add cursor keys to at800,c64,v20

This commit is contained in:
jean-marcharvengt 2023-04-22 18:04:03 +02:00
parent f8d5087360
commit 8eec4cf375
33 changed files with 25 additions and 27 deletions

View file

@ -6,9 +6,9 @@ include(pico_sdk_import.cmake)
# We also need PICO EXTRAS
#include(pico_extras_import.cmake)
#set(TARGET testkeymax)
set(TARGET testkeymax)
#set(TARGET pico20)
set(TARGET pico64)
#set(TARGET pico64)
#set(TARGET pico81)
#set(TARGET picospeccy)
#set(TARGET pico800)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -491,6 +491,7 @@ int emu_ReadKeys(void)
if ( !gpio_get(PIN_KEY_USER4) ) retval |= MASK_KEY_USER4;
#endif
#if (defined(PICOMPUTER) || defined(PICOZX) )
keymatrix_hitrow = -1;
unsigned char row;
@ -539,8 +540,6 @@ int emu_ReadKeys(void)
keymatrixtmp[i] = row;
}
#ifdef SWAP_ALT_DEL
// Swap ALT and DEL
unsigned char alt = keymatrixtmp[0] & 0x02;
@ -564,15 +563,17 @@ int emu_ReadKeys(void)
keymatrix[i] = row;
}
#ifdef PICOZX
key_fn = false;
key_alt = false;
//row = keymatrix[6];
if ( row & 0x02 ) retval |= MASK_KEY_USER1;
if ( row & 0x10 ) retval |= MASK_KEY_USER2;
if ( row & 0x20 ) retval |= MASK_KEY_USER3;
if ( row & 0x40 ) retval |= MASK_KEY_USER4;
row = keymatrix[0];
key_fn = false;
key_alt = false;
if ( row & 0x20 ) {key_fn = true; keymatrix[0] &= ~0x20;}
if ( row & 0x40 ) {key_alt = true;keymatrix[0] &= ~0x40; }
//19,20,21,22,26,27,28
#if INVX
if ( row & 0x2 ) retval |= MASK_JOY2_LEFT;
@ -589,10 +590,8 @@ int emu_ReadKeys(void)
if ( row & 0x8 ) retval |= MASK_JOY2_UP;
#endif
if ( row & 0x04 ) retval |= MASK_JOY2_BTN;
if ( row & 0x20 ) key_fn = true;
if ( row & 0x40 ) key_alt = true;
#else
#else // end PICOZX
//6,9,15,8,7,22
#if INVX
if ( row & 0x2 ) retval |= MASK_JOY2_LEFT;
@ -691,10 +690,9 @@ int emu_ReadKeys(void)
}
}
#endif
#endif
if ( key_fn ) retval |= MASK_KEY_USER2;
if ( ( key_fn ) && (keymatrix[0] == 0x02 )) retval |= MASK_KEY_USER1;
#endif

View file

@ -34,7 +34,7 @@ const unsigned short key_map2[] = {
0,0,0,'<','>',0,0,0,';','"',
0,0,0,0,0,'^','-','+','=',0x0D,
0,':',0,'?','\/','*',',','.',0,' ',
145,157,29,17,0,0 // U L R D
145,157,29,17,157,29 // U L R D L R
};
const unsigned short key_map3[] = {
@ -42,7 +42,7 @@ const unsigned short key_map3[] = {
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0
145,157,29,17,157,29 // U L R D L R
};
const unsigned short matkeys[] = {

View file

@ -201,13 +201,12 @@ const uint32_t ascii2scan[] = {
static int ik;
static int ihk;
static int pik=0;
void v20_Input(int bClick) {
ik = emu_GetPad();
ihk = emu_ReadI2CKeyboard();
ik = emu_GetPad();
}
void emu_KeyboardOnDown(int keymodifer, int key) {
@ -360,7 +359,7 @@ void v20_Step(void)
#if (defined(PICOMPUTER) || defined(PICOZX) )
if (hk) {
int scan = ascii2scan[ihk];
int scan = ascii2scan[hk];
if (scan & 0x10000) mos6522.setShiftPressed(true);
else mos6522.setShiftPressed(false);
mos6522.setKeyPressed(scan & 0xffff);
@ -375,7 +374,8 @@ void v20_Step(void)
int k=ik;
#if (defined(PICOMPUTER) || defined(PICOZX) )
// Ignore joypad if shift is pressed!!!
if ( !(k & MASK_KEY_USER2) )
// if ( !(k & MASK_KEY_USER2) )
if ( hk == 0 )
#endif
{
if ( !(pik & MASK_JOY2_BTN) && (k & MASK_JOY2_BTN) ) {

View file

@ -42,7 +42,7 @@ const unsigned short key_map3[] = {
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0
145,157,29,17,0,0 // U L R D
};
const unsigned short matkeys[] = {

View file

@ -27,7 +27,7 @@ const unsigned short key_map1[] = {
0x2F+1,0x2F,0x2A+1,0x28+1,0x2D+1,0x2B+1,0x0B+1,0x0D+1,0x08+1,0x0A+1,
0x3F+1,0x3F,0x3A+1,0x38+1,0x3D+1,0x39+1,0x01+1,0x05+1,0x00+1,0x0D,
0,0x17+1,0x16+1,0x12+1,0x10+1,0x15+1,0x23+1,0x25+1,0,0x21+1,
0,0,0,0,0,0 //U L R D L R
0,0,0,0,0x34+1,0x87+1 // back R
};
const unsigned short key_map2[] = {
@ -35,7 +35,7 @@ const unsigned short key_map2[] = {
0,0,0,0x36+1,0x37+1,0,0,0,0x02+1,94+1,
0,0,0,0,0,0,0x0E + 1,0x06+1,0x0F+1,0x0D,
0,66+1,0,102+1,0x26+1,0x07+1,0x20+1,0x22+1,0,' ',
0,0,0,0,0,0
0x8e + 1,0x86+1,0x87+1,0x8f+1,0x34+1,0x87+1 //U L R D back R
};
const unsigned short key_map3[] = {
@ -43,7 +43,7 @@ const unsigned short key_map3[] = {
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0
0x8e + 1,0x86+1,0x87+1,0x8f+1,0x34+1,0x87+1 //U L R D back R
};
const unsigned short matkeys[] = {
@ -72,7 +72,7 @@ const unsigned short key_map2[] = {
0x1F+1,0x1F,0x1A+1,0x18+1,0x1D+1,0x1B+1,0x33+1,0x35+1,0x30+1,0x32+1,0x0F+1, // Digits
0x2C+1,95+1,117+1,90+1,88+1,93+1,0x06+1,91+1,0x07+1,0x0E + 1,0, // various
0, 112+1,114+1,102+1,0x26+1,94+1,0x36+1,0x37+1,0x20+1,66+1,
0,0,0,0
0x8e + 1,0x86+1,0x87+1,0x8f+1 //U L R D
};
//0x07+1=*, 0x22+1=.,0x26+1=/, 0x02+1=;, 0x06+1=+, 0x36+1=<, 0x37+1=>, 0x0F+1==, 0x0E+1=-, 0x06+1=+
@ -83,7 +83,7 @@ const unsigned short key_map3[] = {
3+1,4+1,19+1,20+1,17+1,0,0,0,0,0,0, // function keys
0, 0,0,0,0,0,0,0,0,0,0,
0, 0,0,0,0,115+1,0,0,0x02+1,0,
0,0,0,0
0x8e + 1,0x86+1,0x87+1,0x8f+1 //U L R D
};