Previous 15994 Revisions Next

r4746 Tuesday 19th May, 2009 at 12:16:18 UTC by Barry Rodewald
[FMTOWNS] Add some read/write handlers, most just logging info. Runs for a touch longer now. ;)
[src/mess/drivers]fmtowns.c

src/mess/drivers/fmtowns.c
r4745r4746
2828#include "sound/2612intf.h"
2929#include "sound/rf5c68.h"
3030
31/* System ports
32 *
33 * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect
34 * 0x0022  W: bit 7 = power off (write)
35 * 0x0025 R : returns 0x00? (read)
36 * 0x0026 R : timer?
37 * 0x0028 RW: bit 0 = NMI mask (read/write)
38 * 0x0030 R : Machine ID (low)
39 * 0x0031 R : Machine ID (high)
40 * 0x0032 RW: bit 7 = RESET, bit 6 = CLK (serial?)
41 * 0x006c RW: returns 0x00? (read) timer? (write)
42 * 0x0480 RW: bit 1 = some sort of RAM switch?
43 * 0x05e8 R : RAM size in MB
44 * 0x05ec RW: bit 0 = compatibility mode?
45 */
46static READ8_HANDLER(towns_system_r)
47{
48   switch(offset)
49   {
50      case 0x00:
51         logerror("SYS: port 0x20 read\n");
52         return 0x00;
53      case 0x05:
54         logerror("SYS: port 0x25 read\n");
55         return 0x00;
56      case 0x06:
57         logerror("SYS: (0x26) timer read\n");
58         return 0x00;
59      case 0x08:
60         logerror("SYS: (0x28) NMI mask read\n");
61         return 0x00;
62      case 0x10:
63         logerror("SYS: (0x30) Machine ID read\n");
64         return 0x01;
65      case 0x11:
66         logerror("SYS: (0x31) Machine ID read\n");
67         return 0x01;
68      case 0x12:
69         logerror("SYS: (0x32) Serial(?) read\n");
70         return 0x00;
71      default:
72         logerror("SYS: Unknown system port read (0x%02x)\n",offset);
73         return 0x00;
74   }
75}
76
77static WRITE8_HANDLER(towns_system_w)
78{
79   switch(offset)
80   {
81      case 0x00:
82         logerror("SYS: port 0x20 write %02x\n",data);
83         break;
84      case 0x02:
85         logerror("SYS: (0x22) power port write %02x\n",data);
86         break;
87      case 0x08:
88         logerror("SYS: (0x28) NMI mask write %02x\n",data);
89         break;
90      case 0x12:
91         logerror("SYS: (0x32) Serial(?) write %02x\n",data);
92         break;
93      default:
94         logerror("SYS: Unknown system port write 0x%02x (0x%02x)\n",data,offset);
95   }
96}
97
98static READ8_HANDLER(towns_sys6c_r)
99{
100   logerror("SYS: (0x6c) Timer? read\n");
101   return 0x00;
102}
103
104static WRITE8_HANDLER(towns_sys6c_w)
105{
106   logerror("SYS: (0x6c) write to timer (0x%02x)\n",data);
107}
108
109static READ8_HANDLER(towns_dma1_r)
110{
111   logerror("DMA#1: read register %i\n",offset);
112   return 0x00;
113}
114
115static WRITE8_HANDLER(towns_dma1_w)
116{
117   logerror("DMA#1: wrote 0x%02x to register %i\n",data,offset);
118}
119
120static READ8_HANDLER(towns_dma2_r)
121{
122   logerror("DMA#2: read register %i\n",offset);
123   return 0x00;
124}
125
126static WRITE8_HANDLER(towns_dma2_w)
127{
128   logerror("DMA#2: wrote 0x%02x to register %i\n",data,offset);
129}
130
131static READ8_DEVICE_HANDLER(towns_fm_r)
132{
133   logerror("FM: read status port %i\n",offset);
134   return 0x00;
135}
136
137static WRITE8_DEVICE_HANDLER(towns_fm_w)
138{
139   switch(offset)
140   {
141      case 0x00:
142         logerror("FM: wrote %02x to FM control port A\n",data);
143         break;
144      case 0x02:
145         logerror("FM: wrote %02x to FM data port A\n",data);
146         break;
147      case 0x04:
148         logerror("FM: wrote %02x to FM control port B\n",data);
149         break;
150      case 0x06:
151         logerror("FM: wrote %02x to FM data port B\n",data);
152         break;
153      default:
154         logerror("FM: unknown port write (%02x -> 0x%04x)\n",data,offset+0x4d8);
155   }
156}
157
158static READ8_DEVICE_HANDLER(towns_pcm_r)
159{
160   logerror("PCM: read register %i\n",offset);
161   return 0x00;
162}
163
164static WRITE8_DEVICE_HANDLER(towns_pcm_w)
165{
166   logerror("PCM: wrote 0x%02x to register %i\n",data,offset);
167}
168
169static READ8_HANDLER(towns_floppy_r)
170{
171   logerror("PCM: read register %i\n",offset);
172   return 0x00;
173}
174
175static WRITE8_HANDLER(towns_floppy_w)
176{
177   logerror("PCM: wrote 0x%02x to register %i\n",data,offset);
178}
179
180static READ8_HANDLER(towns_video_440_r)
181{
182   logerror("VID: read port %04x\n",offset+0x440);
183   return 0x00;
184}
185
186static WRITE8_HANDLER(towns_video_440_w)
187{
188   logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x440);
189}
190
191static READ8_HANDLER(towns_video_5c8_r)
192{
193   logerror("VID: read port %04x\n",offset+0x5c8);
194   return 0x00;
195}
196
197static WRITE8_HANDLER(towns_video_5c8_w)
198{
199   logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x5c8);
200}
201
202static READ8_HANDLER(towns_video_fd90_r)
203{
204   logerror("VID: read port %04x\n",offset+0xfd90);
205   return 0x00;
206}
207
208static WRITE8_HANDLER(towns_video_fd90_w)
209{
210   logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90);
211}
212
213static READ8_HANDLER(towns_video_ff81_r)
214{
215   logerror("VID: read port ff81\n");
216   return 0x00;
217}
218
219static WRITE8_HANDLER(towns_video_ff81_w)
220{
221   logerror("VID: wrote 0x%02x to port ff81\n",data);
222}
223
224static READ32_HANDLER(towns_sys5e8_r)
225{
226   switch(offset)
227   {
228      case 0x00:
229         if(ACCESSING_BITS_0_7)
230         {
231            logerror("SYS: read RAM size port\n");
232            return 0x06;  // 6MB is standard for the Marty
233         }
234         break;
235      case 0x01:
236         if(ACCESSING_BITS_0_7)
237         {
238            logerror("SYS: read port 5ec\n");
239            return 0x00;
240         }
241         break;
242   }
243   return 0x00;
244}
245
246static WRITE32_HANDLER(towns_sys5e8_w)
247{
248   switch(offset)
249   {
250      case 0x00:
251         if(ACCESSING_BITS_0_7)
252         {
253            logerror("SYS: wrote 0x%02x to port 5e8\n",data);
254         }
255         break;
256      case 0x01:
257         if(ACCESSING_BITS_0_7)
258         {
259            logerror("SYS: wrote 0x%02x to port 5ec\n",data);
260         }
261         break;
262   }
263}
264
31265static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32)
32266  // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns)
33267  // may not be (and probably is not) correct
34  AM_RANGE(0x000c0000, 0x000c7fff) AM_NOP  // GVRAM
35  AM_RANGE(0x000c8000, 0x000cffff) AM_NOP  // TVRAM
268  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
269  AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM  // GVRAM
270  AM_RANGE(0x000c8000, 0x000cffff) AM_RAM  // TVRAM
36271  AM_RANGE(0x000d0000, 0x000d7fff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
37  AM_RANGE(0x000d8000, 0x000d9fff) AM_NOP  // CMOS RAM
272  AM_RANGE(0x000d8000, 0x000d9fff) AM_RAM  // CMOS RAM
273  AM_RANGE(0x000da000, 0x000effff) AM_RAM
274  AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM
38275  AM_RANGE(0x000f8000, 0x000fffff) AM_ROM AM_REGION("user",0x238000)  // BOOT (SYSTEM) ROM
276  AM_RANGE(0x00100000, 0x001fffff) AM_RAM  // some extra RAM - seems to be needed to boot
39277  AM_RANGE(0x80000000, 0x8007ffff) AM_NOP  // VRAM
40278  AM_RANGE(0x80100000, 0x8017ffff) AM_NOP  // VRAM (mirror? second page?)
41279  AM_RANGE(0x81000000, 0x8101ffff) AM_NOP  // Sprite RAM
r4745r4746
51289  // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns
52290  // Some common PC ports are likely to also be used
53291  // System ports
54  AM_RANGE(0x0020,0x0033) AM_NOP  // R/W
55  AM_RANGE(0x006c,0x006f) AM_NOP  // R/W (0x6c)
292  AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff)
293  AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff)
56294  // DMA controllers (uPD71071?)
57  AM_RANGE(0x00a0,0x00af) AM_NOP
58  AM_RANGE(0x00b0,0x00bf) AM_NOP
295  AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff)
296  AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffffffff)
59297  // Floppy controller
60  AM_RANGE(0x0200,0x020f) AM_NOP // all R/W
298  AM_RANGE(0x0200,0x020f) AM_READWRITE8(towns_floppy_r, towns_floppy_w, 0xffffffff)
61299  // CRTC / Video
62300  AM_RANGE(0x0400,0x0403) AM_NOP  // R/O (0x400)
63301  AM_RANGE(0x0404,0x0407) AM_NOP  // R/W (0x404)
64  AM_RANGE(0x0440,0x045f) AM_NOP
302  AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff)
65303  // System port
66304  AM_RANGE(0x0480,0x0483) AM_NOP  // R/W (0x480)
67305  // CD-ROM
68306  AM_RANGE(0x04c0,0x04cf) AM_NOP
69307  // Sound (YM3438 [FM], RF5c68 [PCM])
70308  AM_RANGE(0x04d4,0x04d7) AM_NOP  // R/W  -- (0x4d5) mute?
71  AM_RANGE(0x04d8,0x04db) AM_NOP  // R/W  -- (0x4d8) YM control port A / status port A
72                                  // R/W  -- (0x4da) YM data port A / status port A
73  AM_RANGE(0x04dc,0x04df) AM_NOP  // R/W  -- (0x4dc) YM control port B / status port A
74                                  // R/W  -- (0x4de) YM data port B / status port A
309  AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",towns_fm_r,towns_fm_w,0x00ff00ff)
75310  AM_RANGE(0x04e0,0x04e3) AM_NOP  // R/W  -- volume ports
76311  AM_RANGE(0x04e8,0x04ef) AM_NOP  // R/O  -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3)
77312                                  // (0x4ea) PCM IRQ mask
78313                                  // R/W  -- (0x4eb) PCM IRQ flag
79314                                  // W/O  -- (0x4ec) LED control
80  AM_RANGE(0x04f0,0x04fb) AM_NOP  // W/O  -- (0x4f0-0x4f8) PCM registers
315  AM_RANGE(0x04f0,0x04fb) AM_DEVREADWRITE8("pcm",towns_pcm_r,towns_pcm_w,0xffffffff)
316  // CRTC / Video
317  AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0x00ff00ff)
81318  // System ports
82  AM_RANGE(0x05e8,0x05ef) AM_NOP  // R/O (0x5e8, 0x5ec)
319  AM_RANGE(0x05e8,0x05ef) AM_READWRITE(towns_sys5e8_r, towns_sys5e8_w)
320  // CRTC / Video (again)
321  AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff)
322  AM_RANGE(0xff80,0xff83) AM_READWRITE8(towns_video_ff81_r, towns_video_ff81_w, 0x0000ff00)
83323
84324ADDRESS_MAP_END
85325

Previous 15994 Revisions Next


© 1998-2018 The MESS Team