1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-06-18 14:29:32 +00:00

hardware reorg

This commit is contained in:
Stephen Crane 2021-02-27 12:01:52 +00:00
parent 69f30e81a8
commit 55928d498a
27 changed files with 145 additions and 284 deletions

View File

@ -11,7 +11,6 @@
#endif
#include "memory.h"
#include "ps2drv.h"
#include "CPU.h"
#if defined(USE_SPIRAM)
@ -21,7 +20,11 @@ spiram sram(SPIRAM_SIZE);
#endif
Memory memory;
#if defined(USE_KBD)
#include "ps2drv.h"
PS2Driver ps2;
#endif
static CPU *_cpu;
@ -66,7 +69,10 @@ bool hardware_reset() {
void hardware_init(CPU &cpu) {
_cpu = &cpu;
memory.begin();
#if defined(USE_KBD)
ps2.begin(KBD_DATA, KBD_IRQ);
#endif
#if defined(TFT_BACKLIGHT)
pinMode(TFT_BACKLIGHT, OUTPUT);

View File

@ -1,22 +0,0 @@
// TFT display...
#undef USE_ESPI
#undef USE_UTFT
// PS/2 keyboard
#define KBD_DATA 34
#define KBD_IRQ 35
#define RAM_SIZE 0u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#undef USE_FS
#undef USE_SPIFFS
// sound: dac and pwm
#undef DAC_SOUND
#undef PWM_SOUND

View File

@ -1,32 +1,5 @@
// TFT display...
#define USE_ESPI
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS 5
//#define TFT_DC 2
//#define TFT_MOSI 23
//#define TFT_MISO -1
//#define TFT_SCLK 18
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD
// PS/2 keyboard
#define KBD_DATA 34
#define KBD_IRQ 35
#define RAM_SIZE 0x10000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#undef USE_FS
#define USE_SPIFFS
// sound: dac and pwm
#define DAC_SOUND 25
#define PWM_SOUND 25
#define PWM_DUTY 20 // 20/1024 -> volume
#include <hw/esp32/espi.h>
#include <hw/esp32/kbd.h>
#include <hw/esp32/dac.h>

5
hw/esp32-espi-spiffs.h Normal file
View File

@ -0,0 +1,5 @@
#define RAM_SIZE 0x10000u
#include <hw/esp32/espi.h>
#include <hw/esp32/kbd.h>
#include <hw/esp32/spiffs.h>

View File

@ -1,32 +1,4 @@
// TFT display...
#define USE_ESPI
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS 5
//#define TFT_DC 2
//#define TFT_MOSI 23
//#define TFT_MISO -1
//#define TFT_SCLK 18
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD
// PS/2 keyboard
#define KBD_DATA 34
#define KBD_IRQ 35
#define RAM_SIZE 0x10000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#undef USE_FS
#undef USE_SPIFFS
// sound: dac and pwm
#undef DAC_SOUND
#undef PWM_SOUND
#undef PWM_DUTY
#include <hw/esp32/espi.h>
#include <hw/esp32/kbd.h>

View File

@ -1,28 +1,4 @@
// TFT display...
#define USE_UTFT
#undef TFT_BACKLIGHT
#define TFT_MODEL ILI9325C
#define TFT_RS 32
#define TFT_WR 33
#define TFT_CS 27
#define TFT_RST 26
// PS/2 keyboard
#define KBD_DATA 34
#define KBD_IRQ 35
#define RAM_SIZE 0x10000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#undef USE_FS
#define USE_SPIFFS
// sound: dac and pwm
#define DAC_SOUND 25
#define PWM_SOUND 25
#define PWM_DUTY 20 // 20/1024 -> volume
#include <hw/esp32/utft.h>
#include <hw/esp32/kbd.h>

4
hw/esp32/dac.h Normal file
View File

@ -0,0 +1,4 @@
// sound: dac and pwm
#define DAC_SOUND 25
#define PWM_SOUND 25
#define PWM_DUTY 20 // 20/1024 -> volume

13
hw/esp32/espi.h Normal file
View File

@ -0,0 +1,13 @@
// TFT display...
#define USE_ESPI
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS 5
//#define TFT_DC 2
//#define TFT_MOSI 23
//#define TFT_MISO -1
//#define TFT_SCLK 18
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD

5
hw/esp32/kbd.h Normal file
View File

@ -0,0 +1,5 @@
// PS/2 keyboard
#define USE_KBD
#define KBD_DATA 34
#define KBD_IRQ 35

5
hw/esp32/spiffs.h Normal file
View File

@ -0,0 +1,5 @@
// "tape" storage...
#undef USE_SD
#undef USE_FS
#define USE_SPIFFS

9
hw/esp32/utft.h Normal file
View File

@ -0,0 +1,9 @@
// TFT display...
#define USE_UTFT
#undef TFT_BACKLIGHT
#define TFT_MODEL ILI9325C
#define TFT_RS 32
#define TFT_WR 33
#define TFT_CS 27
#define TFT_RST 26

View File

@ -1,34 +1,7 @@
// TFT display...
#define USE_ESPI
//must define these in Makefile (or platformio)
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS PIN_D8
//#define TFT_DC PIN_D1
//#define TFT_WIDTH 240
//#define TFT_HEIGHT 320
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD
// PS/2 keyboard
#define KBD_IRQ D3
#define KBD_DATA D4
#define RAM_SIZE 0x8000u
// SPI-RAM
#define USE_SPIRAM
#define SPIRAM_DEV SPI
#define SPIRAM_CS D0
#define SPIRAM_SIZE 0x8000u
// "tape" storage...
#undef USE_SD
#undef USE_SPIFFS
#define USE_FS
// sound
#define PWM_SOUND D2
#define PWM_DUTY 20 // 20/1024 -> volume
#define PWM_TOP 1024
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/spiram.h>
#include <hw/esp8266/fs.h>
#include <hw/esp8266/pwm.h>

View File

@ -1,32 +1,6 @@
// TFT display...
#define USE_ESPI
//must define these in Makefile (or platformio)
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS PIN_D8
//#define TFT_DC PIN_D1
//#define TFT_WIDTH 240
//#define TFT_HEIGHT 320
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD
// PS/2 keyboard
#define KBD_IRQ D3
#define KBD_DATA D4
#define RAM_SIZE 0x8000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#undef USE_SPIFFS
#define USE_FS
// sound
#define PWM_SOUND D2
#define PWM_DUTY 20 // 20/1024 -> volume
#define PWM_TOP 1024
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/fs.h>
#include <hw/esp8266/pwm.h>

View File

@ -1,33 +1,6 @@
// TFT display...
#define USE_ESPI
//must define these in Makefile (or platformio)
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS PIN_D8
//#define TFT_DC PIN_D1
//#define TFT_WIDTH 240
//#define TFT_HEIGHT 320
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD
// PS/2 keyboard
#define KBD_IRQ D3
#define KBD_DATA D4
#define RAM_SIZE 0x8000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#define USE_SD
#define SD_CS D0
#undef USE_SPIFFS
#undef USE_FS
// sound
#define PWM_SOUND D2
#define PWM_DUTY 20 // 20/1024 -> volume
#define PWM_TOP 1024
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/sd.h>
#include <hw/esp8266/pwm.h>

View File

@ -1,34 +1,6 @@
// TFT display...
#define USE_ESPI
//must define these in Makefile (or platformio)
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS PIN_D8
//#define TFT_DC PIN_D1
//#define TFT_WIDTH 240
//#define TFT_HEIGHT 320
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD
// PS/2 keyboard
#define KBD_IRQ D3
#define KBD_DATA D4
#define NO_CHECKPOINT 1
#define RAM_SIZE 0x8000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#undef USE_SPIFFS
#undef USE_FS
// sound
#define PWM_SOUND D2
#define PWM_DUTY 20 // 20/1024 -> volume
#define PWM_TOP 1024
#define NO_CHECKPOINT 1
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/pwm.h>

12
hw/esp8266/espi.h Normal file
View File

@ -0,0 +1,12 @@
// TFT display...
#define USE_ESPI
//must define these in Makefile (or platformio)
//#define USER_SETUP_LOADED
//#define ILI9341_DRIVER
//#define TFT_CS PIN_D8
//#define TFT_DC PIN_D1
//#define TFT_WIDTH 240
//#define TFT_HEIGHT 320
//#define TFT_RST -1
//#define SPI_FREQUENCY 40000000
//#define LOAD_GLCD

5
hw/esp8266/fs.h Normal file
View File

@ -0,0 +1,5 @@
// "tape" storage...
#undef USE_SD
#undef USE_SPIFFS
#define USE_FS

4
hw/esp8266/kbd.h Normal file
View File

@ -0,0 +1,4 @@
// PS/2 keyboard
#define USE_KBD
#define KBD_IRQ D3
#define KBD_DATA D4

4
hw/esp8266/pwm.h Normal file
View File

@ -0,0 +1,4 @@
// sound
#define PWM_SOUND D2
#define PWM_DUTY 20 // 20/1024 -> volume
#define PWM_TOP 1024

6
hw/esp8266/sd.h Normal file
View File

@ -0,0 +1,6 @@
// "tape" storage...
#define USE_SD
#define SD_CS D0
#undef USE_SPIFFS
#undef USE_FS

6
hw/esp8266/spiram.h Normal file
View File

@ -0,0 +1,6 @@
// SPI-RAM
#define USE_SPIRAM
#define SPIRAM_DEV SPI
#define SPIRAM_CS D0
#define SPIRAM_SIZE 0x8000u

View File

@ -1,31 +1,8 @@
// TFT display...
// NOTE: edit memorysaver.h to select the correct chip for your display!
// Daniel Rebollo's boosterpack
#define USE_UTFT
#define TFT_BACKLIGHT PD_6
#define TFT_MODEL SSD1289
#define TFT_RS PC_6
#define TFT_WR PC_5
#define TFT_CS PC_7
#define TFT_RST PC_4
// PS/2 keyboard
#define KBD_DATA PE_4
#define KBD_IRQ PE_5
#define RAM_SIZE 0x3000u
// SPI-RAM
#define USE_SPIRAM
#define SPIRAM_CS PE_0
#define SPIRAM_DEV SPI_for_SD
#define SPIRAM_MODULE 1
#define SPIRAM_CLKDIV 1
#define SPIRAM_SIZE 65536u
// "tape" storage...
#define USE_SD
#define SD_CS PF_3
#define SD_SPI 1
#define SPI_CS PF_3
#include <hw/lm4f/utft.h>
#include <hw/lm4f/kbd.h>
#include <hw/lm4f/spiram.h>
#include <hw/lm4f/sd.h>

View File

@ -1,25 +1,6 @@
// TFT display...
// NOTE: edit memorysaver.h to select the correct chip for your display!
// Daniel Rebollo's boosterpack
#define USE_UTFT
#define TFT_BACKLIGHT PD_6
#define TFT_MODEL SSD1289
#define TFT_RS PC_6
#define TFT_WR PC_5
#define TFT_CS PC_7
#define TFT_RST PC_4
// PS/2 keyboard
#define KBD_DATA PE_4
#define KBD_IRQ PE_5
#define RAM_SIZE 0x3000u
// SPI-RAM
#undef USE_SPIRAM
#define SPIRAM_SIZE 0u
// "tape" storage...
#undef USE_SD
#define SPI_CS PF_3
#include <hw/lm4f/utft.h>
#include <hw/lm4f/kbd.h>

4
hw/lm4f/kbd.h Normal file
View File

@ -0,0 +1,4 @@
// PS/2 keyboard
#define KBD_DATA PE_4
#define KBD_IRQ PE_5

5
hw/lm4f/sd.h Normal file
View File

@ -0,0 +1,5 @@
// "tape" storage...
#define USE_SD
#define SD_CS PF_3
#define SD_SPI 1

8
hw/lm4f/spiram.h Normal file
View File

@ -0,0 +1,8 @@
// SPI-RAM
#define USE_SPIRAM
#define SPIRAM_CS PE_0
#define SPIRAM_DEV SPI_for_SD
#define SPIRAM_MODULE 1
#define SPIRAM_CLKDIV 1
#define SPIRAM_SIZE 65536u

11
hw/lm4f/utft.h Normal file
View File

@ -0,0 +1,11 @@
// TFT display...
// NOTE: edit memorysaver.h to select the correct chip for your display!
// Daniel Rebollo's boosterpack
#define USE_UTFT
#define TFT_BACKLIGHT PD_6
#define TFT_MODEL SSD1289
#define TFT_RS PC_6
#define TFT_WR PC_5
#define TFT_CS PC_7
#define TFT_RST PC_4