> ROMBasic 1.01 0 Put BASIC program into sideways ROM module " 1.00 05-Feb-2016 J.G.Harston (2 1.01 27-Jan-2024 Workaround for pre-BASIC IV 2: < S% 500:T%=S% F "BASIC file: "in$ P "Output ROM file: "fname$ Z "Command name: "cmd$ d "Version string: "ver$ n! "Copyright string: (C)"cpy$ x1p(in$):p(fname$):p(cmd$):p(ver$):p(cpy$) ;: S% T%-S%:assem(0):: S% T%-S%:assem(2):sm_table FA$="*SAVE "+fname$+" "+~(mcode%+M%)+" "+~O%+" FFFF0000 FFFBBC00" A$;:A$:  : !p(A$):$T%=A$:T%=T%+$T%+1: ݤg:B%=T%:T%=T%+$T%+1:=$B% assem(pass%) 2T%=S%:in$=g:fname$=g:cmd$=g:ver$=g:cpy$=g JSR OSNEWL:LDX #0  .Serv9Lp 0LDA RomTitle+1,X :\ Print ROM title 3BNE P%+4:LDA #" " :\ Convert &00 to )CMP #"(":BEQ Serv9Done :\ End at '(' JSR OSWRCH:INX:BNE Serv9Lp .Serv9Done JSR OSNEWL .Serv9Skip  LDA #9 & .NotServ9 0RTS :: D .Serv4 N8LDA &27A:BNE Serv4Exit :\ Tube present, ignore XTYA:PHA:DEY:LDX #&FF b .Serv4Lp lINX:INY:LDA (&F2),Y vCMP #".":BEQ Serv4Dot CMP #"!":BCC Serv4End 8CMP RomTitle+1,X:BEQ Serv4Lp :\ Match with ROM title - #&20 :\ Change case 8CMP RomTitle+1,X:BEQ Serv4Lp :\ Match with ROM title .Serv4Quit -PLA:TAY :\ Restore Y .Serv4Exit BLDA #4:RTS :\ Restore A and return unclaimed  .Serv4End "LDA RomTitle+1,X:BNE Serv4Quit DEY  .Serv4Dot 1INY :\ Step past '.' :  LDX #&FF  .TreeLp1  FINX:LDA RomTitle+1,X :\ Copy command name to string buffer *STA &600,X:BNE TreeLp1 4 .TreeLp2 >3LDA (&F2),Y:STA &600,X :\ Copy parameters HINY:INX:CMP #13:BNE TreeLp2 R'LDA #22:JSR OSWRCH :\ 7 \LDA #7:JSR OSWRCH fLDA #&83:JSR OSBYTE pSTX &A8:STY &A9:LDY #3 z .TreeLp3 LDA src-1,Y:STA &A9,Y DEY:BNE TreeLp3  .TreeLp4 LDA (&AA),Y:STA (&A8),Y INY:BNE TreeLp4 INC &A9:INC &AB DEC &AC:BNE TreeLp4 !SEI:LDA #15:LDX #0:JSR OSBYTE  LDX #6  .TreeLp5  TXA:PHA LDA Basic,X:STA &100,X LDY Text,X LDX #0:LDA #138:JSR OSBYTE PLA:TAX:DEX:BPL TreeLp5  CLI:LDX #0:LDY #1:JMP OS_CLI $ .Text .EQUS 13+"NUR"+13+".O" 8 .Basic BEQUS "BASIC"+13 L: V.src `#EQUW src+3:EQUB (size%+255)256 j .file t] ~9 O%+size%L%:"Code overrun": ="4646",pass%+1,1) : sm_table >base80%=mcode%+M%:base81%=mcode%:byte%=0:count%=0:off%=0:  Pbyte80%=base80%?off%:byte81%=base81%?off%: off%>=M%:byte80%=&80:byte81%=&80 [ ((byte81%-byte80%) &FE)<>0: "ERROR: Offset by more than one page at &";~&8000+off% M (byte80% &C0)=&80:byte%=byte%2+128*(byte81%-byte80%):count%=count%+1 (1 count%=8:?O%=byte%:O%=O%+1:byte%=0:count%=0 2$off%=off%+1:off%>=M% count%=0 <