trunk/src/mess/drivers/mz3500.c
| r22080 | r22081 | |
| 4 | 4 | |
| 5 | 5 | preliminary driver by Angelo Salese |
| 6 | 6 | |
| 7 | Notes: |
| 8 | Sub-CPU test meanings: |
| 9 | * RA (tests RAM, first is work RAM, other two are shared RAM banks) |
| 10 | * VR (tests VRAM) |
| 11 | * CRT interface test: |
| 12 | - 40x20 |
| 13 | - 80x25 |
| 14 | - monochrome attribute test |
| 15 | - 80x25 color test (text B-R-G-W, border: black, blue, red, green, black) |
| 16 | - 40x20 color test (text B-R-G-W, border: black, blue, red, green, black) |
| 17 | * Speaker test |
| 18 | * PR (Printer interface test) |
| 19 | * LP (Light pen test) |
| 20 | * RS (RS-232C interface test) |
| 21 | |
| 7 | 22 | ***************************************************************************/ |
| 8 | 23 | |
| 9 | 24 | |
| r22080 | r22081 | |
| 44 | 59 | UINT8 m_ma,m_mo,m_ms,m_me2,m_me1; |
| 45 | 60 | UINT8 m_crtc[0x10]; |
| 46 | 61 | |
| 62 | UINT8 m_fdd_sel; |
| 63 | |
| 47 | 64 | DECLARE_READ8_MEMBER(mz3500_master_mem_r); |
| 48 | 65 | DECLARE_WRITE8_MEMBER(mz3500_master_mem_w); |
| 49 | 66 | DECLARE_READ8_MEMBER(mz3500_ipl_r); |
| r22080 | r22081 | |
| 119 | 136 | UINT8 width80; |
| 120 | 137 | UINT8 char_size; |
| 121 | 138 | UINT8 hires; |
| 139 | UINT8 color_mode; |
| 122 | 140 | |
| 123 | 141 | // popmessage("%02x",state->m_crtc[6]); |
| 124 | 142 | |
| 143 | color_mode = state->m_crtc[4] & 1; |
| 125 | 144 | width80 = (state->m_crtc[5] & 2) >> 1; |
| 126 | 145 | hires = (state->m_crtc[6] & 1); |
| 127 | 146 | char_size = (hires) ? 16 : 8; |
| r22080 | r22081 | |
| 143 | 162 | int res_x,res_y; |
| 144 | 163 | int pen; |
| 145 | 164 | |
| 146 | | /* TODO: color attribute needs double check */ |
| 147 | | |
| 148 | 165 | if(yi >= char_size) |
| 149 | 166 | pen = -1; |
| 150 | 167 | else |
| 151 | 168 | { |
| 152 | | if(state->m_crtc[4] & 1) |
| 153 | | pen = (tile_data >> (7-xi)) & 1 ? (attr >> 1) : -1; |
| 169 | if(color_mode) |
| 170 | pen = (tile_data >> (7-xi)) & 1 ? (attr ^ 7) : -1; |
| 154 | 171 | else |
| 172 | { |
| 173 | /* TODO: "highlight" */ |
| 174 | //if(attr & 4) |
| 175 | // tile_data ^= 0xff; |
| 176 | |
| 177 | if(attr & 1) // VL |
| 178 | tile_data |= 8; |
| 179 | |
| 180 | /* TODO: correct position of HL */ |
| 181 | if(attr & 2 && yi == char_size/2) // HL |
| 182 | tile_data |= 0xff; |
| 183 | |
| 184 | /* TODO: blink (bit 3) */ |
| 185 | |
| 155 | 186 | pen = (tile_data >> (7-xi)) & 1 ? 7 : -1; |
| 187 | } |
| 156 | 188 | } |
| 157 | 189 | |
| 158 | 190 | res_x = x * 8 + xi; |
| r22080 | r22081 | |
| 419 | 451 | |
| 420 | 452 | READ8_MEMBER(mz3500_state::mz3500_fdc_r) |
| 421 | 453 | { |
| 454 | static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"}; |
| 455 | |
| 422 | 456 | /* |
| 423 | 457 | ---- -x-- Motor |
| 424 | 458 | ---- --x- Index |
| 425 | 459 | ---- ---x Drq |
| 426 | 460 | */ |
| 427 | 461 | floppy_image_device *floppy; |
| 428 | | floppy = machine().device<floppy_connector>(":upd765a:0")->get_device(); |
| 462 | floppy = machine().device<floppy_connector>(m_fddnames[m_fdd_sel])->get_device(); |
| 429 | 463 | |
| 430 | 464 | return floppy->idx_r() << 1; |
| 431 | 465 | } |
| r22080 | r22081 | |
| 439 | 473 | ---x ---- motor on signal |
| 440 | 474 | ---- xxxx Select FDD 0-3 (bit-wise) |
| 441 | 475 | */ |
| 476 | static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"}; |
| 477 | |
| 478 | for(int i=0;i<4;i++) |
| 479 | { |
| 480 | if(data & 1 << i) |
| 481 | { |
| 482 | m_fdd_sel = i; |
| 483 | break; |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | machine().device<floppy_connector>(m_fddnames[m_fdd_sel])->get_device()->mon_w(data & 0x10 ? ASSERT_LINE : CLEAR_LINE); |
| 488 | |
| 442 | 489 | } |
| 443 | 490 | |
| 444 | 491 | static ADDRESS_MAP_START( mz3500_master_map, AS_PROGRAM, 8, mz3500_state ) |
| r22080 | r22081 | |
| 447 | 494 | |
| 448 | 495 | static ADDRESS_MAP_START( mz3500_master_io, AS_IO, 8, mz3500_state ) |
| 449 | 496 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 497 | // ADDRESS_MAP_UNMAP_HIGH |
| 450 | 498 | // AM_RANGE(0xe4, 0xe7) SFD upd765 |
| 451 | 499 | // AM_RANGE(0xe8, 0xeb) SFD I/O port and DMAC chip select |
| 452 | 500 | // AM_RANGE(0xec, 0xef) irq signal from slave to master CPU |
| r22080 | r22081 | |
| 464 | 512 | |
| 465 | 513 | static ADDRESS_MAP_START( mz3500_slave_io, AS_IO, 8, mz3500_state ) |
| 466 | 514 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 515 | ADDRESS_MAP_UNMAP_HIGH |
| 467 | 516 | // AM_RANGE(0x00, 0x0f) f/f and irq to master CPU |
| 468 | 517 | // AM_RANGE(0x10, 0x1f) i8251 |
| 469 | 518 | // AM_RANGE(0x20, 0x2f) pit8253 |
| 470 | 519 | // AM_RANGE(0x30, 0x3f) i8255 |
| 471 | | // AM_RANGE(0x40, 0x4f) 8-bit input port |
| 520 | AM_RANGE(0x40, 0x40) AM_READ_PORT("DSW") |
| 472 | 521 | AM_RANGE(0x50, 0x5f) AM_RAM_WRITE(mz3500_crtc_w) |
| 473 | 522 | AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("upd7220_gfx", upd7220_device, read, write) |
| 474 | 523 | AM_RANGE(0x70, 0x71) AM_DEVREADWRITE("upd7220_chr", upd7220_device, read, write) |
| 475 | 524 | ADDRESS_MAP_END |
| 476 | 525 | |
| 477 | 526 | static INPUT_PORTS_START( mz3500 ) |
| 478 | | /* dummy active high structure */ |
| 479 | | PORT_START("SYSA") |
| 527 | PORT_START("DSW") |
| 480 | 528 | PORT_DIPNAME( 0x01, 0x00, "SYSA" ) |
| 481 | 529 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 482 | 530 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| r22080 | r22081 | |
| 498 | 546 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) |
| 499 | 547 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 500 | 548 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 501 | | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) |
| 502 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 503 | | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 549 | PORT_DIPNAME( 0x80, 0x80, "Sub-CPU Test" ) |
| 550 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 551 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 504 | 552 | |
| 505 | 553 | /* dummy active low structure */ |
| 506 | 554 | PORT_START("DSWA") |
| r22080 | r22081 | |
| 615 | 663 | MCFG_CPU_PROGRAM_MAP(mz3500_slave_map) |
| 616 | 664 | MCFG_CPU_IO_MAP(mz3500_slave_io) |
| 617 | 665 | |
| 666 | MCFG_QUANTUM_PERFECT_CPU("master") |
| 667 | |
| 618 | 668 | MCFG_UPD765A_ADD("upd765a", true, true) |
| 619 | 669 | MCFG_FLOPPY_DRIVE_ADD("upd765a:0", mz3500_floppies, "525hd", 0, floppy_image_device::default_floppy_formats) |
| 620 | 670 | MCFG_FLOPPY_DRIVE_ADD("upd765a:1", mz3500_floppies, "525hd", 0, floppy_image_device::default_floppy_formats) |