Author Topic: Just curious...  (Read 3373 times)

0 Members and 1 Guest are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Just curious...
« 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.




Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Just curious...
« Reply #1 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. :)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Just curious...
« Reply #2 on: June 06, 2010, 10:55:37 pm »
Yep, thanks.