From 5f8bb62648cb12142dea3f7b6585f131105f28b9 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Wed, 17 Feb 2021 14:49:40 +0000 Subject: [PATCH] add ram::page_size; sizes are unsigned --- hw/blank.h | 2 +- hw/esp32-espi-dac.h | 2 +- hw/esp32-utft-dac.h | 2 +- hw/esp8266-pwm-fs-23k256.h | 4 ++-- hw/esp8266-pwm-fs.h | 2 +- hw/esp8266-pwm-sd.h | 2 +- hw/esp8266-pwm.h | 2 +- hw/lm4f-utft-sd.h | 2 +- hw/lm4f-utft.h | 2 +- ram.h | 4 +++- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/blank.h b/hw/blank.h index 48557a4..0e58af1 100644 --- a/hw/blank.h +++ b/hw/blank.h @@ -6,7 +6,7 @@ #define KBD_DATA 34 #define KBD_IRQ 35 -#define RAM_SIZE 0 +#define RAM_SIZE 0u // SPI-RAM #undef USE_SPIRAM diff --git a/hw/esp32-espi-dac.h b/hw/esp32-espi-dac.h index 2299f52..c55a7d2 100644 --- a/hw/esp32-espi-dac.h +++ b/hw/esp32-espi-dac.h @@ -15,7 +15,7 @@ #define KBD_DATA 34 #define KBD_IRQ 35 -#define RAM_SIZE 65536 +#define RAM_SIZE 0x10000u // SPI-RAM #undef USE_SPIRAM diff --git a/hw/esp32-utft-dac.h b/hw/esp32-utft-dac.h index 8574bc6..6b101fe 100644 --- a/hw/esp32-utft-dac.h +++ b/hw/esp32-utft-dac.h @@ -11,7 +11,7 @@ #define KBD_DATA 34 #define KBD_IRQ 35 -#define RAM_SIZE 65536 +#define RAM_SIZE 0x10000u // SPI-RAM #undef USE_SPIRAM diff --git a/hw/esp8266-pwm-fs-23k256.h b/hw/esp8266-pwm-fs-23k256.h index ed6f3a6..8d0d0cb 100644 --- a/hw/esp8266-pwm-fs-23k256.h +++ b/hw/esp8266-pwm-fs-23k256.h @@ -15,13 +15,13 @@ #define KBD_DATA D3 #define KBD_IRQ D4 -#define RAM_SIZE 32768 +#define RAM_SIZE 0x8000u // SPI-RAM #define USE_SPIRAM #define SPIRAM_DEV SPI #define SPIRAM_CS D0 -#define SPIRAM_SIZE 32768 +#define SPIRAM_SIZE 0x8000u // "tape" storage... #undef USE_SD diff --git a/hw/esp8266-pwm-fs.h b/hw/esp8266-pwm-fs.h index df2691e..aafeef0 100644 --- a/hw/esp8266-pwm-fs.h +++ b/hw/esp8266-pwm-fs.h @@ -15,7 +15,7 @@ #define KBD_DATA D3 #define KBD_IRQ D4 -#define RAM_SIZE 32768 +#define RAM_SIZE 0x8000u // SPI-RAM #undef USE_SPIRAM diff --git a/hw/esp8266-pwm-sd.h b/hw/esp8266-pwm-sd.h index bcbc508..838ea84 100644 --- a/hw/esp8266-pwm-sd.h +++ b/hw/esp8266-pwm-sd.h @@ -15,7 +15,7 @@ #define KBD_DATA D3 #define KBD_IRQ D4 -#define RAM_SIZE 32768 +#define RAM_SIZE 0x8000u // SPI-RAM #undef USE_SPIRAM diff --git a/hw/esp8266-pwm.h b/hw/esp8266-pwm.h index b13810e..55fee6a 100644 --- a/hw/esp8266-pwm.h +++ b/hw/esp8266-pwm.h @@ -15,7 +15,7 @@ #define KBD_DATA D3 #define KBD_IRQ D4 -#define RAM_SIZE 32768 +#define RAM_SIZE 0x8000u // SPI-RAM #undef USE_SPIRAM diff --git a/hw/lm4f-utft-sd.h b/hw/lm4f-utft-sd.h index a9d7b39..5f0a204 100644 --- a/hw/lm4f-utft-sd.h +++ b/hw/lm4f-utft-sd.h @@ -13,7 +13,7 @@ #define KBD_DATA PE_4 #define KBD_IRQ PE_5 -#define RAM_SIZE 0x3000 +#define RAM_SIZE 0x3000u // SPI-RAM #define USE_SPIRAM diff --git a/hw/lm4f-utft.h b/hw/lm4f-utft.h index 565f2ac..03dded9 100644 --- a/hw/lm4f-utft.h +++ b/hw/lm4f-utft.h @@ -13,7 +13,7 @@ #define KBD_DATA PE_4 #define KBD_IRQ PE_5 -#define RAM_SIZE 0x3000 +#define RAM_SIZE 0x3000u // SPI-RAM #undef USE_SPIRAM diff --git a/ram.h b/ram.h index f88cc94..caf80bd 100644 --- a/ram.h +++ b/ram.h @@ -3,6 +3,8 @@ class ram: public Memory::Device { public: + static const unsigned page_size = 1024; + virtual void operator= (uint8_t c) { _mem[_acc] = c; } virtual operator uint8_t () { return _mem[_acc]; } @@ -14,6 +16,6 @@ public: ram (): Memory::Device(sizeof(_mem)) {} private: - uint8_t _mem[1024]; + uint8_t _mem[page_size]; }; #endif