Previous 199869 Revisions Next

r18968 Thursday 15th November, 2012 at 01:47:06 UTC by Angelo Salese
Fixed pit8253 hook-up, according to another document ...
[src/mess/drivers]apc.c

trunk/src/mess/drivers/apc.c
r18967r18968
1515   i/o memory map:
1616   0x00 - 0x1f DMA
1717   0x20 - 0x23 i8259 master
18   0x28 - 0x2b i8259 slave
19   0x2b / 0x2f / 0x61 / 0x6f pit8253 (!)
18   0x28 - 0x2f i8259 slave (even), pit8253 (odd)
2019   0x30 - 0x37 serial i8251, even #1 / odd #2
2120   0x38 - 0x3f DMA segments
2221   0x40 - 0x43 upd7220, even chr / odd bitmap
r18967r18968
2524   0x58        rtc
2625   0x5a - 0x5e APU
2726   0x60        MPU (melody)
27   0x61 - 0x67 (Mirror of pit8253?)
2828   0x68 - 0x6f parallel port
2929
3030***************************************************************************/
r18967r18968
6868
6969   DECLARE_READ8_MEMBER(apc_port_28_r);
7070   DECLARE_WRITE8_MEMBER(apc_port_28_w);
71   DECLARE_WRITE8_MEMBER(apc_port_2e_w);
7271   DECLARE_READ8_MEMBER(apc_port_60_r);
7372   DECLARE_WRITE8_MEMBER(apc_port_60_w);
7473   DECLARE_READ8_MEMBER(apc_gdc_r);
r18967r18968
135134   UINT8 res;
136135
137136   if(offset & 1)
137      res = pit8253_r(machine().device("pit8253"), space, (offset & 6) >> 1);
138   else
138139   {
139      if(offset == 3)
140         res = pit8253_r(machine().device("pit8253"), space, 0);
141      else
140      if(offset & 4)
142141      {
143         printf("Read undefined port 0x29\n");
142         printf("Read undefined port %02x\n",offset+0x28);
144143         res = 0xff;
145144      }
145      else
146         res = pic8259_r(machine().device("pic8259_slave"), space, (offset & 2) >> 1);
146147   }
147   else
148   {
149      res = pic8259_r(machine().device("pic8259_slave"), space, (offset & 2) >> 1);
150   }
151148
152149   return res;
153150}
r18967r18968
155152WRITE8_MEMBER(apc_state::apc_port_28_w)
156153{
157154   if(offset & 1)
155      pit8253_w(machine().device("pit8253"), space, (offset & 6) >> 1, data);
156   else
158157   {
159      if(offset == 3)
160         pit8253_w(machine().device("pit8253"), space, 0, data);
158      if(offset & 4)
159         printf("Write undefined port %02x\n",offset+0x28);
161160      else
162      {
163         printf("Write undefined port 0x29\n");
164      }
161         pic8259_w(machine().device("pic8259_slave"), space, (offset & 2) >> 1, data);
165162   }
166   else
167   {
168      pic8259_w(machine().device("pic8259_slave"), space, (offset & 2) >> 1, data);
169   }
170163}
171164
172WRITE8_MEMBER(apc_state::apc_port_2e_w)
173{
174   pit8253_w(machine().device("pit8253"), space, 1, data);
175}
176165
177
178166READ8_MEMBER(apc_state::apc_port_60_r)
179167{
180168   UINT8 res;
181169
182170   if(offset & 1)
183171   {
184      if(offset == 1)
185         res = pit8253_r(machine().device("pit8253"), space, 2);
186      else
187      {
188         printf("Read undefined port %02x\n",offset+0x60);
189         res = 0xff;
190      }
172      printf("Read undefined port %02x\n",offset+0x60);
173      res = 0xff;
191174   }
192175   else
193176   {
r18967r18968
202185{
203186   if(offset & 1)
204187   {
205      if(offset == 1)
206         pit8253_w(machine().device("pit8253"), space, 2, data);
207      else if(offset == 7)
208         pit8253_w(machine().device("pit8253"), space, 3, data);
209      else
210      {
211         printf("Write undefined port %02x\n",offset+0x60);
212      }
188      printf("Write undefined port %02x\n",offset+0x60);
213189   }
214190   else
215191   {
r18967r18968
260236//  ADDRESS_MAP_GLOBAL_MASK(0xff)
261237   AM_RANGE(0x00, 0x1f) AM_READWRITE8(apc_dma_r, apc_dma_w, 0x00ff)
262238   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff) // i8259
263   AM_RANGE(0x28, 0x2b) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff)
264   AM_RANGE(0x2e, 0x2f) AM_WRITE8(apc_port_2e_w, 0x00ff)
265//   0x2b RTC counter port 0
266//   0x2f RTC counter mode 0 (w)
239   AM_RANGE(0x28, 0x2f) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff)
267240//   0x30, 0x37 serial port 0/1 (i8251) (even/odd)
268241//   0x38, 0x3f DMA extended address
269242   AM_RANGE(0x40, 0x43) AM_READWRITE8(apc_gdc_r, apc_gdc_w, 0xffff)
r18967r18968
274247//   0x5e  APU status/command
275248   AM_RANGE(0x60, 0x67) AM_READWRITE8(apc_port_60_r, apc_port_60_w, 0xffff)
276249//   0x60 Melody Processing Unit
277//   0x61 RTC counter port 1
278//   0x67 RTC counter mode 1 (w)
279250//   AM_RANGE(0x68, 0x6f) i8255 , printer port (A: status (R) B: data (W) C: command (W))
280251//   AM_DEVREADWRITE8("upd7220_btm", upd7220_device, read, write, 0x00ff)
281252ADDRESS_MAP_END

Previous 199869 Revisions Next


© 1997-2024 The MAME Team