mirror of
https://github.com/jscrane/r65emu.git
synced 2024-12-20 21:29:48 +00:00
change initialisation a bit
This commit is contained in:
parent
e0633e6450
commit
0c87474d58
19
hardware.cpp
19
hardware.cpp
@ -1,5 +1,7 @@
|
||||
#include <UTFT.h>
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <SpiRAM.h>
|
||||
|
||||
#include "ps2drv.h"
|
||||
#include "memory.h"
|
||||
@ -15,8 +17,15 @@ UTFT utft(TFT_MODEL, TFT_RS, TFT_WR, TFT_CS, TFT_RST);
|
||||
static CPU *_cpu;
|
||||
|
||||
bool hardware_reset() {
|
||||
bool sd = SD.begin(SD_CS, 3, SD_SPI);
|
||||
extern SPIClass SPIRAM_DEV;
|
||||
SPIRAM_DEV.begin();
|
||||
SPIRAM_DEV.setModule(SPIRAM_SPI);
|
||||
SPIRAM_DEV.setClockDivider(SPI_CLOCK_DIV8);
|
||||
SPIRAM_DEV.setDataMode(SPI_MODE0);
|
||||
|
||||
bool sd = SD.begin(SD_CS, 2, SD_SPI);
|
||||
pinMode(SPI_CS, OUTPUT); // without this, the SPI-RAM isn't seen
|
||||
|
||||
#if defined(TFT_BACKLIGHT)
|
||||
digitalWrite(TFT_BACKLIGHT, HIGH);
|
||||
#endif
|
||||
@ -24,8 +33,6 @@ bool hardware_reset() {
|
||||
extern uint8_t SmallFont[];
|
||||
utft.setFont(SmallFont);
|
||||
|
||||
sram.begin(SPIRAM_CS, SPIRAM_SPI);
|
||||
|
||||
_cpu->reset();
|
||||
return sd;
|
||||
}
|
||||
@ -34,10 +41,14 @@ void hardware_init(CPU &cpu) {
|
||||
_cpu = &cpu;
|
||||
memory.begin();
|
||||
ps2.begin(KBD_DATA, KBD_IRQ);
|
||||
pinMode(SD_CS, OUTPUT);
|
||||
|
||||
#if defined(TFT_BACKLIGHT)
|
||||
pinMode(TFT_BACKLIGHT, OUTPUT);
|
||||
#endif
|
||||
pinMode(SD_CS, OUTPUT);
|
||||
digitalWrite(SD_CS, HIGH);
|
||||
pinMode(SPIRAM_CS, OUTPUT);
|
||||
digitalWrite(SPIRAM_CS, HIGH);
|
||||
}
|
||||
|
||||
void hardware_checkpoint(Stream &s) {
|
||||
|
20
hardware.h
20
hardware.h
@ -18,24 +18,28 @@
|
||||
#define TFT_CS PC_7
|
||||
#define TFT_RST PC_4
|
||||
|
||||
// SPI-RAM
|
||||
#define SPIRAM_CS PE_0
|
||||
#define SPIRAM_SPI 1
|
||||
#define SPIRAM_DEV SPI_for_SD
|
||||
#define SPIRAM_SIZE 32768
|
||||
|
||||
// PS/2 keyboard
|
||||
#define KBD_DATA PE_4
|
||||
#define KBD_IRQ PE_5
|
||||
|
||||
// SPI-RAM
|
||||
#define SPIRAM_CS PE_0
|
||||
//#define SPIRAM_CS PF_3
|
||||
#define SPIRAM_SPI 1
|
||||
#define SPIRAM_DEV SPI_for_SD
|
||||
#define SPIRAM_SIZE 32768
|
||||
|
||||
// "tape" storage...
|
||||
#define SD_CS PF_3
|
||||
//#define SD_CS PE_0
|
||||
#define SD_SPI 1
|
||||
|
||||
#define SPI_CS PF_3
|
||||
|
||||
bool hardware_reset();
|
||||
void hardware_init(class CPU &);
|
||||
void hardware_checkpoint(Stream &); // FIXME: make a path?
|
||||
void hardware_restore(Stream &);
|
||||
void hardware_checkpoint(class Stream &);
|
||||
void hardware_restore(class Stream &);
|
||||
|
||||
extern class PS2Driver ps2;
|
||||
extern class spiram sram;
|
||||
|
@ -19,10 +19,8 @@ bool sdtape::more()
|
||||
_pos = 0;
|
||||
_len = file.read(_buf, sizeof(_buf));
|
||||
|
||||
if (_len == 0) {
|
||||
file.close();
|
||||
return false; // eof
|
||||
}
|
||||
if (_len == 0) // eof
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -8,15 +8,6 @@ extern SPIClass SPIRAM_DEV;
|
||||
|
||||
SpiRAM spiRam(SPIRAM_DEV, SPIRAM_CS);
|
||||
|
||||
void spiram::begin(byte cs, int module)
|
||||
{
|
||||
SPI_for_SD.setModule(module);
|
||||
SPI_for_SD.setClockDivider(SPI_CLOCK_DIV16);
|
||||
SPI_for_SD.setDataMode(SPI_MODE0);
|
||||
pinMode(PF_3, OUTPUT);
|
||||
pinMode(cs, OUTPUT);
|
||||
}
|
||||
|
||||
void spiram::operator=(byte b)
|
||||
{
|
||||
spiRam.write_byte(_acc, b);
|
||||
|
Loading…
Reference in New Issue
Block a user