trunk/src/mame/drivers/savquest.c
| r23825 | r23826 | |
| 8 | 8 | TODO: |
| 9 | 9 | - currently asserts by selecting a s3 video bank above 1M (register 0x6a) |
| 10 | 10 | |
| 11 | PCI list: |
| 12 | Bus no. Device No. Func No. Vendor ID Device ID Device Class IRQ |
| 13 | 0 7 1 8086 7111 IDE Controller 14 |
| 14 | 0 7 2 8086 7112 Serial Bus Controller 11 |
| 15 | 0 9 0 5333 8901 Display Controller 10 |
| 16 | 0 13 0 121a 0002 Multimedia Device NA |
| 17 | - First two are PIIX4/4E/4M IDE Controller / PIIX4/4E/4M USB Interface |
| 18 | Third is S3 trio64uv+ |
| 19 | Fourth is Voodoo 2 3D Accelerator |
| 20 | Sound Blaster is ISA/PNP |
| 21 | |
| 22 | ============================================================================ |
| 11 | 23 | H/W is a white-box PC consisting of: |
| 12 | 24 | Pentium II 450 CPU |
| 13 | 25 | DFI P2XBL motherboard (i440BX chipset) |
| r23825 | r23826 | |
| 46 | 58 | { |
| 47 | 59 | public: |
| 48 | 60 | savquest_state(const machine_config &mconfig, device_type type, const char *tag) |
| 49 | | : pcat_base_state(mconfig, type, tag) |
| 61 | : pcat_base_state(mconfig, type, tag), |
| 62 | m_vga(*this, "vga") |
| 50 | 63 | { |
| 51 | 64 | } |
| 52 | 65 | |
| r23825 | r23826 | |
| 56 | 69 | UINT32 *m_bios_e8000_ram; |
| 57 | 70 | UINT32 *m_bios_ec000_ram; |
| 58 | 71 | |
| 72 | UINT8 *m_smram; |
| 73 | |
| 74 | required_device<s3_vga_device> m_vga; |
| 75 | |
| 59 | 76 | int m_haspind; |
| 60 | 77 | int m_haspstate; |
| 61 | 78 | enum hasp_states |
| r23825 | r23826 | |
| 84 | 101 | |
| 85 | 102 | DECLARE_WRITE_LINE_MEMBER(vblank_assert); |
| 86 | 103 | |
| 104 | DECLARE_READ8_MEMBER(smram_r); |
| 105 | DECLARE_WRITE8_MEMBER(smram_w); |
| 106 | |
| 87 | 107 | protected: |
| 88 | 108 | |
| 89 | 109 | |
| r23825 | r23826 | |
| 102 | 122 | savquest_state *state = busdevice->machine().driver_data<savquest_state>(); |
| 103 | 123 | // mame_printf_debug("MXTC: read %d, %02X\n", function, reg); |
| 104 | 124 | |
| 125 | if((reg & 0xfe) == 0) |
| 126 | return (reg & 1) ? 0x80 : 0x86; // Vendor ID, Intel |
| 127 | |
| 128 | if((reg & 0xfe) == 2) |
| 129 | return (reg & 1) ? 0x70 : 0x00; // Device ID, MXTC |
| 130 | |
| 105 | 131 | return state->m_mxtc_config_reg[reg]; |
| 106 | 132 | } |
| 107 | 133 | |
| r23825 | r23826 | |
| 183 | 209 | m_mxtc_config_reg[0x63] = 0x02; |
| 184 | 210 | m_mxtc_config_reg[0x64] = 0x02; |
| 185 | 211 | m_mxtc_config_reg[0x65] = 0x02; |
| 212 | m_smram = auto_alloc_array(machine(), UINT8, 0x20000); |
| 186 | 213 | } |
| 187 | 214 | |
| 188 | 215 | static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) |
| r23825 | r23826 | |
| 233 | 260 | { |
| 234 | 261 | savquest_state *state = busdevice->machine().driver_data<savquest_state>(); |
| 235 | 262 | // mame_printf_debug("PIIX4: read %d, %02X\n", function, reg); |
| 263 | |
| 264 | if((reg & 0xfe) == 0) |
| 265 | return (reg & 1) ? 0x80 : 0x86; // Vendor ID, Intel |
| 266 | |
| 267 | if((reg & 0xfe) == 2) |
| 268 | { |
| 269 | /* TODO: it isn't detected properly (i.e. PCI writes always goes to function == 0) */ |
| 270 | if(function == 1) |
| 271 | return (reg & 1) ? 0x71 : 0x11; // Device ID, 82371AB IDE Controller |
| 272 | if(function == 2) |
| 273 | return (reg & 1) ? 0x71 : 0x12; // Device ID, 82371AB Serial Bus Controller |
| 274 | } |
| 275 | |
| 236 | 276 | return state->m_piix4_config_reg[function][reg]; |
| 237 | 277 | } |
| 238 | 278 | |
| r23825 | r23826 | |
| 536 | 576 | } |
| 537 | 577 | } |
| 538 | 578 | |
| 579 | READ8_MEMBER(savquest_state::smram_r) |
| 580 | { |
| 581 | /* TODO: way more complex than this */ |
| 582 | if(m_mxtc_config_reg[0x72] & 0x40) |
| 583 | return m_smram[offset]; |
| 584 | else |
| 585 | return m_vga->mem_r(space,offset,0xff); |
| 586 | } |
| 587 | |
| 588 | WRITE8_MEMBER(savquest_state::smram_w) |
| 589 | { |
| 590 | /* TODO: way more complex than this */ |
| 591 | if(m_mxtc_config_reg[0x72] & 0x40) |
| 592 | m_smram[offset] = data; |
| 593 | else |
| 594 | m_vga->mem_w(space,offset,data,0xff); |
| 595 | |
| 596 | } |
| 597 | |
| 539 | 598 | static ADDRESS_MAP_START(savquest_map, AS_PROGRAM, 32, savquest_state) |
| 540 | 599 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAM |
| 541 | | AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) |
| 600 | AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8(smram_r,smram_w,0xffffffff) //AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) |
| 542 | 601 | AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) |
| 543 | 602 | AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bios_f0000") AM_WRITE(bios_f0000_ram_w) |
| 544 | 603 | AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_e0000") AM_WRITE(bios_e0000_ram_w) |
| 545 | 604 | AM_RANGE(0x000e4000, 0x000e7fff) AM_ROMBANK("bios_e4000") AM_WRITE(bios_e4000_ram_w) |
| 546 | 605 | AM_RANGE(0x000e8000, 0x000ebfff) AM_ROMBANK("bios_e8000") AM_WRITE(bios_e8000_ram_w) |
| 547 | 606 | AM_RANGE(0x000ec000, 0x000effff) AM_ROMBANK("bios_ec000") AM_WRITE(bios_ec000_ram_w) |
| 548 | | AM_RANGE(0x00100000, 0x01ffffff) AM_RAM |
| 549 | | // AM_RANGE(0x02000000, 0x02000003) // protection dongle lies there? |
| 607 | AM_RANGE(0x00100000, 0x07ffffff) AM_RAM // 128MB RAM |
| 550 | 608 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("bios", 0) /* System BIOS */ |
| 551 | 609 | ADDRESS_MAP_END |
| 552 | 610 | |