10
20
30 :
40 OSRDRM=&FFB9:OSASCI=&FFE3:OSNEWL=&FFE7:OSWRCH=&FFEE
50 DIM mcode% &1000
60 :
70 len%=0:FOR pass%=0 TO 3
80 P%=&8100-128*(pass%AND2)
90 O%=mcode%+len%*(pass%AND2)DIV2
100 opt%=VALMID$("4647",pass%+1,1)
110 [OPT opt%
120 .Start
130 BRK:EQUW RelocTable
140 JMP Serv
150 EQUB &82:EQUB Copy-Start
160 EQUB &00:EQUS "Print Service calls"
170 EQUB &00:EQUS "1.02 (15 Mar 1989)"
180 .Copy
190 EQUB &00:EQUS "(C)JGH":EQUB &00
200 :
210 .Serv
220 PHA:JSR PrHex
230 TXA:PHA:JSR PrHex
240 TYA:PHA:JSR PrHex
250 JSR PrColon:LDX #0
260 .ServLp
270 LDA &EF,X:JSR PrHex
280 INX:CPX #5:BNE ServLp
290 TSX:LDA &103,X
300 CMP #4:BEQ ServStr
310 CMP #9:BEQ ServStr
320 CMP #&18:BEQ ServStr
330 CMP #&28:BEQ ServStr
340 CMP #&29:BEQ ServStr
350 CMP #6:BEQ Serv6
360 CMP #8:BNE ServExit
370 :
380 .Serv8
390 JSR PrArrow:LDY #0
400 .Serv8Lp
410 LDA (&F0),Y:JSR PrHex
420 INY:CPY #16:BNE Serv8Lp
430 BEQ ServExit
440 :
450 .ServStr:\ String passed
460 JSR PrArrow
470 .ServStrLp
480 LDA (&F2),Y:JSR OSASCI
490 INY:CMP #13:BNE ServStrLp
500 BEQ ServExitNL
510 :
520 .Serv6:\ BRK occured
530 JSR PrArrow
540 LDY &28C:TYA:JSR PrHex :\ ROM number
550 JSR PrColon
560 LDA &FD:STA &F6
570 LDA &FE:STA &F7
580 JSR OSRDRM:JSR PrHex:JSR PrColon
590 .Serv6Lp
600 INC &F6:BNE P%+4:INC &F7
610 LDY &28C:JSR OSRDRM :\ Y corrupted pre-Master
620 TAX:BEQ ServExitNL
630 JSR OSWRCH:TAX:BNE Serv6Lp
640 :
650 .ServExit
660 JSR OSNEWL
670 .ServExitNL
680 PLA:TAY:PLA:TAX:PLA:RTS
690 :
700 .PrColon:LDA #ASC":":JMP OSWRCH
710 .PrArrow:LDA #ASC">":JMP OSWRCH
720 :
730 .PrHex
740 PHA:LSR A:LSR A:LSR A:LSR A
750 JSR PrNyb:PLA:.PrNyb
760 AND #15:CMP #10:BCC PrDig
770 ADC #6:.PrDig
780 ADC #48:JMP OSWRCH
790 :
800 .RelocTable
810 ]:len%=RelocTable-Start:NEXT
820 PROCMakeRelocTable
830 PRINT"*SAVE ServROM ";~mcode%+len%;" ";~O%;" 0 FFFBBC00"
840 END
850 :
860 DEFPROCMakeRelocTable
870 base80%=mcode%+len%:base81%=mcode%:byte%=0:count%=0:off%=0:REPEAT
880 byte80%=base80%?off%:byte81%=base81%?off%:IF off%>=len%:byte80%=&80:byte81%=&80
890 IF ((byte81%-byte80%) AND &FE)<>0 THEN PRINT "ERROR: Offset by more than one page at &";~&8000+off%
900 IF (byte80% AND &C0)=&80:byte%=byte%DIV2+128*(byte81%-byte80%):count%=count%+1
910 IF count%=8:?O%=byte%:O%=O%+1:byte%=0:count%=0
920 off%=off%+1:UNTILoff%>=len% AND count%=0
930 ENDPROC