Previous 15994 Revisions Next

r15019 Tuesday 24th April, 2012 at 02:47:10 UTC by R. Belmont
Apple II: added /INH support to the slots for the D000-FFFF region and added IAI SwyftCard support. (It must go in slot 3 of a IIe!)
[src/mess]mess.mak
[src/mess/drivers]apple2.c apple2gs.c
[src/mess/includes]apple2.h
[src/mess/machine]a2bus.c a2bus.h a2swyft.c* a2swyft.h* apple2.c

src/mess/machine/a2bus.c
r15018r15019
148148   {
149149       memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
150150       memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
151       memset(&m_out_inh_cb, 0, sizeof(m_out_inh_cb));
151152   }
152153}
153154
r15018r15019
179180    // resolve callbacks
180181   m_out_irq_func.resolve(m_out_irq_cb, *this);
181182   m_out_nmi_func.resolve(m_out_nmi_cb, *this);
183   m_out_inh_func.resolve(m_out_inh_cb, *this);
182184
183185    // clear slots
184186    for (int i = 0; i < 8; i++)
r15018r15019
220222    m_out_nmi_func(state);
221223}
222224
225void a2bus_device::set_inh_slotnum(int slot)
226{
227    m_out_inh_func(slot);
228}
229
223230// interrupt request from a2bus card
224231WRITE_LINE_MEMBER( a2bus_device::irq_w ) { m_out_irq_func(state); }
225232WRITE_LINE_MEMBER( a2bus_device::nmi_w ) { m_out_nmi_func(state); }
r15018r15019
276283   m_a2bus->add_a2bus_card(m_slot, this);
277284}
278285
279
src/mess/machine/a2bus.h
r15018r15019
1313
1414#include "emu.h"
1515
16#define INH_SLOT_INVALID    (255)
1617
1718//**************************************************************************
1819//  INTERFACE CONFIGURATION MACROS
r15018r15019
7273{
7374    devcb_write_line   m_out_irq_cb;
7475    devcb_write_line   m_out_nmi_cb;
76    devcb_write_line   m_out_inh_cb;
7577};
7678
7779class device_a2bus_card_interface;
r15018r15019
9193
9294    void set_irq_line(int state);
9395    void set_nmi_line(int state);
96    void set_inh_slotnum(int slot);
9497
9598   DECLARE_WRITE_LINE_MEMBER( irq_w );
9699   DECLARE_WRITE_LINE_MEMBER( nmi_w );
r15018r15019
106109
107110   devcb_resolved_write_line   m_out_irq_func;
108111   devcb_resolved_write_line   m_out_nmi_func;
112   devcb_resolved_write_line   m_out_inh_func;
109113
110114    device_a2bus_card_interface *m_device_list[8];
111115   const char *m_cputag;
r15018r15019
126130   device_a2bus_card_interface(const machine_config &mconfig, device_t &device);
127131   virtual ~device_a2bus_card_interface();
128132
129    virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { return 0; }       // C0nX - /DEVSEL
133    virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { printf("a2bus: unhandled read at C0n%x\n", offset); return 0; }       // C0nX - /DEVSEL
130134    virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to C0n%x\n", data, offset); }
131135    virtual UINT8 read_cnxx(address_space &space, UINT8 offset) { return 0; }       // CnXX - /IOSEL
132136    virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to Cn%02x\n", data, offset); }
133137    virtual UINT8 read_c800(address_space &space, UINT16 offset) { return 0; }      // C800 - /IOSTB
134138    virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { printf("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); }
135139    virtual bool take_c800() { return true; }   // override and return false if your card doesn't take over the c800 space
140    virtual UINT8 read_inh_rom(address_space &space, UINT16 offset) { return 0; }
141    virtual void write_inh_rom(address_space &space, UINT16 offset, UINT8 data) { }
136142
137143   device_a2bus_card_interface *next() const { return m_next; }
138144
r15018r15019
145151    void lower_slot_irq() { m_a2bus->set_irq_line(CLEAR_LINE); }
146152    void raise_slot_nmi() { m_a2bus->set_nmi_line(ASSERT_LINE); }
147153    void lower_slot_nmi() { m_a2bus->set_nmi_line(CLEAR_LINE); }
154    void raise_slot_inh() { m_a2bus->set_inh_slotnum(m_slot); }
155    void lower_slot_inh() { m_a2bus->set_inh_slotnum(INH_SLOT_INVALID); }
148156
149157    // inline configuration
150158    static void static_set_a2bus_tag(device_t &device, const char *tag, const char *slottag);
src/mess/machine/a2swyft.c
r0r15019
1/*********************************************************************
2
3    a2swyft.c
4
5    Implementation of the IAI SwyftCard
6
7*********************************************************************/
8
9#include "emu.h"
10#include "includes/apple2.h"
11#include "machine/a2swyft.h"
12
13
14/***************************************************************************
15    PARAMETERS
16***************************************************************************/
17
18//**************************************************************************
19//  GLOBAL VARIABLES
20//**************************************************************************
21
22const device_type A2BUS_SWYFT = &device_creator<a2bus_swyft_device>;
23
24#define SWYFT_ROM_REGION  "swyft_rom"
25
26ROM_START( swyft )
27   ROM_REGION(0x4000, SWYFT_ROM_REGION, 0)
28    ROM_LOAD( "swyftcard rom.bin", 0x000000, 0x004000, CRC(5d6673e9) SHA1(1554bd03c536789f0ff7d1ef6c992265e311935d) )
29ROM_END
30
31//-------------------------------------------------
32//  rom_region - device-specific ROM region
33//-------------------------------------------------
34
35const rom_entry *a2bus_swyft_device::device_rom_region() const
36{
37   return ROM_NAME( swyft );
38}
39
40//**************************************************************************
41//  LIVE DEVICE
42//**************************************************************************
43
44a2bus_swyft_device::a2bus_swyft_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
45        device_t(mconfig, A2BUS_SWYFT, "IAI SwyftCard", tag, owner, clock),
46      device_a2bus_card_interface(mconfig, *this)
47{
48   m_shortname = "a2swyft";
49}
50
51a2bus_swyft_device::a2bus_swyft_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
52        device_t(mconfig, type, name, tag, owner, clock),
53      device_a2bus_card_interface(mconfig, *this)
54{
55   m_shortname = "a2swyft";
56}
57
58//-------------------------------------------------
59//  device_start - device-specific startup
60//-------------------------------------------------
61
62void a2bus_swyft_device::device_start()
63{
64   // set_a2bus_device makes m_slot valid
65   set_a2bus_device();
66
67   astring tempstring;
68   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SWYFT_ROM_REGION))->base();
69}
70
71void a2bus_swyft_device::device_reset()
72{
73    m_rombank = 0;
74
75    // take over the machine
76   apple2_state *state = machine().driver_data<apple2_state>();
77    raise_slot_inh();
78    state->m_maincpu->reset();
79}
80
81UINT8 a2bus_swyft_device::read_c0nx(address_space &space, UINT8 offset)
82{
83    switch (offset)
84    {
85        case 0:
86            m_rombank = 0;
87            raise_slot_inh();
88            break;
89
90        case 1:
91            m_rombank = 0;
92            lower_slot_inh();
93            break;
94
95        case 2:
96            m_rombank = 0x1000;
97            raise_slot_inh();
98            break;
99    }
100
101    return 0xff;
102}
103
104void a2bus_swyft_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
105{
106    switch (offset)
107    {
108        case 0:
109            m_rombank = 0;
110            raise_slot_inh();
111            break;
112
113        case 1:
114            m_rombank = 0;
115            lower_slot_inh();
116            break;
117
118        case 2:
119            m_rombank = 0x1000;
120            raise_slot_inh();
121            break;
122    }
123}
124
125UINT8 a2bus_swyft_device::read_inh_rom(address_space &space, UINT16 offset)
126{
127    if (offset < 0x1000)    // banked area d000-dfff
128    {
129        return m_rom[offset + m_rombank];
130    }
131    else                    // fixed area e000-ffff
132    {
133        return m_rom[offset - 0x1000 + 0x2000];
134    }
135}
136
src/mess/machine/a2swyft.h
r0r15019
1/*********************************************************************
2
3    a2swyft.h
4
5    IAI SwyftCard
6
7*********************************************************************/
8
9#ifndef __A2BUS_SWYFT__
10#define __A2BUS_SWYFT__
11
12#include "emu.h"
13#include "machine/a2bus.h"
14
15//**************************************************************************
16//  TYPE DEFINITIONS
17//**************************************************************************
18
19class a2bus_swyft_device:
20    public device_t,
21    public device_a2bus_card_interface
22{
23public:
24    // construction/destruction
25    a2bus_swyft_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
26    a2bus_swyft_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
27
28    virtual const rom_entry *device_rom_region() const;
29
30protected:
31    virtual void device_start();
32    virtual void device_reset();
33
34    virtual UINT8 read_c0nx(address_space &space, UINT8 offset);
35    virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data);
36    virtual UINT8 read_inh_rom(address_space &space, UINT16 offset);
37
38private:
39    UINT8 *m_rom;
40    int m_rombank;
41};
42
43// device type definition
44extern const device_type A2BUS_SWYFT;
45
46#endif  /* __A2BUS_SWYFT__ */
47
src/mess/machine/apple2.c
r15018r15019
6060static READ8_HANDLER ( apple2_ce00_r );
6161static WRITE8_HANDLER ( apple2_ce00_w );
6262
63static READ8_HANDLER ( apple2_inh_d000_r );
64static WRITE8_HANDLER ( apple2_inh_d000_w );
65static READ8_HANDLER ( apple2_inh_e000_r );
66static WRITE8_HANDLER ( apple2_inh_e000_w );
67
6368/* -----------------------------------------------------------------------
6469 * New Apple II memory manager
6570 * ----------------------------------------------------------------------- */
r15018r15019
720725   }
721726}
722727
728static READ8_HANDLER ( apple2_inh_d000_r )
729{
730   apple2_state *state = space->machine().driver_data<apple2_state>();
731   device_a2bus_card_interface *slotdevice;
732
733    slotdevice = state->m_a2bus->get_a2bus_card(state->m_inh_slot);
734
735   if (slotdevice != NULL)
736   {
737      return slotdevice->read_inh_rom(*space, offset & 0xfff);
738   }
739
740   return apple2_getfloatingbusvalue(space->machine());
741}
742
743static WRITE8_HANDLER ( apple2_inh_d000_w )
744{
745   apple2_state *state = space->machine().driver_data<apple2_state>();
746   device_a2bus_card_interface *slotdevice;
747
748    slotdevice = state->m_a2bus->get_a2bus_card(state->m_inh_slot);
749
750   if (slotdevice != NULL)
751   {
752      return slotdevice->write_inh_rom(*space, offset & 0xfff, data);
753   }
754}
755
756static READ8_HANDLER ( apple2_inh_e000_r )
757{
758   apple2_state *state = space->machine().driver_data<apple2_state>();
759   device_a2bus_card_interface *slotdevice;
760
761    slotdevice = state->m_a2bus->get_a2bus_card(state->m_inh_slot);
762
763   if (slotdevice != NULL)
764   {
765      return slotdevice->read_inh_rom(*space, (offset & 0x1fff) + 0x1000);
766   }
767
768   return apple2_getfloatingbusvalue(space->machine());
769}
770
771static WRITE8_HANDLER ( apple2_inh_e000_w )
772{
773   apple2_state *state = space->machine().driver_data<apple2_state>();
774   device_a2bus_card_interface *slotdevice;
775
776    slotdevice = state->m_a2bus->get_a2bus_card(state->m_inh_slot);
777
778   if (slotdevice != NULL)
779   {
780      slotdevice->write_inh_rom(*space, (offset & 0x1fff) + 0x1000, data);
781   }
782}
783
723784static void apple2_mem_0000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
724785{
725786   apple2_state *state = machine.driver_data<apple2_state>();
r15018r15019
871932static void apple2_mem_D000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
872933{
873934   apple2_state *state = machine.driver_data<apple2_state>();
874   if (state->m_flags & VAR_LCRAM)
875   {
876      if (state->m_flags & VAR_LCRAM2)
877         meminfo->read_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
878      else
879         meminfo->read_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
880   }
881   else
882   {
883      meminfo->read_mem      = (state->m_flags & VAR_ROMSWITCH) ? 0x005000 : 0x001000;
884      meminfo->read_mem      |= APPLE2_MEM_ROM;
885   }
886935
887   if (state->m_flags & VAR_LCWRITE)
888   {
889      if (state->m_flags & VAR_LCRAM2)
890         meminfo->write_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
891      else
892         meminfo->write_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
893   }
894   else
895   {
896      meminfo->write_mem = APPLE2_MEM_FLOATING;
897   }
936    if (state->m_inh_slot == INH_SLOT_INVALID)
937    {
938        if (state->m_flags & VAR_LCRAM)
939        {
940            if (state->m_flags & VAR_LCRAM2)
941                meminfo->read_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
942            else
943                meminfo->read_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
944        }
945        else
946        {
947            meminfo->read_mem      = (state->m_flags & VAR_ROMSWITCH) ? 0x005000 : 0x001000;
948            meminfo->read_mem      |= APPLE2_MEM_ROM;
949        }
950
951        if (state->m_flags & VAR_LCWRITE)
952        {
953            if (state->m_flags & VAR_LCRAM2)
954                meminfo->write_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
955            else
956                meminfo->write_mem   = (state->m_flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
957        }
958        else
959        {
960            meminfo->write_mem = APPLE2_MEM_FLOATING;
961        }
962    }
963    else
964    {
965        meminfo->read_handler = apple2_inh_d000_r;
966        meminfo->write_handler = apple2_inh_d000_w;
967    }
898968}
899969
900970static void apple2_mem_E000(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
901971{
902972   apple2_state *state = machine.driver_data<apple2_state>();
903   if (state->m_flags & VAR_LCRAM)
904   {
905      meminfo->read_mem      = (state->m_flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
906   }
907   else
908   {
909      meminfo->read_mem      = (state->m_flags & VAR_ROMSWITCH) ? 0x006000 : 0x002000;
910      meminfo->read_mem      |= APPLE2_MEM_ROM;
911   }
912973
913   if (state->m_flags & VAR_LCWRITE)
914   {
915      meminfo->write_mem      = (state->m_flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
916   }
917   else
918   {
919      meminfo->write_mem      = APPLE2_MEM_FLOATING;
920   }
974    if (state->m_inh_slot == INH_SLOT_INVALID)
975    {
976        if (state->m_flags & VAR_LCRAM)
977        {
978            meminfo->read_mem      = (state->m_flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
979        }
980        else
981        {
982            meminfo->read_mem      = (state->m_flags & VAR_ROMSWITCH) ? 0x006000 : 0x002000;
983            meminfo->read_mem      |= APPLE2_MEM_ROM;
984        }
985
986        if (state->m_flags & VAR_LCWRITE)
987        {
988            meminfo->write_mem      = (state->m_flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
989        }
990        else
991        {
992            meminfo->write_mem      = APPLE2_MEM_FLOATING;
993        }
994    }
995    else
996    {
997        meminfo->read_handler = apple2_inh_e000_r;
998        meminfo->write_handler = apple2_inh_e000_w;
999    }
9211000}
9221001
9231002
r15018r15019
16861765void apple2_init_common(running_machine &machine)
16871766{
16881767   apple2_state *state = machine.driver_data<apple2_state>();
1689   state->m_flags = 0;
1768    state->m_inh_slot = INH_SLOT_INVALID;
1769    state->m_flags = 0;
16901770   state->m_fdc_diskreg = 0;
16911771
16921772   AY3600_init(machine);
src/mess/includes/apple2.h
r15018r15019
105105   const apple2_memmap_entry *memmap;
106106};
107107
108
109108class apple2_state : public driver_device
110109{
111110public:
r15018r15019
152151   UINT16 *m_hires_artifact_map;
153152   UINT16 *m_dhires_artifact_map;
154153    bool m_monochrome_dhr;
154    int m_inh_slot;
155155
156156    READ8_MEMBER ( apple2_c00x_r );
157157    READ8_MEMBER ( apple2_c01x_r );
src/mess/drivers/apple2gs.c
r15018r15019
199199    device_set_input_line(a2->m_maincpu, INPUT_LINE_NMI, data);
200200}
201201
202static WRITE8_DEVICE_HANDLER(a2bus_inh_w)
203{
204    apple2_state *a2 = device->machine().driver_data<apple2_state>();
205
206    a2->m_inh_slot = data;
207    apple2_update_memory(device->machine());
208}
209
202210static const struct a2bus_interface a2bus_intf =
203211{
204   // interrupt lines
205  DEVCB_HANDLER(a2bus_irq_w),
206  DEVCB_HANDLER(a2bus_nmi_w)
212    // interrupt lines
213    DEVCB_HANDLER(a2bus_irq_w),
214    DEVCB_HANDLER(a2bus_nmi_w),
215    DEVCB_HANDLER(a2bus_inh_w)
207216};
208217
209218static SLOT_INTERFACE_START(apple2_cards)
src/mess/drivers/apple2.c
r15018r15019
203203#include "machine/a2softcard.h"
204204#include "machine/a2videoterm.h"
205205#include "machine/a2ssc.h"
206#include "machine/a2swyft.h"
206207
207208/***************************************************************************
208209    PARAMETERS
r15018r15019
215216#define PADDLE_SENSITIVITY      10
216217#define PADDLE_AUTOCENTER       0
217218
218WRITE8_DEVICE_HANDLER(a2bus_irq_w)
219static WRITE8_DEVICE_HANDLER(a2bus_irq_w)
219220{
220221    apple2_state *a2 = device->machine().driver_data<apple2_state>();
221222
222223    device_set_input_line(a2->m_maincpu, M6502_IRQ_LINE, data);
223224}
224225
225WRITE8_DEVICE_HANDLER(a2bus_nmi_w)
226static WRITE8_DEVICE_HANDLER(a2bus_nmi_w)
226227{
227228    apple2_state *a2 = device->machine().driver_data<apple2_state>();
228229
229230    device_set_input_line(a2->m_maincpu, INPUT_LINE_NMI, data);
230231}
231232
233static WRITE8_DEVICE_HANDLER(a2bus_inh_w)
234{
235    apple2_state *a2 = device->machine().driver_data<apple2_state>();
236
237    a2->m_inh_slot = data;
238    apple2_update_memory(device->machine());
239}
240
232241/***************************************************************************
233242    ADDRESS MAP
234243***************************************************************************/
r15018r15019
582591{
583592   // interrupt lines
584593   DEVCB_HANDLER(a2bus_irq_w),
585   DEVCB_HANDLER(a2bus_nmi_w)
594   DEVCB_HANDLER(a2bus_nmi_w),
595    DEVCB_HANDLER(a2bus_inh_w)
586596};
587597
588598static SLOT_INTERFACE_START(apple2_slot0_cards)
r15018r15019
601611    SLOT_INTERFACE("softcard", A2BUS_SOFTCARD)  /* Microsoft SoftCard */
602612    SLOT_INTERFACE("videoterm", A2BUS_VIDEOTERM)    /* Videx VideoTerm */
603613    SLOT_INTERFACE("ssc", A2BUS_SSC)    /* Apple Super Serial Card */
614    SLOT_INTERFACE("swyft", A2BUS_SWYFT)    /* IAI SwyftCard */
604615//    SLOT_INTERFACE("scsi", A2BUS_SCSI)  /* Apple II SCSI Card */
605616SLOT_INTERFACE_END
606617
src/mess/mess.mak
r15018r15019
651651   $(MESS_MACHINE)/a2softcard.o \
652652   $(MESS_MACHINE)/a2videoterm.o \
653653    $(MESS_MACHINE)/a2ssc.o \
654    $(MESS_MACHINE)/a2swyft.o \
654655   $(MESS_MACHINE)/lisa.o      \
655656   $(MESS_DRIVERS)/lisa.o      \
656657   $(MESS_MACHINE)/nubus.o     \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team