src/mess/drivers/pyl601.c
| r5383 | r5384 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "cpu/m6800/m6800.h" |
| 11 | 11 | #include "video/mc6845.h" |
| 12 | #include "devices/basicdsk.h" |
| 13 | #include "machine/nec765.h" |
| 12 | 14 | |
| 13 | 15 | static UINT8 rom_page; |
| 14 | 16 | static UINT32 vdisk_addr = 0; |
| r5383 | r5384 | |
| 68 | 70 | return retVal; |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | | static READ8_HANDLER ( unknown_r ) |
| 72 | | { |
| 73 | | return 0x80; |
| 74 | | } |
| 75 | | |
| 76 | 73 | UINT8 selectedline(UINT16 data) |
| 77 | 74 | { |
| 78 | 75 | UINT8 i; |
| r5383 | r5384 | |
| 138 | 135 | return retVal; |
| 139 | 136 | } |
| 140 | 137 | |
| 138 | static WRITE8_HANDLER (speaker_w) |
| 139 | { |
| 140 | } |
| 141 | 141 | |
| 142 | static WRITE8_HANDLER (led_w) |
| 143 | { |
| 144 | // UINT8 caps_led = BIT(data,4); |
| 145 | } |
| 146 | |
| 147 | INLINE const device_config *get_floppy_image(running_machine *machine, int drive) |
| 148 | { |
| 149 | return image_from_devtype_and_index(machine, IO_FLOPPY, drive); |
| 150 | } |
| 151 | |
| 152 | static NEC765_GET_IMAGE( pyldin_nec765_get_image ) |
| 153 | { |
| 154 | return get_floppy_image(device->machine, (floppy_index & 1)^1); |
| 155 | } |
| 156 | UINT8 floppy_ctrl = 0; |
| 157 | static WRITE8_HANDLER (floppy_w) |
| 158 | { |
| 159 | // bit 0 is reset (if zero) |
| 160 | // bit 1 is TC state |
| 161 | // bit 2 is drive selected |
| 162 | // bit 3 is motor state |
| 163 | const device_config *floppy = devtag_get_device(space->machine, "nec765"); |
| 164 | if (BIT(data,0)==0) { |
| 165 | //reset |
| 166 | nec765_reset(floppy,0); |
| 167 | } |
| 168 | floppy_drive_set_motor_state(get_floppy_image(space->machine, BIT(data,2)), BIT(data,3)); |
| 169 | |
| 170 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data,2), 0); |
| 171 | |
| 172 | nec765_set_tc_state(floppy, BIT(data,1)); |
| 173 | |
| 174 | floppy_ctrl = data; |
| 175 | } |
| 176 | static READ8_HANDLER (floppy_r) |
| 177 | { |
| 178 | return floppy_ctrl; |
| 179 | } |
| 180 | |
| 181 | static const struct nec765_interface pyldin_nec765_interface = |
| 182 | { |
| 183 | NULL, /* interrupt */ |
| 184 | NULL, /* DMA request */ |
| 185 | pyldin_nec765_get_image, /* image lookup */ |
| 186 | NEC765_RDY_PIN_CONNECTED /* ready pin */ |
| 187 | }; |
| 188 | |
| 142 | 189 | static ADDRESS_MAP_START(pyl601_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 143 | 190 | ADDRESS_MAP_UNMAP_HIGH |
| 144 | 191 | AM_RANGE( 0x0000, 0xbfff ) AM_RAMBANK(1) |
| r5383 | r5384 | |
| 150 | 197 | AM_RANGE( 0xe605, 0xe605 ) AM_DEVREADWRITE("crtc", mc6845_register_r , mc6845_register_w) |
| 151 | 198 | AM_RANGE( 0xe628, 0xe628 ) AM_READ(keyboard_r) |
| 152 | 199 | AM_RANGE( 0xe629, 0xe629 ) AM_READWRITE(video_mode_r,video_mode_w) |
| 153 | | AM_RANGE( 0xe62a, 0xe62a ) AM_READ(keycheck_r) |
| 154 | | AM_RANGE( 0xe62b, 0xe62b ) AM_READ(timer_r) |
| 200 | AM_RANGE( 0xe62a, 0xe62a ) AM_READWRITE(keycheck_r,led_w) |
| 201 | AM_RANGE( 0xe62b, 0xe62b ) AM_READWRITE(timer_r,speaker_w) |
| 155 | 202 | AM_RANGE( 0xe62d, 0xe62d ) AM_READ(video_mode_r) |
| 156 | | AM_RANGE( 0xe62e, 0xe62e ) AM_READ(keycheck_r) |
| 203 | AM_RANGE( 0xe62e, 0xe62e ) AM_READWRITE(keycheck_r,led_w) |
| 157 | 204 | AM_RANGE( 0xe680, 0xe680 ) AM_WRITE(vdisk_page_w) |
| 158 | 205 | AM_RANGE( 0xe681, 0xe681 ) AM_WRITE(vdisk_h_w) |
| 159 | 206 | AM_RANGE( 0xe682, 0xe682 ) AM_WRITE(vdisk_l_w) |
| 160 | 207 | AM_RANGE( 0xe683, 0xe683 ) AM_READWRITE(vdisk_data_r,vdisk_data_w) |
| 161 | | AM_RANGE( 0xe6d0, 0xe6d0 ) AM_READ(unknown_r) |
| 208 | AM_RANGE( 0xe6c0, 0xe6c0 ) AM_READWRITE(floppy_r, floppy_w) |
| 209 | AM_RANGE( 0xe6d0, 0xe6d0 ) AM_DEVREAD("nec765", nec765_status_r) |
| 210 | AM_RANGE( 0xe6d1, 0xe6d1 ) AM_DEVREADWRITE("nec765", nec765_data_r, nec765_data_w) |
| 162 | 211 | AM_RANGE( 0xe6f0, 0xe6f0 ) AM_READWRITE(rom_page_r, rom_page_w) |
| 163 | 212 | AM_RANGE( 0xe700, 0xefff ) AM_RAMBANK(4) |
| 164 | 213 | AM_RANGE( 0xf000, 0xffff ) AM_READWRITE(SMH_BANK(5), SMH_BANK(6)) |
| r5383 | r5384 | |
| 433 | 482 | |
| 434 | 483 | MDRV_VIDEO_START( pyl601 ) |
| 435 | 484 | MDRV_VIDEO_UPDATE( pyl601 ) |
| 485 | |
| 486 | MDRV_NEC765A_ADD("nec765", pyldin_nec765_interface) |
| 436 | 487 | MACHINE_DRIVER_END |
| 437 | 488 | |
| 438 | 489 | static MACHINE_DRIVER_START( pyl601a ) |
| r5383 | r5384 | |
| 442 | 493 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_2MHz, pyl601a_crtc6845_interface) |
| 443 | 494 | MACHINE_DRIVER_END |
| 444 | 495 | |
| 496 | static DEVICE_IMAGE_LOAD( pyldin_floppy ) |
| 497 | { |
| 498 | if (image_has_been_created(image)) |
| 499 | { |
| 500 | return INIT_FAIL; |
| 501 | } |
| 502 | |
| 503 | if (DEVICE_IMAGE_LOAD_NAME(basicdsk_floppy)(image) == INIT_PASS) |
| 504 | { |
| 505 | switch (image_length(image)) |
| 506 | { |
| 507 | case 720*1024: |
| 508 | basicdsk_set_geometry(image, 80, 2, 9, 512, 1, 0, FALSE); |
| 509 | break; |
| 510 | default: |
| 511 | return INIT_FAIL; |
| 512 | } |
| 513 | |
| 514 | return INIT_PASS; |
| 515 | } |
| 516 | |
| 517 | return INIT_FAIL; |
| 518 | } |
| 519 | |
| 520 | static void pyldin_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 521 | { |
| 522 | switch (state) |
| 523 | { |
| 524 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 525 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break; |
| 526 | |
| 527 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 528 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(pyldin_floppy); break; |
| 529 | |
| 530 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 531 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "img"); break; |
| 532 | |
| 533 | default: legacybasicdsk_device_getinfo(devclass, state, info); break; |
| 534 | } |
| 535 | } |
| 445 | 536 | static SYSTEM_CONFIG_START(pyl601) |
| 446 | 537 | CONFIG_RAM_DEFAULT((64 +512) * 1024) |
| 538 | CONFIG_DEVICE( pyldin_floppy_getinfo ) |
| 447 | 539 | SYSTEM_CONFIG_END |
| 448 | 540 | |
| 449 | 541 | /* ROM definition */ |
| r5383 | r5384 | |
| 454 | 546 | ROM_REGION(0x0800, "gfx1",0) |
| 455 | 547 | ROM_LOAD( "video.rom", 0x0000, 0x0800, CRC(1c23ba43) SHA1(eb1cfc139858abd0aedbbf3d523f8ba55d27a11d)) |
| 456 | 548 | |
| 457 | | ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF) |
| 549 | ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF) |
| 458 | 550 | ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9)) |
| 459 | 551 | ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385)) |
| 460 | 552 | ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442)) |