Previous 15994 Revisions Next

r13191 Tuesday 8th November, 2011 at 18:29:41 UTC by Angelo Salese
[MBC200]: Programming while being damn tired is never good ...
[src/mess/drivers]mbc200.c

src/mess/drivers/mbc200.c
r13190r13191
1717      TODO:
1818      - Master-Slave hand-shaking thru PPI8255 doesn't work properly
1919        (checks if bit 7 is high on master side, you appaently can't do
20         that with current core(s))
20         that with current core(s)), kludged to work for now.
2121
2222        31/10/2011 Skeleton driver.
2323
r13190r13191
4040      : driver_device(mconfig, type, tag),
4141      m_6845(*this, "crtc"),
4242      m_fdc(*this, "fdc"),
43      m_ppi(*this, "ppi8255_2"),
4344      m_floppy0(*this, FLOPPY_0),
4445      m_floppy1(*this, FLOPPY_1)
4546   { }
r13190r13191
4849
4950   required_device<mc6845_device> m_6845;
5051   required_device<device_t> m_fdc;
52   required_device<i8255_device> m_ppi;
5153   required_device<device_t> m_floppy0;
5254   required_device<device_t> m_floppy1;
5355
5456   DECLARE_READ8_MEMBER(from_master_r);
5557   DECLARE_WRITE8_MEMBER(porta_w);
58   DECLARE_READ8_MEMBER(ppi_hs_r);
5659
57   UINT8 m_hs;
60   UINT8 m_hs_bit;
61   UINT8 m_comm_latch;
5862   UINT8 *m_vram;
5963
6064};
r13190r13191
6670   AM_RANGE( 0x1000, 0xffff ) AM_RAM
6771ADDRESS_MAP_END
6872
73READ8_MEMBER( mbc200_state::ppi_hs_r )
74{
75   return (m_ppi->read(space, 2) & 0x7f) | m_hs_bit;
76}
77
6978static ADDRESS_MAP_START( mbc200_io , AS_IO, 8, mbc200_state)
7079   ADDRESS_MAP_UNMAP_HIGH
7180   ADDRESS_MAP_GLOBAL_MASK(0xff)
7281   AM_RANGE(0xe0, 0xe0) AM_DEVREADWRITE("i8251_1", i8251_device, data_r, data_w)
7382   AM_RANGE(0xe1, 0xe1) AM_DEVREADWRITE("i8251_1", i8251_device, status_r, control_w)
7483   AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE_LEGACY("fdc", wd17xx_r, wd17xx_w)
84   AM_RANGE(0xea, 0xea) AM_READ(ppi_hs_r)
7585   AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write)
7686   AM_RANGE(0xec, 0xec) AM_DEVREADWRITE("i8251_2", i8251_device, data_r, data_w)
7787   AM_RANGE(0xed, 0xed) AM_DEVREADWRITE("i8251_2", i8251_device, status_r, control_w)
r13190r13191
90100{
91101   UINT8 tmp;
92102   machine().scheduler().synchronize(); // force resync
93   tmp = m_hs;
94   m_hs = 0;
103   tmp = m_comm_latch;
104   m_comm_latch = 0;
105   m_hs_bit |= 0x80;
95106   return tmp;
96107}
97108
r13190r13191
101112   AM_RANGE(0x70, 0x73) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
102113   AM_RANGE(0xb0, 0xb0) AM_DEVWRITE("crtc", mc6845_device, address_w)
103114   AM_RANGE(0xb1, 0xb1) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
104//   AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("ppi8255_3", i8255_device, read, write)
115//   AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write)
105116   AM_RANGE(0xd0, 0xd0) AM_READ(from_master_r)
106117ADDRESS_MAP_END
107118
r13190r13191
140151
141152static SCREEN_UPDATE( mbc200 )
142153{
143   /* TODO: video emulation is annoyingly twiddled ... */
154   mbc200_state *state = screen->machine().driver_data<mbc200_state>();
155   int x,y,xi,yi;
156   int count;
157
158   count = 0;
159
160   for(y=0;y<100;y++)
161   {
162      for(x=0;x<80;x++)
163      {
164         for(yi=0;yi<4;yi++)
165         {
166            for(xi=0;xi<8;xi++)
167            {
168               UINT8 dot;
169               dot = (state->m_vram[count] >> (7-xi)) & 1;
170
171               if(y*4+yi < 400 && x*8+xi < 640) /* TODO: safety check */
172                  *BITMAP_ADDR16(bitmap, y*4+yi, x*8+xi) = screen->machine().pens[dot];
173            }
174
175            count++;
176         }
177      }
178   }
179
144180   return 0;
145181}
146182
r13190r13191
159195{
160196   machine().scheduler().synchronize(); // force resync
161197   printf("A %02x %c\n",data,data);
162   m_hs = data; // to slave CPU
198   m_comm_latch = data; // to slave CPU
199   m_hs_bit &= ~0x80;
163200}
164201
165202static I8255_INTERFACE( mbc200_ppi8255_interface_2 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team