Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on January 16, 2011, 01:53:47 pm

Title: Clearing a GDB/String/etc???
Post by: aeTIos on January 16, 2011, 01:53:47 pm
Hi,

im busy with a program, and i have the code:

Code: [Select]
[010101->GDB1
...
[02->{GDB1}

and when i start the program over, the 010101 isnt stored in GDB1, but the 02

how to eliminate this 02?
thanx

aetios
Title: Re: Clearing a GDB/String/etc???
Post by: Binder News on January 16, 2011, 02:04:48 pm
This is what is called SMC (self modifying code). What it means is that the code is actually modifying part of itself (usually data, but I guess it could be actual code as well). Anyways, I think the TiOS is supposed to prevent this. Are you using Noshell?
Title: Re: Clearing a GDB/String/etc???
Post by: aeTIos on January 16, 2011, 02:12:49 pm
I use DCS. and I know that its SMC, but can you undo this?
Title: Re: Clearing a GDB/String/etc???
Post by: Binder News on January 16, 2011, 02:34:10 pm
Yea, I think there is something in the options. However, unless this prog is something you are only using for yourself, you need to either compile it for something other than DCS (which might make it not use SMC, but that's just a guess), or have a sub-routine that initializes all the data, call it on the actual initialization, then Goto it when you want to exit (so the Return will act as the final return)
Code: [Select]
...
sub(IN)
...
Goto IN

Lbl IN
.init data
Return
Title: Re: Clearing a GDB/String/etc???
Post by: Deep Toaster on January 16, 2011, 02:40:48 pm
It's because Doors and Mirage "copy back" the program after it's executed (not exactly but close enough), so any changes you do to it stay in the program. It doesn't matter how you compile it; the shells will still keep the updated version. To avoid that issue you'll just have to initiate the data yourself when the program starts.