Classic Computer Magazine Archive PROGRAM LISTING: 85-03/KEYCOMM.ASM


10 ; KEYCOMM.ASM
20 ; BY PAUL DRIVER
30 ; ANTIC MAGAZINE
40 ATRACT =  $4D
50 VKEYBD =  $0208
60 SRTIMR =  $022B
70 COLBAK =  $02C8
80 INITAD =  $02E2
90 KEYDEL =  $02F1
0100 CH1 =   $02F2
0110 CH  =   $02FC
0120 SSFLAG = $02FF
0130 CONSOL = $D01F
0140 KBCODE = $D209
0150 SETVBV = $E45C
0160 XITVBV = $E462
0170     *=  $0600
0180 ;INITIALIZATION ROUTINE
0190 INIT LDA #PINIT/256
0200     STA $0D
0210     LDA #PINIT&255
0220     STA $0C
0230     LDA #DVINT/256
0240     STA $0B
0250     LDA #DVINT&255
0260     STA $0A
0270     LDA #60     ; turn off the
0280     STA $D302   ; cassette motor
0290     LDA #7      ; DEFERRED VBLANK
0300     LDX # >VBVRTN
0310     LDY # <VBVRTN
0320     JSR SETVBV
0330     LDA #6      ; INITIALIZE OLD
0340     STA OLD
0350     LDA #0      ; INITIALIZE LOCK
0360     STA LOCK
0370     LDA #7
0380     STA OLD
0390     LDA # <KYBDINT ;point to our
0400     STA VKEYBD  ;   keyboard
0410     LDA # >KYBDINT ;interrupt
0420     STA VKEYBD+1 ;  routine
0430     RTS 
0440 ;KEYBOARD INTERUPT HANDLER
0450 KYBDINT LDA KBCODE
0460     CMP CH1
0470     BNE PIRQ3
0480     LDA KEYDEL
0490     BNE PIRQ4
0500 PIRQ3 LDA KBCODE
0510     CMP #$9F    ;CTRL-1
0520     BNE PIRQ1
0530     LDA SSFLAG
0540     EOR #$FF
0550     STA SSFLAG
0560     BCS PIRQ4
0570 PIRQ1 ORA LOCK  ;OUR CUSTOMIZATION
0580     STA CH
0590     STA CH1
0600     LDA #3
0610     STA KEYDEL
0620     LDA #0
0630     STA ATRACT
0640 PIRQ4 LDA #$30
0650     STA SRTIMR
0660 PIRQ2 PLA 
0670     RTI 
0680 ;VERTICAL BLANK ROUTINE
0690 VBVRTN
0700     LDA CONSOL  ;get console key
0710     AND #6      ;mask SELECT/OPTION
0720     CMP OLD     ;has it changed?
0730     BEQ EXIT    ;branch if not
0740     STA OLD     ;hold new value
0750     EOR #6      ;invert bits
0760     ASL A       ;move to MSB
0770     ASL A
0780     ASL A
0790     ASL A
0800     ASL A
0810     EOR LOCK    ;toggle value
0820     STA LOCK    ;hold onto new val
0830     BEQ SKIP    ;branch if 0
0840     ORA #4      ;turn up luminance
0850 SKIP STA COLBAK
0860 EXIT LDA LOCK   ;Added for repeat
0870     ORA CH      ;feature
0880     STA CH
0890     JMP XITVBV
0900 OLD *=  *+1
0910 LOCK *= *+1
0920 PATCH LDA $0C
0930     STA PINIT+1
0940     LDA $0D
0950     STA PINIT+2
0960     LDA $0A
0970     STA DVINT+1
0980     LDA $0B
0990     STA DVINT+2
1000     JMP INIT
1010 PINIT JSR INIT
1020     JMP INIT
1030 DVINT JSR INIT
1040     JMP INIT
1050     *=  INITAD
1060     .WORD PATCH

Back to previous page