src/mess/drivers/sg1000.c
| r11571 | r11572 | |
| 80 | 80 | #include "crsshair.h" |
| 81 | 81 | #include "includes/sg1000.h" |
| 82 | 82 | |
| 83 | | class sf7000_state : public sc3000_state |
| 83 | |
| 84 | |
| 85 | /*************************************************************************** |
| 86 | READ/WRITE HANDLERS |
| 87 | ***************************************************************************/ |
| 88 | |
| 89 | /* |
| 90 | |
| 91 | Terebi Oekaki (TV Draw) |
| 92 | |
| 93 | Address Access Bits |
| 94 | 7 6 5 4 3 2 1 0 |
| 95 | $6000 W - - - - - - - AXIS |
| 96 | $8000 R BUSY - - - - - - PRESS |
| 97 | $A000 R/W DATA |
| 98 | |
| 99 | AXIS: write 0 to select X axis, 1 to select Y axis. |
| 100 | BUSY: reads 1 when graphic board is busy sampling position, else 0. |
| 101 | PRESS: reads 0 when pen is touching graphic board, else 1. |
| 102 | DATA: when pen is touching graphic board, return 8-bit sample position for currently selected axis (X is in the 0-255 range, Y in the 0-191 range). Else, return 0. |
| 103 | |
| 104 | */ |
| 105 | |
| 106 | /*------------------------------------------------- |
| 107 | tvdraw_axis_w - TV Draw axis select |
| 108 | -------------------------------------------------*/ |
| 109 | |
| 110 | WRITE8_MEMBER( sg1000_state::tvdraw_axis_w ) |
| 84 | 111 | { |
| 85 | | public: |
| 86 | | sf7000_state(const machine_config &mconfig, device_type type, const char *tag) |
| 87 | | : sc3000_state(mconfig, type, tag), |
| 88 | | m_fdc(*this, UPD765_TAG), |
| 89 | | m_centronics(*this, CENTRONICS_TAG), |
| 90 | | m_floppy0(*this, FLOPPY_0) |
| 91 | | { } |
| 112 | if (data & 0x01) |
| 113 | { |
| 114 | m_tvdraw_data = input_port_read(machine(), "TVDRAW_X"); |
| 92 | 115 | |
| 93 | | required_device<device_t> m_fdc; |
| 94 | | required_device<device_t> m_centronics; |
| 95 | | required_device<device_t> m_floppy0; |
| 116 | if (m_tvdraw_data < 4) m_tvdraw_data = 4; |
| 117 | if (m_tvdraw_data > 251) m_tvdraw_data = 251; |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | m_tvdraw_data = input_port_read(machine(), "TVDRAW_Y") + 32; |
| 122 | } |
| 123 | } |
| 96 | 124 | |
| 97 | | virtual void machine_start(); |
| 98 | | virtual void machine_reset(); |
| 125 | /*------------------------------------------------- |
| 126 | tvdraw_status_r - TV Draw status read |
| 127 | -------------------------------------------------*/ |
| 99 | 128 | |
| 100 | | DECLARE_READ8_MEMBER( ppi_pa_r ); |
| 101 | | DECLARE_WRITE8_MEMBER( ppi_pc_w ); |
| 102 | | DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); |
| 129 | READ8_MEMBER( sg1000_state::tvdraw_status_r ) |
| 130 | { |
| 131 | return input_port_read(machine(), "TVDRAW_PEN"); |
| 132 | } |
| 103 | 133 | |
| 104 | | /* floppy state */ |
| 105 | | int m_fdc_irq; |
| 106 | | int m_fdc_index; |
| 107 | | }; |
| 134 | /*------------------------------------------------- |
| 135 | tvdraw_data_r - TV Draw data read |
| 136 | -------------------------------------------------*/ |
| 108 | 137 | |
| 138 | READ8_MEMBER( sg1000_state::tvdraw_data_r ) |
| 139 | { |
| 140 | return m_tvdraw_data; |
| 141 | } |
| 142 | |
| 109 | 143 | /*------------------------------------------------- |
| 144 | joysel_r - |
| 145 | -------------------------------------------------*/ |
| 146 | |
| 147 | READ8_MEMBER( sg1000_state::joysel_r ) |
| 148 | { |
| 149 | return 0x80; |
| 150 | } |
| 151 | |
| 152 | /*------------------------------------------------- |
| 153 | ADDRESS_MAP( sg1000_map ) |
| 154 | -------------------------------------------------*/ |
| 155 | |
| 156 | static ADDRESS_MAP_START( sg1000_map, AS_PROGRAM, 8, sg1000_state ) |
| 157 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 158 | AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") |
| 159 | AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank2") |
| 160 | ADDRESS_MAP_END |
| 161 | |
| 162 | /*------------------------------------------------- |
| 163 | ADDRESS_MAP( sg1000_io_map ) |
| 164 | -------------------------------------------------*/ |
| 165 | |
| 166 | static ADDRESS_MAP_START( sg1000_io_map, AS_IO, 8, sg1000_state ) |
| 167 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 168 | AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w) |
| 169 | AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w) |
| 170 | AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w) |
| 171 | AM_RANGE(0xdc, 0xdc) AM_READ_PORT("PA7") |
| 172 | AM_RANGE(0xdd, 0xdd) AM_READ_PORT("PB7") |
| 173 | AM_RANGE(0xde, 0xde) AM_READ(joysel_r) AM_WRITENOP |
| 174 | AM_RANGE(0xdf, 0xdf) AM_NOP |
| 175 | ADDRESS_MAP_END |
| 176 | |
| 177 | /*------------------------------------------------- |
| 178 | ADDRESS_MAP( omv_map ) |
| 179 | -------------------------------------------------*/ |
| 180 | |
| 181 | static ADDRESS_MAP_START( omv_map, AS_PROGRAM, 8, sg1000_state ) |
| 182 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 183 | AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") |
| 184 | AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3800) AM_RAM |
| 185 | ADDRESS_MAP_END |
| 186 | |
| 187 | /*------------------------------------------------- |
| 188 | ADDRESS_MAP( omv_io_map ) |
| 189 | -------------------------------------------------*/ |
| 190 | |
| 191 | static ADDRESS_MAP_START( omv_io_map, AS_IO, 8, sg1000_state ) |
| 192 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 193 | AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w) |
| 194 | AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w) |
| 195 | AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w) |
| 196 | AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x38) AM_READ_PORT("C0") |
| 197 | AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x38) AM_READ_PORT("C1") |
| 198 | AM_RANGE(0xc2, 0xc2) AM_MIRROR(0x38) AM_READ_PORT("C2") |
| 199 | AM_RANGE(0xc3, 0xc3) AM_MIRROR(0x38) AM_READ_PORT("C3") |
| 200 | AM_RANGE(0xc4, 0xc4) AM_MIRROR(0x3a) AM_READ_PORT("C4") |
| 201 | AM_RANGE(0xc5, 0xc5) AM_MIRROR(0x3a) AM_READ_PORT("C5") |
| 202 | ADDRESS_MAP_END |
| 203 | |
| 204 | /*------------------------------------------------- |
| 205 | ADDRESS_MAP( sc3000_map ) |
| 206 | -------------------------------------------------*/ |
| 207 | |
| 208 | static ADDRESS_MAP_START( sc3000_map, AS_PROGRAM, 8, sg1000_state ) |
| 209 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 210 | AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") |
| 211 | AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank2") |
| 212 | ADDRESS_MAP_END |
| 213 | |
| 214 | /*------------------------------------------------- |
| 215 | ADDRESS_MAP( sc3000_io_map ) |
| 216 | -------------------------------------------------*/ |
| 217 | |
| 218 | static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state ) |
| 219 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 220 | AM_RANGE(0x7f, 0x7f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w) |
| 221 | AM_RANGE(0xbe, 0xbe) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w) |
| 222 | AM_RANGE(0xbf, 0xbf) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w) |
| 223 | AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) |
| 224 | ADDRESS_MAP_END |
| 225 | |
| 226 | /* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges |
| 227 | static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state ) |
| 228 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 229 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write) |
| 230 | AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w) |
| 231 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w) |
| 232 | AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w) |
| 233 | AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) |
| 234 | ADDRESS_MAP_END |
| 235 | */ |
| 236 | |
| 237 | /*------------------------------------------------- |
| 110 | 238 | ADDRESS_MAP( sf7000_map ) |
| 111 | 239 | -------------------------------------------------*/ |
| 112 | 240 | |
| r11571 | r11572 | |
| 137 | 265 | ***************************************************************************/ |
| 138 | 266 | |
| 139 | 267 | /*------------------------------------------------- |
| 268 | INPUT_CHANGED( trigger_nmi ) |
| 269 | -------------------------------------------------*/ |
| 270 | |
| 271 | static INPUT_CHANGED( trigger_nmi ) |
| 272 | { |
| 273 | cputag_set_input_line(field.machine(), Z80_TAG, INPUT_LINE_NMI, (input_port_read(field.machine(), "NMI") ? CLEAR_LINE : ASSERT_LINE)); |
| 274 | } |
| 275 | |
| 276 | /*------------------------------------------------- |
| 277 | INPUT_PORTS( tvdraw ) |
| 278 | -------------------------------------------------*/ |
| 279 | |
| 280 | static INPUT_PORTS_START( tvdraw ) |
| 281 | PORT_START("TVDRAW_X") |
| 282 | PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 283 | |
| 284 | PORT_START("TVDRAW_Y") |
| 285 | PORT_BIT( 0xff, 0x60, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 191) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) |
| 286 | |
| 287 | PORT_START("TVDRAW_PEN") |
| 288 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Pen") |
| 289 | INPUT_PORTS_END |
| 290 | |
| 291 | /*------------------------------------------------- |
| 292 | INPUT_PORTS( sg1000 ) |
| 293 | -------------------------------------------------*/ |
| 294 | |
| 295 | static INPUT_PORTS_START( sg1000 ) |
| 296 | PORT_START("PA7") |
| 297 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 298 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 299 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 300 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) |
| 301 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 302 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 303 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 304 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 305 | |
| 306 | PORT_START("PB7") |
| 307 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 308 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 309 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 310 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 311 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 312 | |
| 313 | PORT_START("NMI") |
| 314 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_P) PORT_CHANGED(trigger_nmi, 0) |
| 315 | |
| 316 | PORT_INCLUDE( tvdraw ) |
| 317 | INPUT_PORTS_END |
| 318 | |
| 319 | /*------------------------------------------------- |
| 320 | INPUT_PORTS( omv ) |
| 321 | -------------------------------------------------*/ |
| 322 | |
| 323 | static INPUT_PORTS_START( omv ) |
| 324 | PORT_START("C0") |
| 325 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 326 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 327 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 328 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 329 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 330 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 331 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 332 | |
| 333 | PORT_START("C1") |
| 334 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 335 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 336 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9 #") PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 337 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0 *") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 338 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 339 | |
| 340 | PORT_START("C2") |
| 341 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 342 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 343 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 344 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 345 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 346 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 347 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 348 | |
| 349 | PORT_START("C3") |
| 350 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 351 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 352 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 353 | |
| 354 | PORT_START("C4") |
| 355 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 356 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 357 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 358 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) |
| 359 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("S-1") |
| 360 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("S-2") |
| 361 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 362 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 363 | |
| 364 | PORT_START("C5") |
| 365 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 366 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 367 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 368 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 369 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 370 | |
| 371 | PORT_INCLUDE( tvdraw ) |
| 372 | INPUT_PORTS_END |
| 373 | |
| 374 | /*------------------------------------------------- |
| 375 | INPUT_PORTS( sk1100 ) |
| 376 | -------------------------------------------------*/ |
| 377 | |
| 378 | INPUT_PORTS_START( sk1100 ) |
| 379 | PORT_START("PA0") |
| 380 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 381 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') |
| 382 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') |
| 383 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') |
| 384 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ENG DIER'S") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) |
| 385 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 386 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') |
| 387 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') |
| 388 | |
| 389 | PORT_START("PA1") |
| 390 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 391 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') |
| 392 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') |
| 393 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') |
| 394 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPC") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 395 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 396 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') |
| 397 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') |
| 398 | |
| 399 | PORT_START("PA2") |
| 400 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 401 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') |
| 402 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') |
| 403 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') |
| 404 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 405 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 406 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 407 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') |
| 408 | |
| 409 | PORT_START("PA3") |
| 410 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 411 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') |
| 412 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') |
| 413 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') |
| 414 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 415 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xcf\x80") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x03c0) |
| 416 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') |
| 417 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') |
| 418 | |
| 419 | PORT_START("PA4") |
| 420 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 421 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') |
| 422 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') |
| 423 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') |
| 424 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 425 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 426 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') |
| 427 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 428 | |
| 429 | PORT_START("PA5") |
| 430 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 431 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') |
| 432 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') |
| 433 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') |
| 434 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 435 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 436 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 437 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 438 | |
| 439 | PORT_START("PA6") |
| 440 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 441 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') |
| 442 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') |
| 443 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') |
| 444 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 445 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 446 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 447 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 448 | |
| 449 | PORT_START("PA7") |
| 450 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 451 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 452 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 453 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) |
| 454 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 455 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 456 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 457 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 458 | |
| 459 | PORT_START("PB0") |
| 460 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 461 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 462 | |
| 463 | PORT_START("PB1") |
| 464 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 465 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 466 | |
| 467 | PORT_START("PB2") |
| 468 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 469 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 470 | |
| 471 | PORT_START("PB3") |
| 472 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') |
| 473 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 474 | |
| 475 | PORT_START("PB4") |
| 476 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('^') |
| 477 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 478 | |
| 479 | PORT_START("PB5") |
| 480 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xa5") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x00a5) |
| 481 | PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 482 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FUNC") PORT_CODE(KEYCODE_TAB) |
| 483 | |
| 484 | PORT_START("PB6") |
| 485 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 486 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 487 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 488 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 489 | |
| 490 | PORT_START("PB7") |
| 491 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 492 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 493 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 494 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 495 | |
| 496 | PORT_START("NMI") |
| 497 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F10) PORT_CHANGED(trigger_nmi, 0) |
| 498 | INPUT_PORTS_END |
| 499 | |
| 500 | /*------------------------------------------------- |
| 501 | INPUT_PORTS( sc3000 ) |
| 502 | -------------------------------------------------*/ |
| 503 | |
| 504 | static INPUT_PORTS_START( sc3000 ) |
| 505 | PORT_INCLUDE( sk1100 ) |
| 506 | PORT_INCLUDE( tvdraw ) |
| 507 | INPUT_PORTS_END |
| 508 | |
| 509 | /*------------------------------------------------- |
| 140 | 510 | INPUT_PORTS( sf7000 ) |
| 141 | 511 | -------------------------------------------------*/ |
| 142 | 512 | |
| r11571 | r11572 | |
| 158 | 528 | ***************************************************************************/ |
| 159 | 529 | |
| 160 | 530 | /*------------------------------------------------- |
| 531 | TMS9928a_interface tms9928a_interface |
| 532 | -------------------------------------------------*/ |
| 533 | |
| 534 | INTERRUPT_GEN( sg1000_int ) |
| 535 | { |
| 536 | TMS9928A_interrupt(device->machine()); |
| 537 | } |
| 538 | |
| 539 | static void sg1000_vdp_interrupt(running_machine &machine, int state) |
| 540 | { |
| 541 | cputag_set_input_line(machine, Z80_TAG, INPUT_LINE_IRQ0, state); |
| 542 | } |
| 543 | |
| 544 | const TMS9928a_interface tms9928a_interface = |
| 545 | { |
| 546 | TMS99x8A, |
| 547 | 0x4000, |
| 548 | 0, 0, |
| 549 | sg1000_vdp_interrupt |
| 550 | }; |
| 551 | |
| 552 | /*------------------------------------------------- |
| 553 | I8255_INTERFACE( sc3000_ppi_intf ) |
| 554 | -------------------------------------------------*/ |
| 555 | |
| 556 | READ8_MEMBER( sc3000_state::ppi_pa_r ) |
| 557 | { |
| 558 | /* |
| 559 | Signal Description |
| 560 | |
| 561 | PA0 Keyboard input |
| 562 | PA1 Keyboard input |
| 563 | PA2 Keyboard input |
| 564 | PA3 Keyboard input |
| 565 | PA4 Keyboard input |
| 566 | PA5 Keyboard input |
| 567 | PA6 Keyboard input |
| 568 | PA7 Keyboard input |
| 569 | */ |
| 570 | |
| 571 | static const char *const keynames[] = { "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7" }; |
| 572 | |
| 573 | return input_port_read(machine(), keynames[m_keylatch]); |
| 574 | } |
| 575 | |
| 576 | READ8_MEMBER( sc3000_state::ppi_pb_r ) |
| 577 | { |
| 578 | /* |
| 579 | Signal Description |
| 580 | |
| 581 | PB0 Keyboard input |
| 582 | PB1 Keyboard input |
| 583 | PB2 Keyboard input |
| 584 | PB3 Keyboard input |
| 585 | PB4 /CONT input from cartridge terminal B-11 |
| 586 | PB5 FAULT input from printer |
| 587 | PB6 BUSY input from printer |
| 588 | PB7 Cassette tape input |
| 589 | */ |
| 590 | |
| 591 | static const char *const keynames[] = { "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7" }; |
| 592 | |
| 593 | /* keyboard */ |
| 594 | UINT8 data = input_port_read(machine(), keynames[m_keylatch]); |
| 595 | |
| 596 | /* cartridge contact */ |
| 597 | data |= 0x10; |
| 598 | |
| 599 | /* printer */ |
| 600 | data |= 0x60; |
| 601 | |
| 602 | /* tape input */ |
| 603 | if (cassette_input(m_cassette) > +0.0) data |= 0x80; |
| 604 | |
| 605 | return data; |
| 606 | } |
| 607 | |
| 608 | WRITE8_MEMBER( sc3000_state::ppi_pc_w ) |
| 609 | { |
| 610 | /* |
| 611 | Signal Description |
| 612 | |
| 613 | PC0 Keyboard raster output |
| 614 | PC1 Keyboard raster output |
| 615 | PC2 Keyboard raster output |
| 616 | PC3 not connected |
| 617 | PC4 Cassette tape output |
| 618 | PC5 DATA to printer |
| 619 | PC6 /RESET to printer |
| 620 | PC7 /FEED to printer |
| 621 | */ |
| 622 | |
| 623 | /* keyboard */ |
| 624 | m_keylatch = data & 0x07; |
| 625 | |
| 626 | /* cassette */ |
| 627 | cassette_output(m_cassette, BIT(data, 4) ? +1.0 : -1.0); |
| 628 | |
| 629 | /* TODO printer */ |
| 630 | } |
| 631 | |
| 632 | I8255_INTERFACE( sc3000_ppi_intf ) |
| 633 | { |
| 634 | DEVCB_DRIVER_MEMBER(sc3000_state, ppi_pa_r), // Port A read |
| 635 | DEVCB_NULL, // Port A write |
| 636 | DEVCB_DRIVER_MEMBER(sc3000_state, ppi_pb_r), // Port B read |
| 637 | DEVCB_NULL, // Port B write |
| 638 | DEVCB_NULL, // Port C read |
| 639 | DEVCB_DRIVER_MEMBER(sc3000_state, ppi_pc_w), // Port C write |
| 640 | }; |
| 641 | |
| 642 | /*------------------------------------------------- |
| 643 | cassette_config sc3000_cassette_config |
| 644 | -------------------------------------------------*/ |
| 645 | |
| 646 | const cassette_config sc3000_cassette_config = |
| 647 | { |
| 648 | cassette_default_formats, |
| 649 | NULL, |
| 650 | (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED), |
| 651 | NULL |
| 652 | }; |
| 653 | |
| 654 | /*************************************************************************** |
| 655 | CARTRIDGE LOADING |
| 656 | ***************************************************************************/ |
| 657 | |
| 658 | /*------------------------------------------------- |
| 659 | sg1000_install_cartridge - |
| 660 | -------------------------------------------------*/ |
| 661 | |
| 662 | void sg1000_state::install_cartridge(UINT8 *ptr, int size) |
| 663 | { |
| 664 | address_space *program = m_maincpu->memory().space(AS_PROGRAM); |
| 665 | |
| 666 | switch (size) |
| 667 | { |
| 668 | case 40 * 1024: |
| 669 | program->install_read_bank(0x8000, 0x9fff, "bank1"); |
| 670 | program->unmap_write(0x8000, 0x9fff); |
| 671 | memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base() + 0x8000, 0); |
| 672 | memory_set_bank(machine(), "bank1", 0); |
| 673 | break; |
| 674 | |
| 675 | case 48 * 1024: |
| 676 | program->install_read_bank(0x8000, 0xbfff, "bank1"); |
| 677 | program->unmap_write(0x8000, 0xbfff); |
| 678 | memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base() + 0x8000, 0); |
| 679 | memory_set_bank(machine(), "bank1", 0); |
| 680 | break; |
| 681 | |
| 682 | default: |
| 683 | if (IS_CARTRIDGE_TV_DRAW(ptr)) |
| 684 | { |
| 685 | program->install_write_handler(0x6000, 0x6000, 0, 0, write8_delegate(FUNC(sg1000_state::tvdraw_axis_w), this), 0); |
| 686 | program->install_read_handler(0x8000, 0x8000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_status_r), this), 0); |
| 687 | program->install_read_handler(0xa000, 0xa000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_data_r), this), 0); |
| 688 | program->nop_write(0xa000, 0xa000); |
| 689 | } |
| 690 | else if (IS_CARTRIDGE_THE_CASTLE(ptr)) |
| 691 | { |
| 692 | program->install_readwrite_bank(0x8000, 0x9fff, "bank1"); |
| 693 | } |
| 694 | break; |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | /*------------------------------------------------- |
| 699 | DEVICE_IMAGE_LOAD( sg1000_cart ) |
| 700 | -------------------------------------------------*/ |
| 701 | |
| 702 | static DEVICE_IMAGE_LOAD( sg1000_cart ) |
| 703 | { |
| 704 | running_machine &machine = image.device().machine(); |
| 705 | sg1000_state *state = machine.driver_data<sg1000_state>(); |
| 706 | address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM); |
| 707 | UINT8 *ptr = machine.region(Z80_TAG)->base(); |
| 708 | UINT32 size; |
| 709 | |
| 710 | if (image.software_entry() == NULL) |
| 711 | { |
| 712 | size = image.length(); |
| 713 | if (image.fread( ptr, size) != size) |
| 714 | return IMAGE_INIT_FAIL; |
| 715 | } |
| 716 | else |
| 717 | { |
| 718 | size = image.get_software_region_length("rom"); |
| 719 | memcpy(ptr, image.get_software_region("rom"), size); |
| 720 | } |
| 721 | |
| 722 | /* cartridge ROM banking */ |
| 723 | state->install_cartridge(ptr, size); |
| 724 | |
| 725 | /* work RAM banking */ |
| 726 | program->install_readwrite_bank(0xc000, 0xc3ff, 0, 0x3c00, "bank2"); |
| 727 | |
| 728 | return IMAGE_INIT_PASS; |
| 729 | } |
| 730 | |
| 731 | /*------------------------------------------------- |
| 732 | DEVICE_IMAGE_LOAD( omv_cart ) |
| 733 | -------------------------------------------------*/ |
| 734 | |
| 735 | static DEVICE_IMAGE_LOAD( omv_cart ) |
| 736 | { |
| 737 | running_machine &machine = image.device().machine(); |
| 738 | sg1000_state *state = machine.driver_data<sg1000_state>(); |
| 739 | UINT32 size; |
| 740 | UINT8 *ptr = machine.region(Z80_TAG)->base(); |
| 741 | |
| 742 | if (image.software_entry() == NULL) |
| 743 | { |
| 744 | size = image.length(); |
| 745 | if (image.fread( ptr, size) != size) |
| 746 | return IMAGE_INIT_FAIL; |
| 747 | } |
| 748 | else |
| 749 | { |
| 750 | size = image.get_software_region_length("rom"); |
| 751 | memcpy(ptr, image.get_software_region("rom"), size); |
| 752 | } |
| 753 | |
| 754 | /* cartridge ROM banking */ |
| 755 | state->install_cartridge(ptr, size); |
| 756 | |
| 757 | return IMAGE_INIT_PASS; |
| 758 | } |
| 759 | |
| 760 | /*------------------------------------------------- |
| 761 | sc3000_install_cartridge - |
| 762 | -------------------------------------------------*/ |
| 763 | |
| 764 | void sc3000_state::install_cartridge(UINT8 *ptr, int size) |
| 765 | { |
| 766 | address_space *program = m_maincpu->memory().space(AS_PROGRAM); |
| 767 | |
| 768 | /* include SG-1000 mapping */ |
| 769 | sg1000_state::install_cartridge(ptr, size); |
| 770 | |
| 771 | if (IS_CARTRIDGE_BASIC_LEVEL_III(ptr)) |
| 772 | { |
| 773 | program->install_readwrite_bank(0x8000, 0xbfff, "bank1"); |
| 774 | program->install_readwrite_bank(0xc000, 0xffff, "bank2"); |
| 775 | } |
| 776 | else if (IS_CARTRIDGE_MUSIC_EDITOR(ptr)) |
| 777 | { |
| 778 | program->install_readwrite_bank(0x8000, 0x9fff, "bank1"); |
| 779 | program->install_readwrite_bank(0xc000, 0xc7ff, 0, 0x3800, "bank2"); |
| 780 | } |
| 781 | else |
| 782 | { |
| 783 | /* regular cartridges */ |
| 784 | program->install_readwrite_bank(0xc000, 0xc7ff, 0, 0x3800, "bank2"); |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | /*------------------------------------------------- |
| 789 | DEVICE_IMAGE_LOAD( sc3000_cart ) |
| 790 | -------------------------------------------------*/ |
| 791 | |
| 792 | static DEVICE_IMAGE_LOAD( sc3000_cart ) |
| 793 | { |
| 794 | running_machine &machine = image.device().machine(); |
| 795 | sc3000_state *state = machine.driver_data<sc3000_state>(); |
| 796 | UINT8 *ptr = machine.region(Z80_TAG)->base(); |
| 797 | UINT32 size; |
| 798 | |
| 799 | if (image.software_entry() == NULL) |
| 800 | { |
| 801 | size = image.length(); |
| 802 | if (image.fread( ptr, size) != size) |
| 803 | return IMAGE_INIT_FAIL; |
| 804 | } |
| 805 | else |
| 806 | { |
| 807 | size = image.get_software_region_length("rom"); |
| 808 | memcpy(ptr, image.get_software_region("rom"), size); |
| 809 | } |
| 810 | |
| 811 | /* cartridge ROM and work RAM banking */ |
| 812 | state->install_cartridge(ptr, size); |
| 813 | |
| 814 | return IMAGE_INIT_PASS; |
| 815 | } |
| 816 | |
| 817 | /*------------------------------------------------- |
| 161 | 818 | I8255_INTERFACE( sf7000_ppi_intf ) |
| 162 | 819 | -------------------------------------------------*/ |
| 163 | 820 | |
| r11571 | r11572 | |
| 293 | 950 | } |
| 294 | 951 | |
| 295 | 952 | /*------------------------------------------------- |
| 953 | TIMER_CALLBACK( lightgun_tick ) |
| 954 | -------------------------------------------------*/ |
| 955 | |
| 956 | static TIMER_CALLBACK( lightgun_tick ) |
| 957 | { |
| 958 | UINT8 *rom = machine.region(Z80_TAG)->base(); |
| 959 | |
| 960 | if (IS_CARTRIDGE_TV_DRAW(rom)) |
| 961 | { |
| 962 | /* enable crosshair for TV Draw */ |
| 963 | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); |
| 964 | } |
| 965 | else |
| 966 | { |
| 967 | /* disable crosshair for other cartridges */ |
| 968 | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | /*------------------------------------------------- |
| 973 | MACHINE_START( sg1000 ) |
| 974 | -------------------------------------------------*/ |
| 975 | |
| 976 | void sg1000_state::machine_start() |
| 977 | { |
| 978 | /* configure VDP */ |
| 979 | TMS9928A_configure(&tms9928a_interface); |
| 980 | |
| 981 | /* toggle light gun crosshair */ |
| 982 | machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); |
| 983 | |
| 984 | /* register for state saving */ |
| 985 | state_save_register_global(machine(), m_tvdraw_data); |
| 986 | } |
| 987 | |
| 988 | /*------------------------------------------------- |
| 989 | MACHINE_START( sc3000 ) |
| 990 | -------------------------------------------------*/ |
| 991 | |
| 992 | void sc3000_state::machine_start() |
| 993 | { |
| 994 | /* configure VDP */ |
| 995 | TMS9928A_configure(&tms9928a_interface); |
| 996 | |
| 997 | /* toggle light gun crosshair */ |
| 998 | machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); |
| 999 | |
| 1000 | /* register for state saving */ |
| 1001 | state_save_register_global(machine(), m_tvdraw_data); |
| 1002 | state_save_register_global(machine(), m_keylatch); |
| 1003 | } |
| 1004 | |
| 1005 | |
| 1006 | /*------------------------------------------------- |
| 296 | 1007 | MACHINE_START( sf7000 ) |
| 297 | 1008 | -------------------------------------------------*/ |
| 298 | 1009 | |
| r11571 | r11572 | |
| 329 | 1040 | MACHINE DRIVERS |
| 330 | 1041 | ***************************************************************************/ |
| 331 | 1042 | |
| 1043 | /*------------------------------------------------- |
| 1044 | MACHINE_CONFIG_START( sg1000, sg1000_state ) |
| 1045 | -------------------------------------------------*/ |
| 332 | 1046 | |
| 1047 | static MACHINE_CONFIG_START( sg1000, sg1000_state ) |
| 1048 | /* basic machine hardware */ |
| 1049 | MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) |
| 1050 | MCFG_CPU_PROGRAM_MAP(sg1000_map) |
| 1051 | MCFG_CPU_IO_MAP(sg1000_io_map) |
| 1052 | MCFG_CPU_VBLANK_INT(SCREEN_TAG, sg1000_int) |
| 1053 | |
| 1054 | /* video hardware */ |
| 1055 | MCFG_FRAGMENT_ADD(tms9928a) |
| 1056 | MCFG_SCREEN_MODIFY(SCREEN_TAG) |
| 1057 | MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262) |
| 1058 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1059 | |
| 1060 | /* sound hardware */ |
| 1061 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1062 | MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_10_738635MHz/3) |
| 1063 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1064 | |
| 1065 | /* cartridge */ |
| 1066 | MCFG_CARTSLOT_ADD("cart") |
| 1067 | MCFG_CARTSLOT_EXTENSION_LIST("sg,bin") |
| 1068 | MCFG_CARTSLOT_MANDATORY |
| 1069 | MCFG_CARTSLOT_INTERFACE("sg1000_cart") |
| 1070 | MCFG_CARTSLOT_LOAD(sg1000_cart) |
| 1071 | |
| 1072 | /* software lists */ |
| 1073 | MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000") |
| 1074 | |
| 1075 | /* internal ram */ |
| 1076 | MCFG_RAM_ADD(RAM_TAG) |
| 1077 | MCFG_RAM_DEFAULT_SIZE("1K") |
| 1078 | MACHINE_CONFIG_END |
| 1079 | |
| 333 | 1080 | /*------------------------------------------------- |
| 1081 | MACHINE_CONFIG_DERIVED( omv, sg1000 ) |
| 1082 | -------------------------------------------------*/ |
| 1083 | |
| 1084 | static MACHINE_CONFIG_DERIVED( omv, sg1000 ) |
| 1085 | MCFG_CPU_MODIFY(Z80_TAG) |
| 1086 | MCFG_CPU_PROGRAM_MAP(omv_map) |
| 1087 | MCFG_CPU_IO_MAP(omv_io_map) |
| 1088 | |
| 1089 | MCFG_CARTSLOT_MODIFY("cart") |
| 1090 | MCFG_CARTSLOT_EXTENSION_LIST("sg,bin") |
| 1091 | MCFG_CARTSLOT_NOT_MANDATORY |
| 1092 | MCFG_CARTSLOT_LOAD(omv_cart) |
| 1093 | |
| 1094 | MCFG_RAM_MODIFY(RAM_TAG) |
| 1095 | MCFG_RAM_DEFAULT_SIZE("2K") |
| 1096 | MACHINE_CONFIG_END |
| 1097 | |
| 1098 | /*------------------------------------------------- |
| 1099 | MACHINE_CONFIG_START( sc3000, sc3000_state ) |
| 1100 | -------------------------------------------------*/ |
| 1101 | |
| 1102 | static MACHINE_CONFIG_START( sc3000, sc3000_state ) |
| 1103 | /* basic machine hardware */ |
| 1104 | MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) // LH0080A |
| 1105 | MCFG_CPU_PROGRAM_MAP(sc3000_map) |
| 1106 | MCFG_CPU_IO_MAP(sc3000_io_map) |
| 1107 | MCFG_CPU_VBLANK_INT(SCREEN_TAG, sg1000_int) |
| 1108 | |
| 1109 | /* video hardware */ |
| 1110 | MCFG_FRAGMENT_ADD(tms9928a) |
| 1111 | MCFG_SCREEN_MODIFY(SCREEN_TAG) |
| 1112 | MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262) |
| 1113 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1114 | |
| 1115 | /* sound hardware */ |
| 1116 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1117 | MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_10_738635MHz/3) |
| 1118 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1119 | |
| 1120 | /* devices */ |
| 1121 | MCFG_I8255_ADD(UPD9255_TAG, sc3000_ppi_intf) |
| 1122 | // MCFG_PRINTER_ADD("sp400") /* serial printer */ |
| 1123 | MCFG_CASSETTE_ADD(CASSETTE_TAG, sc3000_cassette_config) |
| 1124 | |
| 1125 | /* cartridge */ |
| 1126 | MCFG_CARTSLOT_ADD("cart") |
| 1127 | MCFG_CARTSLOT_EXTENSION_LIST("sg,sc,bin") |
| 1128 | MCFG_CARTSLOT_INTERFACE("sg1000_cart") |
| 1129 | MCFG_CARTSLOT_LOAD(sc3000_cart) |
| 1130 | |
| 1131 | /* software lists */ |
| 1132 | MCFG_SOFTWARE_LIST_ADD("cart_list","sg1000") |
| 1133 | |
| 1134 | /* internal ram */ |
| 1135 | MCFG_RAM_ADD(RAM_TAG) |
| 1136 | MCFG_RAM_DEFAULT_SIZE("2K") |
| 1137 | MACHINE_CONFIG_END |
| 1138 | |
| 1139 | /*------------------------------------------------- |
| 334 | 1140 | MACHINE_CONFIG_START( sf7000, sf7000_state ) |
| 335 | 1141 | -------------------------------------------------*/ |
| 336 | 1142 | |
| r11571 | r11572 | |
| 371 | 1177 | ROMS |
| 372 | 1178 | ***************************************************************************/ |
| 373 | 1179 | |
| 1180 | ROM_START( sg1000 ) |
| 1181 | ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) |
| 1182 | ROM_END |
| 1183 | |
| 1184 | #define rom_sg1000m2 rom_sg1000 |
| 1185 | |
| 1186 | ROM_START( sc3000 ) |
| 1187 | ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) |
| 1188 | ROM_LOAD( "sc3000.rom", 0x0000, 0x8000, CRC(a46e3c73) SHA1(b1a8585a9afff962e8fd0e79b3305199da4e4562)) |
| 1189 | ROM_END |
| 1190 | |
| 1191 | #define rom_sc3000h rom_sg1000 |
| 1192 | |
| 374 | 1193 | ROM_START( sf7000 ) |
| 375 | | ROM_REGION( 0x10000, Z80_TAG, 0 ) |
| 1194 | ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) |
| 376 | 1195 | ROM_LOAD( "ipl.rom", 0x0000, 0x2000, CRC(d76810b8) SHA1(77339a6db2593aadc638bed77b8e9bed5d9d87e3) ) |
| 377 | 1196 | ROM_END |
| 378 | 1197 | |
| 1198 | ROM_START( omv1000 ) |
| 1199 | ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) |
| 1200 | ROM_LOAD( "omvbios.bin", 0x0000, 0x4000, BAD_DUMP CRC(c5a67b95) SHA1(6d7c64dd60dee4a33061d3d3a7c2ed190d895cdb) ) // The BIOS comes from a Multivision FG-2000. It is still unknown if the FG-1000 BIOS differs |
| 1201 | ROM_END |
| 1202 | |
| 1203 | ROM_START( omv2000 ) |
| 1204 | ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASE00 ) |
| 1205 | ROM_LOAD( "omvbios.bin", 0x0000, 0x4000, CRC(c5a67b95) SHA1(6d7c64dd60dee4a33061d3d3a7c2ed190d895cdb) ) |
| 1206 | ROM_END |
| 1207 | |
| 379 | 1208 | /*************************************************************************** |
| 380 | 1209 | SYSTEM DRIVERS |
| 381 | 1210 | ***************************************************************************/ |
| 382 | 1211 | |
| 383 | 1212 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 1213 | CONS( 1983, sg1000, 0, 0, sg1000, sg1000, 0, "Sega", "SG-1000", GAME_SUPPORTS_SAVE ) |
| 1214 | CONS( 1984, sg1000m2, sg1000, 0, sc3000, sc3000, 0, "Sega", "SG-1000 II", GAME_SUPPORTS_SAVE ) |
| 1215 | COMP( 1983, sc3000, 0, sg1000, sc3000, sc3000, 0, "Sega", "SC-3000", GAME_SUPPORTS_SAVE ) |
| 1216 | COMP( 1983, sc3000h, sc3000, 0, sc3000, sc3000, 0, "Sega", "SC-3000H", GAME_SUPPORTS_SAVE ) |
| 384 | 1217 | COMP( 1983, sf7000, sc3000, 0, sf7000, sf7000, 0, "Sega", "SC-3000/Super Control Station SF-7000", GAME_SUPPORTS_SAVE ) |
| 1218 | CONS( 1984, omv1000, sg1000, 0, omv, omv, 0, "Tsukuda Original", "Othello Multivision FG-1000", GAME_SUPPORTS_SAVE ) |
| 1219 | CONS( 1984, omv2000, sg1000, 0, omv, omv, 0, "Tsukuda Original", "Othello Multivision FG-2000", GAME_SUPPORTS_SAVE ) |