1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-06-12 20:08:04 +00:00

Compare commits

..

No commits in common. "3af6b4d3f7ff99489f683ddeaa1f992737d9a9b3" and "1cf4c02039c123cc0f16b82ae7e65aac75bc78e5" have entirely different histories.

10 changed files with 21 additions and 125 deletions

View File

@ -11,7 +11,6 @@ Sample Applications
- [Pacman](https://github.com/jscrane/pacman)
- [Commodore PET](https://github.com/jscrane/PET)
- [Compukit UK101](https://github.com/jscrane/UK101)
- [Commodore Chessmate](https://github.com/jscrane/Chessmate)
Configuration for Arduino
--------------
@ -52,5 +51,5 @@ ESP8266 board, e.g., [WeMOS](https://www.wemos.cc/en/latest/d1/d1_mini.html), _o
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 (if not using a board with VGA),
- 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.

View File

@ -63,8 +63,10 @@ void Display::begin(colour_t bg, colour_t fg, orientation_t orient, unsigned dis
_dx -= _xoff;
_dy -= _yoff;
DBG(printf("xoff %d yoff %d dx %d dy %d", _xoff, _yoff, _dx, _dy));
DBG(println());
#if defined(DEBUGGING)
Serial.printf("xoff %d yoff %d dx %d dy %d", _xoff, _yoff, _dx, _dy);
Serial.println();
#endif
}
void Display::begin(colour_t bg, colour_t fg, orientation_t orient) {
@ -74,7 +76,6 @@ void Display::begin(colour_t bg, colour_t fg, orientation_t orient) {
#if defined(USE_UTFT)
utft.InitLCD(orient);
utft.setBackColor(_bg);
_dx = utft.getDisplayXSize();
_dy = utft.getDisplayYSize();
@ -108,7 +109,11 @@ void Display::begin(colour_t bg, colour_t fg, orientation_t orient) {
_dx = canvas.getWidth();
_dy = canvas.getHeight();
DBG(printf("w %d h %d\r\n", _dx, _dy));
#if defined(DEBUGGING)
Serial.printf("w %d h %d", _dx, _dy);
Serial.println();
#endif
#endif
setColor(fg);
@ -168,90 +173,17 @@ void Display::drawPixel(unsigned x, unsigned y, colour_t col) {
#endif
}
void Display::drawLine(unsigned x1, unsigned y1, unsigned x2, unsigned y2, colour_t col) {
x1 += _xoff;
y1 += _yoff;
x2 += _xoff;
y2 += _yoff;
#if defined(USE_UTFT)
utft.setColor(col);
utft.drawLine(x1, y1, x2, y2);
#elif defined(USE_ESPI)
espi.drawLine(x1, y1, x2, y2, col);
#elif defined(USE_VGA)
canvas.setPenColor(rgb(col));
canvas.drawLine(x1, y1, x2, y2);
#endif
}
void Display::drawCircle(unsigned x, unsigned y, unsigned r, colour_t col) {
void Display::drawString(const char *s, unsigned x, unsigned y) {
x += _xoff;
y += _yoff;
#if defined(USE_UTFT)
utft.setColor(col);
utft.drawCircle(x, y, r);
#elif defined(USE_ESPI)
espi.drawCircle(x, y, r, col);
#elif defined(USE_VGA)
canvas.setPenColor(rgb(col));
canvas.drawEllipse(x, y, r, r);
#endif
}
void Display::fillCircle(unsigned x, unsigned y, unsigned r, colour_t col) {
x += _xoff;
y += _yoff;
#if defined(USE_UTFT)
utft.setColor(col);
utft.fillCircle(x, y, r);
#elif defined(USE_ESPI)
espi.fillCircle(x, y, r, col);
#elif defined(USE_VGA)
canvas.setBrushColor(rgb(col));
canvas.fillEllipse(x, y, r, r);
#endif
}
void Display::drawRectangle(unsigned x, unsigned y, unsigned w, unsigned h, colour_t col) {
x += _xoff;
y += _yoff;
#if defined(USE_UTFT)
utft.setColor(col);
utft.drawRect(x, y, x+w, y+h);
#elif defined(USE_ESPI)
espi.drawRect(x, y, w, h, col);
#elif defined(USE_VGA)
canvas.setPenColor(rgb(col));
canvas.drawRectangle(x, y, x+w, y+h);
#endif
}
void Display::fillRectangle(unsigned x, unsigned y, unsigned w, unsigned h, colour_t col) {
x += _xoff;
y += _yoff;
#if defined(USE_UTFT)
utft.setColor(col);
utft.fillRect(x, y, x+w, y+h);
#elif defined(USE_ESPI)
espi.fillRect(x, y, w, h, col);
#elif defined(USE_VGA)
canvas.setBrushColor(rgb(col));
canvas.fillRectangle(x, y, x+w, y+h);
#endif
}
void Display::drawString(const char *s, unsigned x, unsigned y, colour_t col) {
x += _xoff;
y += _yoff;
#if defined(USE_UTFT)
utft.setColor(col);
utft.print(s, x, y);
#elif defined(USE_ESPI)
espi.setTextDatum(TL_DATUM);
espi.setTextColor(col, _bg, true);
unsigned w = espi.textWidth(s);
espi.fillRect(x, y, w, _cy, _bg);
espi.drawString(s, x, y);
#elif defined(USE_VGA)
canvas.setPenColor(rgb(col));
canvas.drawText(x, y, s);
#endif
}

View File

@ -37,25 +37,7 @@ public:
void statusf(const char *fmt, ...);
void drawPixel(unsigned x, unsigned y, colour_t col);
void drawPixel(unsigned x, unsigned y) { drawPixel(x, y, _fg); }
void drawLine(unsigned x1, unsigned y1, unsigned x2, unsigned y2, colour_t col);
void drawLine(unsigned x1, unsigned y1, unsigned x2, unsigned y2) { drawLine(x1, y1, x2, y2, _fg); }
void drawCircle(unsigned x, unsigned y, unsigned r, colour_t col);
void drawCircle(unsigned x, unsigned y, unsigned r) { drawCircle(x, y, r, _fg); }
void fillCircle(unsigned x, unsigned y, unsigned r, colour_t col);
void fillCircle(unsigned x, unsigned y, unsigned r) { fillCircle(x, y, r, _fg); }
void drawRectangle(unsigned x, unsigned y, unsigned w, unsigned h, colour_t col);
void drawRectangle(unsigned x, unsigned y, unsigned w, unsigned h) { drawRectangle(x, y, w, h, _fg); }
void fillRectangle(unsigned x, unsigned y, unsigned w, unsigned h, colour_t col);
void fillRectangle(unsigned x, unsigned y, unsigned w, unsigned h) { fillRectangle(x, y, w, h, _fg); }
void drawString(const char *s, unsigned x, unsigned y, colour_t col);
void drawString(const char *s, unsigned x, unsigned y) { drawString(s, x, y, _fg); }
void drawString(const char *s, unsigned x, unsigned y);
protected:
unsigned _bg, _fg, _cx, _cy, _dx, _dy, _oxs, _xoff, _yoff;

View File

@ -12,9 +12,7 @@
#include "filer.h"
#include "flash_filer.h"
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
static File files[MAX_FILES];
#endif
#if defined(USE_SPIFFS)
static File dir;
@ -143,10 +141,8 @@ const char *flash_filer::checkpoint() {
hardware_checkpoint(file);
file.close();
start();
return buf;
#else
return "";
#endif
return buf;
}
void flash_filer::restore(const char *filename) {

View File

@ -22,20 +22,16 @@
#define KBD_DATA D4
// SPI-RAM
#if !defined(NO_SPIRAM)
#define USE_SPIRAM
#define SPIRAM_DEV SPI
#define SPIRAM_CS D0
#define SPIRAM_SIZE 0x8000u
#endif
// flash storage
#if !defined(NO_STORAGE)
// "tape" storage...
#undef USE_SD
//#define SD_CS D0
#undef USE_SPIFFS
#define USE_LITTLEFS
#endif
// sound
#define PWM_SOUND D2

View File

@ -28,12 +28,10 @@
#define KBD_DATA 34
#define KBD_IRQ 35
// Storage
#if !defined(NO_STORAGE)
// storage
#undef USE_SD
#undef USE_LITTLEFS
#define USE_SPIFFS
#endif
// sound: dac and pwm
#define DAC_SOUND 25

View File

@ -7,15 +7,12 @@
#define KBD_DATA PE_4
#define KBD_IRQ PE_5
// Storage
#if !defined(NO_STORAGE)
// "tape" storage...
#define USE_SD
#define SD_CS PF_3
#define SD_SPI 1
#endif
// 23k256 SPI-RAM
#if !defined(NO_SPIRAM)
#define USE_SPIRAM
#define SPI_CS PF_3
#define SPIRAM_CS PE_0
@ -23,7 +20,6 @@
#define SPIRAM_MODULE 1
#define SPIRAM_CLKDIV 1
#define SPIRAM_SIZE 0x8000u
#endif
// TFT display...
// NOTE: edit memorysaver.h to select the correct chip for your display!

View File

@ -20,9 +20,7 @@
#define DAC_SOUND 25
#define PWM_SOUND 25
// Storage
#if !defined(NO_STORAGE)
// "tape" storage...
#undef USE_SD
#undef USE_LITTLEFS
#define USE_SPIFFS
#endif

3
ram.h
View File

@ -1,10 +1,9 @@
#ifndef __RAM_H__
#define __RAM_H__
template<unsigned n = 1024>
class ram: public Memory::Device {
public:
static const unsigned page_size = n;
static const unsigned page_size = 1024;
virtual void operator= (uint8_t c) { _mem[_acc] = c; }
virtual operator uint8_t () { return _mem[_acc]; }

View File

@ -3,9 +3,9 @@
#include "timed.h"
#include "sound_dac.h"
#if defined(DAC_SOUND) && defined(ESP_PLATFORM)
static DAC *s;
#if defined(DAC_SOUND) && defined(ESP_PLATFORM)
#include <driver/dac.h>
static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;