ROMFiler  for BBC B/B+/M +SRAM : (7 2 >&1200 reloc < =&7400 F control% 17,name% 80 Posfile=&FFDD Zp%=&8000-&3400 d n x=01 x&141;(8);"Acorn User ROMFiler": 28,0,23,39,4 "Write-enable your RAM."' &:"RAM socket: "bk:bk>=0 bk<16 ass:C%=0  x=crc (read-1):C%=C%+?x : C%<>5782 err("CRC") !!&8B=&70:?&8F=check-&70: crc x=!&8D &FFFF  x<>26070 err("INPUT") !&8B=read:?&8F=P%-read: crc x=!&8D &FFFF s,v:s=bk v<>x err("READ/WRITE") helptext$=" To load any program from sideways"+13+" RAM, type *ROM"+13+" then LOAD, CHAIN, *LOAD, *RUN, *CAT"+13+" etc. in the normal way"+13 0,8)(134); "Romfile title:"(133); "title$=input(10) ,0,10)(134); 6"8K or 16K RAM?"(133); @x= Jx=56 x=49 Tx ^ x=56 rom=&2000:tPA hx= r x=54 |x  rom=0 x=  x=13: `134"ROM *HELP message:"(133):h2text$=input(20):h2text$="":h2text$="Acorn User ROMFiler" 134"ROM *HELP text:" 4 helptext$=hh$, hh$-3) (134"Give ROMname on *HELP? (Y/N)"; .aa= &DF: aa<>89 aa<>78 aa<>13 dVA >5,8);: aa=89 aa=13 "Yes ":rnam=1 "No ":rnam=0 $ : <>17 a$=::T\B :  romsetup  memleft ' memleft<1 "No memory left":trB  *FX15 0,8)(134); &"Filename:"(133); 0file$=input(20) :C file$,1)="*" oscli(file$):"Press SPACE...";:a$=::TRB D file$="" trB N!oscli("LOAD "+file$+" 3400") X rdaddr bU(134);"Filename to save by:"(133);:file2$=input(10): file2$<>"" file$=file2$ lx=length 256 vx=x-((length 256)<>0) :search=P%+length+(23+(file$))*(1-(x>1))-(x-2)*3*(x>1)  length>memleft TjC  encode  more  x=89 28,0,23,39,4:d~A  '(130); "Press SPACE to save"  =32  equb(43)  save 7  more  x=89 :TDA  *FX18  '"Press BREAK."  TVC  : * length>&3400 D\C 40,8)(129); >"This file is too long." H t^B R: \ f0,9)(129); p!"This file is far too long." z*(129)"You will have to start again." x=  : romsetup  pass=0 2 2  P%=&3400  equw(0)  equb(0)  [OPT pass JMP entry+p% ] equb(&83) equb((title$)+9)  equb(1) equs(title$)  equb(0) $equs("(C) Acorn User") . equb(0) 8 [OPT pass B .entry L CMP #&FE V BEQ v4 ` CMP #9 j BEQ v1 t CMP #13 ~ BEQ v2  CMP #14  BEQ v3 RTS .v1 JMP help1+p% .v2 JMP file+p% .v3 JMP byte+p% .v4 JMP boot+p%  .help1 PHA  LDA (&F2),Y  CMP #13  BNE help2 ( LDX #0 2 .loop1 <LDA message1+p%,X FINX P CMP #0 Z BEQ exit1 d JSR &FFE3 nJMP loop1+p% x .exit1 PLA RTS  .message1 ]  equb(13) equs(h2text$)  equb(13) equs(" ROMFILE")  equb(13)  equb(0)  [OPT pass  .help2 TYA PHA  LDX #0  .loop2 "LDA (&F2),Y , #&DF 6 CMP #&21 @ BCC skip1 JCMP romfile+p%,X T BNE exit2 ^INX hINY rJMP loop2+p% | .skip1 LDA romfile+p%,X  BNE exit2 JMP help3+p%  .exit2 PLA TAY PLA RTS  .romfile ] equs("ROMFILE")  equb(0)  [OPT pass  .help3  LDX #0  .loop3 &LDA message2+p%,X 0INX : CMP #0 D BEQ exit2 N JSR &FFE3 XJMP loop3+p% b .message2 l] v equb(13) equs(h2text$)  equb(13) equs(helptext$) 5 rnam equs(" This ROMFile: "+title$):equb(13)  equb(0)  [OPT pass  .file PHA TYA  #&F  CMP &F4  BCC exit3 LDA #((data+p%) 256)  STA &F6  LDA #((data+p%) 256)  STA &F7  LDA &F4 * #&F 4 STA &F5 >PLA H LDA #0 RRTS \ .exit3 fPLA pRTS z .byte PHA  LDA &F5  #&F  CMP &F4  BNE exit3  LDY #0 LDA (&F6),Y TAY  INC &F6  BNE skip2  INC &F7  .skip2 PLA  LDA #0 RTS  .boot $PHA .TYA 8PHA B\CPY #&FF:\BEQ exit4 L LDY #0 V .loop4 `LDA message3+p%,Y j BEQ exit4 t JSR &FFE3 ~INY JMP loop4+p% .message3 ] equs("ROMFile:") equb(134) equs(title$) equb(13) equb(0) [OPT pass .exit4 PLA TAY PLA RTS  .data ] (?&8F=((data-&3400)/256)+1 2!&8B=&34008000 < ?&89=0 F write P P%=P%+p% Z d: n ass x P%=&70 [OPT 0 .input CLC LDA #0 TAX STX &8B LDX #&C STX &8C LDX #32 STX &8E LDX #127 STX &8F TAY  LDX #&8B  JSR &FFF1 RTS " .check ,] 6: @ pass=0 2 2 J P%=&900 T [OPT pass ^.crc hCLC r LDA #0 | STA &8E STA &8D TAY .loop1 LDA &8E (&8B),Y STA &8E LDX #8 .loop2 LDA &8E ROL A BCC skip LDA &8E  #8  STA &8E  LDA &8D  #16 & STA &8D 0 .skip : ROL &8D D ROL &8E NDEX X BNE loop2 bINY l CPY &8F v BNE loop1 RTS .read LDA #&80 STA &8E LDA #&34 STA &8C LDY #0 STY &8D STY &8B STY &89 .write LDY #0 LDA &F4 PHA LDA #bk  STA &FE30 LDX &8F * .loop3 4LDA (&8D),Y >STA (&8B),Y HINY R CPY &89 \ BNE loop3 f INC &8C p INC &8E zDEX BNE loop3 PLA STA &FE30 RTS ]  : ݤinput(x) x+1,(9))(124); x+2,(8))(124); ?&8D=x &70 =$&C00 :  memleft x=&C000-P%-rom-30 $c x<257 memleft=x x=x-30: x<513 memleft=x memleft=x-((x-512) 259)*3+(((x-512) 259)<>0)*3 . 8'(6)(131); B"Maximum file length=&"; L;~memleft V28,0,23,39,8 ` j: t encode ~@%=6 block=0:address=&3400 flag=0:blen=256 % length<257 blen=length:flag=&80  header 0,10)(131); file$~block ?&89=blen:?&8F=1:!&8B=P% ?&8D=address 256 ?&8E=address 256  write !&8B=address:?&8F=blen  crc hcrc=?&8E:lcrc=?&8D  P%=P%+blen address=address+blen length=length-blen (block=block+1 2equb(hcrc) <equb(lcrc) F' flag=&80 @%=5:14,10)~!&2F8:7: P length<257 t\N Z equb(35) d tpN n: x hblock  equb(42) equs(file$)  equb(0) equd(load) equd(exec) equw(block) equw(blen) equb(flag) equd(search)  :  header x=P%:P%=&980  hblock !&8B=&981:?&8F=P%-&981  crc "hcrc=?&8E:lcrc=?&8D:P%=x , hblock 6equb(hcrc) @equb(lcrc) J T: ^ save h?&8F=((P%-&8000)/256)+1 r read |28,0,23,39,4  0,8)(134); ("Name to save by: ";:tt$=input(20) "Saving ";tt$ Boscli("SAVE "+tt$+" 3400+"+~(P%-&8000)+" FFFFD9CD FFFF8000") x=+300::x<   equb(n)  setequ ?&89=1:?&9F0=n  write  P%=P%+1  :  equw(n)  setequ &?&89=2:!&9F0=n 0: : write D P%=P%+2 N X: b equd(n) l setequ v?&89=4:!&9F0=n  write  P%=P%+4  : equs(n$)  setequ ?&89= n$:$&9F0=n$  write P%=P%+ n$  : oscli(n$)  n$ :   :  more *0,12)(134); 4"Any more? "(133); > x= Hx=(x &20)-32 R x=89 x=78 \x f p: z setequ #?&8F=1:!&8B=P%:?&8D=&F0:?&8E=&9  :  err(n$)  $'"There is an error in the ";n$ #"routine. Please check again."  : :  check "!&8B=&3400:?&8F=message2-&3400  crc x=!&8D &FFFF  x<>42307 err("SETUP") "!&8B=message2:?&8F=P%-message2 $ crc .x=!&8D &FFFF 8 x<>1569 err("SETUP") B:'"Code is correct." L V: ` rdaddr j!control%=name% t$name%=file$ ~X%=control% Y%=control% 256 A%=5: osfile length=control%!10 load=control%!2 exec=control%!6  :  reloc !"Relocating... Please wait."  X%=0 P- 4 X%!&1200=X%!   =&1200  *K.0 OLD|MRUN|M *FX138,0,128  (: 2" 0,2644,1,7986,2,8344,3,13822 <% 4,24524,5,19114,6,29952,7,24678 F' 8,41316,9,46082,10,35752,11,40654 P) 12,62716,13,57754,14,56880,15,52054