Comments (5)
A first pass at a small tool for checking IHX overlaps. It builds for Linux and Windows (mingw).
https://github.com/bbbbbr/ihx_check
-
It does some merging of adjacent data blocks to reduce the number of comparisons, since in the ihx file they typically 32 bytes at the largest. That can be changed if we want to test all of them individually.
-
By default it just prints warnings without changing an error code, but it can be instructed to treat the warnings as errors with the
-e
switch after the .ihx filename.
Some example output with a couple banks overflowing into others by various amounts.
Warning: Multiple write of 16384 bytes at 0x8000 -> 0xbfff. Bank overflow? (8000 - bfff and 8000 - bfff)
Warning: Multiple write of 1 bytes at 0xc000 -> 0xc000. Bank overflow? (c000 - c01e and c000 - c000)
Warning: Multiple write of 28 bytes at 0xc000 -> 0xc01b. Bank overflow? (c000 - c01e and c000 - c01b)
Warning: Multiple write of 1 bytes at 0xc000 -> 0xc000. Bank overflow? (c000 - c000 and c000 - c01b)
If it's decided to use this with gbdk it would probably be easy to integrate with the existing repo and makefile.
Note: Due to how addresses get translated in the linker before it writes the IHX file, a bank that overflows into a following empty bank cannot be warned about:
- This is: (Adjacent banks sharing a boundary)
Bank 3 Bank 4
|33333333| |444.....|
- Is indistinguishable from this:
(bank overflowing to another that is empty, there may be problems accessing the overflowed data)
Bank 3 (Bank 4 is empty, bank 3 spills into it)
|33333333| |333.....|
from gbdk-2020.
"Bank overflow?" -- you are guessing? :)
.area area1
.org 0x500
.db 0, 1, 2
.area area2
.org 0x501
.db 3
nothing overflows here. just output addresses and values like the old tool did. one can construct jump tables like that, having non-used entries to be initialized by nulls. so, overwriting is not a 100% error too.
from gbdk-2020.
@Zal0 Any preferences on this tool?
The "Bank overflow?" text was meant as a hint to the user about what might be going wrong (a question that occurs) and the title of this ticket does happen to be "bank overflow checking". :) No problem though, I can remove the hinting.
I could also change to printing "addresses and values", but a couple points in favor of summarizing the overlap instead:
- Since the address overlap can run into the 100-1000s of bytes, summarizing provides a more compact warning that doesn't scroll for multiple pages.
- Reporting the overlap size in bytes also makes it easier to figure out how much size needs to be reduced in cases of overflow (such as https://gbdev.gg8.se/forums/viewtopic.php?pid=4540)
- In order to report the actual changed values, the tool would need to mostly construct the ROM. It's do-able but seems like scope creep.
Also, for historical reference, here is a list of warnings that were produced by the old gbz80 linker. Some of which have equivalents in makebin
.
fprintf(stderr, "ERROR: address overflow (addr %lx >= %lx)\n", pos, ROMSIZE);
fprintf(stderr, "ERROR: bank overflow (addr %x > %x)\n", current_rom_bank, nb_rom_banks);
fprintf(stderr, "ERROR: address underflow (addr %lx < %lx)\n", pos, BANKSTART);
fprintf(stderr, "ERROR: only 1 32kB segment with 2 bank\n");
fprintf(stderr, "WARNING: possibly wrote twice at addr %lx (%02X->%02X)\n", pos, rtval[i], cart[pos/SEGSIZE][pos%SEGSIZE]);
fprintf(stderr, "ERROR: cartridge size overflow (addr %lx >= %lx)\n", pos, CARTSIZE);
fprintf(stderr, "WARNING: unsupported number of ROM banks (%d)\n", nb_rom_banks);
fprintf(stderr, "WARNING: unsupported number of RAM banks (%d)\n", nb_ram_banks);
from gbdk-2020.
WARINIG: Overwrite at 0x0200 with [0x01,0x11,0x08,0x04]
up to 16 bytes in a row
i don't think old values matter much for the user (new values too, you can't say what is it without maps in most of the cases). we also need a switch that treats warning as an error. because you not always see the warnings: might be useful for gb studio.
from gbdk-2020.
The switch is already in there:
By default it just prints warnings without changing an error code, but it can be instructed to treat the warnings as errors with the -e switch after the .ihx filename
from gbdk-2020.
Related Issues (20)
- Why background tiles displays randomly in the screen? HOT 1
- Include nixpkg derivation HOT 9
- lcc fails on casting anonymous function pointer HOT 3
- Test current sdcc (before 4.3.0 release) HOT 6
- Install on mac? HOT 3
- lcc unknown developer HOT 9
- 4.2 Release
- Unable To Compile HOT 3
- Pointer Error HOT 1
- Errors compiling on Windows with non-C:\ folder names that have spaces HOT 16
- mac installing
- Strip -p arg from mkdir in generated compile.bat files
- Cannot be opened because developer cannot be verified. How to start? HOT 2
- Cannot compile with 4.2.0 HOT 5
- set_bkg_based_tiles() bug when w > 4 HOT 2
- atoi.c:10: syntax error: token -> '__nonbanked' ; column 35 HOT 3
- png2asset: -source_tileset doesn't play nice with -use_structs HOT 2
- Logo example - CGB rom shows malformed image on DMG HOT 3
- 4.3.0 Release
- VSCode problem from 'BANKREF' when using png2asset HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gbdk-2020.