fix memory config

This commit is contained in:
Stephen Crane 2021-02-20 09:13:46 +00:00
parent 3aba408174
commit aab45329c6
4 changed files with 34 additions and 17 deletions

View File

@ -18,7 +18,7 @@ prom b(basic, sizeof(basic));
prom m(monitor, sizeof(monitor)); prom m(monitor, sizeof(monitor));
#endif #endif
ram pages[RAM_SIZE / 1024]; ram pages[RAM_PAGES];
//socket_filer files("apple1"); //socket_filer files("apple1");
flash_filer files(PROGRAMS); flash_filer files(PROGRAMS);
io io(files); io io(files);
@ -45,16 +45,25 @@ void reset() {
void setup() { void setup() {
#if defined(DEBUGGING) || defined(CPU_DEBUG) #if defined(DEBUGGING) || defined(CPU_DEBUG)
Serial.begin(TERMINAL_SPEED); Serial.begin(TERMINAL_SPEED);
Serial.println();
Serial.printf("RAM: %dkB at 0x0000", RAM_PAGES);
Serial.println();
#if defined(USE_SPIRAM)
Serial.printf("SpiRAM: %dkB at 0x%04x", SPIRAM_EXTENT * Memory::page_size / 1024, SPIRAM_BASE);
Serial.println();
#endif
#endif #endif
hardware_init(cpu); hardware_init(cpu);
for (unsigned i = 0; i < RAM_SIZE; i += 1024) for (unsigned i = 0; i < RAM_PAGES; i++)
memory.put(pages[i / 1024], i); memory.put(pages[i], i * ram::page_size);
#if defined(USE_SPIRAM) #if defined(USE_SPIRAM)
memory.put(sram, SPIRAM_BASE, SPIRAM_EXTENT); memory.put(sram, SPIRAM_BASE, SPIRAM_EXTENT);
#endif #endif
memory.put(io, 0xd000); memory.put(io, 0xd000);
#if defined(KRUSADER) #if defined(KRUSADER)
memory.put(k, 0xe000); memory.put(k, 0xe000);
#else #else

View File

@ -1,21 +1,22 @@
t ?= esp32 t ?= esp32
TERMINAL_SPEED := 115200
ifeq ($t, esp8266) ifeq ($t, esp8266)
BOARD := d1_mini BOARD := d1_mini
UPLOAD_SPEED := 921600 UPLOAD_SPEED := 921600
TERMINAL_SPEED := 115200
FS_DIR := programs FS_DIR := programs
FLASH_SIZE := 4M1M FLASH_SIZE := 4M1M
F_CPU := 80 F_CPU := 80
CPPFLAGS = -DUSER_SETUP_LOADED -DILI9341_DRIVER -DTFT_CS=PIN_D8 -DTFT_DC=PIN_D1 \ CPPFLAGS = -DUSER_SETUP_LOADED -DILI9341_DRIVER -DTFT_CS=PIN_D8 -DTFT_DC=PIN_D1 \
-DTFT_RST=-1 -DSPI_FREQUENCY=40000000 -DLOAD_GLCD \ -DTFT_RST=-1 -DSPI_FREQUENCY=40000000 -DLOAD_GLCD \
-DHARDWARE_H=\"hw/esp8266-pwm-fs.h\" -DTERMINAL_SPEED=$(TERMINAL_SPEED) -DHARDWARE_H=\"hw/esp8266-pwm-fs-23k256.h\" -DTERMINAL_SPEED=$(TERMINAL_SPEED) -DDEBUGGING=1
LIBRARIES := TFT_eSPI LIBRARIES := TFT_eSPI SpiRAM
endif endif
ifeq ($t, tivac) ifeq ($t, tivac)
BOARD := EK-LM4F120XL BOARD := EK-LM4F120XL
CPPFLAGS := -DDEBUGGING -DHARDWARE_H=\"hw/lm4f-utft-sd.h\" CPPFLAGS := -DDEBUGGING -DHARDWARE_H=\"hw/lm4f-utft-sd.h\" -DTERMINAL_SPEED=$(TERMINAL_SPEED)
LIBRARIES := UTFT SD SpiRAM LIBRARIES := UTFT SD SpiRAM
endif endif
@ -25,8 +26,8 @@ UPLOAD_SPEED := 921600
FS_DIR := programs FS_DIR := programs
CPPFLAGS = -DDEBUGGING -DCPU_DEBUG \ CPPFLAGS = -DDEBUGGING -DCPU_DEBUG \
-DUSER_SETUP_LOADED -DILI9341_DRIVER -DTFT_CS=5 -DTFT_DC=2 \ -DUSER_SETUP_LOADED -DILI9341_DRIVER -DTFT_CS=5 -DTFT_DC=2 \
-DTFT_RST=-1 -DTFT_WIDTH=240 -DTFT_HEIGHT=320 \ -DTFT_RST=-1 -DSPI_FREQUENCY=40000000 -DLOAD_GLCD \
-DSPI_FREQUENCY=40000000 -DLOAD_GLCD -DHARDWARE_H=\"hw/esp32-espi.h\" -DTERMINAL_SPEED=$(TERMINAL_SPEED)
LIBRARIES = TFT_eSPI FS SPIFFS LIBRARIES = TFT_eSPI FS SPIFFS
endif endif

View File

@ -1,6 +1,6 @@
Apple-1 Emulator Apple-1 Emulator
================ ================
- Emulates an Apple-1 with 32k of RAM - Emulates an Apple-1 with up to 52k of RAM
- See [napple1](https://github.com/nobuh/napple1), - See [napple1](https://github.com/nobuh/napple1),
[krusader](http://school.anhb.uwa.edu.au/personalpages/kwessen/apple1/Krusader.htm) [krusader](http://school.anhb.uwa.edu.au/personalpages/kwessen/apple1/Krusader.htm)
and more [software](http://www.willegal.net/appleii/apple1-software.htm) and more [software](http://www.willegal.net/appleii/apple1-software.htm)

View File

@ -1,12 +1,19 @@
#ifndef _CONFIG_H #ifndef __CONFIG_H__
#define _CONFIG_H #define __CONFIG_H__
#define RAM_TOP 0xd000u
#if (RAM_SIZE >= RAM_TOP)
#define RAM_PAGES (RAM_TOP / ram::page_size)
#elif defined(USE_SPIRAM)
#define RAM_PAGES (RAM_SIZE / ram::page_size)
#define SPIRAM_BASE RAM_SIZE
#define SPIRAM_EXTENT min(RAM_TOP - SPIRAM_BASE, SPIRAM_SIZE) / Memory::page_size
#if defined(USE_SPIRAM)
#define RAM_SIZE 0x3000
#define SPIRAM_BASE 0x3000
#define SPIRAM_EXTENT (20 * 1024 / 256)
#else #else
#define RAM_SIZE 0x8000 #define RAM_PAGES (RAM_SIZE / ram::page_size)
#endif #endif
#define CPU_INSTRUCTIONS 1000 #define CPU_INSTRUCTIONS 1000