Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: Masinini on January 04, 2011, 08:01:06 pm
-
So I decided to start learning axe, with my limited know how of the codes. I made a movement routine that ended up resetting my ram. Anyone have a movement routine that works and is not an unbreakable loop?
-
By movement, are you talking about simply moving around a sprite on the screen?
There's a thread around here talking about that...
edit: Here it is (http://ourl.ca/8578)
-
Easy way to make a program not have an infinite loop:
First line of code (after description line)
repeat getKey(0) or getkey(15), for any key or for clear
your code
goes in
this area
end
that way, unless it actually crashes the calc, you can get out simply by pressing clear, or, any button if you used getkey(0)
-
I made a movement routine that ended up resetting my ram.
Get used to that :P It'll probably happen a lot more before you learn how not to [purposefully] reset your calc.
On a related note, never do Asm(C7 unless something freaks out the OS and you have no other way of shutting down the calc.
-
What does Asm(C7 do? And is it done on the homescreen with Basic or Axe?
-
It's compiled with Axe (to RST $00) and it's basically a simulated RAM clear... with all of the fun [and data loss] of a real one.
-
just RAM right?, not Archive?
-
Yep.
I used it to shut down my calc awhile back when some OS hook failed and disabled the 2nd+On combination on my calc. Pulling the batteries didn't work either, so it was the only option. Yes, Axe saved my calc ;D
-
You could've done that in BASIC too: AsmPrgm: C7 then ran it from the homescreen with Asm()
-
Nice trick to know, although I personally just go in the MEM menu. I guess it can be useful if a normal reset or ON+DEL fails
-
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
-
So I decided to start learning axe, with my limited know how of the codes. I made a movement routine that ended up resetting my ram. Anyone have a movement routine that works and is not an unbreakable loop?
Here -- try this:
.TEST
[FFFFFFFFFFFFFFFF]->Pic1
10->X->Y
Repeat getKey(15)
ClrDraw
getKey(3)-getKey(2)+X->X
getKey(1)-getKey(4)+Y->Y
Pt-On(X,Y,Pic1)
DispGraph
End
(Of course, when you're typing this out on your calc, you don't need to add the indents or spaces)
The code should display a solid black square that moves around with the arrow keys -- press [CLEAR] to exit the program.
-
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
For 1 minute, I assume, right? Because I removed all 5 batteries once, then immediately put them back, yet my RAM was still intact.
-
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
For 1 minute, I assume, right? Because I removed all 5 batteries once, then immediately put them back, yet my RAM was still intact.
Hmm, that's weird. Were you on the homescreen when you pulled the batteries? Because pulling the batteries while on the home screen doesn't cause a RAM clear -- you have to be running a program or something.
-
Ok. thanks for that, Michael_Lee. I'm also learning axe, and am planning on a short game involving movement. this helped a bit on understanding the syntax in general.
-
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
For 1 minute, I assume, right? Because I removed all 5 batteries once, then immediately put them back, yet my RAM was still intact.
Hmm, that's weird. Were you on the homescreen when you pulled the batteries? Because pulling the batteries while on the home screen doesn't cause a RAM clear -- you have to be running a program or something.
Even when removing the lithium one too? And yeah I was on the home screen.
-
Well...
I don't know about the lithium -- I've never had a reason to take it out, so I've no clue as to what would happen.
-
Okay, So I was thinking about Movement programs, and I was wondering. I made a program That went like this.
.Movement
[FFFFFFFFFFFFFFFF->pic1
20->X
20->Y
Repeat getkey(54)
Pt-change(X,Y,pic1
dispgraph
Pt-change(X,Y,pic1
X+(Getkey(4) and X=/= edge )-(getkey(1) and x=/=1) -> X
Y+(getkey(3) and Y=/= Edge)-(getkey(2) and Y=/=1)-> Y
End.
When it displayed it, it displayed it at 20 20, then moved it to like 1, 6. When I tried to move the dot, it would move one space, and then go back to 1,6. Any idea what i am doing wrong?
-
You can't use it like "getKey(1) and X!=1" That will evaluate like "(getKey(1) and X)!=1", which is not what you want.
To get the correct order of operations, you either need to put parentheses around (X!=1) or else change the order to "X!=1 and getKey(1)"
Note: This goes for all of them, not just the part with getKey(1) ;)
-
Alright, I understand what you mean. it was waiting for 1 and X to be pressed. I'll try a re-write tomorrow. And Imma post any other questions I have from now on.