Previous 199869 Revisions Next

r23826 Friday 21st June, 2013 at 01:12:02 UTC by Angelo Salese
Experimenting with Savage Quest, nw
[src/mame/drivers]savquest.c

trunk/src/mame/drivers/savquest.c
r23825r23826
88   TODO:
99   - currently asserts by selecting a s3 video bank above 1M (register 0x6a)
1010
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============================================================================
1123    H/W is a white-box PC consisting of:
1224    Pentium II 450 CPU
1325    DFI P2XBL motherboard (i440BX chipset)
r23825r23826
4658{
4759public:
4860   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")
5063   {
5164   }
5265
r23825r23826
5669   UINT32 *m_bios_e8000_ram;
5770   UINT32 *m_bios_ec000_ram;
5871
72   UINT8 *m_smram;
73
74   required_device<s3_vga_device> m_vga;
75
5976   int m_haspind;
6077   int m_haspstate;
6178   enum hasp_states
r23825r23826
84101
85102   DECLARE_WRITE_LINE_MEMBER(vblank_assert);
86103
104   DECLARE_READ8_MEMBER(smram_r);
105   DECLARE_WRITE8_MEMBER(smram_w);
106
87107protected:
88108
89109
r23825r23826
102122   savquest_state *state = busdevice->machine().driver_data<savquest_state>();
103123//  mame_printf_debug("MXTC: read %d, %02X\n", function, reg);
104124
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
105131   return state->m_mxtc_config_reg[reg];
106132}
107133
r23825r23826
183209   m_mxtc_config_reg[0x63] = 0x02;
184210   m_mxtc_config_reg[0x64] = 0x02;
185211   m_mxtc_config_reg[0x65] = 0x02;
212   m_smram = auto_alloc_array(machine(), UINT8, 0x20000);
186213}
187214
188215static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r23825r23826
233260{
234261   savquest_state *state = busdevice->machine().driver_data<savquest_state>();
235262//  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
236276   return state->m_piix4_config_reg[function][reg];
237277}
238278
r23825r23826
536576   }
537577}
538578
579READ8_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
588WRITE8_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
539598static ADDRESS_MAP_START(savquest_map, AS_PROGRAM, 32, savquest_state)
540599   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)
542601   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
543602   AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK("bios_f0000") AM_WRITE(bios_f0000_ram_w)
544603   AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_e0000") AM_WRITE(bios_e0000_ram_w)
545604   AM_RANGE(0x000e4000, 0x000e7fff) AM_ROMBANK("bios_e4000") AM_WRITE(bios_e4000_ram_w)
546605   AM_RANGE(0x000e8000, 0x000ebfff) AM_ROMBANK("bios_e8000") AM_WRITE(bios_e8000_ram_w)
547606   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
550608   AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("bios", 0)    /* System BIOS */
551609ADDRESS_MAP_END
552610

Previous 199869 Revisions Next


© 1997-2024 The MAME Team