From 25828417c104efccedbc915aeb69d208ec2360a5 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Tue, 16 May 2023 23:11:05 +0000 Subject: [PATCH] m68k: more sensible stack pointer value This accidentally worked as long as the Sound CPU program did not do meaningful stack manipulation. Indeed, none of the Sound CPU programs I have written so far do anything with the stack. Despite this "accidentally working" on real hardware, mednafen's m68k emulation appears to "stall" the Sound CPU when the stack pointer wraps around to a memory that does not exist. This table was originally written when I was first learning about the Saturn "sound block" memory map. I did not know exactly how large the installed sound RAM was, as the manual mentions 8Mbit, 4Mbit, and 1Mbit as being possibilities. Now that I know the production Saturns have 4Mbit installed, I am able to come up with a reasonable value for the stack pointer. --- m68k/vectors.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m68k/vectors.s b/m68k/vectors.s index 05711ce..207cd3f 100644 --- a/m68k/vectors.s +++ b/m68k/vectors.s @@ -1,6 +1,6 @@ .section .vectors - .long 0x0 /* Reset - initial stack pointer */ + .long 0x7fffc /* Reset - initial stack pointer */ .long start /* Reset - initial program counter */ .long start /* Bus error */ .long start /* Address error */