mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 09:58:19 -07:00
Merge branch '86Box:master' into master
This commit is contained in:
@@ -184,7 +184,7 @@ opMOV_CRx_r_a16(uint32_t fetchdat)
|
||||
fetch_ea_16(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0:
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & (0x00000001 | WP_FLAG))
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x00000001)
|
||||
flushmmucache();
|
||||
else if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x80000000) {
|
||||
if (is_p6 || cpu_use_dynarec)
|
||||
@@ -193,7 +193,8 @@ opMOV_CRx_r_a16(uint32_t fetchdat)
|
||||
flushmmucache_nopc();
|
||||
cpu_flush_pending = 1;
|
||||
}
|
||||
}
|
||||
} else if ((cpu_state.regs[cpu_rm].l ^ cr0) & WP_FLAG)
|
||||
flushmmucache_write();
|
||||
/* Make sure CPL = 0 when switching from real mode to protected mode. */
|
||||
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
|
||||
cpu_state.seg_cs.access &= 0x9f;
|
||||
@@ -249,7 +250,7 @@ opMOV_CRx_r_a32(uint32_t fetchdat)
|
||||
fetch_ea_32(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0:
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & (0x00000001 | WP_FLAG))
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x00000001)
|
||||
flushmmucache();
|
||||
else if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x80000000) {
|
||||
if (is_p6 || cpu_use_dynarec)
|
||||
@@ -258,7 +259,8 @@ opMOV_CRx_r_a32(uint32_t fetchdat)
|
||||
flushmmucache_nopc();
|
||||
cpu_flush_pending = 1;
|
||||
}
|
||||
}
|
||||
} else if ((cpu_state.regs[cpu_rm].l ^ cr0) & WP_FLAG)
|
||||
flushmmucache_write();
|
||||
/* Make sure CPL = 0 when switching from real mode to protected mode. */
|
||||
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
|
||||
cpu_state.seg_cs.access &= 0x9f;
|
||||
|
||||
@@ -180,12 +180,13 @@ opMOV_CRx_r_a16(uint32_t fetchdat)
|
||||
fetch_ea_16(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0:
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & (0x00000001 | WP_FLAG))
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x00000001)
|
||||
flushmmucache();
|
||||
else if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x80000000) {
|
||||
flushmmucache_nopc();
|
||||
cpu_flush_pending = 1;
|
||||
}
|
||||
} else if ((cpu_state.regs[cpu_rm].l ^ cr0) & WP_FLAG)
|
||||
flushmmucache_write();
|
||||
/* Make sure CPL = 0 when switching from real mode to protected mode. */
|
||||
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
|
||||
cpu_state.seg_cs.access &= 0x9f;
|
||||
@@ -241,12 +242,13 @@ opMOV_CRx_r_a32(uint32_t fetchdat)
|
||||
fetch_ea_32(fetchdat);
|
||||
switch (cpu_reg) {
|
||||
case 0:
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & (0x00000001 | WP_FLAG))
|
||||
if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x00000001)
|
||||
flushmmucache();
|
||||
else if ((cpu_state.regs[cpu_rm].l ^ cr0) & 0x80000000) {
|
||||
flushmmucache_nopc();
|
||||
cpu_flush_pending = 1;
|
||||
}
|
||||
} else if ((cpu_state.regs[cpu_rm].l ^ cr0) & WP_FLAG)
|
||||
flushmmucache_write();
|
||||
/* Make sure CPL = 0 when switching from real mode to protected mode. */
|
||||
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
|
||||
cpu_state.seg_cs.access &= 0x9f;
|
||||
|
||||
@@ -448,6 +448,7 @@ extern void mem_flush_write_page(uint32_t addr, uint32_t virt);
|
||||
extern void mem_reset_page_blocks(void);
|
||||
|
||||
extern void flushmmucache(void);
|
||||
extern void flushmmucache_write(void);
|
||||
extern void flushmmucache_pc(void);
|
||||
extern void flushmmucache_nopc(void);
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ typedef struct ega_t {
|
||||
uint8_t seqregs[64];
|
||||
uint8_t egapal[16];
|
||||
uint8_t regs[256];
|
||||
|
||||
uint8_t *vram;
|
||||
|
||||
uint16_t light_pen;
|
||||
@@ -73,6 +72,7 @@ typedef struct ega_t {
|
||||
int oddeven_page;
|
||||
int oddeven_chain;
|
||||
int vc;
|
||||
int real_vc;
|
||||
int sc;
|
||||
int dispon;
|
||||
int hdisp_on;
|
||||
@@ -113,6 +113,9 @@ typedef struct ega_t {
|
||||
int remap_required;
|
||||
int actual_type;
|
||||
int chipset;
|
||||
int mono_display;
|
||||
|
||||
int mdacols[256][2][2];
|
||||
|
||||
uint32_t charseta;
|
||||
uint32_t charsetb;
|
||||
|
||||
@@ -225,6 +225,21 @@ flushmmucache(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
flushmmucache_write(void)
|
||||
{
|
||||
for (uint16_t c = 0; c < 256; c++) {
|
||||
if (writelookup[c] != (int) 0xffffffff) {
|
||||
page_lookup[writelookup[c]] = NULL;
|
||||
page_lookupp[writelookup[c]] = 4;
|
||||
writelookup2[writelookup[c]] = LOOKUP_INV;
|
||||
writelookupp[writelookup[c]] = 4;
|
||||
writelookup[c] = 0xffffffff;
|
||||
}
|
||||
}
|
||||
mmuflush++;
|
||||
}
|
||||
|
||||
void
|
||||
flushmmucache_pc(void)
|
||||
{
|
||||
|
||||
@@ -1177,9 +1177,15 @@ modem_process_telnet(modem_t *modem, uint8_t *data, uint32_t size)
|
||||
uint8_t c = data[i];
|
||||
if (modem->telClient.inIAC) {
|
||||
if (modem->telClient.recCommand) {
|
||||
modem_log("modem_process_telnet: received command %i, option %i\n", modem->telClient.command, c);
|
||||
|
||||
if ((c != 0) && (c != 1) && (c != 3)) {
|
||||
if (modem->telClient.command > 250) {
|
||||
/* Reject anything we don't recognize */
|
||||
/* Reject anything we don't recognize */
|
||||
if (modem->telClient.command == 251 || modem->telClient.command == 252) {
|
||||
modem_data_mode_process_byte(modem, 0xff);
|
||||
modem_data_mode_process_byte(modem, 254);
|
||||
modem_data_mode_process_byte(modem, c); /* Don't do crap! */
|
||||
} else if (modem->telClient.command == 253 || modem->telClient.command == 254) {
|
||||
modem_data_mode_process_byte(modem, 0xff);
|
||||
modem_data_mode_process_byte(modem, 252);
|
||||
modem_data_mode_process_byte(modem, c); /* We won't do crap! */
|
||||
|
||||
@@ -442,7 +442,7 @@ cga_interpolate_linear(uint8_t co1, uint8_t co2, double fraction)
|
||||
r2 = pow((r1 >= 0.0) ? r1 : -r1, 1.0 / 2.19921875);
|
||||
if (r1 <= 0.0)
|
||||
r2 = -r2;
|
||||
ret = (uint8_t) (r2 * 255.0);
|
||||
ret = (uint8_t) round(r2 * 255.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -620,11 +620,15 @@ ega_recalctimings(ega_t *ega)
|
||||
ega->y_add >>= 1;
|
||||
|
||||
if (ega->seqregs[1] & 8) {
|
||||
disptime = (double) ((ega->crtc[0] + 2) << 1);
|
||||
_dispontime = (double) ((ega->crtc[1] + 1) << 1);
|
||||
disptime = (double) ((ega->crtc[0] + 2) << 1);
|
||||
_dispontime = (double) ((ega->crtc[1] + 1) << 1);
|
||||
} else {
|
||||
disptime = (double) (ega->crtc[0] + 2);
|
||||
_dispontime = (double) (ega->crtc[1] + 1);
|
||||
disptime = (double) (ega->crtc[0] + 2);
|
||||
_dispontime = (double) (ega->crtc[1] + 1);
|
||||
}
|
||||
if ((ega->actual_type == EGA_SUPEREGA) && (ega->crtc[0xf9] & 0x01)) {
|
||||
disptime *= 2.0;
|
||||
_dispontime *= 2.0;
|
||||
}
|
||||
_dispofftime = disptime - _dispontime;
|
||||
_dispontime *= crtcconst;
|
||||
@@ -852,7 +856,10 @@ ega_poll(void *priv)
|
||||
ega->cca = ega->maback;
|
||||
}
|
||||
}
|
||||
ega->vc++;
|
||||
ega->real_vc++;
|
||||
if ((ega->actual_type != EGA_SUPEREGA) || !(ega->crtc[0xf9] & 0x02) ||
|
||||
!(ega->real_vc & 1))
|
||||
ega->vc++;
|
||||
if (ega->chipset) {
|
||||
if (ega->hdisp > 640)
|
||||
ega->vc &= 1023;
|
||||
@@ -905,9 +912,13 @@ ega_poll(void *priv)
|
||||
|
||||
if (ega->vres) {
|
||||
wy = (ega->lastline - ega->firstline) << 1;
|
||||
if ((ega->actual_type == EGA_SUPEREGA) && (ega->crtc[0xf9] & 0x02))
|
||||
wy >>= 1;
|
||||
ega_doblit(wx, wy, ega);
|
||||
} else {
|
||||
wy = ega->lastline - ega->firstline;
|
||||
if ((ega->actual_type == EGA_SUPEREGA) && (ega->crtc[0xf9] & 0x02))
|
||||
wy >>= 1;
|
||||
ega_doblit(wx, wy, ega);
|
||||
}
|
||||
|
||||
@@ -1436,6 +1447,26 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
|
||||
|
||||
ega->pallook = pallook16;
|
||||
|
||||
for (uint16_t c = 0; c < 256; c++) {
|
||||
ega->mdacols[c][0][0] = ega->mdacols[c][1][0] = ega->mdacols[c][1][1] = 16;
|
||||
if (c & 8)
|
||||
ega->mdacols[c][0][1] = 15 + 16;
|
||||
else
|
||||
ega->mdacols[c][0][1] = 7 + 16;
|
||||
}
|
||||
ega->mdacols[0x70][0][1] = 16;
|
||||
ega->mdacols[0x70][0][0] = ega->mdacols[0x70][1][0] = ega->mdacols[0x70][1][1] = 16 + 15;
|
||||
ega->mdacols[0xF0][0][1] = 16;
|
||||
ega->mdacols[0xF0][0][0] = ega->mdacols[0xF0][1][0] = ega->mdacols[0xF0][1][1] = 16 + 15;
|
||||
ega->mdacols[0x78][0][1] = 16 + 7;
|
||||
ega->mdacols[0x78][0][0] = ega->mdacols[0x78][1][0] = ega->mdacols[0x78][1][1] = 16 + 15;
|
||||
ega->mdacols[0xF8][0][1] = 16 + 7;
|
||||
ega->mdacols[0xF8][0][0] = ega->mdacols[0xF8][1][0] = ega->mdacols[0xF8][1][1] = 16 + 15;
|
||||
ega->mdacols[0x00][0][1] = ega->mdacols[0x00][1][1] = 16;
|
||||
ega->mdacols[0x08][0][1] = ega->mdacols[0x08][1][1] = 16;
|
||||
ega->mdacols[0x80][0][1] = ega->mdacols[0x80][1][1] = 16;
|
||||
ega->mdacols[0x88][0][1] = ega->mdacols[0x88][1][1] = 16;
|
||||
|
||||
egaswitches = monitor_type & 0xf;
|
||||
|
||||
ega->vram_limit = 256 * 1024;
|
||||
|
||||
@@ -118,6 +118,7 @@ ega_render_text(ega_t *ega)
|
||||
const bool doublewidth = ((ega->seqregs[1] & 8) != 0);
|
||||
const bool attrblink = ((ega->attrregs[0x10] & 8) != 0);
|
||||
const bool attrlinechars = (ega->attrregs[0x10] & 4);
|
||||
const bool monoattrs = (ega->attrregs[0x10] & 2);
|
||||
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
|
||||
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
|
||||
const int dwshift = doublewidth ? 1 : 0;
|
||||
@@ -174,13 +175,23 @@ ega_render_text(ega_t *ega)
|
||||
if ((chr & ~0x1F) == 0xC0 && attrlinechars)
|
||||
dat |= (dat >> 1) & 1;
|
||||
|
||||
for (int xx = 0; xx < charwidth; xx++)
|
||||
p[xx] = (dat & (0x100 >> (xx >> dwshift))) ? fg : bg;
|
||||
for (int xx = 0; xx < charwidth; xx++) {
|
||||
if (monoattrs) {
|
||||
if ((ega->sc == ega->crtc[0x14]) && ((attr & 7) == 1))
|
||||
p[xx] = ega->mdacols[attr][attrblink][1];
|
||||
else
|
||||
p[xx] = ega->mdacols[attr][attrblink][dat & (0x100 >> (xx >> dwshift))];
|
||||
} else
|
||||
p[xx] = (dat & (0x100 >> (xx >> dwshift))) ? fg : bg;
|
||||
}
|
||||
|
||||
ega->ma += 4;
|
||||
p += charwidth;
|
||||
}
|
||||
ega->ma &= 0x3ffff;
|
||||
|
||||
if (monoattrs)
|
||||
video_process_8(ega->hdisp + ega->scrollcache, ega->displine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user