Commodore 128 Programmer's Reference Manual page 423

Hide thumbs Also See for 128:
Table of Contents

Advertisement

p
THE COMMODORE 128 OPERATING SYSTEM
413
desirable for the system IRQ functions to continue normally (e.g., keyscan) as
opposed to replacing them totally with our own (as we did with the NMI examples).
The following examples accomplish these objectives as well as masking out all but
the main IRQ. First we must install our IRQ handler. This example converts the
4 0/80
key into a SLOW/FAST key:
A 1302 BIT
$D011
;test VIC reg 17
BPL $1324
;branch if wrong IRQ
| I
LDA $D505
preparation
! i
ORA #$80
;b7 of MMU MCR
STA $D505
;set for input
fi
LDA $D011
;assume FAST setup
| |
AND #$6F
;blank VIC (RC8 = 0)
LDX #$01
;2MHz
BIT
$D505
;test
4 0/80
key
M
BPL $131E
;branch if down (FAST)
1 ]
ORA #$10
;unblank VIC
DEX
;lMHz
f]
131E STX $D030
;set speed
i |
STA $D011
;set blank bit
1324 JMP ($1300)
;continue system IRQ
P
Now we need a small routine to actually wedge our code into the system IRQ. The
following code saves the current IRQ vector for our handler above to exit through
Pi
and substitutes a pointer to our code:
r-j
A 1400 SEI
;prevent interruptions
; {
LDA $314
;get current IRQ lsb
STA $1300
;andsaveit
p>
LDA $315
;get current IRQ msb
1 '
STA $1301
;andsaveit
1 ■
LDA #$02
;get our IRQ lsb
STA $314
;and substitute it
p
LDA #$13
;get our IRQ msb
I {
STA $315
;and substitute it
CLI
;re-enable IRQ processing
n
RTS
! i
i
\
Enable the wedge by typing J 1400, that's all there is to it. Depressing the
]1
Locking 40/80 key now puts you in FAST mode; releasing it SLOWS you
I I
down, and the keyscan, etc., continues to function. Note, however, that on this
n

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents