diff options
-rw-r--r-- | src/devices/bus/isa/mach32.cpp | 89 | ||||
-rw-r--r-- | src/devices/bus/isa/mach32.h | 42 | ||||
-rw-r--r-- | src/devices/bus/isa/vga_ati.cpp | 23 | ||||
-rw-r--r-- | src/devices/video/pc_vga.cpp | 126 | ||||
-rw-r--r-- | src/devices/video/pc_vga.h | 15 |
5 files changed, 260 insertions, 35 deletions
diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index 328072ca7a9..ecad0a425a0 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -14,7 +14,6 @@ #include "screen.h" - DEFINE_DEVICE_TYPE(ATIMACH32, mach32_device, "mach32", "ATi mach32") DEFINE_DEVICE_TYPE(ATIMACH32_8514A, mach32_8514a_device, "mach32_8514a", "ATi mach32 (2D acceleration module)") DEFINE_DEVICE_TYPE(ATIMACH64, mach64_device, "mach64", "ATi mach64") @@ -55,7 +54,7 @@ MACHINE_CONFIG_END void mach32_8514a_device::device_config_complete() { - m_vga = dynamic_cast<vga_device*>(owner()); + m_vga = dynamic_cast<svga_device*>(owner()); } void mach32_8514a_device::device_start() @@ -65,10 +64,91 @@ void mach32_8514a_device::device_start() // 177h 68800-LX // 2F7h 68800-6 // The 68800-3 appears to return 0 for this field (undocumented) - m_chip_ID = 0x000; + m_chip_ID = 0x17; m_membounds = 0; } +// Configuration Status Register 1 (read only) +// bit 0: Disable VGA: 0=VGA+8514/A, 1=8514/A only +// bits 1-3: Bus Type: 0=16-bit ISA. 1=EISA, 2=16-bit MCA, 3=32-bit MCA, 4=LBus 386SX +// 5=LBus 386DX, 6=LBus 486. 7=PCI +// bits 4-6: RAM Type: 3=256Kx16 DRAM +// bit 7: Chip Disable +// bit 8: TST_VCTR_ENA: 1=delay memory write by 1/2 MCLK to test vector generation +// bits 9-11: DAC Type: 0=ATI68830, 1=SC11483, 2=ATI68875, 3=Bt476, 4=Bt481, 5=ATI68860 (68800AX or higher) +// The Graphics Ultra Pro has an ATI68875 +// bit 12: Enable internal uC address decode +// bit 13-15: Card ID: ID when using multiple controllers +READ16_MEMBER(mach32_8514a_device::mach32_config1_r) +{ + return 0x0430; // enable VGA, 16-bit ISA, 256Kx16 DRAM, ATI68875 +} + +// mach32 Hardware Pointer +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_l_w) +{ + if(offset == 1) + m_cursor_address = (m_cursor_address & 0xf0000) | data; +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_h_w) +{ + if(offset == 1) + { + m_cursor_address = (m_cursor_address & 0x0ffff) | ((data & 0x000f) << 16); + m_cursor_enable = data & 0x8000; + if(m_cursor_enable) popmessage("mach32 Hardware Cursor enabled"); + } +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_pos_h) +{ + if(offset == 1) + m_cursor_horizontal = data & 0x07ff; +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_pos_v) +{ + if(offset == 1) + m_cursor_vertical = data & 0x0fff; +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_colour_b_w) +{ + if(offset == 1) + { + m_cursor_colour0_b = data & 0xff; + m_cursor_colour1_b = data >> 8; + } +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_colour_0_w) +{ + if(offset == 1) + { + m_cursor_colour0_g = data & 0xff; + m_cursor_colour0_r = data >> 8; + } +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_colour_1_w) +{ + if(offset == 1) + { + m_cursor_colour1_g = data & 0xff; + m_cursor_colour1_r = data >> 8; + } +} + +WRITE16_MEMBER(mach32_8514a_device::mach32_cursor_offset_w) +{ + if(offset == 1) + { + m_cursor_horizontal = data & 0x00ff; + m_cursor_vertical = data >> 8; + } +} + void mach32_8514a_device::device_reset() { } @@ -76,6 +156,7 @@ void mach32_8514a_device::device_reset() void mach32_device::device_start() { ati_vga_device::device_start(); + ati.vga_chip_id = 0x00; // correct? } void mach32_device::device_reset() @@ -117,7 +198,7 @@ MACHINE_CONFIG_END void mach64_8514a_device::device_config_complete() { - m_vga = dynamic_cast<vga_device*>(owner()); + m_vga = dynamic_cast<svga_device*>(owner()); } void mach64_8514a_device::device_start() diff --git a/src/devices/bus/isa/mach32.h b/src/devices/bus/isa/mach32.h index db2f8bdc2af..80df99c3f86 100644 --- a/src/devices/bus/isa/mach32.h +++ b/src/devices/bus/isa/mach32.h @@ -26,6 +26,18 @@ public: DECLARE_READ16_MEMBER(mach32_mem_boundary_r) { return m_membounds; } DECLARE_WRITE16_MEMBER(mach32_mem_boundary_w) { m_membounds = data; if(data & 0x10) logerror("ATI: Unimplemented memory boundary activated."); } + DECLARE_READ16_MEMBER(mach32_config1_r); + DECLARE_WRITE16_MEMBER(mach32_horz_overscan_w) {} // TODO + DECLARE_READ16_MEMBER(mach32_ext_ge_r) { return 0x0000; } // TODO + DECLARE_WRITE16_MEMBER(mach32_cursor_pos_h); + DECLARE_WRITE16_MEMBER(mach32_cursor_pos_v); + DECLARE_WRITE16_MEMBER(mach32_cursor_colour_b_w); + DECLARE_WRITE16_MEMBER(mach32_cursor_colour_0_w); + DECLARE_WRITE16_MEMBER(mach32_cursor_colour_1_w); + DECLARE_WRITE16_MEMBER(mach32_cursor_l_w); + DECLARE_WRITE16_MEMBER(mach32_cursor_h_w); + DECLARE_WRITE16_MEMBER(mach32_cursor_offset_w); + protected: mach32_8514a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -35,6 +47,20 @@ protected: uint16_t m_chip_ID; uint16_t m_membounds; + + // hardware pointer + bool m_cursor_enable; + uint32_t m_cursor_address; + uint16_t m_cursor_horizontal; + uint16_t m_cursor_vertical; + uint8_t m_cursor_colour0_b; + uint8_t m_cursor_colour0_r; + uint8_t m_cursor_colour0_g; + uint8_t m_cursor_colour1_b; + uint8_t m_cursor_colour1_r; + uint8_t m_cursor_colour1_g; + uint8_t m_cursor_offset_horizontal; + uint8_t m_cursor_offset_vertical; }; // main SVGA device @@ -75,7 +101,7 @@ public: DECLARE_READ16_MEMBER(ibm8514_vtotal_r) { return m_8514a->ibm8514_vtotal_r(space,offset,mem_mask); } DECLARE_WRITE16_MEMBER(ibm8514_vtotal_w) { m_8514a->ibm8514_vtotal_w(space,offset,data,mem_mask); } DECLARE_READ16_MEMBER(ibm8514_htotal_r) { return m_8514a->ibm8514_htotal_r(space,offset,mem_mask); } - DECLARE_WRITE16_MEMBER(ibm8514_htotal_w) { m_8514a->ibm8514_htotal_w(space,offset,data,mem_mask); } + DECLARE_WRITE8_MEMBER(ibm8514_htotal_w) { m_8514a->ibm8514_htotal_w(space,offset,data,mem_mask); } DECLARE_READ16_MEMBER(ibm8514_vdisp_r) { return m_8514a->ibm8514_vdisp_r(space,offset,mem_mask); } DECLARE_WRITE16_MEMBER(ibm8514_vdisp_w) { m_8514a->ibm8514_vdisp_w(space,offset,data,mem_mask); } DECLARE_READ16_MEMBER(ibm8514_vsync_r) { return m_8514a->ibm8514_vsync_r(space,offset,mem_mask); } @@ -121,7 +147,19 @@ public: DECLARE_WRITE16_MEMBER(mach32_clksel_w) { m_8514a->mach32_clksel_w(space,offset,data,mem_mask); } // read only on the mach8 DECLARE_READ16_MEMBER(mach32_mem_boundary_r) { return m_8514a->mach32_mem_boundary_r(space,offset,mem_mask); } DECLARE_WRITE16_MEMBER(mach32_mem_boundary_w) { m_8514a->mach32_mem_boundary_w(space,offset,data,mem_mask); } // read only on the mach8 - DECLARE_READ16_MEMBER(mach32_status_r) { return vga_vblank() << 1; } + DECLARE_READ8_MEMBER(mach32_status_r) { return m_8514a->ibm8514_status_r(space,offset,mem_mask); } + DECLARE_READ16_MEMBER(mach32_config1_r) { return m_8514a->mach32_config1_r(space,offset,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_horz_overscan_w) { m_8514a->mach32_horz_overscan_w(space,offset,mem_mask); } + DECLARE_READ16_MEMBER(mach32_ext_ge_r) { return m_8514a->mach32_ext_ge_r(space,offset,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_pos_h) { m_8514a->mach32_cursor_pos_h(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_pos_v) { m_8514a->mach32_cursor_pos_v(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_colour_b_w) { m_8514a->mach32_cursor_colour_b_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_colour_0_w) { m_8514a->mach32_cursor_colour_0_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_colour_1_w) { m_8514a->mach32_cursor_colour_1_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_l_w) { m_8514a->mach32_cursor_l_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_h_w) { m_8514a->mach32_cursor_h_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach32_cursor_offset_w) { m_8514a->mach32_cursor_offset_w(space,offset,data,mem_mask); } + DECLARE_READ16_MEMBER(mach32_readonly_r) { return 0; } protected: mach32_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/bus/isa/vga_ati.cpp b/src/devices/bus/isa/vga_ati.cpp index b9cf8af71a1..5a5f011a077 100644 --- a/src/devices/bus/isa/vga_ati.cpp +++ b/src/devices/bus/isa/vga_ati.cpp @@ -68,8 +68,8 @@ ROM_END // GLOBAL VARIABLES //************************************************************************** -DEFINE_DEVICE_TYPE(ISA16_VGA_GFXULTRA, isa16_vga_gfxultra_device, "gfxulra", "ATi Graphics Ultra Card") -DEFINE_DEVICE_TYPE(ISA16_SVGA_GFXULTRAPRO, isa16_vga_gfxultrapro_device, "gfxxultrp", "ATi Graphics Ultra Pro Card") +DEFINE_DEVICE_TYPE(ISA16_VGA_GFXULTRA, isa16_vga_gfxultra_device, "gfxultra", "ATi Graphics Ultra Card") +DEFINE_DEVICE_TYPE(ISA16_SVGA_GFXULTRAPRO, isa16_vga_gfxultrapro_device, "gfxultrap", "ATi Graphics Ultra Pro Card") DEFINE_DEVICE_TYPE(ISA16_SVGA_MACH64, isa16_vga_mach64_device, "mach64isa", "ATi mach64 Card") //------------------------------------------------- @@ -171,7 +171,7 @@ void isa16_vga_gfxultra_device::device_start() m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "gfxultra"); m_isa->install_device(0x1ce, 0x1cf, read8_delegate(FUNC(ati_vga_device::ati_port_ext_r),m_vga), write8_delegate(FUNC(ati_vga_device::ati_port_ext_w),m_vga)); - m_isa->install16_device(0x2e8, 0x2eb, read16_delegate(FUNC(mach8_device::ibm8514_status_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_htotal_w),m_8514)); + m_isa->install_device(0x2e8, 0x2ef, read8_delegate(FUNC(mach8_device::ibm8514_status_r),m_8514), write8_delegate(FUNC(mach8_device::ibm8514_htotal_w),m_8514)); m_isa->install_device(0x3b0, 0x3bf, read8_delegate(FUNC(ati_vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(vga_device::port_03b0_w),m_vga)); m_isa->install_device(0x3c0, 0x3cf, read8_delegate(FUNC(ati_vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(vga_device::port_03c0_w),m_vga)); m_isa->install_device(0x3d0, 0x3df, read8_delegate(FUNC(ati_vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(vga_device::port_03d0_w),m_vga)); @@ -223,17 +223,23 @@ void isa16_vga_gfxultrapro_device::device_start() m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "gfxultrapro"); m_isa->install_device(0x1ce, 0x1cf, read8_delegate(FUNC(mach32_device::ati_port_ext_r),m_vga), write8_delegate(FUNC(mach32_device::ati_port_ext_w),m_vga)); - m_isa->install16_device(0x2e8, 0x2eb, read16_delegate(FUNC(mach32_device::mach32_status_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_htotal_w),m_vga)); + m_isa->install_device(0x2e8, 0x2ef, read8_delegate(FUNC(mach32_device::mach32_status_r),m_vga), write8_delegate(FUNC(mach32_device::ibm8514_htotal_w),m_vga)); m_isa->install_device(0x3b0, 0x3bf, read8_delegate(FUNC(mach32_device::port_03b0_r),m_vga), write8_delegate(FUNC(mach32_device::port_03b0_w),m_vga)); m_isa->install_device(0x3c0, 0x3cf, read8_delegate(FUNC(mach32_device::port_03c0_r),m_vga), write8_delegate(FUNC(mach32_device::port_03c0_w),m_vga)); m_isa->install_device(0x3d0, 0x3df, read8_delegate(FUNC(mach32_device::port_03d0_r),m_vga), write8_delegate(FUNC(mach32_device::port_03d0_w),m_vga)); + m_isa->install16_device(0xaec, 0xaef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_l_w),m_vga)); + m_isa->install16_device(0xeec, 0xeef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_h_w),m_vga)); m_isa->install16_device(0x12e8, 0x12eb, read16_delegate(FUNC(mach32_device::ibm8514_vtotal_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_vtotal_w),m_vga)); - m_isa->install16_device(0x12ec, 0x12ef, read16_delegate(FUNC(mach32_device::mach8_config1_r),m_vga), write16_delegate()); + m_isa->install16_device(0x12ec, 0x12ef, read16_delegate(FUNC(mach32_device::mach32_config1_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_pos_h),m_vga)); m_isa->install16_device(0x16e8, 0x16eb, read16_delegate(FUNC(mach32_device::ibm8514_vdisp_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_vdisp_w),m_vga)); - m_isa->install16_device(0x16ec, 0x16ef, read16_delegate(FUNC(mach32_device::mach8_config2_r),m_vga), write16_delegate()); + m_isa->install16_device(0x16ec, 0x16ef, read16_delegate(FUNC(mach32_device::mach8_config2_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_pos_v),m_vga)); m_isa->install16_device(0x1ae8, 0x1aeb, read16_delegate(FUNC(mach32_device::ibm8514_vsync_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_vsync_w),m_vga)); + m_isa->install16_device(0x1aec, 0x1aef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_colour_b_w),m_vga)); + m_isa->install16_device(0x1eec, 0x1eef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_offset_w),m_vga)); m_isa->install16_device(0x26e8, 0x26eb, read16_delegate(FUNC(mach32_device::ibm8514_htotal_r),m_vga),write16_delegate()); m_isa->install16_device(0x2ee8, 0x2eeb, read16_delegate(FUNC(mach32_device::ibm8514_subcontrol_r),m_vga),write16_delegate()); + m_isa->install16_device(0x3aec, 0x3aef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_colour_0_w),m_vga)); + m_isa->install16_device(0x3eec, 0x3eef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_cursor_colour_0_w),m_vga)); m_isa->install16_device(0x42e8, 0x42eb, read16_delegate(FUNC(mach32_device::ibm8514_substatus_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_subcontrol_w),m_vga)); m_isa->install16_device(0x42ec, 0x42ef, read16_delegate(FUNC(mach32_device::mach32_mem_boundary_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_mem_boundary_w),m_vga)); m_isa->install16_device(0x4aec, 0x4aef, read16_delegate(FUNC(mach32_device::mach8_clksel_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_clksel_w),m_vga)); @@ -243,6 +249,7 @@ void isa16_vga_gfxultrapro_device::device_start() m_isa->install16_device(0x56ec, 0x56ef, read16_delegate(FUNC(mach32_device::mach8_scratch0_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_scratch0_w),m_vga)); m_isa->install16_device(0x5ae8, 0x5aeb, read16_delegate(FUNC(mach32_device::mach8_ec2_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ec2_w),m_vga)); m_isa->install16_device(0x5ee8, 0x5eeb, read16_delegate(FUNC(mach32_device::mach8_ec3_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ec3_w),m_vga)); + m_isa->install16_device(0x62ec, 0x62ef, read16_delegate(FUNC(mach32_device::mach32_ext_ge_r),m_vga), write16_delegate(FUNC(mach32_device::mach32_horz_overscan_w),m_vga)); m_isa->install16_device(0x82e8, 0x82eb, read16_delegate(FUNC(mach32_device::ibm8514_currenty_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_currenty_w),m_vga)); m_isa->install16_device(0x86e8, 0x86eb, read16_delegate(FUNC(mach32_device::ibm8514_currentx_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_currentx_w),m_vga)); m_isa->install16_device(0x8ae8, 0x8aeb, read16_delegate(FUNC(mach32_device::ibm8514_desty_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_desty_w),m_vga)); @@ -278,12 +285,12 @@ void isa16_vga_mach64_device::device_start() m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "mach64"); m_isa->install_device(0x1ce, 0x1cf, read8_delegate(FUNC(mach64_device::ati_port_ext_r),m_vga), write8_delegate(FUNC(mach64_device::ati_port_ext_w),m_vga)); - m_isa->install16_device(0x2e8, 0x2eb, read16_delegate(FUNC(mach64_device::mach32_status_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_htotal_w),m_vga)); + m_isa->install_device(0x2e8, 0x2ef, read8_delegate(FUNC(mach64_device::mach32_status_r),m_vga), write8_delegate(FUNC(mach64_device::ibm8514_htotal_w),m_vga)); m_isa->install_device(0x3b0, 0x3bf, read8_delegate(FUNC(mach64_device::port_03b0_r),m_vga), write8_delegate(FUNC(mach64_device::port_03b0_w),m_vga)); m_isa->install_device(0x3c0, 0x3cf, read8_delegate(FUNC(mach64_device::port_03c0_r),m_vga), write8_delegate(FUNC(mach64_device::port_03c0_w),m_vga)); m_isa->install_device(0x3d0, 0x3df, read8_delegate(FUNC(mach64_device::port_03d0_r),m_vga), write8_delegate(FUNC(mach64_device::port_03d0_w),m_vga)); m_isa->install16_device(0x12e8, 0x12eb, read16_delegate(FUNC(mach64_device::ibm8514_vtotal_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_vtotal_w),m_vga)); - m_isa->install16_device(0x12ec, 0x12ef, read16_delegate(FUNC(mach64_device::mach8_config1_r),m_vga), write16_delegate(FUNC(mach64_device::mach64_config1_w),m_vga)); + m_isa->install16_device(0x12ec, 0x12ef, read16_delegate(FUNC(mach64_device::mach32_config1_r),m_vga), write16_delegate(FUNC(mach64_device::mach64_config1_w),m_vga)); m_isa->install16_device(0x16e8, 0x16eb, read16_delegate(FUNC(mach64_device::ibm8514_vdisp_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_vdisp_w),m_vga)); m_isa->install16_device(0x16ec, 0x16ef, read16_delegate(FUNC(mach64_device::mach8_config2_r),m_vga), write16_delegate(FUNC(mach64_device::mach64_config2_w),m_vga)); m_isa->install16_device(0x1ae8, 0x1aeb, read16_delegate(FUNC(mach64_device::ibm8514_vsync_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_vsync_w),m_vga)); diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index 5922fece577..fe395314877 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -418,7 +418,7 @@ void ibm8514a_device::device_config_complete() { if(m_vga_tag.length() != 0) { - m_vga = machine().device<vga_device>(m_vga_tag.c_str()); + m_vga = machine().device<svga_device>(m_vga_tag.c_str()); } } @@ -1077,6 +1077,22 @@ uint8_t svga_device::pc_vga_choosevideomode() return SCREEN_OFF; } +uint8_t svga_device::get_video_depth() +{ + switch(pc_vga_choosevideomode()) + { + case VGA_MODE: + case RGB8_MODE: + return 8; + case RGB15_MODE: + case RGB16_MODE: + return 16; + case RGB24_MODE: + case RGB32_MODE: + return 32; + } + return 0; +} uint32_t vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { @@ -2703,6 +2719,8 @@ uint8_t s3_vga_device::s3_crtc_reg_read(uint8_t index) break; case 0x45: res = s3.cursor_mode; + s3.cursor_fg_ptr = 0; + s3.cursor_bg_ptr = 0; break; case 0x46: res = (s3.cursor_x & 0xff00) >> 8; @@ -2717,12 +2735,12 @@ uint8_t s3_vga_device::s3_crtc_reg_read(uint8_t index) res = s3.cursor_y & 0x00ff; break; case 0x4a: - res = s3.cursor_fg[s3.cursor_fg_ptr]; - s3.cursor_fg_ptr = 0; + res = s3.cursor_fg[s3.cursor_fg_ptr++]; + s3.cursor_fg_ptr %= 4; break; case 0x4b: - res = s3.cursor_bg[s3.cursor_bg_ptr]; - s3.cursor_bg_ptr = 0; + res = s3.cursor_bg[s3.cursor_bg_ptr++]; + s3.cursor_bg_ptr %= 4; break; case 0x4c: res = (s3.cursor_start_addr & 0xff00) >> 8; @@ -2973,9 +2991,11 @@ bit 0-9 (911,924) HCS_STADR. Hardware Graphics Cursor Storage Start Address */ case 0x4c: s3.cursor_start_addr = (s3.cursor_start_addr & 0x00ff) | (data << 8); + popmessage("HW Cursor Data Address %04x\n",s3.cursor_start_addr); break; case 0x4d: s3.cursor_start_addr = (s3.cursor_start_addr & 0xff00) | data; + popmessage("HW Cursor Data Address %04x\n",s3.cursor_start_addr); break; /* 3d4h index 4Eh (R/W): CR4E HGC Pattern Disp Start X-Pixel Position @@ -5276,16 +5296,20 @@ READ8_MEMBER(ati_vga_device::ati_port_ext_r) switch(ati.ext_reg_select) { case 0x20: - ret = 0x10; // 512kB memory + ret = 0x10; // 16-bit ROM access + logerror("ATI20 read\n"); break; case 0x28: // Vertical line counter (high) ret = (machine().first_screen()->vpos() >> 8) & 0x03; + logerror("ATI28 (vertical line high) read\n"); break; case 0x29: // Vertical line counter (low) ret = machine().first_screen()->vpos() & 0xff; // correct? + logerror("ATI29 (vertical line low) read\n"); break; case 0x2a: - ret = ati.vga_chip_id; // Chip revision (6 for the 28800-6, 5 for the 28800-5) + ret = ati.vga_chip_id; // Chip revision (6 for the 28800-6, 5 for the 28800-5) This register is not listed in ATI's mach32 docs + logerror("ATI2A (VGA ID) read\n"); break; case 0x37: { @@ -5297,6 +5321,7 @@ READ8_MEMBER(ati_vga_device::ati_port_ext_r) case 0x3d: ret = ati.ext_reg[ati.ext_reg_select] & 0x0f; ret |= 0x10; // EGA DIP switch emulation + logerror("ATI3D (EGA DIP emulation) read\n"); break; default: ret = ati.ext_reg[ati.ext_reg_select]; @@ -5321,8 +5346,17 @@ WRITE8_MEMBER(ati_vga_device::ati_port_ext_w) case 0x23: vga.crtc.start_addr_latch = (vga.crtc.start_addr_latch & 0xfffdffff) | ((data & 0x10) << 13); vga.crtc.cursor_addr = (vga.crtc.cursor_addr & 0xfffdffff) | ((data & 0x08) << 14); + ati.ext_reg[ati.ext_reg_select] = data & 0x1f; logerror("ATI: ATI23 write %02x\n",data); break; + case 0x26: + ati.ext_reg[ati.ext_reg_select] = data & 0xc9; + logerror("ATI: ATI26 write %02x\n",data); + break; + case 0x2b: + ati.ext_reg[ati.ext_reg_select] = data & 0xdf; + logerror("ATI: ATI2B write %02x\n",data); + break; case 0x2d: if(data & 0x08) { @@ -5335,8 +5369,13 @@ WRITE8_MEMBER(ati_vga_device::ati_port_ext_w) case 0x30: vga.crtc.start_addr_latch = (vga.crtc.start_addr_latch & 0xfffeffff) | ((data & 0x40) << 10); vga.crtc.cursor_addr = (vga.crtc.cursor_addr & 0xfffeffff) | ((data & 0x04) << 14); + ati.ext_reg[ati.ext_reg_select] = data & 0x7d; logerror("ATI: ATI30 write %02x\n",data); break; + case 0x31: + ati.ext_reg[ati.ext_reg_select] = data & 0x7f; + logerror("ATI: ATI31 write %02x\n",data); + break; case 0x32: // memory page select if(ati.ext_reg[0x3e] & 0x08) { @@ -5351,6 +5390,7 @@ WRITE8_MEMBER(ati_vga_device::ati_port_ext_w) //logerror("ATI: Memory Page Select write %02x (read: %i write %i)\n",data,svga.bank_r,svga.bank_w); break; case 0x33: // EEPROM + ati.ext_reg[ati.ext_reg_select] = data & 0xef; if(data & 0x04) { eeprom_serial_93cxx_device* eep = subdevice<eeprom_serial_93cxx_device>("ati_eeprom"); @@ -5364,6 +5404,34 @@ WRITE8_MEMBER(ati_vga_device::ati_port_ext_w) else logerror("ATI: ATI33 write %02x\n",data); break; + case 0x38: + ati.ext_reg[ati.ext_reg_select] = data & 0xef; + logerror("ATI: ATI38 write %02x\n",data); + break; + case 0x39: + ati.ext_reg[ati.ext_reg_select] = data & 0xfe; + logerror("ATI: ATI39 write %02x\n",data); + break; + case 0x3a: // General purpose read-write bits + ati.ext_reg[ati.ext_reg_select] = data & 0x07; + logerror("ATI: ATI3A write %02x\n",data); + break; + case 0x3c: // Reserved, should be 0 + ati.ext_reg[ati.ext_reg_select] = 0; + logerror("ATI: ATI3C write %02x\n",data); + break; + case 0x3d: + ati.ext_reg[ati.ext_reg_select] = data & 0xfd; + logerror("ATI: ATI3D write %02x\n",data); + break; + case 0x3e: + ati.ext_reg[ati.ext_reg_select] = data & 0x1f; + logerror("ATI: ATI3E write %02x\n",data); + break; + case 0x3f: + ati.ext_reg[ati.ext_reg_select] = data & 0x0f; + logerror("ATI: ATI3F write %02x\n",data); + break; default: logerror("ATI: Extended VGA register 0x01CE index %02x write %02x\n",ati.ext_reg_select,data); } @@ -5385,14 +5453,44 @@ bit 0 SENSE is the result of a wired-OR of 3 comparators, one This bit toggles every time a HSYNC pulse starts 3-15 Reserved(0) */ -READ16_MEMBER(ibm8514a_device::ibm8514_status_r) +READ8_MEMBER(ibm8514a_device::ibm8514_status_r) { - return m_vga->vga_vblank() << 1; + switch(offset) + { + case 0: + return m_vga->vga_vblank() << 1; + case 2: + return m_vga->port_03c0_r(space,6,mem_mask); + case 3: + return m_vga->port_03c0_r(space,7,mem_mask); + case 4: + return m_vga->port_03c0_r(space,8,mem_mask); + case 5: + return m_vga->port_03c0_r(space,9,mem_mask); + } + return 0; } -WRITE16_MEMBER(ibm8514a_device::ibm8514_htotal_w) +WRITE8_MEMBER(ibm8514a_device::ibm8514_htotal_w) { - ibm8514.htotal = data & 0x01ff; + switch(offset) + { + case 0: + ibm8514.htotal = data & 0xff; + break; + case 2: + m_vga->port_03c0_w(space,6,data,mem_mask); + break; + case 3: + m_vga->port_03c0_w(space,7,data,mem_mask); + break; + case 4: + m_vga->port_03c0_w(space,8,data,mem_mask); + break; + case 5: + m_vga->port_03c0_w(space,9,data,mem_mask); + break; + } //vga.crtc.horz_total = data & 0x01ff; if(LOG_8514) logerror("8514/A: Horizontal total write %04x\n",data); } @@ -5546,7 +5644,7 @@ WRITE16_MEMBER(mach8_device::mach8_ec3_w) READ16_MEMBER(mach8_device::mach8_ext_fifo_r) { - return 0x00; // for now, report all FIFO slots at free + return 0x00; // for now, report all FIFO slots as free } WRITE16_MEMBER(mach8_device::mach8_linedraw_index_w) @@ -5606,12 +5704,12 @@ WRITE16_MEMBER(mach8_device::mach8_linedraw_w) READ16_MEMBER(mach8_device::mach8_sourcex_r) { - return ibm8514.dest_x; + return ibm8514.dest_x & 0x07ff; } READ16_MEMBER(mach8_device::mach8_sourcey_r) { - return ibm8514.dest_y; + return ibm8514.dest_y & 0x07ff; } WRITE16_MEMBER(mach8_device::mach8_ext_leftscissor_w) diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index 9d45ed2e9e2..320da9f2d2a 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -248,6 +248,7 @@ class svga_device : public vga_device public: virtual void zero() override; virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override; + uint8_t get_video_depth(); protected: // construction/destruction @@ -280,7 +281,7 @@ public: ibm8514a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void set_vga(const char* tag) { m_vga_tag.assign(tag); } - void set_vga_owner() { m_vga = dynamic_cast<vga_device*>(owner()); } + void set_vga_owner() { m_vga = dynamic_cast<svga_device*>(owner()); } void enabled(); @@ -288,8 +289,8 @@ public: WRITE16_MEMBER(ibm8514_cmd_w); READ16_MEMBER(ibm8514_line_error_r); WRITE16_MEMBER(ibm8514_line_error_w); - READ16_MEMBER(ibm8514_status_r); - WRITE16_MEMBER(ibm8514_htotal_w); + READ8_MEMBER(ibm8514_status_r); + WRITE8_MEMBER(ibm8514_htotal_w); READ16_MEMBER(ibm8514_substatus_r); WRITE16_MEMBER(ibm8514_subcontrol_w); READ16_MEMBER(ibm8514_subcontrol_r); @@ -387,7 +388,7 @@ protected: virtual void device_start() override; virtual void device_config_complete() override; - vga_device* m_vga; // for pass-through + svga_device* m_vga; // for pass-through std::string m_vga_tag; // pass-through device tag private: void ibm8514_draw_vector(uint8_t len, uint8_t dir, bool draw); @@ -540,15 +541,15 @@ protected: virtual void device_start() override; virtual void device_add_mconfig(machine_config &config) override; - -private: - void ati_define_video_mode(); struct { uint8_t ext_reg[64]; uint8_t ext_reg_select; uint8_t vga_chip_id; } ati; + +private: + void ati_define_video_mode(); mach8_device* m_8514; }; |