aboutsummaryrefslogtreecommitdiff
path: root/crates/readrom
Commit message (Collapse)AuthorAgeFilesLines
* readrom: read the ROM file right on startMiquel Sabaté Solà2026-07-231-28/+18
| | | | | | | | | | This avoids exhausting the input in other scenarios (thus fixing commit f5549b97bf85 ("readrom: only read the ROM file once")), and it makes everything more cohesive. Fixes: f5549b97bf85 ("readrom: only read the ROM file once") Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Remove .github directoryMiquel Sabaté Solà2026-07-221-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: only read the ROM file onceMiquel Sabaté Solà2026-07-161-15/+14
| | | | | | | | | | | | | | | | | | | Since the implementation grew from disassembling a single subroutine, reading the ROM file from inside print_range() made sense. But since we have disassembling of full segments and files now, this reading would be triggered multiple times. Commit d7b1a895de9e ("readrom: add an option to disassemble the full file") avoided the exhaustion of the input by using seek(), but that's just a hack and it's hiding the fact that we are constantly reading the same thing over and over. Constantly reading ROM files isn't that much of a performance issue given how small they are, but it's embarrasing anyways. Fix this by reading the full file once and passing the slice of bytes to the same functions that used to require the file to be passed. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: add an option to disassemble the full fileMiquel Sabaté Solà2026-07-161-2/+39
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: allow to disassemble a mappingMiquel Sabaté Solà2026-07-161-22/+117
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: fix versioning on the Cargo manifestMiquel Sabaté Solà2026-07-151-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: implement the -d/--disassemble optionMiquel Sabaté Solà2026-07-153-6/+406
| | | | | | | | This option can also be coupled with -n/--nasm-directory, and you can then get a human-readable disassembling of any proc or label you might be thinking on. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: print the usual PRG-RAM size if availableMiquel Sabaté Solà2026-07-131-0/+3
| | | | | | | | | | If 'has_persistent_memory' has been set on the ROM header, then we must print it even if bytes 8/10 was never set by the header. In fact, the vast majority of ROM files don't have these bytes set but they report a true value for 'has_persistent_memory'. Hence, assume the usual PRG-RAM size in these cases, which is (I hope) the correct one in all cases. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Minor style fixes from an upgraded clippyMiquel Sabaté Solà2026-07-091-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* Upgrade to the 2024 edition of RustMiquel Sabaté Solà2026-07-081-1/+0
| | | | | | | And also adjust the code so the clippy from the 2024 edition is fine with it. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
* readrom: Add detection of RAM, Timing and mirroringMiquel Sabaté Solà2025-09-121-8/+40
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add -h and -v options on the help messageMiquel Sabaté Solà2025-09-021-1/+3
| | | | | | | On all binaries there were these two options missing from the help message. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Apply suggested style fixes from clippyMiquel Sabaté Solà2025-08-171-3/+3
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Remove the dependency on clapMiquel Sabaté Solà2025-01-222-18/+62
| | | | | | | | | | | | | | | All three binaries (i.e. readrom, nasm and xa65) used it, and to be honest rolling our own argument parsing was actually pretty easy to achieve. This frees us from a big dependency and it also frees us from inner dependencies such as 'clap_derive' which prevented us from being able to build binaries purely statically. As a side effect, we can now display help/version messages which are more like I'm used to, and certain checks can be moved in the parsing directly instead of having to be done later. As a cherry on top, there is some type masturbation that gets removed along the way. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* readrom: Print addresses for vectorsMiquel Sabaté Solà2025-01-141-1/+39
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* readrom: Remove the derive feature from clapMiquel Sabaté Solà2025-01-102-14/+18
| | | | | | | This allows us to statically build the 'readrom' binary, as that feature from clap prevented that option. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Remove anyhow from xa65 and readromMiquel Sabaté Solà2025-01-102-9/+17
| | | | | | | | Following in the footsteps of c20c991dded8 ("Make errors from nasm itself more cohesive"), 'anyhow' might provide an easy framework, but it lends towards a less cohesive experience. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add the readrom binaryMiquel Sabaté Solà2024-12-182-0/+67
The readrom binary is similar to `readelf` from Linux and it will allow to display information from an NES/Famicom ROM file. For now the information being shown is just the header, but in the future we might also include disassembling parts of the code, or retrieving the "CHARS" section for a given ROM file, and similar. In order to implement the header parsing part a new library has been introduced, simply named "header" which abstracts everything away so you just need to call `Header::try_from("my bytes")` to fetch the actual information. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>