src/mess/drivers/prof80.c
| r5038 | r5039 | |
| 13 | 13 | |
| 14 | 14 | TODO: |
| 15 | 15 | |
| 16 | - keyboard |
| 16 | 17 | - grip31 does not work |
| 17 | | - write all 0 to flr_w on reset |
| 18 | 18 | - PROF-80 RAM banking |
| 19 | 19 | - PROF-80 floppy access |
| 20 | 20 | - GRIP model selection |
| r5038 | r5039 | |
| 37 | 37 | #include "machine/z80sti.h" |
| 38 | 38 | #include "machine/ctronics.h" |
| 39 | 39 | |
| 40 | /* Keyboard HACK */ |
| 41 | |
| 42 | static const UINT8 prof80_keycodes[3][9][8] = |
| 43 | { |
| 44 | /* unshifted */ |
| 45 | { |
| 46 | { 0x1e, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 }, |
| 47 | { 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x08, 0x7f, 0x2d }, |
| 48 | { 0x37, 0x38, 0x39, 0x09, 0x71, 0x77, 0x65, 0x72 }, |
| 49 | { 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d }, |
| 50 | { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x61, 0x73, 0x64 }, |
| 51 | { 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27 }, |
| 52 | { 0x0d, 0x0a, 0x01, 0x31, 0x32, 0x33, 0x7a, 0x78 }, |
| 53 | { 0x63, 0x76, 0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f }, |
| 54 | { 0x04, 0x02, 0x03, 0x30, 0x2e, 0x20, 0x00, 0x00 } |
| 55 | }, |
| 56 | |
| 57 | /* shifted */ |
| 58 | { |
| 59 | { 0x1e, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26 }, |
| 60 | { 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x08, 0x7f, 0x2d }, |
| 61 | { 0x37, 0x38, 0x39, 0x09, 0x51, 0x57, 0x45, 0x52 }, |
| 62 | { 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d }, |
| 63 | { 0x1b, 0x2b, 0x34, 0x35, 0x36, 0x41, 0x53, 0x44 }, |
| 64 | { 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22 }, |
| 65 | { 0x0d, 0x0a, 0x01, 0x31, 0x32, 0x33, 0x5a, 0x58 }, |
| 66 | { 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f }, |
| 67 | { 0x04, 0x02, 0x03, 0x30, 0x2e, 0x20, 0x00, 0x00 } |
| 68 | }, |
| 69 | |
| 70 | /* control */ |
| 71 | { |
| 72 | { 0x9e, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 }, |
| 73 | { 0x98, 0x99, 0x90, 0x1f, 0x9a, 0x88, 0xff, 0xad }, |
| 74 | { 0xb7, 0xb8, 0xb9, 0x89, 0x11, 0x17, 0x05, 0x12 }, |
| 75 | { 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1b, 0x1d }, |
| 76 | { 0x9b, 0xab, 0xb4, 0xb5, 0xb6, 0x01, 0x13, 0x04 }, |
| 77 | { 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x7e, 0x60 }, |
| 78 | { 0x8d, 0x8a, 0x81, 0xb1, 0xb2, 0xb3, 0x1a, 0x18 }, |
| 79 | { 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x1c, 0x7c, 0x5c }, |
| 80 | { 0x84, 0x82, 0x83, 0xb0, 0xae, 0x00, 0x00, 0x00 } |
| 81 | } |
| 82 | }; |
| 83 | |
| 84 | static void prof80_keyboard_scan(running_machine *machine) |
| 85 | { |
| 86 | prof80_state *state = machine->driver_data; |
| 87 | |
| 88 | static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; |
| 89 | int table = 0, row, col; |
| 90 | int keydata = -1; |
| 91 | |
| 92 | if (input_port_read(machine, "ROW9") & 0x07) |
| 93 | { |
| 94 | /* shift, upper case */ |
| 95 | table = 1; |
| 96 | } |
| 97 | |
| 98 | if (input_port_read(machine, "ROW9") & 0x18) |
| 99 | { |
| 100 | /* ctrl */ |
| 101 | table = 2; |
| 102 | } |
| 103 | |
| 104 | /* scan keyboard */ |
| 105 | for (row = 0; row < 9; row++) |
| 106 | { |
| 107 | UINT8 data = input_port_read(machine, keynames[row]); |
| 108 | |
| 109 | for (col = 0; col < 8; col++) |
| 110 | { |
| 111 | if (!BIT(data, col)) |
| 112 | { |
| 113 | /* latch key data */ |
| 114 | keydata = ~prof80_keycodes[table][row][col]; |
| 115 | |
| 116 | if (state->keydata != keydata) |
| 117 | { |
| 118 | state->keydata = keydata; |
| 119 | |
| 120 | /* trigger GRIP 8255 port C bit 2 (_STBB) */ |
| 121 | ppi8255_set_port_c(state->ppi8255, 0x54); |
| 122 | ppi8255_set_port_c(state->ppi8255, 0x50); |
| 123 | ppi8255_set_port_c(state->ppi8255, 0x54); |
| 124 | return; |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | state->keydata = keydata; |
| 131 | } |
| 132 | |
| 133 | static TIMER_DEVICE_CALLBACK( prof80_keyboard_tick ) |
| 134 | { |
| 135 | prof80_state *state = timer->machine->driver_data; |
| 136 | |
| 137 | if (!state->kbf) prof80_keyboard_scan(timer->machine); |
| 138 | } |
| 139 | |
| 40 | 140 | /* PROF-80 */ |
| 41 | 141 | |
| 42 | 142 | static void prof80_bankswitch(running_machine *machine) |
| r5038 | r5039 | |
| 79 | 179 | } |
| 80 | 180 | } |
| 81 | 181 | |
| 82 | | static WRITE8_HANDLER( flr_w ) |
| 182 | static void ls259_w(running_machine *machine, int fa, int sa, int fb, int sb) |
| 83 | 183 | { |
| 84 | | /* |
| 184 | prof80_state *state = machine->driver_data; |
| 85 | 185 | |
| 86 | | bit description |
| 87 | | |
| 88 | | 0 FB |
| 89 | | 1 SB0 |
| 90 | | 2 SB1 |
| 91 | | 3 SB2 |
| 92 | | 4 SA0 |
| 93 | | 5 SA1 |
| 94 | | 6 SA2 |
| 95 | | 7 FA |
| 96 | | |
| 97 | | */ |
| 98 | | |
| 99 | | prof80_state *state = space->machine->driver_data; |
| 100 | | |
| 101 | | int fa = BIT(data, 7); |
| 102 | | int sa = (data >> 4) & 0x07; |
| 103 | | |
| 104 | | int fb = BIT(data, 0); |
| 105 | | int sb = (data >> 1) & 0x07; |
| 106 | | |
| 107 | 186 | switch (sa) |
| 108 | 187 | { |
| 109 | 188 | case 0: |
| r5038 | r5039 | |
| 171 | 250 | } |
| 172 | 251 | } |
| 173 | 252 | |
| 253 | static WRITE8_HANDLER( flr_w ) |
| 254 | { |
| 255 | /* |
| 256 | |
| 257 | bit description |
| 258 | |
| 259 | 0 FB |
| 260 | 1 SB0 |
| 261 | 2 SB1 |
| 262 | 3 SB2 |
| 263 | 4 SA0 |
| 264 | 5 SA1 |
| 265 | 6 SA2 |
| 266 | 7 FA |
| 267 | |
| 268 | */ |
| 269 | |
| 270 | int fa = BIT(data, 7); |
| 271 | int sa = (data >> 4) & 0x07; |
| 272 | |
| 273 | int fb = BIT(data, 0); |
| 274 | int sb = (data >> 1) & 0x07; |
| 275 | |
| 276 | ls259_w(space->machine, fa, sa, fb, sb); |
| 277 | } |
| 278 | |
| 174 | 279 | static READ8_HANDLER( status_r ) |
| 175 | 280 | { |
| 176 | 281 | /* |
| r5038 | r5039 | |
| 269 | 374 | { |
| 270 | 375 | prof80_state *state = space->machine->driver_data; |
| 271 | 376 | |
| 272 | | return state->ecb_status; |
| 377 | return state->gripc; |
| 273 | 378 | } |
| 274 | 379 | |
| 275 | 380 | static READ8_HANDLER( gripd_r ) |
| r5038 | r5039 | |
| 281 | 386 | ppi8255_set_port_c(state->ppi8255, 0x14); |
| 282 | 387 | ppi8255_set_port_c(state->ppi8255, 0x54); |
| 283 | 388 | |
| 284 | | return state->ecb_data; |
| 389 | return state->gripd; |
| 285 | 390 | } |
| 286 | 391 | |
| 287 | 392 | static WRITE8_HANDLER( gripd_w ) |
| 288 | 393 | { |
| 289 | 394 | prof80_state *state = space->machine->driver_data; |
| 290 | 395 | |
| 291 | | state->ecb_data = data; |
| 396 | state->gripd = data; |
| 292 | 397 | |
| 293 | 398 | /* trigger GRIP 8255 port C bit 4 (_STBA) */ |
| 294 | 399 | ppi8255_set_port_c(state->ppi8255, 0x54); |
| r5038 | r5039 | |
| 511 | 616 | /* Input Ports */ |
| 512 | 617 | |
| 513 | 618 | static INPUT_PORTS_START( prof80 ) |
| 619 | PORT_START("ROW0") |
| 620 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_TILDE) |
| 621 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 622 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 623 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 624 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 625 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 626 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') |
| 627 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 628 | |
| 629 | PORT_START("ROW1") |
| 630 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 631 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 632 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 633 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 634 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 635 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 636 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) |
| 637 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) |
| 638 | |
| 639 | PORT_START("ROW2") |
| 640 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) |
| 641 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) |
| 642 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) |
| 643 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 644 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 645 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 646 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 647 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 648 | |
| 649 | PORT_START("ROW3") |
| 650 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 651 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 652 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 653 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 654 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 655 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 656 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 657 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 658 | |
| 659 | PORT_START("ROW4") |
| 660 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 661 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) |
| 662 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) |
| 663 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) |
| 664 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) |
| 665 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 666 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 667 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 668 | |
| 669 | PORT_START("ROW5") |
| 670 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 671 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 672 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 673 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 674 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 675 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 676 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 677 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 678 | |
| 679 | PORT_START("ROW6") |
| 680 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') |
| 681 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) |
| 682 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 683 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) |
| 684 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) |
| 685 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) |
| 686 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 687 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 688 | |
| 689 | PORT_START("ROW7") |
| 690 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 691 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 692 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 693 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 694 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 695 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 696 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 697 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 698 | |
| 699 | PORT_START("ROW8") |
| 700 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 701 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 702 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 703 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) |
| 704 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK) |
| 705 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 706 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 707 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 708 | |
| 709 | PORT_START("ROW9") |
| 710 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 711 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 712 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) |
| 713 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 714 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) |
| 514 | 715 | INPUT_PORTS_END |
| 515 | 716 | |
| 516 | 717 | /* Video */ |
| r5038 | r5039 | |
| 629 | 830 | |
| 630 | 831 | prof80_state *state = device->machine->driver_data; |
| 631 | 832 | |
| 632 | | return state->ecb_data; |
| 833 | return state->gripd; |
| 633 | 834 | } |
| 634 | 835 | |
| 635 | 836 | static WRITE8_DEVICE_HANDLER( grip_ppi8255_a_w ) |
| r5038 | r5039 | |
| 651 | 852 | |
| 652 | 853 | prof80_state *state = device->machine->driver_data; |
| 653 | 854 | |
| 654 | | state->ecb_data = data; |
| 855 | state->gripd = data; |
| 655 | 856 | } |
| 656 | 857 | |
| 657 | 858 | static READ8_DEVICE_HANDLER( grip_ppi8255_b_r ) |
| r5038 | r5039 | |
| 671 | 872 | |
| 672 | 873 | */ |
| 673 | 874 | |
| 674 | | return 0; |
| 675 | | } |
| 875 | prof80_state *state = device->machine->driver_data; |
| 676 | 876 | |
| 677 | | static READ8_DEVICE_HANDLER( grip_ppi8255_c_r ) |
| 678 | | { |
| 679 | | /* |
| 680 | | |
| 681 | | bit signal description |
| 682 | | |
| 683 | | PC0 INTRB interrupt B output (keyboard) |
| 684 | | PC1 KBF input buffer B full output (keyboard) |
| 685 | | PC2 _KBSTB strobe B input (keyboard) |
| 686 | | PC3 INTRA interrupt A output (PROF-80) |
| 687 | | PC4 _STBA strobe A input (PROF-80) |
| 688 | | PC5 IBFA input buffer A full output (PROF-80) |
| 689 | | PC6 _ACKA acknowledge A input (PROF-80) |
| 690 | | PC7 _OBFA output buffer full output (PROF-80) |
| 691 | | |
| 692 | | */ |
| 693 | | |
| 694 | | return 0x54; |
| 877 | return state->keydata; |
| 695 | 878 | } |
| 696 | 879 | |
| 697 | 880 | static WRITE8_DEVICE_HANDLER( grip_ppi8255_c_w ) |
| r5038 | r5039 | |
| 716 | 899 | /* keyboard interrupt */ |
| 717 | 900 | z80sti_i4_w(state->z80sti, BIT(data, 0)); |
| 718 | 901 | |
| 902 | /* keyboard buffer full */ |
| 903 | state->kbf = BIT(data, 1); |
| 904 | |
| 719 | 905 | /* PROF-80 interrupt */ |
| 720 | 906 | z80sti_i7_w(state->z80sti, BIT(data, 3)); |
| 721 | 907 | |
| 722 | 908 | /* PROF-80 handshaking */ |
| 723 | | state->ecb_status = (!BIT(data, 7) << 7) | (!BIT(data, 5) << 6); |
| 909 | state->gripc = (!BIT(data, 7) << 7) | (!BIT(data, 5) << 6) | (ppi8255_get_port_a(state->ppi8255) & 0x3f); |
| 724 | 910 | } |
| 725 | 911 | |
| 726 | 912 | static const ppi8255_interface grip_ppi8255_interface = |
| 727 | 913 | { |
| 728 | 914 | DEVCB_HANDLER(grip_ppi8255_a_r), // Port A read |
| 729 | 915 | DEVCB_HANDLER(grip_ppi8255_b_r), // Port B read |
| 730 | | DEVCB_HANDLER(grip_ppi8255_c_r), // Port C read |
| 916 | DEVCB_NULL, // Port C read |
| 731 | 917 | DEVCB_HANDLER(grip_ppi8255_a_w), // Port A write |
| 732 | 918 | DEVCB_NULL, // Port B write |
| 733 | 919 | DEVCB_HANDLER(grip_ppi8255_c_w) // Port C write |
| r5038 | r5039 | |
| 752 | 938 | |
| 753 | 939 | */ |
| 754 | 940 | |
| 755 | | // prof80_state *state = device->machine->driver_data; |
| 941 | prof80_state *state = device->machine->driver_data; |
| 756 | 942 | |
| 757 | | // return state->pc3 << 7 | state->exin << 6 | state->skbd << 5 | state->pc0 << 4 | busy << 3 | state->cursor << 2 | state->de << 1 | state->cts; |
| 758 | | |
| 759 | | return 0; |
| 943 | return centronics_busy_r(state->centronics) << 3; |
| 760 | 944 | } |
| 761 | 945 | |
| 762 | 946 | static WRITE_LINE_DEVICE_HANDLER( grip_z80sti_tbo_w ) |
| r5038 | r5039 | |
| 834 | 1018 | /* register for state saving */ |
| 835 | 1019 | state_save_register_global_array(machine, state->mmu); |
| 836 | 1020 | state_save_register_global(machine, state->mme); |
| 1021 | state_save_register_global(machine, state->keydata); |
| 1022 | state_save_register_global(machine, state->kbf); |
| 837 | 1023 | state_save_register_global_pointer(machine, state->video_ram, GRIP_VIDEORAM_SIZE); |
| 1024 | state_save_register_global(machine, state->lps); |
| 1025 | state_save_register_global(machine, state->page); |
| 1026 | state_save_register_global(machine, state->flash); |
| 838 | 1027 | state_save_register_global(machine, state->rtc_data); |
| 839 | 1028 | state_save_register_global(machine, state->fdc_index); |
| 1029 | state_save_register_global(machine, state->gripd); |
| 1030 | state_save_register_global(machine, state->gripc); |
| 840 | 1031 | } |
| 841 | 1032 | |
| 842 | 1033 | static MACHINE_RESET( prof80 ) |
| r5038 | r5039 | |
| 847 | 1038 | |
| 848 | 1039 | for (i = 0; i < 8; i++) |
| 849 | 1040 | { |
| 850 | | // write all zeroes 0 flr_W |
| 851 | | //UINT8 data = (i << 4) | (i << 1); |
| 1041 | ls259_w(machine, 0, i, 0, i); |
| 852 | 1042 | } |
| 853 | 1043 | |
| 854 | | state->ecb_status = 0x40; |
| 1044 | state->gripc = 0x40; |
| 855 | 1045 | } |
| 856 | 1046 | |
| 857 | 1047 | /* Machine Drivers */ |
| r5038 | r5039 | |
| 872 | 1062 | MDRV_MACHINE_START(prof80) |
| 873 | 1063 | MDRV_MACHINE_RESET(prof80) |
| 874 | 1064 | |
| 1065 | /* keyboard hack */ |
| 1066 | MDRV_TIMER_ADD_PERIODIC("keyboard", prof80_keyboard_tick, HZ(50)) |
| 1067 | |
| 875 | 1068 | /* video hardware */ |
| 876 | 1069 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 877 | 1070 | MDRV_SCREEN_REFRESH_RATE(60) |