diff --git a/src/machine/m_at.c b/src/machine/m_at.c index 95fb5d182..b35d40e6f 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -8,7 +8,7 @@ * * 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, * Miran Grca, @@ -87,7 +87,21 @@ machine_at_init(const machine_t *model) void 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); diff --git a/src/nvr.h b/src/nvr.h index 0a7c2d60c..7ede9b3ff 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.9 2018/09/15 + * Version: @(#)nvr.h 1.0.10 2018/10/06 * * Author: Fred N. van Kempen, , * David Hrdlička, @@ -92,6 +92,7 @@ extern const device_t at_nvr_old_device; 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; #endif diff --git a/src/nvr_at.c b/src/nvr_at.c index 41b79e6a8..d10620233 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.12 2018/09/15 + * Version: @(#)nvr_at.c 1.0.13 2018/10/06 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -286,9 +286,11 @@ typedef struct { int8_t stat; - uint8_t cent; - uint16_t addr; + uint8_t cent; + uint8_t def; + + uint8_t addr; int64_t ecount, rtctime; @@ -614,7 +616,8 @@ nvr_reset(nvr_t *nvr) { 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_MONTH] = 1; nvr->regs[RTC_YEAR] = RTC_BCD(80); @@ -663,11 +666,6 @@ nvr_at_init(const device_t *info) /* Allocate an NVR for this machine. */ nvr = (nvr_t *)malloc(sizeof(nvr_t)); 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)); memset(local, 0x00, sizeof(local_t)); @@ -675,6 +673,7 @@ nvr_at_init(const device_t *info) /* This is machine specific. */ nvr->size = machines[machine].nvrmask + 1; + local->def = 0x00; switch(info->local) { case 0: /* standard AT, no century register */ nvr->irq = 8; @@ -694,7 +693,15 @@ nvr_at_init(const device_t *info) case 3: /* Amstrad PC's */ nvr->irq = 1; local->cent = RTC_CENTURY_AT; + local->def = 0xff; break; + + case 4: /* IBM AT */ + nvr->irq = 8; + local->cent = RTC_CENTURY_AT; + local->def = 0xff; + break; + } /* Set up any local handlers here. */ @@ -768,3 +775,12 @@ const device_t amstrad_nvr_device = { 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 +};