10
20
30 :
40 PROCvars
50 PROCassemble
60 PROCchecksum
70 *SRWRITE 5000+300 8000 7
80 END
90 DEFPROCvars
100 mshigh=&50:mslow=&51
110 lshigh=&52:lslow=&53
120 temp=&54
130 hibyte=&63:lobyte=&62
140 hibegin=&61:lobegin=&60
150 osrdch=&FFE0:osbyte=&FFF4
160 oswrch=&FFEE:osnewl=&FFE7
170 osasci=&FFE3
180 comline=&F2
190 ENDPROC
200 :
210 DEFPROCassemble
220 FORpass=4TO7STEP3
230 P%=&8000:O%=&5000
240 [OPTpass
250 JMPlanguage
260 JMPservice
270 EQUB&C2
280 EQUBoffset MOD256
290 EQUB1
300 .title
310 EQUS"Master Monitor"
320 .offset
330 EQUB0
340 EQUS"(C) Bruce Smith"
350 EQUB0
360 :
370 .service
380 PHA
390 CMP#9
400 BEQhelp
410 CMP#4
420 BEQunrecognised
430 PLA
440 RTS
450 :
460 .help
470 LDX#&FF
480 .helploop
490 INX
500 LDAtitle,X
510 JSRosasci
520 BNEhelploop
530 JSRosnewl
540 PLA
550 RTS
560 :
570 .unrecognised
580 PHX
590 PHY
600 LDX#&FF
610 DEY
620 .ctloop
630 INX
640 INY
650 LDA(comline),Y
660 AND#&DF
670 CMPtable,X
680 BEQctloop
690 LDAtable,X
700 BMIfound
710 \
720 .notthisrom
730 PLY
740 PLX
750 PLA
760 RTS
770 \
780 .found
790 LDA#&8E
800 LDX&F4
810 JSR&FFF4
820 \ No return!
830 \
840 \ set up Command Table
850 .table
860 EQUS "MASMON"
870 EQUB&FF
880 :
890 .language
900 CLI
910 LDX#&FF
920 TXS
930 LDA#22
940 JSRoswrch
950 LDA#7
960 JSRoswrch
970 LDY#2
980 LDX#&FF
990 .langloop
1000 INX
1010 LDAheading,X
1020 BEQout
1030 JSRosasci
1040 BRAlangloop
1050 .out
1060 \
1070 LDX#&FF
1080 DEY
1090 BNElangloop
1100 \
1110 .copyloop
1120 INX
1130 LDAcopyright,X
1140 BEQout2
1150 JSRosasci
1160 BRAcopyloop
1170 \
1180 .out2
1190 LDA#28
1200 JSRoswrch
1210 LDA#0
1220 JSRoswrch
1230 LDA#24
1240 JSRoswrch
1250 LDA#39
1260 JSRoswrch
1270 LDA#5
1280 JSRoswrch
1290 LDX#&FF
1300 \
1310 .stloop
1320 INX
1330 LDAstart,X
1340 JSRosasci
1350 BNEstloop
1360 JSRinputaddr
1370 LDAhibyte
1380 STAhibegin
1390 LDAlobyte
1400 STAlobegin
1410 \
1420 LDX#&FF
1430 .endloop
1440 INX
1450 LDAend,X
1460 JSRosasci
1470 BNEendloop
1480 JSRinputaddr
1490 LDA#13
1500 JSRosasci
1510 \
1520 .nextline
1530 JSRaddress
1540 LDY#0
1550 LDX#7
1560 .hexloop
1570 LDA(lobegin),Y
1580 JSRhexout
1590 JSRspace
1600 INY
1610 DEX
1620 BPLhexloop
1630 LDA#134
1640 JSRoswrch
1650 \
1660 LDY#0
1670 LDX#7
1680 .ascloop
1690 LDA(lobegin),Y
1700 CMP#32
1710 BCCspot
1720 CMP#128
1730 BCCjumpover
1740 \
1750 .spot
1760 LDA#ASC(".")
1770 .jumpover
1780 JSRoswrch
1790 INY
1800 DEX
1810 BPLascloop
1820 \
1830 LDA#&D
1840 JSRosasci
1850 CLC
1860 LDAlobegin
1870 ADC#8
1880 STAlobegin
1890 BCCnocarry
1900 INChibegin
1910 .nocarry
1920 LDAlobegin
1930 CMPlobyte
1940 BCCnextline
1950 LDAhibegin
1960 CMPhibyte
1970 BCCnextline
1980 \
1990 JSRosnewl
2000 LDX#&FF
2010 .goonloop
2020 INX
2030 LDAcontinue,X
2040 JSRoswrch
2050 BNEgoonloop
2060 .testkey
2070 JSRosrdch
2080 CMP#ASC("Y")
2090 BNEskipover
2100 JMPlanguage
2110 .skipover
2120 CMP#ASC("N")
2130 BNEtestkey
2140 \
2150 LDA#26
2160 JSRoswrch
2170 LDA#12
2180 JSRoswrch
2190 LDA#&BB
2200 JSRosbyte
2210 LDA#&8E
2220 JMPosbyte
2230 :
2240 \ machine code subroutines
2250 :
2260 .inputaddr
2270 JSRcharacters
2280 LDAmshigh
2290 JSRcheck
2300 ASLA
2310 ASLA
2320 ASLA
2330 ASLA
2340 STAtemp
2350 LDAmslow
2360 JSRcheck
2370 ORAtemp
2380 STAhibyte
2390 LDAlshigh
2400 JSRcheck
2410 ASLA
2420 ASLA
2430 ASLA
2440 ASLA
2450 STAtemp
2460 LDAlslow
2470 JSRcheck
2480 ORAtemp
2490 STAlobyte
2500 RTS
2510 \
2520 .characters
2530 JSRosrdch
2540 JSRosasci
2550 STAmshigh
2560 JSRosrdch
2570 STAmslow
2580 JSRosasci
2590 JSRosrdch
2600 JSRosasci
2610 STAlshigh
2620 JSRosrdch
2630 JSRosasci
2640 STAlslow
2650 RTS
2660 \
2670 .check
2680 CMP#58
2690 BCSatof
2700 AND#15
2710 RTS
2720 .atof
2730 SBC#55
2740 RTS
2750 \
2760 .space
2770 LDA#32
2780 JMPoswrch
2790 \
2800 .address
2810 LDA#129
2820 JSRoswrch
2830 LDX#lobegin
2840 LDA1,X
2850 JSRhexout
2860 LDA0,X
2870 JSRhexout
2880 LDA#130
2890 JSRoswrch
2900 RTS
2910 \
2920 .hexout
2930 PHA
2940 LSRA
2950 LSRA
2960 LSRA
2970 LSRA
2980 JSRdigit
2990 PLA
3000 .digit
3010 AND#15
3020 CMP#10
3030 BCCno
3040 ADC#6
3050 .no
3060 ADC#48
3070 JMPoswrch
3080 :
3090 \ ASCII string storage area
3100 :
3110 .copyright
3120 EQUD&20202086
3130 EQUW&2020
3140 EQUS"(C) Bruce Smith 1986"
3150 EQUB13
3160 EQUB0
3170 .heading
3180 EQUB141
3190 EQUB131
3200 EQUD&20202020
3210 EQUD&20202020
3220 EQUS"Master Monitor"
3230 EQUB13
3240 EQUB0
3250 EQUB141
3260 .start
3270 EQUB130
3280 EQUS"Start :&"
3290 EQUB129
3300 EQUB0
3310 .end
3320 EQUB130
3330 EQUS" End :&"
3340 EQUB129
3350 EQUB0
3360 .continue
3370 EQUB130
3380 EQUS"Go again (Y/N)? "
3390 EQUB0
3400 ]
3410 NEXT
3420 ENDPROC
3430 :
3440 DEFPROCchecksum
3450 N%=0
3460 FORX%=&5000TO&5240
3470 N%=N%+?X%
3480 NEXT
3490 IFN%=70308 THEN ENDPROC
3500 VDU7
3510 PRINT"Assembler error!"
3520 END