Closed city41 closed 10 months ago
Doh, this was me. Trying to be too clever.
I have a very primitive "malloc", like this
#define SIZE 8000
u8 _mem[SIZE];
void* next = _mem;
void mem_reset() {
for (u16 i = 0; i < SIZE; ++i) {
_mem[i] = 0;
}
next = _mem;
}
void* mem_alloc(u16 size) {
void* cur = next;
next += size;
return cur;
}
Which has happily worked for a very long time. But when I include the debug stuff into my game (it's a "terminal" on the fix layer, kinda like the quake terminal), I got that address error left and right.
To fix it, all I did was change u8 _mem[SIZE]
to u16 _mem[SIZE]
. Since an address error is described as "Misaligned (odd) word or longword memory access.", I thought maybe handing out pointers to odd bytes is bad. Sure enough, it is.
Welp, there's a day down the drain :)
edit: Oh and sure enough, in the unibios handler, 100fad
is an odd address...
I am getting an address error in my game (unibios used to get a small clue on the exception)
This only happens when I include some debug stuff into my game which takes up a lot more ram. I am actively trying to locate the cause of this as we speak.
One thing I noticed in
ngdevkit.ld
is possibly theBIOSRAM
section is incorrect?This section notes that the bios's ram is 786 bytes in length and starts
10fcee
, but in the wiki it says it starts at10F300
and is 3,328 bytes long?I wonder if my game when the debug stuff is added, ends up using ram that should be reserved for the bios?
Anyway, I'll keep plugging away at this. I'll try to create a small repro as well.
btw this repros in Mame, on the mister, and on a real neo geo, but not in gngeo. I think using gngeo is dangerous, to be honest.