Bueno, encontre esto :
LINK Extended Keyboard Use on the C-128 in C-64 Mode
Dave Kline 07/01/00 McGraw/Hill
Because extra registers are present in the C-64 mode on the C-128, you
can use the C-128 extended keyboard in C-64 mode. A routine using the three
extra keyscan lines at location $D02F follows. This routine wedges itself
into the IRQ interrupt routine by diverting the IRQ vector at $0314/$0315
to point to the code. Note that to scan a given column in the key matrix
(say, that connected to the K0 line), the output line is held low (logical
zero); matrix columns that are not being scanned should have their
respective output lines held high (logical one). (This is merely a
Commodore convention; another manufacturer's system might scan a keyboard
similarly but would reverse the process -- scanned key matrix column output
lines would be held high, while unscanned ones would be held low.)
This ML routine can be entered with the C-128's monitor but is executed
while in C-64 mode. The routine is called by SYS51968. To deactivate,
press RUN-STOP/RESTORE. (Note, other routines that use this memory area
while cause conflicts.)
SEI ; DISABLE INTERRUPTS.
LDY #$CB ; DIRECT IRQ VECTOR TO CODE AT $CBOD.
LDX #$0D
STY $0315
STX $0314
CLI ; ENABLE INTERRUPTS.
RTS ; RETURN TO CALLER.
$CB0D
LDX #$F8 ; %1111 1000
STX $D02F ; ALL 3 EXTENDED KB OUTPUT LINES ACTIVE.
LDA #$FF
STA $DC00 ; CIA #1'S DDR SET FOR ALL 8 LINES AS INPUTS.
CMP $DC01 ; NOT = $FF? KEY HELD DOWN,
BNE $CB22 ; SO PROCESS IT.
STA $D02F ; ELSE ALL KB OUTPUT LINES INACTIVE.
JMP $EA31 ; JUMP TO NORMAL IRQ HANDLER CODE.
$CB22
LDA #$FB ; %1111 10111 ... K2'S COLUMN SCANNED FIRST.
STA $D02F
LDX #$00 ; ZERO SHIFT/CTRL/CBM FLAG.
STX $028D
LDY #$08 ; COUNTER ... 8 ROWS TO TEST.
LDA $DC01 ; READ INPUT PORT.
CMP $DC01 ; VALUE CHANGING?
BNE $CB2E ; YES, LOOP AGAIN FOR ANOTHER READ.
CMP #$FF ; ANY KEYS IN THIS COLUMN DEPRESSED?
BNE $CB44 ; YES, PROCESS KEYSTROKE.
CLC ; CLEAR .C TO PREPARE FOR ADD.
TXA ; GET KEY NUMBER (INDEX) AND
ADC #$08 ; ADD 8 SINCE WE CAN SKIP THIS COLUMN.
TAX ; PUT INDEX BACK WHERE IT BELONGS.
ROR $D02F ; NOW K1 HELD LOW (%1111 1101).
BNE $CB2C ; ZERO? NO WAY! WE'RE FORCING A JUMP
; TO $CB2C TO SCAN THE NEXT COLUMN.
$CB44
LSR ; PROCESS KEYSTROKE ... SHIFT BITS INTO .C .
BCC $CB50 ; IF .C = 0 KEY STRUCK, SO WE QUIT SCANNING.
INX ; BUMP KEY INDEX COUNTER.
DEY ; DECREMENT ROW COUNTER.
BNE $CB44 ; 8 ROWS DONE? NO, THEN LOOP AGAIN.
ROR $D02F ; PREPARE TO SCAN NEXT COLUMN. (KN=0)
LDA $CB69,X ; LOOK UP C-64 KEYCODE FROM TABLE.
BPL $CB5C ; IF HI-BIT (#7) SET, IT'S
ED,
LDY #$01 ; SO WE SET SHIFT FLAG.
STY $028D
AND #$7F ; AND LOP OFF BIT#7 TO GET TRUE C-64 KEYCODE.
STA $CB ; SAVE KEYCODE.
LDX $FF
STX $D02F ; DEACTIVATE EXTENDED KEYSCAN LINES.
JSR $EADD ; CONVERT KEYCODE TO ASCII BYTE, PLACE IN BUFFER.
JMP $EA7E ; RESTORE REGISTER CONTENTS & RETURN FROM IRQ.
$CB69 40 23 2C 87 07 82 02 40 40 28 28 40 01 13 20 08
$CB79 40 1B 10 40 3B 0B 18 38 40
Or copy this BASIC program:
10 for x=49152t049185:read z:pokex,z:ck=ck+z:next
15 for x=x to 49285:poke x,peek(x+10770):next
20 poke49258,117:poke49259,192
25 for x=xt049454:read z:pokex,z:ck=ck+z:next
30 ifck<>26162thenprint"error in data lines...":end
35 print"it's magic1 128 keypad keys now active. "
40 print"[no scroll] and cursor keys, too.":sys49152:new
45 data 120,169,23,141,20,3,169,192,141,21,3,169,24,141,38,3,169,193,141,39
50 data 3,88,96,32,234,255,173,216,192,240,3,206,216,192,240,6,32,39,193,76
55 data 154,234,168,32,13,193,208,6,142,47,208,76,38,235,169,254,141,47,208
60 data 162,8,72,173,1,220,205,1,220,208,248,74,144,21,200,192,25,208,5,104
65 data 162,255,208,221,202,208,240,56,104,42,141,47,208,208,221,104,185
70 data 245,192,170,41,127,160,255,140,47,208,201,1,208,20,32,13,193,208
75 data 251,169,0,240,8,173,34,193,73,1,141,34,193,76,148,192,200,217,129
80 data 235,208,250,132,203,32,39,193,138,76,228,234,255,56,53,255,50,52,55
85 data 49,255,43,45,255,13,54,57,51,255,48,46,145,17,157,29,1,169,0,141,47
90 data 208,174,1,220,224,255,96,32,202,241,72,169,5,141,216,192,169,0,208
95 data 247,104,96,72,169,0,141,34,193,104,96
Here's standard keyboard matrix of Commodore 64
(adjunto la imagen).