Previous 199869 Revisions Next

r36316 Sunday 8th March, 2015 at 11:56:50 UTC by David Haywood
few bits of v53 stuff, start dynamic peripheral mapping, attempts to set up timers at least (nw)
[src/emu/cpu/nec]v53.c v53.h
[src/mame/audio]hng64.c

trunk/src/emu/cpu/nec/v53.c
r244827r244828
7979WRITE8_MEMBER(v53_base_device::SULA_w)
8080{
8181   printf("v53: SULA_w %02x\n", data);
82   m_SULA = data;
83   install_peripheral_io();
8284}
8385
8486WRITE8_MEMBER(v53_base_device::TULA_w)
8587{
8688   printf("v53: TULA_w %02x\n", data);
89   m_TULA = data;
90   install_peripheral_io();
8791}
8892
8993WRITE8_MEMBER(v53_base_device::IULA_w)
9094{
9195   printf("v53: IULA_w %02x\n", data);
96   m_IULA = data;
97   install_peripheral_io();
9298}
9399
94100WRITE8_MEMBER(v53_base_device::DULA_w)
95101{
96102   printf("v53: DULA_w %02x\n", data);
103   m_DULA = data;
104   install_peripheral_io();
97105}
98106
99107WRITE8_MEMBER(v53_base_device::OPHA_w)
100108{
101109   printf("v53: OPHA_w %02x\n", data);
110   m_OPHA = data;
111   install_peripheral_io();
102112}
103113
104114WRITE8_MEMBER(v53_base_device::OPSEL_w)
105115{
106116   printf("v53: OPSEL_w %02x\n", data);
117   m_OPSEL = data;
118   install_peripheral_io();
107119}
108120
109121WRITE8_MEMBER(v53_base_device::SCTL_w)
110122{
123   // bit 7: unused
124   // bit 6: unused
125   // bit 5: unused
126   // bit 4: SCU input clock source
127   // bit 3: uPD71037 DMA mode - Carry A20
128   // bit 2: uPD71037 DMA mode - Carry A16
129   // bit 1: uPD71037 DMA mode enable (otherwise in uPD71071 mode)
130   // bit 0: Onboard pripheral I/O maps to 8-bit boundaries? (otherwise 16-bit)
131
111132   printf("v53: SCTL_w %02x\n", data);
133   m_SCTL = data;
134   install_peripheral_io();
112135}
136/*
137m_WCY0 = 0x07;
138m_WCY1 = 0x77;
139m_WCY2 = 0x77;
140m_WCY3 = 0x77;
141m_WCY4 = 0x77;
142m_WMB0 = 0x77;
143m_WMB1 = 0x77;
144m_WAC =  0x00;
145m_TCKS = 0x00;
146m_RFC =  0x80;
147m_SBCR = 0x00;
148m_BRC =  0x00;
149// SCU
150m_SMD =  0x4b;
151m_SCM =  0x00;
152m_SIMK = 0x03;
153m_SST = 0x04;
154// DMA
155m_DCH = 0x01;
156m_DMD = 0x00;
157m_DCC = 0x0000;
158m_DST = 0x00;
159m_DMK = 0x0f;
160*/
113161
162void v53_base_device::device_reset()
163{
164   nec_common_device::device_reset();
165
166   m_SCTL = 0x00;
167   m_OPSEL= 0x00;
168
169   // peripheral addresses
170   m_SULA = 0x00;
171   m_TULA = 0x00;
172   m_IULA = 0x00;
173   m_DULA = 0x00;
174   m_OPHA = 0x00;
175
176}
177
178void v53_base_device::device_start()
179{
180   nec_common_device::device_start();
181}
182
183void v53_base_device::install_peripheral_io()
184{
185   // unmap everything in I/O space up to the fixed position registers (we avoid overwriting them, it isn't a valid config)
186   space(AS_IO).unmap_readwrite(0x0000, 0xfeff);
187
188   // IOAG determines if the handlers used 8-bit or 16-bit access
189   // the hng64.c games first set everything up in 8-bit mode, then
190   // do the procedure again in 16-bit mode before using them?!
191
192   int IOAG = m_SCTL & 1;
193
194   if (m_OPSEL & 0x01) // DMA Unit available
195   {
196      if (IOAG) // 8-bit
197      {
198
199      }
200      else
201      {
202         
203      }
204   }
205
206   if (m_OPSEL & 0x02) // Interupt Control Unit available
207   {
208      if (IOAG) // 8-bit
209      {
210
211      }
212      else
213      {
214
215      }
216   }
217
218   if (m_OPSEL & 0x04) // Timer Control Unit available
219   {
220      UINT16 base = (m_OPHA << 8) | m_TULA;
221      printf("installing TCU to %04x\n", base);
222
223      if (IOAG) // 8-bit
224      {
225
226      }
227      else
228      {
229         space(AS_IO).install_readwrite_handler(base+0x00, base+0x01, read8_delegate(FUNC(v53_base_device::tmu_tst0_r), this), write8_delegate(FUNC(v53_base_device::tmu_tct0_w), this), 0x00ff);
230         space(AS_IO).install_readwrite_handler(base+0x02, base+0x03, read8_delegate(FUNC(v53_base_device::tmu_tst1_r), this), write8_delegate(FUNC(v53_base_device::tmu_tct1_w), this), 0x00ff);
231         space(AS_IO).install_readwrite_handler(base+0x04, base+0x05, read8_delegate(FUNC(v53_base_device::tmu_tst2_r), this), write8_delegate(FUNC(v53_base_device::tmu_tct2_w), this), 0x00ff);
232         space(AS_IO).install_write_handler(base+0x06, base+0x07, write8_delegate(FUNC(v53_base_device::tmu_tmd_w), this), 0x00ff);
233      }
234   }
235
236   if (m_OPSEL & 0x08) // Serial Control Unit available
237   {
238
239      if (IOAG) // 8-bit
240      {
241
242      }
243      else
244      {
245
246      }
247   }
248
249}
250
251/*** TCU ***/
252
253READ8_MEMBER(v53_base_device::tmu_tst0_r)
254{
255   printf("v53: tmu_tst0_r\n");
256   return 0;
257}
258
259WRITE8_MEMBER(v53_base_device::tmu_tct0_w)
260{
261   printf("v53: tmu_tct0_w %02x\n", data);
262}
263
264READ8_MEMBER(v53_base_device::tmu_tst1_r)
265{
266   printf("v53: tmu_tst1_r\n");
267   return 0;
268}
269
270WRITE8_MEMBER(v53_base_device::tmu_tct1_w)
271{
272   printf("v53: tmu_tct1_w %02x\n", data);
273}
274
275READ8_MEMBER(v53_base_device::tmu_tst2_r)
276{
277   printf("v53: tmu_tst2_r\n");
278   return 0;
279}
280
281WRITE8_MEMBER(v53_base_device::tmu_tct2_w)
282{
283   printf("v53: tmu_tct2_w %02x\n", data);
284}
285
286WRITE8_MEMBER(v53_base_device::tmu_tmd_w)
287{
288   printf("v53: tmu_tmd_w %02x\n", data);
289}
290
291/* General stuff */
292
114293static ADDRESS_MAP_START( v53_internal_port_map, AS_IO, 16, v53_base_device )
115   AM_RANGE(0xffe0, 0xffe1) AM_WRITE8( BSEL_w,  0x00ff) // 0xffe0
116   AM_RANGE(0xffe0, 0xffe1) AM_WRITE8( BADR_w,  0xff00) // 0xffe1
294   AM_RANGE(0xffe0, 0xffe1) AM_WRITE8( BSEL_w,  0x00ff) // 0xffe0 // uPD71037 DMA mode bank selection register
295   AM_RANGE(0xffe0, 0xffe1) AM_WRITE8( BADR_w,  0xff00) // 0xffe1 // uPD71037 DMA mode bank register peripheral mapping (also uses OPHA)
117296//   AM_RANGE(0xffe2, 0xffe3) // (reserved     ,  0x00ff) // 0xffe2
118297//   AM_RANGE(0xffe2, 0xffe3) // (reserved     ,  0xff00) // 0xffe3
119298//   AM_RANGE(0xffe4, 0xffe5) // (reserved     ,  0x00ff) // 0xffe4
r244827r244828
121300//   AM_RANGE(0xffe6, 0xffe7) // (reserved     ,  0x00ff) // 0xffe6
122301//   AM_RANGE(0xffe6, 0xffe7) // (reserved     ,  0xff00) // 0xffe7
123302//   AM_RANGE(0xffe8, 0xffe9) // (reserved     ,  0x00ff) // 0xffe8
124   AM_RANGE(0xffe8, 0xffe9) AM_WRITE8( BRC_w ,  0xff00) // 0xffe9
125   AM_RANGE(0xffea, 0xffeb) AM_WRITE8( WMB0_w,  0x00ff) // 0xffea
126   AM_RANGE(0xffea, 0xffeb) AM_WRITE8( WCY1_w,  0xff00) // 0xffeb
127   AM_RANGE(0xffec, 0xffed) AM_WRITE8( WCY0_w,  0x00ff) // 0xffec
128   AM_RANGE(0xffec, 0xffed) AM_WRITE8( WAC_w,   0xff00) // 0xffed
303   AM_RANGE(0xffe8, 0xffe9) AM_WRITE8( BRC_w ,  0xff00) // 0xffe9 // baud rate counter (used for serial peripheral)
304   AM_RANGE(0xffea, 0xffeb) AM_WRITE8( WMB0_w,  0x00ff) // 0xffea // waitstate control
305   AM_RANGE(0xffea, 0xffeb) AM_WRITE8( WCY1_w,  0xff00) // 0xffeb // waitstate control
306   AM_RANGE(0xffec, 0xffed) AM_WRITE8( WCY0_w,  0x00ff) // 0xffec // waitstate control
307   AM_RANGE(0xffec, 0xffed) AM_WRITE8( WAC_w,   0xff00) // 0xffed // waitstate control
129308//   AM_RANGE(0xffee, 0xffef) // (reserved     ,  0x00ff) // 0xffee
130309//   AM_RANGE(0xffee, 0xffef) // (reserved     ,  0xff00) // 0xffef
131   AM_RANGE(0xfff0, 0xfff1) AM_WRITE8( TCKS_w,  0x00ff) // 0xfff0
132   AM_RANGE(0xfff0, 0xfff1) AM_WRITE8( SBCR_w,  0xff00) // 0xfff1
133   AM_RANGE(0xfff2, 0xfff3) AM_WRITE8( REFC_w,  0x00ff) // 0xfff2
134   AM_RANGE(0xfff2, 0xfff3) AM_WRITE8( WMB1_w,  0xff00) // 0xfff3
135   AM_RANGE(0xfff4, 0xfff5) AM_WRITE8( WCY2_w,  0x00ff) // 0xfff4
136   AM_RANGE(0xfff4, 0xfff5) AM_WRITE8( WCY3_w,  0xff00) // 0xfff5
137   AM_RANGE(0xfff6, 0xfff7) AM_WRITE8( WCY4_w,  0x00ff) // 0xfff6
310   AM_RANGE(0xfff0, 0xfff1) AM_WRITE8( TCKS_w,  0x00ff) // 0xfff0 // timer clocks
311   AM_RANGE(0xfff0, 0xfff1) AM_WRITE8( SBCR_w,  0xff00) // 0xfff1 // internal clock divider, halt behavior etc.
312   AM_RANGE(0xfff2, 0xfff3) AM_WRITE8( REFC_w,  0x00ff) // 0xfff2 // ram refresh control
313   AM_RANGE(0xfff2, 0xfff3) AM_WRITE8( WMB1_w,  0xff00) // 0xfff3 // waitstate control
314   AM_RANGE(0xfff4, 0xfff5) AM_WRITE8( WCY2_w,  0x00ff) // 0xfff4 // waitstate control
315   AM_RANGE(0xfff4, 0xfff5) AM_WRITE8( WCY3_w,  0xff00) // 0xfff5 // waitstate control
316   AM_RANGE(0xfff6, 0xfff7) AM_WRITE8( WCY4_w,  0x00ff) // 0xfff6 // waitstate control
138317//   AM_RANGE(0xfff6, 0xfff7) // (reserved     ,  0xff00) // 0xfff7
139   AM_RANGE(0xfff8, 0xfff9) AM_WRITE8( SULA_w,  0x00ff) // 0xfff8
140   AM_RANGE(0xfff8, 0xfff9) AM_WRITE8( TULA_w,  0xff00) // 0xfff9
141   AM_RANGE(0xfffa, 0xfffb) AM_WRITE8( IULA_w,  0x00ff) // 0xfffa
142   AM_RANGE(0xfffa, 0xfffb) AM_WRITE8( DULA_w,  0xff00) // 0xfffb
143   AM_RANGE(0xfffc, 0xfffd) AM_WRITE8( OPHA_w,  0x00ff) // 0xfffc
144   AM_RANGE(0xfffc, 0xfffd) AM_WRITE8( OPSEL_w, 0xff00) // 0xfffd
145   AM_RANGE(0xfffe, 0xffff) AM_WRITE8( SCTL_w,  0x00ff) // 0xfffe
318   AM_RANGE(0xfff8, 0xfff9) AM_WRITE8( SULA_w,  0x00ff) // 0xfff8 // peripheral mapping
319   AM_RANGE(0xfff8, 0xfff9) AM_WRITE8( TULA_w,  0xff00) // 0xfff9 // peripheral mapping
320   AM_RANGE(0xfffa, 0xfffb) AM_WRITE8( IULA_w,  0x00ff) // 0xfffa // peripheral mapping
321   AM_RANGE(0xfffa, 0xfffb) AM_WRITE8( DULA_w,  0xff00) // 0xfffb // peripheral mapping
322   AM_RANGE(0xfffc, 0xfffd) AM_WRITE8( OPHA_w,  0x00ff) // 0xfffc // peripheral mapping (upper bits, common)
323   AM_RANGE(0xfffc, 0xfffd) AM_WRITE8( OPSEL_w, 0xff00) // 0xfffd // peripheral enabling
324   AM_RANGE(0xfffe, 0xffff) AM_WRITE8( SCTL_w,  0x00ff) // 0xfffe // peripheral configuration (& byte / word mapping)
146325//   AM_RANGE(0xfffe, 0xffff) // (reserved     ,  0xff00) // 0xffff
147326ADDRESS_MAP_END
148327
trunk/src/emu/cpu/nec/v53.h
r244827r244828
3030   DECLARE_WRITE8_MEMBER(OPSEL_w);
3131   DECLARE_WRITE8_MEMBER(SCTL_w);
3232
33   UINT8 m_SCTL;
34   UINT8 m_OPSEL;
35   
36   UINT8 m_SULA;
37   UINT8 m_TULA;
38   UINT8 m_IULA;
39   UINT8 m_DULA;
40   UINT8 m_OPHA;
41
42   // TMU
43   DECLARE_READ8_MEMBER(tmu_tst0_r);
44   DECLARE_WRITE8_MEMBER(tmu_tct0_w);
45   DECLARE_READ8_MEMBER(tmu_tst1_r);
46   DECLARE_WRITE8_MEMBER(tmu_tct1_w);
47   DECLARE_READ8_MEMBER(tmu_tst2_r);
48   DECLARE_WRITE8_MEMBER(tmu_tct2_w);
49   DECLARE_WRITE8_MEMBER(tmu_tmd_w);
50
51   void install_peripheral_io();
52
3353   const address_space_config m_io_space_config;
34
54   
3555   const address_space_config *memory_space_config(address_spacenum spacenum) const
3656   {
3757      switch (spacenum)
r244827r244828
4060         default: return nec_common_device::memory_space_config(spacenum);
4161      }
4262   }
63
64protected:
65   // device-level overrides
66   virtual void device_start();
67   virtual void device_reset();
4368};
4469
4570
trunk/src/mame/audio/hng64.c
r244827r244828
1212fatfurwa  (#)SNK R&D Center (R) HYPER NEOGEO64 Sound Driver Ver 1.14. (#)Copyright (C) SNK Corp. 1997,1998 All rights reserved
1313buriki    (#)SNK R&D Center (R) HYPER NEOGEO64 Sound Driver Ver 1.15. (#)Copyright (C) SNK Corp. 1997,1998 All rights reserved
1414
15the earlier revisions appear to have 2 banks of code (there are vectors at the end of the 0x1e0000 block and the 0x1f0000 block)
15The earlier revisions appear to have 2 banks of code (there are vectors at the end of the 0x1e0000 block and the 0x1f0000 block)
1616
17Those first two revisions also spam the entire range of I/O ports with values several times on startup causing some unexpected
18writes to the V53 internal registers.  The important ones are reinitialized after this however, I'm guessing this is harmless
19on real hardware, as the code flow seems to be correct.
20
1721data structures look very similar between all of them
1822
1923*/


Previous 199869 Revisions Next


© 1997-2024 The MAME Team