src/mess/drivers/pc8001.c
| r6308 | r6309 | |
| 5 | 5 | #include "devices/messram.h"
|
| 6 | 6 | #include "machine/8257dma.h"
|
| 7 | 7 | #include "machine/ctronics.h"
|
| 8 | #include "machine/i8214.h"
|
| 8 | 9 | #include "machine/i8255a.h"
|
| 10 | #include "machine/msm8251.h"
|
| 9 | 11 | #include "machine/upd1990a.h"
|
| 10 | 12 | #include "video/upd3301.h"
|
| 11 | 13 | #include "sound/speaker.h"
|
| 12 | 14 | |
| 13 | 15 | /* Read/Write Handlers */
|
| 14 | 16 | |
| 15 | | WRITE8_HANDLER( port10_w )
|
| 17 | static WRITE8_HANDLER( port10_w )
|
| 16 | 18 | {
|
| 19 | /*
|
| 20 | |
| 21 | bit description
|
| 22 | |
| 23 | 0 RTC C0
|
| 24 | 1 RTC C1
|
| 25 | 2 RTC C2
|
| 26 | 3 RTC DATA IN
|
| 27 | 4 unused
|
| 28 | 5 unused
|
| 29 | 6 unused
|
| 30 | 7 unused
|
| 31 | |
| 32 | */
|
| 33 | |
| 17 | 34 | pc8001_state *state = space->machine->driver_data;
|
| 18 | 35 | |
| 19 | 36 | /* real time clock */
|
| r6308 | r6309 | |
| 26 | 43 | centronics_data_w(state->centronics, 0, data);
|
| 27 | 44 | }
|
| 28 | 45 | |
| 46 | static WRITE8_HANDLER( port30_w )
|
| 47 | {
|
| 48 | /*
|
| 49 | |
| 50 | bit description
|
| 51 | |
| 52 | 0 characters per line (0=40, 1=80)
|
| 53 | 1 color mode (0=color, 1=B&W)
|
| 54 | 2 CMT CHIN
|
| 55 | 3 CMT MOTOR (1=on)
|
| 56 | 4 CMT BS1
|
| 57 | 5 CMT BS2
|
| 58 | 6 unused
|
| 59 | 7 unused
|
| 60 | |
| 61 | */
|
| 62 | }
|
| 63 | |
| 64 | static WRITE8_HANDLER( pc8001mk2_port31_w )
|
| 65 | {
|
| 66 | /*
|
| 67 | |
| 68 | bit description
|
| 69 | |
| 70 | 0 expansion ROM (0=expansion, 1=N80)
|
| 71 | 1 memory mode (0=ROM, 1=RAM)
|
| 72 | 2 color mode (0=attribute, 1=B&W)
|
| 73 | 3 graphics enable
|
| 74 | 4 resolution (0=640x200, 1=320x200)
|
| 75 | 5 background color
|
| 76 | 6 background color
|
| 77 | 7 background color
|
| 78 | |
| 79 | */
|
| 80 | }
|
| 81 | |
| 29 | 82 | static WRITE8_HANDLER( port40_w )
|
| 30 | 83 | {
|
| 84 | /*
|
| 85 | |
| 86 | bit description
|
| 87 | |
| 88 | 0 PRT /STROBE
|
| 89 | 1 RTC STB
|
| 90 | 2 RTC CLK
|
| 91 | 3 CRT /CLDS CLK
|
| 92 | 4 unused
|
| 93 | 5 BEEP
|
| 94 | 6 unused
|
| 95 | 7 unused
|
| 96 | |
| 97 | */
|
| 98 | |
| 31 | 99 | pc8001_state *state = space->machine->driver_data;
|
| 32 | 100 | |
| 33 | 101 | /* printer */
|
| r6308 | r6309 | |
| 36 | 104 | /* real time clock */
|
| 37 | 105 | upd1990a_stb_w(state->upd1990a, BIT(data, 1));
|
| 38 | 106 | upd1990a_clk_w(state->upd1990a, BIT(data, 2));
|
| 107 | |
| 108 | /* beep */
|
| 109 | speaker_level_w(state->speaker, BIT(data, 5));
|
| 39 | 110 | }
|
| 40 | 111 | |
| 41 | 112 | static READ8_HANDLER( port40_r )
|
| 42 | 113 | {
|
| 114 | /*
|
| 115 | |
| 116 | bit description
|
| 117 | |
| 118 | 0 PRT /READY
|
| 119 | 1 PRT /ACK
|
| 120 | 2 CMT CDIN
|
| 121 | 3 EXP /EXTON
|
| 122 | 4 RTC DATA OUT
|
| 123 | 5 CRT VRTC
|
| 124 | 6 unused
|
| 125 | 7 unused
|
| 126 | |
| 127 | */
|
| 128 | |
| 43 | 129 | pc8001_state *state = space->machine->driver_data;
|
| 44 | 130 | UINT8 data = 0xc0;
|
| 45 | 131 | |
| r6308 | r6309 | |
| 71 | 157 | AM_RANGE(0x07, 0x07) AM_READ_PORT("KEY7")
|
| 72 | 158 | AM_RANGE(0x08, 0x08) AM_READ_PORT("KEY8")
|
| 73 | 159 | AM_RANGE(0x09, 0x09) AM_READ_PORT("KEY9")
|
| 74 | | AM_RANGE(0x10, 0x10) AM_WRITE(port10_w)
|
| 75 | | // AM_RANGE(0x30, 0x30) AM_WRITE(port30_w)
|
| 76 | | AM_RANGE(0x40, 0x40) AM_READWRITE(port40_r, port40_w)
|
| 160 | AM_RANGE(0x10, 0x10) AM_MIRROR(0x0f) AM_WRITE(port10_w)
|
| 161 | AM_RANGE(0x20, 0x20) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, msm8251_data_r, msm8251_data_w)
|
| 162 | AM_RANGE(0x21, 0x21) AM_MIRROR(0x0e) AM_DEVREADWRITE(I8251_TAG, msm8251_status_r, msm8251_control_w)
|
| 163 | AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE(port30_w)
|
| 164 | AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_READWRITE(port40_r, port40_w)
|
| 77 | 165 | AM_RANGE(0x50, 0x51) AM_DEVREADWRITE(UPD3301_TAG, upd3301_r, upd3301_w)
|
| 78 | 166 | AM_RANGE(0x60, 0x68) AM_DEVREADWRITE(I8257_TAG, dma8257_r, dma8257_w)
|
| 79 | | // AM_RANGE(0xe4, 0xe4) AM_WRITE(irq_level_w)
|
| 167 | // AM_RANGE(0x70, 0x7f) unused
|
| 168 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext0_w)
|
| 169 | // AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext1_w)
|
| 170 | // AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(pc8011_ext2_w)
|
| 171 | // AM_RANGE(0xb0, 0xb0) AM_READ(pc8011_gpio8_r)
|
| 172 | // AM_RANGE(0xb1, 0xb1) AM_WRITE(pc8011_gpio8_w)
|
| 173 | // AM_RANGE(0xb2, 0xb2) AM_READ(pc8011_gpio4_r)
|
| 174 | // AM_RANGE(0xb3, 0xb3) AM_WRITE(pc8011_gpio4_w)
|
| 175 | // AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(PC8011_CH1_I8251_TAG, msm8251_data_r, msm8251_data_w)
|
| 176 | // AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE(PC8011_CH1_I8251_TAG, msm8251_status_r, msm8251_control_w)
|
| 177 | // AM_RANGE(0xc2, 0xc2) AM_DEVREADWRITE(PC8011_CH2_I8251_TAG, msm8251_data_r, msm8251_data_w)
|
| 178 | // AM_RANGE(0xc3, 0xc3) AM_DEVREADWRITE(PC8011_CH2_I8251_TAG, msm8251_status_r, msm8251_control_w)
|
| 179 | // AM_RANGE(0xc8, 0xc8) RS-232 output enable?
|
| 180 | // AM_RANGE(0xca, 0xca) RS-232 output disable?
|
| 181 | // AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE(PC8011_IEEE488_I8255A_TAG, i8255a_r, i8255a_w)
|
| 182 | // AM_RANGE(0xd8, 0xd8) AM_READ(pc8011_ieee488_control_signal_input_r)
|
| 183 | // AM_RANGE(0xda, 0xda) AM_READ(pc8011_ieee488_bus_address_mode_r)
|
| 184 | // AM_RANGE(0xdc, 0xdc) AM_WRITE(pc8011_ieee488_nrfd_w)
|
| 185 | // AM_RANGE(0xde, 0xde) AM_WRITE(pc8011_ieee488_bus_mode_control_w)
|
| 186 | // AM_RANGE(0xe0, 0xe3) AM_WRITE(expansion_storage_mode_w)
|
| 187 | // AM_RANGE(0xe4, 0xe4) AM_MIRROR(0x01) AM_WRITE(irq_level_w)
|
| 80 | 188 | // AM_RANGE(0xe6, 0xe6) AM_WRITE(irq_mask_w)
|
| 189 | // AM_RANGE(0xe7, 0xe7) AM_WRITE(pc8012_memory_mode_w)
|
| 190 | // AM_RANGE(0xe8, 0xfb) unused
|
| 81 | 191 | AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w)
|
| 82 | 192 | ADDRESS_MAP_END
|
| 83 | 193 | |
| 194 | static ADDRESS_MAP_START( pc8001mk2_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 195 | AM_RANGE(0x0000, 0x5fff) AM_RAMBANK(1)
|
| 196 | AM_RANGE(0x6000, 0x7fff) AM_RAMBANK(2)
|
| 197 | AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(3)
|
| 198 | AM_RANGE(0xc000, 0xffff) AM_RAMBANK(4)
|
| 199 | ADDRESS_MAP_END
|
| 200 | |
| 201 | static ADDRESS_MAP_START( pc8001mk2_io, ADDRESS_SPACE_IO, 8 )
|
| 202 | AM_IMPORT_FROM(pc8001_io)
|
| 203 | AM_RANGE(0x30, 0x30) AM_WRITE(port30_w)
|
| 204 | AM_RANGE(0x31, 0x31) AM_WRITE(pc8001mk2_port31_w)
|
| 205 | // AM_RANGE(0x5c, 0x5c) AM_WRITE(pc8001mk2_gram_on_w)
|
| 206 | // AM_RANGE(0x5f, 0x5f) AM_WRITE(pc8001mk2_gram_off_w)
|
| 207 | // AM_RANGE(0xe8, 0xe8) kanji_address_lo_w, kanji_data_lo_r
|
| 208 | // AM_RANGE(0xe9, 0xe9) kanji_address_hi_w, kanji_data_hi_r
|
| 209 | // AM_RANGE(0xea, 0xea) kanji_readout_start_w
|
| 210 | // AM_RANGE(0xeb, 0xeb) kanji_readout_end_w
|
| 211 | // AM_RANGE(0xf3, 0xf3) DMA type disk unit interface selection port |
| 212 | // AM_RANGE(0xf4, 0xf4) DMA type 8 inch control
|
| 213 | // AM_RANGE(0xf5, 0xf5) DMA type 8 inch margin control
|
| 214 | // AM_RANGE(0xf6, 0xf6) DMA type 8 inch FDC status
|
| 215 | // AM_RANGE(0xf7, 0xf7) DMA type 8 inch FDC data register
|
| 216 | // AM_RANGE(0xf8, 0xf8) DMA type 5 inch control
|
| 217 | // AM_RANGE(0xf9, 0xf9) DMA type 5 inch margin control
|
| 218 | // AM_RANGE(0xfa, 0xfa) DMA type 5 inch FDC status
|
| 219 | // AM_RANGE(0xfb, 0xfb) DMA type 5 inch FDC data register
|
| 220 | ADDRESS_MAP_END
|
| 221 | |
| 84 | 222 | /* Input Ports */
|
| 85 | 223 | |
| 86 | 224 | static INPUT_PORTS_START( pc8001 )
|
| r6308 | r6309 | |
| 198 | 336 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(PGUP))
|
| 199 | 337 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(PGDN))
|
| 200 | 338 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
|
| 339 | |
| 340 | PORT_START("DSW1")
|
| 201 | 341 | INPUT_PORTS_END
|
| 202 | 342 | |
| 203 | 343 | /* Video */
|
| r6308 | r6309 | |
| 225 | 365 | {
|
| 226 | 366 | }
|
| 227 | 367 | |
| 368 | static WRITE_LINE_DEVICE_HANDLER( pc8001_upd3301_drq_w )
|
| 369 | {
|
| 370 | pc8001_state *driver_state = device->machine->driver_data;
|
| 371 | |
| 372 | dma8257_drq_w(driver_state->i8257, 2, state);
|
| 373 | }
|
| 374 | |
| 228 | 375 | static UPD3301_INTERFACE( pc8001_upd3301_intf )
|
| 229 | 376 | {
|
| 230 | 377 | SCREEN_TAG,
|
| 231 | 378 | pc8001_display_pixels,
|
| 232 | 379 | DEVCB_NULL,
|
| 380 | DEVCB_LINE(pc8001_upd3301_drq_w),
|
| 233 | 381 | DEVCB_NULL,
|
| 234 | | DEVCB_NULL,
|
| 235 | 382 | DEVCB_NULL
|
| 236 | 383 | };
|
| 237 | 384 | |
| 385 | /* 8251 Interface */
|
| 386 | |
| 387 | static msm8251_interface pc8001_8251_intf = |
| 388 | {
|
| 389 | NULL,
|
| 390 | NULL,
|
| 391 | NULL
|
| 392 | };
|
| 393 | |
| 238 | 394 | /* 8255 Interface */
|
| 239 | 395 | |
| 240 | 396 | I8255A_INTERFACE( pc8001_8255_intf )
|
| r6308 | r6309 | |
| 286 | 442 | state->i8257 = devtag_get_device(machine, I8257_TAG);
|
| 287 | 443 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG);
|
| 288 | 444 | state->upd3301 = devtag_get_device(machine, UPD3301_TAG);
|
| 289 | | //state->speaker = devtag_get_device(machine, SPEAKER_TAG);
|
| 445 | state->speaker = devtag_get_device(machine, SPEAKER_TAG);
|
| 290 | 446 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
|
| 291 | 447 | |
| 292 | 448 | /* find memory regions */
|
| r6308 | r6309 | |
| 368 | 524 | MDRV_VIDEO_UPDATE(pc8001)
|
| 369 | 525 | |
| 370 | 526 | /* sound hardware */
|
| 527 | MDRV_SPEAKER_STANDARD_MONO("mono")
|
| 528 | MDRV_SOUND_ADD(SPEAKER_TAG, SPEAKER, 0)
|
| 529 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
| 371 | 530 | |
| 372 | 531 | /* devices */
|
| 532 | MDRV_MSM8251_ADD(I8251_TAG, pc8001_8251_intf)
|
| 373 | 533 | MDRV_I8255A_ADD(I8255A_TAG, pc8001_8255_intf)
|
| 374 | 534 | MDRV_DMA8257_ADD(I8257_TAG, 4000000, pc8001_8257_intf)
|
| 375 | 535 | MDRV_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, pc8001_upd1990a_intf)
|
| r6308 | r6309 | |
| 386 | 546 | static MACHINE_DRIVER_START( pc8001mk2 )
|
| 387 | 547 | MDRV_IMPORT_FROM(pc8001)
|
| 388 | 548 | |
| 549 | MDRV_CPU_MODIFY(Z80_TAG)
|
| 550 | MDRV_CPU_PROGRAM_MAP(pc8001mk2_mem)
|
| 551 | MDRV_CPU_IO_MAP(pc8001mk2_io)
|
| 552 | |
| 389 | 553 | MDRV_RAM_MODIFY("messram")
|
| 390 | 554 | MDRV_RAM_DEFAULT_SIZE("64K")
|
| 391 | 555 | MACHINE_DRIVER_END
|
| r6308 | r6309 | |
| 406 | 570 | ROM_END
|
| 407 | 571 | |
| 408 | 572 | ROM_START( pc8001mk2 )
|
| 409 | | ROM_REGION( 0x10000, "maincpu", 0 )
|
| 573 | ROM_REGION( 0x8000, "n80", 0 )
|
| 410 | 574 | ROM_LOAD( "n80_2.rom", 0x00000, 0x8000, CRC(03cce7b6) SHA1(c12d34e42021110930fed45a8af98db52136f1fb) )
|
| 411 | 575 | |
| 412 | | ROM_REGION( 0x40000, "gfx1", 0)
|
| 576 | ROM_REGION( 0x800, "chargen", 0)
|
| 413 | 577 | ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) )
|
| 578 | |
| 579 | ROM_REGION( 0x20000, "kanji", 0)
|
| 414 | 580 | ROM_END
|
| 415 | 581 | |
| 416 | 582 | /* System Drivers */
|