Apply CGA_CRTC and CGA_MODE_FLAGS to the rest of the Super CGA crew.
This commit is contained in:
@@ -56,6 +56,7 @@ typedef enum cga_crtc_registers_e
|
||||
CGA_CRTC_LIGHT_PEN_ADDR_LOW = 0x11, // Light pen address low 8 bits (not currently supported)
|
||||
} cga_crtc_registers;
|
||||
|
||||
// Registers for the CGA
|
||||
typedef enum cga_registers_e
|
||||
{
|
||||
CGA_REGISTER_CRTC_INDEX = 0x3D4,
|
||||
|
||||
@@ -369,26 +369,26 @@ vid_poll_1512(void *priv)
|
||||
for (c = 0; c < 8; c++) {
|
||||
if ((vid->cgamode & 0x12) == 0x12) {
|
||||
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->border & 15) + 16;
|
||||
if (vid->cgamode & 1) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = 0;
|
||||
} else {
|
||||
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = 0;
|
||||
}
|
||||
} else {
|
||||
buffer32->line[vid->displine << 1][c] = buffer32->line[(vid->displine << 1) + 1][c] = (vid->cgacol & 15) + 16;
|
||||
if (vid->cgamode & 1) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 3) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 3) + 8] = (vid->cgacol & 15) + 16;
|
||||
} else {
|
||||
buffer32->line[vid->displine << 1][c + (vid->crtc[1] << 4) + 8] = buffer32->line[(vid->displine << 1) + 1][c + (vid->crtc[1] << 4) + 8] = (vid->cgacol & 15) + 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vid->cgamode & 1) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
for (x = 0; x < 80; x++) {
|
||||
chr = vid->vram[(vid->ma << 1) & 0x3fff];
|
||||
attr = vid->vram[((vid->ma << 1) + 1) & 0x3fff];
|
||||
drawcursor = ((vid->ma == ca) && vid->con && vid->cursoron);
|
||||
if (vid->cgamode & 0x20) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
if ((vid->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
@@ -408,12 +408,12 @@ vid_poll_1512(void *priv)
|
||||
}
|
||||
vid->ma++;
|
||||
}
|
||||
} else if (!(vid->cgamode & 2)) {
|
||||
} else if (!(vid->cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
for (x = 0; x < 40; x++) {
|
||||
chr = vid->vram[(vid->ma << 1) & 0x3fff];
|
||||
attr = vid->vram[((vid->ma << 1) + 1) & 0x3fff];
|
||||
drawcursor = ((vid->ma == ca) && vid->con && vid->cursoron);
|
||||
if (vid->cgamode & 0x20) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
if ((vid->blink & 16) && (attr & 0x80))
|
||||
@@ -433,10 +433,10 @@ vid_poll_1512(void *priv)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!(vid->cgamode & 16)) {
|
||||
} else if (!(vid->cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
|
||||
cols[0] = (vid->cgacol & 15) | 16;
|
||||
col = (vid->cgacol & 16) ? 24 : 16;
|
||||
if (vid->cgamode & 4) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_BW) {
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 7;
|
||||
@@ -477,7 +477,7 @@ vid_poll_1512(void *priv)
|
||||
}
|
||||
} else {
|
||||
cols[0] = ((vid->cgamode & 0x12) == 0x12) ? 0 : (vid->cgacol & 15) + 16;
|
||||
if (vid->cgamode & 1) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
hline(buffer32, 0, (vid->displine << 1), (vid->crtc[1] << 3) + 16, cols[0]);
|
||||
hline(buffer32, 0, (vid->displine << 1) + 1, (vid->crtc[1] << 3) + 16, cols[0]);
|
||||
} else {
|
||||
@@ -486,7 +486,7 @@ vid_poll_1512(void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
if (vid->cgamode & 1)
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (vid->crtc[1] << 3) + 16;
|
||||
else
|
||||
x = (vid->crtc[1] << 4) + 16;
|
||||
@@ -545,7 +545,7 @@ vid_poll_1512(void *priv)
|
||||
vid->displine = 0;
|
||||
vid->vsynctime = 46;
|
||||
|
||||
if (vid->cgamode & 1)
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (vid->crtc[1] << 3) + 16;
|
||||
else
|
||||
x = (vid->crtc[1] << 4) + 16;
|
||||
@@ -582,15 +582,15 @@ vid_poll_1512(void *priv)
|
||||
|
||||
video_res_x = xsize;
|
||||
video_res_y = ysize;
|
||||
if (vid->cgamode & 1) {
|
||||
if (vid->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
video_res_x /= 8;
|
||||
video_res_y /= vid->crtc[9] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(vid->cgamode & 2)) {
|
||||
} else if (!(vid->cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
video_res_x /= 16;
|
||||
video_res_y /= vid->crtc[9] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(vid->cgamode & 16)) {
|
||||
} else if (!(vid->cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
|
||||
video_res_x /= 2;
|
||||
video_bpp = 2;
|
||||
} else {
|
||||
@@ -1403,14 +1403,14 @@ lcdc_poll(amsvid_t *vid)
|
||||
uint16_t ca;
|
||||
int blink;
|
||||
|
||||
ca = (cga->crtc[15] | (cga->crtc[14] << 8)) & 0x3fff;
|
||||
ca = (cga->crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (cga->crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
|
||||
if (!cga->linepos) {
|
||||
timer_advance_u64(&vid->timer, cga->dispofftime);
|
||||
cga->cgastat |= 1;
|
||||
cga->linepos = 1;
|
||||
oldsc = cga->sc;
|
||||
if ((cga->crtc[8] & 3) == 3)
|
||||
if ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3)
|
||||
cga->sc = ((cga->sc << 1) + cga->oddeven) & 7;
|
||||
if (cga->cgadispon) {
|
||||
if (cga->displine < cga->firstline) {
|
||||
@@ -1419,28 +1419,28 @@ lcdc_poll(amsvid_t *vid)
|
||||
}
|
||||
cga->lastline = cga->displine;
|
||||
|
||||
if (cga->cgamode & 1) {
|
||||
for (x = 0; x < cga->crtc[1]; x++) {
|
||||
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
|
||||
chr = cga->charbuffer[x << 1];
|
||||
attr = cga->charbuffer[(x << 1) + 1];
|
||||
drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron);
|
||||
blink = ((cga->cgablink & 16) && (cga->cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((cga->cgablink & 16) && (cga->cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
lcd_draw_char_80(vid, &(buffer32->line[cga->displine << 1])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode);
|
||||
lcd_draw_char_80(vid, &(buffer32->line[(cga->displine << 1) + 1])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode);
|
||||
cga->ma++;
|
||||
}
|
||||
} else if (!(cga->cgamode & 2)) {
|
||||
for (x = 0; x < cga->crtc[1]; x++) {
|
||||
} else if (!(cga->cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
|
||||
chr = cga->vram[(cga->ma << 1) & 0x3fff];
|
||||
attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff];
|
||||
drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron);
|
||||
blink = ((cga->cgablink & 16) && (cga->cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((cga->cgablink & 16) && (cga->cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
lcd_draw_char_40(vid, &(buffer32->line[cga->displine << 1])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode);
|
||||
lcd_draw_char_40(vid, &(buffer32->line[(cga->displine << 1) + 1])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode);
|
||||
cga->ma++;
|
||||
}
|
||||
} else { /* Graphics mode */
|
||||
for (x = 0; x < cga->crtc[1]; x++) {
|
||||
for (x = 0; x < cga->crtc[CGA_CRTC_HDISP]; x++) {
|
||||
dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) | cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1];
|
||||
cga->ma++;
|
||||
for (uint8_t c = 0; c < 16; c++) {
|
||||
@@ -1450,22 +1450,22 @@ lcdc_poll(amsvid_t *vid)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cga->cgamode & 1) {
|
||||
hline(buffer32, 0, (cga->displine << 1), (cga->crtc[1] << 3), green);
|
||||
hline(buffer32, 0, (cga->displine << 1) + 1, (cga->crtc[1] << 3), green);
|
||||
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
hline(buffer32, 0, (cga->displine << 1), (cga->crtc[CGA_CRTC_HDISP] << 3), green);
|
||||
hline(buffer32, 0, (cga->displine << 1) + 1, (cga->crtc[CGA_CRTC_HDISP] << 3), green);
|
||||
} else {
|
||||
hline(buffer32, 0, (cga->displine << 1), (cga->crtc[1] << 4), green);
|
||||
hline(buffer32, 0, (cga->displine << 1) + 1, (cga->crtc[1] << 4), green);
|
||||
hline(buffer32, 0, (cga->displine << 1), (cga->crtc[CGA_CRTC_HDISP] << 4), green);
|
||||
hline(buffer32, 0, (cga->displine << 1) + 1, (cga->crtc[CGA_CRTC_HDISP] << 4), green);
|
||||
}
|
||||
}
|
||||
|
||||
if (cga->cgamode & 1)
|
||||
x = (cga->crtc[1] << 3);
|
||||
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (cga->crtc[CGA_CRTC_HDISP] << 3);
|
||||
else
|
||||
x = (cga->crtc[1] << 4);
|
||||
x = (cga->crtc[CGA_CRTC_HDISP] << 4);
|
||||
|
||||
cga->sc = oldsc;
|
||||
if (cga->vc == cga->crtc[7] && !cga->sc)
|
||||
if (cga->vc == cga->crtc[CGA_CRTC_VSYNC] && !cga->sc)
|
||||
cga->cgastat |= 8;
|
||||
cga->displine++;
|
||||
if (cga->displine >= 360)
|
||||
@@ -1478,10 +1478,10 @@ lcdc_poll(amsvid_t *vid)
|
||||
if (!cga->vsynctime)
|
||||
cga->cgastat &= ~8;
|
||||
}
|
||||
if (cga->sc == (cga->crtc[11] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[11] & 31) >> 1))) {
|
||||
if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_END] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == ((cga->crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) {
|
||||
cga->cursorvisible = 0;
|
||||
}
|
||||
if ((cga->crtc[8] & 3) == 3 && cga->sc == (cga->crtc[9] >> 1))
|
||||
if ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == (cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
|
||||
cga->maback = cga->ma;
|
||||
if (cga->vadj) {
|
||||
cga->sc++;
|
||||
@@ -1490,41 +1490,41 @@ lcdc_poll(amsvid_t *vid)
|
||||
cga->vadj--;
|
||||
if (!cga->vadj) {
|
||||
cga->cgadispon = 1;
|
||||
cga->ma = cga->maback = (cga->crtc[13] | (cga->crtc[12] << 8)) & 0x3fff;
|
||||
cga->ma = cga->maback = (cga->crtc[CGA_CRTC_START_ADDR_LOW] | (cga->crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
cga->sc = 0;
|
||||
}
|
||||
} else if (cga->sc == cga->crtc[9]) {
|
||||
} else if (cga->sc == cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR]) {
|
||||
cga->maback = cga->ma;
|
||||
cga->sc = 0;
|
||||
oldvc = cga->vc;
|
||||
cga->vc++;
|
||||
cga->vc &= 127;
|
||||
|
||||
if (cga->vc == cga->crtc[6])
|
||||
if (cga->vc == cga->crtc[CGA_CRTC_VDISP])
|
||||
cga->cgadispon = 0;
|
||||
|
||||
if (oldvc == cga->crtc[4]) {
|
||||
if (oldvc == cga->crtc[CGA_CRTC_VTOTAL]) {
|
||||
cga->vc = 0;
|
||||
cga->vadj = cga->crtc[5];
|
||||
cga->vadj = cga->crtc[CGA_CRTC_VTOTAL_ADJUST];
|
||||
if (!cga->vadj)
|
||||
cga->cgadispon = 1;
|
||||
if (!cga->vadj)
|
||||
cga->ma = cga->maback = (cga->crtc[13] | (cga->crtc[12] << 8)) & 0x3fff;
|
||||
if ((cga->crtc[10] & 0x60) == 0x20)
|
||||
cga->ma = cga->maback = (cga->crtc[CGA_CRTC_START_ADDR_LOW] | (cga->crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
if ((cga->crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20)
|
||||
cga->cursoron = 0;
|
||||
else
|
||||
cga->cursoron = cga->cgablink & 8;
|
||||
}
|
||||
|
||||
if (cga->vc == cga->crtc[7]) {
|
||||
if (cga->vc == cga->crtc[CGA_CRTC_VSYNC]) {
|
||||
cga->cgadispon = 0;
|
||||
cga->displine = 0;
|
||||
cga->vsynctime = 16;
|
||||
if (cga->crtc[7]) {
|
||||
if (cga->cgamode & 1)
|
||||
x = (cga->crtc[1] << 3);
|
||||
if (cga->crtc[CGA_CRTC_VSYNC]) {
|
||||
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (cga->crtc[CGA_CRTC_HDISP] << 3);
|
||||
else
|
||||
x = (cga->crtc[1] << 4);
|
||||
x = (cga->crtc[CGA_CRTC_HDISP] << 4);
|
||||
cga->lastline++;
|
||||
|
||||
xs_temp = x;
|
||||
@@ -1536,7 +1536,7 @@ lcdc_poll(amsvid_t *vid)
|
||||
if (ys_temp < 32)
|
||||
ys_temp = 400;
|
||||
|
||||
if ((cga->cgamode & 8) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
if ((cga->cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
xsize = xs_temp;
|
||||
ysize = ys_temp;
|
||||
set_screen_size(xsize, ysize);
|
||||
@@ -1553,15 +1553,15 @@ lcdc_poll(amsvid_t *vid)
|
||||
|
||||
video_res_x = xsize;
|
||||
video_res_y = ysize;
|
||||
if (cga->cgamode & 1) {
|
||||
if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
video_res_x /= 8;
|
||||
video_res_y /= cga->crtc[9] + 1;
|
||||
video_res_y /= cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(cga->cgamode & 2)) {
|
||||
} else if (!(cga->cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
video_res_x /= 16;
|
||||
video_res_y /= cga->crtc[9] + 1;
|
||||
video_res_y /= cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(cga->cgamode & 16)) {
|
||||
} else if (!(cga->cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
|
||||
video_res_x /= 2;
|
||||
video_bpp = 2;
|
||||
} else
|
||||
@@ -1579,10 +1579,10 @@ lcdc_poll(amsvid_t *vid)
|
||||
}
|
||||
if (cga->cgadispon)
|
||||
cga->cgastat &= ~1;
|
||||
if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1)))
|
||||
if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_START] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == ((cga->crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
|
||||
cga->cursorvisible = 1;
|
||||
if (cga->cgadispon && (cga->cgamode & 1)) {
|
||||
for (x = 0; x < (cga->crtc[1] << 1); x++)
|
||||
if (cga->cgadispon && (cga->cgamode & CGA_MODE_FLAG_HIGHRES)) {
|
||||
for (x = 0; x < (cga->crtc[CGA_CRTC_HDISP] << 1); x++)
|
||||
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,8 +276,8 @@ compaq_plasma_poll(void *priv)
|
||||
uint8_t chr;
|
||||
uint8_t attr;
|
||||
uint8_t sc;
|
||||
uint16_t ma = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x7fff;
|
||||
uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x7fff;
|
||||
uint16_t ma = (self->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (self->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
uint16_t ca = (self->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (self->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
uint16_t addr;
|
||||
int drawcursor;
|
||||
int cursorline;
|
||||
@@ -321,10 +321,10 @@ compaq_plasma_poll(void *priv)
|
||||
addr = ((ma & ~1) + (self->cga.displine >> 4) * 80) << 1;
|
||||
ma += (self->cga.displine >> 4) * 80;
|
||||
|
||||
if ((self->cga.crtc[0x0a] & 0x60) == 0x20)
|
||||
if ((self->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20)
|
||||
cursorline = 0;
|
||||
else
|
||||
cursorline = (((self->cga.crtc[0x0a] & 0x0f) << 1) <= sc) && (((self->cga.crtc[0x0b] & 0x0f) << 1) >= sc);
|
||||
cursorline = (((self->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0f) << 1) <= sc) && (((self->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0f) << 1) >= sc);
|
||||
|
||||
/* for each text column */
|
||||
for (x = 0; x < 80; x++) {
|
||||
@@ -352,7 +352,7 @@ compaq_plasma_poll(void *priv)
|
||||
/* set foreground */
|
||||
cols[1] = blinkcols[attr][1];
|
||||
/* blink active */
|
||||
if (self->cga.cgamode & 0x20) {
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[0] = blinkcols[attr][0];
|
||||
/* attribute 7 active and not cursor */
|
||||
if ((self->cga.cgablink & 0x08) && (attr & 0x80) && !drawcursor) {
|
||||
@@ -406,10 +406,10 @@ compaq_plasma_poll(void *priv)
|
||||
addr = ((ma & ~1) + (self->cga.displine >> 4) * 40) << 1;
|
||||
ma += (self->cga.displine >> 4) * 40;
|
||||
|
||||
if ((self->cga.crtc[0x0a] & 0x60) == 0x20)
|
||||
if ((self->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20)
|
||||
cursorline = 0;
|
||||
else
|
||||
cursorline = (((self->cga.crtc[0x0a] & 0x0f) << 1) <= sc) && (((self->cga.crtc[0x0b] & 0x0f) << 1) >= sc);
|
||||
cursorline = (((self->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0f) << 1) <= sc) && (((self->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0f) << 1) >= sc);
|
||||
|
||||
for (x = 0; x < 40; x++) {
|
||||
/* video output enabled */
|
||||
@@ -436,7 +436,7 @@ compaq_plasma_poll(void *priv)
|
||||
/* set foreground */
|
||||
cols[1] = blinkcols[attr][1];
|
||||
/* blink active */
|
||||
if (self->cga.cgamode & 0x20) {
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[0] = blinkcols[attr][0];
|
||||
/* attribute 7 active and not cursor */
|
||||
if ((self->cga.cgablink & 0x08) && (attr & 0x80) && !drawcursor) {
|
||||
@@ -485,7 +485,7 @@ compaq_plasma_poll(void *priv)
|
||||
ma++;
|
||||
}
|
||||
} else {
|
||||
if (self->cga.cgamode & 0x10) {
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS) {
|
||||
/* 640x400 mode */
|
||||
if (self->port_23c6 & 0x01) /* 640*400 */ {
|
||||
addr = ((self->cga.displine) & 1) * 0x2000 + ((self->cga.displine >> 1) & 1) * 0x4000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1);
|
||||
@@ -589,7 +589,7 @@ compaq_plasma_poll(void *priv)
|
||||
video_res_y = 400;
|
||||
|
||||
if (self->cga.cgamode & 0x02) {
|
||||
if (self->cga.cgamode & 0x10)
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)
|
||||
video_bpp = 1;
|
||||
else
|
||||
video_bpp = 2;
|
||||
|
||||
@@ -255,24 +255,24 @@ t3100e_text_row80(t3100e_t *t3100e)
|
||||
int blink;
|
||||
uint16_t addr;
|
||||
uint8_t sc;
|
||||
uint16_t ma = (t3100e->cga.crtc[13] | (t3100e->cga.crtc[12] << 8)) & 0x7fff;
|
||||
uint16_t ca = (t3100e->cga.crtc[15] | (t3100e->cga.crtc[14] << 8)) & 0x7fff;
|
||||
uint16_t ma = (t3100e->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t3100e->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
uint16_t ca = (t3100e->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (t3100e->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
|
||||
sc = (t3100e->displine) & 15;
|
||||
addr = ((ma & ~1) + (t3100e->displine >> 4) * 80) * 2;
|
||||
ma += (t3100e->displine >> 4) * 80;
|
||||
|
||||
if ((t3100e->cga.crtc[10] & 0x60) == 0x20) {
|
||||
if ((t3100e->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20) {
|
||||
cursorline = 0;
|
||||
} else {
|
||||
cursorline = ((t3100e->cga.crtc[10] & 0x0F) * 2 <= sc) && ((t3100e->cga.crtc[11] & 0x0F) * 2 >= sc);
|
||||
cursorline = ((t3100e->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0F) * 2 <= sc) && ((t3100e->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0F) * 2 >= sc);
|
||||
}
|
||||
for (uint8_t x = 0; x < 80; x++) {
|
||||
chr = t3100e->vram[(addr + 2 * x) & 0x7FFF];
|
||||
attr = t3100e->vram[(addr + 2 * x + 1) & 0x7FFF];
|
||||
drawcursor = ((ma == ca) && cursorline && (t3100e->cga.cgamode & 8) && (t3100e->cga.cgablink & 16));
|
||||
drawcursor = ((ma == ca) && cursorline && (t3100e->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && (t3100e->cga.cgablink & 16));
|
||||
|
||||
blink = ((t3100e->cga.cgablink & 16) && (t3100e->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((t3100e->cga.cgablink & 16) && (t3100e->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
|
||||
if (t3100e->video_options & 4)
|
||||
bold = boldcols[attr] ? chr + 256 : chr;
|
||||
@@ -280,7 +280,7 @@ t3100e_text_row80(t3100e_t *t3100e)
|
||||
bold = boldcols[attr] ? chr : chr + 256;
|
||||
bold += 512 * (t3100e->video_options & 3);
|
||||
|
||||
if (t3100e->cga.cgamode & 0x20) /* Blink */
|
||||
if (t3100e->cga.cgamode & CGA_MODE_FLAG_BLINK) /* Blink */
|
||||
{
|
||||
cols[1] = blinkcols[attr][1];
|
||||
cols[0] = blinkcols[attr][0];
|
||||
@@ -316,24 +316,24 @@ t3100e_text_row40(t3100e_t *t3100e)
|
||||
int blink;
|
||||
uint16_t addr;
|
||||
uint8_t sc;
|
||||
uint16_t ma = (t3100e->cga.crtc[13] | (t3100e->cga.crtc[12] << 8)) & 0x7fff;
|
||||
uint16_t ca = (t3100e->cga.crtc[15] | (t3100e->cga.crtc[14] << 8)) & 0x7fff;
|
||||
uint16_t ma = (t3100e->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t3100e->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
uint16_t ca = (t3100e->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (t3100e->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
|
||||
sc = (t3100e->displine) & 15;
|
||||
addr = ((ma & ~1) + (t3100e->displine >> 4) * 40) * 2;
|
||||
ma += (t3100e->displine >> 4) * 40;
|
||||
|
||||
if ((t3100e->cga.crtc[10] & 0x60) == 0x20) {
|
||||
if ((t3100e->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20) {
|
||||
cursorline = 0;
|
||||
} else {
|
||||
cursorline = ((t3100e->cga.crtc[10] & 0x0F) * 2 <= sc) && ((t3100e->cga.crtc[11] & 0x0F) * 2 >= sc);
|
||||
cursorline = ((t3100e->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0F) * 2 <= sc) && ((t3100e->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0F) * 2 >= sc);
|
||||
}
|
||||
for (uint8_t x = 0; x < 40; x++) {
|
||||
chr = t3100e->vram[(addr + 2 * x) & 0x7FFF];
|
||||
attr = t3100e->vram[(addr + 2 * x + 1) & 0x7FFF];
|
||||
drawcursor = ((ma == ca) && cursorline && (t3100e->cga.cgamode & 8) && (t3100e->cga.cgablink & 16));
|
||||
drawcursor = ((ma == ca) && cursorline && (t3100e->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && (t3100e->cga.cgablink & 16));
|
||||
|
||||
blink = ((t3100e->cga.cgablink & 16) && (t3100e->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((t3100e->cga.cgablink & 16) && (t3100e->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
|
||||
if (t3100e->video_options & 4)
|
||||
bold = boldcols[attr] ? chr + 256 : chr;
|
||||
@@ -341,7 +341,7 @@ t3100e_text_row40(t3100e_t *t3100e)
|
||||
bold = boldcols[attr] ? chr : chr + 256;
|
||||
bold += 512 * (t3100e->video_options & 3);
|
||||
|
||||
if (t3100e->cga.cgamode & 0x20) /* Blink */
|
||||
if (t3100e->cga.cgamode & CGA_MODE_FLAG_BLINK) /* Blink */
|
||||
{
|
||||
cols[1] = blinkcols[attr][1];
|
||||
cols[0] = blinkcols[attr][0];
|
||||
@@ -374,9 +374,9 @@ t3100e_cgaline6(t3100e_t *t3100e)
|
||||
uint32_t fg = (t3100e->cga.cgacol & 0x0F) ? amber : black;
|
||||
uint32_t bg = black;
|
||||
|
||||
uint16_t ma = (t3100e->cga.crtc[13] | (t3100e->cga.crtc[12] << 8)) & 0x7fff;
|
||||
uint16_t ma = (t3100e->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t3100e->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
|
||||
if (t3100e->cga.crtc[9] == 3) /* 640*400 */
|
||||
if (t3100e->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] == 3) /* 640*400 */
|
||||
{
|
||||
addr = ((t3100e->displine) & 1) * 0x2000 + ((t3100e->displine >> 1) & 1) * 0x4000 + (t3100e->displine >> 2) * 80 + ((ma & ~1) << 1);
|
||||
} else {
|
||||
@@ -388,7 +388,7 @@ t3100e_cgaline6(t3100e_t *t3100e)
|
||||
|
||||
for (uint8_t c = 0; c < 8; c++) {
|
||||
ink = (dat & 0x80) ? fg : bg;
|
||||
if (!(t3100e->cga.cgamode & 8))
|
||||
if (!(t3100e->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE))
|
||||
ink = black;
|
||||
(buffer32->line[t3100e->displine])[x * 8 + c] = ink;
|
||||
dat = dat << 1;
|
||||
@@ -407,8 +407,8 @@ t3100e_cgaline4(t3100e_t *t3100e)
|
||||
uint32_t ink1 = 0;
|
||||
uint16_t addr;
|
||||
|
||||
uint16_t ma = (t3100e->cga.crtc[13] | (t3100e->cga.crtc[12] << 8)) & 0x7fff;
|
||||
if (t3100e->cga.crtc[9] == 3) /* 320*400 undocumented */
|
||||
uint16_t ma = (t3100e->cga.crtc[CGA_CRTC_START_ADDR_HIGH] | (t3100e->cga.crtc[CGA_CRTC_CURSOR_END] << 8)) & 0x7fff;
|
||||
if (t3100e->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] == 3) /* 320*400 undocumented */
|
||||
{
|
||||
addr = ((t3100e->displine) & 1) * 0x2000 + ((t3100e->displine >> 1) & 1) * 0x4000 + (t3100e->displine >> 2) * 80 + ((ma & ~1) << 1);
|
||||
} else /* 320*200 */
|
||||
@@ -421,7 +421,7 @@ t3100e_cgaline4(t3100e_t *t3100e)
|
||||
|
||||
for (uint8_t c = 0; c < 4; c++) {
|
||||
pattern = (dat & 0xC0) >> 6;
|
||||
if (!(t3100e->cga.cgamode & 8))
|
||||
if (!(t3100e->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE))
|
||||
pattern = 0;
|
||||
|
||||
switch (pattern & 3) {
|
||||
@@ -498,7 +498,7 @@ t3100e_poll(void *priv)
|
||||
|
||||
/* Graphics */
|
||||
if (t3100e->cga.cgamode & 0x02) {
|
||||
if (t3100e->cga.cgamode & 0x10)
|
||||
if (t3100e->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)
|
||||
t3100e_cgaline6(t3100e);
|
||||
else
|
||||
t3100e_cgaline4(t3100e);
|
||||
@@ -551,7 +551,7 @@ t3100e_poll(void *priv)
|
||||
video_res_y = T3100E_YSIZE;
|
||||
|
||||
if (t3100e->cga.cgamode & 0x02) {
|
||||
if (t3100e->cga.cgamode & 0x10)
|
||||
if (t3100e->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)
|
||||
video_bpp = 1;
|
||||
else
|
||||
video_bpp = 2;
|
||||
|
||||
@@ -58,13 +58,13 @@ static void
|
||||
elt_vid_off_poll(void *priv)
|
||||
{
|
||||
cga_t *cga = priv;
|
||||
uint8_t hdisp = cga->crtc[1];
|
||||
uint8_t hdisp = cga->crtc[CGA_CRTC_HDISP];
|
||||
|
||||
/* Don't display anything.
|
||||
* TODO: Do something less stupid to emulate backlight off. */
|
||||
cga->crtc[1] = 0;
|
||||
cga->crtc[CGA_CRTC_HDISP] = 0;
|
||||
cga_poll(cga);
|
||||
cga->crtc[1] = hdisp;
|
||||
cga->crtc[CGA_CRTC_HDISP] = hdisp;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1918,7 +1918,7 @@ m19_vid_out(uint16_t addr, uint8_t val, void *priv)
|
||||
/* activating plantronics mode */
|
||||
if (addr == 0x3dd) {
|
||||
/* already in graphics mode */
|
||||
if ((val & 0x30) && (vid->ogc.cga.cgamode & 0x2))
|
||||
if ((val & 0x30) && (vid->ogc.cga.cgamode & CGA_MODE_FLAG_GRAPHICS))
|
||||
vid->mode = PLANTRONICS_MODE;
|
||||
else
|
||||
vid->mode = OLIVETTI_OGC_MODE;
|
||||
|
||||
@@ -246,24 +246,24 @@ t1000_text_row80(t1000_t *t1000)
|
||||
int blink;
|
||||
uint16_t addr;
|
||||
uint8_t sc;
|
||||
uint16_t ma = (t1000->cga.crtc[13] | (t1000->cga.crtc[12] << 8)) & 0x3fff;
|
||||
uint16_t ca = (t1000->cga.crtc[15] | (t1000->cga.crtc[14] << 8)) & 0x3fff;
|
||||
uint16_t ma = (t1000->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t1000->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
uint16_t ca = (t1000->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (t1000->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
|
||||
sc = (t1000->displine) & 7;
|
||||
addr = ((ma & ~1) + (t1000->displine >> 3) * 80) * 2;
|
||||
ma += (t1000->displine >> 3) * 80;
|
||||
|
||||
if ((t1000->cga.crtc[10] & 0x60) == 0x20) {
|
||||
if ((t1000->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20) {
|
||||
cursorline = 0;
|
||||
} else {
|
||||
cursorline = ((t1000->cga.crtc[10] & 0x0F) <= sc) && ((t1000->cga.crtc[11] & 0x0F) >= sc);
|
||||
cursorline = ((t1000->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0F) <= sc) && ((t1000->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0F) >= sc);
|
||||
}
|
||||
for (uint8_t x = 0; x < 80; x++) {
|
||||
chr = t1000->vram[(addr + 2 * x) & 0x3FFF];
|
||||
attr = t1000->vram[(addr + 2 * x + 1) & 0x3FFF];
|
||||
drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & 8) && (t1000->cga.cgablink & 16));
|
||||
drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && (t1000->cga.cgablink & 16));
|
||||
|
||||
blink = ((t1000->cga.cgablink & 16) && (t1000->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((t1000->cga.cgablink & 16) && (t1000->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
|
||||
if (t1000->video_options & 1)
|
||||
bold = boldcols[attr] ? chr : chr + 256;
|
||||
@@ -272,7 +272,7 @@ t1000_text_row80(t1000_t *t1000)
|
||||
if (t1000->video_options & 2)
|
||||
bold += 512;
|
||||
|
||||
if (t1000->cga.cgamode & 0x20) /* Blink */
|
||||
if (t1000->cga.cgamode & CGA_MODE_FLAG_BLINK) /* Blink */
|
||||
{
|
||||
cols[1] = blinkcols[attr][1];
|
||||
cols[0] = blinkcols[attr][0];
|
||||
@@ -307,24 +307,24 @@ t1000_text_row40(t1000_t *t1000)
|
||||
int blink;
|
||||
uint16_t addr;
|
||||
uint8_t sc;
|
||||
uint16_t ma = (t1000->cga.crtc[13] | (t1000->cga.crtc[12] << 8)) & 0x3fff;
|
||||
uint16_t ca = (t1000->cga.crtc[15] | (t1000->cga.crtc[14] << 8)) & 0x3fff;
|
||||
uint16_t ma = (t1000->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t1000->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
uint16_t ca = (t1000->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (t1000->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
|
||||
sc = (t1000->displine) & 7;
|
||||
addr = ((ma & ~1) + (t1000->displine >> 3) * 40) * 2;
|
||||
ma += (t1000->displine >> 3) * 40;
|
||||
|
||||
if ((t1000->cga.crtc[10] & 0x60) == 0x20) {
|
||||
if ((t1000->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20) {
|
||||
cursorline = 0;
|
||||
} else {
|
||||
cursorline = ((t1000->cga.crtc[10] & 0x0F) <= sc) && ((t1000->cga.crtc[11] & 0x0F) >= sc);
|
||||
cursorline = ((t1000->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0F) <= sc) && ((t1000->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0F) >= sc);
|
||||
}
|
||||
for (uint8_t x = 0; x < 40; x++) {
|
||||
chr = t1000->vram[(addr + 2 * x) & 0x3FFF];
|
||||
attr = t1000->vram[(addr + 2 * x + 1) & 0x3FFF];
|
||||
drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & 8) && (t1000->cga.cgablink & 16));
|
||||
drawcursor = ((ma == ca) && cursorline && (t1000->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && (t1000->cga.cgablink & 16));
|
||||
|
||||
blink = ((t1000->cga.cgablink & 16) && (t1000->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((t1000->cga.cgablink & 16) && (t1000->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
|
||||
if (t1000->video_options & 1)
|
||||
bold = boldcols[attr] ? chr : chr + 256;
|
||||
@@ -333,7 +333,7 @@ t1000_text_row40(t1000_t *t1000)
|
||||
if (t1000->video_options & 2)
|
||||
bold += 512;
|
||||
|
||||
if (t1000->cga.cgamode & 0x20) /* Blink */
|
||||
if (t1000->cga.cgamode & CGA_MODE_FLAG_BLINK) /* Blink */
|
||||
{
|
||||
cols[1] = blinkcols[attr][1];
|
||||
cols[0] = blinkcols[attr][0];
|
||||
@@ -366,7 +366,7 @@ t1000_cgaline6(t1000_t *t1000)
|
||||
uint32_t fg = (t1000->cga.cgacol & 0x0F) ? blue : grey;
|
||||
uint32_t bg = grey;
|
||||
|
||||
uint16_t ma = (t1000->cga.crtc[13] | (t1000->cga.crtc[12] << 8)) & 0x3fff;
|
||||
uint16_t ma = (t1000->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t1000->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
|
||||
addr = ((t1000->displine) & 1) * 0x2000 + (t1000->displine >> 1) * 80 + ((ma & ~1) << 1);
|
||||
|
||||
@@ -376,7 +376,7 @@ t1000_cgaline6(t1000_t *t1000)
|
||||
|
||||
for (uint8_t c = 0; c < 8; c++) {
|
||||
ink = (dat & 0x80) ? fg : bg;
|
||||
if (!(t1000->cga.cgamode & 8))
|
||||
if (!(t1000->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE))
|
||||
ink = grey;
|
||||
(buffer32->line[t1000->displine])[x * 8 + c] = ink;
|
||||
dat = dat << 1;
|
||||
@@ -395,7 +395,7 @@ t1000_cgaline4(t1000_t *t1000)
|
||||
uint32_t ink1;
|
||||
uint16_t addr;
|
||||
|
||||
uint16_t ma = (t1000->cga.crtc[13] | (t1000->cga.crtc[12] << 8)) & 0x3fff;
|
||||
uint16_t ma = (t1000->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (t1000->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
addr = ((t1000->displine) & 1) * 0x2000 + (t1000->displine >> 1) * 80 + ((ma & ~1) << 1);
|
||||
|
||||
for (uint8_t x = 0; x < 80; x++) {
|
||||
@@ -404,7 +404,7 @@ t1000_cgaline4(t1000_t *t1000)
|
||||
|
||||
for (uint8_t c = 0; c < 4; c++) {
|
||||
pattern = (dat & 0xC0) >> 6;
|
||||
if (!(t1000->cga.cgamode & 8))
|
||||
if (!(t1000->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE))
|
||||
pattern = 0;
|
||||
|
||||
switch (pattern & 3) {
|
||||
@@ -479,7 +479,7 @@ t1000_poll(void *priv)
|
||||
|
||||
/* Graphics */
|
||||
if (t1000->cga.cgamode & 0x02) {
|
||||
if (t1000->cga.cgamode & 0x10)
|
||||
if (t1000->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)
|
||||
t1000_cgaline6(t1000);
|
||||
else
|
||||
t1000_cgaline4(t1000);
|
||||
@@ -532,7 +532,7 @@ t1000_poll(void *priv)
|
||||
video_res_y = T1000_YSIZE;
|
||||
|
||||
if (t1000->cga.cgamode & 0x02) {
|
||||
if (t1000->cga.cgamode & 0x10)
|
||||
if (t1000->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)
|
||||
video_bpp = 1;
|
||||
else
|
||||
video_bpp = 2;
|
||||
|
||||
@@ -75,7 +75,7 @@ cga_update_latch(cga_t *cga)
|
||||
{
|
||||
uint32_t lp_latch = cga->displine * cga->crtc[CGA_CRTC_HDISP];
|
||||
|
||||
cga->crtc[0x10] = (lp_latch >> 8) & 0x3f;
|
||||
cga->crtc[CGA_CRTC_LIGHT_PEN_ADDR_HIGH] = (lp_latch >> 8) & 0x3f;
|
||||
cga->crtc[CGA_CRTC_LIGHT_PEN_ADDR_LOW] = lp_latch & 0xff;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ update_cga16_color(uint8_t cgamode)
|
||||
int left = (x >> 6) & 15;
|
||||
int rc = right;
|
||||
int lc = left;
|
||||
if ((cgamode & 4) != 0) {
|
||||
if ((cgamode & CGA_MODE_FLAG_BW) != 0) {
|
||||
rc = (right & 8) | ((right & 7) != 0 ? 7 : 0);
|
||||
lc = (left & 8) | ((left & 7) != 0 ? 7 : 0);
|
||||
}
|
||||
@@ -240,7 +240,7 @@ Composite_Process(uint8_t cgamode, uint8_t border, uint32_t blocks /*, bool doub
|
||||
for (uint8_t x = 0; x < 5; ++x)
|
||||
OUT(b[x & 3]);
|
||||
|
||||
if ((cgamode & 4) != 0) {
|
||||
if ((cgamode & CGA_MODE_FLAG_BW) != 0) {
|
||||
/* Decode */
|
||||
i = temp + 5;
|
||||
srgb = TempLine;
|
||||
|
||||
@@ -173,7 +173,7 @@ colorplus_poll(void *priv)
|
||||
} else if (colorplus->control & COLORPLUS_640x200_MODE) {
|
||||
cols[0] = (colorplus->cga.cgacol & 15) | 16;
|
||||
col = (colorplus->cga.cgacol & 16) ? 24 : 16;
|
||||
if (colorplus->cga.cgamode & 4) {
|
||||
if (colorplus->cga.cgamode & CGA_MODE_FLAG_BW) {
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 7;
|
||||
@@ -268,7 +268,7 @@ colorplus_poll(void *priv)
|
||||
colorplus->cga.displine = 0;
|
||||
colorplus->cga.vsynctime = 16;
|
||||
if (colorplus->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
if (colorplus->cga.cgamode & 1)
|
||||
if (colorplus->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (colorplus->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (colorplus->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
@@ -288,15 +288,15 @@ colorplus_poll(void *priv)
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
video_res_y = ysize;
|
||||
if (colorplus->cga.cgamode & 1) {
|
||||
if (colorplus->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
video_res_x /= 8;
|
||||
video_res_y /= colorplus->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(colorplus->cga.cgamode & 2)) {
|
||||
} else if (!(colorplus->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
video_res_x /= 16;
|
||||
video_res_y /= colorplus->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(colorplus->cga.cgamode & 16)) {
|
||||
} else if (!(colorplus->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
|
||||
video_res_x /= 2;
|
||||
video_bpp = 2;
|
||||
} else {
|
||||
@@ -317,7 +317,7 @@ colorplus_poll(void *priv)
|
||||
colorplus->cga.cgastat &= ~1;
|
||||
if (colorplus->cga.sc == (colorplus->cga.crtc[CGA_CRTC_CURSOR_START] & 31) || ((colorplus->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && colorplus->cga.sc == ((colorplus->cga.crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
|
||||
colorplus->cga.cursorvisible = 1;
|
||||
if (colorplus->cga.cgadispon && (colorplus->cga.cgamode & 1)) {
|
||||
if (colorplus->cga.cgadispon && (colorplus->cga.cgamode & CGA_MODE_FLAG_HIGHRES)) {
|
||||
for (x = 0; x < (colorplus->cga.crtc[CGA_CRTC_HDISP] << 1); x++)
|
||||
colorplus->cga.charbuffer[x] = colorplus->cga.vram[((colorplus->cga.ma << 1) + x) & 0x3fff];
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ compaq_cga_recalctimings(compaq_cga_t *self)
|
||||
double _dispontime;
|
||||
double _dispofftime;
|
||||
double disptime;
|
||||
disptime = self->cga.crtc[0] + 1;
|
||||
disptime = self->cga.crtc[CGA_CRTC_HTOTAL] + 1;
|
||||
|
||||
_dispontime = self->cga.crtc[1];
|
||||
_dispontime = self->cga.crtc[CGA_CRTC_HDISP];
|
||||
_dispofftime = disptime - _dispontime;
|
||||
_dispontime *= MDACONST;
|
||||
_dispofftime *= MDACONST;
|
||||
@@ -86,7 +86,7 @@ void
|
||||
compaq_cga_poll(void *priv)
|
||||
{
|
||||
compaq_cga_t *self = (compaq_cga_t *) priv;
|
||||
uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x3fff;
|
||||
uint16_t ca = (self->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (self->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
int drawcursor;
|
||||
int x;
|
||||
int c;
|
||||
@@ -102,7 +102,7 @@ compaq_cga_poll(void *priv)
|
||||
int blink = 0;
|
||||
|
||||
/* If in graphics mode or character height is not 13, behave as CGA */
|
||||
if ((self->cga.cgamode & 0x12) || (self->cga.crtc[9] != 13)) {
|
||||
if ((self->cga.cgamode & 0x12) || (self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] != 13)) {
|
||||
overscan_x = overscan_y = 16;
|
||||
cga_poll(&self->cga);
|
||||
return;
|
||||
@@ -115,7 +115,7 @@ compaq_cga_poll(void *priv)
|
||||
self->cga.cgastat |= 1;
|
||||
self->cga.linepos = 1;
|
||||
oldsc = self->cga.sc;
|
||||
if ((self->cga.crtc[8] & 3) == 3)
|
||||
if ((self->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3)
|
||||
self->cga.sc = ((self->cga.sc << 1) + self->cga.oddeven) & 7;
|
||||
if (self->cga.cgadispon) {
|
||||
if (self->cga.displine < self->cga.firstline) {
|
||||
@@ -129,21 +129,21 @@ compaq_cga_poll(void *priv)
|
||||
|
||||
for (c = 0; c < 8; c++) {
|
||||
buffer32->line[self->cga.displine][c] = cols[0];
|
||||
if (self->cga.cgamode & 1)
|
||||
buffer32->line[self->cga.displine][c + (self->cga.crtc[1] << 3) + 8] = cols[0];
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
buffer32->line[self->cga.displine][c + (self->cga.crtc[CGA_CRTC_HDISP] << 3) + 8] = cols[0];
|
||||
else
|
||||
buffer32->line[self->cga.displine][c + (self->cga.crtc[1] << 4) + 8] = cols[0];
|
||||
buffer32->line[self->cga.displine][c + (self->cga.crtc[CGA_CRTC_HDISP] << 4) + 8] = cols[0];
|
||||
}
|
||||
|
||||
if (self->cga.cgamode & 1) {
|
||||
for (x = 0; x < self->cga.crtc[1]; x++) {
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
for (x = 0; x < self->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
chr = self->cga.charbuffer[x << 1];
|
||||
attr = self->cga.charbuffer[(x << 1) + 1];
|
||||
drawcursor = ((self->cga.ma == ca) && self->cga.cursorvisible && self->cga.cursoron);
|
||||
|
||||
if (vflags) {
|
||||
underline = 0;
|
||||
blink = ((self->cga.cgablink & 8) && (self->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((self->cga.cgablink & 8) && (self->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
}
|
||||
|
||||
if (vflags && (self->cga.cgamode & 0x80)) {
|
||||
@@ -152,7 +152,7 @@ compaq_cga_poll(void *priv)
|
||||
|
||||
if ((self->cga.sc == 12) && ((attr & 7) == 1))
|
||||
underline = 1;
|
||||
} else if (self->cga.cgamode & 0x20) {
|
||||
} else if (self->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
|
||||
@@ -181,14 +181,14 @@ compaq_cga_poll(void *priv)
|
||||
self->cga.ma++;
|
||||
}
|
||||
} else {
|
||||
for (x = 0; x < self->cga.crtc[1]; x++) {
|
||||
for (x = 0; x < self->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
chr = self->cga.vram[(self->cga.ma << 1) & 0x3fff];
|
||||
attr = self->cga.vram[((self->cga.ma << 1) + 1) & 0x3fff];
|
||||
drawcursor = ((self->cga.ma == ca) && self->cga.cursorvisible && self->cga.cursoron);
|
||||
|
||||
if (vflags) {
|
||||
underline = 0;
|
||||
blink = ((self->cga.cgablink & 8) && (self->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((self->cga.cgablink & 8) && (self->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
}
|
||||
|
||||
if (vflags && (self->cga.cgamode & 0x80)) {
|
||||
@@ -196,7 +196,7 @@ compaq_cga_poll(void *priv)
|
||||
cols[1] = mdaattr[attr][blink][1];
|
||||
if (self->cga.sc == 12 && (attr & 7) == 1)
|
||||
underline = 1;
|
||||
} else if (self->cga.cgamode & 0x20) {
|
||||
} else if (self->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
|
||||
@@ -228,19 +228,19 @@ compaq_cga_poll(void *priv)
|
||||
} else {
|
||||
cols[0] = (self->cga.cgacol & 15) + 16;
|
||||
|
||||
if (self->cga.cgamode & 1)
|
||||
hline(buffer32, 0, self->cga.displine, (self->cga.crtc[1] << 3) + 16, cols[0]);
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
hline(buffer32, 0, self->cga.displine, (self->cga.crtc[CGA_CRTC_HDISP] << 3) + 16, cols[0]);
|
||||
else
|
||||
hline(buffer32, 0, self->cga.displine, (self->cga.crtc[1] << 4) + 16, cols[0]);
|
||||
hline(buffer32, 0, self->cga.displine, (self->cga.crtc[CGA_CRTC_HDISP] << 4) + 16, cols[0]);
|
||||
}
|
||||
|
||||
if (self->cga.cgamode & 1)
|
||||
x = (self->cga.crtc[1] << 3) + 16;
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (self->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (self->cga.crtc[1] << 4) + 16;
|
||||
x = (self->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
|
||||
if (self->cga.composite) {
|
||||
if (self->cga.cgamode & 0x10)
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)
|
||||
border = 0x00;
|
||||
else
|
||||
border = self->cga.cgacol & 0x0f;
|
||||
@@ -253,7 +253,7 @@ compaq_cga_poll(void *priv)
|
||||
video_process_8(x, self->cga.displine);
|
||||
|
||||
self->cga.sc = oldsc;
|
||||
if (self->cga.vc == self->cga.crtc[7] && !self->cga.sc)
|
||||
if (self->cga.vc == self->cga.crtc[CGA_CRTC_VSYNC] && !self->cga.sc)
|
||||
self->cga.cgastat |= 8;
|
||||
self->cga.displine++;
|
||||
if (self->cga.displine >= 500)
|
||||
@@ -267,10 +267,10 @@ compaq_cga_poll(void *priv)
|
||||
self->cga.cgastat &= ~8;
|
||||
}
|
||||
|
||||
if (self->cga.sc == (self->cga.crtc[11] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[11] & 31) >> 1))) {
|
||||
if (self->cga.sc == (self->cga.crtc[CGA_CRTC_CURSOR_END] & 31) || ((self->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && self->cga.sc == ((self->cga.crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) {
|
||||
self->cga.cursorvisible = 0;
|
||||
}
|
||||
if ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == (self->cga.crtc[9] >> 1))
|
||||
if ((self->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && self->cga.sc == (self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
|
||||
self->cga.maback = self->cga.ma;
|
||||
if (self->cga.vadj) {
|
||||
self->cga.sc++;
|
||||
@@ -279,48 +279,48 @@ compaq_cga_poll(void *priv)
|
||||
self->cga.vadj--;
|
||||
if (!self->cga.vadj) {
|
||||
self->cga.cgadispon = 1;
|
||||
self->cga.ma = self->cga.maback = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x3fff;
|
||||
self->cga.ma = self->cga.maback = (self->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (self->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
self->cga.sc = 0;
|
||||
}
|
||||
} else if (self->cga.sc == self->cga.crtc[9]) {
|
||||
} else if (self->cga.sc == self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR]) {
|
||||
self->cga.maback = self->cga.ma;
|
||||
self->cga.sc = 0;
|
||||
oldvc = self->cga.vc;
|
||||
self->cga.vc++;
|
||||
self->cga.vc &= 127;
|
||||
|
||||
if (self->cga.vc == self->cga.crtc[6])
|
||||
if (self->cga.vc == self->cga.crtc[CGA_CRTC_VDISP])
|
||||
self->cga.cgadispon = 0;
|
||||
|
||||
if (oldvc == self->cga.crtc[4]) {
|
||||
if (oldvc == self->cga.crtc[CGA_CRTC_VTOTAL]) {
|
||||
self->cga.vc = 0;
|
||||
self->cga.vadj = self->cga.crtc[5];
|
||||
self->cga.vadj = self->cga.crtc[CGA_CRTC_VTOTAL_ADJUST];
|
||||
|
||||
if (!self->cga.vadj)
|
||||
self->cga.cgadispon = 1;
|
||||
|
||||
if (!self->cga.vadj)
|
||||
self->cga.ma = self->cga.maback = (self->cga.crtc[13] | (self->cga.crtc[12] << 8)) & 0x3fff;
|
||||
self->cga.ma = self->cga.maback = (self->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (self->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
|
||||
if ((self->cga.crtc[10] & 0x60) == 0x20)
|
||||
if ((self->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20)
|
||||
self->cga.cursoron = 0;
|
||||
else
|
||||
self->cga.cursoron = self->cga.cgablink & 8;
|
||||
}
|
||||
|
||||
if (self->cga.vc == self->cga.crtc[7]) {
|
||||
if (self->cga.vc == self->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
self->cga.cgadispon = 0;
|
||||
self->cga.displine = 0;
|
||||
self->cga.vsynctime = 16;
|
||||
|
||||
if (self->cga.crtc[7]) {
|
||||
if (self->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
compaq_cga_log("Lastline %i Firstline %i %i\n", self->cga.lastline,
|
||||
self->cga.firstline, self->cga.lastline - self->cga.firstline);
|
||||
|
||||
if (self->cga.cgamode & 1)
|
||||
x = (self->cga.crtc[1] << 3) + 16;
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (self->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (self->cga.crtc[1] << 4) + 16;
|
||||
x = (self->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
|
||||
self->cga.lastline++;
|
||||
|
||||
@@ -335,7 +335,7 @@ compaq_cga_poll(void *priv)
|
||||
if (!enable_overscan)
|
||||
xs_temp -= 16;
|
||||
|
||||
if ((self->cga.cgamode & 8) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
if ((self->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
xsize = xs_temp;
|
||||
ysize = ys_temp;
|
||||
set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0));
|
||||
@@ -356,15 +356,15 @@ compaq_cga_poll(void *priv)
|
||||
if (enable_overscan)
|
||||
xsize -= 16;
|
||||
video_res_y = ysize;
|
||||
if (self->cga.cgamode & 1) {
|
||||
if (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
video_res_x /= 8;
|
||||
video_res_y /= self->cga.crtc[9] + 1;
|
||||
video_res_y /= self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(self->cga.cgamode & 2)) {
|
||||
} else if (!(self->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
video_res_x /= 16;
|
||||
video_res_y /= self->cga.crtc[9] + 1;
|
||||
video_res_y /= self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
video_bpp = 0;
|
||||
} else if (!(self->cga.cgamode & 16)) {
|
||||
} else if (!(self->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS)) {
|
||||
video_res_x /= 2;
|
||||
video_bpp = 2;
|
||||
} else
|
||||
@@ -385,11 +385,11 @@ compaq_cga_poll(void *priv)
|
||||
if (self->cga.cgadispon)
|
||||
self->cga.cgastat &= ~1;
|
||||
|
||||
if (self->cga.sc == (self->cga.crtc[10] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[10] & 31) >> 1)))
|
||||
if (self->cga.sc == (self->cga.crtc[CGA_CRTC_CURSOR_START] & 31) || ((self->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && self->cga.sc == ((self->cga.crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
|
||||
self->cga.cursorvisible = 1;
|
||||
|
||||
if (self->cga.cgadispon && (self->cga.cgamode & 1)) {
|
||||
for (x = 0; x < (self->cga.crtc[1] << 1); x++)
|
||||
if (self->cga.cgadispon && (self->cga.cgamode & CGA_MODE_FLAG_HIGHRES)) {
|
||||
for (x = 0; x < (self->cga.crtc[CGA_CRTC_HDISP] << 1); x++)
|
||||
self->cga.charbuffer[x] = self->cga.vram[((self->cga.ma << 1) + x) & 0x3fff];
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ compaq_cga_init(const device_t *info)
|
||||
cga_palette = (self->cga.rgb_type << 1);
|
||||
cgapal_rebuild();
|
||||
|
||||
self->cga.crtc[9] = 13;
|
||||
self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] = 13;
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ compaq_cga_speed_changed(void *priv)
|
||||
{
|
||||
compaq_cga_t *self = (compaq_cga_t *) priv;
|
||||
|
||||
if (self->cga.crtc[9] == 13) /* Character height */
|
||||
if (self->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] == 13) /* Character height */
|
||||
compaq_cga_recalctimings(self);
|
||||
else
|
||||
cga_recalctimings(&self->cga);
|
||||
|
||||
@@ -362,27 +362,27 @@ f82c425_text_row(f82c425_t *f82c425)
|
||||
int blink;
|
||||
uint16_t addr;
|
||||
uint8_t sc;
|
||||
uint16_t ma = (f82c425->cga.crtc[0x0d] | (f82c425->cga.crtc[0x0c] << 8)) & 0x3fff;
|
||||
uint16_t ma = (f82c425->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (f82c425->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
uint16_t ca = (f82c425->cga.crtc[0x0f] | (f82c425->cga.crtc[0x0e] << 8)) & 0x3fff;
|
||||
uint8_t sl = f82c425->cga.crtc[9] + 1;
|
||||
int columns = f82c425->cga.crtc[1];
|
||||
uint8_t sl = f82c425->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1;
|
||||
int columns = f82c425->cga.crtc[CGA_CRTC_HDISP];
|
||||
|
||||
sc = (f82c425->displine) & 7;
|
||||
addr = ((ma & ~1) + (f82c425->displine >> 3) * columns) * 2;
|
||||
ma += (f82c425->displine >> 3) * columns;
|
||||
|
||||
if ((f82c425->cga.crtc[0x0a] & 0x60) == 0x20) {
|
||||
if ((f82c425->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) == 0x20) {
|
||||
cursorline = 0;
|
||||
} else {
|
||||
cursorline = ((f82c425->cga.crtc[0x0a] & 0x0F) <= sc) && ((f82c425->cga.crtc[0x0b] & 0x0F) >= sc);
|
||||
cursorline = ((f82c425->cga.crtc[CGA_CRTC_CURSOR_START] & 0x0F) <= sc) && ((f82c425->cga.crtc[CGA_CRTC_CURSOR_END] & 0x0F) >= sc);
|
||||
}
|
||||
|
||||
for (int x = 0; x < columns; x++) {
|
||||
chr = f82c425->vram[(addr + 2 * x) & 0x3FFF];
|
||||
attr = f82c425->vram[(addr + 2 * x + 1) & 0x3FFF];
|
||||
drawcursor = ((ma == ca) && cursorline && (f82c425->cga.cgamode & 0x8) && (f82c425->cga.cgablink & 0x10));
|
||||
drawcursor = ((ma == ca) && cursorline && (f82c425->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && (f82c425->cga.cgablink & 0x10));
|
||||
|
||||
blink = ((f82c425->cga.cgablink & 0x10) && (f82c425->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
|
||||
blink = ((f82c425->cga.cgablink & 0x10) && (f82c425->cga.cgamode & CGA_MODE_FLAG_BLINK) && (attr & 0x80) && !drawcursor);
|
||||
|
||||
if (drawcursor) {
|
||||
colors[0] = smartmap[~attr & 0xff][0];
|
||||
@@ -418,7 +418,7 @@ f82c425_cgaline6(f82c425_t *f82c425)
|
||||
uint8_t dat;
|
||||
uint16_t addr;
|
||||
|
||||
uint16_t ma = (f82c425->cga.crtc[0x0d] | (f82c425->cga.crtc[0x0c] << 8)) & 0x3fff;
|
||||
uint16_t ma = (f82c425->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (f82c425->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
|
||||
addr = ((f82c425->displine) & 1) * 0x2000 + (f82c425->displine >> 1) * 80 + ((ma & ~1) << 1);
|
||||
|
||||
@@ -442,7 +442,7 @@ f82c425_cgaline4(f82c425_t *f82c425)
|
||||
uint8_t pattern;
|
||||
uint16_t addr;
|
||||
|
||||
uint16_t ma = (f82c425->cga.crtc[0x0d] | (f82c425->cga.crtc[0x0c] << 8)) & 0x3fff;
|
||||
uint16_t ma = (f82c425->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (f82c425->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
addr = ((f82c425->displine) & 1) * 0x2000 + (f82c425->displine >> 1) * 80 + ((ma & ~1) << 1);
|
||||
|
||||
for (uint8_t x = 0; x < 80; x++) {
|
||||
@@ -526,7 +526,7 @@ f82c425_poll(void *priv)
|
||||
f82c425->displine = 0;
|
||||
f82c425->cga.cgastat &= ~8;
|
||||
f82c425->dispon = 1;
|
||||
} else if (f82c425->displine == (f82c425->cga.crtc[9] + 1) * f82c425->cga.crtc[6]) {
|
||||
} else if (f82c425->displine == (f82c425->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1) * f82c425->cga.crtc[CGA_CRTC_VDISP]) {
|
||||
/* Start of VSYNC */
|
||||
f82c425->cga.cgastat |= 8;
|
||||
f82c425->dispon = 0;
|
||||
|
||||
@@ -56,12 +56,12 @@ nga_recalctimings(nga_t *nga)
|
||||
double _dispofftime;
|
||||
double disptime;
|
||||
|
||||
if (nga->cga.cgamode & 1) {
|
||||
disptime = nga->cga.crtc[0] + 1;
|
||||
_dispontime = nga->cga.crtc[1];
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
disptime = nga->cga.crtc[CGA_CRTC_HTOTAL] + 1;
|
||||
_dispontime = nga->cga.crtc[CGA_CRTC_HDISP];
|
||||
} else {
|
||||
disptime = (nga->cga.crtc[0] + 1) << 1;
|
||||
_dispontime = nga->cga.crtc[1] << 1;
|
||||
disptime = (nga->cga.crtc[CGA_CRTC_HTOTAL] + 1) << 1;
|
||||
_dispontime = nga->cga.crtc[CGA_CRTC_HDISP] << 1;
|
||||
}
|
||||
|
||||
_dispofftime = disptime - _dispontime;
|
||||
@@ -148,7 +148,7 @@ nga_poll(void *priv)
|
||||
{
|
||||
nga_t *nga = (nga_t *) priv;
|
||||
/* set cursor position in memory */
|
||||
uint16_t ca = (nga->cga.crtc[15] | (nga->cga.crtc[14] << 8)) & 0x3fff;
|
||||
uint16_t ca = (nga->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (nga->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
int drawcursor;
|
||||
int x;
|
||||
int c;
|
||||
@@ -164,7 +164,7 @@ nga_poll(void *priv)
|
||||
int oldsc;
|
||||
|
||||
/* graphic mode and not high-res modes */
|
||||
if ((nga->cga.cgamode & 2) && !(nga->cga.cgamode & 0x40)) {
|
||||
if ((nga->cga.cgamode & CGA_MODE_FLAG_GRAPHICS) && !(nga->cga.cgamode & 0x40)) {
|
||||
/* standard cga mode */
|
||||
cga_poll(&nga->cga);
|
||||
return;
|
||||
@@ -176,7 +176,7 @@ nga_poll(void *priv)
|
||||
nga->cga.linepos = 1;
|
||||
oldsc = nga->cga.sc;
|
||||
/* if interlaced */
|
||||
if ((nga->cga.crtc[8] & 3) == 3)
|
||||
if ((nga->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3)
|
||||
nga->cga.sc = ((nga->cga.sc << 1) + nga->cga.oddeven) & 7;
|
||||
if (nga->cga.cgadispon) {
|
||||
if (nga->cga.displine < nga->cga.firstline) {
|
||||
@@ -185,11 +185,11 @@ nga_poll(void *priv)
|
||||
}
|
||||
nga->cga.lastline = nga->cga.displine;
|
||||
/* 80-col */
|
||||
if ((nga->cga.cgamode & 1) && !(nga->cga.cgamode & 2)) {
|
||||
if ((nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES) && !(nga->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
/* for each text column */
|
||||
for (x = 0; x < nga->cga.crtc[1]; x++) {
|
||||
for (x = 0; x < nga->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
/* video output enabled */
|
||||
if (nga->cga.cgamode & 8) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
|
||||
/* character */
|
||||
chr = nga->cga.charbuffer[x << 1];
|
||||
/* text attributes */
|
||||
@@ -201,7 +201,7 @@ nga_poll(void *priv)
|
||||
/* set foreground */
|
||||
cols[1] = (attr & 15) + 16;
|
||||
/* blink active */
|
||||
if (nga->cga.cgamode & 0x20) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
/* attribute 7 active and not cursor */
|
||||
if ((nga->cga.cgablink & 8) && (attr & 0x80) && !nga->cga.drawcursor) {
|
||||
@@ -224,10 +224,10 @@ nga_poll(void *priv)
|
||||
}
|
||||
}
|
||||
/* 40-col */
|
||||
else if (!(nga->cga.cgamode & 2)) {
|
||||
else if (!(nga->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
/* for each text column */
|
||||
for (x = 0; x < nga->cga.crtc[1]; x++) {
|
||||
if (nga->cga.cgamode & 8) {
|
||||
for (x = 0; x < nga->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
|
||||
chr = nga->cga.vram[((nga->cga.ma << 1) & 0x3fff) + nga->base];
|
||||
attr = nga->cga.vram[(((nga->cga.ma << 1) + 1) & 0x3fff) + nga->base];
|
||||
} else {
|
||||
@@ -237,7 +237,7 @@ nga_poll(void *priv)
|
||||
/* set foreground */
|
||||
cols[1] = (attr & 15) + 16;
|
||||
/* blink active */
|
||||
if (nga->cga.cgamode & 0x20) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
if ((nga->cga.cgablink & 8) && (attr & 0x80) && !nga->cga.drawcursor) {
|
||||
/* set blinking */
|
||||
@@ -262,7 +262,7 @@ nga_poll(void *priv)
|
||||
/* high res modes */
|
||||
if (nga->cga.cgamode & 0x40) {
|
||||
/* 640x400x2 mode */
|
||||
if (nga->cga.cgamode & 0x4 || nga->cga.cgamode & 0x10) {
|
||||
if (nga->cga.cgamode & 0x4 || nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS) {
|
||||
/*
|
||||
* Scanlines are read in the following order:
|
||||
* 0b8000-0b9f3f even scans (0,4,...)
|
||||
@@ -277,7 +277,7 @@ nga_poll(void *priv)
|
||||
} else {
|
||||
cols[0] = (nga->cga.cgacol & 15) | 16;
|
||||
col = (nga->cga.cgacol & 16) ? 24 : 16;
|
||||
if (nga->cga.cgamode & 4) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_BW) {
|
||||
cols[1] = col | 3; /* Cyan */
|
||||
cols[2] = col | 4; /* Red */
|
||||
cols[3] = col | 7; /* White */
|
||||
@@ -306,11 +306,11 @@ nga_poll(void *priv)
|
||||
}
|
||||
|
||||
/* for each text column */
|
||||
for (x = 0; x < nga->cga.crtc[1]; x++) {
|
||||
for (x = 0; x < nga->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
/* video out */
|
||||
if (nga->cga.cgamode & 8) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
|
||||
/* 640x400x2 */
|
||||
if (nga->cga.cgamode & 0x4 || nga->cga.cgamode & 0x10) {
|
||||
if (nga->cga.cgamode & 0x4 || nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES_GRAPHICS) {
|
||||
/* read two bytes at a time */
|
||||
dat = (nga->cga.vram[((nga->cga.ma << 1) & 0x1fff) + dat2] << 8) | nga->cga.vram[((nga->cga.ma << 1) & 0x1fff) + dat2 + 1];
|
||||
/* each pixel is represented by one bit, so draw 16 pixels at a time */
|
||||
@@ -347,26 +347,26 @@ nga_poll(void *priv)
|
||||
/* nga specific */
|
||||
cols[0] = ((nga->cga.cgamode & 0x12) == 0x12) ? 0 : (nga->cga.cgacol & 15) + 16;
|
||||
/* 80-col */
|
||||
if (nga->cga.cgamode & 1) {
|
||||
hline(buffer32, 0, (nga->cga.displine << 1), ((nga->cga.crtc[1] << 3) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (nga->cga.displine << 1) + 1, ((nga->cga.crtc[1] << 3) + 16) << 2, cols[0]);
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
hline(buffer32, 0, (nga->cga.displine << 1), ((nga->cga.crtc[CGA_CRTC_HDISP] << 3) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (nga->cga.displine << 1) + 1, ((nga->cga.crtc[CGA_CRTC_HDISP] << 3) + 16) << 2, cols[0]);
|
||||
} else {
|
||||
hline(buffer32, 0, (nga->cga.displine << 1), ((nga->cga.crtc[1] << 4) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (nga->cga.displine << 1) + 1, ((nga->cga.crtc[1] << 4) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (nga->cga.displine << 1), ((nga->cga.crtc[CGA_CRTC_HDISP] << 4) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, (nga->cga.displine << 1) + 1, ((nga->cga.crtc[CGA_CRTC_HDISP] << 4) + 16) << 2, cols[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (nga->cga.cgamode & 1)
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
/* set screen width */
|
||||
x = (nga->cga.crtc[1] << 3) + 16;
|
||||
x = (nga->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (nga->cga.crtc[1] << 4) + 16;
|
||||
x = (nga->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
|
||||
video_process_8(x, nga->cga.displine);
|
||||
|
||||
nga->cga.sc = oldsc;
|
||||
/* vertical sync */
|
||||
if (nga->cga.vc == nga->cga.crtc[7] && !nga->cga.sc)
|
||||
if (nga->cga.vc == nga->cga.crtc[CGA_CRTC_VSYNC] && !nga->cga.sc)
|
||||
nga->cga.cgastat |= 8;
|
||||
nga->cga.displine++;
|
||||
if (nga->cga.displine >= 720)
|
||||
@@ -380,7 +380,7 @@ nga_poll(void *priv)
|
||||
nga->lineff ^= 1;
|
||||
|
||||
/* text mode or 640x400x2 */
|
||||
if (nga->lineff && !((nga->cga.cgamode & 1) && (nga->cga.cgamode & 0x40))) {
|
||||
if (nga->lineff && !((nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES) && (nga->cga.cgamode & 0x40))) {
|
||||
nga->cga.ma = nga->cga.maback;
|
||||
/* 640x400x4 */
|
||||
} else {
|
||||
@@ -390,11 +390,11 @@ nga_poll(void *priv)
|
||||
nga->cga.cgastat &= ~8;
|
||||
}
|
||||
/* cursor stop scanline */
|
||||
if (nga->cga.sc == (nga->cga.crtc[11] & 31) || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[11] & 31) >> 1))) {
|
||||
if (nga->cga.sc == (nga->cga.crtc[CGA_CRTC_CURSOR_END] & 31) || ((nga->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) {
|
||||
nga->cga.cursorvisible = 0;
|
||||
}
|
||||
/* interlaced and max scanline per char reached */
|
||||
if ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == (nga->cga.crtc[9] >> 1))
|
||||
if ((nga->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && nga->cga.sc == (nga->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
|
||||
nga->cga.maback = nga->cga.ma;
|
||||
|
||||
if (nga->cga.vadj) {
|
||||
@@ -405,12 +405,12 @@ nga_poll(void *priv)
|
||||
if (!nga->cga.vadj) {
|
||||
nga->cga.cgadispon = 1;
|
||||
/* change start of displayed page (crtc 12-13) */
|
||||
nga->cga.ma = nga->cga.maback = (nga->cga.crtc[13] | (nga->cga.crtc[12] << 8)) & 0x7fff;
|
||||
nga->cga.ma = nga->cga.maback = (nga->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (nga->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
nga->cga.sc = 0;
|
||||
}
|
||||
/* nga specific */
|
||||
/* end of character line reached */
|
||||
} else if (nga->cga.sc == nga->cga.crtc[9] || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == (nga->cga.crtc[9] >> 1))) {
|
||||
} else if (nga->cga.sc == nga->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] || ((nga->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && nga->cga.sc == (nga->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))) {
|
||||
nga->cga.maback = nga->cga.ma;
|
||||
nga->cga.sc = 0;
|
||||
oldvc = nga->cga.vc;
|
||||
@@ -418,21 +418,21 @@ nga_poll(void *priv)
|
||||
nga->cga.vc &= 127;
|
||||
|
||||
/* lines of character displayed */
|
||||
if (nga->cga.vc == nga->cga.crtc[6])
|
||||
if (nga->cga.vc == nga->cga.crtc[CGA_CRTC_VDISP])
|
||||
nga->cga.cgadispon = 0;
|
||||
|
||||
/* total vertical lines */
|
||||
if (oldvc == nga->cga.crtc[4]) {
|
||||
if (oldvc == nga->cga.crtc[CGA_CRTC_VTOTAL]) {
|
||||
nga->cga.vc = 0;
|
||||
/* adjust vertical lines */
|
||||
nga->cga.vadj = nga->cga.crtc[5];
|
||||
nga->cga.vadj = nga->cga.crtc[CGA_CRTC_VTOTAL_ADJUST];
|
||||
if (!nga->cga.vadj) {
|
||||
nga->cga.cgadispon = 1;
|
||||
/* change start of displayed page (crtc 12-13) */
|
||||
nga->cga.ma = nga->cga.maback = (nga->cga.crtc[13] | (nga->cga.crtc[12] << 8)) & 0x7fff;
|
||||
nga->cga.ma = nga->cga.maback = (nga->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (nga->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x7fff;
|
||||
}
|
||||
/* cursor start */
|
||||
switch (nga->cga.crtc[10] & 0x60) {
|
||||
switch (nga->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) {
|
||||
case 0x20:
|
||||
nga->cga.cursoron = 0;
|
||||
break;
|
||||
@@ -445,18 +445,18 @@ nga_poll(void *priv)
|
||||
}
|
||||
}
|
||||
/* vertical line position */
|
||||
if (nga->cga.vc == nga->cga.crtc[7]) {
|
||||
if (nga->cga.vc == nga->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
nga->cga.cgadispon = 0;
|
||||
nga->cga.displine = 0;
|
||||
/* nga specific */
|
||||
nga->cga.vsynctime = 16;
|
||||
/* vsync pos */
|
||||
if (nga->cga.crtc[7]) {
|
||||
if (nga->cga.cgamode & 1)
|
||||
if (nga->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
if (nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
/* set screen width */
|
||||
x = (nga->cga.crtc[1] << 3) + 16;
|
||||
x = (nga->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (nga->cga.crtc[1] << 4) + 16;
|
||||
x = (nga->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
nga->cga.lastline++;
|
||||
|
||||
xs_temp = x;
|
||||
@@ -471,7 +471,7 @@ nga_poll(void *priv)
|
||||
if (!enable_overscan)
|
||||
xs_temp -= 16;
|
||||
|
||||
if ((nga->cga.cgamode & 8) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
if ((nga->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
xsize = xs_temp;
|
||||
ysize = ys_temp;
|
||||
set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0));
|
||||
@@ -493,14 +493,14 @@ nga_poll(void *priv)
|
||||
video_res_x = xsize;
|
||||
video_res_y = ysize;
|
||||
/* 80-col */
|
||||
if ((nga->cga.cgamode & 1) && !(nga->cga.cgamode & 0x40)) {
|
||||
if ((nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES) && !(nga->cga.cgamode & 0x40)) {
|
||||
video_res_x /= 8;
|
||||
video_res_y /= (nga->cga.crtc[9] + 1) * 2;
|
||||
video_res_y /= (nga->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1) * 2;
|
||||
video_bpp = 0;
|
||||
/* 40-col */
|
||||
} else if (!(nga->cga.cgamode & 2)) {
|
||||
} else if (!(nga->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
video_res_x /= 16;
|
||||
video_res_y /= (nga->cga.crtc[9] + 1) * 2;
|
||||
video_res_y /= (nga->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1) * 2;
|
||||
video_bpp = 0;
|
||||
} else if (nga->cga.cgamode & 0x40) {
|
||||
video_res_x /= 8;
|
||||
@@ -523,13 +523,13 @@ nga_poll(void *priv)
|
||||
nga->cga.cgastat &= ~1;
|
||||
|
||||
/* enable cursor if its scanline was reached */
|
||||
if (nga->cga.sc == (nga->cga.crtc[10] & 31) || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[10] & 31) >> 1)))
|
||||
if (nga->cga.sc == (nga->cga.crtc[CGA_CRTC_CURSOR_START] & 31) || ((nga->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
|
||||
nga->cga.cursorvisible = 1;
|
||||
}
|
||||
/* 80-columns */
|
||||
if (nga->cga.cgadispon && (nga->cga.cgamode & 1)) {
|
||||
if (nga->cga.cgadispon && (nga->cga.cgamode & CGA_MODE_FLAG_HIGHRES)) {
|
||||
/* for each character per line */
|
||||
for (x = 0; x < (nga->cga.crtc[1] << 1); x++)
|
||||
for (x = 0; x < (nga->cga.crtc[CGA_CRTC_HDISP] << 1); x++)
|
||||
nga->cga.charbuffer[x] = nga->cga.vram[(((nga->cga.ma << 1) + x) & 0x3fff) + nga->base];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ ogc_recalctimings(ogc_t *ogc)
|
||||
double _dispofftime;
|
||||
double disptime;
|
||||
|
||||
if (ogc->cga.cgamode & 1) {
|
||||
disptime = ogc->cga.crtc[0] + 1;
|
||||
_dispontime = ogc->cga.crtc[1];
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
disptime = ogc->cga.crtc[CGA_CRTC_HTOTAL] + 1;
|
||||
_dispontime = ogc->cga.crtc[CGA_CRTC_HDISP];
|
||||
} else {
|
||||
disptime = (ogc->cga.crtc[0] + 1) << 1;
|
||||
_dispontime = ogc->cga.crtc[1] << 1;
|
||||
disptime = (ogc->cga.crtc[CGA_CRTC_HTOTAL] + 1) << 1;
|
||||
_dispontime = ogc->cga.crtc[CGA_CRTC_HDISP] << 1;
|
||||
}
|
||||
|
||||
_dispofftime = disptime - _dispontime;
|
||||
@@ -201,7 +201,7 @@ void
|
||||
ogc_poll(void *priv)
|
||||
{
|
||||
ogc_t *ogc = (ogc_t *) priv;
|
||||
uint16_t ca = (ogc->cga.crtc[15] | (ogc->cga.crtc[14] << 8)) & 0x3fff;
|
||||
uint16_t ca = (ogc->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
int drawcursor;
|
||||
int x;
|
||||
int c;
|
||||
@@ -220,7 +220,7 @@ ogc_poll(void *priv)
|
||||
// composito colore appare blu scuro
|
||||
|
||||
/* graphic mode and not mode 40h */
|
||||
if (!(ogc->ctrl_3de & 0x1 || !(ogc->cga.cgamode & 2))) {
|
||||
if (!(ogc->ctrl_3de & 0x1 || !(ogc->cga.cgamode & CGA_MODE_FLAG_GRAPHICS))) {
|
||||
/* standard cga mode */
|
||||
cga_poll(&ogc->cga);
|
||||
return;
|
||||
@@ -231,7 +231,7 @@ ogc_poll(void *priv)
|
||||
ogc->cga.cgastat |= 1;
|
||||
ogc->cga.linepos = 1;
|
||||
oldsc = ogc->cga.sc;
|
||||
if ((ogc->cga.crtc[8] & 3) == 3)
|
||||
if ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3)
|
||||
ogc->cga.sc = ((ogc->cga.sc << 1) + ogc->cga.oddeven) & 7;
|
||||
if (ogc->cga.cgadispon) {
|
||||
if (ogc->cga.displine < ogc->cga.firstline) {
|
||||
@@ -240,11 +240,11 @@ ogc_poll(void *priv)
|
||||
}
|
||||
ogc->cga.lastline = ogc->cga.displine;
|
||||
/* 80-col */
|
||||
if (ogc->cga.cgamode & 1) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
/* for each text column */
|
||||
for (x = 0; x < ogc->cga.crtc[1]; x++) {
|
||||
for (x = 0; x < ogc->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
/* video output enabled */
|
||||
if (ogc->cga.cgamode & 8) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
|
||||
/* character */
|
||||
chr = ogc->cga.charbuffer[x << 1];
|
||||
/* text attributes */
|
||||
@@ -263,7 +263,7 @@ ogc_poll(void *priv)
|
||||
/* set foreground */
|
||||
cols[1] = (attr & 15) + 16;
|
||||
/* blink active */
|
||||
if (ogc->cga.cgamode & 0x20) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
/* attribute 7 active and not cursor */
|
||||
if ((ogc->cga.cgablink & 8) && (attr & 0x80) && !ogc->cga.drawcursor) {
|
||||
@@ -293,9 +293,9 @@ ogc_poll(void *priv)
|
||||
}
|
||||
}
|
||||
/* 40-col */
|
||||
else if (!(ogc->cga.cgamode & 2)) {
|
||||
for (x = 0; x < ogc->cga.crtc[1]; x++) {
|
||||
if (ogc->cga.cgamode & 8) {
|
||||
else if (!(ogc->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
for (x = 0; x < ogc->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
|
||||
chr = ogc->cga.vram[((ogc->cga.ma << 1) & 0x3fff) + ogc->base];
|
||||
attr = ogc->cga.vram[(((ogc->cga.ma << 1) + 1) & 0x3fff) + ogc->base];
|
||||
} else {
|
||||
@@ -312,7 +312,7 @@ ogc_poll(void *priv)
|
||||
/* set foreground */
|
||||
cols[1] = (attr & 15) + 16;
|
||||
/* blink active */
|
||||
if (ogc->cga.cgamode & 0x20) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_BLINK) {
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
if ((ogc->cga.cgablink & 8) && (attr & 0x80) && !ogc->cga.drawcursor) {
|
||||
/* set blinking */
|
||||
@@ -352,9 +352,9 @@ ogc_poll(void *priv)
|
||||
cols[1] = (ogc->cga.cgacol & 15) + 16;
|
||||
}
|
||||
|
||||
for (x = 0; x < ogc->cga.crtc[1]; x++) {
|
||||
for (x = 0; x < ogc->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
/* video out */
|
||||
if (ogc->cga.cgamode & 8) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) {
|
||||
dat = (ogc->cga.vram[((ogc->cga.ma << 1) & 0x1fff) + dat2] << 8) | ogc->cga.vram[((ogc->cga.ma << 1) & 0x1fff) + dat2 + 1];
|
||||
} else {
|
||||
dat = 0;
|
||||
@@ -370,22 +370,22 @@ ogc_poll(void *priv)
|
||||
} else {
|
||||
/* ogc specific */
|
||||
cols[0] = ((ogc->cga.cgamode & 0x12) == 0x12) ? 0 : (ogc->cga.cgacol & 15) + 16;
|
||||
if (ogc->cga.cgamode & 1)
|
||||
hline(buffer32, 0, ogc->cga.displine, ((ogc->cga.crtc[1] << 3) + 16) << 2, cols[0]);
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
hline(buffer32, 0, ogc->cga.displine, ((ogc->cga.crtc[CGA_CRTC_HDISP] << 3) + 16) << 2, cols[0]);
|
||||
else
|
||||
hline(buffer32, 0, ogc->cga.displine, ((ogc->cga.crtc[1] << 4) + 16) << 2, cols[0]);
|
||||
hline(buffer32, 0, ogc->cga.displine, ((ogc->cga.crtc[CGA_CRTC_HDISP] << 4) + 16) << 2, cols[0]);
|
||||
}
|
||||
|
||||
/* 80 columns */
|
||||
if (ogc->cga.cgamode & 1)
|
||||
x = (ogc->cga.crtc[1] << 3) + 16;
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (ogc->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (ogc->cga.crtc[1] << 4) + 16;
|
||||
x = (ogc->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
|
||||
video_process_8(x, ogc->cga.displine);
|
||||
|
||||
ogc->cga.sc = oldsc;
|
||||
if (ogc->cga.vc == ogc->cga.crtc[7] && !ogc->cga.sc)
|
||||
if (ogc->cga.vc == ogc->cga.crtc[CGA_CRTC_VSYNC] && !ogc->cga.sc)
|
||||
ogc->cga.cgastat |= 8;
|
||||
ogc->cga.displine++;
|
||||
if (ogc->cga.displine >= 720)
|
||||
@@ -405,10 +405,10 @@ ogc_poll(void *priv)
|
||||
if (!ogc->cga.vsynctime)
|
||||
ogc->cga.cgastat &= ~8;
|
||||
}
|
||||
if (ogc->cga.sc == (ogc->cga.crtc[11] & 31) || ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == ((ogc->cga.crtc[11] & 31) >> 1))) {
|
||||
if (ogc->cga.sc == (ogc->cga.crtc[CGA_CRTC_CURSOR_END] & 31) || ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.sc == ((ogc->cga.crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) {
|
||||
ogc->cga.cursorvisible = 0;
|
||||
}
|
||||
if ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == (ogc->cga.crtc[9] >> 1))
|
||||
if ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.sc == (ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
|
||||
ogc->cga.maback = ogc->cga.ma;
|
||||
if (ogc->cga.vadj) {
|
||||
ogc->cga.sc++;
|
||||
@@ -417,28 +417,28 @@ ogc_poll(void *priv)
|
||||
ogc->cga.vadj--;
|
||||
if (!ogc->cga.vadj) {
|
||||
ogc->cga.cgadispon = 1;
|
||||
ogc->cga.ma = ogc->cga.maback = (ogc->cga.crtc[13] | (ogc->cga.crtc[12] << 8)) & 0x3fff;
|
||||
ogc->cga.ma = ogc->cga.maback = (ogc->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
ogc->cga.sc = 0;
|
||||
}
|
||||
// potrebbe dare problemi con composito
|
||||
} else if (ogc->cga.sc == ogc->cga.crtc[9] || ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == (ogc->cga.crtc[9] >> 1))) {
|
||||
} else if (ogc->cga.sc == ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] || ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.sc == (ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))) {
|
||||
ogc->cga.maback = ogc->cga.ma;
|
||||
ogc->cga.sc = 0;
|
||||
oldvc = ogc->cga.vc;
|
||||
ogc->cga.vc++;
|
||||
ogc->cga.vc &= 127;
|
||||
|
||||
if (ogc->cga.vc == ogc->cga.crtc[6])
|
||||
if (ogc->cga.vc == ogc->cga.crtc[CGA_CRTC_VDISP])
|
||||
ogc->cga.cgadispon = 0;
|
||||
|
||||
if (oldvc == ogc->cga.crtc[4]) {
|
||||
if (oldvc == ogc->cga.crtc[CGA_CRTC_VTOTAL]) {
|
||||
ogc->cga.vc = 0;
|
||||
ogc->cga.vadj = ogc->cga.crtc[5];
|
||||
ogc->cga.vadj = ogc->cga.crtc[CGA_CRTC_VTOTAL_ADJUST];
|
||||
if (!ogc->cga.vadj) {
|
||||
ogc->cga.cgadispon = 1;
|
||||
ogc->cga.ma = ogc->cga.maback = (ogc->cga.crtc[13] | (ogc->cga.crtc[12] << 8)) & 0x3fff;
|
||||
ogc->cga.ma = ogc->cga.maback = (ogc->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
}
|
||||
switch (ogc->cga.crtc[10] & 0x60) {
|
||||
switch (ogc->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) {
|
||||
case 0x20:
|
||||
ogc->cga.cursoron = 0;
|
||||
break;
|
||||
@@ -450,16 +450,16 @@ ogc_poll(void *priv)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ogc->cga.vc == ogc->cga.crtc[7]) {
|
||||
if (ogc->cga.vc == ogc->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
ogc->cga.cgadispon = 0;
|
||||
ogc->cga.displine = 0;
|
||||
/* ogc specific */
|
||||
ogc->cga.vsynctime = (ogc->cga.crtc[3] >> 4) + 1;
|
||||
if (ogc->cga.crtc[7]) {
|
||||
if (ogc->cga.cgamode & 1)
|
||||
x = (ogc->cga.crtc[1] << 3) + 16;
|
||||
ogc->cga.vsynctime = (ogc->cga.crtc[CGA_CRTC_HSYNC_WIDTH] >> 4) + 1;
|
||||
if (ogc->cga.crtc[CGA_CRTC_VSYNC]) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES)
|
||||
x = (ogc->cga.crtc[CGA_CRTC_HDISP] << 3) + 16;
|
||||
else
|
||||
x = (ogc->cga.crtc[1] << 4) + 16;
|
||||
x = (ogc->cga.crtc[CGA_CRTC_HDISP] << 4) + 16;
|
||||
ogc->cga.lastline++;
|
||||
|
||||
xs_temp = x;
|
||||
@@ -474,7 +474,7 @@ ogc_poll(void *priv)
|
||||
if (!enable_overscan)
|
||||
xs_temp -= 16;
|
||||
|
||||
if ((ogc->cga.cgamode & 8) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
if ((ogc->cga.cgamode & CGA_MODE_FLAG_VIDEO_ENABLE) && ((xs_temp != xsize) || (ys_temp != ysize) || video_force_resize_get())) {
|
||||
xsize = xs_temp;
|
||||
ysize = ys_temp;
|
||||
set_screen_size(xsize, ysize + (enable_overscan ? 16 : 0));
|
||||
@@ -496,14 +496,14 @@ ogc_poll(void *priv)
|
||||
video_res_x = xsize;
|
||||
video_res_y = ysize;
|
||||
/* 80-col */
|
||||
if (ogc->cga.cgamode & 1) {
|
||||
if (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES) {
|
||||
video_res_x /= 8;
|
||||
video_res_y /= (ogc->cga.crtc[9] + 1) * 2;
|
||||
video_res_y /= (ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1) * 2;
|
||||
video_bpp = 0;
|
||||
/* 40-col */
|
||||
} else if (!(ogc->cga.cgamode & 2)) {
|
||||
} else if (!(ogc->cga.cgamode & CGA_MODE_FLAG_GRAPHICS)) {
|
||||
video_res_x /= 16;
|
||||
video_res_y /= (ogc->cga.crtc[9] + 1) * 2;
|
||||
video_res_y /= (ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] + 1) * 2;
|
||||
video_bpp = 0;
|
||||
} else if (!(ogc->ctrl_3de & 1)) {
|
||||
video_res_y /= 2;
|
||||
@@ -524,12 +524,12 @@ ogc_poll(void *priv)
|
||||
if (ogc->cga.cgadispon)
|
||||
ogc->cga.cgastat &= ~1;
|
||||
|
||||
if (ogc->cga.sc == (ogc->cga.crtc[10] & 31) || ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == ((ogc->cga.crtc[10] & 31) >> 1)))
|
||||
if (ogc->cga.sc == (ogc->cga.crtc[CGA_CRTC_CURSOR_START] & 31) || ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.sc == ((ogc->cga.crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
|
||||
ogc->cga.cursorvisible = 1;
|
||||
}
|
||||
/* 80-columns */
|
||||
if (ogc->cga.cgadispon && (ogc->cga.cgamode & 1)) {
|
||||
for (x = 0; x < (ogc->cga.crtc[1] << 1); x++)
|
||||
if (ogc->cga.cgadispon && (ogc->cga.cgamode & CGA_MODE_FLAG_HIGHRES)) {
|
||||
for (x = 0; x < (ogc->cga.crtc[CGA_CRTC_HDISP] << 1); x++)
|
||||
ogc->cga.charbuffer[x] = ogc->cga.vram[(((ogc->cga.ma << 1) + x) & 0x3fff) + ogc->base];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user