Commit Graph

115 Commits

Author SHA1 Message Date
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
a8a981e137 Auto format 2022-10-28 15:02:51 +02: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
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
Vincent Pelletier
a555f2117f All: Resolve all compiler and linker warnings
No functional change intended.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
d7bbc59607 N64.ino: Remove unused function
This does not save any space as the linker noticed it wasn't used.
Also, point the (commented-out) only caller to the equivalent libc
function.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
e7ef7fd4bd All: Make flashid an integer
flashid (almost) always contains the hexadecimal representation of two
bytes, which then means it gets compares with strcmp, which in turn need
another string argument. Instead, make it an integer, removing the need to
call strcmp.
Add a separate string representation for printing purposes (maybe this can be
avoided by having the print function format it when needed ?).
The only apparent case where flashid is not an hexadecimal representation
of a pair of bytes is when N64 clears it to "CONF". Set flashid to zero
this case.
This saves about 500 bytes of program space and 200 bytes of ram.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
3fcd1a808d https://github.com/sanni/cartreader/issues/574#issuecomment-1286956251 2022-10-28 05:29:20 +00:00
sanni
4badfff458 Move to Arduino IDE 2.0.0 (different auto formatting, no code changes) 2022-10-13 09:49:03 +02:00
sanni
21e7468dfd Fix flicker in Controller Test 2022-10-08 23:07:15 +02:00
sanni
a49d8c6590 Remove crc file after successful Controller Pak read 2022-10-08 19:20:21 +02:00
sanni
0ab7a18b05 V10.1 Move HW1/2/3 to same display lib as HW4/5
... bugs are to be expected :D
2022-10-08 16:23:33 +02:00
Lesserkuma
e892a8e9f1 Fixed wording 2022-09-28 21:42:05 +02:00
Lesserkuma
dab124def7 Find Game Serial for Game Boy 2022-09-28 21:31:49 +02:00
Lesserkuma
6098700fdd Merge branch 'master' 2022-09-25 17:06:58 +02:00
Lesserkuma
140401161b UI improvements for GB, GBA, N64, SNES 2022-09-25 16:40:21 +02:00
sanni
6659b84d9d Add support for Benesse Pocket Challenge W Module (thx to skaman) 2022-09-25 10:36:28 +02:00
Lesserkuma
77c0daeb6a Update to displaying full ROM title on SNES, N64, GB, GBA 2022-09-24 14:36:13 +02:00
sanni
38bc8a59e5 Fix bug in N64 controller functions 2022-09-10 15:57:01 +02:00
sanni
3500d4684e Update N64.ino 2022-09-10 15:15:32 +02:00
sanni
b7cbe8e8d9 Verify MPK file after reading 2022-09-10 14:35:47 +02:00
sanni
07a38f30c2 V9.7: Calculate block CRC during Controller Pak read 2022-09-09 00:21:16 +02:00
sanni
90bbccd959 Update N64.ino 2022-08-19 19:27:28 +02:00
sanni
97394939a1 Update N64.ino 2022-08-19 11:50:18 +02:00
sanni
e01ce10faf Add header and ToC checksum calculation for N64 Controller Pak read 2022-08-19 11:48:43 +02:00
sanni
b96c338d79 Reset N64 Controller before accessing Controller Pak 2022-08-18 21:19:58 +02:00
sanni
659eefda63 Improve Controller Pak timing 2022-08-18 19:23:33 +02:00
sanni
e4246d8310 Fix N64 Controller Pak read/write 2022-08-17 22:53:07 +02:00
sanni
f002e40aa6 Add back option to dump headerless NES ROM 2022-08-03 12:14:32 +02:00
sanni
c07a9334fd Small fixes 2022-07-26 23:26:20 +02:00
sanni
0e56a3451a V9.2 Alpha: Adds Coleco- and Intellivision (thx to skaman) 2022-07-23 11:16:37 +02:00
sanni
0a4a4d0039 Add no-intro database to NES
This is just a beta release, stuff might be broken.
2022-07-07 00:15:13 +02:00
sanni
9cb0f1fc13 Use CRC1 instead of cart ID in N64 database 2022-07-03 01:03:39 +02:00
sanni
44d853e1bb Add CRC32 and filenames to SNES database 2022-06-21 13:29:19 +02:00
sanni
196050257b Add filenames to N64 database 2022-06-17 23:57:29 +02:00
sanni
8b96d250bd Add MD database 2022-06-16 17:17:16 +02:00
sanni
fac6f8eab2 Copy latest log to dump dir 2022-06-16 15:15:43 +02:00
sanni
f0639e20ad Improve SD logfile 2022-06-14 15:25:53 +02:00
Kreeblah
75e85af20f
Automatically create snes_clk.txt if it doesn't exist 2022-02-26 21:20:33 -08:00
sanni
bb4ae30151 Update N64.ino 2022-02-12 13:24:05 +01:00
sanni
11b8493c92 If name consists out of all japanese characters use cart id 2022-02-12 13:15:53 +01:00
majorpbx
78295be022 GameShark Dump Compatability Update
This has been confirmed to allow dumping v1.07, v1.09, v2.0-2.21, v3.2-3.3 with the below flash memory chips. Versions not listed may not work correctly or even be supported.

SST 29LE010
SST 28LF040
AMTEL AT29LV010A
SST 29EE010
2021-12-10 23:45:42 -05:00
sanni
eef1c6e8cc Add check if Clockgen is working 2021-11-18 14:55:50 +01:00
sanni
ed3663a21f Fix Progressbar line break on LCD 2021-11-17 21:49:20 +01:00
sanni
5a3b311feb Fix Led and missing word wrap 2021-10-26 17:13:42 +02:00
sanni
852cb8f047 Port ControllerTest to MKS MINI12864 2021-10-26 11:27:07 +02:00