Spencer wrote:Why does everyone do the push? If you're returning right after the call ...
Well, if you wrap it into a call, that's basically pushing. No-one said there would be a return immediately afterwards.
Using push de \ ret is basically the same as ex de,hl \ jp (hl), except that it has a different side-effect: it destroys a word in memory instead of swapping two registers. Also, it's slower because of this memory access. But you can use it, yes.
It's easier to understand to me, i'll just experiment a bit with it and see what happens (and im not repeatedly calling a program so those 3 or 4 extra T-states dont really matter anyway)
Also, keep in mind that you just can't "call" any old regular ASM program. You have to copy or move its code to $9d95 so that its lds and jps/calls are correctly positioned.
ofcourse, the labels would be messed up, but all relative jumps should be fine, and loading anything else then a label's pointer..
but it shouldnt be a problem..
could i just copy it to the end of the calling program?
(ofcourse with a different progstart, namely the end of the calling program +1)
King Harold wrote:could i just copy it to the end of the calling program?
(ofcourse with a different progstart, namely the end of the calling program +1)
Moving around files is a tricky business. As long as the routine in question doesn't rely on TIOS variables in any way, you can get away with swapping it into that place and swapping back after it finished running. But if it is supposed to run from a specific location, and you don't want to assemble it together with the main program for some reason, using a saferam area (e.g. savesscreen) is a better idea, because it doesn't mess up user memory.
Moving files around isn't that hard, Venus does it really quickly, and CrunchyOS does it. Venus does it in the best way I've ever seen, it even uses an undocumented TIOS romcall to speed things up.
You know your hexadecimal output routine is broken when it displays the character 'G'.