Author Topic: ASM help  (Read 4399 times)

0 Members and 2 Guests are viewing this topic.

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
ASM help
« 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?
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: ASM help
« Reply #1 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).
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: ASM help
« Reply #2 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
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: ASM help
« Reply #3 on: May 14, 2009, 01:38:14 am »
Aren't you limited to 8.x KB of executable code when using Ion?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: ASM help
« Reply #4 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.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: ASM help
« Reply #5 on: May 14, 2009, 01:04:13 pm »
Yeah Nostub is worse for that. Does Mirage and APPs solve this issue, tho?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: ASM help
« Reply #6 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.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Iambian

  • Coder Of Tomorrow
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 739
  • Rating: +216/-3
  • Cherry Flavoured Nommer of Fishies
    • View Profile
Re: ASM help
« Reply #7 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.
« Last Edit: May 14, 2009, 08:41:28 pm by Iambian »
A Cherry-Flavored Iambian draws near... what do you do? ...