From 04854d903c132ced10a58c19ec3e60dc4ae3335d Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Wed, 10 Jan 2018 20:36:44 -0600 Subject: [PATCH] Add aux memory field --- include/apple2.h | 9 +++++++++ include/apple2.mem.h | 7 +++++++ src/apple2.c | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/apple2.h b/include/apple2.h index e8a4697..c24eaae 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -124,6 +124,15 @@ typedef struct { */ vm_segment *ram2; + /* + * The Apple II may have an auxiliary RAM bank; this was possible by + * installing a card there. If you had the 80-column text card (and + * you likely did), then you got an extra kilobyte of RAM to work + * with; it was either used for the extra columns or you could take + * advantage of it for extra storage otherwise. + */ + vm_segment *aux; + /* * The screen wherein we shall render all of our graphics. */ diff --git a/include/apple2.mem.h b/include/apple2.mem.h index 8165be8..f89d2ac 100644 --- a/include/apple2.mem.h +++ b/include/apple2.mem.h @@ -39,6 +39,13 @@ */ #define APPLE2_RAM2_SIZE 0x1000 +/* + * At the highest point (with the IIe extended 80 column text card), you + * could have a whole other 64k of data in auxiliary memory. (Of which + * only 1k was needed for 80 columns!) + */ +#define APPLE2_AUX_SIZE 0x10000 + /* * This is the base address (or offset) for all bank-switched memory */ diff --git a/src/apple2.c b/src/apple2.c index f07876f..913d309 100644 --- a/src/apple2.c +++ b/src/apple2.c @@ -67,8 +67,9 @@ apple2_create(int width, int height) // Initliaze our system ROM and separate bank-switched block of RAM mach->rom = vm_segment_create(APPLE2_ROM_SIZE); mach->ram2 = vm_segment_create(APPLE2_RAM2_SIZE); - if (mach->rom == NULL || mach->ram2 == NULL) { - log_critical("Could not initialize ROM / RAM2!"); + mach->aux = vm_segment_create(APPLE2_AUX_SIZE); + if (mach->rom == NULL || mach->ram2 == NULL || mach->aux == NULL) { + log_critical("Could not initialize ROM / RAM2 / AUX!"); apple2_free(mach); return NULL; }