Previous 199869 Revisions Next

r33385 Saturday 15th November, 2014 at 12:11:20 UTC by Barry Rodewald
ngen: added basic display, and other little bits of WIP.
[src/mess/drivers]ngen.c

trunk/src/mess/drivers/ngen.c
r241896r241897
1414#include "machine/am9517a.h"
1515#include "machine/pic8259.h"
1616#include "machine/pit8253.h"
17#include "machine/z80dart.h"
1718
1819class ngen_state : public driver_device
1920{
r241896r241897
2324      m_maincpu(*this,"maincpu"),
2425      m_crtc(*this,"crtc"),
2526      m_viduart(*this,"videouart"),
27      m_iouart(*this,"iouart"),
2628      m_dmac(*this,"dmac"),
2729      m_pic(*this,"pic"),
28      m_pit(*this,"pit")
30      m_pit(*this,"pit"),
31      m_vram(*this,"vram"),
32      m_fontram(*this,"fontram")
2933   {}
3034
3135   DECLARE_WRITE_LINE_MEMBER(pit_out0_w);
r241896r241897
4347   required_device<cpu_device> m_maincpu;
4448   required_device<mc6845_device> m_crtc;
4549   required_device<i8251_device> m_viduart;
50   required_device<upd7201_device> m_iouart;
4651   required_device<am9517a_device> m_dmac;
4752   required_device<pic8259_device> m_pic;
4853   required_device<pit8254_device> m_pit;
54   required_shared_ptr<UINT16> m_vram;
55   required_shared_ptr<UINT16> m_fontram;
4956
5057   UINT16 m_peripheral;
5158   UINT16 m_upper;
5259   UINT16 m_middle;
5360   UINT16 m_port00;
61   UINT16 m_periph141;
5462};
5563
5664WRITE_LINE_MEMBER(ngen_state::pit_out0_w)
5765{
58   m_pic->ir0_w(state);
66   //m_pic->ir0_w(state);
67   logerror("80186 Timer 1 state %i\n",state);
5968}
6069
6170WRITE_LINE_MEMBER(ngen_state::pit_out1_w)
6271{
72   logerror("PIT Timer 1 state %i\n",state);
6373}
6474
6575WRITE_LINE_MEMBER(ngen_state::pit_out2_w)
6676{
77   logerror("PIT Timer 2 state %i\n",state);
6778}
6879
6980WRITE16_MEMBER(ngen_state::cpu_peripheral_cb)
r241896r241897
97108}
98109
99110// 80186 peripheral space
111// Largely guesswork at this stage
100112WRITE16_MEMBER(ngen_state::peripheral_w)
101113{
102114   switch(offset)
103115   {
116   case 0x141:
117      // bit 1 enables speaker?
118      COMBINE_DATA(&m_periph141);
119      break;
104120   case 0x144:
105121      if(mem_mask & 0x00ff)
106122         m_crtc->address_w(space,0,data & 0xff);
r241896r241897
111127      break;
112128   case 0x146:
113129      if(mem_mask & 0x00ff)
114         m_pic->write(space,0,data & 0xff);
130         m_iouart->ba_cd_w(space,0,data & 0xff);
131      logerror("Video write offset 0x146 data %04x mask %04x\n",data,mem_mask);
115132      break;
116133   case 0x147:
117134      if(mem_mask & 0x00ff)
118         m_pic->write(space,1,data & 0xff);
135         m_iouart->ba_cd_w(space,1,data & 0xff);
136      logerror("Video write offset 0x147 data %04x mask %04x\n",data,mem_mask);
119137      break;
138   default:
139      logerror("(PC=%06x) Unknown 80186 peripheral write offset %04x data %04x mask %04x\n",m_maincpu->device_t::safe_pc(),offset,data,mem_mask);
120140   }
121   logerror("Peripheral write offset %04x data %04x mask %04x\n",offset,data,mem_mask);
122141}
123142
124143READ16_MEMBER(ngen_state::peripheral_r)
125144{
126   UINT16 ret = 0xff;
145   UINT16 ret = 0xffff;
127146   switch(offset)
128147   {
148   case 0x141:
149      ret = m_periph141;
150      break;
129151   case 0x144:
130152      if(mem_mask & 0x00ff)
131153         ret = m_crtc->status_r(space,0);
r241896r241897
136158      break;
137159   case 0x146:
138160      if(mem_mask & 0x00ff)
139         ret = m_pic->read(space,0);
161         ret = m_iouart->ba_cd_r(space,0);
140162      break;
141   case 0x147:
163   case 0x147:  // definitely video related, likely UART sending data to the video board
142164      if(mem_mask & 0x00ff)
143         ret = m_pic->read(space,1);
165         ret = m_iouart->ba_cd_r(space,1);
166      // expects bit 0 to be set (Video ready signal?)
167      ret |= 1;
144168      break;
169   default:
170      logerror("(PC=%06x) Unknown 80186 peripheral read offset %04x mask %04x returning %04x\n",m_maincpu->device_t::safe_pc(),offset,mem_mask,ret);
145171   }
146   logerror("Peripheral read offset %04x mask %04x\n",offset,mem_mask);
147172   return ret;
148173}
149174
r241896r241897
165190
166191MC6845_UPDATE_ROW( ngen_state::crtc_update_row )
167192{
193   UINT16 addr = ma;
194
195   for(int x=0;x<bitmap.width();x+=9)
196   {
197      UINT8 ch = m_vram[addr++];
198      for(int z=0;z<9;z++)
199      {
200         if(BIT(m_fontram[ch*16+ra],8-z))
201            bitmap.pix32(y,x+z) = rgb_t(0,0xff,0);
202         else
203            bitmap.pix32(y,x+z) = rgb_t(0,0,0);
204      }
205   }
168206}
169207
170208static ADDRESS_MAP_START( ngen_mem, AS_PROGRAM, 16, ngen_state )
171   AM_RANGE(0x00000, 0xfdfff) AM_RAM
209   AM_RANGE(0x00000, 0xf7fff) AM_RAM
210   AM_RANGE(0xf8000, 0xf9fff) AM_RAM AM_SHARE("vram")
211   AM_RANGE(0xfa000, 0xfbfff) AM_RAM AM_SHARE("fontram")
172212   AM_RANGE(0xfe000, 0xfffff) AM_ROM AM_REGION("bios",0)
173213ADDRESS_MAP_END
174214
r241896r241897
215255
216256   MCFG_DEVICE_ADD("dmac", AM9517A, XTAL_14_7456MHz / 3)  // NEC D8237A, divisor unknown
217257
258   // I/O board
259   MCFG_UPD7201_ADD("iouart",XTAL_14_7456MHz / 3, 0,0,0,0) // no clock visible on I/O board, guessing for now
260
218261   // video board
219262   MCFG_SCREEN_ADD("screen", RASTER)
220263   MCFG_SCREEN_SIZE(720,348)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team