Post subject: emu.getregisters (SNES)
HHS
Active player (282)
Joined: 10/8/2006
Posts: 356
How can I access the contents of registers A, D and DB? And what is the meaning of MDR, RD, SP, Vector and Z in the table returned by emu.getregisters?
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
SP should be the stack pointer, which keeps track of the head of the stack, it's a very important pointer when you trace PUSH / POP opcodes.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
you already knew emu.getregisters returns a table. so why not try getting ["A"] from the table? MDR - "memory data register" (google it) RD - I think this is the last byte read from memory? it's a cpu internal state, probably only used in the middle of instructions. I doubt we need to be exposing this. Vector - the address of the IRQ about to get executed.. it's not clear if this is a real thing at all, it may just be a BSNES implementation detail. It's probably exposed through emu.getregisters for no good reason Z - this appears to be a "Z index" register used to re-base zero page operations somehow. I'm not sure if it is active in the SNES version CPU, but I found it in BSNES so I exposed it. If someone can confirm whether it's operational, I might could remove it.
HHS
Active player (282)
Joined: 10/8/2006
Posts: 356
*facepalm* Somehow I failed to notice that A, D and DB were indeed in there as they should be (my output had just gotten cut off at the start, for some reason). "SP" is not the stack pointer, though. The stack pointer is "S". Is "A" the low 8 bits of the A register, while "AA" is the entire register? I also see both D and DP in there. Are they aliases of each other?
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
aa is CPU internal crap, ignore it. dp is CPU internal crap, ignore it. in other words, everything is 100% normal and theres some extra crap. I wish we would have this documented somewhere. I think I'll just take out the extra crap. It upsets me if someone who knows what an A register is has his time wasted by wondering wtf an AA is.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3600)
Joined: 11/3/2004
Posts: 4739
Location: Tennessee
Also, note that if you know what register you want, it would be simpler to use emu.getregister("A") The main point of emu.getregisters() is that shows you what is available for a given core
It's hard to look this good. My TAS projects