trunk/src/mess/video/pds30_sigmalview.c
| r0 | r18656 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Sigma Designs L-View card |
| 4 | |
| 5 | ***************************************************************************/ |
| 6 | |
| 7 | #include "emu.h" |
| 8 | #include "video/pds30_sigmalview.h" |
| 9 | |
| 10 | #define LVIEW_SCREEN_NAME "lview_screen" |
| 11 | #define LVIEW_ROM_REGION "lview_rom" |
| 12 | |
| 13 | #define VRAM_SIZE (0x80000) // 512K? |
| 14 | |
| 15 | MACHINE_CONFIG_FRAGMENT( lview ) |
| 16 | MCFG_SCREEN_ADD( LVIEW_SCREEN_NAME, RASTER) |
| 17 | MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_lview_device, screen_update) |
| 18 | MCFG_SCREEN_SIZE(832,600) |
| 19 | MCFG_SCREEN_REFRESH_RATE(70) |
| 20 | MCFG_SCREEN_VISIBLE_AREA(0, 832-1, 0, 600-1) |
| 21 | MACHINE_CONFIG_END |
| 22 | |
| 23 | ROM_START( lview ) |
| 24 | ROM_REGION(0x4000, LVIEW_ROM_REGION, 0) |
| 25 | ROM_LOAD( "lv_asi_4_00.bin", 0x000000, 0x004000, CRC(b806f875) SHA1(1e58593b1a8720193d1651b0d8a0d43e4e47563d) ) |
| 26 | ROM_END |
| 27 | |
| 28 | //************************************************************************** |
| 29 | // GLOBAL VARIABLES |
| 30 | //************************************************************************** |
| 31 | |
| 32 | const device_type PDS030_LVIEW = &device_creator<nubus_lview_device>; |
| 33 | |
| 34 | |
| 35 | //------------------------------------------------- |
| 36 | // machine_config_additions - device-specific |
| 37 | // machine configurations |
| 38 | //------------------------------------------------- |
| 39 | |
| 40 | machine_config_constructor nubus_lview_device::device_mconfig_additions() const |
| 41 | { |
| 42 | return MACHINE_CONFIG_NAME( lview ); |
| 43 | } |
| 44 | |
| 45 | //------------------------------------------------- |
| 46 | // rom_region - device-specific ROM region |
| 47 | //------------------------------------------------- |
| 48 | |
| 49 | const rom_entry *nubus_lview_device::device_rom_region() const |
| 50 | { |
| 51 | return ROM_NAME( lview ); |
| 52 | } |
| 53 | |
| 54 | //************************************************************************** |
| 55 | // LIVE DEVICE |
| 56 | //************************************************************************** |
| 57 | |
| 58 | //------------------------------------------------- |
| 59 | // nubus_lview_device - constructor |
| 60 | //------------------------------------------------- |
| 61 | |
| 62 | nubus_lview_device::nubus_lview_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 63 | device_t(mconfig, PDS030_LVIEW, "Lapis ProColor Server 8*16", tag, owner, clock), |
| 64 | device_nubus_card_interface(mconfig, *this) |
| 65 | { |
| 66 | m_shortname = "pd3_lviw"; |
| 67 | } |
| 68 | |
| 69 | nubus_lview_device::nubus_lview_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 70 | device_t(mconfig, type, name, tag, owner, clock), |
| 71 | device_nubus_card_interface(mconfig, *this) |
| 72 | { |
| 73 | m_shortname = "pd3_lviw"; |
| 74 | } |
| 75 | |
| 76 | //------------------------------------------------- |
| 77 | // device_start - device-specific startup |
| 78 | //------------------------------------------------- |
| 79 | |
| 80 | void nubus_lview_device::device_start() |
| 81 | { |
| 82 | UINT32 slotspace; |
| 83 | |
| 84 | // set_nubus_device makes m_slot valid |
| 85 | set_nubus_device(); |
| 86 | install_declaration_rom(this, LVIEW_ROM_REGION); |
| 87 | |
| 88 | slotspace = get_slotspace(); |
| 89 | |
| 90 | // printf("[lview %p] slotspace = %x\n", this, slotspace); |
| 91 | |
| 92 | m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE); |
| 93 | m_vram32 = (UINT32 *)m_vram; |
| 94 | |
| 95 | m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this)); |
| 96 | m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_lview_device::vram_r), this), write32_delegate(FUNC(nubus_lview_device::vram_w), this)); |
| 97 | m_nubus->install_device(slotspace+0xb0000, slotspace+0xbffff, read32_delegate(FUNC(nubus_lview_device::lview_r), this), write32_delegate(FUNC(nubus_lview_device::lview_w), this)); |
| 98 | |
| 99 | m_timer = timer_alloc(0, NULL); |
| 100 | m_screen = NULL; // can we look this up now? |
| 101 | } |
| 102 | |
| 103 | //------------------------------------------------- |
| 104 | // device_reset - device-specific reset |
| 105 | //------------------------------------------------- |
| 106 | |
| 107 | void nubus_lview_device::device_reset() |
| 108 | { |
| 109 | m_vbl_disable = 1; |
| 110 | m_protstate = 0; |
| 111 | memset(m_vram, 0, VRAM_SIZE); |
| 112 | memset(m_palette, 0, sizeof(m_palette)); |
| 113 | |
| 114 | m_palette[0] = MAKE_RGB(255, 255, 255); |
| 115 | m_palette[0x80] = MAKE_RGB(0, 0, 0); |
| 116 | } |
| 117 | |
| 118 | |
| 119 | void nubus_lview_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) |
| 120 | { |
| 121 | if (!m_vbl_disable) |
| 122 | { |
| 123 | raise_slot_irq(); |
| 124 | } |
| 125 | |
| 126 | m_timer->adjust(m_screen->time_until_pos(599, 0), 0); |
| 127 | } |
| 128 | |
| 129 | /*************************************************************************** |
| 130 | |
| 131 | CB264 section |
| 132 | |
| 133 | ***************************************************************************/ |
| 134 | |
| 135 | UINT32 nubus_lview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 136 | { |
| 137 | UINT32 *scanline; |
| 138 | int x, y; |
| 139 | UINT8 pixels, *vram; |
| 140 | |
| 141 | // first time? kick off the VBL timer |
| 142 | if (!m_screen) |
| 143 | { |
| 144 | m_screen = &screen; |
| 145 | m_timer->adjust(m_screen->time_until_pos(599, 0), 0); |
| 146 | } |
| 147 | |
| 148 | vram = m_vram + 0x20; |
| 149 | |
| 150 | for (y = 0; y < 600; y++) |
| 151 | { |
| 152 | scanline = &bitmap.pix32(y); |
| 153 | for (x = 0; x < 832/8; x++) |
| 154 | { |
| 155 | pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; |
| 156 | |
| 157 | *scanline++ = m_palette[(pixels&0x80)]; |
| 158 | *scanline++ = m_palette[((pixels<<1)&0x80)]; |
| 159 | *scanline++ = m_palette[((pixels<<2)&0x80)]; |
| 160 | *scanline++ = m_palette[((pixels<<3)&0x80)]; |
| 161 | *scanline++ = m_palette[((pixels<<4)&0x80)]; |
| 162 | *scanline++ = m_palette[((pixels<<5)&0x80)]; |
| 163 | *scanline++ = m_palette[((pixels<<6)&0x80)]; |
| 164 | *scanline++ = m_palette[((pixels<<7)&0x80)]; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | READ32_MEMBER( nubus_lview_device::lview_r ) |
| 172 | { |
| 173 | UINT32 rv = 0; |
| 174 | |
| 175 | // printf("prot_r: @ %x, mask %08x [PC=%x state %d]\n", offset, mem_mask, machine().device("maincpu")->safe_pc(), m_protstate); |
| 176 | |
| 177 | if ((m_protstate == 1) || (m_protstate == 10) || (machine().device("maincpu")->safe_pc() == 0x5aac)) |
| 178 | { |
| 179 | rv = 0x02020202; |
| 180 | } |
| 181 | |
| 182 | if (m_protstate == 8) |
| 183 | { |
| 184 | rv = 0x01010101; |
| 185 | } |
| 186 | |
| 187 | m_protstate++; |
| 188 | return rv; |
| 189 | } |
| 190 | |
| 191 | WRITE32_MEMBER( nubus_lview_device::lview_w ) |
| 192 | { |
| 193 | // if (offset != 0x7a && offset != 0x3ffb) printf("prot_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); |
| 194 | |
| 195 | if (offset == 0x7a) |
| 196 | { |
| 197 | if (data == 1) |
| 198 | { |
| 199 | m_vbl_disable = 0; |
| 200 | lower_slot_irq(); |
| 201 | } |
| 202 | else |
| 203 | { |
| 204 | m_vbl_disable = 1; |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | WRITE32_MEMBER( nubus_lview_device::vram_w ) |
| 210 | { |
| 211 | COMBINE_DATA(&m_vram32[offset]); |
| 212 | } |
| 213 | |
| 214 | READ32_MEMBER( nubus_lview_device::vram_r ) |
| 215 | { |
| 216 | return m_vram32[offset]; |
| 217 | } |
trunk/src/mess/video/pds30_sigmalview.h
| r0 | r18656 | |
| 1 | #pragma once |
| 2 | |
| 3 | #ifndef __NUBUS_LVIEW_H__ |
| 4 | #define __NUBUS_LVIEW_H__ |
| 5 | |
| 6 | #include "emu.h" |
| 7 | #include "machine/nubus.h" |
| 8 | |
| 9 | //************************************************************************** |
| 10 | // TYPE DEFINITIONS |
| 11 | //************************************************************************** |
| 12 | |
| 13 | // ======================> nubus_lview_device |
| 14 | |
| 15 | class nubus_lview_device : |
| 16 | public device_t, |
| 17 | public device_nubus_card_interface |
| 18 | { |
| 19 | public: |
| 20 | // construction/destruction |
| 21 | nubus_lview_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 22 | nubus_lview_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(lview_r); |
| 36 | DECLARE_WRITE32_MEMBER(lview_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_vbl_disable, m_toggle; |
| 44 | UINT32 m_palette[256]; |
| 45 | screen_device *m_screen; |
| 46 | emu_timer *m_timer; |
| 47 | int m_protstate; |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | // device type definition |
| 52 | extern const device_type PDS030_LVIEW; |
| 53 | |
| 54 | #endif /* __NUBUS_LVIEW_H__ */ |