Previous 199869 Revisions Next

r21500 Friday 1st March, 2013 at 01:22:51 UTC by R. Belmont
(MESS) Apple II: Preliminary support for the Apple II Rev. C SCSI Card. [R. Belmont]
[src/mess/drivers]apple2.c apple2gs.c
[src/mess/machine]a2scsi.c a2scsi.h

trunk/src/mess/machine/a2scsi.c
r21499r21500
99
1010
1111    Notes:
12
1312    C0n0-C0n7 = NCR5380 registers in normal order
1413    C0n9 = DIP switches
1514    C0na = RAM and ROM bank switching
r21499r21500
2120#include "a2scsi.h"
2221#include "includes/apple2.h"
2322#include "machine/scsibus.h"
23#include "machine/nscsi_cd.h"
24#include "machine/nscsi_hd.h"
2425
25
2626/***************************************************************************
2727    PARAMETERS
2828***************************************************************************/
r21499r21500
3434const device_type A2BUS_SCSI = &device_creator<a2bus_scsi_device>;
3535
3636#define SCSI_ROM_REGION  "scsi_rom"
37#define SCSI_5380_TAG    "scsi:ncr5380"
37#define SCSI_BUS_TAG    "scsibus"
38#define SCSI_5380_TAG    "scsibus:7:ncr5380"
3839
39static const struct NCR5380interface a2scsi_5380_intf =
40static const ncr5380n_interface ncr5380_interface =
4041{
41   NULL        // IRQ handler (unconnected according to schematic)
42   DEVCB_NULL,
43   DEVCB_DEVICE_LINE_MEMBER("^^^", a2bus_scsi_device, drq_w)
4244};
4345
46static SLOT_INTERFACE_START( scsi_devices )
47   SLOT_INTERFACE("cdrom", NSCSI_CDROM)
48   SLOT_INTERFACE("harddisk", NSCSI_HARDDISK)
49   SLOT_INTERFACE_INTERNAL("ncr5380", NCR5380N)
50SLOT_INTERFACE_END
51
4452MACHINE_CONFIG_FRAGMENT( scsi )
4553   MCFG_SCSIBUS_ADD("scsi")
46   MCFG_NCR5380_ADD(SCSI_5380_TAG, (XTAL_28_63636MHz/4), a2scsi_5380_intf)
54   MCFG_NSCSI_BUS_ADD(SCSI_BUS_TAG)
55   MCFG_NSCSI_ADD("scsibus:0", scsi_devices, 0, 0, 0, 0, false)
56   MCFG_NSCSI_ADD("scsibus:1", scsi_devices, 0, 0, 0, 0, false)
57   MCFG_NSCSI_ADD("scsibus:2", scsi_devices, 0, 0, 0, 0, false)
58   MCFG_NSCSI_ADD("scsibus:3", scsi_devices, 0, 0, 0, 0, false)
59   MCFG_NSCSI_ADD("scsibus:4", scsi_devices, 0, 0, 0, 0, false)
60   MCFG_NSCSI_ADD("scsibus:5", scsi_devices, 0, 0, 0, 0, false)
61   MCFG_NSCSI_ADD("scsibus:6", scsi_devices, "harddisk", 0, 0, 0, false)
62   MCFG_NSCSI_ADD("scsibus:7", scsi_devices, "ncr5380", 0, &ncr5380_interface, 10000000, true)
4763MACHINE_CONFIG_END
4864
4965ROM_START( scsi )
r21499r21500
8197a2bus_scsi_device::a2bus_scsi_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
8298   device_t(mconfig, type, name, tag, owner, clock),
8399   device_a2bus_card_interface(mconfig, *this),
84   m_ncr5380(*this, SCSI_5380_TAG)
100   m_ncr5380(*this, SCSI_5380_TAG),
101   m_scsibus(*this, SCSI_BUS_TAG)
85102{
86103   m_shortname = "a2scsi";
87104}
r21499r21500
89106a2bus_scsi_device::a2bus_scsi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
90107   device_t(mconfig, A2BUS_SCSI, "Apple II SCSI Card", tag, owner, clock),
91108   device_a2bus_card_interface(mconfig, *this),
92   m_ncr5380(*this, SCSI_5380_TAG)
109   m_ncr5380(*this, SCSI_5380_TAG),
110   m_scsibus(*this, SCSI_BUS_TAG)
93111{
94112   m_shortname = "a2scsi";
95113}
r21499r21500
111129   save_item(NAME(m_ram));
112130   save_item(NAME(m_rambank));
113131   save_item(NAME(m_rombank));
132   save_item(NAME(m_bank));
133   save_item(NAME(m_drq));
134   save_item(NAME(m_816block));
114135}
115136
116137void a2bus_scsi_device::device_reset()
117138{
118139   m_rambank = m_rombank = 0;      // CLR on 74LS273 at U3E is connected to RES, so these clear on reset
140   m_816block = false;
119141}
120142
121143
r21499r21500
125147
126148UINT8 a2bus_scsi_device::read_c0nx(address_space &space, UINT8 offset)
127149{
128   printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc());
129
130150   switch (offset)
131151   {
132152      case 0:
r21499r21500
137157      case 5:
138158      case 6:
139159      case 7:
140         return m_ncr5380->ncr5380_read_reg(offset);
160//         printf("Read 5380 @ %x\n", offset);
161         return m_ncr5380->read(space, offset);
162         break;
141163
142   case 9:         // card's ID?
143      return 7;
164      case 8:      // read and DACK
165         return m_ncr5380->dma_r();
166
167      case 9:     // our SCSI ID (normally 0x80 = 7)
168         return (1<<7);
169
170      case 0xa:   // RAM/ROM bank
171         return m_bank;
172
173      case 0xe:   // DRQ status in bit 7
174         return m_drq;
175
176      default:
177         printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc());
178         break;
144179   }
145180
146181   return 0xff;
r21499r21500
153188
154189void a2bus_scsi_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
155190{
156   printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc());
157
158191   switch (offset)
159192   {
160193      case 0:
r21499r21500
165198      case 5:
166199      case 6:
167200      case 7:
168         m_ncr5380->ncr5380_write_reg(offset, data);
201//         printf("%02x to 5380 reg %x\n", data, offset);
202         m_ncr5380->write(space, offset, data);
169203         break;
170204
205      case 8:   // write and DACK
206         m_ncr5380->dma_w(data);
207         break;
208
171209      case 0xa:  // ROM and RAM banking (74LS273 at U3E)
172210         /*
173211             ROM banking:
r21499r21500
185223
186224         m_rambank = ((data>>4) & 0x7) * 0x400;
187225         m_rombank = (data & 0xf) * 0x400;
188         printf("RAM bank to %x, ROM bank to %x\n", m_rambank, m_rombank);
226         m_bank = data;
227//         printf("RAM bank to %x, ROM bank to %x\n", m_rambank, m_rombank);
228         m_816block = false;   // does this reset block mode?
189229         break;
190230
191      case 0xb:
192         printf("Reset NCR5380\n");
231      case 0xb:   // reset 5380
232//         printf("Resetting SCSI: %02x at %x\n", data, space.device().safe_pc());
233         m_ncr5380->reset();
234         m_816block = false;
193235         break;
236
237      case 0xc:   // set IIgs block mode DMA
238         printf("%02x to block-mode DMA mode\n", data);
239         m_816block = true;
240         break;
241
242      case 0xd:   // set Mac-style pseudo-DMA
243//         printf("%02x to pseudo-DMA mode\n", data);
244         m_816block = false;
245         break;
246
247      default:
248         printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc());
249         break;
194250   }
195251}
196252
r21499r21500
206262
207263void a2bus_scsi_device::write_cnxx(address_space &space, UINT8 offset, UINT8 data)
208264{
209   printf("Write %02x to cn%02x (PC=%x)\n", data, offset, space.device().safe_pc());
265   // there are writes to cn0A, possibly misguided C0nA (bank select?) writes?
266//   printf("Write %02x to cn%02x (PC=%x)\n", data, offset, space.device().safe_pc());
210267}
211268
212269/*-------------------------------------------------
r21499r21500
219276   // bankswitched ROM at cc00-cfff
220277   if (offset < 0x400)
221278   {
222      printf("Read RAM at %x = %02x\n", offset+m_rambank, m_ram[offset + m_rambank]);
279//      printf("Read RAM at %x = %02x\n", offset+m_rambank, m_ram[offset + m_rambank]);
280      if (m_816block)
281      {
282         return m_ncr5380->dma_r();
283      }
284
223285      return m_ram[offset + m_rambank];
224286   }
225287   else
r21499r21500
235297{
236298   if (offset < 0x400)
237299   {
238      printf("%02x to RAM at %x\n", data, offset+m_rambank);
239      m_ram[offset + m_rambank] = data;
300//      printf("%02x to RAM at %x\n", data, offset+m_rambank);
301      if (m_816block)
302      {
303         m_ncr5380->dma_w(data);
304      }
305      else
306      {
307         m_ram[offset + m_rambank] = data;
308      }
240309   }
241310}
311
312WRITE_LINE_MEMBER( a2bus_scsi_device::drq_w )
313{
314   m_drq = (state ? 0x80 : 0x00);
315}
trunk/src/mess/machine/a2scsi.h
r21499r21500
1111
1212#include "emu.h"
1313#include "machine/a2bus.h"
14#include "machine/ncr5380.h"
14#include "machine/ncr5380n.h"
1515
1616//**************************************************************************
1717//  TYPE DEFINITIONS
r21499r21500
3030   virtual machine_config_constructor device_mconfig_additions() const;
3131   virtual const rom_entry *device_rom_region() const;
3232
33   required_device<ncr5380n_device> m_ncr5380;
34   required_device<nscsi_bus_device> m_scsibus;
35
36   DECLARE_WRITE_LINE_MEMBER( drq_w );
37
3338protected:
3439   virtual void device_start();
3540   virtual void device_reset();
r21499r21500
4247   virtual UINT8 read_c800(address_space &space, UINT16 offset);
4348   virtual void write_c800(address_space &space, UINT16 offset, UINT8 data);
4449
45   required_device<ncr5380_device> m_ncr5380;
46
4750private:
4851   UINT8 *m_rom;
4952   UINT8 m_ram[8192];  // 8 banks of 1024 bytes
5053   int m_rambank, m_rombank;
54   UINT8 m_drq;
55   UINT8 m_bank;
56   bool m_816block;
5157};
5258
5359// device type definition
trunk/src/mess/drivers/apple2gs.c
r21499r21500
7474#include "machine/a2midi.h"
7575#include "machine/a2vulcan.h"
7676#include "machine/a2zipdrive.h"
77//#include "machine/a2udrive.h"
7778
7879static const gfx_layout apple2gs_text_layout =
7980{
r21499r21500
307308   SLOT_INTERFACE("vulcan", A2BUS_VULCAN)  /* AE Vulcan IDE card */
308309   SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE)  /* ZIP Technologies IDE card */
309310   SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS)    /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */
311//   SLOT_INTERFACE("mdturbo", A2BUS_UDRIVE_TURBO)  /* ///SHH Systeme MicroDrive Turbo IDE card */
312
310313//    SLOT_INTERFACE("softcard", A2BUS_SOFTCARD)  /* Microsoft SoftCard */  // appears not to be IIgs compatible?
311//    SLOT_INTERFACE("scsi", A2BUS_SCSI)  /* Apple II SCSI Card */
314    SLOT_INTERFACE("scsi", A2BUS_SCSI)  /* Apple II SCSI Card */
312315SLOT_INTERFACE_END
313316
314317static MACHINE_CONFIG_START( apple2gs, apple2gs_state )
trunk/src/mess/drivers/apple2.c
r21499r21500
637637   SLOT_INTERFACE("midi", A2BUS_MIDI)  /* Generic 6840+6850 MIDI board */
638638   SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE)  /* ZIP Technologies IDE card */
639639   SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS)    /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */
640//    SLOT_INTERFACE("scsi", A2BUS_SCSI)  /* Apple II SCSI Card */
640    SLOT_INTERFACE("scsi", A2BUS_SCSI)  /* Apple II SCSI Card */
641641SLOT_INTERFACE_END
642642
643643static SLOT_INTERFACE_START(apple2eaux_cards)
r21499r21500
787787   MCFG_A2BUS_SLOT_REMOVE("sl7")
788788
789789   // TODO: populate the IIc's other virtual slots with ONBOARD_ADD
790   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_SSC, NULL)
791   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl2", A2BUS_SSC, NULL)
790792   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_DISKII, NULL)
791793
792794   MCFG_A2EAUXSLOT_SLOT_REMOVE("aux")
r21499r21500
806808static MACHINE_CONFIG_DERIVED( laser128, apple2c )
807809   MCFG_MACHINE_START_OVERRIDE(apple2_state,laser128)
808810
811   MCFG_A2BUS_SLOT_REMOVE("sl1")
812   MCFG_A2BUS_SLOT_REMOVE("sl2")
809813   MCFG_A2BUS_SLOT_REMOVE("sl6")
810814
811815   MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl1", A2BUS_LASER128, NULL)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team