Classic Computer Magazine Archive PROGRAM LISTING: 89-01/RESET.M65


0100 ;SOFT RESET, SOURCE CODE
0110 ;BY BRAD TIMMINS
0120 ;(c)1988, ANTIC PUBLISHING
0130     *=  $0655
0140 ;IOCB equates
0150 PUTREC = $09
0160 EOL =   $9B
0170 ICCOM = $0342
0180 ICSTA = $0343
0190 ICBAL = $0344
0200 ICBAH = $0345
0210 ICPTL = $0346
0220 ICPTH = $0347
0230 ICBLL = $0348
0240 ICBLH = $0349
0250 AUX1 =  $034A
0260 CIOV =  $E456
0270 ;Program Equates
0280 DOSINI = $0C
0290 FLAG =  $0654
0300 CLEAR = $7D
0310 CONSOL = $D01F
0320 CDOWN = $1D
0330 ;Save old RESET vectors.
0340 START
0350     LDA DOSINI
0360     STA VECTOR
0370     LDA DOSINI+1
0380     STA VECTOR+1
0390 ;Replace with new address.
0400     LDA # <NEWVEC
0410     STA DOSINI
0420     LDA # >NEWVEC
0430     STA DOSINI+1
0440 ;Print "OFF" message.
0450     LDA # <OFF
0460     STA ICBAL
0470     LDA # >OFF
0480     STA ICBAH
0490     JSR PRINT
0500 ;Set FLAG's value to "OFF"
0510 ;and exit.
0520     LDA #0
0530     STA FLAG
0540     RTS 
0550 ;
0560 ;This is executed whenever
0570 ;RESET is pressed:
0580 ;   Has OPTION been pressed?
0590 ;If so, change FLAG's value:
0600 ;  0=Continue
0610 ;  1=Print "OFF" return to BASIC
0620 ;
0630 NEWVEC
0640     LDA CONSOL
0650     CMP #3
0660     BNE NVEC1
0670 ;
0680 ;Change FLAG's value.
0690     LDA FLAG
0700     EOR #1
0710     STA FLAG
0720 NVEC1
0730     LDA FLAG
0740     BEQ OFF1
0750 ;
0760 ;Display "POKE842,12:GOTO 31000"
0770     LDA # <GOTO
0780     STA ICBAL
0790     LDA # >GOTO
0800     STA ICBAH
0810     JSR PRINT
0820 ;Put cursor at 2,0
0830     LDA #2
0840     STA 84
0850     LDA #0
0860     STA 85
0870 ;Put Editor in Forced Read mode
0880 ;and return to BASIC.
0890     LDA #13
0900     STA AUX1
0910     RTS 
0920 ;
0930 ;Program is off. Print "OFF"
0940 ;and exit through old vectors.
0950 OFF1
0960     LDA # <OFF
0970     STA ICBAL
0980     LDA # >OFF
0990     STA ICBAH
1000     JSR PRINT
1010     JMP (VECTOR)
1020 ;
1030 ;IOCB PRINT subroutine
1040 PRINT
1050     LDA #PUTREC
1060     STA ICCOM
1070     LDA #0
1080     TAX 
1090     STA ICBLL
1100     LDA #2
1110     STA ICBLH
1120     JSR CIOV
1130     RTS 
1140 ;
1150 VECTOR
1160     .WORD 0,0
1170 GOTO
1180     .BYTE CLEAR,CDOWN,CDOWN,CDOWN,CDOWN,"POKE842,12:GOTO 31000",EOL
1190 OFF
1200     .BYTE CLEAR,"Soft Reset now OFF",EOL
1210 LABEL
1220     *=  $02E0
1230     .WORD START
1240     .END 

Back to previous page