10
20 :
30
40
50 ESCFLG =&FF :
60 FAULT =&FD :
70 OSARGS =&FFDA
80 OSRDCH =&FFE0 :
90 OSASCI =&FFE3 :
100 OSNEWL =&FFE7 :
110 OSWRCR =&FFEC :
120 OSWRCH =&FFEE :
130 OSWORD =&FFF1 :
140 OSBYTE =&FFF4 :
150 OS_CLI =&FFF7 :
160 BRKV =&0202 :
170 EVENTV =&0220 :
180 :
190 CODELOAD=&4000:DIM mcode% &400
200 FOR P=0 TO 1:opt%=P*3+4
210 P%=CODELOAD:O%=mcode%
220 [OPT opt%
230 \ CODE HEADER
240 \ -----------
250 .CODESTART
260 JMP CODEENTRY
270 BRK:BRK:BRK
280 EQUB &42
290 EQUB COPYMSG-CODESTART
300 EQUB 0
310 .TITLE
320 EQUS "65x02 I/O test program"
330 .COPYMSG
340 EQUB 0:EQUS "(C)2014 J.G.Harston"
350 EQUB 0
360 EQUD CODELOAD
370 :
380 .CODEENTRY
390 PHP:PHA:TYA:PHA:TXA:PHA
400 LDA &FFFB:BPL CHECK2
410 BRK:EQUB 255:EQUS "Not running on I/O":BRK
420 :
430 .CHECK2
440 LDX #TITLE AND 255:LDY #TITLE DIV 256
450 JSR PRSTRING:JSR OSNEWL:TSX
460 JSR PRTEXT:EQUS "A=&":EQUB 0
470 LDA &103,X:JSR PRHEX
480 JSR PRTEXT:EQUS " X=&":EQUB 0
490 LDA &101,X:JSR PRHEX
500 JSR PRTEXT:EQUS " Y=&":EQUB 0
510 LDA &102,X:JSR PRHEX
520 JSR PRTEXT:EQUS " S=&01":EQUB 0
530 TXA:CLC:ADC #4:JSR PRHEX
540 JSR PRTEXT:EQUS " P=&":EQUB 0
550 LDA &104,X:JSR PRHEX
560 :
570 JSR PRTEXT:EQUB 13:EQUS "MEMBOT=&":EQUB 0
580 LDA #&83:JSR OSBYTE:JSR PR2HEX
590 JSR PRTEXT:EQUS " MEMTOP=&":EQUB 0
600 LDA #&84:JSR OSBYTE:JSR PR2HEX
610 JSR PRTEXT:EQUB 13:EQUS "CMD=> ":EQUB 0
620 LDA #&01:LDX #&A8:LDY #&00:JSR OSARGS
630 .CMDlp
640 LDA (&A8),Y:JSR OSASCI
650 INY:CMP #13:BNE CMDlp
660 :
670 .EXIT
680 PLA:PLA:PLA:PLA
690 RTS
700 :
710 .PRTEXT
720 PLA:STA &F6:PLA:STA &F7
730 JSR PSTR3:JMP (&00F6)
740 .PRSTRING
750 STX &F6:STY &F7
760 .PSTR2
770 LDY #0:LDA (&F6),Y
780 BEQ PSTR3:JSR OSASCI
790 .PSTR3
800 INC &F6:BNE PSTR4:INC &F7
810 .PSTR4
820 TAY:BNE PSTR2:RTS
830 :
840 .PR2HEX
850 TYA:JSR PRHEX:TXA
860 .PRHEX
870 PHA:LSR A:LSR A:LSR A:LSR A
880 JSR PNYB:PLA
890 .PNYB
900 AND #15:CMP #10:BCC PDIG:ADC #6
910 .PDIG
920 ADC #ASC"0":JMP OSWRCH
930 :
940 .PRSPACE:LDA #32:JMP OSWRCH
950 .PRKEY
960 JSR PRTEXT:EQUB 13:EQUB 13:EQUS "Press a key...":EQUB 0
970 JSR OSRDCH:JMP OSWRCR
980 :
990 .TEST3:EQUS "This is using PRSTRING":EQUB 13:EQUB 0
1000 .CMDHELP:EQUS "help":EQUB 13
1010 .BRKSAVE:EQUW 0
1020 :
1030 ]NEXT
1040 PRINT"*SAVE TEST65io ";~mcode%;" ";~O%;" "~CODELOAD;" "~CODELOAD