Previous 199869 Revisions Next

r23650 Wednesday 12th June, 2013 at 13:48:22 UTC by Curt Coder
(MESS) softbox: Fixed reset. [Mike Naberezny]
(MESS) corvushd: Supported 4 hard disks and usage from within a device. [Curt Coder]
[src/mess/drivers]softbox.c
[src/mess/includes]corvushd.h softbox.h
[src/mess/machine]corvushd.c softbox.c softbox.h

trunk/src/mess/drivers/softbox.c
r23649r23650
357357}
358358
359359
360//-------------------------------------------------
361//  device_reset_after_children - device-specific
362//    reset that must happen after child devices
363//    have performed their resets
364//-------------------------------------------------
365 
366void 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}
360380
381
382
361383//**************************************************************************
362384//  MACHINE CONFIGURATION
363385//**************************************************************************
r23649r23650
379401   MCFG_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE(I8251_TAG, i8251_device, rxc_w), DEVWRITELINE(I8251_TAG, i8251_device, txc_w))
380402   MCFG_CBM_IEEE488_ADD("c8050")
381403   MCFG_HARDDISK_ADD("harddisk1")
404   MCFG_HARDDISK_ADD("harddisk2")
405   MCFG_HARDDISK_ADD("harddisk3")
406   MCFG_HARDDISK_ADD("harddisk4")
382407   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, "serial_terminal")
383408   MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal)
384409
trunk/src/mess/machine/softbox.c
r23649r23650
277277   MCFG_I8255A_ADD(I8255_1_TAG, ppi1_intf)
278278   MCFG_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE(I8251_TAG, i8251_device, rxc_w), DEVWRITELINE(I8251_TAG, i8251_device, txc_w))
279279   MCFG_HARDDISK_ADD("harddisk1")
280   MCFG_HARDDISK_ADD("harddisk2")
281   MCFG_HARDDISK_ADD("harddisk3")
282   MCFG_HARDDISK_ADD("harddisk4")
280283   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
281284MACHINE_CONFIG_END
282285
r23649r23650
331334softbox_device::softbox_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
332335   : device_t(mconfig, SOFTBOX, "PET SoftBox", tag, owner, clock, "pet_softbox", __FILE__),
333336      device_ieee488_interface(mconfig, *this),
337      m_maincpu(*this, Z80_TAG),
334338      m_dbrg(*this, COM8116_TAG)
335339{
336340}
r23649r23650
342346
343347void softbox_device::device_start()
344348{
345   corvus_hdc_init(machine());
349   corvus_hdc_init(this);
346350}
347351
348352
349353//-------------------------------------------------
354//  device_reset_after_children - device-specific
355//    reset that must happen after child devices
356//    have performed their resets
357//-------------------------------------------------
358 
359void 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//-------------------------------------------------
350376//  dbrg_w - baud rate selection
351377//-------------------------------------------------
352378
trunk/src/mess/machine/softbox.h
r23649r23650
5656protected:
5757   // device-level overrides
5858   virtual void device_start();
59   virtual void device_reset_after_children();
5960
6061private:
6162   enum
r23649r23650
6566      LED_READY
6667   };
6768
69   required_device<cpu_device> m_maincpu;
6870   required_device<com8116_device> m_dbrg;
6971};
7072
trunk/src/mess/machine/corvushd.c
r23649r23650
9797
9898// Controller structure
9999struct corvus_hdc_t {
100   device_t *root_device;
100101   UINT8   status;             // Controller status byte (DIRECTION + BUSY/READY)
101102   char    prep_mode;          // Whether the controller is in Prep Mode or not
102103   // Physical drive info
r23649r23650
11591160//      hard_disk_file object
11601161//
11611162static hard_disk_file *corvus_hdc_file(running_machine &machine, int id) {
1163   corvus_hdc_t
1164         *c = &corvus_hdc;
11621165   static const char *const tags[] = {
1163      "harddisk1"
1166      "harddisk1", "harddisk2", "harddisk3", "harddisk4"
11641167   };
11651168   harddisk_image_device *img;
11661169
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]));
11691174
1170   img = dynamic_cast<harddisk_image_device *>(machine.device(tags[id]));
1171
11721175   if ( !img )
11731176      return NULL;
11741177
11751178   if (!img->exists())
11761179      return NULL;
11771180
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;
11791191}
11801192
11811193
r23649r23650
14201432//
14211433UINT8 corvus_hdc_init(running_machine &machine) {
14221434   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;
14251435
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
14311436   c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Host-to-controller mode, Idle (awaiting command from Host mode)
14321437   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;
14361438   c->offset = 0;                              // Buffer is empty
14371439   c->awaiting_modifier = FALSE;               // We're not in the middle of a two-byte command
14381440   c->xmit_bytes = 0;                          // We don't have anything to say to the host
r23649r23650
14421444   c->timeout_timer->adjust(attotime::from_seconds(4), CALLBACK_TIMEOUT);
14431445   c->timeout_timer->enable(0);        // Start this timer out disabled
14441446
1445   LOG(("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors));
1446
14471447   //
14481448   // Define all of the packet sizes for the commands
14491449   //
r23649r23650
15481548}
15491549
15501550
1551UINT8 corvus_hdc_init( device_t *device )
1552{
1553   corvus_hdc_t            *c = &corvus_hdc;   // Pick up global controller structure
15511554
1555   c->root_device = device;
1556
1557   return corvus_hdc_init(device->machine());   
1558}
1559
1560
15521561//
15531562// Corvus_HDC_Status_R
15541563//
trunk/src/mess/includes/corvushd.h
r23649r23650
178178// Prototypes
179179//
180180UINT8 corvus_hdc_init( running_machine &machine );
181UINT8 corvus_hdc_init( device_t *device );
181182DECLARE_READ8_HANDLER ( corvus_hdc_status_r );
182183DECLARE_READ8_HANDLER ( corvus_hdc_data_r );
183184DECLARE_WRITE8_HANDLER ( corvus_hdc_data_w );
trunk/src/mess/includes/softbox.h
r23649r23650
2626public:
2727   softbox_state(const machine_config &mconfig, device_type type, const char *tag)
2828      : driver_device(mconfig, type, tag),
29         m_maincpu(*this, Z80_TAG),
2930         m_dbrg(*this, COM8116_TAG),
3031         m_ieee(*this, IEEE488_TAG)
3132   { }
3233
34   required_device<cpu_device> m_maincpu;
3335   required_device<com8116_device> m_dbrg;
3436   required_device<ieee488_device> m_ieee;
3537
3638   virtual void machine_start();
39   virtual void device_reset_after_children();
3740
3841   DECLARE_WRITE8_MEMBER( dbrg_w );
3942

Previous 199869 Revisions Next


© 1997-2024 The MAME Team