10 HIMEM=&7000
20 Z%=HIMEM:W%=Z%
30 FORI=4TO6STEP2
40 O%=HIMEM
50 P%=&2500
60 U%=O%
70 V%=P%
80 [ OPT I
90 JMPon
100 ]
110 P%=&FF00
120 A%=O%-U%+V%
130 [ OPT I
140 .romstart BRK
150 BRK
160 BRK
170 JMPservice
180 EQUB&82
190 EQUBcopyr-romstart
200 EQUB0
210 EQUS"E2P-6502 "
220 .copyr EQUB0
230 EQUS"(C)1986 John Wike"
240 EQUB0
250 :
260 .reset LDA#anrti MOD 256
270 STA&FFFA
280 LDX#&FF
290 TXS
300 .reset2 LDAcodtabe-&FF,X
310 .reset4 STA&FD00,X
320 STA&FC80,X
330 DEX
340 CMP#&C9
350 BNEreset2
360 DEX
370 BMIreset4
380 :
390 LDX#0
400 STX&FF8D
410 CLI
420 :
430 .reset6 JSRcycle
440 .reset8 JMPreset6
450 :
460 CMP#0
470 LDAcycle+1
480 EOR#&80
490 STAcycle+1
500 LDA&FF8D
510 CMP&F2
520 STA&F2
530 .codtabe RTS
540 :
550 .irq1 PHA
560 LDA&FEE5
570 .ivec STA&FEE5
580 STA&FEE5
590 INCivec+1
600 BNEirq2
610 INCivec+2
620 .irq2 PLA
630 .anrti RTI
640 :
650 .cycle JSR&FD00
660 BEQcycle5
670 ORA#0
680 .cycle5 RTS
690 :
700 .start JMPstart1
710 .nmi JMPnmi1
720 .irq5 JMPirq6
730 ]
740 B%=O%-U%+V%
750 [ OPT I
760 EQUWreset
770 EQUWreset
780 EQUWirq1
790 ]
800 C%=O%-U%+V%
810 P%=C%
820 [ OPT I
830 .setup LDA&DF0,X
840 AND#&BF
850 STA&DF0,X
860 TYA
870 PHA
880 JSR&FFE7
890 :
900 LDA&20B
910 CMP#newosb DIV 256
920 BEQsetup5
930 STA&235
940 LDA&20A
950 STA&234
960 LDA#newosb DIV 256
970 STA&20B
980 LDA#newosb MOD 256
990 STA&20A
1000 :
1010 .setup5 LDA#&7A
1020 .setup7 JSRnewosb20
1030 LDY#0
1040 LDA#&78
1050 CPX#&64
1060 BEQsetup20
1070 :
1080 LDA#&79
1090 INX
1100 BNEsetup7
1110 :
1120 JSRcodld
1130 LDA&DF0,X
1140 ORA#&40
1150 STA&DF0,X
1160 :
1170 LDX#&FF
1180 TXA
1190 JSRpcomm
1200 LDA#&EA
1210 LDY#0
1220 JSR&FFF4
1230 :
1240 LDA#newbrk MOD 256
1250 STA&202
1260 LDA#newbrk DIV 256
1270 STA&203
1280 LDA#newevent MOD 256
1290 STA&220
1300 LDA#newevent DIV 256
1310 STA&221
1320 :
1330 LDA#&80
1340 STA&14
1350 :
1360 LDA#&14
1370 LDX#6
1380 CLC
1390 :
1400 .setup20 PHP
1410 JSR&FFF4
1420 LDY#message5-message1
1430 PLP
1440 BCCsetup22
1450 LDY#message6-message1
1460 :
1470 .setup22 JSRprnmes2
1480 PLA
1490 TAY
1500 LDA#0
1510 LDX&F4
1520 .noservice RTS
1530 :
1540 .service ROR&DF0,X
1550 PHP
1560 ROL&DF0,X
1570 PLP
1580 BCCnoservice
1590 :
1600 CMP#&FE
1610 BNEservice2
1620 JMPsetup
1630 :
1640 .service2 CMP#4
1650 BEQcommand
1660 :
1670 CMP#6
1680 BEQerr
1690 :
1700 CMP#9
1710 BNEhelp4
1720 :
1730 .help TYA
1740 PHA
1750 JSRprnmes
1760 :
1770 LDA&DF0,X
1780 :
1790 LDY#message3-message1
1800 ROL A
1810 BMIhelp2
1820 :
1830 LDY#message4-message1
1840 :
1850 .help2 JSRprnmes2
1860 PLA
1870 TAY
1880 LDA#9
1890 :
1900 .help4 RTS
1910 :
1920 .err LDA&DF0,X
1930 ROL A
1940 BPLnoterr
1950 :
1960 LDA&6FC
1970 BEQnoterr
1980 :
1990 TAY
2000 JSRprnmes2
2010 LDY#message9-message1
2020 JSRprnmes2
2030 :
2040 .stayhere JMPstayhere
2050 :
2060 .noterr LDA#6
2070 RTS
2080 :
2090 .comstr EQUS"E":EQUB(ASC"2" AND &DF):EQUS"POFF"
2100 :
2110 .command TYA
2120 PHA
2130 LDX#0
2140 :
2150 .comm2 LDA(&F2),Y
2160 AND#&DF
2170 CMPcomstr,X
2180 BNEnotE2P
2190 INY
2200 INX
2210 CPX#6
2220 BNEcomm2
2230 :
2240 JMPoff
2250 :
2260 .notE2P PLA
2270 TAY
2280 LDA#4
2290 LDX&F4
2300 RTS
2310 :
2320 .newosb CMP#&84
2330 BEQnewosb2
2340 CMP#&85
2350 BNEnewosb5
2360 .newosb2 LDX#V% MOD 256
2370 LDY#V% DIV 256
2380 RTS
2390 :
2400 .newosb5 CMP#&C8
2410 BNEnewosb7
2420 TXA
2430 AND#&FD
2440 TAX
2450 LDA#&C8
2460 :
2470 .newosb7 JSRnewosb20
2480 PHA
2490 PHP
2500 CMP#&79
2510 BEQnewosb10
2520 CMP#&7A
2530 BNEnewosb15
2540 :
2550 .newosb10 CPX#&64
2560 BNEnewosb15
2570 LDA#&79
2580 INX
2590 JSRnewosb20
2600 :
2610 .newosb15 PLP
2620 PLA
2630 RTS
2640 :
2650 .newosb20 JMP(&234)
2660 ]
2670 D%=O%-U%+V%
2680 P%=&400
2690 [ OPT I
2700 JMPwst
2710 JMPesc
2720 JMPinstr
2730 :
2740 .langerr LDA#message7-message1
2750 STA&6FC
2760 BRK
2770 BRK
2780 BRK
2790 :
2800 .procerr LDA#message8-message1
2810 STA&6FC
2820 BRK
2830 BRK
2840 BRK
2850 :
2860 .osrdch JSR&FFC8
2870 .osrd1 JSRregso2
2880 .osret LDA#0
2890 STA&8093
2900 .anrts RTS
2910 :
2920 .oscli JSRdatin
2930 JSR&FFF7
2940 JMPosret
2950 :
2960 .osbyte JSRregsin
2970 JSR&FFF4
2980 .osbyte2 JSRregsout
2990 JMPosret
3000 :
3010 .osword LDA&8096
3020 BNEoswd5
3030 JSRdatin
3040 STX0
3050 STY1
3060 TXA
3070 TAY
3080 JSR&FFF1
3090 JSRosbyte2
3100 BCSanrts
3110 JMPtxtout
3120 :
3130 .oswd5 LDY#&30
3140 JSRdatin1
3150 LDX#&30
3160 LDY#1
3170 LDA&8096
3180 JSR&FFF1
3190 JSRosret
3200 LDX&8097
3210 LDY#&30
3220 BNEosfile4
3230 :
3240 .osargs JSRdatin
3250 JSRregsi1
3260 JSR&FFDA
3270 LDX#4
3280 BNEosgbpb4
3290 :
3300 .osbget LDY&8098
3310 JSR&FFD7
3320 JMPosrd1
3330 :
3340 .osbput JSRregsi1
3350 JSR&FFD4
3360 JMPosret
3370 :
3380 .osfind JSRregsi1
3390 BEQosf5
3400 PHA
3410 JSRdatin
3420 PLA
3430 .osf5 JSR&FFCE
3440 JMPosrd1
3450 :
3460 .osfile JSRdatin
3470 JSRdatin
3480 STX0
3490 STY1
3500 LDY#0
3510 LDA&8096
3520 JSR&FFDD
3530 LDX#&12
3540 LDY#2
3550 .osfile2 JSRosrd1
3560 .osfile4 JMPblkout2
3570 :
3580 .osgbpb JSRdatin
3590 LDY#0
3600 LDA&8096
3610 JSR&FFD1
3620 LDX#&D
3630 .osgbpb4 LDY#0
3640 BEQosfile2
3650 :
3660 .pload LDA(0),Y
3670 INC0
3680 BNEpload2
3690 INC1
3700 :
3710 .pload2 STA&FCE5
3720 :
3730 LDY#&A
3740 .delay DEY
3750 BNEdelay
3760 RTS
3770 :
3780 .pcomm STA&808D
3790 .pstat2 BNEpstat
3800 :
3810 .pselect LDA&6FE
3820 JSRsidesel
3830 :
3840 .pstat LDA&808D
3850 BNEpstat2
3860 RTS
3870 :
3880 .sidesel STA&F4
3890 LDA#&C
3900 STA&FE05
3910 LDA&F4
3920 STA&FE05
3930 RTS
3940 :
3950 .wst CLI
3960 :
3970 LDX&6FE
3980 LDA&DF0,X
3990 ROL A
4000 ROL A
4010 STA&6FD
4020 ROR A
4030 ROR A
4040 ORA#&20
4050 STA&DF0,X
4060 :
4070 LDX#0
4080 STX0
4090 STX&17
4100 LDA#&80
4110 STA1
4120 STA&18
4130 LDA#&20
4140 AND&8006
4150 BEQwst2
4160 :
4170 LDY&8007
4180 .wst1 INY
4190 LDA&8000,Y
4200 BNEwst1
4210 LDA&8001,Y
4220 STA&17
4230 LDA&8002,Y
4240 STA&18
4250 :
4260 .wst2 BCSwst4
4270 LDY#&FF
4280 BIT&6FD
4290 BPLwst4
4300 LDA#&FD
4310 JSR&FFF4
4320 TXA
4330 BNEwst4
4340 STA&18
4350 BEQwst99
4360 :
4370 .wst4 LDA&F4
4380 CMP#&C
4390 BNEwst5
4400 JMP&8000
4410 :
4420 .wst5 LDA#1
4430 JSRwst100
4440 .wst7 JSRpload
4450 BIT1
4460 BVCwst7
4470 :
4480 .wst99 LDA#4
4490 :
4500 .wst100 PHA
4510 .wst110 LDA#&FF
4520 JSRinstr
4530 BCCwst110
4540 PLA
4550 LDX#&17
4560 LDY#0
4570 :
4580 .instr CMP#&80
4590 BCCinstr4
4600 CMP#&C0
4610 BCCinstr3
4620 ASL&14
4630 BCSinstr1
4640 CMP&15
4650 BEQinstr2
4660 CLC
4670 RTS
4680 .instr1 STA&15
4690 .instr2 RTS
4700 .instr3 ORA#&40
4710 CMP&15
4720 BNEinstr2
4730 LDA#&80
4740 STA&14
4750 LDA#&20
4760 :
4770 .instr4 PHP
4780 SEI
4790 STY&13
4800 STX&12
4810 STA&16
4820 :
4830 LDA&F4
4840 PHA
4850 :
4860 LDY#1
4870 .instr5 LDA(&12),Y
4880 PHA
4890 DEY
4900 BPLinstr5
4910 JSRpselect
4920 :
4930 .instr6 PLA
4940 INY
4950 STA&8090,Y
4960 BEQinstr6
4970 :
4980 LDY&13
4990 LDA&16
5000 ORA#8
5010 JSRpcomm
5020 :
5030 PLA
5040 JSRsidesel
5050 :
5060 LDA&16
5070 CMP#4
5080 BNEinstr9
5090 :
5100 .instr8 LDA#&80
5110 STA&14
5120 JMPmain
5130 :
5140 .esc PHP
5150 SEI
5160 PHA
5170 LDA&F4
5180 PHA
5190 JSRpselect
5200 LDA&FF
5210 STA&8090
5220 LDA#&C0
5230 BNEnewev5
5240 :
5250 .newevent PHP
5260 STA&19
5270 PHA
5280 LDA&F4
5290 PHA
5300 JSRpselect
5310 STX&808E
5320 STY&808F
5330 LDA&19
5340 STA&8090
5350 LDA#&40
5360 .newev5 JSRpcomm
5370 PLA
5380 JSRsidesel
5390 PLA
5400 .instr9 PLP
5410 RTS
5420 :
5430 .regsout STY&8098
5440 .regso1 STX&8097
5450 .regso2 STA&8096
5460 .regso3 ROL A
5470 STA&8095
5480 ROR A
5490 RTS
5500 :
5510 .regsin LDX&8097
5520 .regsi1 LDY&8098
5530 LDA&8096
5540 RTS
5550 :
5560 .datin LDY#0
5570 .datin1 LDX#0
5580 .datin2 BIT&8099
5590 BVCdatin5
5600 BMIdatin9
5610 LDA&809A
5620 STA&700,Y
5630 BVSdatin7
5640 :
5650 .datin5 BPLdatin2
5660 LDA&809A
5670 CPY#&12
5680 BCCdatin6
5690 :
5700 STA&100,Y
5710 BCSdatin7
5720 :
5730 .datin6 STA0,Y
5740 :
5750 .datin7 CLV
5760 .datin9 STX&8099
5770 INY
5780 BVC datin2
5790 LDY#7
5800 RTS
5810 :
5820 .blkout2 STX&1A
5830 .blkout3 LDX#&80
5840 .blkout5 CPY&1A
5850 BEQtxtout5
5860 :
5870 LDA0,Y
5880 CPY#&12
5890 BCCblkout7
5900 LDA&100,Y
5910 :
5920 .blkout7 JSRdatout
5930 INY
5940 BNEblkout5
5950 :
5960 .txtout LDX#&40
5970 LDY#0
5980 .txtout2 LDA&700,Y
5990 JSRdatout
6000 INY
6010 CMP#&D
6020 BNEtxtout2
6030 .txtout5 LDX#&C0
6040 :
6050 .datout NOP
6060 NOP
6070 BIT&809B
6080 BVSdatout
6090 BMIdatout
6100 STA&809C
6110 STX&809B
6120 RTS
6130 :
6140 .newbrk LDY#&FF
6150 .newbrk2 INY
6160 LDA(&FD),Y
6170 STA&130,Y
6180 :
6190 BNEnewbrk2
6200 TYA
6210 BEQnewbrk2
6220 INY
6230 STY&1A
6240 LDY#&30
6250 JSRpselect
6260 LDA#&80
6270 JSRpcomm
6280 JSRblkout3
6290 :
6300 .main LDX#&FF
6310 TXS
6320 .main2 SEI
6330 LDA&6FE
6340 JSRsidesel
6350 CLI
6360 :
6370 .main3 LDX&8094
6380 BEQmain4
6390 STX&809D
6400 LDA#0
6410 STA&8094
6420 :
6430 .main4 LDX&809D
6440 CPX&809E
6450 BEQmain9
6460 :
6470 INX
6480 CPX#&4E
6490 BCCmain7
6500 LDX#&1F
6510 .main7 LDA&8080,X
6520 STX&809D
6530 JSR&FFCB
6540 JMPmain3
6550 :
6560 .main9 LDA&8093
6570 BEQmain2
6580 :
6590 LDX&809D
6600 CPX&809E
6610 BNEmain3
6620 :
6630 STAosjmp+1
6640 .osjmp JSRosrdch
6650 JMPmain
6660 :
6670 .error BRK
6680 BRK
6690 EQUS"Cannot Initialise!"
6700 BRK
6710 ]
6720 P%=O%-U%+V%
6730 [ OPT I
6740 .on JSRcodld
6750 LDA#&8F
6760 LDX#&C
6770 LDY#&FF
6780 JSR&FFF4
6790 STY&A0
6800 :
6810 SEI
6820 LDA#&40
6830 STA&D00
6840 :
6850 LDY#7
6860 .find TYA
6870 JSRsidesel
6880 LDA&8000
6890 CMP&8100
6900 BNEfind5
6910 EOR#&FF
6920 STA&8000
6930 NOP
6940 NOP
6950 NOP
6960 NOP
6970 CMP&8100
6980 PHP
6990 EOR#&FF
7000 STA&8000
7010 PLP
7020 BEQon2
7030 :
7040 .find5 DEY
7050 BPLfind
7060 BMInotfound
7070 :
7080 .on2 STY&6FE
7090 LDA#10
7100 STA&A1
7110 :
7120 .on4 JSRboot
7130 BPLon6
7140 DEC&A1
7150 BNEon4
7160 :
7170 .notfound CLI
7180 LDA#&8F
7190 LDX#&B
7200 LDY&A0
7210 JSR&FFF4
7220 JMPerror
7230 :
7240 .on6 JSRboot
7250 :
7260 LDA#W% MOD 256
7270 STA0
7280 LDA#W% DIV 256
7290 STA1
7300 :
7310 LDY#0
7320 STY&8001+(ivec MOD 256)
7330 LDA#&F8
7340 STA&8002+(ivec MOD 256)
7350 :
7360 .on10 JSRpload
7370 :
7380 LDA0
7390 CMP#Z% MOD 256
7400 BNEon10
7410 LDA1
7420 CMP#Z% DIV 256
7430 BNEon10
7440 :
7450 LDA#start MOD 256
7460 STA&8001+(reset8 MOD 256)
7470 :
7480 LDA#1
7490 .on20 LDX&F4
7500 STA&DF0,X
7510 JMP(&FFFC)
7520 :
7530 .off LDA#&FF
7540 STA&808D
7550 :
7560 LDA#0
7570 STA&8006
7580 BEQon20
7590 :
7600 .codld LDX#0
7610 .codld2 LDAD%,X
7620 STA&400,X
7630 LDAD%+&100,X
7640 STA&500,X
7650 LDAD%+&200,X
7660 STA&600,X
7670 INX
7680 BNEcodld2
7690 :
7700 STX&6FC
7710 :
7720 LDX&F4
7730 STX&6FE
7740 RTS
7750 :
7760 .boot LDA#&40
7770 STA&8000+(anrti MOD 256)
7780 LDA#anrti MOD 256
7790 STA&80FA
7800 LDA#&FF
7810 STA&80FB
7820 :
7830 LDX#0
7840 .boot2 LDAA%,X
7850 STA&8000,X
7860 INX
7870 CPX#(B%-A%)
7880 BNEboot2
7890 :
7900 LDX#&CE
7910 .boot3 LDA&FF00,X
7920 STA&8000,X
7930 INX
7940 CPX#&FA
7950 BNEboot3
7960 :
7970 .boot4 LDAB%-&FA,X
7980 STA&8000,X
7990 INX
8000 BNEboot4
8010 :
8020 LDA#&FF
8030 STA&808D
8040 :
8050 LDA&FCE5
8060 LDY#50
8070 .boot6 LDA&8000,X
8080 INX
8090 BNEboot6
8100 :
8110 LDA&808D
8120 BEQboot8
8130 DEY
8140 BPLboot6
8150 .boot8 RTS
8160 :
8170 .message1 EQUB&D
8180 EQUS"E2P-6502 OS v2.4 "
8190 EQUB&D
8200 EQUS" <E2POFF B-BREAK>"
8210 EQUB&D
8220 EQUS" "
8230 EQUB0
8240 :
8250 .message3 EQUS"E2P is in use"
8260 EQUW&D
8270 :
8280 .message4 EQUS"I/O is in use"
8290 EQUW&D
8300 :
8310 .message5 EQUS"E2P-6502 Second Processor "
8320 EQUD&D0D
8330 :
8340 .message6 EQUS"I/O Processor"
8350 EQUD&D0D
8360 :
8370 .message7 EQUB&D
8380 EQUS"Not a language!"
8390 EQUB0
8400 :
8410 .message8 EQUB&D
8420 EQUS"Not 6502 code!"
8430 EQUB0
8440 :
8450 .message9 EQUS" : press ctrl-BREAK"
8460 EQUB0
8470 :
8480 .prnmes LDY#0
8490 .prnmes2 LDAmessage1,Y
8500 BEQprnmes5
8510 JSR&FFE3
8520 INY
8530 BNEprnmes2
8540 .prnmes5 RTS
8550 ]
8560 W%=O%-U%+V%
8570 P%=&F800
8580 [ OPT I
8590 .prompt LDA#sysbrk MOD 256
8600 STA&202
8610 LDA#sysbrk DIV 256
8620 STA&203
8630 LDX#&FF
8640 TXS
8650 LDA#ASC"*"
8660 JSR&FFEE
8670 LDX#oswblk MOD 256
8680 LDY#oswblk DIV 256
8690 LDA#0
8700 JSR&FFF1
8710 BCCnoesc
8720 :
8730 LDA#&7E
8740 JSR&FFF4
8750 BRK
8760 EQUB&11
8770 EQUS"Escape!"
8780 BRK
8790 :
8800 .noesc LDX#&36
8810 LDY#2
8820 JSR&FFF7
8830 JMPprompt
8840 :
8850 .oswblk EQUW&236
8860 EQUB&CA
8870 EQUB&20
8880 EQUB&FF
8890 :
8900 .tclear LDA&FF9E
8910 STA&FF94
8920 LDA#0
8930 STA&FF93
8940 STA&FF99
8950 STA&FF9B
8960 :
8970 .tclear10 LDA#irq5 MOD 256
8980 STA&FFFE
8990 LDA#nmi MOD 256
9000 STA&FFFA
9010 :
9020 .tclear20 LDA#0
9030 STA&FF8D
9040 STA&F2
9050 RTS
9060 :
9070 .cstr EQUS")C("
9080 EQUB0
9090 :
9100 .test12 CMP#&C
9110 BNEtest15
9120 LDX#&FF
9130 TXS
9140 LDY&FF91
9150 LDX&FF90
9160 JSRtclear
9170 :
9180 TYA
9190 BEQsamelang
9200 :
9210 .lang STYtjump+2
9220 STXtjump+1
9230 :
9240 .samelang LDAtjump+2
9250 STA&FE
9260 LDAtjump+1
9270 STA&FD
9280 :
9290 LDY#7
9300 LDA(&FD),Y
9310 TAY
9320 LDX#3
9330 :
9340 .tryrom LDA(&FD),Y
9350 CMPcstr,X
9360 BNEnotrom
9370 INY
9380 DEX
9390 BPLtryrom
9400 :
9410 LDY#6
9420 LDA(&FD),Y
9430 :
9440 AND#&4F
9450 CMP#&40
9460 BCSsamel0
9470 LDA#langerr MOD 256
9480 JSRoscomm
9490 :
9500 .samel0 AND#&D
9510 BEQsamel1
9520 LDA#procerr MOD 256
9530 JSRoscomm
9540 :
9550 .samel1 LDY#8
9560 :
9570 .samel2 INY
9580 LDA(&FD),Y
9590 BNEsamel2
9600 :
9610 TYA
9620 CLD
9630 CLC
9640 ADC&FD
9650 STA&FD
9660 BCCnotrom
9670 :
9680 INC&FE
9690 :
9700 .notrom LDA#1
9710 .tjump JMP&F800
9720 :
9730 .test15 CMP#&28
9740 BEQtest92
9750 BCCtest92
9760 :
9770 CMP#&FF
9780 BNEtest20
9790 .start1 LDX#&FF
9800 TXS
9810 INX
9820 STX&FF
9830 LDX#&35
9840 STX&FF9E
9850 :
9860 .test17 LDAvectab,X
9870 STA&200,X
9880 DEX
9890 BPLtest17
9900 :
9910 .test18A JSRtclear
9920 .test18 JMPtest18
9930 :
9940 .test20 CMP#&C0
9950 BNEtest25
9960 LDA&FF90
9970 STA&FF
9980 BMItest92
9990 :
10000 .test90 LDA&FFFA
10010 CMP#anrti MOD 256
10020 BNEtest95
10030 JMPtest7
10040 :
10050 .test92 JSRtclear10
10060 PLA
10070 RTI
10080 :
10090 .test95 JSRtclear20
10100 PLA
10110 RTI
10120 :
10130 .test25 CMP#&40
10140 BNEtest30
10150 TXA
10160 PHA
10170 TYA
10180 PHA
10190 LDX&FF8E
10200 LDY&FF8F
10210 LDA&FF90
10220 JSRevjmp
10230 PLA
10240 TAY
10250 PLA
10260 TAX
10270 JMPtest90
10280 :
10290 .evjmp JMP(&220)
10300 :
10310 .test30 TXA
10320 PHA
10330 TYA
10340 PHA
10350 JSRtclear
10360 LDX#0
10370 STX&FD
10380 LDY#3
10390 STY&FE
10400 JSRdatin10
10410 PLA
10420 TAY
10430 PLA
10440 TAX
10450 PLA
10460 STA&FC
10470 JMP(&202)
10480 :
10490 .osrdch10 LDA#osrdch MOD 256
10500 JSRoscomm
10510 JMPregsin12
10520 :
10530 .goasc EQUS"GO"
10540 EQUB&D
10550 :
10560 .oscli10 STY&F1
10570 STX&F0
10580 LDY#&FF
10590 LDX#&FF
10600 :
10610 .oscli12 INX
10620 CPX#3
10630 BNEoscli13
10640 JMPsamelang
10650 :
10660 .oscli13 INY
10670 LDA(&F0),Y
10680 CMP#ASC"*"
10690 BEQoscli13
10700 CMP#ASC" "
10710 BEQoscli13
10720 AND#&DF
10730 CMPgoasc,X
10740 BEQoscli12
10750 CPX#2
10760 BNEoscli20
10770 :
10780 LDA#0
10790 STA&100
10800 STA&101
10810 :
10820 .oscli14 LDA(&F0),Y
10830 INY
10840 CMP#ASC"0"
10850 BCCoscli18
10860 CMP#(ASC"9"+1)
10870 BCCoscli15
10880 AND#&DF
10890 CMP#ASC"A"
10900 BCCoscli20
10910 SBC#7
10920 CMP#&40
10930 BCSoscli20
10940 :
10950 .oscli15 LDX#4
10960 .oscli16 ASL&100
10970 ROL&101
10980 DEX
10990 BNEoscli16
11000 AND#&F
11010 CLC
11020 CLD
11030 ADC&100
11040 STA&100
11050 JMPoscli14
11060 :
11070 .oscli18 LDAtjump+2
11080 PHA
11090 LDAtjump+1
11100 PHA
11110 LDX&100
11120 LDY&101
11130 JSRlang
11140 PLA
11150 STAtjump+1
11160 PLA
11170 STAtjump+2
11180 RTS
11190 :
11200 .oscli20 LDX&F0
11210 LDY&F1
11220 LDA#oscli MOD 256
11230 STA&FF93
11240 JSRtxtout10
11250 JMPosstat
11260 :
11270 .osbyte10 CMP#&82
11280 BCCosbyte15
11290 CMP#&84
11300 BEQosbyte12
11310 BCSosbyte15
11320 TAX
11330 LDYosbtab-&82,X
11340 LDX#0
11350 .anrts10 RTS
11360 :
11370 .osbtab EQUB0
11380 EQUB8
11390 :
11400 .osbyte12 LDXtjump+1
11410 LDYtjump+2
11420 RTS
11430 :
11440 .osbyte15 JSRregso10
11450 CMP#&DA
11460 BNEosbyte18
11470 TXA
11480 BNEosbyte18
11490 TYA
11500 .osbyte18 PHP
11510 LDA#osbyte MOD 256
11520 JSRoscomm
11530 PLP
11540 BNEosbyte25
11550 LDX&FF9E
11560 STX&FF94
11570 .osbyte25 JMPregsin10
11580 :
11590 .osword10 STX&F0
11600 STY&F1
11610 :
11620 PHA
11630 STA&FF96
11640 LDA#osword MOD 256
11650 STA&FF93
11660 PLA
11670 BMIoswd12
11680 BNEoswd15
11690 LDA#5
11700 JSRblkout10
11710 JSRosstat
11720 JSRregsin12
11730 BCSanrts10
11740 LDY#0
11750 LDA(&F5),Y
11760 TAX
11770 INY
11780 LDA(&F5),Y
11790 TAY
11800 JSRdatin10
11810 JMPregsin10
11820 :
11830 .oswd12 LDY#1
11840 LDA(&F0),Y
11850 CLD
11860 CLC
11870 ADC#&30
11880 STA&FF97
11890 DEY
11900 LDA(&F0),Y
11910 JMPoswd20
11920 :
11930 .oswd15 CMP#&15
11940 BCCoswd17
11950 LDA#&15
11960 :
11970 .oswd17 TAX
11980 LDAoswito-1,X
11990 STA&FF97
12000 LDAoswoto-1,X
12010 :
12020 .oswd20 LDX&F0
12030 LDY&F1
12040 JSRblkout10
12050 JSRosstat
12060 JSRdatin10
12070 JMPblkout19
12080 :
12090 .osargs10 JSRregso10
12100 LDA#osargs MOD 256
12110 STA&FF93
12120 LDY#0
12130 LDA#4
12140 CLD
12150 JSRblkout10
12160 JSRosstat
12170 JSRdatin10
12180 JMPregsin10
12190 :
12200 .osbget10 STY&FF98
12210 LDA#osbget MOD 256
12220 .osbget12 JSRoscomm
12230 JMPregsin12
12240 :
12250 .osbput10 JSRregso11
12260 LDA#osbput MOD 256
12270 BNEosbget12
12280 :
12290 .osfind10 JSRregso10
12300 PHA
12310 LDA#osfind MOD 256
12320 STA&FF93
12330 PLA
12340 BEQosfind20
12350 JSRtxtout10
12360 :
12370 .osfind20 JSRosstat
12380 JMPregsin10
12390 :
12400 .osfile10 STA&FF96
12410 LDA#osfile MOD 256
12420 STA&FF93
12430 LDA#&12
12440 JSRblkout10
12450 LDY#0
12460 LDA(&F5),Y
12470 TAX
12480 INY
12490 LDA(&F5),Y
12500 TAY
12510 JSRtxtout10
12520 JSRosstat
12530 LDX&F5
12540 LDY&F6
12550 LDA#2
12560 .osfile15 JSRdatin11
12570 LDX&F5
12580 LDY&F6
12590 JMPregsin12
12600 :
12610 .osgbpb10 STA&FF96
12620 LDA#osgbpb MOD 256
12630 STA&FF93
12640 LDA#&D
12650 JSRblkout10
12660 JSRosstat
12670 CLD
12680 LDA#0
12690 BEQosfile15
12700 :
12710 .oscomm STA&FF93
12720 .osstat LDA&FF93
12730 BNEosstat
12740 RTS
12750 :
12760 .regso10 STX&FF97
12770 .regso11 STY&FF98
12780 STA&FF96
12790 RTS
12800 :
12810 .txtout10 STX&F3
12820 STY&F4
12830 LDX#&40
12840 LDY#0
12850 .txtout12 LDA(&F3),Y
12860 JSRdatout10
12870 INY
12880 CMP#&D
12890 BNEtxtout12
12900 .txtout15 LDX#&C0
12910 :
12920 .datout10 BIT&FF99
12930 BVSdatout10
12940 BMIdatout10
12950 STA&FF9A
12960 STX&FF99
12970 .datout15 RTS
12980 :
12990 .blkout10 STA&F7
13000 .blkout11 STX&F5
13010 STY&F6
13020 LDX#&80
13030 LDY#0
13040 .blkout15 CPY&F7
13050 BEQblkout17
13060 LDA(&F5),Y
13070 JSRdatout10
13080 INY
13090 BNEblkout15
13100 :
13110 .blkout17 JSRtxtout15
13120 .blkout19 LDX&F5
13130 LDY&F6
13140 RTS
13150 :
13160 .datin10 LDA#0
13170 .datin11 STX&F8
13180 STY&F9
13190 TAY
13200 LDX#0
13210 .datin12 BIT&FF9B
13220 BVCdatin15
13230 BMIdatin19
13240 BPLdatin17
13250 :
13260 .datin15 BPLdatin12
13270 .datin17 LDA&FF9C
13280 STA(&F8),Y
13290 CLV
13300 :
13310 .datin19 STX&FF9B
13320 INY
13330 BVCdatin12
13340 RTS
13350 :
13360 .oswrch10 STX&FA
13370 LDX&FF9E
13380 INX
13390 CPX#&4E
13400 BCCoswrch15
13410 LDX#&1F
13420 .oswrch15 CPX&FF9D
13430 BEQoswrch15
13440 :
13450 STA&FF80,X
13460 STX&FF9E
13470 LDX&FA
13480 RTS
13490 :
13500 .oswoto EQUB0
13510 EQUB5
13520 EQUB0
13530 EQUB5
13540 EQUB4
13550 EQUB5
13560 EQUB8
13570 EQUB&E
13580 EQUB4
13590 EQUB1
13600 EQUB1
13610 EQUB5
13620 EQUB0
13630 EQUB1
13640 EQUB&20
13650 EQUB&10
13660 EQUB&D
13670 EQUB0
13680 EQUB4
13690 EQUB&80
13700 EQUB&10
13710 :
13720 .oswito EQUB&35
13730 EQUB&30
13740 EQUB&35
13750 EQUB&30
13760 EQUB&35
13770 EQUB&30
13780 EQUB&30
13790 EQUB&30
13800 EQUB&35
13810 EQUB&39
13820 EQUB&35
13830 EQUB&30
13840 EQUB&38
13850 EQUB&48
13860 EQUB&30
13870 EQUB&31
13880 EQUB&3D
13890 EQUB&B0
13900 EQUB&34
13910 EQUB&B0
13920 EQUB&40
13930 :
13940 .vectab EQUWanrts10
13950 EQUWsysbrk
13960 EQUWirq7
13970 EQUWirq7
13980 EQUWoscli10
13990 EQUWosbyte10
14000 EQUWosword10
14010 EQUWoswrch10
14020 EQUWosrdch10
14030 EQUWosfile10
14040 EQUWosargs10
14050 EQUWosbget10
14060 EQUWosbput10
14070 EQUWosgbpb10
14080 EQUWosfind10
14090 EQUWanrts10
14100 EQUWanrts10
14110 EQUWanrts10
14120 EQUWanrts10
14130 EQUWanrts10
14140 EQUWanrts10
14150 EQUWanrts10
14160 EQUWanrts10
14170 EQUWanrts10
14180 EQUWanrts10
14190 EQUWanrts10
14200 EQUWanrts10
14210 :
14220 .regsin10 LDY&FF98
14230 .regsin11 LDX&FF97
14240 .regsin12 LDA&FF95
14250 ROR A
14260 LDA&FF96
14270 RTS
14280 :
14290 .irq6 STA&FC
14300 PLA
14310 ORA#4
14320 PHA
14330 AND#&10
14340 BEQirq7
14350 :
14360 TXA
14370 PHA
14380 TSX
14390 LDA&103,X
14400 CLD
14410 SEC
14420 SBC#1
14430 STA&FD
14440 LDA&104,X
14450 SBC#0
14460 STA&FE
14470 PLA
14480 TAX
14490 LDA&FC
14500 JMP(&202)
14510 .irq7 LDA&FC
14520 RTI
14530 :
14540 .sysbrk LDX#&FF
14550 TXS
14560 JSR&FFE7
14570 LDY#1
14580 .sysbrk2 LDA(&FD),Y
14590 BEQsysbrk5
14600 JSR&FFEE
14610 INY
14620 BNEsysbrk2
14630 :
14640 .sysbrk5 JSR&FFE7
14650 JMPprompt
14660 :
14670 .nmi1 PHA
14680 JSRcycle
14690 BNEtest
14700 PLA
14710 RTI
14720 :
14730 .test CMP#9
14740 BCCtest2
14750 BNEtest10
14760 LDA#&8D
14770 BNEtest4
14780 :
14790 .test2 LDA#&AD
14800 .test4 STAivec
14810 LDA&FF90
14820 STAivec+1
14830 LDA&FF91
14840 STAivec+2
14850 :
14860 LDA#irq1 MOD 256
14870 STA&FFFE
14880 LDA#anrti MOD 256
14890 STA&FFFA
14900 BCStest6
14910 BRK
14920 NOP
14930 :
14940 .test6 CLI
14950 .test7 LDA#0
14960 STA&FF8D
14970 .test8 JSRcycle
14980 BNEtest
14990 BEQtest8
15000 .test10 JMPtest12
15010 ]
15020 Z%=O%-U%+V%
15030 NEXT
20000 :
20005 O$="SAVE E2P "+STR$~U%+" +"+STR$~(Z%-V%)+" FFFF2500 FFFF2500"
20010 REPEAT
20020 INPUT"TAPE OR DISC (T/D)"D$
20030 UNTIL D$= "D" OR D$="T"
20040 IF D$="D" GOTO 31000
20050 :
30000 *TAPE
30020 ONERROR GOTO30030
30030 VDU6:CLS
30040 PRINT'"INSERT NEW TAPE, SET TO RECORD THEN PRESS RETURN"
30050 VDU21
30060 INPUT Z$
30070 *MOTOR1
30080 T%=TIME:REPEAT:UNTIL TIME=T%+2000
30090 *FX138,0,13
30100 OSCLIO$
30110 *MOTOR1
30120 T%=TIME:REPEAT:UNTIL TIME=T%+1000
30130 *FX138,0,13
30140 OSCLIO$
30150 VDU6,7,7,7
30160 PRINT'"PRESS REWIND THEN RETURN,"
30170 PRINT"WHEN TAPE AT START, PRESS PLAY"
30180 VDU21
30190 INPUT Z$
30200 VDU6
30210 PRINT'"AFTER CATALOG REWIND THEN PRESS ESCAPE"
30220 *.
30230 END
30240 :
31000 *ADFS
31010 OSCLI O$
31020 *SPOOL !BOOT
31030 PRINT"*/E2P"
31040 *SPOOL
31050 *OPT 4,3