Omnimaga

Calculator Community => TI Calculators => General Calculator Help => Topic started by: Deep Toaster on June 06, 2010, 07:06:59 pm

Title: Just curious...
Post by: Deep Toaster on June 06, 2010, 07:06:59 pm
I don't really need to know this, since I've given up ASM anyway, but I never understood a certain concept, and it's still haunting me every day. :( So a calculator copies a program, whether it's assembly or BASIC, to $9D95 to call it, right? So what happens when there's a subroutine? How does it run that?

Just curious.
Title: Re: Just curious...
Post by: calcdude84se on June 06, 2010, 10:39:36 pm
Not BASIC, I don't think, that's why you can run 15KB basic programs but not 15KB ASM programs (ignore the code size limit for right now)
For ASM, you normally don't use other programs containing subroutines (when's the last time you saw an ASM lib for ASM programmers?) The only calls that occur to outside of a program are bcalls, which run from where they are in the OS, and calls to shells like ion, mirageos, doorscs, etc. Those are also written to run from where they are. (Apps are in $4000-$7FFF, btw)
If for some reason you did make an asm library (not a very practical idea in ti's os), it would have to either be completely relative (no ld, call, or jp commands referring to w/in the program), or you have to have a way to find the current value of the PC (for which you have to know where certain code is, I guess the program that uses the library could set up some code at a certain free RAM location, statvars for instance, that contains something like ld hl,(sp) \ ret, which just returns the current PC of the caller in hl). But doing relative calculations is messy, unless it can be compactly done with, say, RST's, which are part of the OS and therefore unchangeable.
Well, that was long. I hope I answered your question. :)
Title: Re: Just curious...
Post by: Deep Toaster on June 06, 2010, 10:55:37 pm
Yep, thanks.