src/mess/drivers/qx10.c
| r10486 | r10487 | |
| 23 | 23 | #include "machine/mc146818.h" |
| 24 | 24 | #include "machine/i8255a.h" |
| 25 | 25 | #include "machine/8237dma.h" |
| 26 | | #include "video/i82720.h" |
| 26 | #include "video/upd7220.h" |
| 27 | 27 | #include "machine/upd765.h" |
| 28 | 28 | #include "machine/ram.h" |
| 29 | 29 | |
| r10486 | r10487 | |
| 37 | 37 | { |
| 38 | 38 | public: |
| 39 | 39 | qx10_state(running_machine &machine, const driver_device_config_base &config) |
| 40 | | : driver_device(machine, config) { } |
| 40 | : driver_device(machine, config), |
| 41 | m_hgdc(*this, "upd7220") |
| 42 | { } |
| 41 | 43 | |
| 44 | required_device<device_t> m_hgdc; |
| 45 | |
| 46 | virtual void video_start(); |
| 47 | virtual bool video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); |
| 48 | UINT8 *m_char_rom; |
| 49 | |
| 42 | 50 | int mc146818_offset; |
| 43 | 51 | |
| 44 | 52 | /* FDD */ |
| r10486 | r10487 | |
| 426 | 434 | AM_RANGE(0x30, 0x30) AM_READWRITE(qx10_30_r, fdd_motor_w) |
| 427 | 435 | AM_RANGE(0x34, 0x34) AM_DEVREAD("upd765", upd765_status_r) |
| 428 | 436 | AM_RANGE(0x35, 0x35) AM_DEVREADWRITE("upd765", upd765_data_r, upd765_data_w) |
| 429 | | AM_RANGE(0x38, 0x39) AM_READWRITE(compis_gdc_r, compis_gdc_w) |
| 437 | AM_RANGE(0x38, 0x39) AM_DEVREADWRITE("upd7220", upd7220_r, upd7220_w) |
| 430 | 438 | AM_RANGE(0x3c, 0x3c) AM_READWRITE(mc146818_data_r, mc146818_data_w) |
| 431 | 439 | AM_RANGE(0x3d, 0x3d) AM_WRITE(mc146818_offset_w) |
| 432 | 440 | AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("8237dma_1", i8237_r, i8237_w) |
| r10486 | r10487 | |
| 442 | 450 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) |
| 443 | 451 | INPUT_PORTS_END |
| 444 | 452 | |
| 445 | | /* |
| 446 | | Video |
| 447 | | */ |
| 448 | | static const compis_gdc_interface i82720_interface = |
| 449 | | { |
| 450 | | GDC_MODE_HRG, |
| 451 | | 0x8000 |
| 452 | | }; |
| 453 | 453 | |
| 454 | 454 | static MACHINE_START(qx10) |
| 455 | 455 | { |
| r10486 | r10487 | |
| 457 | 457 | |
| 458 | 458 | cpu_set_irq_callback(machine->device("maincpu"), irq_callback); |
| 459 | 459 | |
| 460 | | compis_init( &i82720_interface ); |
| 461 | | |
| 462 | 460 | // find devices |
| 463 | 461 | state->pic8259_master = machine->device("pic8259_master"); |
| 464 | 462 | state->pic8259_slave = machine->device("pic8259_slave"); |
| r10486 | r10487 | |
| 497 | 495 | GFXDECODE_ENTRY( "chargen", 0x0000, qx10_charlayout, 1, 7 ) |
| 498 | 496 | GFXDECODE_END |
| 499 | 497 | |
| 498 | void qx10_state::video_start() |
| 499 | { |
| 500 | // find memory regions |
| 501 | m_char_rom = machine->region("chargen")->base(); |
| 500 | 502 | |
| 503 | VIDEO_START_CALL(generic_bitmapped); |
| 504 | } |
| 505 | |
| 506 | bool qx10_state::video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) |
| 507 | { |
| 508 | /* graphics */ |
| 509 | upd7220_update(m_hgdc, &bitmap, &cliprect); |
| 510 | |
| 511 | return 0; |
| 512 | } |
| 513 | |
| 514 | static ADDRESS_MAP_START( qx10_upd7220_map, 0, 16 ) |
| 515 | AM_RANGE(0x00000, 0x3ffff) AM_RAM |
| 516 | ADDRESS_MAP_END |
| 517 | |
| 518 | static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels ) |
| 519 | { |
| 520 | int i; |
| 521 | |
| 522 | for (i = 0; i < 16; i++) |
| 523 | { |
| 524 | if (BIT(data, i)) *BITMAP_ADDR16(bitmap, y, x + i) = 1; |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | static UPD7220_INTERFACE( hgdc_intf ) |
| 529 | { |
| 530 | "screen", |
| 531 | hgdc_display_pixels, |
| 532 | DEVCB_NULL, |
| 533 | DEVCB_NULL, |
| 534 | DEVCB_NULL, |
| 535 | DEVCB_NULL |
| 536 | }; |
| 537 | |
| 538 | /* TODO: this is just a c&p code */ |
| 539 | static PALETTE_INIT( gdc ) |
| 540 | { |
| 541 | int i; |
| 542 | int r,g,b; |
| 543 | |
| 544 | for ( i = 0; i < 16; i++ ) |
| 545 | { |
| 546 | r = i & 4 ? ((i & 8) ? 0xaa : 0xff) : 0x00; |
| 547 | g = i & 2 ? ((i & 8) ? 0xaa : 0xff) : 0x00; |
| 548 | b = i & 1 ? ((i & 8) ? 0xaa : 0xff) : 0x00; |
| 549 | |
| 550 | palette_set_color(machine, i, MAKE_RGB(r,g,b)); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | |
| 501 | 555 | static MACHINE_CONFIG_START( qx10, qx10_state ) |
| 502 | 556 | /* basic machine hardware */ |
| 503 | 557 | MCFG_CPU_ADD("maincpu",Z80, MAIN_CLK / 4) |
| r10486 | r10487 | |
| 526 | 580 | MCFG_SCREEN_SIZE(640, 480) |
| 527 | 581 | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 528 | 582 | MCFG_GFXDECODE(qx10) |
| 529 | | MCFG_PALETTE_LENGTH(COMPIS_PALETTE_SIZE) |
| 530 | | MCFG_PALETTE_INIT(compis_gdc) |
| 583 | MCFG_PALETTE_LENGTH(16) |
| 584 | MCFG_PALETTE_INIT(gdc) |
| 531 | 585 | |
| 532 | | MCFG_VIDEO_START(compis_gdc) |
| 533 | | MCFG_VIDEO_UPDATE(compis_gdc) |
| 586 | MCFG_UPD7220_ADD("upd7220", MAIN_CLK/4, hgdc_intf, qx10_upd7220_map) |
| 534 | 587 | |
| 535 | 588 | MCFG_MC146818_ADD( "rtc", MC146818_STANDARD ) |
| 536 | 589 | |