S3 Vision968 work.
This commit is contained in:
@@ -217,6 +217,11 @@ extern uint8_t bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t
|
||||
extern void bt48x_recalctimings(void *p, svga_t *svga);
|
||||
extern void bt48x_hwcursor_draw(svga_t *svga, int displine);
|
||||
|
||||
extern void ibm_rgb525_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga);
|
||||
extern uint8_t ibm_rgb525_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga);
|
||||
extern void ibm_rgb525_recalctimings(void *p, svga_t *svga);
|
||||
extern void ibm_rgb525_hwcursor_draw(svga_t *svga, int displine);
|
||||
|
||||
extern void icd2061_write(void *p, int val);
|
||||
extern float icd2061_getclock(int clock, void *p);
|
||||
|
||||
@@ -259,6 +264,7 @@ extern const device_t bt485_ramdac_device;
|
||||
extern const device_t att20c505_ramdac_device;
|
||||
extern const device_t bt485a_ramdac_device;
|
||||
extern const device_t gendac_ramdac_device;
|
||||
extern const device_t ibm_rgb525_ramdac_device;
|
||||
extern const device_t ics2494an_305_device;
|
||||
extern const device_t ics2595_device;
|
||||
extern const device_t icd2061_device;
|
||||
|
@@ -328,6 +328,10 @@ extern const device_t s3_diamond_stealth64_pci_device;
|
||||
extern const device_t s3_diamond_stealth64_vlb_device;
|
||||
extern const device_t s3_diamond_stealth64_964_pci_device;
|
||||
extern const device_t s3_diamond_stealth64_964_vlb_device;
|
||||
extern const device_t s3_elsa_winner2000_pro_x_964_pci_device;
|
||||
extern const device_t s3_elsa_winner2000_pro_x_964_vlb_device;
|
||||
extern const device_t s3_elsa_winner2000_pro_x_pci_device;
|
||||
extern const device_t s3_elsa_winner2000_pro_x_vlb_device;
|
||||
extern const device_t s3_trio64v2_dx_pci_device;
|
||||
|
||||
/* S3 ViRGE */
|
||||
|
978
src/video/vid_ibm_rgb525_ramdac.c
Normal file
978
src/video/vid_ibm_rgb525_ramdac.c
Normal file
@@ -0,0 +1,978 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Emulation of the IBM RGB 525 true colour RAMDAC.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2020 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
|
||||
|
||||
typedef union {
|
||||
uint8_t pixel;
|
||||
struct {
|
||||
uint8_t b :2, g :3, r :2;
|
||||
};
|
||||
} ibm_rgb525_pixel8_t;
|
||||
|
||||
typedef union {
|
||||
uint16_t pixel;
|
||||
struct {
|
||||
uint16_t b_ :5, g_ :6, r_ :5;
|
||||
};
|
||||
struct {
|
||||
uint16_t b :5, g :5, r :5, c :1;
|
||||
};
|
||||
} ibm_rgb525_pixel16_t;
|
||||
|
||||
typedef union {
|
||||
uint32_t pixel;
|
||||
struct {
|
||||
uint8_t b, g, r, a;
|
||||
};
|
||||
} ibm_rgb525_pixel32_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PALETTE extpal;
|
||||
uint32_t extpallook[256];
|
||||
uint8_t indexed_data[2048];
|
||||
uint8_t cursor32_data[256];
|
||||
uint8_t cursor64_data[1024];
|
||||
uint8_t palettes[3][256];
|
||||
ibm_rgb525_pixel32_t extra_pal[4];
|
||||
int hwc_y, hwc_x;
|
||||
uint16_t index, smlc_part;
|
||||
uint8_t cmd_r0;
|
||||
uint8_t cmd_r1;
|
||||
uint8_t cmd_r2;
|
||||
uint8_t cmd_r3;
|
||||
uint8_t cmd_r4;
|
||||
uint8_t status, indx_cntl;
|
||||
uint8_t cursor_array;
|
||||
} ibm_rgb525_ramdac_t;
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_render_4bpp(svga_t *svga)
|
||||
{
|
||||
int x;
|
||||
uint32_t *p;
|
||||
ibm_rgb525_pixel32_t dat_out;
|
||||
uint8_t dat;
|
||||
uint32_t dat32 = 0x00000000;
|
||||
uint64_t dat64 = 0x0000000000000000ULL;
|
||||
uint64_t dat642 = 0x0000000000000000ULL;
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) svga->ramdac;
|
||||
uint8_t b8_dcol = (ramdac->indexed_data[0x0c] & 0xc0) >> 6;
|
||||
uint8_t partition = (ramdac->indexed_data[0x07] & 0x0f) << 4;
|
||||
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
|
||||
uint8_t swap_nib = ramdac->indexed_data[0x72] & 0x21;
|
||||
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x03;
|
||||
|
||||
if ((svga->displine + svga->y_add) < 0)
|
||||
return;
|
||||
|
||||
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[(svga->ma >> 12) + 1] || svga->changedvram[(svga->ma >> 12) + 2] || svga->fullchange) {
|
||||
p = &buffer32->line[svga->displine + svga->y_add][svga->x_add];
|
||||
|
||||
if (svga->firstline_draw == 2000)
|
||||
svga->firstline_draw = svga->displine;
|
||||
svga->lastline_draw = svga->displine;
|
||||
|
||||
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
|
||||
if (svga->crtc[0x17] & 0x80) {
|
||||
if (vram_size == 3) {
|
||||
if (!(x & 31)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
dat642 = *(uint64_t *)(&svga->vram[svga->ma + 8]);
|
||||
if (swap_word) {
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
dat642 = (dat642 << 32ULL) | (dat642 >> 32ULL);
|
||||
}
|
||||
}
|
||||
if (swap_nib)
|
||||
dat = (((x & 16) ? dat642 : dat64) >> ((x & 15) << 2)) & 0xf;
|
||||
else
|
||||
dat = (((x & 16) ? dat642 : dat64) >> (((x & 15) << 2) ^ 4)) & 0xf;
|
||||
} else if (vram_size == 1) {
|
||||
if (!(x & 15)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
if (swap_word)
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
}
|
||||
if (swap_nib)
|
||||
dat = (dat64 >> ((x & 15) << 2)) & 0xf;
|
||||
else
|
||||
dat = (dat64 >> (((x & 15) << 2) ^ 4)) & 0xf;
|
||||
} else {
|
||||
if (!(x & 7))
|
||||
dat32 = *(uint32_t *)(&svga->vram[svga->ma]);
|
||||
if (swap_nib)
|
||||
dat = (dat32 >> ((x & 7) << 2)) & 0xf;
|
||||
else
|
||||
dat = (dat32 >> (((x & 7) << 2) ^ 4)) & 0xf;
|
||||
}
|
||||
} else
|
||||
dat = 0x00000000;
|
||||
if (b8_dcol == 0x00) {
|
||||
dat_out.a = 0x00;
|
||||
dat_out.r = ramdac->palettes[0][partition | dat];
|
||||
dat_out.g = ramdac->palettes[1][partition | dat];
|
||||
dat_out.b = ramdac->palettes[2][partition | dat];
|
||||
} else
|
||||
dat_out.pixel = video_8togs[dat];
|
||||
if (svga->lowres) {
|
||||
p[x << 1] = p[(x << 1) + 1] = dat_out.pixel & 0xffffff;
|
||||
} else
|
||||
p[x] = dat_out.pixel & 0xffffff;
|
||||
|
||||
if ((vram_size == 3) && ((x & 31) == 31))
|
||||
svga->ma = (svga->ma + 16) & svga->vram_display_mask;
|
||||
if ((vram_size == 1) && ((x & 15) == 15))
|
||||
svga->ma = (svga->ma + 8) & svga->vram_display_mask;
|
||||
else if ((!vram_size) && ((x & 7) == 7))
|
||||
svga->ma = (svga->ma + 4) & svga->vram_display_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_render_8bpp(svga_t *svga)
|
||||
{
|
||||
int x;
|
||||
uint32_t *p;
|
||||
ibm_rgb525_pixel32_t dat_out;
|
||||
uint8_t dat;
|
||||
uint32_t dat32 = 0x00000000;
|
||||
uint64_t dat64 = 0x0000000000000000ULL;
|
||||
uint64_t dat642 = 0x0000000000000000ULL;
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) svga->ramdac;
|
||||
uint8_t b8_dcol = (ramdac->indexed_data[0x0c] & 0xc0) >> 6;
|
||||
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
|
||||
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x03;
|
||||
|
||||
if ((svga->displine + svga->y_add) < 0)
|
||||
return;
|
||||
|
||||
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[(svga->ma >> 12) + 1] || svga->changedvram[(svga->ma >> 12) + 2] || svga->fullchange) {
|
||||
p = &buffer32->line[svga->displine + svga->y_add][svga->x_add];
|
||||
|
||||
if (svga->firstline_draw == 2000)
|
||||
svga->firstline_draw = svga->displine;
|
||||
svga->lastline_draw = svga->displine;
|
||||
|
||||
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
|
||||
if (svga->crtc[0x17] & 0x80) {
|
||||
if (vram_size == 3) {
|
||||
if (!(x & 15)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
dat642 = *(uint64_t *)(&svga->vram[svga->ma + 8]);
|
||||
if (swap_word) {
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
dat642 = (dat642 << 32ULL) | (dat642 >> 32ULL);
|
||||
}
|
||||
}
|
||||
dat = (((x & 8) ? dat642 : dat64) >> ((x & 7) << 3)) & 0xff;
|
||||
} else if (vram_size == 1) {
|
||||
if (!(x & 7)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
if (swap_word)
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
}
|
||||
dat = (dat64 >> ((x & 7) << 3)) & 0xff;
|
||||
} else {
|
||||
if (!(x & 3))
|
||||
dat32 = *(uint32_t *)(&svga->vram[svga->ma]);
|
||||
dat = (dat32 >> ((x & 3) << 3)) & 0xff;
|
||||
}
|
||||
} else
|
||||
dat = 0x00000000;
|
||||
if (b8_dcol == 0x00) {
|
||||
dat_out.a = 0x00;
|
||||
dat_out.r = ramdac->palettes[0][dat];
|
||||
dat_out.g = ramdac->palettes[1][dat];
|
||||
dat_out.b = ramdac->palettes[2][dat];
|
||||
} else
|
||||
dat_out.pixel = video_8togs[dat];
|
||||
if (svga->lowres) {
|
||||
p[x << 1] = p[(x << 1) + 1] = dat_out.pixel & 0xffffff;
|
||||
} else
|
||||
p[x] = dat_out.pixel & 0xffffff;
|
||||
|
||||
if ((vram_size == 3) && ((x & 15) == 15))
|
||||
svga->ma = (svga->ma + 16) & svga->vram_display_mask;
|
||||
else if ((vram_size == 1) && ((x & 7) == 7))
|
||||
svga->ma = (svga->ma + 8) & svga->vram_display_mask;
|
||||
else if ((!vram_size) && ((x & 3) == 3))
|
||||
svga->ma = (svga->ma + 4) & svga->vram_display_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_render_15_16bpp(svga_t *svga)
|
||||
{
|
||||
int x;
|
||||
uint32_t *p;
|
||||
ibm_rgb525_pixel16_t *dat_ex;
|
||||
ibm_rgb525_pixel32_t dat_out;
|
||||
uint16_t dat;
|
||||
uint32_t dat32 = 0x00000000;
|
||||
uint64_t dat64 = 0x0000000000000000ULL;
|
||||
uint64_t dat642 = 0x0000000000000000ULL;
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) svga->ramdac;
|
||||
uint8_t b16_dcol = (ramdac->indexed_data[0x0c] & 0xc0) >> 6;
|
||||
uint8_t by16_pol = ramdac->indexed_data[0x0c] & 0x20;
|
||||
uint8_t b555_565 = ramdac->indexed_data[0x0c] & 0x02;
|
||||
uint8_t bspr_cnt = ramdac->indexed_data[0x0c] & 0x01;
|
||||
uint8_t partition = (ramdac->indexed_data[0x07] & 0x0e) << 4;
|
||||
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80;
|
||||
uint8_t swaprb = ramdac->indexed_data[0x72] & 0x80;
|
||||
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
|
||||
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01, temp;
|
||||
|
||||
if ((svga->displine + svga->y_add) < 0)
|
||||
return;
|
||||
|
||||
if (b555_565 && (b16_dcol != 0x01))
|
||||
partition &= 0xc0;
|
||||
|
||||
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[(svga->ma >> 12) + 1] || svga->changedvram[(svga->ma >> 12) + 2] || svga->fullchange) {
|
||||
p = &buffer32->line[svga->displine + svga->y_add][svga->x_add];
|
||||
|
||||
if (svga->firstline_draw == 2000)
|
||||
svga->firstline_draw = svga->displine;
|
||||
svga->lastline_draw = svga->displine;
|
||||
|
||||
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
|
||||
if (svga->crtc[0x17] & 0x80) {
|
||||
if (vram_size == 2) {
|
||||
if (!(x & 7)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
dat642 = *(uint64_t *)(&svga->vram[svga->ma + 8]);
|
||||
if (swap_word) {
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
dat642 = (dat64 << 32ULL) | (dat642 >> 32ULL);
|
||||
}
|
||||
}
|
||||
dat = (((x & 4) ? dat642 : dat64) >> ((x & 3) << 4)) & 0xffff;
|
||||
} else if (vram_size == 1) {
|
||||
if (!(x & 3)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
if (swap_word)
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
}
|
||||
dat = (dat64 >> ((x & 3) << 4)) & 0xffff;
|
||||
} else {
|
||||
if (!(x & 1))
|
||||
dat32 = *(uint32_t *)(&svga->vram[svga->ma]);
|
||||
dat = (dat32 >> ((x & 1) << 4)) & 0xffff;
|
||||
}
|
||||
} else
|
||||
dat = 0x00000000;
|
||||
dat_ex = (ibm_rgb525_pixel16_t *) &dat;
|
||||
if (b555_565 && (b16_dcol != 0x01)) {
|
||||
if (swaprb) {
|
||||
temp = dat_ex->r_;
|
||||
dat_ex->r_ = dat_ex->b_;
|
||||
dat_ex->b_ = temp;
|
||||
}
|
||||
if (b16_dcol == 0x00) {
|
||||
dat_out.a = 0x00;
|
||||
if (bspr_cnt) {
|
||||
dat_out.r = ramdac->palettes[0][partition | dat_ex->r_];
|
||||
dat_out.g = ramdac->palettes[1][partition | dat_ex->g_];
|
||||
dat_out.b = ramdac->palettes[2][partition | dat_ex->b_];
|
||||
} else {
|
||||
dat_out.r = ramdac->palettes[0][dat_ex->r_ << 3];
|
||||
dat_out.g = ramdac->palettes[1][dat_ex->g_ << 2];
|
||||
dat_out.b = ramdac->palettes[2][dat_ex->b_ << 3];
|
||||
}
|
||||
if ((svga->ramdac_type != RAMDAC_8BIT) && !b6bit_lin) {
|
||||
dat_out.r |= ((dat_out.r & 0xc0) >> 6);
|
||||
dat_out.g |= ((dat_out.g & 0xc0) >> 6);
|
||||
dat_out.b |= ((dat_out.b & 0xc0) >> 6);
|
||||
}
|
||||
} else
|
||||
dat_out.pixel = video_16to32[dat_ex->pixel];
|
||||
} else {
|
||||
if (swaprb) {
|
||||
temp = dat_ex->r;
|
||||
dat_ex->r = dat_ex->b;
|
||||
dat_ex->b = temp;
|
||||
}
|
||||
if (by16_pol)
|
||||
dat ^= 0x8000;
|
||||
if ((b16_dcol == 0x00) || ((b16_dcol == 0x01) && !(dat & 0x8000))) {
|
||||
dat_out.a = 0x00;
|
||||
if (bspr_cnt) {
|
||||
dat_out.r = ramdac->palettes[0][partition | dat_ex->r];
|
||||
dat_out.g = ramdac->palettes[1][partition | dat_ex->g];
|
||||
dat_out.b = ramdac->palettes[2][partition | dat_ex->b];
|
||||
} else {
|
||||
dat_out.r = ramdac->palettes[0][dat_ex->r << 3];
|
||||
dat_out.g = ramdac->palettes[1][dat_ex->g << 3];
|
||||
dat_out.b = ramdac->palettes[2][dat_ex->b << 3];
|
||||
}
|
||||
if ((svga->ramdac_type != RAMDAC_8BIT) && !b6bit_lin) {
|
||||
dat_out.r |= ((dat_out.r & 0xc0) >> 6);
|
||||
dat_out.g |= ((dat_out.g & 0xc0) >> 6);
|
||||
dat_out.b |= ((dat_out.b & 0xc0) >> 6);
|
||||
}
|
||||
} else
|
||||
dat_out.pixel = video_15to32[dat_ex->pixel & 0x7fff];
|
||||
}
|
||||
if (svga->lowres) {
|
||||
p[x << 1] = p[(x << 1) + 1] = dat_out.pixel & 0xffffff;
|
||||
} else
|
||||
p[x] = dat_out.pixel & 0xffffff;
|
||||
|
||||
if ((vram_size == 3) && ((x & 7) == 7))
|
||||
svga->ma = (svga->ma + 16) & svga->vram_display_mask;
|
||||
else if ((vram_size == 1) && ((x & 3) == 3))
|
||||
svga->ma = (svga->ma + 8) & svga->vram_display_mask;
|
||||
else if (!vram_size && ((x & 1) == 1))
|
||||
svga->ma = (svga->ma + 4) & svga->vram_display_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_render_24bpp(svga_t *svga)
|
||||
{
|
||||
int x;
|
||||
uint32_t *p;
|
||||
ibm_rgb525_pixel32_t *dat_ex;
|
||||
uint32_t dat;
|
||||
uint64_t dat64[6];
|
||||
uint8_t *dat8 = (uint8_t *) dat64;
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) svga->ramdac;
|
||||
uint8_t b24_dcol = ramdac->indexed_data[0x0d] & 0x01;
|
||||
uint8_t swaprb = ramdac->indexed_data[0x72] & 0x80;
|
||||
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
|
||||
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01;
|
||||
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80, temp;
|
||||
|
||||
if ((svga->displine + svga->y_add) < 0)
|
||||
return;
|
||||
|
||||
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[(svga->ma >> 12) + 1] || svga->changedvram[(svga->ma >> 12) + 2] || svga->fullchange) {
|
||||
p = &buffer32->line[svga->displine + svga->y_add][svga->x_add];
|
||||
|
||||
if (svga->firstline_draw == 2000)
|
||||
svga->firstline_draw = svga->displine;
|
||||
svga->lastline_draw = svga->displine;
|
||||
|
||||
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
|
||||
dat_ex = (ibm_rgb525_pixel32_t *) &dat;
|
||||
if (svga->crtc[0x17] & 0x80) {
|
||||
if (vram_size == 3) {
|
||||
if ((x & 15) == 0) {
|
||||
dat64[0] = *(uint64_t *)(&svga->vram[svga->ma & svga->vram_display_mask]);
|
||||
dat64[1] = *(uint64_t *)(&svga->vram[(svga->ma + 8) & svga->vram_display_mask]);
|
||||
dat64[2] = *(uint64_t *)(&svga->vram[(svga->ma + 16) & svga->vram_display_mask]);
|
||||
dat64[3] = *(uint64_t *)(&svga->vram[(svga->ma + 24) & svga->vram_display_mask]);
|
||||
dat64[4] = *(uint64_t *)(&svga->vram[(svga->ma + 32) & svga->vram_display_mask]);
|
||||
dat64[5] = *(uint64_t *)(&svga->vram[(svga->ma + 40) & svga->vram_display_mask]);
|
||||
if (swap_word) {
|
||||
dat64[0] = (dat64[0] << 32ULL) | (dat64[0] >> 32ULL);
|
||||
dat64[1] = (dat64[1] << 32ULL) | (dat64[1] >> 32ULL);
|
||||
dat64[2] = (dat64[2] << 32ULL) | (dat64[2] >> 32ULL);
|
||||
dat64[3] = (dat64[3] << 32ULL) | (dat64[3] >> 32ULL);
|
||||
dat64[4] = (dat64[4] << 32ULL) | (dat64[4] >> 32ULL);
|
||||
dat64[5] = (dat64[5] << 32ULL) | (dat64[5] >> 32ULL);
|
||||
}
|
||||
}
|
||||
dat_ex = (ibm_rgb525_pixel32_t *) &(dat8[((x & 15) * 3)]);
|
||||
} else if (vram_size == 1) {
|
||||
if ((x & 7) == 0) {
|
||||
dat64[0] = *(uint64_t *)(&svga->vram[svga->ma & svga->vram_display_mask]);
|
||||
dat64[1] = *(uint64_t *)(&svga->vram[(svga->ma + 8) & svga->vram_display_mask]);
|
||||
dat64[2] = *(uint64_t *)(&svga->vram[(svga->ma + 16) & svga->vram_display_mask]);
|
||||
if (swap_word) {
|
||||
dat64[0] = (dat64[0] << 32ULL) | (dat64[0] >> 32ULL);
|
||||
dat64[1] = (dat64[1] << 32ULL) | (dat64[1] >> 32ULL);
|
||||
dat64[2] = (dat64[2] << 32ULL) | (dat64[2] >> 32ULL);
|
||||
}
|
||||
}
|
||||
dat_ex = (ibm_rgb525_pixel32_t *) &(dat8[((x & 7) * 3)]);
|
||||
} else
|
||||
dat = 0x00000000;
|
||||
} else
|
||||
dat = 0x00000000;
|
||||
if (swaprb) {
|
||||
temp = dat_ex->r;
|
||||
dat_ex->r = dat_ex->b;
|
||||
dat_ex->b = temp;
|
||||
}
|
||||
if (b24_dcol == 0x00) {
|
||||
dat_ex->a = 0x00;
|
||||
dat_ex->r = ramdac->palettes[0][dat_ex->r];
|
||||
dat_ex->g = ramdac->palettes[1][dat_ex->g];
|
||||
dat_ex->g = ramdac->palettes[2][dat_ex->b];
|
||||
if ((svga->ramdac_type != RAMDAC_8BIT) && !b6bit_lin) {
|
||||
dat_ex->r |= ((dat_ex->r & 0xc0) >> 6);
|
||||
dat_ex->g |= ((dat_ex->g & 0xc0) >> 6);
|
||||
dat_ex->b |= ((dat_ex->b & 0xc0) >> 6);
|
||||
}
|
||||
}
|
||||
if (svga->lowres) {
|
||||
p[x << 1] = p[(x << 1) + 1] = dat_ex->pixel & 0xffffff;
|
||||
} else
|
||||
p[x] = dat_ex->pixel & 0xffffff;
|
||||
|
||||
if ((vram_size == 3) && ((x & 15) == 15))
|
||||
svga->ma = (svga->ma + 48) & svga->vram_display_mask;
|
||||
else if ((vram_size == 1) && ((x & 7) == 7))
|
||||
svga->ma = (svga->ma + 24) & svga->vram_display_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_render_32bpp(svga_t *svga)
|
||||
{
|
||||
int x;
|
||||
uint32_t *p;
|
||||
ibm_rgb525_pixel32_t *dat_ex;
|
||||
uint32_t dat = 0x00000000;
|
||||
uint64_t dat64 = 0x0000000000000000ULL;
|
||||
uint64_t dat642 = 0x0000000000000000ULL;
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) svga->ramdac;
|
||||
uint8_t b32_dcol = ramdac->indexed_data[0x0e] & 0x03;
|
||||
uint8_t by32_pol = ramdac->indexed_data[0x0e] & 0x04;
|
||||
uint8_t swaprb = ramdac->indexed_data[0x72] & 0x80;
|
||||
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
|
||||
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01;
|
||||
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80, temp;
|
||||
|
||||
if ((svga->displine + svga->y_add) < 0)
|
||||
return;
|
||||
|
||||
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[(svga->ma >> 12) + 1] || svga->changedvram[(svga->ma >> 12) + 2] || svga->fullchange) {
|
||||
p = &buffer32->line[svga->displine + svga->y_add][svga->x_add];
|
||||
|
||||
if (svga->firstline_draw == 2000)
|
||||
svga->firstline_draw = svga->displine;
|
||||
svga->lastline_draw = svga->displine;
|
||||
|
||||
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
|
||||
if (svga->crtc[0x17] & 0x80) {
|
||||
if (vram_size == 3) {
|
||||
if (!(x & 3)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
dat642 = *(uint64_t *)(&svga->vram[svga->ma + 8]);
|
||||
if (swap_word) {
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
dat642 = (dat642 << 32ULL) | (dat642 >> 32ULL);
|
||||
}
|
||||
}
|
||||
dat = (((x & 2) ? dat642 : dat64) >> ((x & 1ULL) << 5ULL)) & 0xffffffff;
|
||||
} else if (vram_size == 1) {
|
||||
if (!(x & 1)) {
|
||||
dat64 = *(uint64_t *)(&svga->vram[svga->ma]);
|
||||
if (swap_word)
|
||||
dat64 = (dat64 << 32ULL) | (dat64 >> 32ULL);
|
||||
}
|
||||
dat = (dat64 >> ((x & 1ULL) << 5ULL)) & 0xffffffff;
|
||||
} else
|
||||
dat = *(uint32_t *)(&svga->vram[svga->ma]);
|
||||
} else
|
||||
dat = 0x00000000;
|
||||
dat_ex = (ibm_rgb525_pixel32_t *) &dat;
|
||||
if (swaprb) {
|
||||
temp = dat_ex->r;
|
||||
dat_ex->r = dat_ex->b;
|
||||
dat_ex->b = temp;
|
||||
}
|
||||
if ((b32_dcol < 0x03) && (by32_pol))
|
||||
dat ^= 0x01000000;
|
||||
if ((b32_dcol == 0x00) || ((b32_dcol == 0x01) && !(dat & 0x01000000))) {
|
||||
dat_ex->a = 0x00;
|
||||
dat_ex->r = ramdac->palettes[0][dat_ex->r];
|
||||
dat_ex->g = ramdac->palettes[1][dat_ex->g];
|
||||
dat_ex->g = ramdac->palettes[2][dat_ex->b];
|
||||
if ((svga->ramdac_type != RAMDAC_8BIT) && !b6bit_lin) {
|
||||
dat_ex->r |= ((dat_ex->r & 0xc0) >> 6);
|
||||
dat_ex->g |= ((dat_ex->g & 0xc0) >> 6);
|
||||
dat_ex->b |= ((dat_ex->b & 0xc0) >> 6);
|
||||
}
|
||||
}
|
||||
if (svga->lowres) {
|
||||
p[x << 1] = p[(x << 1) + 1] = dat_ex->pixel & 0xffffff;
|
||||
} else
|
||||
p[x] = dat_ex->pixel & 0xffffff;
|
||||
|
||||
if ((vram_size == 3) && ((x & 3) == 3))
|
||||
svga->ma = (svga->ma + 16) & svga->vram_display_mask;
|
||||
else if ((vram_size == 1) && ((x & 1) == 1))
|
||||
svga->ma = (svga->ma + 8) & svga->vram_display_mask;
|
||||
else if (!vram_size)
|
||||
svga->ma = (svga->ma + 4) & svga->vram_display_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ibm_rgb525_set_bpp(ibm_rgb525_ramdac_t *ramdac, svga_t *svga)
|
||||
{
|
||||
uint8_t b16_dcol = (ramdac->indexed_data[0x0c] & 0xc0) >> 6;
|
||||
uint8_t b555_565 = ramdac->indexed_data[0x0c] & 0x02;
|
||||
|
||||
if (ramdac->indexed_data[0x071] & 0x01)
|
||||
switch (ramdac->indexed_data[0x00a] & 0x07) {
|
||||
case 0x02:
|
||||
svga->bpp = 4;
|
||||
break;
|
||||
case 0x03:
|
||||
default:
|
||||
svga->bpp = 8;
|
||||
break;
|
||||
case 0x04:
|
||||
if (b555_565 && (b16_dcol != 0x01))
|
||||
svga->bpp = 16;
|
||||
else
|
||||
svga->bpp = 15;
|
||||
break;
|
||||
case 0x05:
|
||||
svga->bpp = 24;
|
||||
break;
|
||||
case 0x06:
|
||||
svga->bpp = 32;
|
||||
break;
|
||||
} else
|
||||
svga->bpp = 8;
|
||||
|
||||
// pclog("svga->bpp = %i\n", svga->bpp);
|
||||
|
||||
svga_recalctimings(svga);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga)
|
||||
{
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) p;
|
||||
uint16_t index;
|
||||
uint8_t rs = (addr & 0x03);
|
||||
uint16_t da_mask = 0x03ff;
|
||||
uint8_t updt_cntl = (ramdac->indexed_data[0x30] & 0x08);
|
||||
rs |= (!!rs2 << 2);
|
||||
|
||||
// pclog("[%04X:%08X] [W] RS%01X = %02X\n", CS, cpu_state.pc, rs, val);
|
||||
|
||||
switch (rs) {
|
||||
case 0x00: /* Palette Write Index Register (RS value = 0000) */
|
||||
case 0x03:
|
||||
svga->dac_pos = 0;
|
||||
svga->dac_status = addr & 0x03;
|
||||
svga->dac_addr = val;
|
||||
if (svga->dac_status)
|
||||
svga->dac_addr = (svga->dac_addr + 1) & da_mask;
|
||||
break;
|
||||
case 0x01: /* Palette Data Register (RS value = 0001) */
|
||||
index = svga->dac_addr & 255;
|
||||
if (svga->ramdac_type == RAMDAC_8BIT)
|
||||
ramdac->palettes[svga->dac_pos][index] = val;
|
||||
else
|
||||
ramdac->palettes[svga->dac_pos][index] = (val & 0x3f) << 2;
|
||||
svga_out(addr, val, svga);
|
||||
break;
|
||||
case 0x02: /* Pixel Read Mask Register (RS value = 0010) */
|
||||
svga_out(addr, val, svga);
|
||||
break;
|
||||
case 0x04:
|
||||
// pclog("Index low: %02X\n", val);
|
||||
ramdac->index = (ramdac->index & 0x0700) | val;
|
||||
if ((ramdac->index >= 0x0100) && (ramdac->index <= 0x04ff))
|
||||
ramdac->cursor_array = 1;
|
||||
break;
|
||||
case 0x05:
|
||||
// pclog("Index high: %02X\n", val);
|
||||
ramdac->index = (ramdac->index & 0x00ff) | ((val & 0x07) << 0x08);
|
||||
if ((ramdac->index >= 0x0100) && (ramdac->index <= 0x04ff))
|
||||
ramdac->cursor_array = 1;
|
||||
break;
|
||||
case 0x06:
|
||||
// pclog("Indexed data [%03X]: %02X\n", ramdac->index, val);
|
||||
if ((ramdac->index < 0x0100) || (ramdac->index > 0x04ff) || ramdac->cursor_array)
|
||||
ramdac->indexed_data[ramdac->index] = val;
|
||||
switch (ramdac->index) {
|
||||
case 0x00a: case 0x00c:
|
||||
ibm_rgb525_set_bpp(ramdac, svga);
|
||||
break;
|
||||
case 0x030:
|
||||
switch (val & 0xc0) {
|
||||
case 0x00:
|
||||
ramdac->smlc_part = 0x0100;
|
||||
break;
|
||||
case 0x40:
|
||||
ramdac->smlc_part = 0x0200;
|
||||
break;
|
||||
case 0x80:
|
||||
ramdac->smlc_part = 0x0300;
|
||||
break;
|
||||
case 0xc0:
|
||||
ramdac->smlc_part = 0x0400;
|
||||
break;
|
||||
}
|
||||
svga->dac_hwcursor.addr = ramdac->smlc_part;
|
||||
svga->dac_hwcursor.xsize = svga->dac_hwcursor.ysize = (val & 0x04) ? 64 : 32;
|
||||
svga->dac_hwcursor.ena = ((val & 0x03) != 0x00);
|
||||
/* pclog("%ix%i cursor %sabled at DAC buffer address %02X\n", svga->dac_hwcursor.xsize,
|
||||
svga->dac_hwcursor.ysize, svga->dac_hwcursor.ena ? "en" : "dis",
|
||||
svga->dac_hwcursor.addr);
|
||||
pclog("Pixel order %i, mode %i, update %s\n", !!(ramdac->indexed_data[0x30] & 0x20),
|
||||
ramdac->indexed_data[0x30] & 0x03, (ramdac->indexed_data[0x30] & 0x08) ? "now" : "later"); */
|
||||
break;
|
||||
case 0x031:
|
||||
if (!updt_cntl)
|
||||
break;
|
||||
svga->dac_hwcursor.x = (svga->dac_hwcursor.x & 0xff00) | val;
|
||||
// pclog("Cursor X = %i\n", svga->dac_hwcursor.x);
|
||||
break;
|
||||
case 0x032:
|
||||
/* Sign-extend the sign bit (7) to the remaining bits (6-4). */
|
||||
val &= 0x8f;
|
||||
if (val & 0x80)
|
||||
val |= 0x70;
|
||||
ramdac->indexed_data[ramdac->index] = val;
|
||||
if (!updt_cntl)
|
||||
break;
|
||||
svga->dac_hwcursor.x = (svga->dac_hwcursor.x & 0x00ff) | (val << 8);
|
||||
// pclog("Cursor X = %i\n", svga->dac_hwcursor.x);
|
||||
break;
|
||||
case 0x033:
|
||||
if (!updt_cntl)
|
||||
break;
|
||||
svga->dac_hwcursor.y = (svga->dac_hwcursor.y & 0xff00) | val;
|
||||
// pclog("Cursor Y = %i\n", svga->dac_hwcursor.y);
|
||||
break;
|
||||
case 0x034:
|
||||
/* Sign-extend the sign bit (7) to the remaining bits (6-4). */
|
||||
val &= 0x8f;
|
||||
if (val & 0x80)
|
||||
val |= 0x70;
|
||||
ramdac->indexed_data[ramdac->index] = val;
|
||||
if (updt_cntl) {
|
||||
svga->dac_hwcursor.y = (svga->dac_hwcursor.y & 0x00ff) | (val << 8);
|
||||
// pclog("Cursor Y = %i\n", svga->dac_hwcursor.x);
|
||||
} else {
|
||||
svga->dac_hwcursor.x = ramdac->indexed_data[0x031];
|
||||
svga->dac_hwcursor.x |= (ramdac->indexed_data[0x032] << 8);
|
||||
// pclog("Cursor X = %i\n", svga->dac_hwcursor.x);
|
||||
svga->dac_hwcursor.y = ramdac->indexed_data[0x033];
|
||||
svga->dac_hwcursor.y |= (val << 8);
|
||||
// pclog("Cursor Y = %i\n", svga->dac_hwcursor.y);
|
||||
}
|
||||
break;
|
||||
case 0x035:
|
||||
if (svga->dac_hwcursor.xsize == 64)
|
||||
svga->dac_hwcursor.xoff = (val & 0x1f);
|
||||
else
|
||||
svga->dac_hwcursor.xoff = (val & 0x3f);
|
||||
// pclog("Cursor X offset = %i\n", (int) svga->dac_hwcursor.xoff);
|
||||
break;
|
||||
case 0x036:
|
||||
if (svga->dac_hwcursor.xsize == 64)
|
||||
svga->dac_hwcursor.yoff = (val & 0x1f);
|
||||
else
|
||||
svga->dac_hwcursor.yoff = (val & 0x3f);
|
||||
// pclog("Cursor Y offset = %i\n", (int) svga->dac_hwcursor.yoff);
|
||||
break;
|
||||
case 0x040: case 0x043: case 0x046:
|
||||
ramdac->extra_pal[(ramdac->index - 0x40) / 3].r = val;
|
||||
break;
|
||||
case 0x041: case 0x044: case 0x047:
|
||||
ramdac->extra_pal[(ramdac->index - 0x41) / 3].g = val;
|
||||
break;
|
||||
case 0x042: case 0x045: case 0x048:
|
||||
ramdac->extra_pal[(ramdac->index - 0x42) / 3].b = val;
|
||||
break;
|
||||
case 0x060:
|
||||
ramdac->extra_pal[3].r = val;
|
||||
break;
|
||||
case 0x061:
|
||||
ramdac->extra_pal[3].g = val;
|
||||
break;
|
||||
case 0x062:
|
||||
ramdac->extra_pal[3].b = val;
|
||||
break;
|
||||
case 0x071:
|
||||
svga->ramdac_type = (val & 0x04) ? RAMDAC_8BIT : RAMDAC_6BIT;
|
||||
ibm_rgb525_set_bpp(ramdac, svga);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (ramdac->indx_cntl) {
|
||||
if (ramdac->index == 0x00ff)
|
||||
ramdac->cursor_array = 0;
|
||||
ramdac->index = (ramdac->index + 1) & 0x07ff;
|
||||
// pclog("Index now: %03X\n", ramdac->index);
|
||||
}
|
||||
break;
|
||||
case 0x07:
|
||||
ramdac->indx_cntl = val & 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
ibm_rgb525_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga)
|
||||
{
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) p;
|
||||
uint8_t temp = 0xff;
|
||||
uint8_t rs = (addr & 0x03);
|
||||
uint8_t loc_read = (ramdac->indexed_data[0x30] & 0x10);
|
||||
rs |= (!!rs2 << 2);
|
||||
|
||||
switch (rs) {
|
||||
case 0x00: /* Palette Write Index Register (RS value = 0000) */
|
||||
case 0x01: /* Palette Data Register (RS value = 0001) */
|
||||
case 0x02: /* Pixel Read Mask Register (RS value = 0010) */
|
||||
temp = svga_in(addr, svga);
|
||||
break;
|
||||
case 0x03: /* Palette Read Index Register (RS value = 0011) */
|
||||
temp = svga->dac_addr & 0xff;
|
||||
if (ramdac->indexed_data[0x070] & 0x20)
|
||||
temp = (temp & 0xfc) | svga->dac_status;
|
||||
break;
|
||||
case 0x04:
|
||||
temp = ramdac->index & 0xff;
|
||||
break;
|
||||
case 0x05:
|
||||
temp = ramdac->index >> 8;
|
||||
break;
|
||||
case 0x06:
|
||||
temp = ramdac->indexed_data[ramdac->index];
|
||||
switch (ramdac->index) {
|
||||
case 0x0000: /* Revision */
|
||||
temp = 0xe0;
|
||||
break;
|
||||
case 0x0001: /* ID */
|
||||
temp = 0x02;
|
||||
break;
|
||||
case 0x0031:
|
||||
if (loc_read)
|
||||
temp = svga->dac_hwcursor.x & 0xff;
|
||||
break;
|
||||
case 0x0032:
|
||||
if (loc_read)
|
||||
temp = svga->dac_hwcursor.x >> 8;
|
||||
break;
|
||||
case 0x0033:
|
||||
if (loc_read)
|
||||
temp = svga->dac_hwcursor.y & 0xff;
|
||||
break;
|
||||
case 0x0034:
|
||||
if (loc_read)
|
||||
temp = svga->dac_hwcursor.y >> 8;
|
||||
break;
|
||||
default:
|
||||
temp = ramdac->indexed_data[ramdac->index];
|
||||
break;
|
||||
}
|
||||
if (ramdac->indx_cntl) {
|
||||
if (ramdac->index == 0x00ff)
|
||||
ramdac->cursor_array = 0;
|
||||
ramdac->index = (ramdac->index + 1) & 0x07ff;
|
||||
}
|
||||
break;
|
||||
case 0x07:
|
||||
temp = ramdac->indx_cntl;
|
||||
break;
|
||||
}
|
||||
|
||||
// pclog("[%04X:%08X] [R] RS%01X = %02X\n", CS, cpu_state.pc, rs, temp);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_recalctimings(void *p, svga_t *svga)
|
||||
{
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) p;
|
||||
|
||||
svga->interlace = ramdac->indexed_data[0x071] & 0x20;
|
||||
|
||||
if (svga->scrblank || !svga->attr_palette_enable) {
|
||||
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
|
||||
if (((svga->gdcreg[5] & 0x60) == 0x40) || ((svga->gdcreg[5] & 0x60) == 0x60)) {
|
||||
if (ramdac->indexed_data[0x071] & 0x01) {
|
||||
switch (svga->bpp) {
|
||||
case 4:
|
||||
svga->render = ibm_rgb525_render_4bpp;
|
||||
break;
|
||||
case 8:
|
||||
svga->render = ibm_rgb525_render_8bpp;
|
||||
break;
|
||||
case 15: case 16:
|
||||
svga->render = ibm_rgb525_render_15_16bpp;
|
||||
break;
|
||||
case 24:
|
||||
svga->render = ibm_rgb525_render_24bpp;
|
||||
break;
|
||||
case 32:
|
||||
svga->render = ibm_rgb525_render_32bpp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ibm_rgb525_hwcursor_draw(svga_t *svga, int displine)
|
||||
{
|
||||
uint8_t dat, four_pixels = 0x00;
|
||||
int x, pitch, x_pos, y_pos, offset = svga->dac_hwcursor_latch.x - svga->dac_hwcursor_latch.xoff;
|
||||
uint32_t *p;
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) svga->ramdac;
|
||||
uint8_t pix_ordr = ramdac->indexed_data[0x30] & 0x20;
|
||||
uint8_t cursor_mode = ramdac->indexed_data[0x30] & 0x03;
|
||||
|
||||
/* The planes come in one part, and each plane is 2bpp,
|
||||
so a 32x32 cursor has 8 bytes per line, and a 64x64
|
||||
cursor has 16 bytes per line. */
|
||||
pitch = (svga->dac_hwcursor_latch.xsize >> 2); /* Bytes per line. */
|
||||
|
||||
if ((ramdac->indexed_data[0x071] & 0x20) && svga->dac_hwcursor_oddeven)
|
||||
svga->dac_hwcursor_latch.addr += pitch;
|
||||
|
||||
y_pos = displine;
|
||||
x_pos = offset + svga->x_add;
|
||||
p = buffer32->line[y_pos];
|
||||
|
||||
for (x = 0; x < svga->dac_hwcursor_latch.xsize; x ++) {
|
||||
if (!(x & 3)) {
|
||||
four_pixels = ramdac->indexed_data[svga->dac_hwcursor_latch.addr];
|
||||
// pclog("Pixels %i to %i: %02X at %08X\n", x, x + 3, four_pixels, svga->dac_hwcursor_latch.addr);
|
||||
}
|
||||
if (pix_ordr)
|
||||
dat = (four_pixels >> (((3 - x) & 3) << 1)) & 0x03;
|
||||
else
|
||||
dat = (four_pixels >> ((x & 3) << 1)) & 0x03;
|
||||
|
||||
x_pos = offset + svga->x_add + x;
|
||||
|
||||
switch (cursor_mode) {
|
||||
case 0x01:
|
||||
switch (dat) {
|
||||
case 0x01:
|
||||
/* Cursor Color 1 */
|
||||
p[x_pos] = ramdac->extra_pal[0].pixel;
|
||||
break;
|
||||
case 0x02:
|
||||
/* Cursor Color 2 */
|
||||
p[x_pos] = ramdac->extra_pal[1].pixel;
|
||||
break;
|
||||
case 0x03:
|
||||
/* Cursor Color 3 */
|
||||
p[x_pos] = ramdac->extra_pal[2].pixel;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
switch (dat) {
|
||||
case 0x00:
|
||||
/* Cursor Color 1 */
|
||||
p[x_pos] = ramdac->extra_pal[0].pixel;
|
||||
break;
|
||||
case 0x01:
|
||||
/* Cursor Color 2 */
|
||||
p[x_pos] = ramdac->extra_pal[1].pixel;
|
||||
break;
|
||||
case 0x03:
|
||||
/* Complement */
|
||||
p[x_pos] ^= 0xffffff;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x03:
|
||||
switch (dat) {
|
||||
case 0x02:
|
||||
/* Cursor Color 1 */
|
||||
p[x_pos] = ramdac->extra_pal[0].pixel;
|
||||
break;
|
||||
case 0x03:
|
||||
/* Cursor Color 2 */
|
||||
p[x_pos] = ramdac->extra_pal[1].pixel;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((x & 3) == 3)
|
||||
svga->dac_hwcursor_latch.addr++;
|
||||
}
|
||||
|
||||
if ((ramdac->indexed_data[0x071] & 0x20) && !svga->dac_hwcursor_oddeven)
|
||||
svga->dac_hwcursor_latch.addr += pitch;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
ibm_rgb525_ramdac_init(const device_t *info)
|
||||
{
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) malloc(sizeof(ibm_rgb525_ramdac_t));
|
||||
memset(ramdac, 0, sizeof(ibm_rgb525_ramdac_t));
|
||||
|
||||
ramdac->smlc_part = 0x0100;
|
||||
|
||||
ramdac->indexed_data[0x0008] = 0x0001;
|
||||
ramdac->indexed_data[0x0015] = 0x0008;
|
||||
ramdac->indexed_data[0x0016] = 0x0041;
|
||||
|
||||
return ramdac;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ibm_rgb525_ramdac_close(void *priv)
|
||||
{
|
||||
ibm_rgb525_ramdac_t *ramdac = (ibm_rgb525_ramdac_t *) priv;
|
||||
|
||||
if (ramdac)
|
||||
free(ramdac);
|
||||
}
|
||||
|
||||
|
||||
const device_t ibm_rgb525_ramdac_device =
|
||||
{
|
||||
"IBM RGB525 RAMDAC",
|
||||
0, 0,
|
||||
ibm_rgb525_ramdac_init, ibm_rgb525_ramdac_close,
|
||||
NULL, { NULL }, NULL, NULL, NULL
|
||||
};
|
1255
src/video/vid_s3.c
1255
src/video/vid_s3.c
File diff suppressed because it is too large
Load Diff
@@ -129,6 +129,8 @@ video_cards[] = {
|
||||
{ "stealth3d_3000_pci", &s3_virge_988_pci_device },
|
||||
{ "stealth64d_pci", &s3_diamond_stealth64_pci_device },
|
||||
{ "stealth64v_pci", &s3_diamond_stealth64_964_pci_device },
|
||||
{ "elsawin2kprox_964_pci", &s3_elsa_winner2000_pro_x_964_pci_device },
|
||||
{ "elsawin2kprox_pci", &s3_elsa_winner2000_pro_x_pci_device },
|
||||
{ "stealthse_pci", &s3_diamond_stealth_se_pci_device },
|
||||
#if defined(DEV_BRANCH) && defined(USE_MGA)
|
||||
{ "mystique", &mystique_device },
|
||||
@@ -165,6 +167,8 @@ video_cards[] = {
|
||||
{ "stealth3d_3000_vlb", &s3_virge_988_vlb_device },
|
||||
{ "stealth64d_vlb", &s3_diamond_stealth64_vlb_device },
|
||||
{ "stealth64v_vlb", &s3_diamond_stealth64_964_vlb_device },
|
||||
{ "elsawin2kprox_964_vlb", &s3_elsa_winner2000_pro_x_964_vlb_device },
|
||||
{ "elsawin2kprox_vlb", &s3_elsa_winner2000_pro_x_vlb_device },
|
||||
{ "stealthse_vlb", &s3_diamond_stealth_se_vlb_device },
|
||||
{ "metheus928_vlb", &s3_metheus_86c928_vlb_device },
|
||||
{ "n9_9fx_vlb", &s3_9fx_vlb_device },
|
||||
|
@@ -742,7 +742,7 @@ VIDOBJ := video.o \
|
||||
vid_tgui9440.o vid_tkd8001_ramdac.o \
|
||||
vid_att20c49x_ramdac.o \
|
||||
vid_s3.o vid_s3_virge.o \
|
||||
vid_sdac_ramdac.o \
|
||||
vid_ibm_rgb525_ramdac.o vid_sdac_ramdac.o \
|
||||
vid_voodoo.o vid_voodoo_banshee.o \
|
||||
vid_voodoo_banshee_blitter.o \
|
||||
vid_voodoo_blitter.o \
|
||||
|
Reference in New Issue
Block a user