Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add usage map import for other CPUs #56

Open
binary1230 opened this issue May 17, 2021 · 1 comment
Open

add usage map import for other CPUs #56

binary1230 opened this issue May 17, 2021 · 1 comment

Comments

@binary1230
Copy link
Collaborator

binary1230 commented May 17, 2021

So our usage map import works great for main CPU

In the BSNES "-usage.bin" files output though, it contains usage info for all of the various kinds of CPUs.

Right now we're just reading the first part of that file (main CPU) and ignoring the rest (SA1, SFX, SPC, etc)
looks like this:

We can totally parse that stuff though :)

BSNES code is doing stuff like this:

fp.read(SNES::cpu.usage, 1 << 24);
fp.read(SNES::smp.usage, 1 << 16);

if (SNES::cartridge.has_sa1())
    fp.read(SNES::sa1.usage, 1 << 24);

if (SNES::cartridge.hassuperfx())
    fp.read(SNES::superfx.usage, 1 << 23);

if (SNES::cartridge.mode() == SNES::Cartridge::Mode::SuperGameBoy)
    fp.read(SNES::supergameboy.usage, 1 << 24);

so we'd have to replicate that to read these files. one snag is they're calling SNES::cartridge.has_sa1(), which means we may need the same detection routines that BSNES has to know what data is next in the file. that's... kinda unfortunate, maybe we should add some kind of tagging into the BSNES file format so we don't have to detect the file format/etc.

@binary1230
Copy link
Collaborator Author

other random note for me, ignore this. (about tracelogs)

// my code in BSNES (prob doing something old now)
void Tracer::outputSgbTrace() {
    char buf[256]; int len;
    if (traceOutputFormatIsText) {
        
		
		SNES::supergameboy.disassemble_opcode(buf, SNES::cpu.regs.pc);
		                                           ^^^^^^^^^^^^^^^^^
												   should be: SNES::supergameboy.opcode_pc
		
		
        len = strlen(buf) + 1; // byte size = string + null term
    } else {
        // TODO: implement // SNES::supergameboy.disassemble_opcode_bin(buf, SNES::cpu.regs.pc, len); // binary
        return; // TODO: not supported just yet
    }
    outputTrace(buf, len);
}




my code always said  SNES::cpu.regs.pc
their code now uses: SNES::supergameboy.opcode_pc
or 					 *.opcode_pc


// their code:
    unsigned addr = SNES::supergameboy.opcode_pc;
    if(!traceMask || !(traceMaskSGB[addr >> 3] & (0x80 >> (addr & 7)))) {
      char text[256];
      SNES::supergameboy.disassemble_opcode(text, addr);
      tracefile.print(string() << text << "\n");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant