Service handler for fast ROMFS ============================== J.G.Harston This service handler implements a fast ROMFS handler. When the MOS RFS code requests data from a file's first data block, the service handler takes over and copies the entire file to memory. .Service PHA:CMP #13:BEQ Serv13:CMP #14:BEQ Serv14 .ServQuit PLA:RTS : .Serv13 TYA:EOR #15:CMP &F4:BCC ServQuit :\ Not this ROM LDA &F4:EOR #15:STA &F5 LDA #Data AND 255:STA &F6 :\ Point to start of RFS data LDA #Data DIV 256:STA &F7 BNE ServExit : .Serv14Slow LDA (&F6),Y:TAY:LDA #1:JSR AddPTR :\ Get single byte .ServExit PLA:LDA #0:RTS : .Serv14 LDA &F5:EOR #15:CMP &F4:BNE ServQuit :\ Not this ROM LDY #0 LDA &E2:AND #8:BNE Serv14Slow :\ Cataloging LDA &C2:CMP #4:BNE Serv14Slow :\ Not fetching data block LDA &27A:BPL Serv14lp0 :\ No Tube, with CS from previous CMP LDA &B2:AND &B3:CMP #&FF:PHP :\ CC=Tube, CS=I/O .Serv14lp PLP :\ Get saved Tube/IO flag .Serv14lp0 PHP:BCS Serv14io :\ Save Tube/IO flag, jump if I/O .Serv14tube LDA (&F6),Y:STA &FEE5 :\ Send data to Tube data FIFO JSR Delay:JSR Delay :\ Inter-byte Tube delay INY:CPY &3C8:BNE Serv14tube BEQ Serv14Next .Serv14io LDA (&F6),Y:STA (&B0),Y :\ Copy data directly to memory INY:CPY &3C8:BNE Serv14io .Serv14Next TYA:JSR AddPTR:LDA #2:JSR AddPTR :\ Step past data and CRC LDA &3C9:BEQ Serv14Finished :\ Last block.hi=0, was last block INC &B1:INC &F7 :\ Step to next data block LDA (&F6),Y:CMP #ASC"#":BNE Serv14Last :\ Not short header, last block LDA #1 :\ Step past single header byte .Serv14Next2 JSR AddPTR:BCC Serv14lp :\ Do next data block .Serv14Last INY:LDA (&F6),Y:BNE Serv14Last :\ Step past filename TYA:CLC:ADC #11:TAY:LDA (&F6),Y:STA &3C8:\ Get final block length LDA #0:STA &3C9 :\ Set top byte=0 to flag last block TYA:CLC:ADC #9 :\ Prepare to point to final data block LDY #0:BEQ Serv14Next2 :\ Jump to update pointer and fetch last block .Serv14Finished PLP:STA &BE:STA &BF:STA &C2 :\ CRC=Ok, Progress=Done LDA #&80:STA &BD:STA &3CA :\ b7=last block JMP ServExit .AddPTR CLC:ADC &F6:STA &F6 LDA &F7:ADC #0:STA &F7 .Delay RTS : .Data