src/mess/drivers/pc98.c
| r6054 | r6055 | |
| 221 | 221 | |
| 222 | 222 | static UINT32 *pc9801_vram; |
| 223 | 223 | static UINT32 *gfx_bitmap_ram; |
| 224 | static UINT32 *work_ram_banked; |
| 224 | 225 | static UINT8 ems_bank; |
| 226 | static UINT8 wram_bank; |
| 225 | 227 | |
| 228 | |
| 226 | 229 | static VIDEO_START( pc9801 ) |
| 227 | 230 | { |
| 228 | 231 | gfx_bitmap_ram = auto_alloc_array(machine, UINT32, 0x18000*2); |
| 232 | work_ram_banked = auto_alloc_array(machine, UINT32, 0x2000*0xfe); //shouldn't be here |
| 229 | 233 | } |
| 230 | 234 | |
| 231 | 235 | /* |
| r6054 | r6055 | |
| 395 | 399 | |
| 396 | 400 | static WRITE8_HANDLER( ems_sel_w ) |
| 397 | 401 | { |
| 402 | // printf("%02x %02x\n",offset,data); |
| 403 | |
| 404 | if(offset == 1) |
| 405 | { |
| 406 | UINT8 *ROM = memory_region(space->machine, "cpudata"); |
| 407 | |
| 408 | if(data == 0x00 || data == 0x10) |
| 409 | memory_set_bankptr(space->machine, 1, &ROM[0x20000]); |
| 410 | |
| 411 | if(data == 0x02 || data == 0x12) |
| 412 | memory_set_bankptr(space->machine, 1, &ROM[0x00000]); |
| 413 | } |
| 414 | |
| 398 | 415 | if(offset == 3) |
| 399 | 416 | { |
| 400 | 417 | if(data == 0x22) |
| r6054 | r6055 | |
| 455 | 472 | } |
| 456 | 473 | } |
| 457 | 474 | |
| 475 | static UINT8 gate_a20; |
| 476 | |
| 477 | static READ8_HANDLER( port_f0_r ) |
| 478 | { |
| 479 | if(offset == 0x02) |
| 480 | return (gate_a20 ^ 1) | 0x2e; |
| 481 | else if(offset == 0x06) |
| 482 | return (gate_a20 ^ 1) | 0x5e; |
| 483 | |
| 484 | return 0x00; |
| 485 | } |
| 486 | |
| 487 | static WRITE8_HANDLER( port_f0_w ) |
| 488 | { |
| 489 | if(offset == 0x00) |
| 490 | { |
| 491 | //cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE); |
| 492 | } |
| 493 | |
| 494 | if(offset == 0x02) |
| 495 | { |
| 496 | gate_a20 = 1; |
| 497 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_A20, gate_a20); |
| 498 | } |
| 499 | if(offset == 0x06) |
| 500 | { |
| 501 | if(data == 0x02) |
| 502 | { |
| 503 | gate_a20 = 1; |
| 504 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_A20, gate_a20); |
| 505 | } |
| 506 | else if(data == 0x03) |
| 507 | { |
| 508 | gate_a20 = 0; |
| 509 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_A20, gate_a20); |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | static UINT8 wram_latch_reg; |
| 515 | |
| 516 | static READ8_HANDLER( wram_sel_r ) |
| 517 | { |
| 518 | return (wram_bank << 1) | wram_latch_reg; |
| 519 | } |
| 520 | |
| 521 | static WRITE8_HANDLER( wram_sel_w ) |
| 522 | { |
| 523 | wram_bank = (data & 0xfe) >> 1; |
| 524 | wram_latch_reg = data & 1; //<- correct? |
| 525 | //printf("%02x\n",wram_bank); |
| 526 | } |
| 527 | |
| 458 | 528 | static READ32_HANDLER( gfx_bitmap_ram_r ) { return gfx_bitmap_ram[offset+ems_bank*0x18000/4]; } |
| 459 | | static WRITE32_HANDLER( gfx_bitmap_ram_w ) { gfx_bitmap_ram[offset+ems_bank*0x18000/4] = data; } |
| 529 | static WRITE32_HANDLER( gfx_bitmap_ram_w ) { COMBINE_DATA(&gfx_bitmap_ram[offset+ems_bank*0x18000/4]); } |
| 460 | 530 | |
| 531 | static READ32_HANDLER( wram_bank_r ) { return work_ram_banked[offset+wram_bank*0x2000/4]; } |
| 532 | static WRITE32_HANDLER( wram_bank_w ) { COMBINE_DATA(&work_ram_banked[offset+wram_bank*0x2000/4]); } |
| 533 | |
| 534 | static READ32_HANDLER( wram_ide_r ) { return work_ram_banked[offset+4*0x2000/4]; } //todo: ide hookup & calculate the correct bank number here |
| 535 | static WRITE32_HANDLER( wram_ide_w ) { COMBINE_DATA(&work_ram_banked[offset+4*0x2000/4]); } |
| 536 | |
| 461 | 537 | static ADDRESS_MAP_START( pc9801_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 462 | | AM_RANGE(0x00000000, 0x0009ffff) AM_MIRROR(0x00100000) AM_RAM |
| 538 | AM_RANGE(0x00000000, 0x0007ffff) AM_RAM |
| 539 | AM_RANGE(0x00080000, 0x0009ffff) AM_READWRITE(wram_bank_r,wram_bank_w) |
| 463 | 540 | AM_RANGE(0x000a0000, 0x000a3fff) AM_RAM AM_BASE(&pc9801_vram) //vram + attr |
| 464 | 541 | AM_RANGE(0x000a4000, 0x000a4fff) AM_RAM //cg window |
| 465 | 542 | AM_RANGE(0x000a8000, 0x000bffff) AM_READWRITE(gfx_bitmap_ram_r,gfx_bitmap_ram_w) |
| 466 | | AM_RANGE(0x000e0000, 0x000fffff) AM_ROM AM_REGION("maincpu",0) |
| 467 | | AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("maincpu",0) |
| 543 | AM_RANGE(0x000c0000, 0x000dffff) AM_READWRITE(wram_ide_r,wram_ide_w) |
| 544 | AM_RANGE(0x000e0000, 0x000fffff) AM_ROMBANK(1) |
| 545 | AM_RANGE(0xfffe0000, 0xffffffff) AM_ROMBANK(1) |
| 468 | 546 | ADDRESS_MAP_END |
| 469 | 547 | |
| 470 | 548 | |
| r6054 | r6055 | |
| 491 | 569 | AM_RANGE(0x0070, 0x007f) AM_READWRITE8(port_70_r,port_70_w,0xffffffff) // crtc regs (even ports) / pit8253 (odd ports) |
| 492 | 570 | AM_RANGE(0x00a0, 0x00a3) AM_READWRITE8(port_a0_r,port_a0_w,0xffffffff) // uPD7220 status & fifo (R) / param & cmd (W) slave (even ports) |
| 493 | 571 | // AM_RANGE(0x00e0, 0x00ef) DMA |
| 572 | AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(port_f0_r,port_f0_w,0xffffffff) |
| 494 | 573 | AM_RANGE(0x043c, 0x043f) AM_WRITE8(ems_sel_w,0xffffffff) |
| 574 | AM_RANGE(0x0460, 0x0463) AM_READWRITE8(wram_sel_r,wram_sel_w,0xffffffff) |
| 495 | 575 | |
| 496 | 576 | // (and many more...) |
| 497 | 577 | ADDRESS_MAP_END |
| r6054 | r6055 | |
| 518 | 598 | return r; |
| 519 | 599 | } |
| 520 | 600 | |
| 601 | #include "cpu/i386/i386priv.h" |
| 602 | |
| 603 | |
| 521 | 604 | static MACHINE_RESET(pc9801) |
| 522 | 605 | { |
| 606 | UINT8 *ROM = memory_region(machine, "cpudata"); |
| 607 | |
| 523 | 608 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); |
| 609 | |
| 610 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, 0); |
| 611 | |
| 612 | gate_a20 = 0; |
| 613 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), I386_EIP, 0xffff0+0x10000); |
| 614 | |
| 615 | memory_set_bankptr(machine, 1, &ROM[0x20000]); |
| 616 | |
| 617 | wram_bank = 0; |
| 524 | 618 | } |
| 525 | 619 | |
| 526 | 620 | static MACHINE_RESET(pc9821) |
| 527 | 621 | { |
| 622 | UINT8 *ROM = memory_region(machine, "cpudata"); |
| 528 | 623 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); |
| 624 | |
| 625 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, 0); |
| 626 | |
| 627 | gate_a20 = 0; |
| 628 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), I386_EIP, 0xffff0+0x10000); |
| 629 | |
| 630 | memory_set_bankptr(machine, 1, &ROM[0x20000]); |
| 631 | |
| 632 | wram_bank = 0; |
| 529 | 633 | } |
| 530 | 634 | |
| 531 | 635 | /************************************************************* |
| r6054 | r6055 | |
| 817 | 921 | |
| 818 | 922 | /* I strongly suspect this dump comes from a later machine, like an i386-based one, but I could be wrong... */ |
| 819 | 923 | ROM_START( pc9801 ) |
| 820 | | ROM_REGION( 0x20000, "maincpu", 0 ) |
| 821 | | ROM_LOAD( "bios.rom", 0x00000, 0x18000, CRC(315d2703) SHA1(4f208d1dbb68373080d23bff5636bb6b71eb7565) ) |
| 822 | | ROM_LOAD( "itf.rom", 0x18000, 0x08000, CRC(c1815325) SHA1(a2fb11c000ed7c976520622cfb7940ed6ddc904e) ) |
| 924 | ROM_REGION( 0x60000, "cpudata", ROMREGION_ERASEFF ) |
| 925 | ROM_LOAD( "bios.rom", 0x08000, 0x18000, CRC(315d2703) SHA1(4f208d1dbb68373080d23bff5636bb6b71eb7565) ) |
| 926 | ROM_LOAD( "itf.rom", 0x38000, 0x08000, CRC(c1815325) SHA1(a2fb11c000ed7c976520622cfb7940ed6ddc904e) ) |
| 823 | 927 | |
| 824 | 928 | /* where shall we load this? */ |
| 825 | 929 | ROM_REGION( 0x100000, "memory", 0 ) |
| r6054 | r6055 | |
| 840 | 944 | ROM_END |
| 841 | 945 | |
| 842 | 946 | ROM_START( pc9821 ) |
| 843 | | ROM_REGION( 0x20000, "maincpu", 0 ) |
| 844 | | ROM_LOAD( "bios.rom", 0x00000, 0x18000, CRC(34a19a59) SHA1(2e92346727b0355bc1ec9a7ded1b444a4917f2b9) ) |
| 845 | | ROM_LOAD( "itf.rom", 0x00000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) |
| 947 | ROM_REGION( 0x60000, "maincpu", ROMREGION_ERASEFF ) |
| 948 | ROM_LOAD( "bios.rom", 0x08000, 0x18000, CRC(34a19a59) SHA1(2e92346727b0355bc1ec9a7ded1b444a4917f2b9) ) |
| 949 | ROM_LOAD( "itf.rom", 0x38000, 0x08000, CRC(dd4c7bb8) SHA1(cf3aa193df2722899066246bccbed03f2e79a74a) ) |
| 846 | 950 | |
| 847 | 951 | ROM_REGION( 0x10000, "soundcpu", 0 ) |
| 848 | 952 | ROM_LOAD( "sound.rom", 0x0000, 0x4000, CRC(a21ef796) SHA1(34137c287c39c44300b04ee97c1e6459bb826b60) ) |