(MESS) Added preliminary keyboard hook-up in AAKART device, adding bare-bones keyboard inputs to Acorn Archimedes. [Angelo Salese]

This commit is contained in:
Scott Stone 2014-04-08 04:20:29 +00:00
parent 8a6d7e7d00
commit f2da70078a
4 changed files with 211 additions and 314 deletions

View File

@ -64,7 +64,7 @@ void aakart_device::device_start()
m_rxtimer = timer_alloc(RX_TIMER);
m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
m_txtimer = timer_alloc(TX_TIMER);
m_txtimer->adjust(attotime::from_hz(clock()*3), 0, attotime::from_hz(clock()*3));
m_txtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
m_mousetimer = timer_alloc(MOUSE_TIMER);
m_mousetimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
m_keybtimer = timer_alloc(KEYB_TIMER);
@ -98,7 +98,7 @@ void aakart_device::device_config_complete()
void aakart_device::device_reset()
{
m_status = STATUS_NORMAL;
m_status = STATUS_HRST;
m_new_command = 0;
m_rx = -1;
m_mouse_enable = 0;
@ -108,162 +108,76 @@ void aakart_device::device_reset()
// device_timer - handler timer events
//-------------------------------------------------
#if 0
void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
#if 0
if(id == KEYB_TIMER && m_keyb_enable && m_status == STATUS_NORMAL)
{
m_new_command |= 2;
m_rx_latch = 0xd0 | 0; // keyb scancode (0xd0=up 0xc0=down, bits 3-0 row)
m_status = STATUS_KEYUP;
//m_ff ^= 1;
return;
}
#endif
if(id == MOUSE_TIMER && m_mouse_enable && m_status == STATUS_NORMAL)
{
m_new_command |= 2;
m_rx_latch = 0; // mouse X position
m_status = STATUS_MOUSE;
//m_ff ^= 1;
return;
}
if(m_new_command == 0)
return;
if(id == RX_TIMER && m_new_command & 2)
{
m_out_rx_func(ASSERT_LINE);
m_new_command &= ~2;
m_rx = m_rx_latch;
return;
}
if(id == TX_TIMER && m_new_command & 1)
{
switch(m_status)
{
case STATUS_NORMAL:
{
switch(m_tx_latch)
{
case 0x00: // set leds
case 0x00:
case 0x03:
case 0x07:
// ---- -xxx led enables;
break;
case RQID:
m_rx_latch = 0x81; //keyboard ID
break;
case SMAK:
case MACK:
case SACK:
case NACK:
if(m_tx_latch & 2) { m_mouse_enable = 1; }
if(m_tx_latch & 1) { m_keyb_enable = 1; }
break;
case HRST:
m_rx_latch = HRST;
m_status = STATUS_HRST;
break;
default:
//printf("%02x\n",m_tx_latch);
break;
}
break;
}
case STATUS_KEYDOWN:
{
switch(m_tx_latch)
{
case BACK:
m_rx_latch = 0xc0 | 0; // keyb scancode (0xd0=up 0xc0=down, bits 3-0 col)
m_status = STATUS_NORMAL;
break;
case HRST:
m_rx_latch = HRST;
m_status = STATUS_HRST;
break;
}
break;
}
case STATUS_KEYUP:
{
switch(m_tx_latch)
{
case BACK:
m_rx_latch = 0xd0 | 0; // keyb scancode (0xd0=up 0xc0=down, bits 3-0 col)
m_status = STATUS_NORMAL;
break;
case HRST:
m_rx_latch = HRST;
m_status = STATUS_HRST;
break;
}
break;
}
case STATUS_MOUSE:
{
switch(m_tx_latch)
{
case BACK:
m_rx_latch = 0; // mouse Y
m_status = STATUS_NORMAL;
break;
default:
case HRST:
m_rx_latch = HRST;
m_status = STATUS_HRST;
break;
}
break;
}
case STATUS_HRST:
{
switch(m_tx_latch)
{
case HRST: { m_rx_latch = HRST; m_keyb_enable = m_mouse_enable = 0; break; }
case RAK1: { m_rx_latch = RAK1; m_keyb_enable = m_mouse_enable = 0; break; }
case RAK2: { m_rx_latch = RAK2; m_status = STATUS_NORMAL; break; }
}
break;
}
}
case 0x20:
m_rx = 0x81;
m_out_tx_func(ASSERT_LINE);
m_new_command &= ~1;
m_new_command |= 2;
}
}
#else
void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
if(id == RX_TIMER && m_new_command & 2)
break;
case 0x30:
case 0x31:
case 0x32:
case 0x33:
m_keyb_enable = m_tx_latch & 1;
m_mouse_enable = (m_tx_latch & 2) >> 1;
if(m_keyb_enable & 1 && m_keyb_state & 1)
{
//printf("Got row\n");
m_rx = m_keyb_row;
m_out_tx_func(ASSERT_LINE);
}
break;
case 0x3f:
if(m_keyb_enable & 1 && m_keyb_state & 1)
{
//printf("Got col\n");
m_rx = m_keyb_col;
m_out_tx_func(ASSERT_LINE);
m_keyb_state = 0;
}
break;
case 0xfd:
m_rx = 0xfd;
m_out_tx_func(ASSERT_LINE);
break;
case 0xfe:
m_rx = 0xfe;
m_out_tx_func(ASSERT_LINE);
break;
case 0xff:
m_rx = 0xff;
m_out_tx_func(ASSERT_LINE);
break;
default:
printf("%02x %02x %02x\n",m_tx_latch,m_rx_latch,m_keyb_enable);
break;
}
//m_new_command &= ~1;
m_out_rx_func(ASSERT_LINE);
m_out_tx_func(CLEAR_LINE);
m_rx = m_rx_latch;
return;
}
if(id == TX_TIMER && m_new_command & 1)
{
m_out_tx_func(ASSERT_LINE);
m_new_command &= ~1;
m_new_command |= 2;
return;
}
}
#endif
//**************************************************************************
// READ/WRITE HANDLERS
//**************************************************************************
#include "debugger.h"
READ8_MEMBER( aakart_device::read )
{
m_out_rx_func(CLEAR_LINE);
m_out_tx_func(CLEAR_LINE);
//debugger_break(machine());
return m_rx;
}
@ -272,78 +186,22 @@ WRITE8_MEMBER( aakart_device::write )
// if(m_new_command) printf("skip cmd %02x\n",data);
m_tx_latch = data;
switch(m_status)
{
case STATUS_NORMAL:
{
switch(m_tx_latch)
{
case 0x00: //set leds
break;
case RQID:
m_rx_latch = 0x81; //keyboard ID
break;
case HRST:
m_rx_latch = HRST;
m_status = STATUS_HRST;
break;
case SMAK:
case MACK:
case SACK:
case NACK:
if(m_tx_latch & 2) { m_mouse_enable = 1; }
if(m_tx_latch & 1) { m_keyb_enable = 1; }
m_rx_latch = 0;
break;
case BACK:
m_rx_latch = machine().rand(); // ???
break;
default:
//printf("%02x\n",data);
break;
}
break;
}
case STATUS_KEYDOWN:
{
m_rx_latch = machine().rand();
switch(m_tx_latch)
{
case HRST:
m_rx_latch = HRST;
m_status = STATUS_HRST;
break;
default:
//m_rx_latch = 0xc0 | 0x04;
printf("%02x\n",data);
break;
}
break;
}
case STATUS_HRST:
{
switch(m_tx_latch)
{
case HRST: { m_rx_latch = HRST; m_keyb_enable = m_mouse_enable = 0; break; }
case RAK1: { m_rx_latch = RAK1; m_keyb_enable = m_mouse_enable = 0; break; }
case RAK2: { m_rx_latch = RAK2; m_status = STATUS_NORMAL; break; }
}
break;
}
}
m_out_rx_func(CLEAR_LINE);
m_new_command |= 1;
//m_tx_latch = data;
//m_new_command |= 1;
}
#if 0
void aakart_device::write_kbd_buf()
void aakart_device::send_keycode_down(UINT8 row, UINT8 col)
{
//printf("%08x\n",data);
m_out_tx_func(ASSERT_LINE);
//debugger_break(machine());
m_status = STATUS_KEYDOWN;
//printf("keycode down\n");
m_keyb_row = row | 0xc0;
m_keyb_col = col | 0xc0;
m_keyb_state = 1;
}
void aakart_device::send_keycode_up(UINT8 row, UINT8 col)
{
//printf("keycode up\n");
m_keyb_row = row | 0xd0;
m_keyb_col = col | 0xd0;
m_keyb_state = 1;
}
#endif

