trunk/src/mess/drivers/d6800.c
| r22691 | r22692 | |
| 10 | 10 | |
| 11 | 11 | NOTE that the display only updates after each 4 digits is entered, and |
| 12 | 12 | you can't see what you type as you change bytes. This is by design. |
| 13 | | The speaker is supposed to bleep on each keystroke, but it only gets |
| 14 | | one pulse - which is almost inaudible. |
| 15 | 13 | |
| 16 | 14 | Function keys: |
| 17 | 15 | FN 0 - Modify memory - firstly enter a 4-digit address, then 2-digit data |
| r22691 | r22692 | |
| 95 | 93 | private: |
| 96 | 94 | UINT8 m_rtc; |
| 97 | 95 | bool m_screen_on; |
| 98 | | UINT8 m_kbd_s; |
| 99 | 96 | UINT8 m_portb; |
| 100 | 97 | virtual void machine_start(); |
| 101 | 98 | virtual void machine_reset(); |
| r22691 | r22692 | |
| 107 | 104 | static ADDRESS_MAP_START( d6800_map, AS_PROGRAM, 8, d6800_state ) |
| 108 | 105 | AM_RANGE(0x0000, 0x00ff) AM_RAM |
| 109 | 106 | AM_RANGE(0x0100, 0x01ff) AM_RAM AM_SHARE("videoram") |
| 110 | | AM_RANGE(0x0200, 0x07ff) AM_RAM |
| 107 | AM_RANGE(0x0200, 0x0fff) AM_RAM |
| 111 | 108 | AM_RANGE(0x8010, 0x8013) AM_DEVREADWRITE("pia", pia6821_device, read, write) |
| 112 | 109 | AM_RANGE(0xc000, 0xc3ff) AM_MIRROR(0x3c00) AM_ROM |
| 113 | 110 | ADDRESS_MAP_END |
| r22691 | r22692 | |
| 120 | 117 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 121 | 118 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 122 | 119 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 120 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 123 | 121 | |
| 124 | 122 | PORT_START("X1") |
| 125 | 123 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 126 | 124 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 127 | 125 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 128 | 126 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 127 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 129 | 128 | |
| 130 | 129 | PORT_START("X2") |
| 131 | 130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 132 | 131 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 133 | 132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 134 | 133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 134 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 135 | 135 | |
| 136 | 136 | PORT_START("X3") |
| 137 | 137 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 138 | 138 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 139 | 139 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 140 | 140 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 141 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 141 | 142 | |
| 142 | 143 | PORT_START("Y0") |
| 144 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 143 | 145 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 144 | 146 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 145 | 147 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 146 | 148 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 147 | 149 | |
| 148 | 150 | PORT_START("Y1") |
| 151 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 149 | 152 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 150 | 153 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 151 | 154 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 152 | 155 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 153 | 156 | |
| 154 | 157 | PORT_START("Y2") |
| 158 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 155 | 159 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 156 | 160 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 157 | 161 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 158 | 162 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 159 | 163 | |
| 160 | 164 | PORT_START("Y3") |
| 165 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 161 | 166 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 162 | 167 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 163 | 168 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| r22691 | r22692 | |
| 201 | 206 | |
| 202 | 207 | /* PIA6821 Interface */ |
| 203 | 208 | |
| 209 | |
| 204 | 210 | TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::d6800_p) |
| 205 | 211 | { |
| 206 | 212 | m_rtc++; |
| 207 | | m_maincpu->set_input_line(M6800_IRQ_LINE, (m_rtc) ? CLEAR_LINE : ASSERT_LINE); |
| 213 | if (m_rtc > 159) |
| 214 | m_rtc = 0; |
| 215 | |
| 216 | UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read(); |
| 217 | m_pia->ca1_w( (data == 255) ? 0 : 1); |
| 218 | data = m_io_shift->read(); |
| 219 | m_pia->ca2_w( data ); |
| 220 | m_pia->cb1_w((m_rtc) ? 1 : 0); |
| 208 | 221 | } |
| 209 | 222 | |
| 210 | 223 | |
| 211 | | // not used |
| 212 | 224 | READ_LINE_MEMBER( d6800_state::d6800_rtc_pulse ) |
| 213 | 225 | { |
| 214 | | return 1; |
| 226 | return (m_rtc) ? 1 : 0; |
| 215 | 227 | } |
| 216 | 228 | |
| 217 | 229 | READ_LINE_MEMBER( d6800_state::d6800_keydown_r ) |
| 218 | 230 | { |
| 219 | 231 | UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read(); |
| 220 | 232 | |
| 221 | | m_kbd_s = (data == 15) ? 0 : 1; |
| 222 | | |
| 223 | | return m_kbd_s; |
| 233 | return (data == 255) ? 0 : 1; |
| 224 | 234 | } |
| 225 | 235 | |
| 226 | 236 | READ_LINE_MEMBER( d6800_state::d6800_fn_key_r ) |
| r22691 | r22692 | |
| 267 | 277 | lines around and reads it another way. This isolates the key that was pressed. |
| 268 | 278 | */ |
| 269 | 279 | |
| 270 | | m_kbd_s++; |
| 280 | UINT8 data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read() |
| 281 | & m_io_y0->read() & m_io_y1->read() & m_io_y2->read() & m_io_y3->read(); |
| 271 | 282 | |
| 272 | | if (m_kbd_s == 3) |
| 273 | | return 0x0f & m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read(); |
| 274 | | else |
| 275 | | if (m_kbd_s == 6) |
| 276 | | return 0xf0 & m_io_y0->read() & m_io_y1->read() & m_io_y2->read() & m_io_y3->read(); |
| 277 | | else |
| 278 | | return 0xff; |
| 283 | return data; |
| 279 | 284 | } |
| 280 | 285 | |
| 281 | 286 | WRITE8_MEMBER( d6800_state::d6800_keyboard_w ) |
| r22691 | r22692 | |
| 322 | 327 | void d6800_state::machine_reset() |
| 323 | 328 | { |
| 324 | 329 | m_beeper->set_state(0); |
| 330 | m_rtc = 0; |
| 325 | 331 | } |
| 326 | 332 | |
| 327 | 333 | /* Machine Drivers */ |
| r22691 | r22692 | |
| 364 | 370 | else |
| 365 | 371 | { |
| 366 | 372 | for (i = 0; i < quick_length; i++) |
| 367 | | if ((quick_addr + i) < 0x800) |
| 373 | if ((quick_addr + i) < 0x1000) |
| 368 | 374 | space.write_byte(i + quick_addr, quick_data[i]); |
| 369 | 375 | |
| 370 | 376 | /* display a message about the loaded quickload */ |
| r22691 | r22692 | |
| 387 | 393 | MCFG_CPU_ADD("maincpu",M6800, XTAL_4MHz/4) |
| 388 | 394 | MCFG_CPU_PROGRAM_MAP(d6800_map) |
| 389 | 395 | |
| 390 | | |
| 391 | 396 | /* video hardware */ |
| 392 | 397 | MCFG_SCREEN_ADD("screen", RASTER) |
| 393 | 398 | MCFG_SCREEN_REFRESH_RATE(50) |
| 394 | 399 | MCFG_SCREEN_SIZE(64, 32) |
| 395 | 400 | MCFG_SCREEN_VISIBLE_AREA(0, 63, 0, 31) |
| 396 | 401 | MCFG_SCREEN_UPDATE_DRIVER(d6800_state, screen_update_d6800) |
| 397 | | |
| 402 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(25)) |
| 398 | 403 | MCFG_PALETTE_LENGTH(2) |
| 399 | 404 | MCFG_PALETTE_INIT(black_and_white) |
| 400 | 405 | |
| r22691 | r22692 | |
| 419 | 424 | ROM_START( d6800 ) |
| 420 | 425 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 421 | 426 | ROM_LOAD( "d6800.bin", 0xc000, 0x0400, CRC(3f97ca2e) SHA1(60f26e57a058262b30befceceab4363a5d65d877) ) |
| 422 | | //ROM_FILL(0xc2eb,2,1) |
| 423 | 427 | ROM_END |
| 424 | 428 | |
| 425 | 429 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |