diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index ecad0a425a0..6f94b263c26 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -84,70 +84,6 @@ 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() { @@ -157,6 +93,10 @@ void mach32_device::device_start() { ati_vga_device::device_start(); ati.vga_chip_id = 0x00; // correct? + vga.svga_intf.vram_size = 0x400000; + vga.memory.resize(vga.svga_intf.vram_size); + memset(&vga.memory[0], 0, vga.svga_intf.vram_size); + save_item(NAME(vga.memory)); } void mach32_device::device_reset() @@ -164,6 +104,141 @@ void mach32_device::device_reset() ati_vga_device::device_reset(); } +uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + ati_vga_device::screen_update(screen,bitmap,cliprect); + uint8_t depth = get_video_depth(); + + if(!m_cursor_enable) + return 0; + + uint32_t src = (m_cursor_address & 0x000fffff) << 2; + uint32_t* dst; // destination pixel + uint8_t x,y,z; + uint32_t colour0; + uint32_t colour1; + + if(depth == 8) + { + colour0 = m_palette->pen(m_cursor_colour0_b); + colour1 = m_palette->pen(m_cursor_colour1_b); + } + else // 16/24/32bpp + { + colour0 = (m_cursor_colour0_r << 16) | (m_cursor_colour0_g << 8) | (m_cursor_colour0_b); + colour1 = (m_cursor_colour1_r << 16) | (m_cursor_colour1_g << 8) | (m_cursor_colour1_b); + } + + // draw hardware pointer (64x64 max) + for(y=0;y<64;y++) + { + dst = &bitmap.pix32(m_cursor_vertical + y, m_cursor_horizontal); + for(x=0;x<64;x+=8) + { + uint16_t bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); + + for(z=0;z<8;z++) + { + if(((z + x) > (m_cursor_offset_horizontal-1)) && (y < (63 - m_cursor_offset_vertical))) + { + uint8_t val = (bits >> (z*2)) & 0x03; + switch(val) + { + case 0: // cursor colour 0 + *dst = colour0; + break; + case 1: // cursor colour 1 + *dst = colour1; + break; + case 2: // transparent + break; + case 3: // complement + *dst = ~(*dst); + break; + } + dst++; + } + } + src+=2; + } + } + + return 0; +} + +// mach32 Hardware Pointer +WRITE16_MEMBER(mach32_device::mach32_cursor_l_w) +{ + if(offset == 1) + m_cursor_address = (m_cursor_address & 0xf0000) | data; + if(LOG_MACH32) logerror("mach32 HW pointer data address: %05x",m_cursor_address); +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_h_w) +{ + if(offset == 1) + { + m_cursor_address = (m_cursor_address & 0x0ffff) | ((data & 0x000f) << 16); + m_cursor_enable = data & 0x8000; + if(LOG_MACH32) logerror("mach32 HW pointer data address: %05x",m_cursor_address); + } +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_pos_h) +{ + if(offset == 1) + m_cursor_horizontal = data & 0x07ff; +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_pos_v) +{ + if(offset == 1) + m_cursor_vertical = data & 0x0fff; +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_colour_b_w) +{ + if(offset == 1) + { + m_cursor_colour0_b = data & 0xff; + m_cursor_colour1_b = data >> 8; + if(LOG_MACH32) logerror("Mach32: HW Cursor Colour Blue write RGB: 0: %02x %02x %02x 1: %02x %02x %02x\n" + ,m_cursor_colour0_r,m_cursor_colour0_g,m_cursor_colour0_b,m_cursor_colour1_r,m_cursor_colour1_g,m_cursor_colour1_b); + } +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_colour_0_w) +{ + if(offset == 1) + { + m_cursor_colour0_g = data & 0xff; + m_cursor_colour0_r = data >> 8; + if(LOG_MACH32) logerror("Mach32: HW Cursor Colour 0 write RGB: %02x %02x %02x\n",m_cursor_colour0_r,m_cursor_colour0_g,m_cursor_colour0_b); + } +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_colour_1_w) +{ + if(offset == 1) + { + m_cursor_colour1_g = data & 0xff; + m_cursor_colour1_r = data >> 8; + if(LOG_MACH32) logerror("Mach32: HW Cursor Colour 1 write RGB: %02x %02x %02x\n",m_cursor_colour1_r,m_cursor_colour1_g,m_cursor_colour1_b); + } +} + +WRITE16_MEMBER(mach32_device::mach32_cursor_offset_w) +{ + if(offset == 1) + { + if(ACCESSING_BITS_0_7) + m_cursor_offset_horizontal = data & 0x00ff; + if(ACCESSING_BITS_8_15) + m_cursor_offset_vertical = data >> 8; + if(LOG_MACH32) logerror("Mach32: HW Cursor Offset write H:%i V:%i\n",m_cursor_offset_horizontal,m_cursor_offset_vertical); + } +} + /* * mach64 */ diff --git a/src/devices/bus/isa/mach32.h b/src/devices/bus/isa/mach32.h index 80df99c3f86..25cf48c4ec7 100644 --- a/src/devices/bus/isa/mach32.h +++ b/src/devices/bus/isa/mach32.h @@ -14,6 +14,8 @@ #include "video/pc_vga.h" #include "machine/eepromser.h" +#define LOG_MACH32 1 + // 8514/A module of the Mach32 class mach32_8514a_device : public mach8_device { @@ -29,14 +31,6 @@ public: 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); @@ -48,19 +42,6 @@ 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 @@ -69,6 +50,7 @@ class mach32_device : public ati_vga_device public: // construction/destruction mach32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override; required_device m_8514a; // provides accelerated 2D drawing, derived from the Mach8 device @@ -97,6 +79,11 @@ public: DECLARE_READ16_MEMBER(mach8_sourcey_r) { return m_8514a->mach8_sourcey_r(space,offset,mem_mask); } DECLARE_WRITE16_MEMBER(mach8_ext_leftscissor_w) { m_8514a->mach8_ext_leftscissor_w(space,offset,data,mem_mask); } DECLARE_WRITE16_MEMBER(mach8_ext_topscissor_w) { m_8514a->mach8_ext_topscissor_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach8_ge_offset_l_w) { m_8514a->mach8_ge_offset_l_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach8_ge_offset_h_w) { m_8514a->mach8_ge_offset_h_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach8_scan_x_w) { m_8514a->mach8_scan_x_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach8_dp_config_w) { m_8514a->mach8_dp_config_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach8_ge_pitch_w) { m_8514a->mach8_ge_pitch_w(space,offset,data,mem_mask); } 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); } @@ -140,7 +127,7 @@ public: DECLARE_READ16_MEMBER(ibm8514_multifunc_r) { return m_8514a->ibm8514_multifunc_r(space,offset,mem_mask); } DECLARE_WRITE16_MEMBER(ibm8514_multifunc_w) { m_8514a->ibm8514_multifunc_w(space,offset,data,mem_mask); } DECLARE_READ16_MEMBER(ibm8514_pixel_xfer_r) { return m_8514a->ibm8514_pixel_xfer_r(space,offset,mem_mask); } - DECLARE_WRITE16_MEMBER(ibm8514_pixel_xfer_w) { m_8514a->ibm8514_pixel_xfer_w(space,offset,data,mem_mask); } + DECLARE_WRITE16_MEMBER(mach8_pixel_xfer_w) { m_8514a->mach8_pixel_xfer_w(space,offset,data,mem_mask); } DECLARE_READ16_MEMBER(mach32_chipid_r) { return m_8514a->mach32_chipid_r(space,offset,mem_mask); } DECLARE_READ16_MEMBER(mach8_clksel_r) { return m_8514a->mach8_clksel_r(space,offset,mem_mask); } @@ -151,15 +138,15 @@ public: 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; } + 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_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -168,6 +155,20 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; + + // 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; }; /* diff --git a/src/devices/bus/isa/vga_ati.cpp b/src/devices/bus/isa/vga_ati.cpp index 5a5f011a077..246d091e6bb 100644 --- a/src/devices/bus/isa/vga_ati.cpp +++ b/src/devices/bus/isa/vga_ati.cpp @@ -189,6 +189,9 @@ void isa16_vga_gfxultra_device::device_start() m_isa->install16_device(0x56ec, 0x56ef, read16_delegate(FUNC(mach8_device::mach8_scratch0_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_scratch0_w),m_8514)); m_isa->install16_device(0x5ae8, 0x5aeb, read16_delegate(FUNC(mach8_device::mach8_ec2_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ec2_w),m_8514)); m_isa->install16_device(0x5ee8, 0x5eeb, read16_delegate(FUNC(mach8_device::mach8_ec3_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ec3_w),m_8514)); + m_isa->install16_device(0x6eec, 0x6eef, read16_delegate(FUNC(mach8_device::mach8_readonly_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ge_offset_l_w),m_8514)); + m_isa->install16_device(0x72ec, 0x72ef, read16_delegate(FUNC(mach8_device::mach8_readonly_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ge_offset_h_w),m_8514)); + m_isa->install16_device(0x76ec, 0x76ef, read16_delegate(FUNC(mach8_device::mach8_readonly_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ge_pitch_w),m_8514)); m_isa->install16_device(0x82e8, 0x82eb, read16_delegate(FUNC(mach8_device::ibm8514_currenty_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_currenty_w),m_8514)); m_isa->install16_device(0x86e8, 0x86eb, read16_delegate(FUNC(mach8_device::ibm8514_currentx_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_currentx_w),m_8514)); m_isa->install16_device(0x8ae8, 0x8aeb, read16_delegate(FUNC(mach8_device::ibm8514_desty_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_desty_w),m_8514)); @@ -206,7 +209,9 @@ void isa16_vga_gfxultra_device::device_start() m_isa->install16_device(0xb6e8, 0xb6eb, read16_delegate(FUNC(mach8_device::ibm8514_backmix_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_backmix_w),m_8514)); m_isa->install16_device(0xbae8, 0xbaeb, read16_delegate(FUNC(mach8_device::ibm8514_foremix_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_foremix_w),m_8514)); m_isa->install16_device(0xbee8, 0xbeeb, read16_delegate(FUNC(mach8_device::ibm8514_multifunc_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_multifunc_w),m_8514)); - m_isa->install16_device(0xe2e8, 0xe2eb, read16_delegate(FUNC(mach8_device::ibm8514_pixel_xfer_r),m_8514), write16_delegate(FUNC(mach8_device::ibm8514_pixel_xfer_w),m_8514)); + m_isa->install16_device(0xcaec, 0xcaef, read16_delegate(FUNC(mach8_device::mach8_readonly_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_scan_x_w),m_8514)); + m_isa->install16_device(0xceec, 0xceef, read16_delegate(FUNC(mach8_device::mach8_readonly_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_dp_config_w),m_8514)); + m_isa->install16_device(0xe2e8, 0xe2eb, read16_delegate(FUNC(mach8_device::ibm8514_pixel_xfer_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_pixel_xfer_w),m_8514)); m_isa->install16_device(0xdaec, 0xdaef, read16_delegate(FUNC(mach8_device::mach8_sourcex_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ext_leftscissor_w),m_8514)); m_isa->install16_device(0xdeec, 0xdeef, read16_delegate(FUNC(mach8_device::mach8_sourcey_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_ext_topscissor_w),m_8514)); m_isa->install16_device(0xfeec, 0xfeef, read16_delegate(FUNC(mach8_device::mach8_linedraw_r),m_8514), write16_delegate(FUNC(mach8_device::mach8_linedraw_w),m_8514)); @@ -250,6 +255,9 @@ void isa16_vga_gfxultrapro_device::device_start() 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(0x6eec, 0x6eef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ge_offset_l_w),m_vga)); + m_isa->install16_device(0x72ec, 0x72ef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ge_offset_h_w),m_vga)); + m_isa->install16_device(0x76ec, 0x76ef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ge_pitch_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)); @@ -267,7 +275,9 @@ void isa16_vga_gfxultrapro_device::device_start() m_isa->install16_device(0xb6e8, 0xb6eb, read16_delegate(FUNC(mach32_device::ibm8514_backmix_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_backmix_w),m_vga)); m_isa->install16_device(0xbae8, 0xbaeb, read16_delegate(FUNC(mach32_device::ibm8514_foremix_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_foremix_w),m_vga)); m_isa->install16_device(0xbee8, 0xbeeb, read16_delegate(FUNC(mach32_device::ibm8514_multifunc_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_multifunc_w),m_vga)); - m_isa->install16_device(0xe2e8, 0xe2eb, read16_delegate(FUNC(mach32_device::ibm8514_pixel_xfer_r),m_vga), write16_delegate(FUNC(mach32_device::ibm8514_pixel_xfer_w),m_vga)); + m_isa->install16_device(0xcaec, 0xcaef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_scan_x_w),m_vga)); + m_isa->install16_device(0xceec, 0xceef, read16_delegate(FUNC(mach32_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_dp_config_w),m_vga)); + m_isa->install16_device(0xe2e8, 0xe2eb, read16_delegate(FUNC(mach32_device::ibm8514_pixel_xfer_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_pixel_xfer_w),m_vga)); m_isa->install16_device(0xdaec, 0xdaef, read16_delegate(FUNC(mach32_device::mach8_sourcex_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ext_leftscissor_w),m_vga)); m_isa->install16_device(0xdeec, 0xdeef, read16_delegate(FUNC(mach32_device::mach8_sourcey_r),m_vga), write16_delegate(FUNC(mach32_device::mach8_ext_topscissor_w),m_vga)); m_isa->install16_device(0xfaec, 0xfaef, read16_delegate(FUNC(mach32_device::mach32_chipid_r),m_vga), write16_delegate()); @@ -305,6 +315,9 @@ void isa16_vga_mach64_device::device_start() m_isa->install16_device(0x56ec, 0x56ef, read16_delegate(FUNC(mach64_device::mach8_scratch0_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_scratch0_w),m_vga)); m_isa->install16_device(0x5ae8, 0x5aeb, read16_delegate(FUNC(mach64_device::mach8_ec2_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ec2_w),m_vga)); m_isa->install16_device(0x5ee8, 0x5eeb, read16_delegate(FUNC(mach64_device::mach8_ec3_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ec3_w),m_vga)); + m_isa->install16_device(0x6eec, 0x6eef, read16_delegate(FUNC(mach64_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ge_offset_l_w),m_vga)); + m_isa->install16_device(0x72ec, 0x72ef, read16_delegate(FUNC(mach64_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ge_offset_h_w),m_vga)); + m_isa->install16_device(0x76ec, 0x76ef, read16_delegate(FUNC(mach64_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ge_pitch_w),m_vga)); m_isa->install16_device(0x82e8, 0x82eb, read16_delegate(FUNC(mach64_device::ibm8514_currenty_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_currenty_w),m_vga)); m_isa->install16_device(0x86e8, 0x86eb, read16_delegate(FUNC(mach64_device::ibm8514_currentx_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_currentx_w),m_vga)); m_isa->install16_device(0x8ae8, 0x8aeb, read16_delegate(FUNC(mach64_device::ibm8514_desty_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_desty_w),m_vga)); @@ -322,7 +335,9 @@ void isa16_vga_mach64_device::device_start() m_isa->install16_device(0xb6e8, 0xb6eb, read16_delegate(FUNC(mach64_device::ibm8514_backmix_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_backmix_w),m_vga)); m_isa->install16_device(0xbae8, 0xbaeb, read16_delegate(FUNC(mach64_device::ibm8514_foremix_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_foremix_w),m_vga)); m_isa->install16_device(0xbee8, 0xbeeb, read16_delegate(FUNC(mach64_device::ibm8514_multifunc_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_multifunc_w),m_vga)); - m_isa->install16_device(0xe2e8, 0xe2eb, read16_delegate(FUNC(mach64_device::ibm8514_pixel_xfer_r),m_vga), write16_delegate(FUNC(mach64_device::ibm8514_pixel_xfer_w),m_vga)); + m_isa->install16_device(0xcaec, 0xcaef, read16_delegate(FUNC(mach64_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_scan_x_w),m_vga)); + m_isa->install16_device(0xceec, 0xceef, read16_delegate(FUNC(mach64_device::mach32_readonly_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_dp_config_w),m_vga)); + m_isa->install16_device(0xe2e8, 0xe2eb, read16_delegate(FUNC(mach64_device::ibm8514_pixel_xfer_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_pixel_xfer_w),m_vga)); m_isa->install16_device(0xdaec, 0xdaef, read16_delegate(FUNC(mach64_device::mach8_sourcex_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ext_leftscissor_w),m_vga)); m_isa->install16_device(0xdeec, 0xdeef, read16_delegate(FUNC(mach64_device::mach8_sourcey_r),m_vga), write16_delegate(FUNC(mach64_device::mach8_ext_topscissor_w),m_vga)); m_isa->install16_device(0xfaec, 0xfaef, read16_delegate(FUNC(mach64_device::mach32_chipid_r),m_vga), write16_delegate()); diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index fe395314877..5bff9734440 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -68,7 +68,8 @@ enum IBM8514_DRAWING_BITBLT, IBM8514_DRAWING_PATTERN, IBM8514_DRAWING_SSV_1, - IBM8514_DRAWING_SSV_2 + IBM8514_DRAWING_SSV_2, + MACH8_DRAWING_SCAN }; #define CRTC_PORT_ADDR ((vga.miscellaneous_output&1)?0x3d0:0x3b0) @@ -4766,7 +4767,7 @@ WRITE16_MEMBER(ibm8514a_device::ibm8514_pixel_xfer_w) if(ibm8514.state == IBM8514_DRAWING_LINE) ibm8514_wait_draw_vector(); - if(LOG_8514) logerror("S3: Pixel Transfer = %08x\n",ibm8514.pixel_xfer); + if(LOG_8514) logerror("8514/A: Pixel Transfer = %08x\n",ibm8514.pixel_xfer); } READ8_MEMBER(s3_vga_device::mem_r) @@ -5744,6 +5745,104 @@ WRITE16_MEMBER(mach8_device::mach8_scratch1_w) if(LOG_8514) logerror("Mach8: Scratch Pad 1 write %04x\n",data); } +WRITE16_MEMBER(mach8_device::mach8_ge_offset_l_w) +{ + mach8.ge_offset = (mach8.ge_offset & 0x0f0000) | data; + if(LOG_8514) logerror("Mach8: Graphics Engine Offset (Low) write %05x\n",mach8.ge_offset); +} + +WRITE16_MEMBER(mach8_device::mach8_ge_offset_h_w) +{ + mach8.ge_offset = (mach8.ge_offset & 0x00ffff) | ((data & 0x000f) << 16); + if(LOG_8514) logerror("Mach8: Graphics Engine Offset (High) write %05x\n",mach8.ge_offset); +} + +WRITE16_MEMBER(mach8_device::mach8_ge_pitch_w) +{ + mach8.ge_pitch = mach8.ge_offset & 0x00ff; + if(LOG_8514) logerror("Mach8: Graphics Engine pitch write %05x\n",mach8.ge_pitch); +} + +WRITE16_MEMBER(mach8_device::mach8_scan_x_w) +{ + mach8.scan_x = data & 0x07ff; + + if((mach8.dp_config & 0xe000) == 0x4000) // foreground source is the Pixel Transfer register + { + ibm8514.state = MACH8_DRAWING_SCAN; + ibm8514.bus_size = (mach8.dp_config & 0x0200) >> 9; + ibm8514.data_avail = true; + } + // TODO: non-wait version of Scan To X + if(LOG_8514) logerror("Mach8: Scan To X write %04x\n",mach8.scan_x); +} + +WRITE16_MEMBER(mach8_device::mach8_pixel_xfer_w) +{ + ibm8514_pixel_xfer_w(space,offset,data,mem_mask); + + if(ibm8514.state == MACH8_DRAWING_SCAN) + mach8_wait_scan(); +} + +void mach8_device::mach8_wait_scan() +{ + uint32_t offset = mach8.ge_offset << 2; + uint32_t addr = (ibm8514.prev_y * (mach8.ge_pitch * 8)) + ibm8514.prev_x; + + // TODO: support reverse direction + if(mach8.dp_config & 0x0010) // drawing enabled + { + if(mach8.dp_config & 0x0200) // 16-bit + { + ibm8514_write_fg(offset + addr); + ibm8514.pixel_xfer >>= 8; + ibm8514.prev_x++; + ibm8514_write_fg(offset + addr + 1); + ibm8514.prev_x++; + mach8.scan_x -= 2; + if(mach8.scan_x <= 0) + { + ibm8514.state = IBM8514_IDLE; + ibm8514.gpbusy = false; + ibm8514.data_avail = false; + ibm8514.curr_x = ibm8514.prev_x; + } + } + else // 8-bit + { + ibm8514_write_fg(offset + addr); + ibm8514.prev_x++; + mach8.scan_x--; + if(mach8.scan_x <= 0) + { + ibm8514.state = IBM8514_IDLE; + ibm8514.gpbusy = false; + ibm8514.data_avail = false; + ibm8514.curr_x = ibm8514.prev_x; + } + } + } +} + +/* + * CEEE (Write): Data Path Configuration + * bit 0: Read/Write data + * 1: Polygon-fill blit mode + * 2: Read host data - 0=colour, 1=monochrome + * 4: Enable Draw + * 5-6: Monochrome Data Source (0=always 1, 1=Mono pattern register, 2=Pixel Transfer register, 3=VRAM blit source) + * 7-8: Background Colour Source (0=Foreground Colour register, 1=Background Colour register, 2=Pixel Transfer register, 3=VRAM blit source) + * 9: Data width - 0=8-bit, 1=16-bit + * 12: LSB First (ignored in mach8 mode when data width is not set) + * 13-15: Foreground Colour Source (as Background Source, plus 5=Colour pattern shift register) + */ +WRITE16_MEMBER(mach8_device::mach8_dp_config_w) +{ + mach8.dp_config = data; + if(LOG_8514) logerror("Mach8: Data Path Configuration write %04x\n",mach8.dp_config); +} + /* 12EEh W(R): Configuration Status 1 Register (Mach8) bit 0 CLK_MODE. Set to use clock chip, clear to use crystals. diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index 320da9f2d2a..0b5b9539fd9 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -324,7 +324,7 @@ public: READ16_MEMBER(ibm8514_foremix_r); WRITE16_MEMBER(ibm8514_foremix_w); READ16_MEMBER(ibm8514_pixel_xfer_r); - WRITE16_MEMBER(ibm8514_pixel_xfer_w); + virtual WRITE16_MEMBER(ibm8514_pixel_xfer_w); READ16_MEMBER(ibm8514_read_mask_r); WRITE16_MEMBER(ibm8514_read_mask_w); READ16_MEMBER(ibm8514_write_mask_r); @@ -388,6 +388,10 @@ protected: virtual void device_start() override; virtual void device_config_complete() override; + void ibm8514_write(uint32_t offset, uint32_t src); + void ibm8514_write_fg(uint32_t offset); + void ibm8514_write_bg(uint32_t offset); + svga_device* m_vga; // for pass-through std::string m_vga_tag; // pass-through device tag private: @@ -395,9 +399,6 @@ private: void ibm8514_wait_draw_ssv(); void ibm8514_draw_ssv(uint8_t data); void ibm8514_wait_draw_vector(); - void ibm8514_write_fg(uint32_t offset); - void ibm8514_write_bg(uint32_t offset); - void ibm8514_write(uint32_t offset, uint32_t src); //uint8_t* m_vram; // the original 8514/A has it's own VRAM, but most VGA+8514 combination cards will have // only one set of VRAM, so this will only be needed in standalone 8514/A cards @@ -446,6 +447,13 @@ public: WRITE16_MEMBER(mach8_ext_leftscissor_w); WRITE16_MEMBER(mach8_ext_topscissor_w); READ16_MEMBER(mach8_clksel_r) { return mach8.clksel; } + WRITE16_MEMBER(mach8_ge_offset_l_w); + WRITE16_MEMBER(mach8_ge_offset_h_w); + WRITE16_MEMBER(mach8_ge_pitch_w); + WRITE16_MEMBER(mach8_scan_x_w); + WRITE16_MEMBER(mach8_dp_config_w); + READ16_MEMBER(mach8_readonly_r) { return 0; } + WRITE16_MEMBER(mach8_pixel_xfer_w); protected: mach8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -456,7 +464,15 @@ protected: uint16_t scratch1; uint16_t linedraw; uint16_t clksel; + uint16_t dp_config; + uint32_t ge_offset; + uint16_t ge_pitch; + uint16_t scan_x; } mach8; + +private: + void mach8_wait_scan(); + }; // device type definition