View File

@ -52,7 +52,8 @@ public:
// I/O operations
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( read );
void send_keycode_down(UINT8 row, UINT8 col);
void send_keycode_up(UINT8 row, UINT8 col);
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const;
@ -73,12 +74,16 @@ private:
devcb_resolved_write_line m_out_tx_func;
devcb_resolved_write_line m_out_rx_func;
int m_tx_latch, m_rx_latch;
int m_rx;
int m_new_command;
int m_status;
int m_mouse_enable;
int m_keyb_enable;
UINT8 m_tx_latch, m_rx_latch;
UINT8 m_rx;
UINT8 m_new_command;
UINT8 m_status;
UINT8 m_mouse_enable;
UINT8 m_keyb_enable;
UINT8 m_keyb_row;
UINT8 m_keyb_col;
UINT8 m_keyb_state;
};

View File

@ -416,37 +416,37 @@ void archimedes_state::archimedes_driver_init()
static const char *const ioc_regnames[] =
{
"(rw) Control", // 0
"(read) Keyboard receive (write) keyboard send", // 1
"(read) Keyboard receive (write) keyboard send", // 4
"?",
"?",
"(read) IRQ status A", // 4
"(read) IRQ request A (write) IRQ clear", // 5
"(rw) IRQ mask A", // 6
"(read) IRQ status A", // 10
"(read) IRQ request A (write) IRQ clear", // 14
"(rw) IRQ mask A", // 18
"?",
"(read) IRQ status B", // 8
"(read) IRQ request B", // 9
"(rw) IRQ mask B", // 10
"(read) IRQ status B", // 20
"(read) IRQ request B", // 24
"(rw) IRQ mask B", // 28
"?",
"(read) FIQ status", // 12
"(read) FIQ request", // 13
"(rw) FIQ mask", // 14
"(read) FIQ status", // 30
"(read) FIQ request", // 34
"(rw) FIQ mask", // 38
"?",
"(read) Timer 0 count low (write) Timer 0 latch low", // 16
"(read) Timer 0 count high (write) Timer 0 latch high", // 17
"(write) Timer 0 go command", // 18
"(write) Timer 0 latch command", // 19
"(read) Timer 1 count low (write) Timer 1 latch low", // 20
"(read) Timer 1 count high (write) Timer 1 latch high", // 21
"(write) Timer 1 go command", // 22
"(write) Timer 1 latch command", // 23
"(read) Timer 2 count low (write) Timer 2 latch low", // 24
"(read) Timer 2 count high (write) Timer 2 latch high", // 25
"(write) Timer 2 go command", // 26
"(write) Timer 2 latch command", // 27
"(read) Timer 3 count low (write) Timer 3 latch low", // 28
"(read) Timer 3 count high (write) Timer 3 latch high", // 29
"(write) Timer 3 go command", // 30
"(write) Timer 3 latch command" // 31
"(read) Timer 0 count low (write) Timer 0 latch low", // 40
"(read) Timer 0 count high (write) Timer 0 latch high", // 44
"(write) Timer 0 go command", // 48
"(write) Timer 0 latch command", // 4c
"(read) Timer 1 count low (write) Timer 1 latch low", // 50
"(read) Timer 1 count high (write) Timer 1 latch high", // 54
"(write) Timer 1 go command", // 58
"(write) Timer 1 latch command", // 5c
"(read) Timer 2 count low (write) Timer 2 latch low", // 60
"(read) Timer 2 count high (write) Timer 2 latch high", // 64
"(write) Timer 2 go command", // 68
"(write) Timer 2 latch command", // 6c
"(read) Timer 3 count low (write) Timer 3 latch low", // 70
"(read) Timer 3 count high (write) Timer 3 latch high", // 74
"(write) Timer 3 go command", // 78
"(write) Timer 3 latch command" // 7c
};
void archimedes_state::latch_timer_cnt(int tmr)

