Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2345

programming • Re: Is it possible to reload the DFS into &E00 after overwriting?

$
0
0
There is a disassembly of 1770 DFS at: http://regregex.bbcmicro.net/dfs224.asm.txt

Thinking aloud, here, there are three ROM service calls that may be interesting:

&03 - boot filing system (pmsg in the disassembly).
&04 - unknown OS command (for *DISC) (chkcom in the disassembly)
&12 - initialise filing system (inifsy in the disassembly).

The *DISC command goes to the label 'init' in the disassembly. The service call to start a filing system is handled by this:

Code:

.inifsy                                 ;Service call $12 = initialise FS            JSR     savita            CPY     #$04                ;if number of FS to initialise = 4            BEQ     init                ;then initialise DFS            RTS                         ;else exit
so this ends up at the same place as *DISC. The "boot" entry is more interesting, and immediately next in the ROM:

Code:

.pmsg                                   ;Service call $03 = boot filing system            JSR     savita            STY     itemp               ;save boot flag in scratch space            LDA     #$7A                ;call OSBYTE $7A = scan keyboard from $10+            JSR     osbyte            TXA                         ;test returned key code            BMI     L9B54               ;if N=1 no key is pressed, so init and boot            CMP     #$32                ;else if key pressed is D            BEQ     L9B4F               ;then register keypress, init and boot            CMP     #$61                ;else if key pressed is not Z            BNE     L9B0E               ;then exit            JSR     LA9FB               ;else set up i8271/MOS 1.20 emulation:.L9B4F            LDA     #$78                ;OSBYTE $78 = write keys pressed information            JSR     osbyte.L9B54            LDA     itemp               ;a=boot flag passed to service call            JSR     vstrng            EQUS    "Acorn 1770 DFS"            EQUB    $0D            EQUB    $0D                 ;iff A=0 then force cold start, enable bootIF _NMOS            BCC     sinit0              ;branch alwaysELSE            BRA     sinit0              ;65C02 instructionENDIF
Next we have code reach from various of the above:

Code:

.init            LDA     #$FF                ;$FF = allow warm start, disable boot.sinit0            JSR     wopa                ;have A=0 returned on exit.L9B70            PHA                         ;save cold start flag            LDA     #$06                ;FSC  6 = new filing system starting up            JSR     osfscm              ;issue Filing System call            LDA     fdcdat            LDX     #$0D                ;7 vectors to replace:.init0            LDA     vtabb,X             ;copy addresses of extended vector handlers            STA     vtab2,X             ;to FILEV,ARGSV,BGETV,BPUTV,GBPBV,FINDV,FSCV            DEX                         ;loop until 7 vectors transferred            BPL     init0            LDA     #$A8                ;call OSBYTE $A8 = get ext. vector table addr            JSR     readby            STX     temp+$00            ;set up pointer to vector table            STY     temp+$01            LDX     #$07                ;7 vectors to transfer            LDY     #$1B                ;y = $1B = offset of FILEV in extended vector table:.init1            LDA     vtabf-$1B,Y         ;get LSB action address from table            STA     (temp),Y            ;store in extended vector table            INY            LDA     vtabf-$1B,Y         ;get MSB action address from table            STA     (temp),Y            ;store in extended vector table            INY            LDA     romid               ;get our ROM slot number            STA     (temp),Y            ;store in extended vector table            INY            DEX                         ;loop until 7 vectors transferred            BNE     init1            STY     catdrv              ;no catalogue in workspace            STY     olddrv              ;redundant            STX     fdrive              ;[D]current drive = 0            LDA     #$FF            STA     LC287               ;both drives uncalibrated            LDY     #$03.L9BB4            STA     LC28B,Y             ;clear bad tracks, $FF = rogue value            DEY            BPL     L9BB4            LDX     #$0F                ;service call $0F = vectors claimed            JSR     doswcl              ;call OSBYTE $8F = issue service call            JSR     suspri              ;set up pointer to private page            LDY     #colds-mainws       ;test cold start flag in private page            LDA     (temp),Y            BPL     initcl              ;if b7=0 then force a cold start            PLA                         ;else test cold start flag passed to us            PHA            BEQ     initcl              ;if =$00 then force a cold start            LDY     #memflg             ;else test shared workspace possession flag            LDA     (temp),Y            BMI     bootit              ;if b7=1 then we have the workspace, proceed to boot            JSR     getmem              ;else issue service call $0A to claim the workspace            LDY     #$00                ;offset into private page = $00....
So all routines to starting DFS seem to end up at the label sinit0. *DISC and the ROM service call to start a filing system set A to &FF to attempt a warm start. The filing system boot call (&03) sets this according to whether the OS says it should attempt to use the !BOOT file and what keys are pressed.

Even if DFS is asked to do a warm start, there is this bit:

Code:

            LDY     #colds-mainws       ;test cold start flag in private page            LDA     (temp),Y            BPL     initcl              ;if b7=0 then force a cold start
So if DFS has saved things in its private workspace to enable a warm start it sets this flag. If there is something else there, there is a chance that this flag will be clear (bit 7 not set) in which case DFS will do a cold start anyway. It looks like there are three ways to make sure, though:

1. Find the DFS private workspace from the table the OS keeps, then use the correct offset (from the source/disassembly) to set this byte to zero.
2. Assume DFS is the only ROM that has private workspace and that nothing else has increased the size of the shared workspace and hard code that address.
3. Clear (set to zero) all memory between &0E00 and the proper value of OSHWM.

Statistics: Posted by Coeus — Wed Jan 22, 2025 8:53 pm



Viewing all articles
Browse latest Browse all 2345

Trending Articles