trunk/src/mess/drivers/prestige.c
| r31133 | r31134 | |
| 91 | 91 | : driver_device(mconfig, type, tag), |
| 92 | 92 | m_maincpu(*this, "maincpu"), |
| 93 | 93 | m_ram(*this, RAM_TAG), |
| 94 | m_keyboard(*this, "KEY"), |
| 94 | 95 | m_bank1(*this, "bank1"), |
| 95 | 96 | m_bank2(*this, "bank2"), |
| 96 | 97 | m_bank3(*this, "bank3"), |
| r31133 | r31134 | |
| 100 | 101 | |
| 101 | 102 | required_device<cpu_device> m_maincpu; |
| 102 | 103 | required_device<ram_device> m_ram; |
| 104 | required_ioport_array<16> m_keyboard; |
| 103 | 105 | required_memory_bank m_bank1; |
| 104 | 106 | required_memory_bank m_bank2; |
| 105 | 107 | required_memory_bank m_bank3; |
| r31133 | r31134 | |
| 112 | 114 | UINT8 m_mousex; |
| 113 | 115 | UINT8 m_mousey; |
| 114 | 116 | UINT8 *m_vram; |
| 117 | struct |
| 118 | { |
| 119 | UINT16 addr1; |
| 120 | UINT16 addr2; |
| 121 | UINT8 lcd_w; |
| 122 | UINT8 lcd_h; |
| 123 | UINT8 fb_width; |
| 124 | UINT8 split_pos; |
| 125 | } m_lcdc; |
| 115 | 126 | |
| 116 | 127 | virtual void machine_start(); |
| 117 | | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 128 | UINT32 screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 129 | UINT32 screen_update_1bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 130 | UINT32 screen_update_2bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 118 | 131 | |
| 119 | 132 | DECLARE_READ8_MEMBER( bankswitch_r ); |
| 120 | 133 | DECLARE_WRITE8_MEMBER( bankswitch_w ); |
| r31133 | r31134 | |
| 122 | 135 | DECLARE_WRITE8_MEMBER( kb_w ); |
| 123 | 136 | DECLARE_READ8_MEMBER( mouse_r ); |
| 124 | 137 | DECLARE_WRITE8_MEMBER( mouse_w ); |
| 138 | DECLARE_WRITE8_MEMBER( lcdc_w ); |
| 125 | 139 | DECLARE_PALETTE_INIT(prestige); |
| 140 | DECLARE_PALETTE_INIT(glcolor); |
| 126 | 141 | TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); |
| 127 | 142 | IRQ_CALLBACK_MEMBER(prestige_int_ack); |
| 128 | 143 | }; |
| r31133 | r31134 | |
| 166 | 181 | break; |
| 167 | 182 | |
| 168 | 183 | case 5: |
| 169 | | if (ioport("CART_TYPE")->read() == 0x01) |
| 184 | if (m_bank[5] == data) |
| 185 | break; |
| 186 | |
| 187 | if (data & 0x20) |
| 170 | 188 | { |
| 189 | program.install_ram(0x8000, 0xbfff, m_vram); |
| 190 | } |
| 191 | else if (ioport("CART_TYPE")->read() == 0x01) |
| 192 | { |
| 171 | 193 | //cartridge memory is writable |
| 172 | 194 | if (data & 0x02) |
| 173 | 195 | program.install_readwrite_bank(0x4000, 0x7fff, "bank2"); |
| r31133 | r31134 | |
| 183 | 205 | { |
| 184 | 206 | //cartridge memory is read-only |
| 185 | 207 | program.unmap_write(0x4000, 0xbfff); |
| 208 | program.install_read_bank(0x8000, 0xbfff, "bank3"); |
| 186 | 209 | } |
| 187 | 210 | break; |
| 188 | 211 | case 6: |
| r31133 | r31134 | |
| 194 | 217 | |
| 195 | 218 | READ8_MEMBER( prestige_state::kb_r ) |
| 196 | 219 | { |
| 197 | | static const char *const bitnames[2][8] = |
| 198 | | { |
| 199 | | {"LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7"}, |
| 200 | | {"LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF"} |
| 201 | | }; |
| 202 | | |
| 203 | 220 | UINT8 data = 0xff; |
| 204 | 221 | |
| 205 | 222 | for (int line=0; line<8; line++) |
| 206 | 223 | if (!(m_kb_matrix & (1<<line))) |
| 207 | | data &= ioport(bitnames[offset][line])->read(); |
| 224 | data &= m_keyboard[offset * 8 + line]->read(); |
| 208 | 225 | |
| 209 | 226 | return data; |
| 210 | 227 | } |
| r31133 | r31134 | |
| 228 | 245 | break; |
| 229 | 246 | } |
| 230 | 247 | |
| 248 | data = MIN(data, +127); |
| 249 | data = MAX(data, -127); |
| 250 | |
| 231 | 251 | return 0x80 + data; |
| 232 | 252 | } |
| 233 | 253 | |
| r31133 | r31134 | |
| 244 | 264 | } |
| 245 | 265 | } |
| 246 | 266 | |
| 267 | WRITE8_MEMBER( prestige_state::lcdc_w ) |
| 268 | { |
| 269 | switch(offset) |
| 270 | { |
| 271 | case 0x02: |
| 272 | m_lcdc.lcd_w = data; |
| 273 | break; |
| 274 | case 0x04: |
| 275 | m_lcdc.lcd_h = data; |
| 276 | break; |
| 277 | case 0x06: |
| 278 | m_lcdc.addr1 = (m_lcdc.addr1 & 0xff00) | data; |
| 279 | break; |
| 280 | case 0x07: |
| 281 | m_lcdc.addr1 = (m_lcdc.addr1 & 0x00ff) | (data << 8); |
| 282 | break; |
| 283 | case 0x08: |
| 284 | m_lcdc.addr2 = (m_lcdc.addr2 & 0xff00) | data; |
| 285 | break; |
| 286 | case 0x09: |
| 287 | m_lcdc.addr2 = (m_lcdc.addr2 & 0x00ff) | (data << 8); |
| 288 | break; |
| 289 | case 0x0a: |
| 290 | m_lcdc.split_pos = data; |
| 291 | break; |
| 292 | case 0x0d: |
| 293 | m_lcdc.fb_width = data; |
| 294 | break; |
| 295 | default: |
| 296 | logerror("Unknown LCDC reg write %x = %x\n", offset, data); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | |
| 247 | 301 | static ADDRESS_MAP_START(prestige_mem, AS_PROGRAM, 8, prestige_state) |
| 248 | 302 | AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") |
| 249 | 303 | AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") |
| r31133 | r31134 | |
| 256 | 310 | ADDRESS_MAP_UNMAP_HIGH |
| 257 | 311 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 258 | 312 | AM_RANGE(0x04, 0x05) AM_READWRITE(mouse_r, mouse_w) |
| 313 | AM_RANGE(0x30, 0x3f) AM_WRITE(lcdc_w) |
| 314 | AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) |
| 315 | AM_RANGE(0x41, 0x42) AM_READ(kb_r) |
| 259 | 316 | AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) |
| 317 | ADDRESS_MAP_END |
| 318 | |
| 319 | static ADDRESS_MAP_START( glcolor_io , AS_IO, 8, prestige_state) |
| 320 | ADDRESS_MAP_UNMAP_HIGH |
| 321 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 322 | AM_RANGE(0x30, 0x3f) AM_WRITE(lcdc_w) |
| 260 | 323 | AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) |
| 261 | 324 | AM_RANGE(0x41, 0x42) AM_READ(kb_r) |
| 325 | AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) |
| 262 | 326 | ADDRESS_MAP_END |
| 263 | 327 | |
| 264 | 328 | /* Input ports */ |
| r31133 | r31134 | |
| 274 | 338 | PORT_START("MOUSEY") |
| 275 | 339 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(2) |
| 276 | 340 | |
| 277 | | PORT_START("LINE0") |
| 341 | PORT_START("KEY.0") |
| 278 | 342 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) |
| 279 | 343 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 280 | 344 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| r31133 | r31134 | |
| 284 | 348 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) |
| 285 | 349 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) |
| 286 | 350 | |
| 287 | | PORT_START("LINE1") |
| 351 | PORT_START("KEY.1") |
| 288 | 352 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) |
| 289 | 353 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 290 | 354 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| r31133 | r31134 | |
| 294 | 358 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) |
| 295 | 359 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 296 | 360 | |
| 297 | | PORT_START("LINE2") |
| 361 | PORT_START("KEY.2") |
| 298 | 362 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Up (KB)") PORT_CODE(KEYCODE_8_PAD) |
| 299 | 363 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 300 | 364 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) |
| r31133 | r31134 | |
| 304 | 368 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) |
| 305 | 369 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) |
| 306 | 370 | |
| 307 | | PORT_START("LINE3") |
| 371 | PORT_START("KEY.3") |
| 308 | 372 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Left (KB)") PORT_CODE(KEYCODE_4_PAD) |
| 309 | 373 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 310 | 374 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc2\xa1") PORT_CODE(KEYCODE_CLOSEBRACE) |
| r31133 | r31134 | |
| 314 | 378 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) |
| 315 | 379 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 316 | 380 | |
| 317 | | PORT_START("LINE4") |
| 381 | PORT_START("KEY.4") |
| 318 | 382 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Right (KB)") PORT_CODE(KEYCODE_6_PAD) |
| 319 | 383 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 320 | 384 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) |
| r31133 | r31134 | |
| 324 | 388 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) |
| 325 | 389 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) |
| 326 | 390 | |
| 327 | | PORT_START("LINE5") |
| 391 | PORT_START("KEY.5") |
| 328 | 392 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Down (KB)") PORT_CODE(KEYCODE_2_PAD) |
| 329 | 393 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 330 | 394 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) |
| r31133 | r31134 | |
| 334 | 398 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) |
| 335 | 399 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_PGUP) |
| 336 | 400 | |
| 337 | | PORT_START("LINE6") |
| 401 | PORT_START("KEY.6") |
| 338 | 402 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F10) |
| 339 | 403 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 340 | 404 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) |
| r31133 | r31134 | |
| 344 | 408 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) |
| 345 | 409 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_PGDN) |
| 346 | 410 | |
| 347 | | PORT_START("LINE7") |
| 411 | PORT_START("KEY.7") |
| 348 | 412 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F9) |
| 349 | 413 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 350 | 414 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) |
| r31133 | r31134 | |
| 354 | 418 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) |
| 355 | 419 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Answer") PORT_CODE(KEYCODE_END) |
| 356 | 420 | |
| 357 | | PORT_START("LINE8") |
| 421 | PORT_START("KEY.8") |
| 358 | 422 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 359 | 423 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Word Games") PORT_CODE(KEYCODE_F1) |
| 360 | 424 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Player") PORT_CODE(KEYCODE_F2) |
| 361 | 425 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 362 | 426 | |
| 363 | | PORT_START("LINE9") |
| 427 | PORT_START("KEY.9") |
| 364 | 428 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) |
| 365 | 429 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mathematics") PORT_CODE(KEYCODE_F3) |
| 366 | 430 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Level") PORT_CODE(KEYCODE_F4) |
| 367 | 431 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 368 | 432 | |
| 369 | | PORT_START("LINEA") |
| 433 | PORT_START("KEY.10") |
| 370 | 434 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_RALT) |
| 371 | 435 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Trivia") PORT_CODE(KEYCODE_F5) |
| 372 | 436 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cartridge") PORT_CODE(KEYCODE_F6) |
| 373 | 437 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 374 | 438 | |
| 375 | | PORT_START("LINEB") |
| 439 | PORT_START("KEY.11") |
| 376 | 440 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 377 | 441 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Logic Games") PORT_CODE(KEYCODE_F7) |
| 378 | 442 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Business Basics") PORT_CODE(KEYCODE_F8) |
| 379 | 443 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 380 | 444 | |
| 381 | | PORT_START("LINEC") |
| 445 | PORT_START("KEY.12") |
| 382 | 446 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 383 | 447 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 384 | 448 | |
| 385 | | PORT_START("LINED") |
| 449 | PORT_START("KEY.13") |
| 386 | 450 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 387 | 451 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 388 | 452 | |
| 389 | | PORT_START("LINEE") |
| 453 | PORT_START("KEY.14") |
| 390 | 454 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button (KB)") PORT_CODE(KEYCODE_0_PAD) |
| 391 | 455 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 392 | 456 | |
| 393 | | PORT_START("LINEF") |
| 457 | PORT_START("KEY.15") |
| 394 | 458 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button (KB)") PORT_CODE(KEYCODE_DEL_PAD) |
| 395 | 459 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 396 | 460 | |
| 397 | 461 | INPUT_PORTS_END |
| 398 | 462 | |
| 463 | INPUT_PORTS_START( glcolor ) |
| 464 | PORT_START("CART_TYPE") |
| 465 | PORT_CONFNAME( 0x01, 0x00, "Cartridge Type" ) |
| 466 | PORT_CONFSETTING( 0x00, "ROM" ) |
| 467 | PORT_CONFSETTING( 0x01, "RAM" ) |
| 468 | |
| 469 | PORT_START("KEY.0") |
| 470 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 471 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 472 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 473 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('^') |
| 474 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 475 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 476 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 477 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') |
| 478 | |
| 479 | PORT_START("KEY.1") |
| 480 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_NAME("Help") |
| 481 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 482 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 483 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 484 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 485 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 486 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00df) PORT_CHAR('?') |
| 487 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') |
| 488 | |
| 489 | PORT_START("KEY.2") |
| 490 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 491 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 492 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 493 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 494 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 495 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 496 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 497 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 498 | |
| 499 | PORT_START("KEY.3") |
| 500 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 501 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 502 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 503 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 504 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 505 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 506 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 507 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 508 | |
| 509 | PORT_START("KEY.4") |
| 510 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("Spieler 1") |
| 511 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 512 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 513 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 514 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 515 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 516 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 517 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 518 | |
| 519 | PORT_START("KEY.5") |
| 520 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 521 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 522 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("Spielers") |
| 523 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("Stufe") |
| 524 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 525 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("Symbols") |
| 526 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 527 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') |
| 528 | |
| 529 | PORT_START("KEY.6") |
| 530 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 531 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 532 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 533 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 534 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_NAME("Button 1") |
| 535 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("Button 2") |
| 536 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_NAME("Button 3") |
| 537 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Button 4") |
| 538 | |
| 539 | PORT_START("KEY.7") |
| 540 | PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 541 | |
| 542 | PORT_START("KEY.8") |
| 543 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 544 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) |
| 545 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 546 | |
| 547 | PORT_START("KEY.9") |
| 548 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 549 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) |
| 550 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 551 | |
| 552 | PORT_START("KEY.10") |
| 553 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 554 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) |
| 555 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 556 | |
| 557 | PORT_START("KEY.11") |
| 558 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 559 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 560 | |
| 561 | PORT_START("KEY.12") |
| 562 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) |
| 563 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("Spieler 2") |
| 564 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 565 | |
| 566 | PORT_START("KEY.13") |
| 567 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') |
| 568 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 569 | |
| 570 | PORT_START("KEY.14") |
| 571 | PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 572 | |
| 573 | PORT_START("KEY.15") |
| 574 | PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 575 | |
| 576 | INPUT_PORTS_END |
| 577 | |
| 578 | |
| 399 | 579 | IRQ_CALLBACK_MEMBER(prestige_state::prestige_int_ack) |
| 400 | 580 | { |
| 401 | 581 | UINT32 vector; |
| 402 | 582 | |
| 403 | 583 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 404 | 584 | |
| 405 | | if (m_irq_counter == 0x02) |
| 585 | if (m_irq_counter == 0x04) |
| 406 | 586 | { |
| 407 | 587 | m_irq_counter = 0; |
| 408 | 588 | vector = 0x0020; |
| r31133 | r31134 | |
| 448 | 628 | palette.set_pen_color(1, rgb_t(16, 37, 84)); |
| 449 | 629 | } |
| 450 | 630 | |
| 451 | | UINT32 prestige_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 631 | PALETTE_INIT_MEMBER(prestige_state, glcolor) |
| 452 | 632 | { |
| 453 | | UINT16 addr = 0; |
| 633 | palette.set_pen_color(0, rgb_t(0x3f,0xbf,0x3f)); |
| 634 | palette.set_pen_color(1, rgb_t(0xff,0x3f,0x5f)); |
| 635 | palette.set_pen_color(2, rgb_t(0x1f,0x1f,0x3f)); |
| 636 | palette.set_pen_color(3, rgb_t(0xff,0xdf,0x1f)); |
| 637 | } |
| 454 | 638 | |
| 455 | | for (int y = 0; y < 100; y++) |
| 639 | UINT32 prestige_state::screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 640 | { |
| 641 | int width = m_lcdc.fb_width + m_lcdc.lcd_w + 1; |
| 642 | |
| 643 | for (int y = 0; y <= m_lcdc.lcd_h; y++) |
| 456 | 644 | { |
| 457 | | for (int sx = 0; sx < 30; sx++) |
| 645 | int line_start; |
| 646 | if (y <= m_lcdc.split_pos) |
| 647 | line_start = m_lcdc.addr1 + y * width; |
| 648 | else |
| 649 | line_start = m_lcdc.addr2 + (y - m_lcdc.split_pos - 1) * width; |
| 650 | |
| 651 | for (int sx = 0; sx <= m_lcdc.lcd_w; sx++) |
| 458 | 652 | { |
| 459 | | UINT8 data = m_vram[addr]; |
| 653 | UINT8 data = m_vram[(line_start + sx) & 0x1fff]; |
| 460 | 654 | |
| 461 | | for (int x = 0; x < 8; x++) |
| 655 | for (int x = 0; x < 8 / bpp; x++) |
| 462 | 656 | { |
| 463 | | bitmap.pix16(y, (sx * 8) + x) = BIT(data, 7); |
| 657 | int pix = 0; |
| 658 | for (int b=0; b<bpp; b++) |
| 659 | pix |= BIT(data, 7 - b) << b; |
| 464 | 660 | |
| 465 | | data <<= 1; |
| 661 | if (cliprect.contains(sx * 8 / bpp + x, y)) |
| 662 | bitmap.pix16(y, sx * 8 / bpp + x) = pix; |
| 663 | |
| 664 | data <<= bpp; |
| 466 | 665 | } |
| 467 | | |
| 468 | | addr++; |
| 469 | 666 | } |
| 470 | 667 | } |
| 471 | 668 | |
| 472 | 669 | return 0; |
| 473 | 670 | } |
| 474 | 671 | |
| 672 | UINT32 prestige_state::screen_update_1bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 673 | { |
| 674 | return screen_update(1, screen, bitmap, cliprect); |
| 675 | } |
| 676 | |
| 677 | UINT32 prestige_state::screen_update_2bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 678 | { |
| 679 | return screen_update(2, screen, bitmap, cliprect); |
| 680 | } |
| 681 | |
| 475 | 682 | TIMER_DEVICE_CALLBACK_MEMBER(prestige_state::irq_timer) |
| 476 | 683 | { |
| 477 | 684 | m_maincpu->set_input_line(0, ASSERT_LINE); |
| r31133 | r31134 | |
| 479 | 686 | |
| 480 | 687 | static MACHINE_CONFIG_START( prestige_base, prestige_state ) |
| 481 | 688 | /* basic machine hardware */ |
| 482 | | MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 689 | MCFG_CPU_ADD("maincpu",Z80, XTAL_8MHz) // Z84C008 |
| 483 | 690 | MCFG_CPU_PROGRAM_MAP(prestige_mem) |
| 484 | 691 | MCFG_CPU_IO_MAP(prestige_io) |
| 485 | 692 | MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(prestige_state,prestige_int_ack) |
| r31133 | r31134 | |
| 490 | 697 | MCFG_SCREEN_ADD("screen", LCD) |
| 491 | 698 | MCFG_SCREEN_REFRESH_RATE(50) |
| 492 | 699 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 493 | | MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update) |
| 700 | MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update_1bpp) |
| 494 | 701 | MCFG_SCREEN_SIZE( 240, 100 ) |
| 495 | 702 | MCFG_SCREEN_VISIBLE_AREA( 0, 240-1, 0, 100-1 ) |
| 496 | 703 | MCFG_SCREEN_PALETTE("palette") |
| r31133 | r31134 | |
| 511 | 718 | MCFG_RAM_EXTRA_OPTIONS("64K") |
| 512 | 719 | MACHINE_CONFIG_END |
| 513 | 720 | |
| 721 | static MACHINE_CONFIG_DERIVED( glcolor, prestige_base ) |
| 722 | MCFG_CPU_MODIFY("maincpu") |
| 723 | MCFG_CPU_IO_MAP(glcolor_io) |
| 724 | |
| 725 | /* video hardware */ |
| 726 | MCFG_SCREEN_MODIFY("screen") |
| 727 | MCFG_SCREEN_UPDATE_DRIVER(prestige_state, screen_update_2bpp) |
| 728 | MCFG_SCREEN_SIZE( 160, 80 ) |
| 729 | MCFG_SCREEN_VISIBLE_AREA( 0, 160-1, 0, 80-1 ) |
| 730 | |
| 731 | MCFG_PALETTE_MODIFY("palette") |
| 732 | MCFG_PALETTE_ENTRIES(4) |
| 733 | MCFG_PALETTE_INIT_OWNER(prestige_state, glcolor) |
| 734 | |
| 735 | MCFG_SOFTWARE_LIST_ADD("cart_list", "glcolor") |
| 736 | MACHINE_CONFIG_END |
| 737 | |
| 514 | 738 | static MACHINE_CONFIG_DERIVED( prestige, prestige_base ) |
| 515 | 739 | MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl") |
| 516 | 740 | MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx") |
| r31133 | r31134 | |
| 565 | 789 | /* Driver */ |
| 566 | 790 | |
| 567 | 791 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 568 | | COMP( 1994, glcolor, 0, 0, prestige, prestige, driver_device, 0, "VTech", "Genius Leader Color (Germany)", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 792 | COMP( 1994, glcolor, 0, 0, glcolor, glcolor, driver_device, 0, "VTech", "Genius Leader Color (Germany)", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 569 | 793 | COMP( 1997, gl6000sl, 0, 0, gl6000sl, prestige, driver_device, 0, "VTech", "Genius Leader 6000SL (Germany)", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 570 | 794 | COMP( 1998, gl7007sl, 0, 0, gl7007sl, prestige, driver_device, 0, "VTech", "Genius Leader 7007SL (Germany)", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 571 | 795 | COMP( 1998, prestige, 0, 0, prestige, prestige, driver_device, 0, "VTech", "PreComputer Prestige Elite", GAME_NOT_WORKING | GAME_NO_SOUND) |