Numeric keypad in 64 mode

Started by bill.mann, July 15, 2006, 11:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bill.mann

Anyone have the code available that allows you to use the numeric keypad in C64 mode ? This would make it useful and easier to enter data when using the 64 side of things rather than the cumbersome top row of number keys .

Stephane Richard

You mean this?  I know this is an old post, but I figured, for the sake of information, might be handy to reply to it :-)

100 FOR AD = 830 TO 949 : READ {SPACE} BY : CK = CK + BY
110 POKE AD, BY : NEXT
120 IF CK <> 13099 THEN PRINT TAB(7) "{RVS} ERROR IN {SPACE} DATA STATEMENTS {SPACE}" : STOP
130 SYS 830 : PRINT "{2 DOWN} * * NUMERIC KEYPAD IS NOW ACTIVE ** {2 SOWN}"
140 NEW
830 DATA 120, 169, 75, 141, 20, 3, 169, 3, 141, 21
840 DATA 3, 88, 96, 169, 248, 141, 47, 208, 169, 255
850 DATA 141, 0, 220, 205, 1, 220, 208, 10, 141, 47
860 DATA 208, 74, 141, 0, 220, 76, 49, 234, 160, 0
870 DATA 140, 141, 2, 169, 251, 141, 47, 208, 162, 8
880 DATA 173, 1, 220, 205, 1, 220, 208, 248, 74, 144
890 DATA 9, 200, 202, 208, 249, 110, 47, 208, 176, 234
900 DATA 185, 157, 3, 16, 7, 162, 1, 142, 141, 2
910 DATA 41, 127, 133, 203, 169, 255, 141, 47, 208, 32
920 DATA 72, 235, 76, 126, 234, 64, 35, 44, 135, 7
930 DATA 130, 2, 64, 64, 40, 43, 64, 1, 19, 32
940 DATA 8, 64, 27, 16, 64, 59, 11, 24, 56, 64

this is taken from the C-128 Programmer's reference guide. I believe it does what you want :-).
When God created light, so too was born, the first Shadow!

MystikShadows

Blacklord

