SetPC() not doing what i expect #25
-
Hi, i'm trying to implement Moira in Atari ST emulation, i have a few issues, i'll tackle them one at a time. firstly, memory is initialized before reset and moira correctly reads the reset vector correctly as 0xfc0020, however on cold reset i need to change the PC to 0xfc0000, i can do this but although i use SetPC and SetPC0, and can confirm in the debugger that these are set, moira still executes at 0xfc0020 and this crashes. i can solve that specific case using the Read16OnReset, and thats fine, my concern is, why doesnt execution change when i change the PC? there are a few places i need to do this. i wondered if it was prefetch, but there seems to be no prefect clear commands i can run? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The issue is the prefetch queue, as you've already pointed out. To redirect program execution, Moira has a separate function inside the debugger (see MoiraDebugger.h): //
// Changing state
//
// Continues program execution at the specified address
void jump(u32 addr); The function first sets the PC and updates the prefetch queue afterward: void
Debugger::jump(u32 addr)
{
moira.reg.pc = addr & ~1;
moira.fullPrefetch<C68000, POLL>();
}
Your project sounds interesting. I'd like to see Moira inside an ST emulator someday. |
Beta Was this translation helpful? Give feedback.
The issue is the prefetch queue, as you've already pointed out. To redirect program execution, Moira has a separate function inside the debugger (see MoiraDebugger.h):
The function first sets the PC and updates the prefetch queue afterward:
jump
is a public function, so you can call it viamoira.debugger.jump(<addr>)
.Your project sounds interesting. I'd like to see Moira inside an ST emulator someday.