Merge branch 'master' into pc98x1

This commit is contained in:
TC1995
2024-08-08 01:16:23 +02:00
3 changed files with 54 additions and 15 deletions

View File

@@ -998,7 +998,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
case 0x10b: /* Microsoft scroll up normal */
case 0x180 ... 0x1ff: /* E0 break codes (including Microsoft scroll down normal) */
/* This key uses a break code as make. Send it manually, only on press. */
if (down) {
if (down && (mouse_capture || !kbd_req_capture || video_fullscreen)) {
if (keycode & 0x100)
keyboard_send(0xe0);
keyboard_send(keycode & 0xff);
@@ -1011,7 +1011,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
break;
case 0x137: /* Print Screen */
if (keyboard_recv(0x38) || keyboard_recv(0x138)) { /* Alt+ */
if (keyboard_recv_ui(0x38) || keyboard_recv_ui(0x138)) { /* Alt+ */
keycode = 0x54;
} else if (down) {
keyboard_input(down, 0x12a);
@@ -1022,7 +1022,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
break;
case 0x145: /* Pause */
if (keyboard_recv(0x1d) || keyboard_recv(0x11d)) { /* Ctrl+ */
if (keyboard_recv_ui(0x1d) || keyboard_recv_ui(0x11d)) { /* Ctrl+ */
keycode = 0x146;
} else {
keyboard_input(down, 0xe11d);
@@ -1196,6 +1196,8 @@ MainWindow::on_actionFullscreen_triggered()
ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
showFullScreen();
}
fs_on_signal = false;
fs_off_signal = false;
ui->stackedWidget->onResize(width(), height());
}

View File

@@ -62,6 +62,7 @@ enum {
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
static uint8_t ega_rotate[8][256];
static int active = 0;
static uint32_t pallook16[256];
static uint32_t pallook64[256];
static int ega_type = EGA_TYPE_IBM;
@@ -155,6 +156,25 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
if (!(val & 1))
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
ega_recalctimings(ega);
if ((ega_type == 2) && !(val & 0x02))
mem_mapping_disable(&ega->mapping);
else switch (ega->gdcreg[6] & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
break;
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x10000);
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&ega->mapping, 0xb0000, 0x08000);
break;
case 0xC: /*32k at B8000*/
mem_mapping_set_addr(&ega->mapping, 0xb8000, 0x08000);
break;
default:
break;
}
break;
case 0x3c4:
ega->seqaddr = val;
@@ -207,7 +227,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
ega->chain2_read = val & 0x10;
break;
case 6:
switch (val & 0xc) {
if ((ega_type == 2) && !(ega->miscout & 0x02))
mem_mapping_disable(&ega->mapping);
else switch (val & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
break;
@@ -593,9 +615,16 @@ ega_recalctimings(ega_t *ega)
if (ega->dispofftime < TIMER_USEC)
ega->dispofftime = TIMER_USEC;
ega->dot_time = (uint64_t) (ega->dot_clock);
if (ega->dot_time < TIMER_USEC)
ega->dot_time = TIMER_USEC;
if (ega_type == 2) {
ega->dot_time = (uint64_t) (ega->dot_clock);
if (ega->dot_time < TIMER_USEC)
ega->dot_time = TIMER_USEC;
timer_disable(&ega->dot_timer);
timer_set_delay_u64(&ega->dot_timer, ega->dot_time);
ega->cca = 0;
active = 1;
ega->dot = 0;
}
ega_recalc_remap_func(ega);
}
@@ -622,14 +651,13 @@ ega_dot_poll(void *priv)
uint32_t addr;
int drawcursor;
uint32_t charaddr;
static int fg;
static int bg;
static uint32_t dat;
static int fg = 0;
static int bg = 0;
static uint32_t dat = 0x00000000;
static int cclock = 0;
static int disptime;
static int _dispontime;
static int _dispofftime;
static int cclock = 0;
static int active = 0;
if (ega->seqregs[1] & 8) {
disptime = ((ega->crtc[0] + 2) << 1);
@@ -1476,6 +1504,8 @@ ega_standalone_init(const device_t *info)
ega->vrammask = ega->vram_limit - 1;
mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, ega);
if (ega_type == 2)
mem_mapping_disable(&ega->mapping);
io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if (ega->chipset) {

View File

@@ -201,7 +201,8 @@ ega_render_graphics(ega_t *ega)
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
const bool seqoddeven = ((ega->seqregs[1] & 4) != 0);
const uint8_t blinkmask = (attrblink && blinked ? 0x8 : 0x0);
const uint8_t blinkmask = (attrblink ? 0x8 : 0x0);
const uint8_t blinkval = (attrblink && blinked ? 0x8 : 0x0);
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift;
@@ -254,8 +255,14 @@ ega_render_graphics(ega_t *ega)
uint8_t dat = (edatlookup[(edat[0] >> inshift) & 3][(edat[1] >> inshift) & 3])
| (edatlookup[(edat[2] >> inshift) & 3][(edat[3] >> inshift) & 3] << 2);
// FIXME: Confirm blink behaviour is actually XOR on real hardware
uint32_t p0 = ega->pallook[ega->egapal[((dat >> 4) & ega->plane_mask) ^ blinkmask]];
uint32_t p1 = ega->pallook[ega->egapal[(dat & ega->plane_mask) ^ blinkmask]];
uint32_t c0 = (dat >> 4) & 0xF;
uint32_t c1 = dat & 0xF;
c0 = ((c0 & ega->plane_mask & ~blinkmask) |
((c0 | ~ega->plane_mask) & blinkmask & blinkval)) ^ blinkmask;
c1 = ((c1 & ega->plane_mask & ~blinkmask) |
((c1 | ~ega->plane_mask) & blinkmask & blinkval)) ^ blinkmask;
uint32_t p0 = ega->pallook[ega->egapal[c0]];
uint32_t p1 = ega->pallook[ega->egapal[c1]];
for (int subx = 0; subx < dotwidth; subx++)
p[outoffs + subx] = p0;
for (int subx = 0; subx < dotwidth; subx++)