Author Topic: Resetting Data?  (Read 2179 times)

0 Members and 1 Guest are viewing this topic.

Offline gibaoran

  • LV2 Member (Next: 40)
  • **
  • Posts: 37
  • Rating: +1/-0
    • View Profile
Resetting Data?
« on: November 23, 2011, 01:22:34 am »
Just a quick nooby question:

I make a pointer to some data
[0101020202etc -> GDB1

I compile and run, and at the end the data looks a bit different
[0000000000etc

Next time I run it it starts with [000000000etc instead of the [0101020202 I am adding a pointer to

So if your with me (which is hard because its late and I can tell what I have written makes little sense), how would I make it so every time I run a program it resets the data instead of using the previous runs data?

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Resetting Data?
« Reply #1 on: November 23, 2011, 01:49:45 am »
That's odd, static vars should always reset. Do you mind posting your code?
In-progress: Graviter (...)

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: Resetting Data?
« Reply #2 on: November 23, 2011, 04:39:00 am »
If you're using a shell like DCS or Mirage, those will write back changes you made to the program after quitting.  If you still want to use those shells, another alternative is to copy your static data to free ram using the Copy() command and then modify the data there instead of in the program itself.
« Last Edit: November 23, 2011, 04:39:41 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline gibaoran

  • LV2 Member (Next: 40)
  • **
  • Posts: 37
  • Rating: +1/-0
    • View Profile
Re: Resetting Data?
« Reply #3 on: November 23, 2011, 10:16:39 am »
If you're using a shell like DCS or Mirage, those will write back changes you made to the program after quitting.  If you still want to use those shells, another alternative is to copy your static data to free ram using the Copy() command and then modify the data there instead of in the program itself.

So I would lay out the data like I did before, then afterwards copy it immediately to a new pointer?
[0101020202etc -> GDB1
Copy(GDB1,GDB1A,length of GDB1(How do I get the length also?))