Previous 15994 Revisions Next

r4776 Thursday 21st May, 2009 at 02:30:45 UTC by Barry Rodewald
[FMTOWNS] Added more documentation, hooked up PIT and PICs (no interrupt handlers yet)
[src/mess/drivers]fmtowns.c

src/mess/drivers/fmtowns.c
r4775r4776
2323
2424*/
2525
26#include "driver.h"
27#include "cpu/i386/i386.h"
28#include "sound/2612intf.h"
29#include "sound/rf5c68.h"
30
31/* System ports
32 *
26/* I/O port map (incomplete, could well be incorrect too)
27 *
28 * 0x0000   : Master 8259 PIC
29 * 0x0002   : Master 8259 PIC
30 * 0x0010   : Slave 8259 PIC
31 * 0x0012   : Slave 8259 PIC
3332 * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect
3433 * 0x0022  W: bit 7 = power off (write)
3534 * 0x0025 R : returns 0x00? (read)
r4775r4776
3837 * 0x0030 R : Machine ID (low)
3938 * 0x0031 R : Machine ID (high)
4039 * 0x0032 RW: bit 7 = RESET, bit 6 = CLK (serial?)
40 * 0x0040   : 8253 PIT counter 0
41 * 0x0042   : 8253 PIT counter 1
42 * 0x0044   : 8253 PIT counter 2
43 * 0x0046   : 8253 PIT mode port
44 * 0x0060   : 8253 PIT ???
4145 * 0x006c RW: returns 0x00? (read) timer? (write)
46 * 0x00a0-af: DMA controller 1 (uPD71071)
47 * 0x00b0-bf: DMA controller 2 (uPD71071)
48 * 0x0200-0f: Floppy controller (unknown)
49 * 0x0400   : Video / CRTC (unknown)
50 * 0x0404   : Video / CRTC (unknown)
51 * 0x0440-5f: Video / CRTC (unknown)
4252 * 0x0480 RW: bit 1 = some sort of RAM switch?
53 * 0x04c0-cf: CD-ROM controller (unknown? SCSI?)
54 * 0x04d5   : Sound mute
55 * 0x04d8   : YM3438 control port A / status
56 * 0x04da   : YM3438 data port A / status
57 * 0x04dc   : YM3438 control port B / status
58 * 0x04de   : YM3438 data port B / status
59 * 0x04e0-e3: volume ports
60 * 0x04e9-ec: IRQ masks
61 * 0x04f0-f8: RF5c68 registers
4362 * 0x05e8 R : RAM size in MB
4463 * 0x05ec RW: bit 0 = compatibility mode?
64 * 0x0600 RW: Keyboard data port (8042)
65 * 0x0602   : Keyboard control port (8042)
66 * 0x0604   : (8042)
67 * 0x3000 - 0x3fff : CMOS RAM
68 * 0xfd90-a0: CRTC / Video
69 * 0xff81: CRTC / Video - returns value in RAM location 0xcff81?
4570 */
71
72#include "driver.h"
73#include "cpu/i386/i386.h"
74#include "sound/2612intf.h"
75#include "sound/rf5c68.h"
76#include "machine/pit8253.h"
77#include "machine/pic8259.h"
78
4679static READ8_HANDLER(towns_system_r)
4780{
4881   switch(offset)
r4775r4776
221254   logerror("VID: wrote 0x%02x to port ff81\n",data);
222255}
223256
257static READ8_HANDLER(towns_keyboard_r)
258{
259   logerror("KB: read offset %02x\n",offset);
260   return 0x00;
261}
262
263static WRITE8_HANDLER(towns_keyboard_w)
264{
265   logerror("KB: wrote 0x%02x to offset %02x\n",data,offset);
266}
267
224268static READ32_HANDLER(towns_sys5e8_r)
225269{
226270   switch(offset)
r4775r4776
265309static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32)
266310  // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns)
267311  // may not be (and probably is not) correct
268  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
312  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
269313  AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM  // GVRAM
270314  AM_RANGE(0x000c8000, 0x000cffff) AM_RAM  // TVRAM
271315  AM_RANGE(0x000d0000, 0x000d7fff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
272  AM_RANGE(0x000d8000, 0x000d9fff) AM_RAM  // CMOS RAM
316  AM_RANGE(0x000d8000, 0x000d9fff) AM_RAM  // CMOS? RAM
273317  AM_RANGE(0x000da000, 0x000effff) AM_RAM
274318  AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM
275319  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
277  AM_RANGE(0x80000000, 0x8007ffff) AM_NOP  // VRAM
278  AM_RANGE(0x80100000, 0x8017ffff) AM_NOP  // VRAM (mirror? second page?)
279  AM_RANGE(0x81000000, 0x8101ffff) AM_NOP  // Sprite RAM
320  AM_RANGE(0x00100000, 0x005fffff) AM_RAM  // some extra RAM - seems to be needed to boot
321  AM_RANGE(0x80000000, 0x8007ffff) AM_RAM  // VRAM
322  AM_RANGE(0x80100000, 0x8017ffff) AM_RAM  // VRAM (mirror? second page?)
323  AM_RANGE(0x81000000, 0x8101ffff) AM_RAM  // Sprite RAM
280324  AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000)  // OS ROM
281325  AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000)  // DIC ROM
282326  AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000)  // FONT ROM
r4775r4776
289333  // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns
290334  // Some common PC ports are likely to also be used
291335  // System ports
336  AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_r, pic8259_w, 0x00ff00ff)
337  AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_r, pic8259_w, 0x00ff00ff)
292338  AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff)
339  AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit",pit8253_r, pit8253_w, 0x00ff00ff)
293340  AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff)
294341  // DMA controllers (uPD71071?)
295342  AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff)
r4775r4776
306353  AM_RANGE(0x04c0,0x04cf) AM_NOP
307354  // Sound (YM3438 [FM], RF5c68 [PCM])
308355  AM_RANGE(0x04d4,0x04d7) AM_NOP  // R/W  -- (0x4d5) mute?
309  AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",towns_fm_r,towns_fm_w,0x00ff00ff)
356  AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",towns_fm_r,towns_fm_w,0xffffffff)
310357  AM_RANGE(0x04e0,0x04e3) AM_NOP  // R/W  -- volume ports
311358  AM_RANGE(0x04e8,0x04ef) AM_NOP  // R/O  -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3)
312359                                  // (0x4ea) PCM IRQ mask
r4775r4776
314361                                  // W/O  -- (0x4ec) LED control
315362  AM_RANGE(0x04f0,0x04fb) AM_DEVREADWRITE8("pcm",towns_pcm_r,towns_pcm_w,0xffffffff)
316363  // CRTC / Video
317  AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0x00ff00ff)
364  AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff)
318365  // System ports
319366  AM_RANGE(0x05e8,0x05ef) AM_READWRITE(towns_sys5e8_r, towns_sys5e8_w)
367  // Keyboard (8042 MCU)
368  AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff)
369  // CMOS
370  AM_RANGE(0x3000,0x3fff) AM_RAM
320371  // CRTC / Video (again)
321372  AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff)
322373  AM_RANGE(0xff80,0xff83) AM_READWRITE8(towns_video_ff81_r, towns_video_ff81_w, 0x0000ff00)
r4775r4776
341392    return 0;
342393}
343394
395const struct pit8253_config towns_pit8253_config =
396{
397   {
398      {
399         307200,
400         NULL
401      },
402      {
403         307200,
404         NULL
405      },
406      {
407         307200,
408         NULL
409      }
410   }
411};
412
413const struct pic8259_interface towns_pic8259_master_config =
414{
415   NULL
416};
417
418
419const struct pic8259_interface towns_pic8259_slave_config =
420{
421   NULL
422};
423
344424static MACHINE_DRIVER_START( towns )
345425    /* basic machine hardware */
346426    MDRV_CPU_ADD("maincpu",I386, 16000000)
r4775r4776
359439   
360440    /* sound hardware */
361441    MDRV_SPEAKER_STANDARD_MONO("mono")
362   MDRV_SOUND_ADD("fm", YM3438, 4000000) // actual clock speed unknown
442   MDRV_SOUND_ADD("fm", YM3438, 53693100 / 7) // actual clock speed unknown
363443//   MDRV_SOUND_CONFIG(ym3438_interface)
364444   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
365   MDRV_SOUND_ADD("pcm", RF5C68, 4000000)  // actual clock speed unknown
445   MDRV_SOUND_ADD("pcm", RF5C68, 2150000)  // actual clock speed unknown
366446//   MDRV_SOUND_CONFIG(rf5c68_interface)
367447   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
368448   
449    MDRV_PIT8253_ADD("pit",towns_pit8253_config)
450   
451   MDRV_PIC8259_ADD( "pic8259_master", towns_pic8259_master_config )
452
453   MDRV_PIC8259_ADD( "pic8259_slave", towns_pic8259_slave_config )
454
369455    MDRV_VIDEO_START(towns)
370456    MDRV_VIDEO_UPDATE(towns)
371457MACHINE_DRIVER_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team