devinacker / bsnes-plus

debug-oriented fork of bsnes
http://bsnes.revenant1.net
327 stars 94 forks source link

Uninitialized memory pattern assignment #354

Open qwertymodo opened 7 months ago

qwertymodo commented 7 months ago

I'm aware that there has been a fair amount of research into the way that the original hardware uninitialized RAM works, and certain things break if the emulator initializes RAM in certain ways, but outside of actual gameplay, there are situations when it is useful to be able to detect uninitialized memory, (e.g. when loading SPC dumps into a disassembler, knowing what memory regions are still uninitialized allows you to completely ignore them during disassembly, instead of accidentally trying to decode garbage as code). One helpful way to enable this detection is to allow initializing of the entire address space with specific patterns, so you can locate those patterns during analysis. There are a handful of common patterns that are used, such as alternating 0x55,0xAA bytes, but allowing the user to input their own pattern would be nice as well (I personally like to use 0xDEADBEEF).

qwertymodo commented 7 months ago

On second thought, I suppose the usage.bin can be used for this purpose on the main bus, but some of the peripherals like the SPC and on-cart chips don't show up in the usage.bin file, so maybe this might only be relevant for those memory regions. Or maybe an alternate feature request would be to usage log all of those memory regions that aren't currently logged. In that case, I would suggest separate files for each device, rather than trying to tack them onto the existing usage.bin. The SPC ARAM is my current use case, but the GB memory bus for SGB, SA-1 BW-RAM/I-RAM etc also apply.