In a program I'm making I'm attemting to implement a teacher key. To clarify what I mean by that: the user will press a button (Sto-> at this point), and it will quit very fast to the Homescreen, bypassing the shell it's being run from (DCS, MOS, Crunchy etc...). The two possible strategies I've come up for doing this are as follows:
-bjump(_JForceCmdNoChar)
-Find out what level the stack is at before it ran the shell and set SP = to that.
I've tried the former method, but when it quits it leaves the homescreen in a mess of characters. I tried to fix this by loading 0 into ever byte of TextShadow before I bjump(_JForceCmdNoChar), but no dice. It appears that bjump(_JForceCmdNoChar) itself screws with TextShadow. This leaves me conflicted. Although this way is much easier, it's not very professional becuase the Homescreen looks like a mess.
I have yet to attempt the latter method because I'm confused as to where to start. I guess I could try setting sp to one byte higher in memory each time until I achieve the desired result, but will that really work?
Does anyone have any suggestions or different methods for quickly quitting by bypassing a shell?
Edit: Solved my own question, but I will leave the topic up here for others if they want to learn. All you have to do is
Code:
Make sure that you clear out TextShadow first as most shells like to use that for variable storage.
-bjump(_JForceCmdNoChar)
-Find out what level the stack is at before it ran the shell and set SP = to that.
I've tried the former method, but when it quits it leaves the homescreen in a mess of characters. I tried to fix this by loading 0 into ever byte of TextShadow before I bjump(_JForceCmdNoChar), but no dice. It appears that bjump(_JForceCmdNoChar) itself screws with TextShadow. This leaves me conflicted. Although this way is much easier, it's not very professional becuase the Homescreen looks like a mess.
I have yet to attempt the latter method because I'm confused as to where to start. I guess I could try setting sp to one byte higher in memory each time until I achieve the desired result, but will that really work?
Does anyone have any suggestions or different methods for quickly quitting by bypassing a shell?
Edit: Solved my own question, but I will leave the topic up here for others if they want to learn. All you have to do is
Code:
ld sp,$FFE1
ret
Make sure that you clear out TextShadow first as most shells like to use that for variable storage.