The stack wouldn't need to be used at all if you use jmp istead of jsr to call the JumpEngine.Actually, I thought about it more..keeping the same structure, and using x,y for the table pointer (or zeropage) is okay, but then you would need two RTS or still use PLA,PLA,RTS to return to the code that first called into the jump table, so it might as well be done this way.
Nintendo Jump tables
Moderator: Moderators
Re: Nintendo Jump tables
I must agree with Movax12 that it would have been easier to just load the x,y registers with the table address and then call the JumpEngine. It's faster. And also uses less code, but I don't know how much tables SMB uses (loading the address before the JumpEngine call costs additional code).
Re: Nintendo Jump tables
And how would you return, then?Yggi wrote:The stack wouldn't need to be used at all if you use jmp istead of jsr to call the JumpEngine.
Re: Nintendo Jump tables
By RTS? "OperModeExecutionTree" still needs to be called using JSR.tokumaru wrote:And how would you return, then?Yggi wrote:The stack wouldn't need to be used at all if you use jmp istead of jsr to call the JumpEngine.
I meant, the stack wouldn't be needed for the JumpEngine-Part.