ma -> memaddr
ma_latch -> memaddr_latch maback -> memaddr_backup ca -> cursoraddr sc -> scanline oldsc -> scanline_old
This commit is contained in:
@@ -201,7 +201,7 @@ void
|
||||
ogc_poll(void *priv)
|
||||
{
|
||||
ogc_t *ogc = (ogc_t *) priv;
|
||||
uint16_t ca = (ogc->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
uint16_t cursoraddr = (ogc->cga.crtc[CGA_CRTC_CURSOR_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_CURSOR_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
int drawcursor;
|
||||
int x;
|
||||
int c;
|
||||
@@ -213,7 +213,7 @@ ogc_poll(void *priv)
|
||||
uint16_t dat;
|
||||
uint16_t dat2;
|
||||
int cols[4];
|
||||
int oldsc;
|
||||
int scanline_old;
|
||||
int blink = 0;
|
||||
int underline = 0;
|
||||
|
||||
@@ -230,9 +230,9 @@ ogc_poll(void *priv)
|
||||
timer_advance_u64(&ogc->cga.timer, ogc->cga.dispofftime);
|
||||
ogc->cga.cgastat |= 1;
|
||||
ogc->cga.linepos = 1;
|
||||
oldsc = ogc->cga.sc;
|
||||
scanline_old = ogc->cga.scanline;
|
||||
if ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3)
|
||||
ogc->cga.sc = ((ogc->cga.sc << 1) + ogc->cga.oddeven) & 7;
|
||||
ogc->cga.scanline = ((ogc->cga.scanline << 1) + ogc->cga.oddeven) & 7;
|
||||
if (ogc->cga.cgadispon) {
|
||||
if (ogc->cga.displine < ogc->cga.firstline) {
|
||||
ogc->cga.firstline = ogc->cga.displine;
|
||||
@@ -252,7 +252,7 @@ ogc_poll(void *priv)
|
||||
} else
|
||||
chr = attr = 0;
|
||||
/* check if cursor has to be drawn */
|
||||
drawcursor = ((ogc->cga.ma == ca) && ogc->cga.cursorvisible && ogc->cga.cursoron);
|
||||
drawcursor = ((ogc->cga.memaddr == cursoraddr) && ogc->cga.cursorvisible && ogc->cga.cursoron);
|
||||
/* check if character underline mode should be set */
|
||||
underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6));
|
||||
if (underline) {
|
||||
@@ -277,31 +277,31 @@ ogc_poll(void *priv)
|
||||
blink = (attr & 0x80) * 8 + 7 + 16;
|
||||
}
|
||||
/* character underline active and 7th row of pixels in character height being drawn */
|
||||
if (underline && (ogc->cga.sc == 7)) {
|
||||
if (underline && (ogc->cga.scanline == 7)) {
|
||||
/* for each pixel in character width */
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer32->line[ogc->cga.displine][(x << 3) + c + 8] = mdaattr[attr][blink][1];
|
||||
} else if (drawcursor) {
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer32->line[ogc->cga.displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((ogc->cga.sc & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
buffer32->line[ogc->cga.displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((ogc->cga.scanline & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
} else {
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer32->line[ogc->cga.displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((ogc->cga.sc & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
buffer32->line[ogc->cga.displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((ogc->cga.scanline & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
|
||||
ogc->cga.ma++;
|
||||
ogc->cga.memaddr++;
|
||||
}
|
||||
}
|
||||
/* 40-col */
|
||||
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];
|
||||
chr = ogc->cga.vram[((ogc->cga.memaddr << 1) & 0x3fff) + ogc->base];
|
||||
attr = ogc->cga.vram[(((ogc->cga.memaddr << 1) + 1) & 0x3fff) + ogc->base];
|
||||
} else {
|
||||
chr = attr = 0;
|
||||
}
|
||||
drawcursor = ((ogc->cga.ma == ca) && ogc->cga.cursorvisible && ogc->cga.cursoron);
|
||||
drawcursor = ((ogc->cga.memaddr == cursoraddr) && ogc->cga.cursorvisible && ogc->cga.cursoron);
|
||||
/* check if character underline mode should be set */
|
||||
underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6));
|
||||
if (underline) {
|
||||
@@ -326,28 +326,28 @@ ogc_poll(void *priv)
|
||||
}
|
||||
|
||||
/* character underline active and 7th row of pixels in character height being drawn */
|
||||
if (underline && (ogc->cga.sc == 7)) {
|
||||
if (underline && (ogc->cga.scanline == 7)) {
|
||||
/* for each pixel in character width */
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 1 + 8] = mdaattr[attr][blink][1];
|
||||
} else if (drawcursor) {
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((ogc->cga.sc & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((ogc->cga.scanline & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
} else {
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((ogc->cga.sc & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 8] = buffer32->line[ogc->cga.displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((ogc->cga.scanline & 7) << 1) | ogc->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
|
||||
ogc->cga.ma++;
|
||||
ogc->cga.memaddr++;
|
||||
}
|
||||
} else {
|
||||
/* 640x400 mode */
|
||||
if (ogc->ctrl_3de & 1) {
|
||||
dat2 = ((ogc->cga.sc & 1) * 0x4000) | (ogc->lineff * 0x2000);
|
||||
dat2 = ((ogc->cga.scanline & 1) * 0x4000) | (ogc->lineff * 0x2000);
|
||||
cols[0] = 0;
|
||||
cols[1] = 15 + 16;
|
||||
} else {
|
||||
dat2 = (ogc->cga.sc & 1) * 0x2000;
|
||||
dat2 = (ogc->cga.scanline & 1) * 0x2000;
|
||||
cols[0] = 0;
|
||||
cols[1] = (ogc->cga.cgacol & 15) + 16;
|
||||
}
|
||||
@@ -355,11 +355,11 @@ ogc_poll(void *priv)
|
||||
for (x = 0; x < ogc->cga.crtc[CGA_CRTC_HDISP]; x++) {
|
||||
/* video out */
|
||||
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];
|
||||
dat = (ogc->cga.vram[((ogc->cga.memaddr << 1) & 0x1fff) + dat2] << 8) | ogc->cga.vram[((ogc->cga.memaddr << 1) & 0x1fff) + dat2 + 1];
|
||||
} else {
|
||||
dat = 0;
|
||||
}
|
||||
ogc->cga.ma++;
|
||||
ogc->cga.memaddr++;
|
||||
|
||||
for (c = 0; c < 16; c++) {
|
||||
buffer32->line[ogc->cga.displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
@@ -384,8 +384,8 @@ ogc_poll(void *priv)
|
||||
|
||||
video_process_8(x, ogc->cga.displine);
|
||||
|
||||
ogc->cga.sc = oldsc;
|
||||
if (ogc->cga.vc == ogc->cga.crtc[CGA_CRTC_VSYNC] && !ogc->cga.sc)
|
||||
ogc->cga.scanline = scanline_old;
|
||||
if (ogc->cga.vc == ogc->cga.crtc[CGA_CRTC_VSYNC] && !ogc->cga.scanline)
|
||||
ogc->cga.cgastat |= 8;
|
||||
ogc->cga.displine++;
|
||||
if (ogc->cga.displine >= 720)
|
||||
@@ -398,32 +398,32 @@ ogc_poll(void *priv)
|
||||
/* ogc specific */
|
||||
ogc->lineff ^= 1;
|
||||
if (ogc->lineff) {
|
||||
ogc->cga.ma = ogc->cga.maback;
|
||||
ogc->cga.memaddr = ogc->cga.memaddr_backup;
|
||||
} else {
|
||||
if (ogc->cga.vsynctime) {
|
||||
ogc->cga.vsynctime--;
|
||||
if (!ogc->cga.vsynctime)
|
||||
ogc->cga.cgastat &= ~8;
|
||||
}
|
||||
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))) {
|
||||
if (ogc->cga.scanline == (ogc->cga.crtc[CGA_CRTC_CURSOR_END] & 31) || ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.scanline == ((ogc->cga.crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) {
|
||||
ogc->cga.cursorvisible = 0;
|
||||
}
|
||||
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.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.scanline == (ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
|
||||
ogc->cga.memaddr_backup = ogc->cga.memaddr;
|
||||
if (ogc->cga.vadj) {
|
||||
ogc->cga.sc++;
|
||||
ogc->cga.sc &= 31;
|
||||
ogc->cga.ma = ogc->cga.maback;
|
||||
ogc->cga.scanline++;
|
||||
ogc->cga.scanline &= 31;
|
||||
ogc->cga.memaddr = ogc->cga.memaddr_backup;
|
||||
ogc->cga.vadj--;
|
||||
if (!ogc->cga.vadj) {
|
||||
ogc->cga.cgadispon = 1;
|
||||
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;
|
||||
ogc->cga.memaddr = ogc->cga.memaddr_backup = (ogc->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
ogc->cga.scanline = 0;
|
||||
}
|
||||
// may cause problems with composite
|
||||
} 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;
|
||||
} else if (ogc->cga.scanline == ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] || ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.scanline == (ogc->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))) {
|
||||
ogc->cga.memaddr_backup = ogc->cga.memaddr;
|
||||
ogc->cga.scanline = 0;
|
||||
oldvc = ogc->cga.vc;
|
||||
ogc->cga.vc++;
|
||||
ogc->cga.vc &= 127;
|
||||
@@ -436,7 +436,7 @@ ogc_poll(void *priv)
|
||||
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[CGA_CRTC_START_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
ogc->cga.memaddr = ogc->cga.memaddr_backup = (ogc->cga.crtc[CGA_CRTC_START_ADDR_LOW] | (ogc->cga.crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff;
|
||||
}
|
||||
switch (ogc->cga.crtc[CGA_CRTC_CURSOR_START] & 0x60) {
|
||||
case 0x20:
|
||||
@@ -516,21 +516,21 @@ ogc_poll(void *priv)
|
||||
ogc->cga.oddeven ^= 1;
|
||||
}
|
||||
} else {
|
||||
ogc->cga.sc++;
|
||||
ogc->cga.sc &= 31;
|
||||
ogc->cga.ma = ogc->cga.maback;
|
||||
ogc->cga.scanline++;
|
||||
ogc->cga.scanline &= 31;
|
||||
ogc->cga.memaddr = ogc->cga.memaddr_backup;
|
||||
}
|
||||
|
||||
if (ogc->cga.cgadispon)
|
||||
ogc->cga.cgastat &= ~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)))
|
||||
if (ogc->cga.scanline == (ogc->cga.crtc[CGA_CRTC_CURSOR_START] & 31) || ((ogc->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && ogc->cga.scanline == ((ogc->cga.crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
|
||||
ogc->cga.cursorvisible = 1;
|
||||
}
|
||||
/* 80-columns */
|
||||
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];
|
||||
ogc->cga.charbuffer[x] = ogc->cga.vram[(((ogc->cga.memaddr << 1) + x) & 0x3fff) + ogc->base];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user