Commit Graph

601 Commits

Author SHA1 Message Date
nsx0r
43669ce181
addes NES mapper 111
addes NES mapper 111
2022-11-02 12:27:08 +01:00
nsx0r
bc0923d1ac
actually fix all NAMCOT mappers similar to 206
actually fix all NAMCOT mappers similar to 206
2022-11-02 07:44:25 +01:00
nsx0r
4a799e6969
fixed NES mapper 206
fixed NES mapper 206, tested working with FC game "Super Chinese"
2022-11-02 05:50:33 +01:00
sanni
61cc4b034c Update Cart_Reader.ino 2022-11-02 01:20:35 +01:00
sanni
044e90f575 Update Cart_Reader.ino 2022-11-02 00:44:16 +01:00
sanni
a3b1882e88 Fix NES manual mapper selection 2022-11-02 00:32:54 +01:00
sanni
78aa7a3d34 Update NES.ino 2022-11-01 23:32:46 +01:00
sanni
2c95299010 Turn LED off when rotary button is pressed 2022-11-01 22:50:14 +01:00
sanni
d7082a2366 Add fast scrolling through NES database
Fast scrolling skips 30 entries at once.
Also fixed lockup when browsing backwards on first database entry.
2022-11-01 22:26:53 +01:00
Vincent Pelletier
90303b45c0 SNES.ino: Restore code with side-effects
This code was removed as part of
  a555f21 ("All: Resolve all compiler and linker warnings")
because it was filling a 1kB buffer which was never read from.
While I expect reading values from PINC should be invisible from the
cartridge's perspective, writing to PORTL, PORTF and PORTK is definitely
visible.
I have currently no way of testing if this code is required, so in doubt
restore the parts which have effects visible from the cartridge.
2022-11-01 07:56:15 +00:00
Vincent Pelletier
c82815f0d5 SFM.ino, SNES.ino: Rework compiler warnings resolution
I am not sure why I changed some variables from 16 bit types to 8 bit types
when the warnings being resolved were only about signedness.
Fixes: a555f21 ("All: Resolve all compiler and linker warnings")
2022-11-01 07:53:35 +00:00
sanni
cc17c70e30 Fix reading/writing 4MB HiROM
HiROM starts at bank 192 and has 64 banks so byte variable currBank overflows.
2022-10-31 15:41:29 +01:00
sanni
a3feb32e15
V11.1 2022-10-31 11:40:15 +01:00
Vincent Pelletier
f07f6f9025 All: Replace print_Error(*, boolean) calls with print_{,Fatal}Error(*)
Also, make print_FatalError(*) independent from print_Error(*).
Also, factorise common parts of print_Error(*).

Frees 2336 bytes of program space and 5 bytes of global ram space.
2022-10-31 08:52:33 +00:00
Vincent Pelletier
0a823bf5b7 Cart_Reader.ino: Factorise missing module error.
Also, handle one such case in the HW3 main menu.
2022-10-31 08:52:19 +00:00
Vincent Pelletier
25b615f77c Cart_Reader.ino: Move print_FatalError prototypes earlier in the file
So they can be used in more places within that file.
2022-10-31 05:48:46 +00:00
Vincent Pelletier
4a2a2c69d2 Cart_Reader.ino: Deduplicate HW5 mainMenu pagination logic 2022-10-31 05:48:46 +00:00
Vincent Pelletier
a35c882662 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.
2022-10-31 05:48:46 +00:00
Vincent Pelletier
bea06e55fe N64.ino: Assorted low-hanging fruits
More sizeof() use, avoiding high-level loops when a callee can do it
without the call overhead on every iteration, a bit of source code
factorisation, avoiding initializers for large variables.
2022-10-31 05:48:46 +00:00
Vincent Pelletier
d9daadb1f9 N64.ino: Build eeprom path and file name with snprintf_P
So the format string is stored in flash rather than in ram.
The gain from doing just one like this is not much, to be done in more
places.
2022-10-31 01:16:06 +00:00
Vincent Pelletier
a43b2553cd N64.ino: Optimise controller CRC functions for speed
Also, shave off 5 bytes from a local initializer.
Saves 22 bytes of program space and of global ram space.
2022-10-31 01:16:06 +00:00
sanni
3826f5aa10
Update Cart_Reader.ino 2022-10-30 11:46:55 +01:00
Vincent Pelletier
fbaed78eb5 SFM.ino: Get rid of write-only global variables
These variables are set but never read. Removing them removes a non-trivial
amount of code, which I am not comfortable deleting: it contains knowledge
about cart data structure, even though it is currently not being used for
anything. So comment it out until someone who know this architecture better
comes around.

