diff options
Diffstat (limited to 'src/devices/machine/kr2376.cpp')
| -rw-r--r-- | src/devices/machine/kr2376.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/devices/machine/kr2376.cpp b/src/devices/machine/kr2376.cpp index ff2c1d00bec..14de041c58d 100644 --- a/src/devices/machine/kr2376.cpp +++ b/src/devices/machine/kr2376.cpp @@ -4,6 +4,10 @@ SMC KR2376 Keyboard Encoder emulation + Notes: + - the ROM contains 2376 bits, 3 x 88 x 9 bits per code. The last bit is + parity which we calculate so only define the 8 data bits. + **********************************************************************/ #include "emu.h" @@ -39,13 +43,13 @@ uint8_t kr2376_st_device::key_codes(int mode, int x, int y) // DLE K L N M NAK SYN ETB CAN EM SUB X1 { 0x10, 0x4b, 0x4c, 0x4e, 0x4d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1 // - FS GS RS US < > , SP . _ X2 - { 0x2d, 0x1c, 0x1d, 0x1e, 0x1f, 0x3c, 0x3e, 0x2c, 0x20, 0x2e, 0x5f }, // X2 + { 0xad, 0x1c, 0x1d, 0x1e, 0x1f, 0xbc, 0xbe, 0xac, 0xa0, 0xae, 0x5f }, // X2 // 0 : p _ @ BS [ ] CR LF DEL X3 - { 0x30, 0x3a, 0x70, 0x5f, 0x40, 0x08, 0x5B, 0x5d, 0x0d, 0x0a, 0x7f }, // X3 - { 0x3b, 0x2f, 0x2e, 0x2c, 0x6d, 0x6e, 0x62, 0x76, 0x63, 0x78, 0x7a }, // X4 + { 0xb0, 0xba, 0x70, 0x5f, 0x40, 0x08, 0x5B, 0x5d, 0x0d, 0x0a, 0xff }, // X3 + { 0xbb, 0xaf, 0xae, 0xac, 0x6d, 0x6e, 0x62, 0x76, 0x63, 0x78, 0x7a }, // X4 { 0x6c, 0x6b, 0x6a, 0x68, 0x67, 0x66, 0x64, 0x73, 0x61, 0x0c, 0x1b }, // X5 { 0x6f, 0x69, 0x75, 0x79, 0x74, 0x72, 0x65, 0x77, 0x71, 0x09, 0x0b }, // X6 - { 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x5e, 0x5c } // X7 + { 0xb9, 0xb8, 0xb7, 0xb6, 0xb5, 0xb4, 0xb3, 0xb2, 0xb1, 0x5e, 0x5c } // X7 }, // shift @@ -56,13 +60,13 @@ uint8_t kr2376_st_device::key_codes(int mode, int x, int y) // DLE [ \ ^ ] NAK SYN ETB CAN EM SUB X1 { 0x10, 0x5b, 0x5c, 0x5e, 0x5d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1 // = FS GS RS US < > , SP . _ X2 - { 0x3d, 0x1c, 0x1d, 0x1e, 0x1f, 0x3c, 0x3e, 0x2c, 0x20, 0x2e, 0x5f }, // X2 + { 0xbd, 0x1c, 0x1d, 0x1e, 0x1f, 0xbc, 0xbe, 0xac, 0xa0, 0xae, 0x5f }, // X2 // NUL * P DEL ` BS { } CR LF DEL X3 - { 0x00, 0x2a, 0x50, 0x7f, 0x60, 0x08, 0x7b, 0x7d, 0x0d, 0x0a, 0x7f }, // X3 - { 0x2b, 0x3f, 0x3e, 0x3c, 0x4d, 0x4e, 0x42, 0x56, 0x43, 0x58, 0x5a }, // X4 + { 0x00, 0xaa, 0x50, 0xff, 0xe0, 0x08, 0xfb, 0xfd, 0x0d, 0x0a, 0xff }, // X3 + { 0xab, 0xbf, 0xbe, 0xbc, 0x4d, 0x4e, 0x42, 0x56, 0x43, 0x58, 0x5a }, // X4 { 0x4c, 0x4b, 0x4a, 0x48, 0x47, 0x46, 0x44, 0x53, 0x41, 0x0c, 0x1b }, // X5 { 0x4f, 0x49, 0x55, 0x59, 0x54, 0x52, 0x45, 0x57, 0x51, 0x09, 0x0b }, // X6 - { 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x7e, 0x7c } // X7 + { 0xa9, 0xa8, 0xa7, 0xa6, 0xa5, 0xa4, 0xa3, 0xa2, 0xa1, 0xfe, 0xfc } // X7 }, // control @@ -73,9 +77,9 @@ uint8_t kr2376_st_device::key_codes(int mode, int x, int y) // DLE VT FF SO CR NAK SYN ETB CAN EM SUB X1 { 0x10, 0x0b, 0x0c, 0x0e, 0x0d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1 // NUL FS GS RS US NUL NUL NUL SP NUL US X2 - { 0x00, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x1f }, // X2 + { 0x00, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x1f }, // X2 // NUL NUL DLE US NUL BS ESC GS CR LF DEL X3 - { 0x00, 0x00, 0x10, 0x1f, 0x00, 0x08, 0x1B, 0x1d, 0x0d, 0x0a, 0x7f }, // X3 + { 0x00, 0x00, 0x10, 0x1f, 0x00, 0x08, 0x1B, 0x1d, 0x0d, 0x0a, 0xff }, // X3 { 0x00, 0x00, 0x00, 0x00, 0x1d, 0x0e, 0x02, 0x16, 0x03, 0x18, 0x1a }, // X4 { 0x0c, 0x0b, 0x0a, 0x08, 0x07, 0x06, 0x04, 0x13, 0x01, 0x0c, 0x1b }, // X5 { 0x1f, 0x09, 0x15, 0x19, 0x14, 0x12, 0x05, 0x17, 0x11, 0x09, 0x0b }, // X6 @@ -255,15 +259,12 @@ void kr2376_device::detect_keypress() /* strobe 0->1 transition, encode char and update parity */ if (!m_strobe_old) { - int i; int parbit; - int shift = m_read_shift(); - int control = m_read_control(); int table = 0; - if (shift) + if (m_read_shift()) table = 1; - else if (control) + else if (m_read_control()) table = 2; m_data = key_codes(table, m_ring8, m_ring11); @@ -271,7 +272,7 @@ void kr2376_device::detect_keypress() /* Compute ODD parity */ m_parity = m_data; parbit = 0; - for (i=0; i<8; i++) + for (int i=0; i<8; i++) parbit ^= (m_parity >> i) & 1; m_parity = parbit; } |
