src/mess/video/pc_video.c
| r5960 | r5961 | |
| 138 | 138 | COMBINE_DATA(((UINT32 *) videoram) + offset); |
| 139 | 139 | pc_anythingdirty = 1; |
| 140 | 140 | } |
| 141 | | |
| 142 | | |
| 143 | | |
| 144 | | /************************************* |
| 145 | | * |
| 146 | | * Graphics renderers |
| 147 | | * |
| 148 | | *************************************/ |
| 149 | | |
| 150 | | void pc_render_gfx_1bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc, |
| 151 | | const UINT8 *vram, const UINT16 *palette, int interlace) |
| 152 | | { |
| 153 | | int sx, sy, sh; |
| 154 | | int offs = mscrtc6845_get_start(crtc)*2; |
| 155 | | int lines = mscrtc6845_get_char_lines(crtc); |
| 156 | | int height = mscrtc6845_get_char_height(crtc); |
| 157 | | int columns = mscrtc6845_get_char_columns(crtc)*2; |
| 158 | | |
| 159 | | if (!vram) |
| 160 | | vram = videoram; |
| 161 | | if (!palette) |
| 162 | | palette = dummy_palette; |
| 163 | | |
| 164 | | for (sy = 0; sy < lines; sy++) |
| 165 | | { |
| 166 | | for (sh = 0; sh < height; sh++) |
| 167 | | { |
| 168 | | UINT16 *dest = BITMAP_ADDR16(bitmap, sy * height + sh, 0); |
| 169 | | const UINT8 *src = &vram[offs | ((sh % interlace) << 13)]; |
| 170 | | |
| 171 | | for (sx = 0; sx < columns; sx++) |
| 172 | | { |
| 173 | | UINT8 b = *(src++); |
| 174 | | *(dest++) = palette[(b >> 7) & 0x01]; |
| 175 | | *(dest++) = palette[(b >> 6) & 0x01]; |
| 176 | | *(dest++) = palette[(b >> 5) & 0x01]; |
| 177 | | *(dest++) = palette[(b >> 4) & 0x01]; |
| 178 | | *(dest++) = palette[(b >> 3) & 0x01]; |
| 179 | | *(dest++) = palette[(b >> 2) & 0x01]; |
| 180 | | *(dest++) = palette[(b >> 1) & 0x01]; |
| 181 | | *(dest++) = palette[(b >> 0) & 0x01]; |
| 182 | | } |
| 183 | | } |
| 184 | | offs = (offs + columns) & 0x1fff; |
| 185 | | } |
| 186 | | } |
| 187 | | |
| 188 | | |
| 189 | | |
| 190 | | void pc_render_gfx_2bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc, |
| 191 | | const UINT8 *vram, const UINT16 *palette, int interlace) |
| 192 | | { |
| 193 | | int sx, sy, sh; |
| 194 | | int offs = mscrtc6845_get_start(crtc)*2; |
| 195 | | int lines = mscrtc6845_get_char_lines(crtc); |
| 196 | | int height = mscrtc6845_get_char_height(crtc); |
| 197 | | int columns = mscrtc6845_get_char_columns(crtc)*2; |
| 198 | | UINT16 *dest; |
| 199 | | const UINT8 *src; |
| 200 | | |
| 201 | | if (!vram) |
| 202 | | vram = videoram; |
| 203 | | if (!palette) |
| 204 | | palette = dummy_palette; |
| 205 | | |
| 206 | | for (sy = 0; sy < lines; sy++) |
| 207 | | { |
| 208 | | for (sh = 0; sh < height; sh++) |
| 209 | | { |
| 210 | | if (sy*height+sh >= bitmap->height) |
| 211 | | return; |
| 212 | | |
| 213 | | dest = BITMAP_ADDR16(bitmap, sy * height + sh, 0); |
| 214 | | src = &vram[offs | ((sh % interlace) << 13)]; |
| 215 | | |
| 216 | | for (sx = 0; sx < columns; sx++) |
| 217 | | { |
| 218 | | UINT8 b = *(src++); |
| 219 | | *(dest++) = palette[(b >> 6) & 0x03]; |
| 220 | | *(dest++) = palette[(b >> 4) & 0x03]; |
| 221 | | *(dest++) = palette[(b >> 2) & 0x03]; |
| 222 | | *(dest++) = palette[(b >> 0) & 0x03]; |
| 223 | | } |
| 224 | | } |
| 225 | | offs = (offs + columns) & 0x1fff; |
| 226 | | } |
| 227 | | } |
| 228 | | |
| 229 | | |
| 230 | | |
| 231 | | void pc_render_gfx_4bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc, |
| 232 | | const UINT8 *vram, const UINT16 *palette, int interlace) |
| 233 | | { |
| 234 | | int sx, sy, sh; |
| 235 | | int offs = mscrtc6845_get_start(crtc)*2; |
| 236 | | int lines = mscrtc6845_get_char_lines(crtc); |
| 237 | | int height = mscrtc6845_get_char_height(crtc); |
| 238 | | int columns = mscrtc6845_get_char_columns(crtc)*2; |
| 239 | | |
| 240 | | if (!vram) |
| 241 | | vram = videoram; |
| 242 | | if (!palette) |
| 243 | | palette = dummy_palette; |
| 244 | | |
| 245 | | for (sy = 0; sy < lines; sy++) |
| 246 | | { |
| 247 | | for (sh = 0; sh < height; sh++) |
| 248 | | { |
| 249 | | UINT16 *dest = BITMAP_ADDR16(bitmap, sy * height + sh, 0); |
| 250 | | const UINT8 *src = &vram[offs | ((sh % interlace) << 13)]; |
| 251 | | |
| 252 | | for (sx = 0; sx < columns; sx++) |
| 253 | | { |
| 254 | | UINT8 b = *(src++); |
| 255 | | *(dest++) = palette[(b >> 4) & 0x0F]; |
| 256 | | *(dest++) = palette[(b >> 0) & 0x0F]; |
| 257 | | } |
| 258 | | } |
| 259 | | offs = (offs + columns) & 0x1fff; |
| 260 | | } |
| 261 | | } |
src/mess/video/pc_video.h
| r5960 | r5961 | |
| 25 | 25 | WRITE16_HANDLER( pc_video_videoram16le_w ); |
| 26 | 26 | WRITE32_HANDLER( pc_video_videoram32_w ); |
| 27 | 27 | |
| 28 | | /* renderers */ |
| 29 | | void pc_render_gfx_1bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc, |
| 30 | | const UINT8 *vram, const UINT16 *palette, int interlace); |
| 31 | | void pc_render_gfx_2bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc, |
| 32 | | const UINT8 *vram, const UINT16 *palette, int interlace); |
| 33 | | void pc_render_gfx_4bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc, |
| 34 | | const UINT8 *vram, const UINT16 *palette, int interlace); |
| 35 | | |
| 36 | | |
| 37 | 28 | #endif /* PC_VIDEO_H */ |