src/mess/drivers/fmtowns.c
| r5912 | r5913 | |
| 82 | 82 | static UINT8 ftimer; |
| 83 | 83 | static UINT8 nmi_mask; |
| 84 | 84 | static UINT8 compat_mode; |
| 85 | static UINT8 towns_system_port; |
| 86 | static UINT32* towns_vram; |
| 87 | static UINT32* towns_cmos; |
| 88 | static UINT32* towns_gfxvram; |
| 89 | static UINT32* towns_txtvram; |
| 85 | 90 | |
| 86 | 91 | static READ8_HANDLER(towns_system_r) |
| 87 | 92 | { |
| r5912 | r5913 | |
| 297 | 302 | } |
| 298 | 303 | } |
| 299 | 304 | |
| 305 | static READ32_HANDLER(towns_padport_r) |
| 306 | { |
| 307 | if(ACCESSING_BITS_0_7) |
| 308 | return 0x7f; |
| 309 | |
| 310 | return 0x00; |
| 311 | } |
| 312 | |
| 313 | static READ8_HANDLER( towns_cmos8_r ) |
| 314 | { |
| 315 | UINT8* cmos = (UINT8*)towns_cmos; |
| 316 | |
| 317 | return cmos[offset]; |
| 318 | } |
| 319 | |
| 320 | static WRITE8_HANDLER( towns_cmos8_w ) |
| 321 | { |
| 322 | UINT8* cmos = (UINT8*)towns_cmos; |
| 323 | |
| 324 | cmos[offset] = data; |
| 325 | } |
| 326 | |
| 327 | static READ32_HANDLER( towns_cmos_r ) |
| 328 | { |
| 329 | return towns_cmos[offset]; |
| 330 | } |
| 331 | |
| 332 | static WRITE32_HANDLER( towns_cmos_w ) |
| 333 | { |
| 334 | COMBINE_DATA(towns_cmos+offset); |
| 335 | } |
| 336 | |
| 337 | static READ8_HANDLER( towns_sys480_r ) |
| 338 | { |
| 339 | if(towns_system_port & 0x02) |
| 340 | return 0x02; |
| 341 | else |
| 342 | return 0x00; |
| 343 | } |
| 344 | |
| 345 | static WRITE8_HANDLER( towns_sys480_w ) |
| 346 | { |
| 347 | towns_system_port = data; |
| 348 | } |
| 349 | |
| 300 | 350 | static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 301 | 351 | // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns) |
| 302 | 352 | // may not be (and probably is not) correct |
| 303 | 353 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 304 | | AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM // GVRAM |
| 305 | | AM_RANGE(0x000c8000, 0x000cffff) AM_RAM // TVRAM |
| 306 | | AM_RANGE(0x000d0000, 0x000d7fff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 307 | | AM_RANGE(0x000d8000, 0x000d9fff) AM_RAM // CMOS? RAM |
| 354 | AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_BASE(&towns_gfxvram) // GVRAM |
| 355 | AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM |
| 356 | // AM_RANGE(0x000ca000, 0x000cafff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM |
| 357 | AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM |
| 358 | AM_RANGE(0x000d8000, 0x000d9fff) AM_READWRITE(towns_cmos_r,towns_cmos_w) // CMOS? RAM |
| 308 | 359 | AM_RANGE(0x000da000, 0x000effff) AM_RAM |
| 309 | 360 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM |
| 310 | | AM_RANGE(0x000f8000, 0x000fffff) AM_ROM AM_REGION("user",0x238000) // BOOT (SYSTEM) ROM |
| 361 | AM_RANGE(0x000f8000, 0x000fffff) AM_RAM AM_REGION("user",0x238000) // BOOT (SYSTEM) ROM |
| 311 | 362 | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - seems to be needed to boot |
| 312 | | AM_RANGE(0x80000000, 0x8007ffff) AM_RAM // VRAM |
| 313 | | AM_RANGE(0x80100000, 0x8017ffff) AM_RAM // VRAM (mirror? second page?) |
| 363 | AM_RANGE(0x80000000, 0x8003ffff) AM_RAM AM_MIRROR(0x1c0000) AM_BASE(&towns_vram) // VRAM |
| 314 | 364 | AM_RANGE(0x81000000, 0x8101ffff) AM_RAM // Sprite RAM |
| 315 | 365 | AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM |
| 316 | 366 | AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 317 | 367 | AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000) // FONT ROM |
| 318 | | AM_RANGE(0xc2140000, 0xc2141fff) AM_NOP // CMOS (mirror?) |
| 368 | AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE(towns_cmos_r,towns_cmos_w) // CMOS (mirror?) |
| 319 | 369 | AM_RANGE(0xc2200000, 0xc2200fff) AM_NOP // WAVE RAM |
| 320 | 370 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 321 | 371 | ADDRESS_MAP_END |
| r5912 | r5913 | |
| 340 | 390 | AM_RANGE(0x0404,0x0407) AM_NOP // R/W (0x404) |
| 341 | 391 | AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff) |
| 342 | 392 | // System port |
| 343 | | AM_RANGE(0x0480,0x0483) AM_NOP // R/W (0x480) |
| 393 | AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0xff000000) // R/W (0x480) |
| 344 | 394 | // CD-ROM |
| 345 | 395 | AM_RANGE(0x04c0,0x04cf) AM_NOP |
| 396 | // Joystick / Mouse ports(?) |
| 397 | AM_RANGE(0x04d0,0x04d3) AM_READ(towns_padport_r) |
| 346 | 398 | // Sound (YM3438 [FM], RF5c68 [PCM]) |
| 347 | 399 | AM_RANGE(0x04d4,0x04d7) AM_NOP // R/W -- (0x4d5) mute? |
| 348 | 400 | AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",ym3438_r,ym3438_w,0x00ff00ff) |
| r5912 | r5913 | |
| 359 | 411 | // Keyboard (8042 MCU) |
| 360 | 412 | AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff) |
| 361 | 413 | // CMOS |
| 362 | | AM_RANGE(0x3000,0x3fff) AM_RAM |
| 414 | AM_RANGE(0x3000,0x3fff) AM_READWRITE8(towns_cmos8_r, towns_cmos8_w,0x00ff00ff) |
| 363 | 415 | // CRTC / Video (again) |
| 364 | 416 | AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff) |
| 365 | 417 | AM_RANGE(0xff80,0xff83) AM_READWRITE8(towns_video_ff81_r, towns_video_ff81_w, 0x0000ff00) |
| r5912 | r5913 | |
| 370 | 422 | static INPUT_PORTS_START( towns ) |
| 371 | 423 | INPUT_PORTS_END |
| 372 | 424 | |
| 425 | static DRIVER_INIT( towns ) |
| 426 | { |
| 427 | towns_vram = auto_alloc_array(machine,UINT32,0x20000); |
| 428 | towns_cmos = auto_alloc_array(machine,UINT32,0x2000/(sizeof(UINT32))); |
| 429 | towns_gfxvram = auto_alloc_array(machine,UINT32,0x8000/(sizeof(UINT32))); |
| 430 | towns_txtvram = auto_alloc_array(machine,UINT32,0x8000/(sizeof(UINT32))); |
| 431 | } |
| 373 | 432 | |
| 374 | 433 | static MACHINE_RESET( towns ) |
| 375 | 434 | { |
| r5912 | r5913 | |
| 384 | 443 | |
| 385 | 444 | static VIDEO_UPDATE( towns ) |
| 386 | 445 | { |
| 446 | int x,y; |
| 447 | int pixel = 0; |
| 448 | |
| 449 | for(y=0;y<480;y++) |
| 450 | { |
| 451 | for(x=0;x<640;x++) |
| 452 | { |
| 453 | *BITMAP_ADDR32(bitmap,y,x) = towns_vram[pixel++]; |
| 454 | if(pixel >= 0x20000) |
| 455 | pixel = 0; |
| 456 | } |
| 457 | } |
| 458 | |
| 387 | 459 | return 0; |
| 388 | 460 | } |
| 389 | 461 | |
| r5912 | r5913 | |
| 479 | 551 | /* Driver */ |
| 480 | 552 | |
| 481 | 553 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 482 | | COMP( 1989, fmtowns, 0, 0, towns, towns, 0, 0, "Fujitsu", "FM-Towns", GAME_NOT_WORKING) |
| 483 | | COMP( 1989, fmtownsa, fmtowns, 0, towns, towns, 0, 0, "Fujitsu", "FM-Towns (alternate)", GAME_NOT_WORKING) |
| 484 | | CONS( 1993, fmtmarty, 0, 0, towns, towns, 0, 0, "Fujitsu", "FM-Towns Marty", GAME_NOT_WORKING) |
| 554 | COMP( 1989, fmtowns, 0, 0, towns, towns, towns, 0, "Fujitsu", "FM-Towns", GAME_NOT_WORKING) |
| 555 | COMP( 1989, fmtownsa, fmtowns, 0, towns, towns, towns, 0, "Fujitsu", "FM-Towns (alternate)", GAME_NOT_WORKING) |
| 556 | CONS( 1993, fmtmarty, 0, 0, towns, towns, towns, 0, "Fujitsu", "FM-Towns Marty", GAME_NOT_WORKING) |
| 485 | 557 | |