Frees 146 bytes of program space and 16 bytes of global ram space.
2022-10-29 09:46:00 +00:00
Vincent Pelletier
18bd92d100 WSV.ino: Move WVS to PROGMEM
Frees 16 bytes of program space and 8 bytes of global ram space.
2022-10-29 08:01:59 +00:00
Vincent Pelletier
cb26782e22 PCE.ino: Get rid of menuOptionspceCart global variable
Also, move a few inline string constants into PROGMEM.
Uses 64 bytes of program space.
Frees 206 bytes of global ram space.
2022-10-29 08:01:59 +00:00
Vincent Pelletier
59665bb848 NES.ino: Factorise Create{PRG,CHR,RAM}FileInSD functions
Also, gets rid of filesCount global.

Frees 390 bytes of program space and 21 bytes of global ram space.
2022-10-29 08:01:55 +00:00
Vincent Pelletier
64db4ded54 NES.ino: Convert nointro-disabled global variables into locals
Also, remove dead error handling code: sd.exists internally opens the file
and returns the produced status, so myFile.open return value should be the
same.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
264bfd5ce5 INTV.ino: Move INTV to PROGMEM.
Uses 8 bytes of program space.
Frees 6 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
a6f9e5e99c GBA.ino: Get rid of unused global 2022-10-29 07:16:37 +00:00
Vincent Pelletier
d4c5f6ec5b GBA.ino: Get rid of calcChecksumStr as a global
Frees 150 bytes of program space and 5 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
3bb63d77e3 COLV.ino: Move COL to PROGMEM
Uses 30 bytes of program space
Frees 6 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
65f7950af4 NES.ino: Move PRG, CHR and RAM to PROGMEM.
Uses 90 bytes of program space.
Frees 40 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
133e3feda9 Cart_Reader.ino: New variants of print_Error
Tagged with noreturn so the compiler knows about the effect of
forceReset=true.
Ideally, print_Error should lose its forceReset argument so that:
- print_Error never resets
- print_FatalError always resets (and hosts the code doing so)
so the compiler is more accurately aware of the execution flow.
2022-10-29 07:16:37 +00:00
sanni
34981fdb8e Fix compile error 2022-10-28 15:09:15 +02:00
sanni
a8a981e137 Auto format 2022-10-28 15:02:51 +02:00
sanni
30d880bfa7 Fix SNES romName 2022-10-28 13:38:16 +02:00
sanni
24c5957993 Fix CRC32 calculation 2022-10-28 12:56:38 +02:00
nsx0r
2682e5ef94
added NES mapper 91 + m36 typo fix
added NES mapper 91 + m36 typo fix
2022-10-28 11:49:55 +02:00
nsx0r
1509549946
added NES mapper 36
added NES mapper 36
2022-10-28 10:29:54 +02:00
sanni
748b9094df V11.0 2022-10-28 10:26:04 +02:00
Vincent Pelletier
10061beaf5 MD.ino: Move some globals to getCartInfo_MD locals.
Also, bypass sdBuffer when it was the directory copied to another buffer.
Also, factorise yet another pair of loops copying rom name.
This frees 59 bytes of global ram space.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
3c3b399d6a SFM.ino: Move all menu variables from globals to locals.
Saves about 100 bytes of program memory and 80 bytes of global ram.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
3632b06980 SFM.ino: Factorise single-game gamecode retrieval.
Frees 220 bytes of code and 16 bytes of ram.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
67b54a690b All: Factorise title generation from cart.
Fix out-of-bound access when first byte is not an ascii printable
character.
Reduces program space use by 480 bytes.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
3b05046ee9 All: Factorise CRC functions.
This saves 370 bytes of program space.
2022-10-28 05:29:41 +00:00
Vincent Pelletier
84738038e1 NES.ino: Give more time to read "No data found" message. 2022-10-28 05:29:20 +00:00
Vincent Pelletier
337ef94b07 NES.ino: Factorise code.
Mainly, this removes a lot of the logic from selectMapping by reusing the
copy already present in getMapping. As a result, selectMapping is not
expected to be accessed from outside this module anymore.
Also, this factorises several smaller chunks of code found throughout the
module.
Also, get rid of a few easy globals along the way.
Also, move a bit more of NES-specific initialisation and menu display to
the NES.ino module.

This saves about 1490 bytes of code.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
e4e09c7bf8 GBA.ino: Reduce gbaMenu size.
Replace switch blocks which produce one output with const tables.
Use functions instead of repeating code.
Move common initial and final statements outside of blocks.
Also, do not erase/flash second bank on dual-bank chips when the first one
had failures.
This saves about 520 bytes of code and increases ram use by 12 bytes.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
27baa2b164 All: Factorise code seeking a file back N lines
This saves 890 bytes of program space.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
0a627e5bd4 All: Use f.seekCur(x) instead of f.seekSet(f.curPosition() + x)
Saves 450 bytes of program space.
2022-10-28 05:29:20 +00:00