src/mess/drivers/fmtowns.c
| r4775 | r4776 | |
| 23 | 23 | |
| 24 | 24 | */ |
| 25 | 25 | |
| 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 |
| 33 | 32 | * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect |
| 34 | 33 | * 0x0022 W: bit 7 = power off (write) |
| 35 | 34 | * 0x0025 R : returns 0x00? (read) |
| r4775 | r4776 | |
| 38 | 37 | * 0x0030 R : Machine ID (low) |
| 39 | 38 | * 0x0031 R : Machine ID (high) |
| 40 | 39 | * 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 ??? |
| 41 | 45 | * 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) |
| 42 | 52 | * 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 |
| 43 | 62 | * 0x05e8 R : RAM size in MB |
| 44 | 63 | * 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? |
| 45 | 70 | */ |
| 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 | |
| 46 | 79 | static READ8_HANDLER(towns_system_r) |
| 47 | 80 | { |
| 48 | 81 | switch(offset) |
| r4775 | r4776 | |
| 221 | 254 | logerror("VID: wrote 0x%02x to port ff81\n",data); |
| 222 | 255 | } |
| 223 | 256 | |
| 257 | static READ8_HANDLER(towns_keyboard_r) |
| 258 | { |
| 259 | logerror("KB: read offset %02x\n",offset); |
| 260 | return 0x00; |
| 261 | } |
| 262 | |
| 263 | static WRITE8_HANDLER(towns_keyboard_w) |
| 264 | { |
| 265 | logerror("KB: wrote 0x%02x to offset %02x\n",data,offset); |
| 266 | } |
| 267 | |
| 224 | 268 | static READ32_HANDLER(towns_sys5e8_r) |
| 225 | 269 | { |
| 226 | 270 | switch(offset) |
| r4775 | r4776 | |
| 265 | 309 | static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 266 | 310 | // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns) |
| 267 | 311 | // may not be (and probably is not) correct |
| 268 | | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 312 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 269 | 313 | AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM // GVRAM |
| 270 | 314 | AM_RANGE(0x000c8000, 0x000cffff) AM_RAM // TVRAM |
| 271 | 315 | 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 |
| 273 | 317 | AM_RANGE(0x000da000, 0x000effff) AM_RAM |
| 274 | 318 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM |
| 275 | 319 | 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 |
| 280 | 324 | AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM |
| 281 | 325 | AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 282 | 326 | AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000) // FONT ROM |
| r4775 | r4776 | |
| 289 | 333 | // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns |
| 290 | 334 | // Some common PC ports are likely to also be used |
| 291 | 335 | // 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) |
| 292 | 338 | 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) |
| 293 | 340 | AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff) |
| 294 | 341 | // DMA controllers (uPD71071?) |
| 295 | 342 | AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff) |
| r4775 | r4776 | |
| 306 | 353 | AM_RANGE(0x04c0,0x04cf) AM_NOP |
| 307 | 354 | // Sound (YM3438 [FM], RF5c68 [PCM]) |
| 308 | 355 | 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) |
| 310 | 357 | AM_RANGE(0x04e0,0x04e3) AM_NOP // R/W -- volume ports |
| 311 | 358 | AM_RANGE(0x04e8,0x04ef) AM_NOP // R/O -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3) |
| 312 | 359 | // (0x4ea) PCM IRQ mask |
| r4775 | r4776 | |
| 314 | 361 | // W/O -- (0x4ec) LED control |
| 315 | 362 | AM_RANGE(0x04f0,0x04fb) AM_DEVREADWRITE8("pcm",towns_pcm_r,towns_pcm_w,0xffffffff) |
| 316 | 363 | // 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) |
| 318 | 365 | // System ports |
| 319 | 366 | 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 |
| 320 | 371 | // CRTC / Video (again) |
| 321 | 372 | AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff) |
| 322 | 373 | AM_RANGE(0xff80,0xff83) AM_READWRITE8(towns_video_ff81_r, towns_video_ff81_w, 0x0000ff00) |
| r4775 | r4776 | |
| 341 | 392 | return 0; |
| 342 | 393 | } |
| 343 | 394 | |
| 395 | const 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 | |
| 413 | const struct pic8259_interface towns_pic8259_master_config = |
| 414 | { |
| 415 | NULL |
| 416 | }; |
| 417 | |
| 418 | |
| 419 | const struct pic8259_interface towns_pic8259_slave_config = |
| 420 | { |
| 421 | NULL |
| 422 | }; |
| 423 | |
| 344 | 424 | static MACHINE_DRIVER_START( towns ) |
| 345 | 425 | /* basic machine hardware */ |
| 346 | 426 | MDRV_CPU_ADD("maincpu",I386, 16000000) |
| r4775 | r4776 | |
| 359 | 439 | |
| 360 | 440 | /* sound hardware */ |
| 361 | 441 | 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 |
| 363 | 443 | // MDRV_SOUND_CONFIG(ym3438_interface) |
| 364 | 444 | 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 |
| 366 | 446 | // MDRV_SOUND_CONFIG(rf5c68_interface) |
| 367 | 447 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 368 | 448 | |
| 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 | |
| 369 | 455 | MDRV_VIDEO_START(towns) |
| 370 | 456 | MDRV_VIDEO_UPDATE(towns) |
| 371 | 457 | MACHINE_DRIVER_END |