Arduino build (#19)

* changes for Arduino build

* update
This commit is contained in:
Stephen Crane 2023-07-27 15:09:05 +01:00 committed by GitHub
parent 628a507fe8
commit 393cc190e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 169 additions and 181 deletions

View File

@ -3,21 +3,53 @@ r65emu
Arduino emulation library for 8-bit microcomputers based on 6502, i8080 and z80.
Sample Applications:
--------------------
- [Apple1](https://github.com/jscrane/Apple1)
- [CPM80](https://github.com/jscrane/cpm80)
- [Space Invaders](https://github.com/jscrane/invaders)
- [Pacman](https://github.com/jscrane/pacman)
- [Commodore PET](https://github.com/jscrane/PET)
- [Compukit UK101](https://github.com/jscrane/UK101)
Configuration:
--------------
If building using the Arduino IDE, `r65emu/hw/user.h` must be configured correctly.
Currently the only mass-produced board which is supported is the
[LilyGO TTGO](https://www.tinytronics.nl/shop/en/development-boards/microcontroller-boards/with-wi-fi/lilygo-ttgo-vga32-esp32).
Examples are also given for a generic `node32s` board and a homebrew `esp8bit` board.
Copy your configuration file to `user.h`. If the board is also mass-produced, please open a PR to add the new file to the library.
Libraries:
---------
- [My port](https://github.com/jscrane/UTFT-Energia)
of Henning Karlsen's [UTFT library](http://henningkarlsen.com/electronics/library.php?id=52),
- [Rei Vilo's port](https://github.com/rei-vilo/SD_TM4C) of
Adafruit/Sparkfun's [SD library](https://github.com/adafruit/SD),
- [My port](https://github.com/jscrane/SpiRAM)
of Phil Stewart's [SpiRAM library](http://playground.arduino.cc/Main/SpiRAM)
Display:
--------
Depending on target board, one of:
- [My port](https://github.com/jscrane/UTFT-Energia) of Henning Karlsen's [UTFT library](http://www.rinkydinkelectronics.com/library.php?id=51)
- [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI)
- [FabGL](https://github.com/fdivitto/FabGL)
Storage:
--------
These are optional if the target board supports it (e.g., esp8266 or esp32 boards):
- [Rei Vilo's port](https://github.com/rei-vilo/SD_TM4C) of Adafruit/Sparkfun's [SD library](https://github.com/adafruit/SD),
- [My port](https://github.com/jscrane/SpiRAM) of Phil Stewart's [SpiRAM library](http://playground.arduino.cc/Main/SpiRAM)
Input:
------
- [PS2Keyboard](https://github.com/jscrane/PS2Keyboard)
Hardware:
---------
- A [Stellaris Launchpad](http://www.energia.nu/Guide_StellarisLaunchPad.html) _or_ ESP8266 board, e.g., [WeMOS](https://www.wemos.cc/en/latest/d1/d1_mini.html), _or_ ESP32-based board, e.g., [Node32s](https://www.esp32.com/viewtopic.php?t=459),
- A [Stellaris Launchpad](http://www.energia.nu/Guide_StellarisLaunchPad.html) _or_
ESP8266 board, e.g., [WeMOS](https://www.wemos.cc/en/latest/d1/d1_mini.html), _or_
ESP32-based board, e.g., [Node32s](https://www.esp32.com/viewtopic.php?t=459),
- An SD drive to store programs (for Stellarpad),
- A 23k256 SPI RAM chip (for Stellarpad, optional),
- A supported TFT screen, such as [this one](http://forum.stellarisiti.com/topic/626-ssd1289-32-320x240-tft-16bit-parallel-interface-touch-libraries/),
- A PS/2 keyboard.
See _hardware.h_ for wiring details and other options.

View File

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

View File

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

View File

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

View File

@ -1,4 +0,0 @@
#define RAM_SIZE 0x10000u
#include <hw/esp32/utft.h>
#include <hw/esp32/kbd.h>

View File

@ -1,3 +0,0 @@
// sound: dac and pwm
#define DAC_SOUND 25
#define PWM_SOUND 25

View File

@ -1,13 +0,0 @@
// 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

View File

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

View File

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

View File

@ -1,9 +0,0 @@
// 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,7 +0,0 @@
#define RAM_SIZE 0x8000u
#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,6 +0,0 @@
#define RAM_SIZE 0x8000u
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/fs.h>
#include <hw/esp8266/pwm.h>

View File

@ -1,6 +0,0 @@
#define RAM_SIZE 0x8000u
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/sd.h>
#include <hw/esp8266/pwm.h>

View File

@ -1,6 +0,0 @@
#define NO_CHECKPOINT 1
#define RAM_SIZE 0x8000u
#include <hw/esp8266/espi.h>
#include <hw/esp8266/kbd.h>
#include <hw/esp8266/pwm.h>

View File

@ -1,12 +0,0 @@
// 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

View File

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

View File

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

View File

@ -1,3 +0,0 @@
// sound
#define PWM_SOUND D2
#define PWM_TOP 1024

View File

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

View File

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

40
hw/esp8bit.h Normal file
View File

@ -0,0 +1,40 @@
// Homebrew esp8bit board based on WeMOS D1-Mini
// https://github.com/jscrane/esp8bit
#define RAM_SIZE 0x8000u
// 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 USE_KBD
#define KBD_IRQ D3
#define KBD_DATA D4
// SPI-RAM
#define USE_SPIRAM
#define SPIRAM_DEV SPI
#define SPIRAM_CS D0
#define SPIRAM_SIZE 0x8000u
// "tape" storage...
#undef USE_SD
//#define SD_CS D0
#undef USE_SPIFFS
#undef USE_FS
#undef USE_SPIFFS
#define USE_FS
// sound
#define PWM_SOUND D2

View File

@ -1,8 +0,0 @@
#define RAM_SIZE 0x3000u
#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,6 +0,0 @@
#define RAM_SIZE 0x3000u
#define SPI_CS PF_3
#include <hw/lm4f/utft.h>
#include <hw/lm4f/kbd.h>

View File

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

View File

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

View File

@ -1,8 +0,0 @@
// 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

View File

@ -1,11 +0,0 @@
// 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

38
hw/node32s-example.h Normal file
View File

@ -0,0 +1,38 @@
#define RAM_SIZE 0x10000u
// TFT display...
#define USE_ESPI
// must be configured in uC-Makefile, or platformio, or TFT_eSPI's User_Setup.h
//#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
// use alternative TFT display library...
//#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 USE_KBD
#define KBD_DATA 34
#define KBD_IRQ 35
// "tape" storage...
#undef USE_SD
#undef USE_FS
#define USE_SPIFFS
// sound: dac and pwm
#define DAC_SOUND 25
#define PWM_SOUND 25

34
hw/stellarpad-example.h Normal file
View File

@ -0,0 +1,34 @@
// Stellaris Launchpad example
#define RAM_SIZE 0x3000u
// PS/2 keyboard
#define USE_KBD
#define KBD_DATA PE_4
#define KBD_IRQ PE_5
// "tape" storage...
#define USE_SD
#define SD_CS PF_3
#define SD_SPI 1
// 23k256 SPI-RAM
#define USE_SPIRAM
#define SPI_CS PF_3
#define SPIRAM_CS PE_0
#define SPIRAM_DEV SPI_for_SD
#define SPIRAM_MODULE 1
#define SPIRAM_CLKDIV 1
#define SPIRAM_SIZE 0x8000u
// 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

View File

@ -1,14 +1,18 @@
// LilyGO TTGO VGA32
// https://www.tinytronics.nl/shop/en/development-boards/microcontroller-boards/with-wi-fi/lilygo-ttgo-vga32-esp32
// Display
#define USE_VGA
// PS/2 Keyboard
#define USE_KBD
#define KBD_DATA 32
#define KBD_IRQ 33
// 64kB RAM
#define RAM_SIZE 0x10000u
// sound: dac and pwm
// Sound: dac and pwm
#define DAC_SOUND 25
#define PWM_SOUND 25

View File

@ -1,17 +1,3 @@
// user-configured hardware description
#if defined(ESP32)
// #include <hw/esp32-espi.h>
// #include <hw/esp32-espi-dac.h>
// #include <hw/esp32-espi-spiffs.h>
#elif defined(ESP8266)
// #include <hw/esp8266-pwm.h>
// #include <hw/esp8266-pwm-sd.h>
#include <hw/esp8266-pwm-fs.h>
// #include <hw/esp8266-pwm-fs-23k256.h>
#elif defined(LM4F)
// #include <hw/lm4f-utft.h>
// #include <hw/lm4f-utft-sd.h>
#endif
#error "hw/user.h not configured!"

10
library.properties Normal file
View File

@ -0,0 +1,10 @@
name=r65emu
version=1.0.0
author=Stephen Crane <jscrane@gmail.com>
maintainer=Stephen Crane <jscrane@gmail.com>
sentence=8-bit Microcomputer Emulation Library
paragraph=Supports 6502, 8080 and Z80 processors
category=Other
url=https://github.com/jscrane/r65emu
architectures=esp32, esp8266, tivac
includes=r65emu.h