Quote from: bill.mannAnyone have the code available that allows you to use the numeric keypad in C64 mode ? This would make it useful and easier to enter data when using the 64 side of things rather than the cumbersome top row of number keys .
There's also this :

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.)


   0CB00 78       SEI         ; DISABLE INTERRUPTS.
   0CB01 A0 CB    LDY #$CB    ; DIRECT IRQ VECTOR TO CODE AT $CBOD.
   0CB03 A2 0D    LDX #$0D
   0CB05 8C 1C 03 STY $0315
   0CB08 8E 14 03 STX $0314
   0CB0B 58       CLI         ; ENABLE INTERRUPTS.
   0CB0C 60       RTS         ; RETURN TO CALLER.

   0CB0D A2 F8    LDX #$F8    ; %1111 1000
   0CB0F 8E 2F D0 STX $D02F   ; ALL 3 EXTENDED KB OUTPUT LINES ACTIVE.
   0CB12 A9 FF    LDA #$FF  
   0CB14 8D 00 DC STA $DC00   ; CIA #1'S DDR SET FOR ALL 8 LINES AS INPUTS.
   0CB17 CD 01 DC CMP $DC01   ; NOT = $FF? KEY HELD DOWN,
   0CB1A D0 06    BNE $CB22   ;    SO PROCESS IT.
   0CB1C 8D 2F D0 STA $D02F   ; ELSE ALL KB OUTPUT LINES INACTIVE.
   0CB1F 4C 31 EA JMP $EA31   ; JUMP TO NORMAL IRQ HANDLER CODE.

   0CB22 A9 FB    LDA #$FB    ; %1111 10111 ... K2'S COLUMN SCANNED FIRST.
   0CB24 8D 2F D0 STA $D02F  
   0CB27 A2 00    LDX #$00    ; ZERO SHIFT/CTRL/CBM FLAG.
   0CB29 8E 8D 02 STX $028D
   0CB2C A0 08    LDY #$08    ; COUNTER ... 8 ROWS TO TEST.
   0CB2E AD 01 DC LDA $DC01   ; READ INPUT PORT.
   0CB31 CD 01 DC CMP $DC01   ; VALUE CHANGING?
   0CB34 D0 F8    BNE $CB2E   ; YES, LOOP AGAIN FOR ANOTHER READ.
   0CB36 C9 FF    CMP #$FF    ; ANY KEYS IN THIS COLUMN DEPRESSED?
   0CB38 D0 0A    BNE $CB44   ; YES, PROCESS KEYSTROKE.
   0CB3A 18       CLC         ; CLEAR .C TO PREPARE FOR ADD.
   0CB3B 8A       TXA         ; GET KEY NUMBER (INDEX) AND
   0CB3C 69 08    ADC #$08    ;    ADD 8 SINCE WE CAN SKIP THIS COLUMN.
   0CB3E AA       TAX         ; PUT INDEX BACK WHERE IT BELONGS.
   0CB3F 6E 2F D0 ROR $D02F   ; NOW K1 HELD LOW (%1111 1101).
   0CB42 D0 E8    BNE $CB2C   ; ZERO? NO WAY! WE'RE FORCING A JUMP
                              ;     TO $CB2C TO SCAN THE NEXT COLUMN.

   0CB44 4A       LSR         ; PROCESS KEYSTROKE ... SHIFT BITS INTO .C .
   0CB45 90 09    BCC $CB50   ; IF .C = 0 KEY STRUCK, SO WE QUIT SCANNING.
   0CB47 E8       INX         ; BUMP KEY INDEX COUNTER.
   0CB48 88       DEY         ; DECREMENT ROW COUNTER.
   0CB49 D0 F9    BNE $CB44   ; 8 ROWS DONE? NO, THEN LOOP AGAIN.
   0CB4B 6E 2F D0 ROR $D02F   ; PREPARE TO SCAN NEXT COLUMN. (KN=0)
   0CB50 BD 69 CB LDA $CB69,X ; LOOK UP C-64 KEYCODE FROM TABLE.
   0CB53 10 07    BPL $CB5C   ; IF HI-BIT (#7) SET, IT'S ED,
   0CB55 A0 01    LDY #$01    ;     SO WE SET SHIFT FLAG.
   0CB57 8C 8D 02 STY $028D  
   0CB5A 29 7F    AND #$7F    ; AND LOP OFF BIT#7 TO GET TRUE C-64 KEYCODE.
   0CB5C 85 CB    STA $CB     ; SAVE KEYCODE.
   0CB5E A6 FF    LDX $FF
   0CB60 8E 2F D0 STX $D02F   ; DEACTIVATE EXTENDED KEYSCAN LINES.
   0CB63 20 DD EA JSR $EADD   ; CONVERT KEYCODE TO ASCII BYTE, PLACE IN
                              ; BUFFER.
   0CB66 4C 7E EA JMP $EA7E   ; RESTORE REGISTER CONTENTS & RETURN FROM IRQ.

  >0CB69 40 23 2C 87 07 82 02 40 40 28 28 40 01 13 20 08
  >0CB79 40 1B 10 40 3B 0B 18 38 40

Guest

Back in the 1990's I needed a monitor for the C64 mode. I found JIM butterfield's Supermon V1.2.
It worked out very well but I missed the use of the numerical keys and the up, down, left and right keys.

So, I converted it to Merlin source code and added the code to activate the numerical keys and the cursor keys. When you exit the monitor and return to basic the keys stay active. I added a couple other features too.

I would like to upload the program so that others could use it too.
I could also email the file to anyone one that wants it.

Blacklord

Quote from: C128RETIREDBack in the 1990's I needed a monitor for the C64 mode. I found JIM butterfield's Supermon V1.2.
It worked out very well but I missed the use of the numerical keys and the up, down, left and right keys.

So, I converted it to Merlin source code and added the code to activate the numerical keys and the cursor keys. When you exit the monitor and return to basic the keys stay active. I added a couple other features too.

I would like to upload the program so that others could use it too.
I could also email the file to anyone one that wants it.
Email it to me (landover at tpg.com.au) & I'll upload it to the main site.

cheers,

Lance

Guest

I'll have to write a description on how to use the monitor and the added features.
If I can find the old source code, I'll include it also.

I have the source code for the keypad that was added to the monitor. It will run by itself.
I'll add that too.