src/mess/drivers/slc1.c
| r13771 | r13772 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | 2011-07-16 SLC1 skeleton driver [Robbbert] |
| 3 | 2011-JUL-16 SLC1 skeleton driver [Robbbert] |
| 4 | 2011-DEC-29 Working [Robbbert] |
| 4 | 5 | |
| 5 | 6 | http://www.jens-mueller.org/jkcemu/slc1.html |
| 6 | 7 | |
| 7 | 8 | This computer is both a Z80 trainer, and a chess computer. |
| 9 | The keyboard is different between the two, so |
| 10 | we redefine it for your convenience. |
| 8 | 11 | |
| 12 | There is no chess board attached. You supply your own |
| 13 | and you sync the pieces and the computer instructions. |
| 14 | |
| 15 | When started, it is in Chess mode. Press 11111 to switch to |
| 16 | Trainer mode. |
| 17 | |
| 9 | 18 | Hardware |
| 10 | | 4 Kbytes ROM in the address range 0000-0FFF |
| 11 | | 1 Kbyte RAM in the address range 5000-53ff |
| 12 | | 6-digit 7-segment display |
| 13 | | Busy LED |
| 14 | | Keyboard with 12 keys |
| 19 | 4 Kbytes ROM in the address range 0000-0FFF |
| 20 | 1 Kbyte RAM in the address range 5000-53ff (user area starts at 5100) |
| 21 | 6-digit 7-segment display |
| 22 | Busy LED |
| 23 | Keyboard with 12 keys |
| 15 | 24 | |
| 16 | | ToDo: |
| 17 | | - Everything |
| 25 | Keys: |
| 26 | 0-7 : hexadecimal numbers |
| 27 | Shift then 0-7 : Hexadecimal 8-F (decimal points will appear) |
| 28 | ADR : enter an address to work with. After the 4 digits are entered, |
| 29 | the data at that address shows, and you can modify the data. |
| 30 | + (inc) : Enter the data into memory, and increment the address by 1. |
| 18 | 31 | |
| 32 | Pasting doesn't work, but if it did... |
| 19 | 33 | |
| 34 | Pasting: |
| 35 | 0-7 : as is |
| 36 | 8-F : H, then 0-7 |
| 37 | + : ^ |
| 38 | - : H^ |
| 39 | ADR : - |
| 20 | 40 | |
| 41 | Test Paste: |
| 42 | [[[[[-510011^22^33^44^55^66^77^H8H8^H9H9^-5100 |
| 43 | Now press up-arrow to confirm the data has been entered. |
| 44 | |
| 45 | |
| 46 | |
| 21 | 47 | ***************************************************************************/ |
| 22 | 48 | #define ADDRESS_MAP_MODERN |
| 23 | 49 | |
| r13771 | r13772 | |
| 40 | 66 | |
| 41 | 67 | required_device<cpu_device> m_maincpu; |
| 42 | 68 | required_device<device_t> m_speaker; |
| 43 | | emu_timer *m_kbd_timer; |
| 44 | 69 | DECLARE_READ8_MEMBER( io_r ); |
| 45 | 70 | DECLARE_WRITE8_MEMBER( io_w ); |
| 46 | | UINT8 m_kbd; |
| 47 | | UINT8 m_segment; |
| 48 | 71 | UINT8 m_digit; |
| 49 | | UINT8 m_kbd_row; |
| 50 | | UINT8 m_refresh[6]; |
| 51 | | UINT8 slc1_convert_col_to_bin( UINT8 col, UINT8 row ); |
| 72 | bool m_kbd_type; |
| 52 | 73 | virtual void machine_reset(); |
| 53 | 74 | virtual void machine_start(); |
| 54 | 75 | }; |
| r13771 | r13772 | |
| 64 | 85 | |
| 65 | 86 | WRITE8_MEMBER( slc1_state::io_w ) |
| 66 | 87 | { |
| 67 | | UINT8 upper = offset >> 8; |
| 68 | | // if (upper == 0x2f) return; |
| 88 | bool segonoff = BIT(data, 7); |
| 89 | bool busyled = BIT(data, 4); |
| 90 | data &= 15; |
| 69 | 91 | |
| 92 | if (data < 8) |
| 93 | m_digit = data; |
| 94 | else |
| 95 | if (data < 12) |
| 96 | { |
| 97 | speaker_level_w(m_speaker, BIT(data, 1) ); |
| 98 | return; |
| 99 | } |
| 100 | else |
| 101 | if (offset == 0x2f07) |
| 102 | return; |
| 70 | 103 | |
| 71 | | speaker_level_w(m_speaker, (upper == 0x29)); |
| 104 | UINT8 segdata = output_get_digit_value(m_digit); |
| 105 | UINT8 segnum = offset & 7; |
| 106 | UINT8 segmask = 1 << segnum; |
| 72 | 107 | |
| 73 | | // output_set_led_value(0, BIT(data, 4)); |
| 108 | if (segonoff) |
| 109 | segdata |= segmask; |
| 110 | else |
| 111 | segdata &= ~segmask; |
| 74 | 112 | |
| 75 | | // This computer sets each segment, one at a time. */ |
| 113 | output_set_digit_value(m_digit, segdata); |
| 76 | 114 | |
| 77 | | if ((offset & 0xff) < 8) |
| 78 | | { |
| 79 | | static const UINT8 segments[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; |
| 80 | | UINT8 digit = data & 7; |
| 81 | | UINT8 segment = segments[offset]; |
| 82 | | UINT8 segdata = output_get_digit_value(digit); |
| 115 | output_set_value("busyled", busyled); |
| 83 | 116 | |
| 84 | | if (BIT(data, 7)) |
| 85 | | segdata |= segment; |
| 86 | | else |
| 87 | | segdata &= ~segment; |
| 88 | | |
| 89 | | output_set_digit_value(digit, segdata); |
| 90 | | } |
| 117 | if (m_digit == 3) |
| 118 | m_kbd_type = (segdata); |
| 91 | 119 | } |
| 92 | 120 | |
| 93 | 121 | |
| 94 | | |
| 95 | 122 | /*************************************************************************** |
| 96 | 123 | |
| 97 | 124 | Keyboard |
| r13771 | r13772 | |
| 102 | 129 | { |
| 103 | 130 | UINT8 data = 0xff, upper = (offset >> 8) & 7; |
| 104 | 131 | |
| 105 | | if (upper == 5) data &= input_port_read(machine(), "X0"); |
| 106 | | if (upper == 6) data &= input_port_read(machine(), "X1"); |
| 107 | | if (upper == 7) data &= input_port_read(machine(), "X2"); |
| 132 | if (m_kbd_type) |
| 133 | { // Trainer |
| 134 | if (upper == 3) |
| 135 | data &= input_port_read(machine(), "Y0"); |
| 136 | else |
| 137 | if (upper == 4) |
| 138 | data &= input_port_read(machine(), "Y1"); |
| 139 | else |
| 140 | if (upper == 5) |
| 141 | data &= input_port_read(machine(), "Y2"); |
| 142 | } |
| 143 | else |
| 144 | { // Chess |
| 145 | if (upper == 3) |
| 146 | data &= input_port_read(machine(), "X0"); |
| 147 | else |
| 148 | if (upper == 4) |
| 149 | data &= input_port_read(machine(), "X1"); |
| 150 | else |
| 151 | if (upper == 5) |
| 152 | data &= input_port_read(machine(), "X2"); |
| 153 | } |
| 154 | |
| 108 | 155 | return data; |
| 109 | 156 | } |
| 110 | 157 | |
| r13771 | r13772 | |
| 152 | 199 | ***************************************************************************/ |
| 153 | 200 | |
| 154 | 201 | static INPUT_PORTS_START( slc1 ) |
| 202 | // Chess Keyboard |
| 155 | 203 | PORT_START("X0") |
| 156 | 204 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 157 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 B D 4 T") PORT_CODE(KEYCODE_3) |
| 158 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 A C 3 L") PORT_CODE(KEYCODE_2) |
| 159 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 9 B 2 S") PORT_CODE(KEYCODE_1) |
| 160 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 8 A 1 B") PORT_CODE(KEYCODE_0) |
| 205 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4 T") PORT_CODE(KEYCODE_4) |
| 206 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3 L") PORT_CODE(KEYCODE_3) |
| 207 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2 S") PORT_CODE(KEYCODE_2) |
| 208 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1 B") PORT_CODE(KEYCODE_1) PORT_CHAR('[') |
| 161 | 209 | |
| 162 | 210 | PORT_START("X1") |
| 163 | 211 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 164 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 F H 8 GO") PORT_CODE(KEYCODE_7) |
| 165 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 E G 7 BL") PORT_CODE(KEYCODE_6) |
| 166 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 D F 6 K DEL") PORT_CODE(KEYCODE_5) |
| 167 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 C E 5 D INS") PORT_CODE(KEYCODE_4) |
| 212 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5 D") PORT_CODE(KEYCODE_5) |
| 213 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6 K") PORT_CODE(KEYCODE_6) |
| 214 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) |
| 215 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) |
| 168 | 216 | |
| 169 | 217 | PORT_START("X2") |
| 170 | 218 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 171 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Seq C BG") PORT_CODE(KEYCODE_Q) |
| 172 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+-1 A SS") PORT_CODE(KEYCODE_W) |
| 173 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fu St DP") PORT_CODE(KEYCODE_E) |
| 174 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADR Z BP") PORT_CODE(KEYCODE_R) |
| 219 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 220 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 221 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("St") PORT_CODE(KEYCODE_S) |
| 222 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 223 | |
| 224 | // Trainer Keyboard |
| 225 | PORT_START("Y0") |
| 226 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 227 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 B") PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 228 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 A") PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 229 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 9") PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 230 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 8") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 231 | |
| 232 | PORT_START("Y1") |
| 233 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 234 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 C INS") PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 235 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 D DEL") PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 236 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 E BL") PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 237 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 F Go") PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 238 | |
| 239 | PORT_START("Y2") |
| 240 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 241 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fu DP") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR('H') |
| 242 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+-1 SS") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') |
| 243 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Seq BG") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 244 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADR BP") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') |
| 175 | 245 | INPUT_PORTS_END |
| 176 | 246 | |
| 177 | 247 | |
| r13771 | r13772 | |
| 210 | 280 | |
| 211 | 281 | |
| 212 | 282 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 213 | | COMP( 1989, slc1, 0, 0, slc1, slc1, 0, "Dr. Dieter Scheuschner", "SLC-1" , GAME_NOT_WORKING ) |
| 283 | COMP( 1989, slc1, 0, 0, slc1, slc1, 0, "Dr. Dieter Scheuschner", "SLC-1" , 0 ) |