10
20
30 :
40 mcode%=&FFFF0900
50 OSWRCH=&FFEE:OSNEWL=&FFE7
60 :
70 Lptr=&A8:Addr=&AA
80 :
90 FOR P=0 TO 1
100 P%=mcode%
110 [OPT P*3
120 .Text
130 EQUS "BAS":BRK
140 EQUS "M/C":BRK
150 :
160 .start%
170 LDA &F4:PHA
180 LDX #Lptr:LDY #0:LDA #1:JSR &FFDA
190 LDA (Lptr),Y:CMP #13:BNE GetHex
200 LDX #15:.RomLoop
210 TXA:PHA:JSR DoRom
220 PLA:TAX:DEX:BPL RomLoop:BMI Finished
230 .GetHex
240 CMP #ASC"A":BCC GetHex2:AND #&DF:SBC #7
250 .GetHex2:AND #15:JSR DoRom
260 .Finished
270 PLA
280 .SelectRom
290 STA &F4:STA &FE30
300 .Empty
310 RTS
320 :
330 .DoRom
340 JSR SelectRom
350 LDA &8004:STA Addr:LDA &8005:STA Addr+1
360 LDY #0:LDA (Addr),Y:CMP #&18:BNE Empty
370 LDY #6:LDA (Addr),Y:TAX
380 DEY:LDA (Addr),Y:STA Addr:STX Addr+1:\ Point to start of list
390 \ Print ROM title
400 LDA &F4:JSR PrHex:JSR PrSpace
410 LDX #0:.TitleLoop
420 LDA &8009,X:BEQ TitleEnd
430 JSR OSWRCH:INX:BNE TitleLoop
440 .TitleEnd
450 LDA #ASC":":JSR OSWRCH
460 JSR OSNEWL
470 .Loop0
480 LDY #0
490 .Loop1
500 LDA (Addr),Y:BEQ ListEnd:BMI NameEnd
510 JSR OSWRCH:INY:BNE Loop1
520 .NameEnd
530 PHA:TYA:SEC:ADC Addr:STA Addr
540 LDA Addr+1:STA Addr+1:LDA #32
550 .Loop2
560 JSR OSWRCH:INY:CPY #12:BCC Loop2
570 PLA:AND #1:ASL A:ASL A:TAX:JSR PrMess
580 JSR Pr2Space:LDY #3:JSR PrThisHex
590 JSR Pr2Space:LDY #5:JSR PrThisHex
600 JSR Pr2Space:LDY #0:LDA (Addr),Y:SEC:SBC Addr:TAX
610 INY:LDA (Addr),Y:SBC Addr+1:TAY
620 TXA:SEC:SBC #6:TAX:TYA:SBC #0:JSR PrHex:TXA:JSR PrHex
630 JSR OSNEWL:LDY #0:LDA (Addr),Y:TAX
640 INY:LDA (Addr),Y:STA Addr+1:STX Addr
650 BNE Loop0
660 .ListEnd
670 .PrMessEnd
680 RTS
690 :
700 .PrMess
710 LDA Text,X:BEQ PrMessEnd
720 JSR OSWRCH:INX:BNE PrMess
730 :
740 .PrThisHex
750 LDA (Addr),Y:JSR PrHex
760 DEY:LDA (Addr),Y
770 :
780 .PrHex
790 PHA:LSR A:LSR A:LSR A:LSR A
800 JSR PrNybble:PLA
810 .PrNybble
820 AND #15:CMP #10:BCC PrDigit
830 ADC #6:.PrDigit:ADC #48
840 JMP OSWRCH
850 :
860 .Pr2Space
870 LDA #32:JSR OSWRCH
880 .PrSpace
890 LDA #32:JMP OSWRCH
900 :
910 ]NEXT
920 PRINT"*SAVE RList ";~mcode%;" ";~P%;" ";~start%OR&FFFF0000