trunk/src/mess/video/pds30_30hr.c
| r0 | r18739 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Micron/XCEED Technologies Color 30HR |
| 4 | |
| 5 | Fs800000 - Mode A |
| 6 | FsA00000 - Mode B |
| 7 | FsC00000 - RAMDAC write offset |
| 8 | FsC00004 - RAMDAC write data |
| 9 | FsC00008 - RAMDAC write mask |
| 10 | FsC0000C - RAMDAC read offset |
| 11 | |
| 12 | ***************************************************************************/ |
| 13 | |
| 14 | #include "emu.h" |
| 15 | #include "video/pds30_30hr.h" |
| 16 | |
| 17 | #define XCEED30HR_SCREEN_NAME "x30hr_screen" |
| 18 | #define XCEED30HR_ROM_REGION "x30hr_rom" |
| 19 | |
| 20 | #define VRAM_SIZE (0x100000) // 1 MB VRAM - max mode is 1024x768 @ 8bpp |
| 21 | |
| 22 | MACHINE_CONFIG_FRAGMENT( xceed30hr ) |
| 23 | MCFG_SCREEN_ADD( XCEED30HR_SCREEN_NAME, RASTER) |
| 24 | MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_xceed30hr_device, screen_update) |
| 25 | MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) |
| 26 | MCFG_SCREEN_SIZE(1024,768) |
| 27 | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 28 | MACHINE_CONFIG_END |
| 29 | |
| 30 | ROM_START( xceed30hr ) |
| 31 | ROM_REGION(0x8000, XCEED30HR_ROM_REGION, 0) |
| 32 | ROM_LOAD( "369c.rom", 0x000000, 0x008000, CRC(b22f0a89) SHA1(be34c8604b8a1ae9c9f3b0b90faba9a1a64a5855) ) |
| 33 | ROM_END |
| 34 | |
| 35 | //************************************************************************** |
| 36 | // GLOBAL VARIABLES |
| 37 | //************************************************************************** |
| 38 | |
| 39 | const device_type PDS030_XCEED30HR = &device_creator<nubus_xceed30hr_device>; |
| 40 | |
| 41 | |
| 42 | //------------------------------------------------- |
| 43 | // machine_config_additions - device-specific |
| 44 | // machine configurations |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | machine_config_constructor nubus_xceed30hr_device::device_mconfig_additions() const |
| 48 | { |
| 49 | return MACHINE_CONFIG_NAME( xceed30hr ); |
| 50 | } |
| 51 | |
| 52 | //------------------------------------------------- |
| 53 | // rom_region - device-specific ROM region |
| 54 | //------------------------------------------------- |
| 55 | |
| 56 | const rom_entry *nubus_xceed30hr_device::device_rom_region() const |
| 57 | { |
| 58 | return ROM_NAME( xceed30hr ); |
| 59 | } |
| 60 | |
| 61 | //************************************************************************** |
| 62 | // LIVE DEVICE |
| 63 | //************************************************************************** |
| 64 | |
| 65 | //------------------------------------------------- |
| 66 | // nubus_xceed30hr_device - constructor |
| 67 | //------------------------------------------------- |
| 68 | |
| 69 | nubus_xceed30hr_device::nubus_xceed30hr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 70 | device_t(mconfig, PDS030_XCEED30HR, "Micron/XCEED Technology Color 30HR", tag, owner, clock), |
| 71 | device_nubus_card_interface(mconfig, *this) |
| 72 | { |
| 73 | m_shortname = "pd3_30hr"; |
| 74 | } |
| 75 | |
| 76 | nubus_xceed30hr_device::nubus_xceed30hr_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 77 | device_t(mconfig, type, name, tag, owner, clock), |
| 78 | device_nubus_card_interface(mconfig, *this) |
| 79 | { |
| 80 | m_shortname = "pd3_30hr"; |
| 81 | } |
| 82 | |
| 83 | //------------------------------------------------- |
| 84 | // device_start - device-specific startup |
| 85 | //------------------------------------------------- |
| 86 | |
| 87 | void nubus_xceed30hr_device::device_start() |
| 88 | { |
| 89 | UINT32 slotspace; |
| 90 | |
| 91 | // set_nubus_device makes m_slot valid |
| 92 | set_nubus_device(); |
| 93 | install_declaration_rom(this, XCEED30HR_ROM_REGION); |
| 94 | |
| 95 | slotspace = get_slotspace(); |
| 96 | |
| 97 | // printf("[xceed30hr %p] slotspace = %x\n", this, slotspace); |
| 98 | |
| 99 | m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); |
| 100 | m_vram32 = (UINT32 *)m_vram; |
| 101 | |
| 102 | m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceed30hr_device::vram_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::vram_w), this)); |
| 103 | m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_r), this), write32_delegate(FUNC(nubus_xceed30hr_device::xceed30hr_w), this)); |
| 104 | |
| 105 | m_timer = timer_alloc(0, NULL); |
| 106 | m_screen = NULL; // can we look this up now? |
| 107 | } |
| 108 | |
| 109 | //------------------------------------------------- |
| 110 | // device_reset - device-specific reset |
| 111 | //------------------------------------------------- |
| 112 | |
| 113 | void nubus_xceed30hr_device::device_reset() |
| 114 | { |
| 115 | m_count = 0; |
| 116 | m_clutoffs = 0; |
| 117 | m_vbl_disable = 1; |
| 118 | m_mode = 0; |
| 119 | memset(m_vram, 0, VRAM_SIZE); |
| 120 | memset(m_palette, 0, sizeof(m_palette)); |
| 121 | |
| 122 | m_palette[0] = MAKE_RGB(255, 255, 255); |
| 123 | m_palette[0x80] = MAKE_RGB(0, 0, 0); |
| 124 | } |
| 125 | |
| 126 | |
| 127 | void nubus_xceed30hr_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) |
| 128 | { |
| 129 | if (!m_vbl_disable) |
| 130 | { |
| 131 | raise_slot_irq(); |
| 132 | } |
| 133 | |
| 134 | m_timer->adjust(m_screen->time_until_pos(479, 0), 0); |
| 135 | } |
| 136 | |
| 137 | /*************************************************************************** |
| 138 | |
| 139 | CB264 section |
| 140 | |
| 141 | ***************************************************************************/ |
| 142 | |
| 143 | UINT32 nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 144 | { |
| 145 | UINT32 *scanline; |
| 146 | int x, y; |
| 147 | UINT8 pixels, *vram; |
| 148 | |
| 149 | // first time? kick off the VBL timer |
| 150 | if (!m_screen) |
| 151 | { |
| 152 | m_screen = &screen; |
| 153 | m_timer->adjust(m_screen->time_until_pos(479, 0), 0); |
| 154 | } |
| 155 | |
| 156 | vram = m_vram + 1024; |
| 157 | |
| 158 | switch (m_mode) |
| 159 | { |
| 160 | case 0: // 1 bpp? |
| 161 | for (y = 0; y < 480; y++) |
| 162 | { |
| 163 | scanline = &bitmap.pix32(y); |
| 164 | for (x = 0; x < 640/8; x++) |
| 165 | { |
| 166 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 167 | |
| 168 | *scanline++ = m_palette[(pixels>>7)&1]; |
| 169 | *scanline++ = m_palette[(pixels>>6)&1]; |
| 170 | *scanline++ = m_palette[(pixels>>5)&1]; |
| 171 | *scanline++ = m_palette[(pixels>>4)&1]; |
| 172 | *scanline++ = m_palette[(pixels>>3)&1]; |
| 173 | *scanline++ = m_palette[(pixels>>2)&1]; |
| 174 | *scanline++ = m_palette[(pixels>>1)&1]; |
| 175 | *scanline++ = m_palette[pixels&1]; |
| 176 | } |
| 177 | } |
| 178 | break; |
| 179 | |
| 180 | case 1: // 2 bpp |
| 181 | for (y = 0; y < 480; y++) |
| 182 | { |
| 183 | scanline = &bitmap.pix32(y); |
| 184 | for (x = 0; x < 640/4; x++) |
| 185 | { |
| 186 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 187 | |
| 188 | *scanline++ = m_palette[((pixels>>6)&3)]; |
| 189 | *scanline++ = m_palette[((pixels>>4)&3)]; |
| 190 | *scanline++ = m_palette[((pixels>>2)&3)]; |
| 191 | *scanline++ = m_palette[(pixels&3)]; |
| 192 | } |
| 193 | } |
| 194 | break; |
| 195 | |
| 196 | case 2: // 4 bpp |
| 197 | for (y = 0; y < 480; y++) |
| 198 | { |
| 199 | scanline = &bitmap.pix32(y); |
| 200 | |
| 201 | for (x = 0; x < 640/2; x++) |
| 202 | { |
| 203 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 204 | |
| 205 | *scanline++ = m_palette[(pixels>>4)]; |
| 206 | *scanline++ = m_palette[(pixels&0xf)]; |
| 207 | } |
| 208 | } |
| 209 | break; |
| 210 | |
| 211 | case 3: // 8 bpp |
| 212 | for (y = 0; y < 480; y++) |
| 213 | { |
| 214 | scanline = &bitmap.pix32(y); |
| 215 | |
| 216 | for (x = 0; x < 640; x++) |
| 217 | { |
| 218 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 219 | *scanline++ = m_palette[pixels]; |
| 220 | } |
| 221 | } |
| 222 | break; |
| 223 | |
| 224 | default: |
| 225 | fatalerror("xceed30hr: unknown video mode %d\n", m_mode); |
| 226 | break; |
| 227 | } |
| 228 | return 0; |
| 229 | } |
| 230 | |
| 231 | WRITE32_MEMBER( nubus_xceed30hr_device::xceed30hr_w ) |
| 232 | { |
| 233 | switch (offset) |
| 234 | { |
| 235 | case 0x80000: // mode |
| 236 | switch (data & 0xff000000) |
| 237 | { |
| 238 | case 0xfc000000: |
| 239 | m_mode = 0; |
| 240 | break; |
| 241 | |
| 242 | case 0xfd000000: |
| 243 | m_mode = 1; |
| 244 | break; |
| 245 | |
| 246 | case 0xfe000000: |
| 247 | m_mode = 2; |
| 248 | break; |
| 249 | |
| 250 | case 0xff000000: |
| 251 | m_mode = 3; |
| 252 | break; |
| 253 | } |
| 254 | break; |
| 255 | |
| 256 | case 0x80005: // ack VBL |
| 257 | lower_slot_irq(); |
| 258 | break; |
| 259 | |
| 260 | case 0x100000: |
| 261 | // printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc()); |
| 262 | m_clutoffs = (data&0xff); |
| 263 | m_count = 0; |
| 264 | break; |
| 265 | |
| 266 | case 0x100001: |
| 267 | // printf("%08x to DAC data (PC=%x)\n", data, space.device().safe_pc()); |
| 268 | m_colors[m_count++] = (data & 0xff); |
| 269 | |
| 270 | if (m_count == 3) |
| 271 | { |
| 272 | // printf("RAMDAC: color %02x = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); |
| 273 | m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); |
| 274 | m_clutoffs++; |
| 275 | if (m_clutoffs > 255) |
| 276 | { |
| 277 | m_clutoffs = 0; |
| 278 | } |
| 279 | m_count = 0; |
| 280 | } |
| 281 | break; |
| 282 | |
| 283 | case 0x100002: // VBL control |
| 284 | if (data & 0x06000000) |
| 285 | { |
| 286 | m_vbl_disable = 0; |
| 287 | lower_slot_irq(); |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | m_vbl_disable = 1; |
| 292 | } |
| 293 | break; |
| 294 | |
| 295 | default: |
| 296 | printf("xceed30hr_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); |
| 297 | break; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | READ32_MEMBER( nubus_xceed30hr_device::xceed30hr_r ) |
| 302 | { |
| 303 | // printf("xceed30hr_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc()); |
| 304 | if (offset == 0x80008) |
| 305 | { |
| 306 | m_toggle ^= 0x80; |
| 307 | return m_toggle | 0x33333333; |
| 308 | } |
| 309 | |
| 310 | return 0; |
| 311 | } |
| 312 | |
| 313 | WRITE32_MEMBER( nubus_xceed30hr_device::vram_w ) |
| 314 | { |
| 315 | COMBINE_DATA(&m_vram32[offset]); |
| 316 | } |
| 317 | |
| 318 | READ32_MEMBER( nubus_xceed30hr_device::vram_r ) |
| 319 | { |
| 320 | return m_vram32[offset]; |
| 321 | } |
trunk/src/mess/video/pds30_30hr.h
| r0 | r18739 | |
| 1 | #pragma once |
| 2 | |
| 3 | #ifndef __NUBUS_XCEED30HR_H__ |
| 4 | #define __NUBUS_XCEED30HR_H__ |
| 5 | |
| 6 | #include "emu.h" |
| 7 | #include "machine/nubus.h" |
| 8 | |
| 9 | //************************************************************************** |
| 10 | // TYPE DEFINITIONS |
| 11 | //************************************************************************** |
| 12 | |
| 13 | // ======================> nubus_xceed30hr_device |
| 14 | |
| 15 | class nubus_xceed30hr_device : |
| 16 | public device_t, |
| 17 | public device_nubus_card_interface |
| 18 | { |
| 19 | public: |
| 20 | // construction/destruction |
| 21 | nubus_xceed30hr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 22 | nubus_xceed30hr_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 23 | |
| 24 | // optional information overrides |
| 25 | virtual machine_config_constructor device_mconfig_additions() const; |
| 26 | virtual const rom_entry *device_rom_region() const; |
| 27 | |
| 28 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 29 | protected: |
| 30 | // device-level overrides |
| 31 | virtual void device_start(); |
| 32 | virtual void device_reset(); |
| 33 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 34 | |
| 35 | DECLARE_READ32_MEMBER(xceed30hr_r); |
| 36 | DECLARE_WRITE32_MEMBER(xceed30hr_w); |
| 37 | DECLARE_READ32_MEMBER(vram_r); |
| 38 | DECLARE_WRITE32_MEMBER(vram_w); |
| 39 | |
| 40 | public: |
| 41 | UINT8 *m_vram; |
| 42 | UINT32 *m_vram32; |
| 43 | UINT32 m_mode, m_vbl_disable, m_toggle; |
| 44 | UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs; |
| 45 | screen_device *m_screen; |
| 46 | emu_timer *m_timer; |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | // device type definition |
| 51 | extern const device_type PDS030_XCEED30HR; |
| 52 | |
| 53 | #endif /* __NUBUS_XCEED30HR_H__ */ |
trunk/src/mess/video/pds30_mc30.c
| r0 | r18739 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Micron/XCEED Technologies MacroColor 30 |
| 4 | |
| 5 | Similar to the 30HR, but registers are rearranged and 24bpp support |
| 6 | was added. |
| 7 | |
| 8 | ***************************************************************************/ |
| 9 | |
| 10 | #include "emu.h" |
| 11 | #include "video/pds30_mc30.h" |
| 12 | |
| 13 | #define XCEEDMC30_SCREEN_NAME "x30hr_screen" |
| 14 | #define XCEEDMC30_ROM_REGION "x30hr_rom" |
| 15 | |
| 16 | #define VRAM_SIZE (0x200000) // 16 42C4256 256Kx4 VRAMs on the board = 2MB |
| 17 | |
| 18 | MACHINE_CONFIG_FRAGMENT( xceedmc30 ) |
| 19 | MCFG_SCREEN_ADD( XCEEDMC30_SCREEN_NAME, RASTER) |
| 20 | MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_xceedmc30_device, screen_update) |
| 21 | MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480) |
| 22 | MCFG_SCREEN_SIZE(1024,768) |
| 23 | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 24 | MACHINE_CONFIG_END |
| 25 | |
| 26 | ROM_START( xceedmc30 ) |
| 27 | ROM_REGION(0x8000, XCEEDMC30_ROM_REGION, 0) |
| 28 | ROM_LOAD( "0390.bin", 0x000000, 0x008000, CRC(adea7a18) SHA1(9141eb1a0e5061e0409d65a89b4eaeb119ee4ffb) ) |
| 29 | ROM_END |
| 30 | |
| 31 | //************************************************************************** |
| 32 | // GLOBAL VARIABLES |
| 33 | //************************************************************************** |
| 34 | |
| 35 | const device_type PDS030_XCEEDMC30 = &device_creator<nubus_xceedmc30_device>; |
| 36 | |
| 37 | |
| 38 | //------------------------------------------------- |
| 39 | // machine_config_additions - device-specific |
| 40 | // machine configurations |
| 41 | //------------------------------------------------- |
| 42 | |
| 43 | machine_config_constructor nubus_xceedmc30_device::device_mconfig_additions() const |
| 44 | { |
| 45 | return MACHINE_CONFIG_NAME( xceedmc30 ); |
| 46 | } |
| 47 | |
| 48 | //------------------------------------------------- |
| 49 | // rom_region - device-specific ROM region |
| 50 | //------------------------------------------------- |
| 51 | |
| 52 | const rom_entry *nubus_xceedmc30_device::device_rom_region() const |
| 53 | { |
| 54 | return ROM_NAME( xceedmc30 ); |
| 55 | } |
| 56 | |
| 57 | //************************************************************************** |
| 58 | // LIVE DEVICE |
| 59 | //************************************************************************** |
| 60 | |
| 61 | //------------------------------------------------- |
| 62 | // nubus_xceedmc30_device - constructor |
| 63 | //------------------------------------------------- |
| 64 | |
| 65 | nubus_xceedmc30_device::nubus_xceedmc30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 66 | device_t(mconfig, PDS030_XCEEDMC30, "Micron/XCEED Technology MacroColor 30", tag, owner, clock), |
| 67 | device_nubus_card_interface(mconfig, *this) |
| 68 | { |
| 69 | m_shortname = "pd3_mclr"; |
| 70 | } |
| 71 | |
| 72 | nubus_xceedmc30_device::nubus_xceedmc30_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 73 | device_t(mconfig, type, name, tag, owner, clock), |
| 74 | device_nubus_card_interface(mconfig, *this) |
| 75 | { |
| 76 | m_shortname = "pd3_mclr"; |
| 77 | } |
| 78 | |
| 79 | //------------------------------------------------- |
| 80 | // device_start - device-specific startup |
| 81 | //------------------------------------------------- |
| 82 | |
| 83 | void nubus_xceedmc30_device::device_start() |
| 84 | { |
| 85 | UINT32 slotspace; |
| 86 | |
| 87 | // set_nubus_device makes m_slot valid |
| 88 | set_nubus_device(); |
| 89 | install_declaration_rom(this, XCEEDMC30_ROM_REGION); |
| 90 | |
| 91 | slotspace = get_slotspace(); |
| 92 | |
| 93 | // printf("[xceedmc30 %p] slotspace = %x\n", this, slotspace); |
| 94 | |
| 95 | m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); |
| 96 | m_vram32 = (UINT32 *)m_vram; |
| 97 | |
| 98 | m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_xceedmc30_device::vram_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::vram_w), this)); |
| 99 | m_nubus->install_device(slotspace+0x800000, slotspace+0xefffff, read32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_r), this), write32_delegate(FUNC(nubus_xceedmc30_device::xceedmc30_w), this)); |
| 100 | |
| 101 | m_timer = timer_alloc(0, NULL); |
| 102 | m_screen = NULL; // can we look this up now? |
| 103 | } |
| 104 | |
| 105 | //------------------------------------------------- |
| 106 | // device_reset - device-specific reset |
| 107 | //------------------------------------------------- |
| 108 | |
| 109 | void nubus_xceedmc30_device::device_reset() |
| 110 | { |
| 111 | m_count = 0; |
| 112 | m_clutoffs = 0; |
| 113 | m_vbl_disable = 1; |
| 114 | m_mode = 0; |
| 115 | memset(m_vram, 0, VRAM_SIZE); |
| 116 | memset(m_palette, 0, sizeof(m_palette)); |
| 117 | |
| 118 | m_palette[0] = MAKE_RGB(255, 255, 255); |
| 119 | m_palette[0x80] = MAKE_RGB(0, 0, 0); |
| 120 | } |
| 121 | |
| 122 | |
| 123 | void nubus_xceedmc30_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) |
| 124 | { |
| 125 | if (!m_vbl_disable) |
| 126 | { |
| 127 | raise_slot_irq(); |
| 128 | } |
| 129 | |
| 130 | m_timer->adjust(m_screen->time_until_pos(479, 0), 0); |
| 131 | } |
| 132 | |
| 133 | /*************************************************************************** |
| 134 | |
| 135 | CB264 section |
| 136 | |
| 137 | ***************************************************************************/ |
| 138 | |
| 139 | UINT32 nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 140 | { |
| 141 | UINT32 *scanline; |
| 142 | int x, y; |
| 143 | UINT8 pixels, *vram; |
| 144 | |
| 145 | // first time? kick off the VBL timer |
| 146 | if (!m_screen) |
| 147 | { |
| 148 | m_screen = &screen; |
| 149 | m_timer->adjust(m_screen->time_until_pos(479, 0), 0); |
| 150 | } |
| 151 | |
| 152 | vram = m_vram + (4*1024); |
| 153 | |
| 154 | switch (m_mode) |
| 155 | { |
| 156 | case 0: // 1 bpp? |
| 157 | for (y = 0; y < 480; y++) |
| 158 | { |
| 159 | scanline = &bitmap.pix32(y); |
| 160 | for (x = 0; x < 640/8; x++) |
| 161 | { |
| 162 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 163 | |
| 164 | *scanline++ = m_palette[(pixels>>7)&1]; |
| 165 | *scanline++ = m_palette[(pixels>>6)&1]; |
| 166 | *scanline++ = m_palette[(pixels>>5)&1]; |
| 167 | *scanline++ = m_palette[(pixels>>4)&1]; |
| 168 | *scanline++ = m_palette[(pixels>>3)&1]; |
| 169 | *scanline++ = m_palette[(pixels>>2)&1]; |
| 170 | *scanline++ = m_palette[(pixels>>1)&1]; |
| 171 | *scanline++ = m_palette[pixels&1]; |
| 172 | } |
| 173 | } |
| 174 | break; |
| 175 | |
| 176 | case 1: // 2 bpp |
| 177 | for (y = 0; y < 480; y++) |
| 178 | { |
| 179 | scanline = &bitmap.pix32(y); |
| 180 | for (x = 0; x < 640/4; x++) |
| 181 | { |
| 182 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 183 | |
| 184 | *scanline++ = m_palette[((pixels>>6)&3)]; |
| 185 | *scanline++ = m_palette[((pixels>>4)&3)]; |
| 186 | *scanline++ = m_palette[((pixels>>2)&3)]; |
| 187 | *scanline++ = m_palette[(pixels&3)]; |
| 188 | } |
| 189 | } |
| 190 | break; |
| 191 | |
| 192 | case 2: // 4 bpp |
| 193 | for (y = 0; y < 480; y++) |
| 194 | { |
| 195 | scanline = &bitmap.pix32(y); |
| 196 | |
| 197 | for (x = 0; x < 640/2; x++) |
| 198 | { |
| 199 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 200 | |
| 201 | *scanline++ = m_palette[(pixels>>4)]; |
| 202 | *scanline++ = m_palette[(pixels&0xf)]; |
| 203 | } |
| 204 | } |
| 205 | break; |
| 206 | |
| 207 | case 3: // 8 bpp |
| 208 | for (y = 0; y < 480; y++) |
| 209 | { |
| 210 | scanline = &bitmap.pix32(y); |
| 211 | |
| 212 | for (x = 0; x < 640; x++) |
| 213 | { |
| 214 | pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; |
| 215 | *scanline++ = m_palette[pixels]; |
| 216 | } |
| 217 | } |
| 218 | break; |
| 219 | |
| 220 | case 4: // 24 bpp |
| 221 | { |
| 222 | UINT32 *vram32 = (UINT32 *)vram; |
| 223 | UINT32 *base; |
| 224 | |
| 225 | for (y = 0; y < 480; y++) |
| 226 | { |
| 227 | scanline = &bitmap.pix32(y); |
| 228 | base = &vram32[y * 1024]; |
| 229 | for (x = 0; x < 640; x++) |
| 230 | { |
| 231 | *scanline++ = *base++; |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | break; |
| 236 | |
| 237 | default: |
| 238 | fatalerror("xceedmc30: unknown video mode %d\n", m_mode); |
| 239 | break; |
| 240 | } |
| 241 | return 0; |
| 242 | } |
| 243 | |
| 244 | WRITE32_MEMBER( nubus_xceedmc30_device::xceedmc30_w ) |
| 245 | { |
| 246 | switch (offset) |
| 247 | { |
| 248 | case 0x80000: // mode |
| 249 | switch (data & 0xff000000) |
| 250 | { |
| 251 | case 0xfb000000: |
| 252 | m_mode = 0; |
| 253 | break; |
| 254 | |
| 255 | case 0xfa000000: |
| 256 | m_mode = 1; |
| 257 | break; |
| 258 | |
| 259 | case 0xf9000000: |
| 260 | m_mode = 2; |
| 261 | break; |
| 262 | |
| 263 | case 0xf8000000: |
| 264 | m_mode = 3; |
| 265 | break; |
| 266 | |
| 267 | case 0xff000000: |
| 268 | m_mode = 4; |
| 269 | break; |
| 270 | } |
| 271 | break; |
| 272 | |
| 273 | case 0x80005: // ack VBL |
| 274 | lower_slot_irq(); |
| 275 | break; |
| 276 | |
| 277 | case 0x100000: |
| 278 | // printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc()); |
| 279 | m_clutoffs = (data&0xff); |
| 280 | m_count = 0; |
| 281 | break; |
| 282 | |
| 283 | case 0x100001: |
| 284 | // printf("%08x to DAC data (PC=%x)\n", data, space.device().safe_pc()); |
| 285 | m_colors[m_count++] = ((data>>24) & 0xff); |
| 286 | |
| 287 | if (m_count == 3) |
| 288 | { |
| 289 | // printf("RAMDAC: color %02x = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); |
| 290 | m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); |
| 291 | m_clutoffs++; |
| 292 | if (m_clutoffs > 255) |
| 293 | { |
| 294 | m_clutoffs = 0; |
| 295 | } |
| 296 | m_count = 0; |
| 297 | } |
| 298 | break; |
| 299 | |
| 300 | case 0x80002: // VBL control |
| 301 | if (data == 0xdcef0000) |
| 302 | { |
| 303 | m_vbl_disable = 0; |
| 304 | lower_slot_irq(); |
| 305 | } |
| 306 | else |
| 307 | { |
| 308 | m_vbl_disable = 1; |
| 309 | } |
| 310 | break; |
| 311 | |
| 312 | default: |
| 313 | // printf("xceedmc30_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); |
| 314 | break; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | READ32_MEMBER( nubus_xceedmc30_device::xceedmc30_r ) |
| 319 | { |
| 320 | // printf("xceedmc30_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc()); |
| 321 | if (offset == 0x80008) |
| 322 | { |
| 323 | m_toggle ^= 0x04; |
| 324 | return m_toggle; |
| 325 | } |
| 326 | |
| 327 | return 0; |
| 328 | } |
| 329 | |
| 330 | WRITE32_MEMBER( nubus_xceedmc30_device::vram_w ) |
| 331 | { |
| 332 | COMBINE_DATA(&m_vram32[offset]); |
| 333 | } |
| 334 | |
| 335 | READ32_MEMBER( nubus_xceedmc30_device::vram_r ) |
| 336 | { |
| 337 | return m_vram32[offset]; |
| 338 | } |
trunk/src/mess/video/pds30_mc30.h
| r0 | r18739 | |
| 1 | #pragma once |
| 2 | |
| 3 | #ifndef __NUBUS_XCEEDMC30_H__ |
| 4 | #define __NUBUS_XCEEDMC30_H__ |
| 5 | |
| 6 | #include "emu.h" |
| 7 | #include "machine/nubus.h" |
| 8 | |
| 9 | //************************************************************************** |
| 10 | // TYPE DEFINITIONS |
| 11 | //************************************************************************** |
| 12 | |
| 13 | // ======================> nubus_xceedmc30_device |
| 14 | |
| 15 | class nubus_xceedmc30_device : |
| 16 | public device_t, |
| 17 | public device_nubus_card_interface |
| 18 | { |
| 19 | public: |
| 20 | // construction/destruction |
| 21 | nubus_xceedmc30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 22 | nubus_xceedmc30_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 23 | |
| 24 | // optional information overrides |
| 25 | virtual machine_config_constructor device_mconfig_additions() const; |
| 26 | virtual const rom_entry *device_rom_region() const; |
| 27 | |
| 28 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 29 | protected: |
| 30 | // device-level overrides |
| 31 | virtual void device_start(); |
| 32 | virtual void device_reset(); |
| 33 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 34 | |
| 35 | DECLARE_READ32_MEMBER(xceedmc30_r); |
| 36 | DECLARE_WRITE32_MEMBER(xceedmc30_w); |
| 37 | DECLARE_READ32_MEMBER(vram_r); |
| 38 | DECLARE_WRITE32_MEMBER(vram_w); |
| 39 | |
| 40 | public: |
| 41 | UINT8 *m_vram; |
| 42 | UINT32 *m_vram32; |
| 43 | UINT32 m_mode, m_vbl_disable, m_toggle; |
| 44 | UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs; |
| 45 | screen_device *m_screen; |
| 46 | emu_timer *m_timer; |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | // device type definition |
| 51 | extern const device_type PDS030_XCEEDMC30; |
| 52 | |
| 53 | #endif /* __NUBUS_XCEEDMC30_H__ */ |