From eeb8af91f596985f8adf95c369f31ae9caf7e7ed Mon Sep 17 00:00:00 2001 From: cold-brewed <47337035+cold-brewed@users.noreply.github.com> Date: Sat, 13 Jul 2024 09:30:36 -0400 Subject: [PATCH 1/5] qt: Fix settings on mac and linux --- src/qt/qt_settings.cpp | 7 +- src/qt/qt_settings.ui | 36 +++-- src/qt/qt_settingsfloppycdrom.ui | 219 +++++++++++++++------------- src/qt/qt_settingsotherremovable.ui | 205 ++++++++++++++------------ 4 files changed, 252 insertions(+), 215 deletions(-) diff --git a/src/qt/qt_settings.cpp b/src/qt/qt_settings.cpp index caabdbfca..67064b73a 100644 --- a/src/qt/qt_settings.cpp +++ b/src/qt/qt_settings.cpp @@ -50,6 +50,7 @@ public: SettingsModel(QObject *parent) : QAbstractListModel(parent) { + fontHeight = QApplication::fontMetrics().height(); } QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; @@ -82,6 +83,7 @@ private: "other_removable_devices", "other_peripherals", }; + int fontHeight; }; QVariant @@ -94,6 +96,8 @@ SettingsModel::data(const QModelIndex &index, int role) const return tr(pages.at(index.row()).toUtf8().data()); case Qt::DecorationRole: return QIcon(QString("%1/%2.ico").arg(ProgSettings::getIconSetPath(), page_icons[index.row()])); + case Qt::SizeHintRole: + return QSize(-1, fontHeight * 2); default: return {}; } @@ -182,9 +186,6 @@ Settings::Settings(QWidget *parent) [this](const QModelIndex ¤t, const QModelIndex &previous) { ui->stackedWidget->setCurrentIndex(current.row()); }); - ui->listView->resizeColumnsToContents(); - ui->listView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->listView->setCurrentIndex(model->index(0, 0)); Settings::settings = this; diff --git a/src/qt/qt_settings.ui b/src/qt/qt_settings.ui index fd92f7f58..da31b98c4 100644 --- a/src/qt/qt_settings.ui +++ b/src/qt/qt_settings.ui @@ -36,25 +36,31 @@ 0 - - - QAbstractItemView::NoEditTriggers + + + + 0 + 0 + - - QAbstractItemView::SingleSelection + + + 200 + 0 + - - QAbstractItemView::SelectRows + + + 200 + 16777215 + - - false + + QListView::ListMode + + + true - - false - - - false - diff --git a/src/qt/qt_settingsfloppycdrom.ui b/src/qt/qt_settingsfloppycdrom.ui index d7ad853b3..b9a937d8d 100644 --- a/src/qt/qt_settingsfloppycdrom.ui +++ b/src/qt/qt_settingsfloppycdrom.ui @@ -7,7 +7,7 @@ 0 0 544 - 617 + 363 @@ -35,6 +35,18 @@ + + + 0 + 0 + + + + + 16777215 + 150 + + QAbstractItemView::NoEditTriggers @@ -53,49 +65,38 @@ - - - - - Type: - - - - - - - 30 - - - - - - - Turbo timings - - - - - - - Check BPB - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + + Type: + + + + + + + 30 + + + + + + + Turbo timings + + + + + + + Check BPB + + + + + @@ -106,6 +107,18 @@ + + + 0 + 0 + + + + + 16777215 + 150 + + QAbstractItemView::NoEditTriggers @@ -124,64 +137,66 @@ - - - - - Bus: - - - - - - - Channel: - - - - - - - Speed: - - - - - - - Type: - - - - - - - 30 - - - - - - - 30 - - - - - - - 30 - - - - - - - 30 - - - - + + + + + + Bus: + + + + + + + Channel: + + + + + + + Speed: + + + + + + + Type: + + + + + + + 30 + + + + + + + 30 + + + + + + + 30 + + + + + + + 30 + + + + + diff --git a/src/qt/qt_settingsotherremovable.ui b/src/qt/qt_settingsotherremovable.ui index 219333376..8962184fc 100644 --- a/src/qt/qt_settingsotherremovable.ui +++ b/src/qt/qt_settingsotherremovable.ui @@ -7,7 +7,7 @@ 0 0 418 - 433 + 368 @@ -35,6 +35,18 @@ + + + 0 + 0 + + + + + 16777215 + 150 + + QAbstractItemView::NoEditTriggers @@ -53,63 +65,52 @@ - - - - - Bus: - - - - - - - Channel: - - - - - - - 30 - - - - - - - 30 - - - - - - - Type: - - - - - - - 30 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + + Bus: + + + + + + + Channel: + + + + + + + 30 + + + + + + + 30 + + + + + + + Type: + + + + + + + 30 + + + + + @@ -120,6 +121,18 @@ + + + 0 + 0 + + + + + 16777215 + 150 + + QAbstractItemView::NoEditTriggers @@ -138,43 +151,45 @@ - - - - - Bus: - - - - - - - 30 - - - - - - - Channel: - - - - - - - 30 - - - - - - - ZIP 250 - - - - + + + + + + Bus: + + + + + + + 30 + + + + + + + Channel: + + + + + + + 30 + + + + + + + ZIP 250 + + + + + From 44be6a0dbfd8b081bd0e3f5ef719b3452a4f2970 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Jul 2024 19:14:12 -0300 Subject: [PATCH 2/5] C&T 69000: Fix PCI slot assignment and internal name --- src/config.c | 4 ++++ src/video/vid_chips_69000.c | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/config.c b/src/config.c index bc4341b0d..3548fdf2d 100644 --- a/src/config.c +++ b/src/config.c @@ -431,6 +431,10 @@ load_video(void) strcpy(p, "none"); } free_p = 1; + } else if (!strcmp(p, "c&t_69000")) { + p = (char *) malloc((strlen("chips_69000") + 1) * sizeof(char)); + strcpy(p, "chips_69000"); + free_p = 1; } gfxcard[0] = video_get_video_from_internal_name(p); if (free_p) { diff --git a/src/video/vid_chips_69000.c b/src/video/vid_chips_69000.c index d91ab1a8b..2caefd413 100644 --- a/src/video/vid_chips_69000.c +++ b/src/video/vid_chips_69000.c @@ -156,7 +156,7 @@ typedef struct chips_69000_t { rom_t bios_rom; - void* i2c_ddc, *ddc; + void *i2c, *ddc; uint8_t st01; } chips_69000_t; @@ -1497,10 +1497,10 @@ chips_69000_read_ext_reg(chips_69000_t* chips) { val = chips->ext_regs[index]; if (!(chips->ext_regs[0x62] & 0x8)) - val = (val & ~8) | (i2c_gpio_get_scl(chips->i2c_ddc) << 3); + val = (val & ~8) | (i2c_gpio_get_scl(chips->i2c) << 3); if (!(chips->ext_regs[0x62] & 0x4)) - val = (val & ~4) | (i2c_gpio_get_sda(chips->i2c_ddc) << 2); + val = (val & ~4) | (i2c_gpio_get_sda(chips->i2c) << 2); break; } @@ -1560,14 +1560,14 @@ chips_69000_write_ext_reg(chips_69000_t* chips, uint8_t val) if (chips->ext_regs[0x62] & 0x8) scl = !!(val & 8); else - scl = i2c_gpio_get_scl(chips->i2c_ddc); + scl = i2c_gpio_get_scl(chips->i2c); if (chips->ext_regs[0x62] & 0x4) sda = !!(val & 4); else - scl = i2c_gpio_get_sda(chips->i2c_ddc); + scl = i2c_gpio_get_sda(chips->i2c); - i2c_gpio_set(chips->i2c_ddc, scl, sda); + i2c_gpio_set(chips->i2c, scl, sda); chips->ext_regs[chips->ext_index] = val & 0x9F; break; @@ -2455,7 +2455,7 @@ chips_69000_init(const device_t *info) io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips); - pci_add_card(PCI_ADD_VIDEO, chips_69000_pci_read, chips_69000_pci_write, chips, &chips->slot); + pci_add_card(info->local ? PCI_ADD_VIDEO : PCI_ADD_NORMAL, chips_69000_pci_read, chips_69000_pci_write, chips, &chips->slot); chips->svga.bpp = 8; chips->svga.miscout = 1; @@ -2477,8 +2477,8 @@ chips_69000_init(const device_t *info) timer_add(&chips->decrement_timer, chips_69000_decrement_timer, chips, 0); timer_on_auto(&chips->decrement_timer, 1000000. / 2000.); - chips->i2c_ddc = i2c_gpio_init("c&t_69000_mga"); - chips->ddc = ddc_init(i2c_gpio_get_bus(chips->i2c_ddc)); + chips->i2c = i2c_gpio_init("chips_69000_ddc"); + chips->ddc = ddc_init(i2c_gpio_get_bus(chips->i2c)); chips->flat_panel_regs[0x01] = 1; @@ -2500,7 +2500,7 @@ chips_69000_close(void *p) // thread_set_event(chips->fifo_event); // thread_wait(chips->accel_thread); ddc_close(chips->ddc); - i2c_gpio_close(chips->i2c_ddc); + i2c_gpio_close(chips->i2c); svga_close(&chips->svga); free(chips); @@ -2524,7 +2524,7 @@ chips_69000_force_redraw(void *p) const device_t chips_69000_device = { .name = "Chips & Technologies B69000", - .internal_name = "c&t_69000", + .internal_name = "chips_69000", .flags = DEVICE_PCI, .local = 0, .init = chips_69000_init, @@ -2537,8 +2537,8 @@ const device_t chips_69000_device = { }; const device_t chips_69000_onboard_device = { - .name = "Chips & Technologies B69000 (onboard)", - .internal_name = "c&t_69000_onboard", + .name = "Chips & Technologies B69000 On-Board", + .internal_name = "chips_69000_onboard", .flags = DEVICE_PCI, .local = 1, .init = chips_69000_init, From 869b4813715d395500ca9dbeeb609b8c639c448b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Jul 2024 19:15:31 -0300 Subject: [PATCH 3/5] config: Remove ancient Sound Blaster PCI 128 migration path --- src/config.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/config.c b/src/config.c index 3548fdf2d..8a837cf56 100644 --- a/src/config.c +++ b/src/config.c @@ -558,36 +558,24 @@ load_sound(void) char *p; p = ini_section_get_string(cat, "sndcard", NULL); - /* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */ - if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci"))) - p = "es1371"; if (p != NULL) sound_card_current[0] = sound_card_get_from_internal_name(p); else sound_card_current[0] = 0; p = ini_section_get_string(cat, "sndcard2", NULL); - /* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */ - if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci"))) - p = "es1371"; if (p != NULL) sound_card_current[1] = sound_card_get_from_internal_name(p); else sound_card_current[1] = 0; p = ini_section_get_string(cat, "sndcard3", NULL); - /* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */ - if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci"))) - p = "es1371"; if (p != NULL) sound_card_current[2] = sound_card_get_from_internal_name(p); else sound_card_current[2] = 0; p = ini_section_get_string(cat, "sndcard4", NULL); - /* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */ - if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci"))) - p = "es1371"; if (p != NULL) sound_card_current[3] = sound_card_get_from_internal_name(p); else From f247fa84acbc1512dc13384975fae88b27467cff Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Jul 2024 19:17:48 -0300 Subject: [PATCH 4/5] gdbstub: Don't reload CS on jump --- src/gdbstub.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gdbstub.c b/src/gdbstub.c index 703637422..8322c5ef6 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -365,13 +365,7 @@ gdbstub_break(void) static void gdbstub_jump(uint32_t new_pc) { - /* Nasty hack; qemu always uses the full 32-bit EIP internally... */ - if (cpu_state.op32 || ((new_pc >= cs) && (new_pc < (cs + 65536)))) { - cpu_state.pc = new_pc - cs; - } else { - loadseg((new_pc >> 4) & 0xf000, &cpu_state.seg_cs); - cpu_state.pc = new_pc & 0xffff; - } + cpu_state.pc = new_pc - cs; flushmmucache(); } From 1c034a15ed2b4ee60fa350802619c5ed86d77438 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 14 Jul 2024 01:33:06 +0200 Subject: [PATCH 5/5] PCjr: Fix overscan. --- src/machine/m_pcjr.c | 298 ++++++++++++++++++++++++++++++++----------- 1 file changed, 226 insertions(+), 72 deletions(-) diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index 9d2aa6879..6638402f7 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -161,6 +161,19 @@ recalc_timings(pcjr_t *pcjr) pcjr->dispofftime = (uint64_t) (_dispofftime); } +static int +vid_get_h_overscan_size(pcjr_t *pcjr) +{ + int ret; + + if (pcjr->array[0] & 1) + ret = 128; + else + ret = 256; + + return ret; +} + static void vid_out(uint16_t addr, uint8_t val, void *priv) { @@ -181,6 +194,8 @@ vid_out(uint16_t addr, uint8_t val, void *priv) case 0x3d7: old = pcjr->crtc[pcjr->crtcreg]; pcjr->crtc[pcjr->crtcreg] = val & crtcmask[pcjr->crtcreg]; + if (pcjr->crtcreg == 2) + overscan_x = vid_get_h_overscan_size(pcjr); if (old != val) { if (pcjr->crtcreg < 0xe || pcjr->crtcreg > 0x10) { pcjr->fullchange = changeframecount; @@ -273,6 +288,93 @@ vid_read(uint32_t addr, void *priv) return (pcjr->b8000[addr & 0x3fff]); } +static int +vid_get_h_overscan_delta(pcjr_t *pcjr) +{ + int def; + int coef; + int ret; + + switch ((pcjr->array[0] & 0x13) | ((pcjr->array[3] & 0x08) << 5)) { + case 0x13: /*320x200x16*/ + def = 0x56; + coef = 8; + break; + case 0x12: /*160x200x16*/ + def = 0x2b; + coef = 16; + break; + case 0x03: /*640x200x4*/ + def = 0x56; + coef = 8; + break; + case 0x01: /*80 column text*/ + def = 0x5a; + coef = 8; + break; + case 0x00: /*40 column text*/ + default: + def = 0x2c; + coef = 16; + break; + case 0x02: /*320x200x4*/ + def = 0x2b; + coef = 16; + break; + case 0x102: /*640x200x2*/ + def = 0x2b; + coef = 16; + break; + } + + ret = pcjr->crtc[0x02] - def; + + if (ret < -8) + ret = -8; + + if (ret > 8) + ret = 8; + + return ret * coef; +} + +static void +vid_blit_h_overscan(pcjr_t *pcjr) +{ + int cols; + int i; + int x; + int y = (pcjr->lastline << 1) + 16; + int ho_s = vid_get_h_overscan_size(pcjr); + + if (pcjr->dispon) + cols = (pcjr->array[2] & 0xf) + 16; + else { + if (pcjr->array[3] & 4) + cols = (pcjr->array[2] & 0xf) + 16; + else + cols = pcjr->array[0 + 16] + 16; + } + + if (pcjr->array[0] & 1) + x = (pcjr->crtc[1] << 3) + ho_s; + else + x = (pcjr->crtc[1] << 4) + ho_s; + + for (i = 0; i < 16; i++) { + hline(buffer32, 0, i, x, cols); + hline(buffer32, 0, y + i, x, cols); + + if (pcjr->composite) { + Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[i]); + Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[y + i]); + } else { + video_process_8(x, i); + video_process_8(x, y + i); + } + } +} + static void vid_poll(void *priv) { @@ -288,6 +390,9 @@ vid_poll(void *priv) uint16_t dat; int cols[4]; int oldsc; + int l = (pcjr->displine << 1) + 16; + int ho_s = vid_get_h_overscan_size(pcjr); + int ho_d = vid_get_h_overscan_delta(pcjr) + (ho_s / 2); if (!pcjr->linepos) { timer_advance_u64(&pcjr->timer, pcjr->dispofftime); @@ -306,13 +411,13 @@ vid_poll(void *priv) } pcjr->lastline = pcjr->displine; cols[0] = (pcjr->array[2] & 0xf) + 16; - for (uint8_t c = 0; c < 8; c++) { - (buffer32->line[pcjr->displine])[c] = cols[0]; - if (pcjr->array[0] & 1) { - buffer32->line[pcjr->displine << 1][c + (pcjr->crtc[1] << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 3) + 8] = cols[0]; - } else { - buffer32->line[pcjr->displine << 1][c + (pcjr->crtc[1] << 4) + 8] = buffer32->line[(pcjr->displine << 1) + 1][c + (pcjr->crtc[1] << 4) + 8] = cols[0]; - } + + if (pcjr->array[0] & 1) { + hline(buffer32, 0, l, (pcjr->crtc[1] << 3) + ho_s, cols[0]); + hline(buffer32, 0, l + 1, (pcjr->crtc[1] << 3) + ho_s, cols[0]); + } else { + hline(buffer32, 0, l, (pcjr->crtc[1] << 4) + ho_s, cols[0]); + hline(buffer32, 0, l + 1, (pcjr->crtc[1] << 4) + ho_s, cols[0]); } switch (pcjr->addr_mode) { @@ -326,45 +431,76 @@ vid_poll(void *priv) case 3: /*High resolution graphics*/ offset = (pcjr->sc & 3) * 0x2000; break; - default: break; } switch ((pcjr->array[0] & 0x13) | ((pcjr->array[3] & 0x08) << 5)) { case 0x13: /*320x200x16*/ for (x = 0; x < pcjr->crtc[1]; x++) { - dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; + int ef_x = (x << 3) + ho_d; + dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | + pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; - buffer32->line[pcjr->displine << 1][(x << 3) + 8] = buffer32->line[pcjr->displine << 1][(x << 3) + 9] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 9] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16; - buffer32->line[pcjr->displine << 1][(x << 3) + 10] = buffer32->line[pcjr->displine << 1][(x << 3) + 11] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 10] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 11] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16; - buffer32->line[pcjr->displine << 1][(x << 3) + 12] = buffer32->line[pcjr->displine << 1][(x << 3) + 13] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 12] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 13] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16; - buffer32->line[pcjr->displine << 1][(x << 3) + 14] = buffer32->line[pcjr->displine << 1][(x << 3) + 15] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 14] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 15] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x] = buffer32->line[l][ef_x + 1] = + buffer32->line[l + 1][ef_x] = buffer32->line[l + 1][ef_x + 1] = + pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + 2] = buffer32->line[l][ef_x + 3] = + buffer32->line[l + 1][ef_x + 2] = buffer32->line[l + 1][ef_x + 3] = + pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + 4] = buffer32->line[l][ef_x + 5] = + buffer32->line[l + 1][ef_x + 4] = buffer32->line[l + 1][ef_x + 5] = + pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + 6] = buffer32->line[l][ef_x + 7] = + buffer32->line[l + 1][ef_x + 6] = buffer32->line[l + 1][ef_x + 7] = + pcjr->array[(dat & pcjr->array[1]) + 16] + 16; } break; case 0x12: /*160x200x16*/ for (x = 0; x < pcjr->crtc[1]; x++) { - dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; + int ef_x = (x << 4) + ho_d; + dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | + pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; - buffer32->line[pcjr->displine << 1][(x << 4) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + 9] = buffer32->line[pcjr->displine << 1][(x << 4) + 10] = buffer32->line[pcjr->displine << 1][(x << 4) + 11] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 9] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 10] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 11] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16; - buffer32->line[pcjr->displine << 1][(x << 4) + 12] = buffer32->line[pcjr->displine << 1][(x << 4) + 13] = buffer32->line[pcjr->displine << 1][(x << 4) + 14] = buffer32->line[pcjr->displine << 1][(x << 4) + 15] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 12] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 13] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 14] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 15] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16; - buffer32->line[pcjr->displine << 1][(x << 4) + 16] = buffer32->line[pcjr->displine << 1][(x << 4) + 17] = buffer32->line[pcjr->displine << 1][(x << 4) + 18] = buffer32->line[pcjr->displine << 1][(x << 4) + 19] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 16] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 17] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 18] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 19] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16; - buffer32->line[pcjr->displine << 1][(x << 4) + 20] = buffer32->line[pcjr->displine << 1][(x << 4) + 21] = buffer32->line[pcjr->displine << 1][(x << 4) + 22] = buffer32->line[pcjr->displine << 1][(x << 4) + 23] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 20] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 21] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 22] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + 23] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x] = buffer32->line[l][ef_x + 1] = + buffer32->line[l][ef_x + 2] = buffer32->line[l][ef_x + 3] = + buffer32->line[l + 1][ef_x] = buffer32->line[l + 1][ef_x + 1] = + buffer32->line[l + 1][ef_x + 2] = buffer32->line[l + 1][ef_x + 3] = + pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + 4] = buffer32->line[l][ef_x + 5] = + buffer32->line[l][ef_x + 6] = buffer32->line[l][ef_x + 7] = + buffer32->line[l + 1][(x << 4) + 12] = buffer32->line[l + 1][(x << 4) + 13] = + buffer32->line[l + 1][(x << 4) + 14] = buffer32->line[l + 1][(x << 4) + 15] = + pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + 8] = buffer32->line[l][ef_x + 9] = + buffer32->line[l][ef_x + 10] = buffer32->line[l][ef_x + 11] = + buffer32->line[l + 1][ef_x + 8] = buffer32->line[l + 1][ef_x + 9] = + buffer32->line[l + 1][ef_x + 10] = buffer32->line[l + 1][ef_x + 11] = + pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + 12] = buffer32->line[l][ef_x + 13] = + buffer32->line[l][ef_x + 14] = buffer32->line[l][ef_x + 15] = + buffer32->line[l + 1][ef_x + 12] = buffer32->line[l + 1][ef_x + 13] = + buffer32->line[l + 1][ef_x + 14] = buffer32->line[l + 1][ef_x + 15] = + pcjr->array[(dat & pcjr->array[1]) + 16] + 16; } break; case 0x03: /*640x200x4*/ for (x = 0; x < pcjr->crtc[1]; x++) { - dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset]; + int ef_x = (x << 3) + ho_d; + dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1] << 8) | + pcjr->vram[((pcjr->ma << 1) & mask) + offset]; pcjr->ma++; for (uint8_t c = 0; c < 8; c++) { chr = (dat >> 7) & 1; chr |= ((dat >> 14) & 2); - buffer32->line[pcjr->displine << 1][(x << 3) + 8 + c] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16; + buffer32->line[l][ef_x + c] = buffer32->line[l + 1][ef_x + c] = + pcjr->array[(chr & pcjr->array[1]) + 16] + 16; dat <<= 1; } } break; case 0x01: /*80 column text*/ for (x = 0; x < pcjr->crtc[1]; x++) { + int ef_x = (x << 3) + ho_d; chr = pcjr->vram[((pcjr->ma << 1) & mask) + offset]; attr = pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; drawcursor = ((pcjr->ma == ca) && pcjr->con && pcjr->cursoron); @@ -377,26 +513,26 @@ vid_poll(void *priv) cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16] + 16; cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16; } - if (pcjr->sc & 8) { + if (pcjr->sc & 8) + for (uint8_t c = 0; c < 8; c++) + buffer32->line[l][ef_x + c] = + buffer32->line[l + 1][ef_x + c] = cols[0]; + else + for (uint8_t c = 0; c < 8; c++) + buffer32->line[l][ef_x + c] = + buffer32->line[l + 1][ef_x + c] = + cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; + if (drawcursor) for (uint8_t c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[0]; + buffer32->line[l][ef_x + c] ^= 15; + buffer32->line[l + 1][ef_x + c] ^= 15; } - } else { - for (uint8_t c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; - } - } - if (drawcursor) { - for (uint8_t c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 3) + c + 8] ^= 15; - buffer32->line[(pcjr->displine << 1) + 1][(x << 3) + c + 8] ^= 15; - } - } pcjr->ma++; } break; case 0x00: /*40 column text*/ for (x = 0; x < pcjr->crtc[1]; x++) { + int ef_x = (x << 4) + ho_d; chr = pcjr->vram[((pcjr->ma << 1) & mask) + offset]; attr = pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; drawcursor = ((pcjr->ma == ca) && pcjr->con && pcjr->cursoron); @@ -410,21 +546,24 @@ vid_poll(void *priv) cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16; } pcjr->ma++; - if (pcjr->sc & 8) { - for (uint8_t c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[0]; - } - } else { - for (uint8_t c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; - } - } - if (drawcursor) { + if (pcjr->sc & 8) + for (uint8_t c = 0; c < 8; c++) + buffer32->line[l][ef_x + (c << 1)] = + buffer32->line[l][ef_x + (c << 1) + 1] = + buffer32->line[l + 1][ef_x + (c << 1)] = + buffer32->line[l + 1][ef_x + (c << 1) + 1] = cols[0]; + else + for (uint8_t c = 0; c < 8; c++) + buffer32->line[l][ef_x + (c << 1)] = + buffer32->line[l][ef_x + (c << 1) + 1] = + buffer32->line[l + 1][ef_x + (c << 1)] = + buffer32->line[l + 1][ef_x + (c << 1) + 1] = + cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0]; + if (drawcursor) for (uint8_t c = 0; c < 16; c++) { - buffer32->line[pcjr->displine << 1][(x << 4) + c + 8] ^= 15; - buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] ^= 15; + buffer32->line[l][ef_x + c] ^= 15; + buffer32->line[l + 1][ef_x + c] ^= 15; } - } } break; case 0x02: /*320x200x4*/ @@ -433,10 +572,15 @@ vid_poll(void *priv) cols[2] = pcjr->array[2 + 16] + 16; cols[3] = pcjr->array[3 + 16] + 16; for (x = 0; x < pcjr->crtc[1]; x++) { - dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; + int ef_x = (x << 4) + ho_d; + dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | + pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; for (uint8_t c = 0; c < 8; c++) { - buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[pcjr->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14]; + buffer32->line[l][ef_x + (c << 1)] = + buffer32->line[l][ef_x + (c << 1) + 1] = + buffer32->line[l + 1][ef_x + (c << 1)] = + buffer32->line[l + 1][ef_x + (c << 1) + 1] = cols[dat >> 14]; dat <<= 2; } } @@ -445,10 +589,13 @@ vid_poll(void *priv) cols[0] = pcjr->array[0 + 16] + 16; cols[1] = pcjr->array[1 + 16] + 16; for (x = 0; x < pcjr->crtc[1]; x++) { - dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; + int ef_x = (x << 4) + ho_d; + dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) | + pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1]; pcjr->ma++; for (uint8_t c = 0; c < 16; c++) { - buffer32->line[pcjr->displine << 1][(x << 4) + c + 8] = buffer32->line[(pcjr->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15]; + buffer32->line[l][ef_x + c] = buffer32->line[l + 1][ef_x + c] = + cols[dat >> 15]; dat <<= 1; } } @@ -460,33 +607,33 @@ vid_poll(void *priv) } else { if (pcjr->array[3] & 4) { if (pcjr->array[0] & 1) { - hline(buffer32, 0, (pcjr->displine << 1), (pcjr->crtc[1] << 3) + 16, (pcjr->array[2] & 0xf) + 16); - hline(buffer32, 0, (pcjr->displine << 1) + 1, (pcjr->crtc[1] << 3) + 16, (pcjr->array[2] & 0xf) + 16); + hline(buffer32, 0, l, (pcjr->crtc[1] << 3) + ho_s, (pcjr->array[2] & 0xf) + 16); + hline(buffer32, 0, l + 1, (pcjr->crtc[1] << 3) + ho_s, (pcjr->array[2] & 0xf) + 16); } else { - hline(buffer32, 0, (pcjr->displine << 1), (pcjr->crtc[1] << 4) + 16, (pcjr->array[2] & 0xf) + 16); - hline(buffer32, 0, (pcjr->displine << 1) + 1, (pcjr->crtc[1] << 4) + 16, (pcjr->array[2] & 0xf) + 16); + hline(buffer32, 0, l, (pcjr->crtc[1] << 4) + ho_s, (pcjr->array[2] & 0xf) + 16); + hline(buffer32, 0, l + 1, (pcjr->crtc[1] << 4) + ho_s, (pcjr->array[2] & 0xf) + 16); } } else { cols[0] = pcjr->array[0 + 16] + 16; if (pcjr->array[0] & 1) { - hline(buffer32, 0, (pcjr->displine << 1), (pcjr->crtc[1] << 3) + 16, cols[0]); - hline(buffer32, 0, (pcjr->displine << 1) + 1, (pcjr->crtc[1] << 3) + 16, cols[0]); + hline(buffer32, 0, l, (pcjr->crtc[1] << 3) + ho_s, cols[0]); + hline(buffer32, 0, l + 1, (pcjr->crtc[1] << 3) + ho_s, cols[0]); } else { - hline(buffer32, 0, (pcjr->displine << 1), (pcjr->crtc[1] << 4) + 16, cols[0]); - hline(buffer32, 0, (pcjr->displine << 1) + 1, (pcjr->crtc[1] << 4) + 16, cols[0]); + hline(buffer32, 0, l, (pcjr->crtc[1] << 4) + ho_s, cols[0]); + hline(buffer32, 0, l + 1, (pcjr->crtc[1] << 4) + ho_s, cols[0]); } } } if (pcjr->array[0] & 1) - x = (pcjr->crtc[1] << 3) + 16; + x = (pcjr->crtc[1] << 3) + ho_s; else - x = (pcjr->crtc[1] << 4) + 16; + x = (pcjr->crtc[1] << 4) + ho_s; if (pcjr->composite) { - Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[pcjr->displine << 1]); - Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[(pcjr->displine << 1) + 1]); + Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[l]); + Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[l + 1]); } else { - video_process_8(x, pcjr->displine << 1); - video_process_8(x, (pcjr->displine << 1) + 1); + video_process_8(x, l); + video_process_8(x, l + 1); } pcjr->sc = oldsc; if (pcjr->vc == pcjr->crtc[7] && !pcjr->sc) { @@ -547,37 +694,42 @@ vid_poll(void *priv) picint(1 << 5); if (pcjr->crtc[7]) { if (pcjr->array[0] & 1) - x = (pcjr->crtc[1] << 3) + 16; + x = (pcjr->crtc[1] << 3) + ho_s; else - x = (pcjr->crtc[1] << 4) + 16; + x = (pcjr->crtc[1] << 4) + ho_s; pcjr->lastline++; xs_temp = x; ys_temp = (pcjr->lastline - pcjr->firstline) << 1; if ((xs_temp > 0) && (ys_temp > 0)) { + int actual_ys = ys_temp; + if (xs_temp < 64) xs_temp = 656; if (ys_temp < 32) ys_temp = 400; if (!enable_overscan) - xs_temp -= 16; + xs_temp -= ho_s; if ((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)); + + set_screen_size(xsize, ysize + (enable_overscan ? 32 : 0)); if (video_force_resize_get()) video_force_resize_set(0); } + vid_blit_h_overscan(pcjr); + if (enable_overscan) { - video_blit_memtoscreen(0, (pcjr->firstline - 4) << 1, - xsize, ((pcjr->lastline - pcjr->firstline) + 8) << 1); + video_blit_memtoscreen(0, pcjr->firstline << 1, + xsize, actual_ys + 32); } else { - video_blit_memtoscreen(8, pcjr->firstline << 1, - xsize, (pcjr->lastline - pcjr->firstline) << 1); + video_blit_memtoscreen(ho_s / 2, (pcjr->firstline << 1) + 16, + xsize, actual_ys); } } @@ -838,6 +990,8 @@ machine_pcjr_init(UNUSED(const machine_t *model)) pcjr->memctrl &= ~0x24; display_type = machine_get_config_int("display_type"); pcjr->composite = (display_type != PCJR_RGB); + overscan_x = 256; + overscan_y = 32; pic_init_pcjr(); pit_common_init(0, pit_irq0_timer_pcjr, NULL);