> VDFS05/S > Source for Virtual DFS ROM for WSS 6502Em emulator traps  ( v0.01 MRB: Original 2 v0.02 SPROW: Sprow update < v0.03 JGH: Major tidy-up FD v0.04 JGH: Rearranged into separate ROM and Filing System code PK Added FSClaim, fuller help, better *CAT plus *EX and *INFO Z& Added Osword7F veneer dH v0.05 JGH: Works better on Master, merged *command search routines nK *INFO checks for Not Found, pre-test for ignored *commands xF Claims/releases NMIs, *EX/*INFO shows date if present C Checks if host present, *INFO claims NMI workspace : 7OS_CLI=&FFF7:OSBYTE=&FFF4:OSWORD=&FFF1:OSWRCH=&FFEE 7OSASCI=&FFE3:OSGBPB=&FFD1:OSNEWL=&FFE7:OSFILE=&FFDD :  mcode% &B00, L% -1 P=01 P%=&8000:O%=mcode% [OPT P*3+4 .ROMStart :EQUS "MRB" :\ No language entry 6JMP Service :\ Service entry 'EQUB &82:EQUB ROMCopyright-ROMStart .ROMVersion  EQUB &05  .ROMTitle "7EQUS "Virtual DFS":EQUB 0:EQUS "0.05 (01 Oct 2016)" ,.ROMCopyright 63EQUB 0:EQUS "(C)1995 MRB, 2004,2016 JGH":EQUB 0 @: J .Service T7PHA:TYA:PHA :\ Save registers ^;TSX:LDA &0102,X :\ Get service number h3CMP #&03:BNE P%+5:JMP ServFSStart :\ FS startup r1CMP #&04:BNE P%+5:JMP ServCommand :\ *command |/CMP #&08:BNE P%+5:JMP ServOsword :\ OSWORD .CMP #&09:BNE P%+5:JMP ServHelp :\ *Help ?CMP #&12:BNE P%+5:JMP ServFSSelect:\ Select a filing system 8CMP #&25:BNE P%+5:JMP ServFSInfo :\ Request FS info  .ServExit 2PLA:TAY :\ Restore Y .ServExitY JPLA:RTS :\ Restore service number and return .ServClaim ?PLA:PLA :\ Drop stacked registers DLDA #0:RTS :\ Exit with A=0 to claim call : !\ =========================== !\ ROM Administration Routines !\ =========================== 5.PrROMTitleNL :\ Print NL, ROM title JSR OSNEWL &1.PrROMTitle :\ Print ROM title 0 LDX #0 : .PrRTLp DLDA ROMTitle,X:BEQ PrRTDone NJSR OSWRCH:INX:BNE PrRTLp X .PrRTDone bRTS l.PrROMVersion vJSR PrSpace:INX  .PrRVLp )LDA ROMTitle,X:CMP #"!":BCC PrRVDone JSR OSWRCH:INX:BNE PrRVLp  .PrRVDone JMP OSNEWL : \ ------------ \ ROM Commands \ ------------ .ServCommand 6PLA:TAY:PLA:LDX #&00 :\ X=>ROM command table : \ --------------- \ *command lookup  \ --------------- .CmdSearch  9PHA:TYA:PHA :\ Save A and text offset *.CmdLookNext 47PLA:PHA:TAY :\ Get text offset back >.CmdLookLp H(LDA (&F2),Y:CMP #&2E:BEQ CmdMatchDot R+ #&DF:CMP CommandBase,X:BNE CmdNoMatch \INX:INY:LDA CommandBase,X f5CMP #&0D:BNE CmdLookLp :\ Not a full command p:LDA (&F2),Y :\ Get following character zCCMP #"A":BCS CmdCheckNext:\ Ensure command ends with non-alpha 9DEY :\ Prepare to skip spaces .CmdFoundSpc 7INY:LDA (&F2),Y :\ Move past any spaces CMP #" ":BEQ CmdFoundSpc 6LDA CommandBase+1,X:STA &B0 :\ Get command address LDA CommandBase+2,X:STA &B1 7JSR JumpB0 :\ Call command routine APLA:PLA:LDA #0:RTS :\ Drop saved A,Y, return claimed .CmdMatchDot INX:LDA CommandBase,X :CMP #&0D:BNE CmdMatchDot :\ Find end of table entry 8BEQ CmdFoundSpc :\ Jump to enter command .CmdNoMatch LDA CommandBase,X:INX :CMP #&0D:BNE CmdNoMatch :\ Find end of table entry .CmdCheckNext $INX:INX:LDA CommandBase,X .>BNE CmdLookNext :\ Loop until terminator found 8 .CmdQuit B>PLA:TAY:PLA:RTS :\ Restore A,Y, exit unclaimed L: V\ ----------------- `\ ROM Command Table j\ ----------------- t.CommandBase ~.ROMCommands \ Filing system selection $EQUS "DISC" :EQUB 13:EQUW disc $EQUS "DISK" :EQUB 13:EQUW disk $EQUS "ADFS" :EQUB 13:EQUW adfs %EQUS "FADFS" :EQUB 13:EQUW fadfs $EQUS "VDFS" :EQUB 13:EQUW vdfs 'EQUS "FSCLAIM":EQUB 13:EQUW fsclaim : \ Utility commands /EQUS "OSW"+("7"&DF)+"F":EQUB 13:EQUW fdc &\EQUS "PAGE" :\EQUB 13:\EQUW page $EQUS "QUIT" :EQUB 13:EQUW quit $EQUS "DESKTOP":EQUB 13:EQUW quit  (\EQUS "SHADOW":\EQUB 13:\EQUW shadow : \ SRAM commands (&EQUS "SRLOAD" :EQUB 13:EQUW srload 2'EQUS "SRWRITE":EQUB 13:EQUW srwrite < EQUB 0 F: P!\ --------------------------- Z!\ Filing System Command Table d!\ --------------------------- n.FSCommands x&EQUS "ACCESS" :EQUB 13:EQUW access $EQUS "BACK" :EQUB 13:EQUW back &EQUS "BACKUP" :EQUB 13:EQUW backup 'EQUS "COMPACT":EQUB 13:EQUW compact $EQUS "COPY" :EQUB 13:EQUW copy &EQUS "DELETE" :EQUB 13:EQUW delete 'EQUS "DESTROY":EQUB 13:EQUW destroy %EQUS "DRIVE" :EQUB 13:EQUW drive &EQUS "ENABLE" :EQUB 13:EQUW enable "EQUS "EX" :EQUB 13:EQUW ex $EQUS "FORM" :EQUB 13:EQUW form $EQUS "FREE" :EQUB 13:EQUW free $EQUS "INFO" :EQUB 13:EQUW info $EQUS "MAP" :EQUB 13:EQUW free %EQUS "MOUNT" :EQUB 13:EQUW mount &EQUS "RENAME" :EQUB 13:EQUW rename %EQUS "TITLE" :EQUB 13:EQUW title "&EQUS "VERIFY" :EQUB 13:EQUW verify ,$EQUS "WIPE" :EQUB 13:EQUW wipe 6 EQUB 0 @: J5]: P%-CommandBase>255:"Command table too big": T[OPT P*3+4 ^(\ ---------------------------------- h\ Detailed help routine r(\ Based on Sprow's code in VDFS 0.02 |(\ ----------------------------------  .ServHelp LDA (&F2),Y BCMP #&0D:BEQ HelpTitle :\ No subject, just print ROM title 6CMP #&2E:BEQ L8514 :\ '.', print full info G #&DF:CMP #&56:BNE L8538:\ Doesn't start with 'V', check for "DFS" @INY:\JMP L8538 :\ Move past 'V', check for "DFS" :  .L8538 DEY:LDX #&FF  .L853B :INX:INY :\ Point to next characters LDA (&F2),Y: #&DF ECMP L854C,X:BEQ L853B :\ If matches "DFS", loop to next char DLDA L854C,X:BEQ L8514 :\ If at end, jump to print full info JMP ServExit : & .L8514 01JSR PrROMTitleNL :\ Print ROM title :JSR PrROMVersion DLDX #ROMCommandHelp 255 N2LDY #ROMCommandHelp 256:\ Point to help text XJSR PrintText:JMP ServExit b.HelpTitle l6JSR PrROMTitleNL :\ Just print ROM title vJSR PrROMVersion JMP ServExit : .PrintText JSTX &F6:STY &F7 :\ Store text pointer in ROMFS text pointer 0LDY #&00:BEQ L8525 :\ Jump into loop  .L8522 /CMP #10:BNE HelpChar :\ LF is soft CR 2LDA &30A:SBC &308 :\ Get window width -CMP #70:BCC HelpNarrow :\ <80 columns ;LDA #" ":BNE HelpChar :\ 80-column mode, print space .HelpNarrow HJSR OSNEWL:JSR PrSpace :\ <80-column mode, print newline+2spaces  .HelpChar JSR OSASCI  .L8525 8LDA (&F6),Y:BEQ L8530 :\ If &00 terminator, end  9INY:BNE L8522 :\ Loop to print character *CINC &F7:BMI L8522 :\ Increment high byte and loop back 4 .L8530 >RTS H: R .L854C \4EQUS "DFS":EQUB 0 :\ *Help match string f: p.ROMCommandHelp z+EQUS "Filing system selection:":EQUB 13 .EQUS " DISK, DISC, ADFS, FADFS :":EQUB 10 )EQUS "Select VDFS if claimed":EQUB 13 .EQUS " VDFS : Select VDFS":EQUB 13 3EQUS " FSCLAIM ON : Claim DISC, ADFS":EQUB 13 5EQUS " FSCLAIM OFF : Release DISC, ADFS":EQUB 13 *EQUS " OSW7F (NONE)() :":EQUB 10 7EQUS "Emulate Osword &7F memory corruption":EQUB 13  EQUB 13 $EQUS "Utility commands:":EQUB 13 8EQUS " QUIT or DESKTOP : return to RISC OS":EQUB 13 4\EQUS " PAGE :\ force PAGE location":\EQUB 13 .\EQUS " SHADOW :\ dummy command":\EQUB 13 2EQUS " SRLOAD
":EQUB 13 7EQUS " SRWRITE ":EQUB 13  EQUB 13 !EQUS "VDFS commands:":EQUB 13 $5EQUS " BACK : return to root directory":EQUB 13 .1EQUS " DRIVE : change current drive":EQUB 13 8(EQUS " MOUNT : mount drive":EQUB 13 B5EQUS " DIR : change current directory":EQUB 13 L3EQUS " LIB : change current library":EQUB 13 V5EQUS " INFO : show info on single file":EQUB 13 `:EQUS " EX : show info on all files in CSD":EQUB 13 j3EQUS " ACCESS, BACKUP, COMPACT, COPY,":EQUB 10 t4EQUS "DESTROY, ENABLE, FORM, FREE, MAP,":EQUB 13 ~2EQUS " RENAME, TITLE, VERIFY, WIPE :":EQUB 10 &EQUS "trapped and ignored":EQUB 13 EQUB 0 : \ -------------------- \ ROM Command routines \ -------------------- .quit 0EQUB &03:EQUB &FF :\ Return to host : .page:.shadow 0\LDA #&00:\RTS :\ Ignore command : 9.srload :EQUB &03:EQUB &D0 :\ Pass to host and return 9.srwrite:EQUB &03:EQUB &D1 :\ Pass to host and return : \ ROM Support Workspace (\ --------------------- 26.PageOffset:EQUB &00 :\ Amount to raise by <: F\ ====================== P\ Filing System Routines Z\ ====================== d\ Filing System Workspace n\ ----------------------- x6.ClaimFS:EQUB &00 :\ *FSCLAIM On/Off flag 4.FSFlag :EQUB &11 :\ FS id when claimed : &\ -------------------------------- &\ Filing system selection commands &\ -------------------------------- .disc:.disk:.adfs <.fadfs:.vdfs :\ On entry, X=4,11,18,26,33 .TXA:LSR A:LSR A:LSR A:TAX :\ X=0,1,2,3,4 ;LDA FSValues,X:TAY :\ Get filing system number 5CPY #9:BCS SelectFS :\ Always select VDFS :BIT ClaimFS:BMI SelectFS :\ If claimed, select VDFS BPLA:PLA:PLA:TAY:PLA:RTS :\ Drop return, restore and return .SelectFS 7LDX #&12:LDA #&8F:JMP OSBYTE:\ Select filing system  .FSValues 3EQUB 4:EQUB 4:EQUB 8 :\ DISC, DISK, ADFS ".EQUB 8:EQUB 17 :\ FADFS, VDFS ,: 6 .fsclaim @LDA (&F2),Y: #&DF JCMP #"O":BNE fsclaimStatus TINY:LDA (&F2),Y: #&DF ^CMP #"N":LDA #0:SBC #0 h #&FF:STA ClaimFS:RTS r.fsclaimStatus |LDA #"O":JSR OSWRCH !LDA ClaimFS: #8:PHP:A #"F" &JSR OSWRCH:PLP:BNE P%+5:JSR OSWRCH JMP OSNEWL : \ -------------------------- \ Filing System Service Code \ -------------------------- .ServFSSelect 'CPY #&11:BEQ FSSelect :\ VDFS NBIT ClaimFS:BPL FSSelectNone:\ If not claimed, don't check for DFS or ADFS -CPY #&04:BEQ FSSelect :\ Select DFS .CPY #&08:BEQ FSSelect :\ Select ADFS .FSSelectNone 1JMP ServExit :\ Exit unclaimed  .FSSelect -TYA:PHA :\ Save FS id &4LDA #&06:JSR FSCCallHost :\ Check host exists 0GJSR CallFSCV :\ Inform current FS new FS taking over :5LDX #0:LDY #&1B :\ Set up new vectors D.ClaimVecLp NTYA:STA &212,X X/LDA #&FF:STA &213,X :\ vector=&FFxx b$LDA VectorTable+0,X:STA &D9F+0,Y l$LDA VectorTable+1,X:STA &D9F+1,Y v0LDA &F4:STA &D9F+2,Y :\ exvec=&RRxxyy INY:INY:INY:INX:INX CPX #&0E:BNE ClaimVecLp CLDA #&8F:LDX #&0F:JSR OSBYTE:\ Notify that vectors have changed .PLA:STA FSFlag :\ Store FS id JMP ServClaim .CallFSCV JMP (&021E) .VectorTable +EQUW File:EQUW Args:EQUW BGet:EQUW BPut EQUW GBPB:EQUW Find:EQUW FSC : '\ --------------------------------- '\ Select FS on BREAK and maybe boot '\ --------------------------------- .ServFSStart  TYA:PHA =LDA #&7A:JSR OSBYTE :\ Check what keys are pressed *&PLA:JMP ServExit :\ Exit H.FSStartGo1 R7LDA #&78:JSR OSBYTE :\ Clear keypressed info \.FSStartGo2 f:JSR PrROMTitle :\ Print filing system name pJSR OSNEWL:JSR OSNEWL z6LDY FSFlag:JSR SelectFS :\ Select filing system APLA:BNE P%+5:JSR HostBoot :\ If booting, get !Boot from host /JMP ServClaim :\ Exit, claimed .HostBoot *EQUB &03:EQUB &D3 :\ Do !Boot : .ServFSInfo LDX #&00 .FSInfoLp LDA L81FB,X:STA (&F2),Y :INY:INX:CPX #44:BNE FSInfoLp:\ Copy filing system name 8PLA:JMP ServExitY :\ Drop saved Y and exit .L81FB .EQUS "DISK ":EQUB &11:EQUB &15:EQUB &04 .EQUS "DISC ":EQUB &11:EQUB &15:EQUB &04 .EQUS "ADFS ":EQUB &30:EQUB &3A:EQUB &08 .EQUS "VDFS ":EQUB &C0:EQUB &FF:EQUB &11 $: .1\ ------------------------------------------- 81\ Pass filing system calls to host and return B1\ ------------------------------------------- L.File :EQUB &03:EQUB &06 V.Args :EQUB &03:EQUB &05 `.BGet :EQUB &03:EQUB &04 j.BPut :EQUB &03:EQUB &03 t.GBPB :EQUB &03:EQUB &02 ~.Find :EQUB &03:EQUB &01 : \ ------------------- \ File System Control \ ------------------- .FSC ;CMP #&08:BEQ FSCDone :\ Jump if *command warning 1CMP #&0A:BNE P%+5:JMP Info :\ Info on a file 4CMP #&09:BNE P%+5:JMP Ex :\ Examine directory 6CMP #&05:BNE P%+5:JMP Cat :\ Catalogue directory .CMP #&04:BEQ FSCmdRun :\ * filename 9CMP #&03:BEQ FSCommandLookup:\ Filing system commands -CMP #&02:BEQ FSCmdRun :\ */filename .FSCCallHost  >EQUB &03:EQUB &00 :\ Pass to emulator and return ILDX #msgNoHost-msgNotFound :\ If we fall through to here, there's no EJMP error :\ host and we've done ASL-A (&00,X) (: 2\ ---------------------- <\ Filing System Commands F\ ---------------------- P.FSCommandLookup ZPHA:TXA:PHA:TYA:PHA dSTX &F2:STY &F3:LDY #0 nLDX #FSCommands-CommandBase x2LDA #3:JSR CmdSearch:CMP #1:\ Cy=done/not done .FSCmdRetry 3PLA:TAY:PLA:TAX:PLA :\ Restore registers BCC FSCDone  .FSCmdRun 9JSR FSCCallHost :\ Pass FSC to host to try %\ On return, A=action, XY=address -\ A=%1xxxxxxx - enter CoPro address, A=ID %\ A=%01xxxxxx - enter I/O address \ A=%001xxxxx - print text \ A=%0001xxxx - reserved 2\ A=%0000xxxx - all done (usually A preserved) \ 2 #&FF:BMI FSCTube :\ Execute CoPro code 2ASL A:BMI FSCJump :\ Execute I/O code ASL A:BPL FSCDone ,JMP PrintText :\ Print text " .FSCTube ,9JSR &406:BCC FSCTube :\ Claim Tube with ID in A 6?LDA #4:JMP &406 :\ Execute code at address at XY @ .FSCJump JSTX &B0:STY &B1 T .JumpB0 ^ JMP (&B0) h: r$\ ------------------------------ |$\ Filing System Command Routines $\ ------------------------------  .F2toXY *TYA:CLC:ADC &F2:TAX:LDA &F3:ADC #0:TAY  .FSCDone RTS : :.drive :EQUB &03:EQUB &D2:\ Pass to host and return :.back :EQUB &03:EQUB &D5:\ Pass to host and return :.mount :EQUB &03:EQUB &D6:\ Pass to host and return /.ex :JSR F2toXY:LDA #&09:JMP CallFSCV /.info :JSR F2toXY:LDA #&0A:JMP CallFSCV /.rename :JSR F2toXY:LDA #&0C:JMP CallFSCV :  .access  .backup  .compact & .copy 0 .delete : .destroy D .enable N .form X .free b .wipe l .title v .verify 0LDA #8:JSR FSCCallHost :\ Probe emulator ?CMP #3:BNE FSCDone :\ If doesn't return A=3, ignore 6PLA:PLA:PLA:PLA:PLA:PLA :\ Drop data from stack :SEC:BCS FSCmdRetry :\ Pass command to emulator : !\ --------------------------- !\ Functions performed locally !\ ---------------------------  .Info 3STX &C0:STY &C1 :\ Perm FS workspace LDA #&80:BNE CatExInfo : .Ex LDA #&40:BNE CatExInfo  : .Cat  LDA #&00 *A.CatExInfo :\ PL=multiple files, NE=full info 4\ &D01 = GBPB block >6\ E, WSS OSGBPB 9 uses control block differently: H\ &D01 = count R\ &D02 = address \"\ &D06 = filename buffer size f\ &D0A = offset p\ &D0E = FILE block z\ &D20 = pathname \ PHA 7LDY #255:JSR ClaimNMI:STY &A0:\ Claim NMI workspace 4LDA #&40:STA &0D00:LDY #0 :\ Null RTI routine  .InfoLp ;LDA (&C0),Y:STA &0D20,Y:INY :\ Copy filename to buffer CPY #&D60-&D20:BCC InfoLp LDA #&00:LDX #&06  .CatInit 9STA &0D07,X:DEX:BPL CatInit :\ Start with first item  .CatLoop 5LDX #&20:STX &0D02:STX &0D0E :\ =>Filename buffer  LDX #&0D:STX &0D03:STX &0D0F PLA:PHA:BMI CatSingleFile  LDX #&FF:STX &0D04:STX &0D05 0LDX #&01:STX &0D01 :\ Fetch one item $6LDX #&D60-&D20:STX &0D06 :\ Filename buffer size .LDX #&01:LDY #&0D 86LDA #&09:JSR OSGBPB :\ Read catalogue entry B2LDA &0D01:BEQ CatDone :\ If no more, exit LLDX #&D5F-&D20 V.CatLoopCR1 `:LDA &D20,X:BNE CatLoopCR2 :\ Check for &00 terminator j5LDA #13:STA &D20,X :\ Change it to a t.CatLoopCR2 ~DEX:BPL CatLoopCR1 .CatSingleFile LDX #&0E:LDY #&0D 9LDA #&05:JSR OSFILE :\ Read info on this entry /TAY:BNE CatFound :\ Y=object type :PLA:PHA:BMI errNotFound :\ Error if *INFO not found  .CatFound 3JSR CatPrint :\ Print object name PLA:PHA:BEQ CatNoInfo TYA:PHA:LDY #3:LDX #5 .CatAddrLp1 TYA:PHA:LDY #4 .CatAddrLp2 LDA &0D0E,X:JSR PrHex  DEX:DEY:BNE CatAddrLp2 JSR PrSpace TXA:CLC:ADC #8:TAX (PLA:TAY:DEY:BNE CatAddrLp1 26PLA:TAY :\ Get object type back <.CatNoInfo FTYA:JSR CatAttrs P4PLA:TAY:BEQ CatNext :\ *CAT, no more info Z@JSR CatDate:JSR OSNEWL :\ *EX/*INFO, print date, newline d .CatNext n/TYA:BMI CatExit :\ *INFO, finish x9PHA:JMP CatLoop :\ Loop back with *CAT/*EX :  .CatDone 8PLA:BNE CatExit :\ *EX, no newline needed .LDA #&86:JSR OSBYTE :\ Get POS,VPOS 3TXA:BEQ CatExit :\ No newline needed JSR OSNEWL  .CatExit :LDY &A0 :\ Relinquish NMI workspace  .ClaimNMI LDX #11:LDA #143:JMP OSBYTE : .errNotFound JSR CatExit:LDX #0  .error  LDY #0  .errLp "*INX:INY:LDA msgNotFound-1,X:STA &100,Y , BNE errLp 6STA &100:JMP &100 @1.msgNotFound:EQUB 214:EQUS "Not found":EQUB 0 J/.msgNoHost :EQUB 248:EQUS "No host":EQUB 0 T: ^ .CatPrint h0TYA:PHA:LDA #0:TAX:TAY:PHA :\ Print leafname r.CatPrtLp1 |*LDA &D20,Y:INY:CMP #".":BNE CatPrtLp2 PLA:TYA:PHA:LDA #"." .CatPrtLp2 #CMP #"!":BCS CatPrtLp1:PLA:TAY .CatPrtLp3 &LDA &0D20,Y:CMP #" ":BCC CatPrPop ,JSR OSWRCH:INY:INX:CPX #12:BNE CatPrtLp3  .CatPrPop  PLA:TAY  .CatPrSpc  LDA #" "  .CatPrLp4 JSR OSWRCH:INX >CPX #13:BCC CatPrLp4 :\ Print spaces until column 13 .CatCharNone RTS : & .CatAttrs 0LDX #7:LDY #8 :$ #2:BEQ P%+5:JSR CatCharD:\ 'D' D&LDY #3:LDA #&08:JSR CatChar :\ 'L' N&LDY #1:LDA #&02:JSR CatChar :\ 'W' X&LDY #0:LDA #&01:JSR CatChar :\ 'R' bBNE CatAttrs2 l&LDY #2:LDA #&04:JSR CatChar :\ 'E' v&.CatAttrs2:JSR PrSlash :\ '\' &LDY #5:LDA #&20:JSR CatChar :\ 'w' &LDY #4:LDA #&10:JSR CatChar :\ 'r' BNE CatAttrs3 &LDY #6:LDA #&40:JSR CatChar :\ 'e' .CatAttrs3:JMP CatPrSpc :  .CatChar BIT &0D1C:BEQ CatCharNone  .CatCharD %LDA CatAttrChars,Y:INX:JMP OSWRCH .CatAttrChars EQUS "RWELrwePD" :  .CatDate  ,LDA &D1D:BEQ CatCharNone :\ No date PHA:LDX #9:JSR CatPrSpc:PLA  & #31:JSR PrDec:JSR PrSlash :\ Day *(LDA &D1E: #15:JSR PrDec :\ Month 4/JSR PrSlash:LDA &D1E:LSR A :\ Year b0-b3 >6LSR A:LSR A: &D1D: #&1E :\ Merge with year b4-b6 H &D1D:LSR A:PHA:CMP #19 R6LDA #20:SBC #0:JSR PrDec :\ Calculate century \3PLA:SEC:SBC #19:BCS PrDec :\ Calculate year f ADC #100 p: z .PrDec TAX:LDA #&99:SED:.PrDecLp "CLC:ADC #1:DEX:BPL PrDecLp:CLD :  .PrHex PHA:LSR A:LSR A:LSR A:LSR A JSR PrNyb:PLA: #15:.PrNyb SED:CLC:ADC #&90:ADC #&40 CLD:JMP OSWRCH : !.PrSpace:LDA #" ":JMP OSWRCH !.PrSlash:LDA #"/":JMP OSWRCH : : \ ================ \ OSWORD emulation \ ================ $.fdc .%LDA (&F2),Y:CMP #13:BEQ fdcstatus 8 #&DF BCMP #"A":BEQ fdcAcorn LCMP #"W":BEQ fdcWatford VLDA #3:BNE fdcSet `.fdcWatford jINY t .fdcAcorn ~$INY:PHA:LDA (&F2),Y: #7:STA &B0 !PLA: #16:LSR A:LSR A:ADC &B0 ':\ A=0/1/2/3 = A090/A120/A210/ALL (:\ A=5/7/8/9 = W110/W130/W14x/W154  .fdcSet ASL A:ASL A:ASL A -CLC:ADC #Osw7FTable 255:STA Osw7FAddr+0 0LDA #0:ADC #Osw7FTable 256:STA Osw7FAddr+1  .fdcstEnd RTS : .fdcstatus JSR fdcFetchAddr:LDY #2  .fdcstLp1  LDA (&B0),Y:BEQ fdcstName JSR OSASCI:INY:BNE fdcstLp1 .fdcstName (JSR fdcFetchPtr 2LDA (&B0),Y:BEQ fdcstDone <LDA #":":JSR OSWRCH FJMP fdcSpace P .fdcstLp2 ZLDA (&B0),Y:BEQ fdcstDone dPHA:LDA #"&":JSR OSWRCH nLDA #&10:JSR PrHex xPLA:JSR PrHex:INY  .fdcSpace 'JSR PrSpace:JSR PrSpace:JSR PrSpace JMP fdcstLp2 .fdcstDone JMP OSNEWL : .fdcFetchAddr LDA Osw7FAddr+0:STA &B0 LDA Osw7FAddr+1:STA &B1 RTS : .fdcFetchPtr LDY #0:LDA (&B0),Y:PHA INY:LDA (&B0),Y:STA &B1 PLA:STA &B0:DEY RTS ": ,.ServOsword 65LDA &EF:CMP #127 :\ Check OSWORD number @EBNE P%+5:JSR Osword7F :\ If FM disk access, play with memory J3PLA:TAY:PLA :\ Restore registers TIEQUB &03:EQUB &40 :\ Pass OSWORD call to emulator and return ^: hC\ ------------------------------------------------------------- rC\ Corrupt bits of memory to simulate effects of real OSWORD &7F |C\ -------------------------------------------------------------  .Osword7F JLDA &B0:PHA:LDA &B1:PHA :\ Code calling Osword7F may be using &B0/1 JSR fdcFetchAddr JSR fdcFetchPtr  .Osw7FLp !LDA (&B0),Y:BEQ Osw7FDone:TAX & &1000,X:ROL A: #&23:STA &1000,X INY:BNE Osw7FLp .Osw7FDone >PLA:STA &B1:PLA:STA &B0 :\ A,X,Y preserved outside here RTS : .Osw7FAddr :EQUW Osw7FTableNone :\ Pointer to address table : .Osw7FTable &.EQUW Osw7FAcorn1:EQUS "A090":EQUB 0:EQUB 0 0.EQUW Osw7FAcorn1:EQUS "A120":EQUB 0:EQUB 1 :.EQUW Osw7FAcorn2:EQUS "A210":EQUB 0:EQUB 2 D.Osw7FTableNone N-EQUW Osw7FNone :EQUS "NONE":EQUB 0:EQUB 3 X-EQUW Osw7FAll :EQUS "ALL ":EQUB 0:EQUB 4 b-EQUW Osw7FWatf :EQUS "W110":EQUB 0:EQUB 5 l-EQUW Osw7FWatf :EQUS "W120":EQUB 0:EQUB 6 v-EQUW Osw7FWatf :EQUS "W130":EQUB 0:EQUB 7 -EQUW Osw7FWatf :EQUS "W14x":EQUB 0:EQUB 8 -EQUW Osw7FWat5 :EQUS "W15x":EQUB 0:EQUB 9 .Osw7FNone  EQUB 0 : =.Osw7FAcorn1:\ Locations corrupted by Acorn DFS 0.90/1.20 9EQUB &72:EQUB &73:EQUB &74:EQUB &75:EQUB &80:EQUB &82 9EQUB &83:EQUB &85:EQUB &C8:EQUB &C9:EQUB &D3:EQUB &D5 EQUB &D6:EQUB 0 : =.Osw7FAcorn2:\ Locations corrupted by Acorn DFS 2.10/2.20 9EQUB &87:EQUB &88:EQUB &89:EQUB &8B:EQUB &8C:EQUB &8D 9EQUB &8E:EQUB &D3:EQUB &D6:EQUB &DE:EQUB &DF:EQUB &E0 EQUB &E1:EQUB 0  : :.Osw7FWatf :\ Locations corrupted by Watford 1.00-1.44  9EQUB &42:EQUB &43:EQUB &4A:EQUB &78:EQUB &88:EQUB &89 *EQUB &8A:EQUB 0 4: >5.Osw7FWat5 :\ Locations corrupted by Watford 1.54 H9EQUB &30:EQUB &36:EQUB &38:EQUB &3F:EQUB &42:EQUB &43 R9EQUB &4A:EQUB &78:EQUB &88:EQUB &89:EQUB &8A:EQUB &A0 \9EQUB &A1:EQUB &A2:EQUB &A3:EQUB &A4:EQUB &A5:EQUB &A6 f.EQUB &A7:EQUB &A8:EQUB &A9:EQUB &AA:EQUB 0 p: z,.Osw7FAll :\ Composite of all locations 9EQUB &30:EQUB &33:EQUB &36:EQUB &38:EQUB &3F:EQUB &42 9EQUB &43:EQUB &44:EQUB &4A:EQUB &72:EQUB &73:EQUB &74 9EQUB &75:EQUB &78:EQUB &79:EQUB &7A:EQUB &7B:EQUB &80 9EQUB &82:EQUB &83:EQUB &85:EQUB &87:EQUB &88:EQUB &89 9EQUB &8A:EQUB &8B:EQUB &8C:EQUB &8D:EQUB &8E:EQUB &A0 9EQUB &A1:EQUB &A2:EQUB &A3:EQUB &A4:EQUB &A5:EQUB &A6 9EQUB &A7:EQUB &A8:EQUB &A9:EQUB &AA:EQUB &C8:EQUB &C9 9EQUB &D3:EQUB &D5:EQUB &D6:EQUB &DE:EQUB &DF:EQUB &E0 EQUB &E1::EQUB 0 : ]  O%>L%:"Code overflow":  7" *SAVE VDFS05/ROM ";~mcode%;" ";~O%;" 0 FFFBBC00" , &03 opcode calls, also performs a RTS:  &00 FSC $ &01 OSFIND . &02 OSGBPB 8 &03 OSBPUT B &04 OSBGET L &05 OSARGS V &06 OSFILE `: j &40 OSWORD service call t &41 OSBYTE service call ~: ; &80 Read CMOS low level location X, return in Y and A . &81 Write Y to CMOS low level location X < &82 Read EPROM low level location X, return in Y and A / &83 Write Y to EPROM low level location X :  &D0 *SRLOAD  &D1 *SRWRITE  &D2 *DRIVE  &D3 Load/Run/Exec !BOOT  &D4 Does nothing  &D5 *BACK  &D6 *MOUNT :   &FF Quit