AddOsw7F/s - Add RFS OSWORD &7F call to existing ROM : ( A%(4096):: mcode% &40FF 2: < "Source ROM: "rom$ F"LOAD "+rom$+" "+~mcode% POldService=mcode%!4 &FFFF Z?spare%=&4000::spare%=spare%-1:mcode%?spare%<>mcode%?&3FFF d8spare%=spare%+&8001:"ROM space starts at &";~spare% n( spare%>&BE80:"Not enough space": x: zp=&F0 P=0 1 P%=spare%:O%=P%-&8000+mcode% [OPT P*2+4 .Service% #CMP #8:BEQ Serv8:JMP OldService : .Serv8 LDA &EF CMP #&77:BEQ osword77 CMP #&7F:BEQ osword7F .NotMyOsword LDA #8:JMP OldService :  .osword7F  JSR SetSCR "+ LDA &FD8F \ Check DTrap flag ,1 \BPL osw7Fignore \ DTrap off, ignore call 6 .osword77 @ LDY #&00 JK LDA (zp),Y \ Get first byte of parameter block - Drive number T) BPL osw7F_J1 \ Use this drive ^ JSR set10 h0 LDA &FDCB \ Get current DFS drive r STA (zp),Y | .osw7F_J1  LDY #&06  LDA (zp),Y  CMP #&53 0 BEQ osw7F_CMD \ Jump for read sectors  CMP #&4B 1 BEQ osw7F_CMD \ Jump for write sectors .osw7Fignore  LDA #8 ! RTS \ Ignore  .osw7F_CMD  LDY #13 .osw7F_Save 1 LDA &B2,Y \ Save some ZP workspace  PHA 1 LDA (zp),Y \ And copy control block & STA &B2,Y 0 DEY : BPL osw7F_Save D LDA &027A N BMI osw7F_TubeOk X LDA #&FF b> STA &B5 \ No Tube, force address to &FFFFxxxx l STA &B6 v.osw7F_TubeOk  LDA &BB  #31 3 STA &BB \ Remove sector size flags  \ &F0/1 => control block \ &B2 = drive \ &B3-6 = address  \ &B7 !\ &B8 = command, &4B or &53 \ &B9 = track \ &BA = sector \ &BB = count   LDX &B9 \ Track  ! LDY &BA \ Sector  LDA &B2 \ Drive  #&03 * ASL A 4 ASL A >, STA &BA \ RAMAddr=&0400*drv H TYA R A #&10 \6 STA &B9 \ RAMAddr=&0400*drv+sec+&0010 f, INX \ Balance first DEX p BNE osw7F_T10b z .osw7F_Times10 6 LDA &B9 \ RAMAddr=drivestart+10*track  CLC  ADC #&0A  STA &B9  LDA &BA  ADC #0  STA &BA .osw7F_T10b  DEX  BNE osw7F_Times10  \ &B3-6 = address !\ &B8 = command, &4B or &53 \ &B9-A = RAMCard address \ &BB = count $ ./ LDA &B8 \ Command &4B or &53 83 \ %01001011 or %01010011 B3 LSR A \ %00100101 or %00101001 L3 LSR A \ %00010010 or %00010100 V3 LSR A \ %00001001 or %00001010 `3 LSR A \ %00000100 or %00000101 j7 #&01 \ b0=0 for save, b0=1 for load t& A #&80 \ Flag 'I/O' ~ PHA  LDA &B5  &B6  CMP #&FF  BEQ osw7F_NoTube .osw7F_Claim 3 LDA #&CF \ Claim ID=&0F for RAMFS  JSR &406 / BCC osw7F_Claim \ Loop until claimed - LDX #&B3 \ XY=>Tube address  LDY #&00 / PLA \ Get direction byte & #&01 \ Flag 'Tube'  PHA  3 JSR &406 \ Initiate Tube transfer .osw7F_NoTube  (\ Stacked flag byte means 2!\ &00 Save from Tube to RAMFS  LDY #10 H LDA #0 R6 STA (zp),Y \ Return value = &00 for Ok \.TubeDelay f RTS p z   .set10  LDA #&10  .SetDFS  #7  BNE SetWS  .SetSCR  LDA #&0F  .SetWS  STA &FCFF  LDA #0  STA &FCFE  RTS  ] +mcode%?4=Service%:mcode%?5=Service%256 $7"*Save ";rom$;"7F ";~mcode%;" ";~O%;" 0 FFFBBC00"