Fixes to NVRAM initialization and the IBM AT's NVRAM now initializes with all 0xFF's.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Standard PC/AT implementation.
|
* Standard PC/AT implementation.
|
||||||
*
|
*
|
||||||
* Version: @(#)m_at.c 1.0.0 2018/09/02
|
* Version: @(#)m_at.c 1.0.10 2018/10/06
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -87,7 +87,21 @@ machine_at_init(const machine_t *model)
|
|||||||
void
|
void
|
||||||
machine_at_ibm_init(const machine_t *model)
|
machine_at_ibm_init(const machine_t *model)
|
||||||
{
|
{
|
||||||
machine_at_init(model);
|
machine_common_init(model);
|
||||||
|
|
||||||
|
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
|
||||||
|
pic2_init();
|
||||||
|
dma16_init();
|
||||||
|
|
||||||
|
if (lpt_enabled)
|
||||||
|
lpt2_remove();
|
||||||
|
|
||||||
|
device_add(&ibmat_nvr_device);
|
||||||
|
|
||||||
|
if (joystick_type != 7)
|
||||||
|
device_add(&gameport_device);
|
||||||
|
|
||||||
|
device_add(&keyboard_at_device);
|
||||||
|
|
||||||
mem_remap_top(384);
|
mem_remap_top(384);
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the generic NVRAM/CMOS driver.
|
* Definitions for the generic NVRAM/CMOS driver.
|
||||||
*
|
*
|
||||||
* Version: @(#)nvr.h 1.0.9 2018/09/15
|
* Version: @(#)nvr.h 1.0.10 2018/10/06
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>,
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>,
|
||||||
* David Hrdlička, <hrdlickadavid@outlook.com>
|
* David Hrdlička, <hrdlickadavid@outlook.com>
|
||||||
@@ -92,6 +92,7 @@ extern const device_t at_nvr_old_device;
|
|||||||
extern const device_t at_nvr_device;
|
extern const device_t at_nvr_device;
|
||||||
extern const device_t ps_nvr_device;
|
extern const device_t ps_nvr_device;
|
||||||
extern const device_t amstrad_nvr_device;
|
extern const device_t amstrad_nvr_device;
|
||||||
|
extern const device_t ibmat_nvr_device;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
34
src/nvr_at.c
34
src/nvr_at.c
@@ -189,7 +189,7 @@
|
|||||||
* including the later update (DS12887A) which implemented a
|
* including the later update (DS12887A) which implemented a
|
||||||
* "century" register to be compatible with Y2K.
|
* "century" register to be compatible with Y2K.
|
||||||
*
|
*
|
||||||
* Version: @(#)nvr_at.c 1.0.12 2018/09/15
|
* Version: @(#)nvr_at.c 1.0.13 2018/10/06
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -286,9 +286,11 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t stat;
|
int8_t stat;
|
||||||
uint8_t cent;
|
|
||||||
|
|
||||||
uint16_t addr;
|
uint8_t cent;
|
||||||
|
uint8_t def;
|
||||||
|
|
||||||
|
uint8_t addr;
|
||||||
|
|
||||||
int64_t ecount,
|
int64_t ecount,
|
||||||
rtctime;
|
rtctime;
|
||||||
@@ -614,7 +616,8 @@ nvr_reset(nvr_t *nvr)
|
|||||||
{
|
{
|
||||||
local_t *local = (local_t *)nvr->data;
|
local_t *local = (local_t *)nvr->data;
|
||||||
|
|
||||||
memset(nvr->regs, 0x00, RTC_REGS);
|
/* memset(nvr->regs, local->def, RTC_REGS); */
|
||||||
|
memset(nvr->regs, local->def, nvr->size);
|
||||||
nvr->regs[RTC_DOM] = 1;
|
nvr->regs[RTC_DOM] = 1;
|
||||||
nvr->regs[RTC_MONTH] = 1;
|
nvr->regs[RTC_MONTH] = 1;
|
||||||
nvr->regs[RTC_YEAR] = RTC_BCD(80);
|
nvr->regs[RTC_YEAR] = RTC_BCD(80);
|
||||||
@@ -663,11 +666,6 @@ nvr_at_init(const device_t *info)
|
|||||||
/* Allocate an NVR for this machine. */
|
/* Allocate an NVR for this machine. */
|
||||||
nvr = (nvr_t *)malloc(sizeof(nvr_t));
|
nvr = (nvr_t *)malloc(sizeof(nvr_t));
|
||||||
if (nvr == NULL) return(NULL);
|
if (nvr == NULL) return(NULL);
|
||||||
/* FIXME: See which is correct, this or 0xFF. */
|
|
||||||
if (info->local == 0)
|
|
||||||
memset(nvr, 0xff, sizeof(nvr_t));
|
|
||||||
else
|
|
||||||
memset(nvr, 0x00, sizeof(nvr_t));
|
|
||||||
|
|
||||||
local = (local_t *)malloc(sizeof(local_t));
|
local = (local_t *)malloc(sizeof(local_t));
|
||||||
memset(local, 0x00, sizeof(local_t));
|
memset(local, 0x00, sizeof(local_t));
|
||||||
@@ -675,6 +673,7 @@ nvr_at_init(const device_t *info)
|
|||||||
|
|
||||||
/* This is machine specific. */
|
/* This is machine specific. */
|
||||||
nvr->size = machines[machine].nvrmask + 1;
|
nvr->size = machines[machine].nvrmask + 1;
|
||||||
|
local->def = 0x00;
|
||||||
switch(info->local) {
|
switch(info->local) {
|
||||||
case 0: /* standard AT, no century register */
|
case 0: /* standard AT, no century register */
|
||||||
nvr->irq = 8;
|
nvr->irq = 8;
|
||||||
@@ -694,7 +693,15 @@ nvr_at_init(const device_t *info)
|
|||||||
case 3: /* Amstrad PC's */
|
case 3: /* Amstrad PC's */
|
||||||
nvr->irq = 1;
|
nvr->irq = 1;
|
||||||
local->cent = RTC_CENTURY_AT;
|
local->cent = RTC_CENTURY_AT;
|
||||||
|
local->def = 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 4: /* IBM AT */
|
||||||
|
nvr->irq = 8;
|
||||||
|
local->cent = RTC_CENTURY_AT;
|
||||||
|
local->def = 0xff;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up any local handlers here. */
|
/* Set up any local handlers here. */
|
||||||
@@ -768,3 +775,12 @@ const device_t amstrad_nvr_device = {
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const device_t ibmat_nvr_device = {
|
||||||
|
"IBM AT NVRAM",
|
||||||
|
DEVICE_ISA | DEVICE_AT,
|
||||||
|
4,
|
||||||
|
nvr_at_init, nvr_at_close, NULL,
|
||||||
|
NULL, NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user