diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c
index 01566bc14..b82c92fdf 100644
--- a/src/machine/m_at_386dx_486.c
+++ b/src/machine/m_at_386dx_486.c
@@ -8,7 +8,7 @@
*
* Implementation of 386DX and 486 machines.
*
- * Version: @(#)m_at_386dx_486.c 1.0.1 2020/01/19
+ * Version: @(#)m_at_386dx_486.c 1.0.2 2020/01/20
*
* Authors: Sarah Walker,
* Miran Grca,
@@ -30,6 +30,7 @@
#include "../chipset/chipset.h"
#include "../keyboard.h"
#include "../mem.h"
+#include "../nvr.h"
#include "../pci.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
@@ -269,8 +270,6 @@ machine_at_win471_init(const machine_t *model)
static void
machine_at_sis_85c496_common_init(const machine_t *model)
{
- machine_at_common_init(model);
-
device_add(&ide_pci_device);
pci_init(PCI_CONFIG_TYPE_1);
@@ -278,8 +277,6 @@ machine_at_sis_85c496_common_init(const machine_t *model)
pci_register_slot(0x0B, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0D, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2);
- pci_register_slot(0x07, PCI_CARD_NORMAL, 4, 1, 2, 3);
- device_add(&keyboard_ps2_pci_device);
pci_set_irq_routing(PCI_INTA, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTB, PCI_IRQ_DISABLED);
@@ -301,9 +298,37 @@ machine_at_r418_init(const machine_t *model)
if (bios_only || !ret)
return ret;
+ machine_at_common_init(model);
+
machine_at_sis_85c496_common_init(model);
+ pci_register_slot(0x07, PCI_CARD_NORMAL, 4, 1, 2, 3);
device_add(&fdc37c665_device);
+ device_add(&keyboard_ps2_pci_device);
+
+ return ret;
+}
+
+
+int
+machine_at_ls486e_init(const machine_t *model)
+{
+ int ret;
+
+ ret = bios_load_linear(L"roms/machines/ls486e/LS486E RevC.BIN",
+ 0x000e0000, 131072, 0);
+
+ if (bios_only || !ret)
+ return ret;
+
+ machine_at_common_init_ex(model, 2);
+ device_add(&ls486e_nvr_device);
+
+ machine_at_sis_85c496_common_init(model);
+ pci_register_slot(0x06, PCI_CARD_NORMAL, 4, 1, 2, 3);
+
+ device_add(&fdc37c665_device);
+ device_add(&keyboard_ps2_ami_pci_device);
return ret;
}
diff --git a/src/machine/machine.h b/src/machine/machine.h
index 474d97738..53353f7cc 100644
--- a/src/machine/machine.h
+++ b/src/machine/machine.h
@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
- * Version: @(#)machine.h 1.0.35 2020/01/13
+ * Version: @(#)machine.h 1.0.36 2020/01/20
*
* Authors: Sarah Walker,
* Miran Grca,
@@ -225,6 +225,7 @@ extern int machine_at_px471_init(const machine_t *);
extern int machine_at_win471_init(const machine_t *);
extern int machine_at_r418_init(const machine_t *);
+extern int machine_at_ls486e_init(const machine_t *);
extern int machine_at_alfredo_init(const machine_t *);
/* m_at_commodore.c */
diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c
index 382c58d95..dcb2b0754 100644
--- a/src/machine/machine_table.c
+++ b/src/machine/machine_table.c
@@ -11,7 +11,7 @@
* NOTES: OpenAT wip for 286-class machine with open BIOS.
* PS2_M80-486 wip, pending receipt of TRM's for machine.
*
- * Version: @(#)machine_table.c 1.0.52 2020/01/19
+ * Version: @(#)machine_table.c 1.0.53 2020/01/20
*
* Authors: Sarah Walker,
* Miran Grca,
@@ -170,6 +170,7 @@ const machine_t machines[] = {
#endif
{ "[486 PCI] Intel Classic/PCI", "alfredo", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 2, 128, 2, 127, machine_at_alfredo_init, NULL },
+ { "[486 PCI] Lucky Star LS-486E", "ls486e", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 255, 1, 127, machine_at_ls486e_init, NULL },
{ "[486 PCI] Rise Computer R418", "r418", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 255, 1, 127, machine_at_r418_init, NULL },
{ "[Socket 4 LX] Intel Premiere/PCI", "revenge", {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 2, 128, 2, 127, machine_at_batman_init, NULL },
diff --git a/src/machine/machine_table_new.c b/src/machine/machine_table_new.c
index ffe3a5c28..fffc0ad9f 100644
--- a/src/machine/machine_table_new.c
+++ b/src/machine/machine_table_new.c
@@ -11,7 +11,7 @@
* NOTES: OpenAT wip for 286-class machine with open BIOS.
* PS2_M80-486 wip, pending receipt of TRM's for machine.
*
- * Version: @(#)machine_table.c 1.0.52 2020/01/19
+ * Version: @(#)machine_table.c 1.0.53 2020/01/20
*
* Authors: Sarah Walker,
* Miran Grca,
@@ -155,6 +155,7 @@ const machine_t machines[] = {
#endif
{ "[486 PCI] Intel Classic/PCI", "alfredo", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 2, 128, 2, 127, machine_at_alfredo_init, NULL },
+ { "[486 PCI] Lucky Star LS-486E", "ls486e", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 255, 1, 127, machine_at_ls486e_init, NULL },
{ "[486 PCI] Rise Computer R418", "r418", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 255, 1, 127, machine_at_r418_init, NULL },
{ "[Socket 4 LX] Intel Premiere/PCI", "revenge", {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 2, 128, 2, 127, machine_at_batman_init, NULL },
diff --git a/src/nvr.h b/src/nvr.h
index 7929ce642..85d54082a 100644
--- a/src/nvr.h
+++ b/src/nvr.h
@@ -8,7 +8,7 @@
*
* Definitions for the generic NVRAM/CMOS driver.
*
- * Version: @(#)nvr.h 1.0.12 2020/01/13
+ * Version: @(#)nvr.h 1.0.13 2020/01/20
*
* Author: Fred N. van Kempen, ,
* David Hrdlička,
@@ -91,6 +91,7 @@ extern const device_t at_nvr_device;
extern const device_t ps_nvr_device;
extern const device_t amstrad_nvr_device;
extern const device_t ibmat_nvr_device;
+extern const device_t ls486e_nvr_device;
extern const device_t via_nvr_device;
#endif
diff --git a/src/nvr_at.c b/src/nvr_at.c
index d4b1cfde1..d9a9c692f 100644
--- a/src/nvr_at.c
+++ b/src/nvr_at.c
@@ -189,7 +189,7 @@
* including the later update (DS12887A) which implemented a
* "century" register to be compatible with Y2K.
*
- * Version: @(#)nvr_at.c 1.0.17 2020/01/13
+ * Version: @(#)nvr_at.c 1.0.18 2020/01/20
*
* Authors: Fred N. van Kempen,
* Miran Grca,
@@ -291,7 +291,7 @@ typedef struct {
int8_t stat;
uint8_t cent;
- uint8_t def;
+ uint8_t def, ls_hack;
uint8_t addr[8];
@@ -553,8 +553,9 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
nvr_t *nvr = (nvr_t *)priv;
local_t *local = (local_t *)nvr->data;
struct tm tm;
- uint8_t old;
+ uint8_t old, i;
uint8_t addr_id = (addr & 0x0e) >> 1;
+ uint16_t checksum = 0x0000;
sub_cycles(ISA_CYCLES(8));
@@ -579,6 +580,18 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
case RTC_REGD: /* R/O */
break;
+ case 0x2e:
+ case 0x2f:
+ if (local->ls_hack) {
+ /* 2E and 2F are a simple sum of the values of 0E to 2D. */
+ for (i = 0x0e; i < 0x2e; i++)
+ checksum += (uint16_t) nvr->regs[i];
+ nvr->regs[0x2e] = checksum >> 8;
+ nvr->regs[0x2f] = checksum & 0xff;
+ break;
+ }
+ /*FALLTHROUGH*/
+
default: /* non-RTC registers are just NVRAM */
if (nvr->regs[local->addr[addr_id]] != val) {
nvr->regs[local->addr[addr_id]] = val;
@@ -617,6 +630,7 @@ nvr_read(uint16_t addr, void *priv)
local_t *local = (local_t *)nvr->data;
uint8_t ret;
uint8_t addr_id = (addr & 0x0e) >> 1;
+ uint16_t checksum;
sub_cycles(ISA_CYCLES(8));
@@ -636,6 +650,27 @@ nvr_read(uint16_t addr, void *priv)
ret = nvr->regs[RTC_REGD];
break;
+ case 0x2c:
+ if (local->ls_hack)
+ ret = nvr->regs[local->addr[addr_id]] & 0x7f;
+ else
+ ret = nvr->regs[local->addr[addr_id]];
+ break;
+
+ case 0x2e:
+ case 0x2f:
+ if (local->ls_hack) {
+ checksum = (nvr->regs[0x2e] << 8) | nvr->regs[0x2f];
+ if (nvr->regs[0x2c] & 0x80)
+ checksum -= 0x80;
+ if (local->addr[addr_id] == 0x2e)
+ ret = checksum >> 8;
+ else
+ ret = checksum & 0xff;
+ } else
+ ret = nvr->regs[local->addr[addr_id]];
+ break;
+
default:
ret = nvr->regs[local->addr[addr_id]];
break;
@@ -742,12 +777,17 @@ nvr_at_init(const device_t *info)
/* This is machine specific. */
nvr->size = machines[machine].nvrmask + 1;
local->def = 0x00;
+ local->ls_hack = 0;
switch(info->local & 7) {
case 0: /* standard AT, no century register */
nvr->irq = 8;
local->cent = 0xff;
break;
+ case 5: /* Lucky Star LS-486E */
+ local->ls_hack = 1;
+ /*FALLTHROUGH*/
+
case 1: /* standard AT */
nvr->irq = 8;
local->cent = RTC_CENTURY_AT;
@@ -770,7 +810,7 @@ nvr_at_init(const device_t *info)
local->def = 0xff;
break;
- case 5: /* VIA VT82C586B */
+ case 6: /* VIA VT82C586B */
nvr->irq = 8;
local->cent = RTC_CENTURY_VIA;
break;
@@ -870,12 +910,20 @@ const device_t ibmat_nvr_device = {
NULL
};
-const device_t via_nvr_device = {
- "VIA PC/AT NVRAM",
+const device_t ls486e_nvr_device = {
+ "Lucky Star LS-486E PC/AT NVRAM",
DEVICE_ISA | DEVICE_AT,
- 9,
+ 13,
nvr_at_init, nvr_at_close, NULL,
NULL, nvr_at_speed_changed,
NULL
};
+const device_t via_nvr_device = {
+ "VIA PC/AT NVRAM",
+ DEVICE_ISA | DEVICE_AT,
+ 14,
+ nvr_at_init, nvr_at_close, NULL,
+ NULL, nvr_at_speed_changed,
+ NULL
+};