Previous 15994 Revisions Next

r14909 Saturday 14th April, 2012 at 03:42:00 UTC by R. Belmont
Apple II: Added Microsoft SoftCard. Works only on apple2 and apple2p for now, and only with Microsoft's CP/M boot disks. [R. Belmont]
[src/mess/drivers]apple2.c
[src/mess/machine]a2softcard.c* a2softcard.h*

src/mess/machine/a2softcard.c
r0r14909
1/*********************************************************************
2
3    a2softcard.c
4
5    Implementation of the Microsoft SoftCard Z-80 card
6
7*********************************************************************/
8
9#include "a2softcard.h"
10#include "includes/apple2.h"
11#include "cpu/z80/z80.h"
12
13/***************************************************************************
14    PARAMETERS
15***************************************************************************/
16
17//**************************************************************************
18//  GLOBAL VARIABLES
19//**************************************************************************
20
21const device_type A2BUS_SOFTCARD = &device_creator<a2bus_softcard_device>;
22
23#define Z80_TAG         "z80"
24
25static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, a2bus_softcard_device )
26   AM_RANGE(0x0000, 0xffff) AM_READWRITE(dma_r, dma_w)
27ADDRESS_MAP_END
28
29MACHINE_CONFIG_FRAGMENT( a2softcard )
30   MCFG_CPU_ADD(Z80_TAG, Z80, 1021800*2)   // Z80 runs on double the Apple II's clock
31   MCFG_CPU_PROGRAM_MAP(z80_mem)
32MACHINE_CONFIG_END
33
34/***************************************************************************
35    FUNCTION PROTOTYPES
36***************************************************************************/
37
38//-------------------------------------------------
39//  machine_config_additions - device-specific
40//  machine configurations
41//-------------------------------------------------
42
43machine_config_constructor a2bus_softcard_device::device_mconfig_additions() const
44{
45   return MACHINE_CONFIG_NAME( a2softcard );
46}
47
48//**************************************************************************
49//  LIVE DEVICE
50//**************************************************************************
51
52a2bus_softcard_device::a2bus_softcard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
53    device_t(mconfig, type, name, tag, owner, clock),
54    device_a2bus_card_interface(mconfig, *this),
55    m_z80(*this, Z80_TAG),
56    m_6502space(NULL)
57{
58   m_shortname = "a2softcard";
59}
60
61a2bus_softcard_device::a2bus_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
62    device_t(mconfig, A2BUS_SOFTCARD, "Microsoft SoftCard", tag, owner, clock),
63    device_a2bus_card_interface(mconfig, *this),
64    m_z80(*this, Z80_TAG),
65    m_6502space(NULL)
66{
67   m_shortname = "a2softcard";
68}
69
70//-------------------------------------------------
71//  device_start - device-specific startup
72//-------------------------------------------------
73
74void a2bus_softcard_device::device_start()
75{
76   // set_a2bus_device makes m_slot valid
77   set_a2bus_device();
78}
79
80void a2bus_softcard_device::device_reset()
81{
82    m_bEnabled = false;
83    m_6502space = NULL;
84    m_FirstZ80Boot = true;
85    device_set_input_line(m_z80, INPUT_LINE_HALT, ASSERT_LINE);
86}
87
88void a2bus_softcard_device::write_cnxx(address_space &space, UINT8 offset, UINT8 data)
89{
90   apple2_state *state = machine().driver_data<apple2_state>();
91
92    if (!m_bEnabled)
93    {
94        // steal the 6502's address space
95        m_6502space = &space;
96
97        device_set_input_line(m_z80, INPUT_LINE_HALT, CLEAR_LINE);
98        device_set_input_line(state->m_maincpu, INPUT_LINE_HALT, ASSERT_LINE);
99
100        if (m_FirstZ80Boot)
101        {
102            m_FirstZ80Boot = false;
103            device_set_input_line(m_z80, INPUT_LINE_RESET, ASSERT_LINE);
104            device_set_input_line(m_z80, INPUT_LINE_RESET, CLEAR_LINE);
105            m_z80->set_state(Z80_PC, 0);
106        }
107
108        m_bEnabled = true;
109    }
110    else
111    {
112        device_set_input_line(m_z80, INPUT_LINE_HALT, ASSERT_LINE);
113        device_set_input_line(state->m_maincpu, INPUT_LINE_HALT, CLEAR_LINE);
114        m_bEnabled = false;
115    }
116}
117
118READ8_MEMBER( a2bus_softcard_device::dma_r )
119{
120    if (m_6502space)
121    {
122        if (offset <= 0xafff)
123        {
124            return m_6502space->read_byte(offset+0x1000);
125        }
126        else if (offset <= 0xbfff)  // LC bank 2 d000-dfff
127        {
128            return m_6502space->read_byte((offset&0xfff) + 0xd000);
129        }
130        else if (offset <= 0xcfff)  // LC e000-efff
131        {
132            return m_6502space->read_byte((offset&0xfff) + 0xe000);
133        }
134        else if (offset <= 0xdfff)  // LC f000-ffff (or ROM?)
135        {
136            return m_6502space->read_byte((offset&0xfff) + 0xf000);
137        }
138        else if (offset <= 0xefff)  // I/O space c000-cfff
139        {
140            return m_6502space->read_byte((offset&0xfff) + 0xc000);
141        }
142        else    // zero page
143        {
144            return m_6502space->read_byte(offset&0xfff);
145        }
146    }
147
148    return 0xff;
149}
150
151
152//-------------------------------------------------
153//  dma_w -
154//-------------------------------------------------
155
156WRITE8_MEMBER( a2bus_softcard_device::dma_w )
157{
158    if (m_6502space)
159    {
160        if (offset <= 0xafff)
161        {
162            m_6502space->write_byte(offset+0x1000, data);
163        }
164        else if (offset <= 0xbfff)  // LC bank 2 d000-dfff
165        {
166            m_6502space->write_byte((offset&0xfff) + 0xd000, data);
167        }
168        else if (offset <= 0xcfff)  // LC e000-efff
169        {
170            m_6502space->write_byte((offset&0xfff) + 0xe000, data);
171        }
172        else if (offset <= 0xdfff)  // LC f000-ffff (or ROM?)
173        {
174            m_6502space->write_byte((offset&0xfff) + 0xf000, data);
175        }
176        else if (offset <= 0xefff)  // I/O space c000-cfff
177        {
178            m_6502space->write_byte((offset&0xfff) + 0xc000, data);
179        }
180        else    // zero page
181        {
182            m_6502space->write_byte(offset&0xfff, data);
183        }
184    }
185}
186
src/mess/machine/a2softcard.h
r0r14909
1/*********************************************************************
2
3    a2softcard.h
4
5    Implementation of the Apple II Memory Expansion Card
6
7*********************************************************************/
8
9#ifndef __A2BUS_SOFTCARD__
10#define __A2BUS_SOFTCARD__
11
12#include "emu.h"
13#include "machine/a2bus.h"
14
15//**************************************************************************
16//  TYPE DEFINITIONS
17//**************************************************************************
18
19class a2bus_softcard_device:
20    public device_t,
21    public device_a2bus_card_interface
22{
23public:
24    // construction/destruction
25    a2bus_softcard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
26    a2bus_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
27
28    // optional information overrides
29    virtual machine_config_constructor device_mconfig_additions() const;
30
31   DECLARE_READ8_MEMBER( dma_r );
32   DECLARE_WRITE8_MEMBER( dma_w );
33
34protected:
35    virtual void device_start();
36    virtual void device_reset();
37
38    // overrides of standard a2bus slot functions
39    virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data);
40
41   required_device<cpu_device> m_z80;
42
43private:
44    bool m_bEnabled;
45    bool m_FirstZ80Boot;
46    address_space *m_6502space;
47};
48
49// device type definition
50extern const device_type A2BUS_SOFTCARD;
51
52#endif /* __A2BUS_SOFTCARD__ */
53
src/mess/drivers/apple2.c
r14908r14909
200200#include "machine/a2memexp.h"
201201#include "machine/a2scsi.h"
202202#include "machine/a2thunderclock.h"
203#include "machine/a2softcard.h"
203204
204205/***************************************************************************
205206    PARAMETERS
r14908r14909
594595    SLOT_INTERFACE("memexp", A2BUS_MEMEXP)  /* Apple II Memory Expansion Card */
595596    SLOT_INTERFACE("ramfactor", A2BUS_RAMFACTOR)    /* Applied Engineering RamFactor */
596597    SLOT_INTERFACE("thclock", A2BUS_THUNDERCLOCK)    /* ThunderWare ThunderClock Plus */
598    SLOT_INTERFACE("softcard", A2BUS_SOFTCARD)  /* Microsoft SoftCard */
597599//    SLOT_INTERFACE("scsi", A2BUS_SCSI)  /* Apple II SCSI Card */
598600SLOT_INTERFACE_END
599601

Previous 15994 Revisions Next


© 1998-2018 The MESS Team