src/mess/drivers/mycom.c
| r9449 | r9450 | |
| 1 | | /*************************************************************************** |
| 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | 3 | MYCOMZ-80A (c) 1981 Japan Electronics College |
| 4 | 4 | |
| 5 | 5 | preliminary driver by Angelo Salese |
| 6 | additions by Robbbert |
| 6 | 7 | |
| 8 | THE KEYBOARD |
| 9 | - Uses a 4MO1003A custom mcu. |
| 10 | - Every combination is documented in the manual, including the unused ones. |
| 11 | - All commands must be in uppercase - lowercase will produce errors. |
| 12 | - There are 5 special keys which do crude editing functions. These are in |
| 13 | the range 0x61 to 0x75. Kana characters occupy the range 0xa0 to 0xff. |
| 14 | Graphics characters are found in 0x00 to 0x1f, and 0x80 to 0x9f. |
| 15 | - Editing characters (hold down shift to get them): |
| 16 | a - shiftlock (toggle). You can then enter any lowercase character. |
| 17 | c - clear screen and home cursor |
| 18 | d - insert |
| 19 | f - vertical tab (cursor up) |
| 20 | u - cursor right |
| 21 | - There are switches on the right-hand side which are connected directly |
| 22 | to one of the PIAs. The switches (not emulated): |
| 23 | s2 - ?unknown |
| 24 | s3 - ?unknown but must be high for the keyboard to function |
| 25 | s4 - cassette motor on/off |
| 26 | s5 - ?unknown |
| 27 | - There is also switch s1 which it is not known what it connects to. |
| 28 | - Please note: The Takeda 80-column monitor expects the enter key to be the |
| 29 | line feed key. This is the numpad-enter in our emulation. Strangely, the |
| 30 | standard monitor, and Basic, will also respond to this key. |
| 31 | - The keyboard has a "English" key on the left, and a "Japan" key on the |
| 32 | right. Pressing the appropriate key toggles the input language mode. |
| 33 | Internally, this turns the Kana bit off/on. On our keyboard, hold down |
| 34 | the ALT key to get Kana; release it to get English. |
| 35 | |
| 7 | 36 | TODO: |
| 8 | 37 | - SN doesn't seem to work properly, needs to find out what's the WE bit |
| 9 | 38 | for. |
| r9449 | r9450 | |
| 11 | 40 | - Hook-up CMT load / save; (save works, load does not) |
| 12 | 41 | - Printer |
| 13 | 42 | - RTC |
| 43 | - Keyboard lookup table for Kana and Shifted Kana |
| 44 | - Keyboard autorepeat |
| 14 | 45 | |
| 15 | | ****************************************************************************/ |
| 46 | *******************************************************************************/ |
| 16 | 47 | |
| 17 | 48 | #include "emu.h" |
| 18 | 49 | #include "cpu/z80/z80.h" |
| r9449 | r9450 | |
| 33 | 64 | static UINT8 *vram; |
| 34 | 65 | static UINT8 *gfx_rom; |
| 35 | 66 | static UINT16 vram_addr; |
| 36 | | static UINT8 keyb_press,keyb_press_flag,shift_press_flag; |
| 67 | static UINT8 keyb_press,keyb_press_flag; |
| 37 | 68 | static UINT8 video_mode,sn_we; |
| 38 | 69 | static UINT32 upper_sw; |
| 39 | | static UINT8 * RAM; |
| 70 | static UINT8 *RAM; |
| 40 | 71 | |
| 41 | 72 | static VIDEO_START( mycom ) |
| 42 | 73 | { |
| r9449 | r9450 | |
| 182 | 213 | |
| 183 | 214 | /* Input ports */ |
| 184 | 215 | static INPUT_PORTS_START( mycom ) |
| 216 | PORT_START("X0") |
| 217 | PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) |
| 218 | PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 185 | 219 | |
| 186 | | PORT_START("key1") //0x00-0x1f |
| 187 | | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null |
| 188 | | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh |
| 189 | | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x02 stx |
| 190 | | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x03 etx |
| 191 | | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x04 eot |
| 192 | | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x05 enq |
| 193 | | PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x06 ack |
| 194 | | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x07 bel |
| 195 | | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 196 | | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) |
| 197 | | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(10) |
| 198 | | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b vt |
| 199 | | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c ff |
| 200 | | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0d cr |
| 201 | | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e so |
| 202 | | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f si |
| 220 | PORT_START("X1") |
| 221 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 222 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 223 | PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 224 | PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 225 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 226 | PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 227 | PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 228 | PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 229 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 203 | 230 | |
| 204 | | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 dle |
| 205 | | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dc1 |
| 206 | | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc2 |
| 207 | | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc3 |
| 208 | | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) |
| 209 | | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 nak |
| 210 | | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 211 | | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 etb |
| 212 | | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 can |
| 213 | | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 214 | | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a sub |
| 215 | | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) |
| 216 | | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1c fs |
| 217 | | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1d gs |
| 218 | | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1e rs |
| 219 | | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1f us |
| 231 | PORT_START("X2") |
| 232 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(17) |
| 233 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(23) |
| 234 | PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(5) |
| 235 | PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(18) |
| 236 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(20) |
| 237 | PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(25) |
| 238 | PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(21) |
| 239 | PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(9) |
| 240 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(15) |
| 220 | 241 | |
| 221 | | PORT_START("key2") //0x20-0x3f |
| 222 | | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 223 | | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! |
| 224 | | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " |
| 225 | | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # |
| 226 | | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ |
| 227 | | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % |
| 228 | | PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & |
| 229 | | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' |
| 230 | | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( |
| 231 | | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) |
| 232 | | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') //0x2a * |
| 233 | | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) |
| 234 | | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , |
| 235 | | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') |
| 236 | | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . |
| 237 | | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / |
| 242 | PORT_START("X3") |
| 243 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(1) |
| 244 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(19) |
| 245 | PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(4) |
| 246 | PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(6) |
| 247 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(7) |
| 248 | PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(8) |
| 249 | PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(10) |
| 250 | PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(11) |
| 251 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(12) |
| 238 | 252 | |
| 239 | | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 240 | | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 241 | | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 242 | | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 243 | | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 244 | | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 245 | | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 246 | | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 247 | | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 248 | | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 249 | | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') |
| 250 | | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') |
| 251 | | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') |
| 252 | | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = |
| 253 | | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > |
| 254 | | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? |
| 253 | PORT_START("X4") |
| 254 | PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) |
| 255 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(26) |
| 256 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(24) |
| 257 | PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(3) |
| 258 | PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(22) |
| 259 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(2) |
| 260 | PORT_BIT(0x040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(14) |
| 261 | PORT_BIT(0x080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(13) |
| 262 | PORT_BIT(0x100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("< ,") PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') |
| 263 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("> .") PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') |
| 255 | 264 | |
| 256 | | PORT_START("key3") //0x40-0x5f |
| 257 | | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 258 | | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 259 | | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 260 | | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 261 | | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 262 | | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 263 | | PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 264 | | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 265 | | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 266 | | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 267 | | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 268 | | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 269 | | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 270 | | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 271 | | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 272 | | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 273 | | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 274 | | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 275 | | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 276 | | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 277 | | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 278 | | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 279 | | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 280 | | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 281 | | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 282 | | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 283 | | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 284 | | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') |
| 285 | | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) |
| 286 | | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 287 | | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') |
| 288 | | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") |
| 265 | PORT_START("X5") |
| 266 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(u)") PORT_CHAR('u') |
| 267 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(c)") PORT_CHAR('c') |
| 289 | 268 | |
| 290 | | PORT_START("key_modifiers") |
| 291 | | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) |
| 292 | | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) |
| 293 | | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) |
| 294 | | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 295 | | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) |
| 269 | PORT_START("X6") |
| 270 | PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 271 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') |
| 272 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_CHAR(30) |
| 273 | PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\ _") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('_') PORT_CHAR(28) |
| 274 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(d)") PORT_CHAR('d') |
| 275 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(f)") PORT_CHAR('f') |
| 276 | |
| 277 | PORT_START("X7") |
| 278 | PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(16) |
| 279 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('`') PORT_CHAR(0) |
| 280 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(27) |
| 281 | PORT_BIT(0x008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LineFeed") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(10) |
| 282 | PORT_BIT(0x010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 283 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(a)") PORT_CHAR('a') |
| 284 | |
| 285 | PORT_START("X8") |
| 286 | PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 287 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') |
| 288 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(29) |
| 289 | PORT_BIT(0x020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 290 | PORT_BIT(0x200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 291 | |
| 292 | PORT_START("XX") |
| 293 | PORT_BIT(0x001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 294 | PORT_BIT(0x002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 295 | PORT_BIT(0x004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) |
| 296 | 296 | INPUT_PORTS_END |
| 297 | 297 | |
| 298 | |
| 298 | 299 | /* F4 Character Displayer */ |
| 299 | 300 | static const gfx_layout mycom_charlayout = |
| 300 | 301 | { |
| r9449 | r9450 | |
| 337 | 338 | |
| 338 | 339 | static WRITE8_DEVICE_HANDLER( mycom_04_w ) |
| 339 | 340 | { |
| 340 | | vram_addr = (vram_addr & 0x700) | (data & 0x0ff); |
| 341 | vram_addr = (vram_addr & 0x700) | data; |
| 341 | 342 | |
| 342 | 343 | /* doesn't work? */ |
| 343 | 344 | //printf("%02x %02x\n",data,sn_we); |
| r9449 | r9450 | |
| 357 | 358 | ---- --x- keyboard shift |
| 358 | 359 | ---- ---x keyboard strobe |
| 359 | 360 | */ |
| 360 | | UINT8 data = shift_press_flag << 1; |
| 361 | UINT8 data = 0; |
| 361 | 362 | |
| 362 | | data |= keyb_press_flag; |
| 363 | | keyb_press_flag = 0; |
| 363 | data = keyb_press_flag; //~keyb_press_flag & 1; |
| 364 | 364 | |
| 365 | 365 | //if (cassette_input(mycom_cassette) > 0.03) // not working |
| 366 | 366 | // data+=4; |
| r9449 | r9450 | |
| 381 | 381 | |
| 382 | 382 | static READ8_DEVICE_HANDLER( mycom_05_r ) |
| 383 | 383 | { |
| 384 | | //keyb_press_flag = 0; |
| 385 | 384 | return keyb_press; |
| 386 | 385 | } |
| 387 | 386 | |
| r9449 | r9450 | |
| 436 | 435 | DEVCB_NULL /* Port C write */ |
| 437 | 436 | }; |
| 438 | 437 | |
| 439 | | static TIMER_CALLBACK( keyboard_callback ) |
| 438 | static const UINT8 mycom_keyval[] = { 0, |
| 439 | 0x1b,0x1b,0x7c,0x7c,0x18,0x18,0x0f,0x0f,0x09,0x09,0x1c,0x1c,0x30,0x00,0x50,0x70,0x3b,0x2b, |
| 440 | 0x00,0x00,0x31,0x21,0x51,0x71,0x41,0x61,0x5a,0x7a,0x17,0x17,0x2d,0x3d,0x40,0x60,0x3a,0x2a, |
| 441 | 0x0b,0x0b,0x32,0x22,0x57,0x77,0x53,0x73,0x58,0x78,0x03,0x03,0x5e,0x7e,0x5b,0x7b,0x5d,0x7d, |
| 442 | 0x1f,0x1f,0x33,0x23,0x45,0x65,0x44,0x64,0x43,0x63,0x0c,0x0c,0x5c,0x7c,0x0a,0x0a,0x00,0x00, |
| 443 | 0x01,0x01,0x34,0x24,0x52,0x72,0x46,0x66,0x56,0x76,0x04,0x04,0x7f,0x7f,0x08,0x08,0x0e,0x0e, |
| 444 | 0x02,0x02,0x35,0x25,0x54,0x74,0x47,0x67,0x42,0x62,0x75,0x75,0x64,0x64,0x00,0x00,0x20,0x20, |
| 445 | 0x1e,0x1e,0x36,0x26,0x59,0x79,0x48,0x68,0x4e,0x6e,0x37,0x37,0x34,0x34,0x31,0x31,0x30,0x30, |
| 446 | 0x1d,0x1d,0x37,0x27,0x55,0x75,0x4a,0x6a,0x4d,0x6d,0x38,0x38,0x35,0x35,0x32,0x32,0x11,0x11, |
| 447 | 0x0d,0x0d,0x38,0x28,0x49,0x69,0x4b,0x6b,0x2c,0x3c,0x39,0x39,0x36,0x36,0x33,0x33,0x12,0x12, |
| 448 | 0x07,0x07,0x39,0x29,0x4f,0x6f,0x4c,0x6c,0x2e,0x3e,0x63,0x63,0x66,0x66,0x61,0x61,0x2f,0x3f }; |
| 449 | |
| 450 | static TIMER_CALLBACK( mycom_kbd ) |
| 440 | 451 | { |
| 441 | | const char* portnames[3] = { "key1","key2","key3" }; |
| 442 | | int i,port_i,scancode; |
| 443 | | UINT8 keymod = input_port_read(machine,"key_modifiers") & 0x1f; |
| 444 | | scancode = 0; |
| 452 | UINT8 x, y, scancode = 0; |
| 453 | UINT16 pressed[9]; |
| 454 | char kbdrow[2]; |
| 455 | UINT8 modifiers = input_port_read(machine, "XX"); |
| 456 | UINT8 shift_pressed = (modifiers & 2) >> 1; |
| 457 | keyb_press_flag = 0; |
| 445 | 458 | |
| 446 | | shift_press_flag = ((keymod & 0x02) >> 1); |
| 459 | /* see what is pressed */ |
| 460 | for (x = 0; x < 9; x++) |
| 461 | { |
| 462 | sprintf(kbdrow,"X%d",x); |
| 463 | pressed[x] = (input_port_read(machine, kbdrow)); |
| 464 | } |
| 447 | 465 | |
| 448 | | for(port_i=0;port_i<3;port_i++) |
| 466 | /* find what has changed */ |
| 467 | for (x = 0; x < 9; x++) |
| 449 | 468 | { |
| 450 | | for(i=0;i<32;i++) |
| 469 | if (pressed[x]) |
| 451 | 470 | { |
| 452 | | if((input_port_read(machine,portnames[port_i])>>i) & 1) |
| 471 | /* get scankey value */ |
| 472 | for (y = 0; y < 10; y++) |
| 453 | 473 | { |
| 454 | | //key_flag = 1; |
| 455 | | if(!shift_press_flag) // shift not pressed |
| 474 | if (BIT(pressed[x], y)) |
| 456 | 475 | { |
| 457 | | //if(scancode >= 0x41 && scancode < 0x5b) |
| 458 | | // scancode += 0x20; // lowercase, FIXME: 'A' doesn't work properly? |
| 476 | scancode = ((x + y * 9) << 1) + shift_pressed + 1; |
| 477 | keyb_press_flag = 1; |
| 478 | keyb_press = mycom_keyval[scancode]; |
| 459 | 479 | } |
| 460 | | else |
| 461 | | { |
| 462 | | if(scancode >= 0x31 && scancode < 0x3a) |
| 463 | | scancode -= 0x10; |
| 464 | | if(scancode == 0x30) |
| 465 | | scancode = 0x3d; |
| 466 | | |
| 467 | | if(scancode == 0x3b) |
| 468 | | scancode = 0x2c; |
| 469 | | |
| 470 | | if(scancode == 0x3a) |
| 471 | | scancode = 0x2e; |
| 472 | | if(scancode == 0x5b) |
| 473 | | scancode = 0x2b; |
| 474 | | if(scancode == 0x3c) |
| 475 | | scancode = 0x3e; |
| 476 | | } |
| 477 | | if (keymod & 1) scancode &= 0xbf; // ctrl, sets d6 low |
| 478 | | if (keymod & 4) scancode |= 0x80; // kana, sets d7 high |
| 479 | | keyb_press = scancode; |
| 480 | | keyb_press_flag = 1; |
| 481 | | return; |
| 482 | 480 | } |
| 483 | | scancode++; |
| 484 | 481 | } |
| 485 | 482 | } |
| 483 | |
| 484 | if (keyb_press_flag) |
| 485 | { |
| 486 | if (modifiers & 1) keyb_press &= 0xbf; |
| 487 | if (modifiers & 4) keyb_press |= 0x80; |
| 488 | } |
| 486 | 489 | } |
| 487 | 490 | |
| 488 | 491 | static MACHINE_START(mycom) |
| 489 | 492 | { |
| 490 | | timer_pulse(machine, ATTOTIME_IN_HZ(240/32), NULL, 0, keyboard_callback); |
| 491 | 493 | mycom_cassette = machine->device("cassette"); |
| 492 | 494 | RAM = memory_region(machine, "maincpu"); |
| 495 | timer_pulse(machine, ATTOTIME_IN_HZ(20), NULL, 0, mycom_kbd); |
| 493 | 496 | } |
| 494 | 497 | |
| 495 | 498 | static MACHINE_RESET(mycom) |