Previous 15994 Revisions Next

r15101 Sunday 6th May, 2012 at 21:03:21 UTC by R. Belmont
Rainbow: initial Z80/8088 comms work, ends with Error 10 now instead of 18 [R. Belmont]
[src/mess/drivers]rainbow.c

src/mess/drivers/rainbow.c
r15100r15101
2424        m_i8088(*this, "maincpu"),
2525        m_z80(*this, "subcpu"),
2626        m_fdc(*this, "wd1793"),
27      m_p_ram(*this, "p_ram"){ }
27      m_p_ram(*this, "p_ram"),
28        m_shared(*this, "sh_ram")
29    { }
2830
2931   required_device<device_t> m_crtc;
3032    required_device<device_t> m_i8088;
3133    required_device<device_t> m_z80;
3234    required_device<device_t> m_fdc;
3335   required_shared_ptr<UINT8> m_p_ram;
36   required_shared_ptr<UINT8> m_shared;
3437   UINT8 m_diagnostic;
3538
3639    virtual void machine_start();
r15100r15101
4144   DECLARE_READ8_MEMBER(diagnostic_r);
4245   DECLARE_WRITE8_MEMBER(diagnostic_w);
4346
44   DECLARE_READ8_MEMBER(share_8088_r);
45   DECLARE_WRITE8_MEMBER(share_8088_w);
4647   DECLARE_READ8_MEMBER(share_z80_r);
4748   DECLARE_WRITE8_MEMBER(share_z80_w);
4849
r15100r15101
5758    bool m_zflip;                   // Z80 alternate memory map with A15 inverted
5859
5960private:
60    UINT8 m_shared[64*1024];        // 62k of shared RAM (to make the code simpler, we have 64k and ignore the lower 2k)
6161    UINT8 m_z80_private[0x800];     // Z80 private 2K
62    UINT8 m_8088_private[0x800];    // 8088 private 2K
6362    UINT8 m_z80_mailbox, m_8088_mailbox;
6463};
6564
6665void rainbow_state::machine_start()
6766{
68    save_item(NAME(m_shared));
6967    save_item(NAME(m_z80_private));
70    save_item(NAME(m_8088_private));
7168    save_item(NAME(m_z80_mailbox));
7269    save_item(NAME(m_8088_mailbox));
7370    save_item(NAME(m_zflip));
r15100r15101
7572
7673static ADDRESS_MAP_START( rainbow8088_map, AS_PROGRAM, 8, rainbow_state)
7774   ADDRESS_MAP_UNMAP_HIGH
78    AM_RANGE(0x00000, 0x0ffff) AM_READWRITE(share_8088_r, share_8088_w)
75    AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_SHARE("sh_ram")
7976   AM_RANGE(0x10000, 0x1ffff) AM_RAM
8077   AM_RANGE(0xec000, 0xedfff) AM_RAM
8178   AM_RANGE(0xee000, 0xeffff) AM_RAM AM_SHARE("p_ram")
r15100r15101
153150            return m_z80_private[offset];
154151        }
155152
156        return m_shared[offset-0x800];
153        return m_shared[offset];
157154    }
158155
159156    return 0xff;
r15100r15101
182179        }
183180        else
184181        {
185            m_shared[offset-0x800] = data;
182            m_shared[offset] = data;
186183        }
187184    }
188185}
189186
190READ8_MEMBER(rainbow_state::share_8088_r)
191{
192    if (offset < 0x800)
193    {
194        return m_8088_private[offset];
195    }
196
197    return m_shared[offset];
198}
199
200WRITE8_MEMBER(rainbow_state::share_8088_w)
201{
202    if (offset < 0x800)
203    {
204        m_8088_private[offset] = data;
205    }
206    else
207    {
208        m_shared[offset] = data;
209    }
210}
211
212187READ8_MEMBER(rainbow_state::i8088_latch_r)
213188{
189//    printf("Read %02x from 8088 mailbox\n", m_8088_mailbox);
214190    // todo: this should clear IRQ 27 vector 0x9c on the i8088
215191    return m_8088_mailbox;
216192}
217193
218194WRITE8_MEMBER(rainbow_state::i8088_latch_w)
219195{
196//    printf("%02x to Z80 mailbox\n", data);
220197    device_set_input_line_and_vector(m_z80, 0, ASSERT_LINE, 0xf7);
221198    m_z80_mailbox = data;
222199}
223200
224201READ8_MEMBER(rainbow_state::z80_latch_r)
225202{
203//    printf("Read %02x from Z80 mailbox\n", m_z80_mailbox);
226204    device_set_input_line(m_z80, 0, CLEAR_LINE);
227205    return m_z80_mailbox;
228206}
229207
230208WRITE8_MEMBER(rainbow_state::z80_latch_w)
231209{
210//    printf("%02x to 8088 mailbox\n", data);
232211    // todo: this should assert IRQ 27 vector 0x9c on the i8088
233212    m_8088_mailbox = data;
234213}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team