trunk/src/mess/drivers/softbox.c
| r23649 | r23650 | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | |
| 360 | //------------------------------------------------- |
| 361 | // device_reset_after_children - device-specific |
| 362 | // reset that must happen after child devices |
| 363 | // have performed their resets |
| 364 | //------------------------------------------------- |
| 365 | |
| 366 | void softbox_state::device_reset_after_children() |
| 367 | { |
| 368 | /* The Z80 starts at address 0x0000 but the SoftBox has RAM there and |
| 369 | needs to start from the BIOS at 0xf000. The PCB has logic and a |
| 370 | 74S287 PROM that temporarily changes the memory map so that the |
| 371 | IC3 EPROM at 0xf000 is mapped to 0x0000 for the first instruction |
| 372 | fetch only. The instruction normally at 0xf000 is an absolute jump |
| 373 | into the BIOS. On reset, the Z80 will fetch it from 0x0000 and set |
| 374 | its PC, then the normal map will be restored before the next |
| 375 | instruction fetch. Here we just set the PC to 0xf000 after the Z80 |
| 376 | resets, which has the same effect. */ |
| 377 | |
| 378 | m_maincpu->set_state_int(Z80_PC, 0xf000); |
| 379 | } |
| 360 | 380 | |
| 381 | |
| 382 | |
| 361 | 383 | //************************************************************************** |
| 362 | 384 | // MACHINE CONFIGURATION |
| 363 | 385 | //************************************************************************** |
| r23649 | r23650 | |
| 379 | 401 | MCFG_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE(I8251_TAG, i8251_device, rxc_w), DEVWRITELINE(I8251_TAG, i8251_device, txc_w)) |
| 380 | 402 | MCFG_CBM_IEEE488_ADD("c8050") |
| 381 | 403 | MCFG_HARDDISK_ADD("harddisk1") |
| 404 | MCFG_HARDDISK_ADD("harddisk2") |
| 405 | MCFG_HARDDISK_ADD("harddisk3") |
| 406 | MCFG_HARDDISK_ADD("harddisk4") |
| 382 | 407 | MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, "serial_terminal") |
| 383 | 408 | MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) |
| 384 | 409 | |
trunk/src/mess/machine/softbox.c
| r23649 | r23650 | |
| 277 | 277 | MCFG_I8255A_ADD(I8255_1_TAG, ppi1_intf) |
| 278 | 278 | MCFG_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE(I8251_TAG, i8251_device, rxc_w), DEVWRITELINE(I8251_TAG, i8251_device, txc_w)) |
| 279 | 279 | MCFG_HARDDISK_ADD("harddisk1") |
| 280 | MCFG_HARDDISK_ADD("harddisk2") |
| 281 | MCFG_HARDDISK_ADD("harddisk3") |
| 282 | MCFG_HARDDISK_ADD("harddisk4") |
| 280 | 283 | MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL) |
| 281 | 284 | MACHINE_CONFIG_END |
| 282 | 285 | |
| r23649 | r23650 | |
| 331 | 334 | softbox_device::softbox_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 332 | 335 | : device_t(mconfig, SOFTBOX, "PET SoftBox", tag, owner, clock, "pet_softbox", __FILE__), |
| 333 | 336 | device_ieee488_interface(mconfig, *this), |
| 337 | m_maincpu(*this, Z80_TAG), |
| 334 | 338 | m_dbrg(*this, COM8116_TAG) |
| 335 | 339 | { |
| 336 | 340 | } |
| r23649 | r23650 | |
| 342 | 346 | |
| 343 | 347 | void softbox_device::device_start() |
| 344 | 348 | { |
| 345 | | corvus_hdc_init(machine()); |
| 349 | corvus_hdc_init(this); |
| 346 | 350 | } |
| 347 | 351 | |
| 348 | 352 | |
| 349 | 353 | //------------------------------------------------- |
| 354 | // device_reset_after_children - device-specific |
| 355 | // reset that must happen after child devices |
| 356 | // have performed their resets |
| 357 | //------------------------------------------------- |
| 358 | |
| 359 | void softbox_device::device_reset_after_children() |
| 360 | { |
| 361 | /* The Z80 starts at address 0x0000 but the SoftBox has RAM there and |
| 362 | needs to start from the BIOS at 0xf000. The PCB has logic and a |
| 363 | 74S287 PROM that temporarily changes the memory map so that the |
| 364 | IC3 EPROM at 0xf000 is mapped to 0x0000 for the first instruction |
| 365 | fetch only. The instruction normally at 0xf000 is an absolute jump |
| 366 | into the BIOS. On reset, the Z80 will fetch it from 0x0000 and set |
| 367 | its PC, then the normal map will be restored before the next |
| 368 | instruction fetch. Here we just set the PC to 0xf000 after the Z80 |
| 369 | resets, which has the same effect. */ |
| 370 | |
| 371 | m_maincpu->set_state_int(Z80_PC, 0xf000); |
| 372 | } |
| 373 | |
| 374 | |
| 375 | //------------------------------------------------- |
| 350 | 376 | // dbrg_w - baud rate selection |
| 351 | 377 | //------------------------------------------------- |
| 352 | 378 | |
trunk/src/mess/machine/corvushd.c
| r23649 | r23650 | |
| 97 | 97 | |
| 98 | 98 | // Controller structure |
| 99 | 99 | struct corvus_hdc_t { |
| 100 | device_t *root_device; |
| 100 | 101 | UINT8 status; // Controller status byte (DIRECTION + BUSY/READY) |
| 101 | 102 | char prep_mode; // Whether the controller is in Prep Mode or not |
| 102 | 103 | // Physical drive info |
| r23649 | r23650 | |
| 1159 | 1160 | // hard_disk_file object |
| 1160 | 1161 | // |
| 1161 | 1162 | static hard_disk_file *corvus_hdc_file(running_machine &machine, int id) { |
| 1163 | corvus_hdc_t |
| 1164 | *c = &corvus_hdc; |
| 1162 | 1165 | static const char *const tags[] = { |
| 1163 | | "harddisk1" |
| 1166 | "harddisk1", "harddisk2", "harddisk3", "harddisk4" |
| 1164 | 1167 | }; |
| 1165 | 1168 | harddisk_image_device *img; |
| 1166 | 1169 | |
| 1167 | | /* Only one harddisk supported right now */ |
| 1168 | | assert ( id == 0 ); |
| 1170 | if (c->root_device) |
| 1171 | img = dynamic_cast<harddisk_image_device *>(c->root_device->subdevice(tags[id])); |
| 1172 | else |
| 1173 | img = dynamic_cast<harddisk_image_device *>(machine.device(tags[id])); |
| 1169 | 1174 | |
| 1170 | | img = dynamic_cast<harddisk_image_device *>(machine.device(tags[id])); |
| 1171 | | |
| 1172 | 1175 | if ( !img ) |
| 1173 | 1176 | return NULL; |
| 1174 | 1177 | |
| 1175 | 1178 | if (!img->exists()) |
| 1176 | 1179 | return NULL; |
| 1177 | 1180 | |
| 1178 | | return img->get_hard_disk_file(); |
| 1181 | // Pick up the Head/Cylinder/Sector info |
| 1182 | hard_disk_file *file = img->get_hard_disk_file(); |
| 1183 | hard_disk_info *info = hard_disk_get_info(file); |
| 1184 | c->sectors_per_track = info->sectors; |
| 1185 | c->tracks_per_cylinder = info->heads; |
| 1186 | c->cylinders_per_drive = info->cylinders; |
| 1187 | |
| 1188 | LOG(("corvus_hdc_init: Attached to drive %u image: H:%d, C:%d, S:%d\n", id, info->heads, info->cylinders, info->sectors)); |
| 1189 | |
| 1190 | return file; |
| 1179 | 1191 | } |
| 1180 | 1192 | |
| 1181 | 1193 | |
| r23649 | r23650 | |
| 1420 | 1432 | // |
| 1421 | 1433 | UINT8 corvus_hdc_init(running_machine &machine) { |
| 1422 | 1434 | corvus_hdc_t *c = &corvus_hdc; // Pick up global controller structure |
| 1423 | | hard_disk_file *disk; // Structures for interface to CHD routines |
| 1424 | | hard_disk_info *info; |
| 1425 | 1435 | |
| 1426 | | if((disk = corvus_hdc_file(machine, 0))) // Attach to the CHD file |
| 1427 | | info = hard_disk_get_info(disk); // Pick up the Head/Cylinder/Sector info |
| 1428 | | else |
| 1429 | | return 0; |
| 1430 | | |
| 1431 | 1436 | c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Host-to-controller mode, Idle (awaiting command from Host mode) |
| 1432 | 1437 | c->prep_mode = FALSE; // We're not in Prep Mode |
| 1433 | | c->sectors_per_track = info->sectors; |
| 1434 | | c->tracks_per_cylinder = info->heads; |
| 1435 | | c->cylinders_per_drive = info->cylinders; |
| 1436 | 1438 | c->offset = 0; // Buffer is empty |
| 1437 | 1439 | c->awaiting_modifier = FALSE; // We're not in the middle of a two-byte command |
| 1438 | 1440 | c->xmit_bytes = 0; // We don't have anything to say to the host |
| r23649 | r23650 | |
| 1442 | 1444 | c->timeout_timer->adjust(attotime::from_seconds(4), CALLBACK_TIMEOUT); |
| 1443 | 1445 | c->timeout_timer->enable(0); // Start this timer out disabled |
| 1444 | 1446 | |
| 1445 | | LOG(("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors)); |
| 1446 | | |
| 1447 | 1447 | // |
| 1448 | 1448 | // Define all of the packet sizes for the commands |
| 1449 | 1449 | // |
| r23649 | r23650 | |
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | |
| 1551 | UINT8 corvus_hdc_init( device_t *device ) |
| 1552 | { |
| 1553 | corvus_hdc_t *c = &corvus_hdc; // Pick up global controller structure |
| 1551 | 1554 | |
| 1555 | c->root_device = device; |
| 1556 | |
| 1557 | return corvus_hdc_init(device->machine()); |
| 1558 | } |
| 1559 | |
| 1560 | |
| 1552 | 1561 | // |
| 1553 | 1562 | // Corvus_HDC_Status_R |
| 1554 | 1563 | // |
trunk/src/mess/includes/softbox.h
| r23649 | r23650 | |
| 26 | 26 | public: |
| 27 | 27 | softbox_state(const machine_config &mconfig, device_type type, const char *tag) |
| 28 | 28 | : driver_device(mconfig, type, tag), |
| 29 | m_maincpu(*this, Z80_TAG), |
| 29 | 30 | m_dbrg(*this, COM8116_TAG), |
| 30 | 31 | m_ieee(*this, IEEE488_TAG) |
| 31 | 32 | { } |
| 32 | 33 | |
| 34 | required_device<cpu_device> m_maincpu; |
| 33 | 35 | required_device<com8116_device> m_dbrg; |
| 34 | 36 | required_device<ieee488_device> m_ieee; |
| 35 | 37 | |
| 36 | 38 | virtual void machine_start(); |
| 39 | virtual void device_reset_after_children(); |
| 37 | 40 | |
| 38 | 41 | DECLARE_WRITE8_MEMBER( dbrg_w ); |
| 39 | 42 | |