src/mess/drivers/fmtowns.c
| r4784 | r4785 | |
| 4 | 4 | |
| 5 | 5 | Japanese computer system released in 1989. |
| 6 | 6 | |
| 7 | | CPU: AMD 80386SX (80387 available as add-on) |
| 7 | CPU: AMD 80386SX(DX?) (80387 available as add-on?) |
| 8 | 8 | Sound: Yamaha YM3438 |
| 9 | 9 | Ricoh RF5c68 |
| 10 | 10 | Video: VGA + some custom extra video hardware |
| r4784 | r4785 | |
| 16 | 16 | |
| 17 | 17 | Fujitsu FM-Towns Marty |
| 18 | 18 | |
| 19 | | Japanese console, based on the FM-Towns computer, released in 1993 |
| 19 | Japanese console, based on the FM-Towns computer, using an AMD 80386SX CPU, |
| 20 | released in 1993 |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | 16/5/09: Skeleton driver. |
| 23 | 24 | |
| 25 | Issues: BIOS requires 386 protected mode. |
| 26 | |
| 24 | 27 | */ |
| 25 | 28 | |
| 26 | 29 | /* I/O port map (incomplete, could well be incorrect too) |
| r4784 | r4785 | |
| 76 | 79 | #include "machine/pit8253.h" |
| 77 | 80 | #include "machine/pic8259.h" |
| 78 | 81 | |
| 82 | UINT8 ftimer; |
| 83 | UINT8 nmi_mask; |
| 84 | UINT8 compat_mode; |
| 85 | |
| 79 | 86 | static READ8_HANDLER(towns_system_r) |
| 80 | 87 | { |
| 81 | 88 | switch(offset) |
| r4784 | r4785 | |
| 88 | 95 | return 0x00; |
| 89 | 96 | case 0x06: |
| 90 | 97 | logerror("SYS: (0x26) timer read\n"); |
| 91 | | return 0x00; |
| 98 | ftimer -= 0x13; |
| 99 | return ftimer; |
| 92 | 100 | case 0x08: |
| 93 | 101 | logerror("SYS: (0x28) NMI mask read\n"); |
| 94 | | return 0x00; |
| 102 | return nmi_mask & 0x01; |
| 95 | 103 | case 0x10: |
| 96 | 104 | logerror("SYS: (0x30) Machine ID read\n"); |
| 97 | 105 | return 0x01; |
| r4784 | r4785 | |
| 119 | 127 | break; |
| 120 | 128 | case 0x08: |
| 121 | 129 | logerror("SYS: (0x28) NMI mask write %02x\n",data); |
| 130 | nmi_mask = data & 0x01; |
| 122 | 131 | break; |
| 123 | 132 | case 0x12: |
| 124 | 133 | logerror("SYS: (0x32) Serial(?) write %02x\n",data); |
| r4784 | r4785 | |
| 137 | 146 | static WRITE8_HANDLER(towns_sys6c_w) |
| 138 | 147 | { |
| 139 | 148 | logerror("SYS: (0x6c) write to timer (0x%02x)\n",data); |
| 149 | ftimer -= 0x54; |
| 140 | 150 | } |
| 141 | 151 | |
| 142 | 152 | static READ8_HANDLER(towns_dma1_r) |
| r4784 | r4785 | |
| 161 | 171 | logerror("DMA#2: wrote 0x%02x to register %i\n",data,offset); |
| 162 | 172 | } |
| 163 | 173 | |
| 164 | | static READ8_DEVICE_HANDLER(towns_fm_r) |
| 165 | | { |
| 166 | | logerror("FM: read status port %i\n",offset); |
| 167 | | return 0x00; |
| 168 | | } |
| 169 | | |
| 170 | | static WRITE8_DEVICE_HANDLER(towns_fm_w) |
| 171 | | { |
| 172 | | switch(offset) |
| 173 | | { |
| 174 | | case 0x00: |
| 175 | | logerror("FM: wrote %02x to FM control port A\n",data); |
| 176 | | break; |
| 177 | | case 0x02: |
| 178 | | logerror("FM: wrote %02x to FM data port A\n",data); |
| 179 | | break; |
| 180 | | case 0x04: |
| 181 | | logerror("FM: wrote %02x to FM control port B\n",data); |
| 182 | | break; |
| 183 | | case 0x06: |
| 184 | | logerror("FM: wrote %02x to FM data port B\n",data); |
| 185 | | break; |
| 186 | | default: |
| 187 | | logerror("FM: unknown port write (%02x -> 0x%04x)\n",data,offset+0x4d8); |
| 188 | | } |
| 189 | | } |
| 190 | | |
| 191 | | static READ8_DEVICE_HANDLER(towns_pcm_r) |
| 192 | | { |
| 193 | | logerror("PCM: read register %i\n",offset); |
| 194 | | return 0x00; |
| 195 | | } |
| 196 | | |
| 197 | | static WRITE8_DEVICE_HANDLER(towns_pcm_w) |
| 198 | | { |
| 199 | | logerror("PCM: wrote 0x%02x to register %i\n",data,offset); |
| 200 | | } |
| 201 | | |
| 202 | 174 | static READ8_HANDLER(towns_floppy_r) |
| 203 | 175 | { |
| 204 | 176 | logerror("PCM: read register %i\n",offset); |
| r4784 | r4785 | |
| 265 | 237 | logerror("KB: wrote 0x%02x to offset %02x\n",data,offset); |
| 266 | 238 | } |
| 267 | 239 | |
| 240 | static READ8_HANDLER(towns_port60_r) |
| 241 | { |
| 242 | UINT8 val = 0x00; |
| 243 | if ( pit8253_get_output(devtag_get_device(space->machine, "pit"), 2 ) ) |
| 244 | val |= 0x20; |
| 245 | else |
| 246 | val &= ~0x20; |
| 247 | |
| 248 | logerror("PIT: port 0x60 read, returning 0x%02x\n",val); |
| 249 | return val; |
| 250 | } |
| 251 | |
| 252 | static WRITE8_HANDLER(towns_port60_w) |
| 253 | { |
| 254 | pit8253_gate_w(devtag_get_device(space->machine, "pit"), 2, data & 1); |
| 255 | logerror("PIT: wrote 0x%02x to port 0x60\n",data); |
| 256 | } |
| 257 | |
| 268 | 258 | static READ32_HANDLER(towns_sys5e8_r) |
| 269 | 259 | { |
| 270 | 260 | switch(offset) |
| r4784 | r4785 | |
| 280 | 270 | if(ACCESSING_BITS_0_7) |
| 281 | 271 | { |
| 282 | 272 | logerror("SYS: read port 5ec\n"); |
| 283 | | return 0x00; |
| 273 | return compat_mode & 0x01; |
| 284 | 274 | } |
| 285 | 275 | break; |
| 286 | 276 | } |
| r4784 | r4785 | |
| 301 | 291 | if(ACCESSING_BITS_0_7) |
| 302 | 292 | { |
| 303 | 293 | logerror("SYS: wrote 0x%02x to port 5ec\n",data); |
| 294 | compat_mode = data & 0x01; |
| 304 | 295 | } |
| 305 | 296 | break; |
| 306 | 297 | } |
| r4784 | r4785 | |
| 337 | 328 | AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_r, pic8259_w, 0x00ff00ff) |
| 338 | 329 | AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff) |
| 339 | 330 | AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit",pit8253_r, pit8253_w, 0x00ff00ff) |
| 331 | AM_RANGE(0x0060,0x0063) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x000000ff) |
| 340 | 332 | AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff) |
| 341 | 333 | // DMA controllers (uPD71071?) |
| 342 | 334 | AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff) |
| r4784 | r4785 | |
| 353 | 345 | AM_RANGE(0x04c0,0x04cf) AM_NOP |
| 354 | 346 | // Sound (YM3438 [FM], RF5c68 [PCM]) |
| 355 | 347 | AM_RANGE(0x04d4,0x04d7) AM_NOP // R/W -- (0x4d5) mute? |
| 356 | | AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",towns_fm_r,towns_fm_w,0xffffffff) |
| 348 | AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",ym3438_r,ym3438_w,0x00ff00ff) |
| 357 | 349 | AM_RANGE(0x04e0,0x04e3) AM_NOP // R/W -- volume ports |
| 358 | 350 | AM_RANGE(0x04e8,0x04ef) AM_NOP // R/O -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3) |
| 359 | 351 | // (0x4ea) PCM IRQ mask |
| 360 | 352 | // R/W -- (0x4eb) PCM IRQ flag |
| 361 | 353 | // W/O -- (0x4ec) LED control |
| 362 | | AM_RANGE(0x04f0,0x04fb) AM_DEVREADWRITE8("pcm",towns_pcm_r,towns_pcm_w,0xffffffff) |
| 354 | AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm",rf5c68_w,0xffffffff) |
| 363 | 355 | // CRTC / Video |
| 364 | 356 | AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff) |
| 365 | 357 | // System ports |
| r4784 | r4785 | |
| 381 | 373 | |
| 382 | 374 | static MACHINE_RESET( towns ) |
| 383 | 375 | { |
| 376 | ftimer = 0x00; |
| 377 | nmi_mask = 0x00; |
| 378 | compat_mode = 0x00; |
| 384 | 379 | } |
| 385 | 380 | |
| 386 | 381 | static VIDEO_START( towns ) |