mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-28 14:01:52 +01:00
N64.ino: Factorise JoyBus-related code
IMPORTANT: with this change, the Adafruit clock generator becomes a hard requirement to read and write gamecart eeproms. This is a large patch, partly because JoyBus is used a lot: - controller - controller pak - gamecart eeprom and partly because of the further simplifications it allows. Also, implement low-level bit shift functions in assembly in order to get complete control of the timings: there can be just a few cycles of slack. Also, use the time waiting for the input line to go high to pack received bits into bytes on-the-fly, as there is now plenty of time. This saves about 2080 bytes of program space, and 369 bytes of global ram space.
This commit is contained in:
parent
bea06e55fe
commit
a35c882662
@ -1081,11 +1081,7 @@ static const char modeItem2[] PROGMEM = "SNES/SFC (CLK0+1)";
|
||||
static const char modeItem2[] PROGMEM = "Super Nintendo/SFC";
|
||||
#endif
|
||||
static const char modeItem3[] PROGMEM = "Mega Drive/Genesis";
|
||||
#if defined(clockgen_installed)
|
||||
static const char modeItem4[] PROGMEM = "N64 (3V EEP CLK1)";
|
||||
#else
|
||||
static const char modeItem4[] PROGMEM = "Nintendo 64(3V EEP)";
|
||||
#endif
|
||||
static const char modeItem5[] PROGMEM = "Game Boy";
|
||||
static const char modeItem6[] PROGMEM = "About";
|
||||
// static const char modeItem7[] PROGMEM = "Reset"; (stored in common strings array)
|
||||
@ -2903,15 +2899,6 @@ void wait_btn() {
|
||||
// get input button
|
||||
int b = checkButton();
|
||||
|
||||
#ifdef enable_N64
|
||||
#ifndef clockgen_installed
|
||||
// Send some clock pulses to the Eeprom in case it locked up
|
||||
if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
|
||||
pulseClock_N64(1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// if the cart readers input button is pressed shortly
|
||||
if (b == 1) {
|
||||
errorLvl = 0;
|
||||
@ -3005,15 +2992,6 @@ void wait_btn() {
|
||||
// get input button
|
||||
int b = checkButton();
|
||||
|
||||
#ifdef enable_N64
|
||||
#ifndef clockgen_installed
|
||||
// Send some clock pulses to the Eeprom in case it locked up
|
||||
if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
|
||||
pulseClock_N64(1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// if the cart readers input button is pressed shortly
|
||||
if (b == 1) {
|
||||
errorLvl = 0;
|
||||
@ -3045,15 +3023,6 @@ void wait_encoder() {
|
||||
encoder.tick();
|
||||
int newPos = encoder.getPosition();
|
||||
|
||||
#ifdef enable_N64
|
||||
#ifndef clockgen_installed
|
||||
// Send some clock pulses to the Eeprom in case it locked up
|
||||
if ((mode == mode_N64_Cart) && ((saveType == 5) || (saveType == 6))) {
|
||||
pulseClock_N64(1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (rotaryPos != newPos) {
|
||||
rotaryPos = newPos;
|
||||
errorLvl = 0;
|
||||
|
1402
Cart_Reader/N64.ino
1402
Cart_Reader/N64.ino
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user