Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - indubitably

Pages: [1]
1
ASM / Programming help
« on: September 30, 2009, 11:54:15 pm »
I was bored in class so I decided to try and make a ddr type game.
I did so and i like it, but it slows down over time and I cannot figure out how to prevent this.
Is this a problem with my code or is it the calculator?
I didn't think it was the calc because there are much bigger games that keep a constant speed.
Also I tried the program on an emulator and it still slowed down. I cannot find any reason why this would happen in the code.

Thanks for any help in advance!

Link:
http://www.ticalc.org/archives/files/fileinfo/421/42167.html


Code: [Select]
:ClrHome
:0→S
:9→O
:9→P
:9→Q
:9→R
:Goto Z
:Lbl A
:0→X
:0→A
:While X=0
:(A+1)→A
:If A=10
:Goto B
:getKey→X
:End
:Goto B
:Lbl B
:If X=24
:Goto 1
:If X=25
:Goto 3
:If X=26
:Goto 4
:If X=34
:Goto 2
:If O=2
:(S-1)→S
:If P=2
:(S-1)→S
:If Q=2
:(S-1)→S
:If R=2
:(S-1)→S
:Goto X
:Lbl 1
:If O=2
:Then
:(S+1)→S
:9→O
:Goto X
:Else
:(S-1)→S
:Goto X
:End
:Lbl 2
:If P=2
:Then
:(S+1)→S
:9→P
:Goto X
:Else
:(S-1)→S
:Goto X
:End
:Lbl 3
:If Q=2
:Then
:(S+1)→S
:9→Q
:Goto X
:Else
:(S-1)→S
:Goto X
:End
:Lbl 4
:If R=2
:Then
:(S+1)→S
:9→R
:Goto X
:Else
:(S-1)→S
:Goto X
:End
:Lbl Z
:randInt(1,4)→M
:1→N
:Goto X
:Lbl X
:If N=0
:Goto Z
:(N-1)→N
:If M=1
:Then
:If O=9
:(O-1)→O
:End
:If M=2
:Then
:If P=9
:(P-1)→P
:End
:If M=3
:Then
:If Q=9
:(Q-1)→Q
:End
:If M=4
:Then
:If R=9
:(R-1)→R
:End
:0→M
:Goto Y
:Lbl Y
:ClrHome
:If O≤8
:Then
:Output(O,7,"<")
:(O-1)→O
:End
:If P≤8
:Then
:Output(P,8,"V")
:(P-1)→P
:End
:If Q≤8
:Then
:Output(Q,9,"^")
:(Q-1)→Q
:End
:If R≤8
:Then
:Output(R,10,">")
:(R-1)→R
:End
:Output(1,1,S)
:Output(3,6,"-"
:Output(3,11,"-"
:If O=0
:9→O
:If P=0
:9→P
:If Q=0
:9→Q
:If R=0
:9→R
:Goto A

Pages: [1]