Author Topic: Question about Pointers, Program Size, and Location  (Read 2629 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Question about Pointers, Program Size, and Location
« on: May 04, 2010, 08:56:22 am »
I have a question, for anyone who know the answer. I've always wondered, lets say you have a program or appvar named A2. How is it possible, using assembly or axe or Celtic III, to figure how long the data is (how many bytes are in the program), so that if I try to write to the program, I know I am writing to the END of it, not to halfway through it or to the data following it in memory?

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Question about Pointers, Program Size, and Location
« Reply #1 on: May 04, 2010, 12:26:37 pm »
It Axe, you can do this:

:"prgmMYPROG"->Str1
:getcalc(Str1)->C
:{C-2}r->S

Puts the size of the program in S.  Basically, the size bytes come right before the data.

EDIT: by the way, you cannot change the size of the program without some pretty advanced assembly.  You either have to append data to the end ,which might cause the program to shift around in ram and you'll need to get a new pointer right after, OR you can put the entire calculator in edit mode and add as much data as you want, but you have to keep track of a bunch of pointers.  Either way you need to make sure you update the new size manually after changing it.
« Last Edit: May 04, 2010, 01:20:26 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Question about Pointers, Program Size, and Location
« Reply #2 on: May 14, 2010, 08:02:28 pm »
Moved to help and support