From 8e61a3403b105b959097a467d57c955049a7f027 Mon Sep 17 00:00:00 2001 From: tudnai Date: Mon, 27 Apr 2020 08:15:36 -0700 Subject: [PATCH] Moving to a unified 64K expansion memory instead of small fragments --- A2Mac/ViewController.swift | 4 ++-- src/cpu/6502.h | 5 +++-- src/dev/mem/mmio.h | 14 +++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/A2Mac/ViewController.swift b/A2Mac/ViewController.swift index 993f6ca..7ef607e 100644 --- a/A2Mac/ViewController.swift +++ b/A2Mac/ViewController.swift @@ -158,8 +158,8 @@ class ViewController: NSViewController { // static var flashingSpace : Character = " " let ramBufferPointer = UnsafeRawBufferPointer(start: RAM, count: 64 * 1024) - let textBufferPointer = UnsafeRawBufferPointer(start: RAM + textBaseAddr, count: textBufferSize) - let textAuxBufferPointer = UnsafeRawBufferPointer(start: AUX_VID_RAM, count: textBufferSize * 2) + let textBufferPointer = UnsafeRawBufferPointer(start: RAM + textBaseAddr, count: textBufferSize * 2) + let textAuxBufferPointer = UnsafeRawBufferPointer(start: AUX + textBaseAddr, count: textBufferSize) static let textArraySize = textLines * (textCols + lineEndChars) + textCols * 2 diff --git a/src/cpu/6502.h b/src/cpu/6502.h index b461834..221ed28 100644 --- a/src/cpu/6502.h +++ b/src/cpu/6502.h @@ -110,8 +110,9 @@ extern videoMode_t videoMode; extern m6502_t m6502; -extern uint8_t * RAM; -extern uint8_t * AUX_VID_RAM; +extern uint8_t * const AUX; // Pointer to the auxiliary memory so we can use this from Swift +extern uint8_t * const RAM; +//extern uint8_t * AUX_VID_RAM; extern uint32_t * videoMemPtr; extern void hires_Update(void); diff --git a/src/dev/mem/mmio.h b/src/dev/mem/mmio.h index f0716a6..8c5f047 100644 --- a/src/dev/mem/mmio.h +++ b/src/dev/mem/mmio.h @@ -29,15 +29,15 @@ videoMode_t videoMode = { 1 }; // 40 col text, page 1 uint8_t Apple2_Dummy_Page[ 1 * PG ]; // Dummy Page for discarding data uint8_t Apple2_Dummy_RAM[ 4 * KB ]; // Dummy RAM for discarding data -uint8_t Apple2_512_AUX[ 2 * PG ] = {0}; // Auxiliary bank for page 0 and 1 -uint8_t Apple2_VID_AUX[ 2 * KB ] = {0}; // Auxiliary RAM for video page 2 uint8_t Apple2_12K_ROM[ 12 * KB ] = {0}; // ROM D0, D8, E0, E8, F0, F8 uint8_t Apple2_16K_ROM[ 16 * KB ] = {0}; // ROM C0, C8, D0, D8, E0, E8, F0, F8 uint8_t Apple2_16K_RAM[ 16 * KB ] = {0}; // 16K Memory Expansion Card +uint8_t Apple2_64K_AUX[ 64 * KB ] = {0}; // 64K Expansion Memory uint8_t Apple2_64K_RAM[ 64 * KB ] = {0}; // Main Memory -uint8_t * AUX_VID_RAM = Apple2_VID_AUX; // Pointer to Auxiliary Video Memory -uint8_t * RAM = Apple2_64K_RAM; // Pointer to the main memory so we can use this from Swift +//uint8_t * AUX_VID_RAM = Apple2_VID_AUX; // Pointer to Auxiliary Video Memory +uint8_t * const AUX = Apple2_64K_AUX; // Pointer to the auxiliary memory so we can use this from Swift +uint8_t * const RAM = Apple2_64K_RAM; // Pointer to the main memory so we can use this from Swift #define DEF_RAM_PAGE(mem,pg) \ @@ -371,7 +371,7 @@ void resetMemory() { MEMcfg.is80STORE = 0; // Aux Video Memory - memset( Apple2_VID_AUX, 0xFF | 0x80, sizeof(Apple2_VID_AUX) ); + memset( AUX, 0, sizeof(Apple2_64K_AUX) ); // 64K Main Memory Area memset( RAM, 0, sizeof(Apple2_64K_RAM) ); // 16K Memory Expansion @@ -384,8 +384,8 @@ void resetMemory() { void textPageSelect() { if ( MEMcfg.is80STORE && videoMode.page2 ) { - SWITCH_VIDEO_RAM( RAM_PG_RD_TBL, 0x04, Apple2_VID_AUX, 0x00) - SWITCH_VIDEO_RAM( RAM_PG_WR_TBL, 0x04, Apple2_VID_AUX, 0x00) + SWITCH_VIDEO_RAM( RAM_PG_RD_TBL, 0x04, Apple2_64K_AUX, 0x04) + SWITCH_VIDEO_RAM( RAM_PG_WR_TBL, 0x04, Apple2_64K_AUX, 0x04) } else { SWITCH_VIDEO_RAM( RAM_PG_RD_TBL, 0x04, Apple2_64K_RAM, 0x04)