CHECK THE KEYS $d4, dec 212 YOU WANT TO HAVE PRESSED TO CONTINUE WITH THE PROCESS! ------------------------------------------------------------------------------------------------------------- TOOL: Information {Commodore C128} Language: None Extra: none Author: Misel Zivanovic Note: (C) 16th DEC 2025 - www.lived.ch, mzretro.ch ------------------------------------------------------------------------------------------------------------- lived.ch, 14:34 20.03.2024 update: 16.12.2025 ------------------------------------------------------------------------------------------------------------- Commodore C128 address register >>> $d4, dec 212, Matrix Coordinate of Current Key Pressed Commodore C64 address register >>> $cb, dec 203, Matrix Coordinate of Current Key Pressed Decimal Hex$ Decimal Hex$ Decimal Hex$ Decimal Hex$ A = 10 #$0a O = 38 #$26 1 = 56 #$38 Up Arrow = 83 #$53 B = 28 #$1c P = 41 #$29 2 = 59 #$3b Down Arrow = 84 #$54 C = 20 #$14 Q = 62 #$3e 3 = 08 #$08 Left Arrow = 85 #$55 D = 18 #$12 R = 17 #$11 4 = 11 #$0b Right Arrow = 86 #$56 E = 14 #$0e S = 13 #$0d 5 = 16 #$10 F = 21 #$15 T = 22 #$16 6 = 19 #$13 {Numeric Block} G = 26 #$1a U = 30 #$1e 7 = 24 #$18 Decimal Hex$ Decimal Hex$ H = 29 #$1d V = 31 #$1f 8 = 27 #$1b 1 = 71 $47 6 = 77 #$4d I = 33 #$21 W = 09 #$09 9 = 32 #$20 2 = 68 $44 7 = 70 #$46 J = 34 #$22 X = 23 #$17 0 = 35 #$23 3 = 79 $4f 8 = 65 #$41 K = 37 #$25 Y = 25 #$19 SPACE = 60 #$3c 4 = 69 $45 9 = 78 #$4e L = 42 #$2a Z = 12 #$0c ENTER = 01 #$01 5 = 66 $42 0 = 81 #$51 M = 36 #$24 ESC = 72 #$48 ENTER = 76 $4c - = 74 #$4a N = 39 #$27 + = 73 #$49 ------------------------------------------------------------------------------------------------------------- {16.12.2025 - No idea why this are the results! Maybe because i use no real hardware?} FUNKTION KEY: F1 F3 F5 F7 {direct, F1-F3-F5-F7} 04, #$04 05, #$05 06, #$06 3, #$03 FUNKTION KEY: F2 F4 F6 F8 {With SHIFT pressed} Code for SHIFT 04 05 06 03 ------------------------------------------------------------------------------------------------------------- $d3, dec 211, Shift, Ctrl etc. { The values are cumulative; if both SHIFT and CONTROL are } Shift key status flag { pressed simultaneously, the value here will be 5 {4 + 1} } { Based on the value here, the SCNKEY routine chooses a keyboard } { table pointer value to be stored in 204-20S/$CC-$CD } { Note: Bit 7 of this location is also used as a flag to indicate } { when the extra characters read using the VIC chip lines are } { being scanned. } Key Bit Bit value SHIFT 0 1/$01 Commodore 1 2/$02 CONTROL 2 4/$04 ALT 3 8/$08 CAPS LOCK 4 16/$10 ------------------------------------------------------------------------------------------------------------- EXAMPLE 1: {endless loop until you press any key} a 01300 a5 d4 lda $d4 Load the active code {default value is #$58, dec 88, if nothing is pressed} a 01302 c9 58 cmp #$58 If it is #$58, dec 88 a 01304 f0 fa beq $1300 Then we go back to check again until any key is pressed a 01306 60 rts When a key is pressed, return to subroutine or BASIC {If called from BASIC} EXAMPLE 2: {ENDLESS LOOP until you press Q to exit and delete keyboard buffer} . 01300 a5 d4 lda $d4 . 01302 c9 3e cmp #$3e . 01304 f0 02 beq $1308 . 01306 d0 f8 bne $1300 . 01308 a9 00 lda #$00 . 0130a 85 d0 sta $d0 . 0130c 60 rts ------------------------------------------------------------------------------------------------------------- ALTERNATIVE WAYS! EXAMPLE 1: {Kernal GETIN routine $ffe4 to check if ENTER was pressed} NOTE : This has nothing to do with KEYBOARD-MATRIX and $d4, dec 212!!! . 01300 20 e4 ff jsr $ffe4 . 01303 c9 0d cmp #$0d {ASCII Code CHR$(13) or hex #$0d}. You work with the Character Codes! . 01305 f0 03 beq $130a . 01307 4c 00 13 jmp $1300 . 0130a 60 rts