Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: trevmeister66 on May 13, 2009, 09:30:12 pm

Title: ASM help
Post by: trevmeister66 on May 13, 2009, 09:30:12 pm
Well I started (re)learning ASM today, and I was actually understanding most of it, but I had one question: Is there a way to store a variable (for example: a hi score) without using an appvar?
Title: Re: ASM help
Post by: calc84maniac on May 13, 2009, 10:51:54 pm
Well I started (re)learning ASM today, and I was actually understanding most of it, but I had one question: Is there a way to store a variable (for example: a hi score) without using an appvar?
Well, if you're coding for an ION-compatible shell, all changes to your program during execution are saved. If you're going no-stub, you can always locate the original copy of your program in memory and save the bytes there (when running nostub, your program's name is in OP1, ready for lookup).
Title: Re: ASM help
Post by: trevmeister66 on May 14, 2009, 01:08:09 am
Alright thanks. I'll try giving that a shot, but I think I'll probably need more space than available, so I'll probably just end up doing an appvar
Title: Re: ASM help
Post by: DJ Omnimaga on May 14, 2009, 01:38:14 am
Aren't you limited to 8.x KB of executable code when using Ion?
Title: Re: ASM help
Post by: calc84maniac on May 14, 2009, 09:32:58 am
Aren't you limited to 8.x KB of executable code when using Ion?
It's worse in nostub though, because there are two copies of the program in memory, and TI even makes it error if the program is over 8.x KB.
Title: Re: ASM help
Post by: DJ Omnimaga on May 14, 2009, 01:04:13 pm
Yeah Nostub is worse for that. Does Mirage and APPs solve this issue, tho?
Title: Re: ASM help
Post by: calc84maniac on May 14, 2009, 02:45:09 pm
Yeah, Mirage/ION solve this by moving the program, rather then copying, to the executable location. You still can't have more than 8.x KB of executable code because of a hardware-imposed limit. APPs, on the other hand, can have as much executable code as they want because they are executing directly from Archive.
Title: Re: ASM help
Post by: Iambian on May 14, 2009, 08:38:27 pm
For ASM programs, the problem is the *executable* code that you're limited to. From the first post, I assume you're trying to store *data*. As long as the material isn't executed, but only read, you can easily go higher than that "limit". A couple of the large games out there (Gemini, Joltima, etc) makes use of this fact by putting pretty much ALL of the data at the end so that when the code is copied to the executable location, nothing is ever being *run* past the end of that limit...

Most specifically, it's addresses $C000-$FFFF that doesn't allow code execution, except under special circumstances that doesn't exist on the TI-83+ (non-SE calcs) and a few other lesser ones.

To further answer the first question, you can write back to your program in a defined space as opposed to some saferam value that doesn't get saved back with your program.

To further affirm some of the other responses in the thread, ION and a few other types of programs meant to run in shells will preserve changes (unless the user set the shell to not do so). Nostub by default doesn't save changes, as the program put at $9D95 is a temp (copy) program and is erased after the ASM program hands execution back to the OS.