View File

@ -86,6 +86,8 @@ public:
DECLARE_DRIVER_INIT(a310);
virtual void machine_start();
virtual void machine_reset();
DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
protected:
required_device<ram_device> m_ram;
@ -151,83 +153,108 @@ static ADDRESS_MAP_START( a310_mem, AS_PROGRAM, 32, a310_state )
ADDRESS_MAP_END
INPUT_CHANGED_MEMBER(a310_state::key_stroke)
{
UINT8 row_val = (UINT8)(FPTR)(param) >> 4;
UINT8 col_val = (UINT8)(FPTR)(param) & 0xf;
if(newval && !oldval)
m_kart->send_keycode_down(row_val,col_val);
if(oldval && !newval)
m_kart->send_keycode_up(row_val,col_val);
}
// TODO:
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1) <- led enabled & 4
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1d) PORT_IMPULSE(1) <- English Pound symbol
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x21) PORT_IMPULSE(1) <- unknown but used (changes cursor to full)
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x22) PORT_IMPULSE(1) <- led enabled & 1
// 0x37 - 0x39 another 7 - 9 (keypad?)
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3a) PORT_IMPULSE(1) <- another minus (keypad?)
// 0x48 - 0x4a another 4 - 6 (keypad?)
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4b) PORT_IMPULSE(1) <- +
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4c) PORT_IMPULSE(1) <- another English Pound
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x57) PORT_IMPULSE(1) <- another /
// PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x5d) PORT_IMPULSE(1) <- led enabled & 2
static INPUT_PORTS_START( a310 )
PORT_START("dip") /* DIP switches */
PORT_BIT(0xfd, 0xfd, IPT_UNUSED)
PORT_START("key0") /* KEY ROW 0 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x00) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x11) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x12) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x13) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x14) PORT_IMPULSE(1)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x15) PORT_IMPULSE(1)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x16) PORT_IMPULSE(1)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x17) PORT_IMPULSE(1)
PORT_START("key1") /* KEY ROW 1 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x18) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x19) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1a) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1b) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1c) PORT_IMPULSE(1)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("` ~") PORT_CODE(KEYCODE_TILDE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x10) PORT_IMPULSE(1)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x1e) PORT_IMPULSE(1)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB)
PORT_START("key2") /* KEY ROW 2 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("e E") PORT_CODE(KEYCODE_E)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("u U") PORT_CODE(KEYCODE_U)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("i I") PORT_CODE(KEYCODE_I)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x27) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x28) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("e E") PORT_CODE(KEYCODE_E) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x29) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2a) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2b) PORT_IMPULSE(1)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2c) PORT_IMPULSE(1)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("u U") PORT_CODE(KEYCODE_U) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2d) PORT_IMPULSE(1)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("i I") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2e) PORT_IMPULSE(1)
PORT_START("key3") /* KEY ROW 3 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("o O") PORT_CODE(KEYCODE_O)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("p P") PORT_CODE(KEYCODE_P)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("o O") PORT_CODE(KEYCODE_O) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2f) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("p P") PORT_CODE(KEYCODE_P) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x30) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x31) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x32) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x47) PORT_IMPULSE(1)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
PORT_BIT(0x80, 0x80, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
PORT_START("key4") /* KEY ROW 4 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("s S") PORT_CODE(KEYCODE_S)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("d D") PORT_CODE(KEYCODE_D)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3c) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("s S") PORT_CODE(KEYCODE_S) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3d) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("d D") PORT_CODE(KEYCODE_D) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3e) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x3f) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x40) PORT_IMPULSE(1)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x41) PORT_IMPULSE(1)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x42) PORT_IMPULSE(1)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x43) PORT_IMPULSE(1)
PORT_START("key5") /* KEY ROW 5 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_ASTERISK)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x44) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x45) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x46) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_ASTERISK) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x33) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("x X") PORT_CODE(KEYCODE_X)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4e) PORT_IMPULSE(1)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("x X") PORT_CODE(KEYCODE_X) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x4f) PORT_IMPULSE(1)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x50) PORT_IMPULSE(1)
PORT_START("key6") /* KEY ROW 6 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH)
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x51) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x52) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x53) PORT_IMPULSE(1)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x54) PORT_IMPULSE(1)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x55) PORT_IMPULSE(1)
PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x56) PORT_IMPULSE(1)
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x23) PORT_IMPULSE(1)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT)
PORT_START("key7") /* KEY ROW 7 */
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED")
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x26) PORT_IMPULSE(1)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD)
PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD)
PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD)
@ -245,11 +272,17 @@ static INPUT_PORTS_START( a310 )
PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD)
PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD)
PORT_START("key9")
PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x20) PORT_IMPULSE(1)
PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x24) PORT_IMPULSE(1) // (KP?)
PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("#") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x25) PORT_IMPULSE(1) // (KP?)
PORT_START("via1a") /* VIA #1 PORT A */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY
@ -297,7 +330,8 @@ static MACHINE_CONFIG_START( a310, a310_state )
MCFG_CPU_ADD("maincpu", ARM, 8000000) /* 8 MHz */
MCFG_CPU_PROGRAM_MAP(a310_mem)
MCFG_AAKART_ADD("kart", 8000000/128, kart_interface) // TODO: frequency
MCFG_AAKART_ADD("kart", 8000000/256, kart_interface) // TODO: frequency
MCFG_I2CMEM_ADD("i2cmem")
MCFG_I2CMEM_DATA_SIZE(0x100)