Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Spyro543 on November 22, 2011, 08:00:40 pm

Title: Learning Axe! And made a program
Post by: Spyro543 on November 22, 2011, 08:00:40 pm
Ok, I am learning Axe! Yay! <insert applause here>
My program lets you use the arrow keys to move a circle around the screen and change its velocity!!! :w00t:
Added a cool feature!
The circle gets larger the faster it's going!
It's still a bit buggy, but here it is!
(http://i.imgur.com/yehZ3.gif)
At the end, the circle stops instantly. Do this with [DEL]. [CLEAR] exits the program.
Attached : SVELDRAW is the source, and VELOCITY is the compiled program.
Source code:
Code: [Select]
:.VELOCITY
:0→A
:0→B
:1→X
:1→Y
:While 1
:Pause 180
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(56)
:0→A
:0→B
:End
:If getKey(15)
:Return
:End
:Y+B→Y
:X+A→X
:If X>>96
:1→X
:End
:If X<<1
:96→X
:End
:If Y>>64
:1→Y
:End
:If Y<<1
:64→Y
:End
:A+B→R
:If R<<1
:If R=0
:Circle(X,Y,1)
:Else
:Circle(X,Y,‾R)
:End
:Else
:Circle(X,Y,R)
:End
:DispGraphClrDraw
:End
Optimizations, suggestions, bug reports?
Title: Re: Learning Axe! And made a program
Post by: Deep Toaster on November 22, 2011, 08:03:43 pm
You need to use >> for signed comparison. X>96 returns 1 when X is less than zero (since the unsigned value of a negative number is somewhere between 32,768 and 65,535). Same thing with Y.
Title: Re: Learning Axe! And made a program
Post by: epic7 on November 22, 2011, 08:03:47 pm
/me applauds
 (http://www.omnimaga.org/Themes/default/images/gpbp_arrow_up.gif)

I found that alot of my bugs were involved with that.
I changed the check for the left side of the screen to >100, but does <<1 work for that?
Title: Re: Learning Axe! And made a program
Post by: mrmprog on November 22, 2011, 08:04:59 pm
Applause! I'll look at the code.
Title: Re: Learning Axe! And made a program
Post by: annoyingcalc on November 22, 2011, 08:09:41 pm
(http://www.omnimaga.org/Themes/default/images/gpbp_arrow_up.gif) Great! That is an awesome start!
Title: Re: Learning Axe! And made a program
Post by: parserp on November 22, 2011, 09:02:37 pm
Hooray!!!!! it seems like yesterday that i was making these programs... :D
Title: Re: Learning Axe! And made a program
Post by: Spyro543 on November 23, 2011, 03:46:17 pm
Added a cool feature!
The circle gets larger the faster it's going!
It's still a bit buggy, but here it is!
(http://i.imgur.com/yehZ3.gif)
At the end, the circle stops instantly. Do this with [key][DEL][/key]. [key][CLEAR][/key] exits the program.
Attached : SVELDRAW is the source, and VELOCITY is the compiled program.
Source code:
Code: [Select]
:.VELOCITY
:0→A
:0→B
:1→X
:1→Y
:While 1
:Pause 180
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(56)
:0→A
:0→B
:End
:If getKey(15)
:Return
:End
:Y+B→Y
:X+A→X
:If X>>96
:1→X
:End
:If X<<1
:96→X
:End
:If Y>>64
:1→Y
:End
:If Y<<1
:64→Y
:End
:A+B→R
:If R<<1
:If R=0
:Circle(X,Y,1)
:Else
:Circle(X,Y,‾R)
:End
:Else
:Circle(X,Y,R)
:End
:DispGraphClrDraw
:End
Optimizations, suggestions, bug reports?
Title: Re: Learning Axe! And made a program
Post by: epic7 on November 23, 2011, 04:02:53 pm
Optimizations:

:0→A
:0→B
:1→X
:1→Y

Can be 1 line. It optimizes to
:0->A->B+1->X->Y

Instead of doing
A+1->A and
A-1->A,
Use

A++ and
A--

Instead of
If R=0
Use
!If R

And do you need the >>
When seeing if its greater than 96 and 64?
I don't think its needed but I might be wrong because I'm not experienced with them since I just figured out they existed yesterday :P
Title: Re: Learning Axe! And made a program
Post by: ztrumpet on November 23, 2011, 04:09:03 pm
That looks really cool.  I like how the circle gets bigger with its velocity; it's a cool effect.
Great job on your first Axe program. ;D
Title: Re: Learning Axe! And made a program
Post by: Spyro543 on November 23, 2011, 04:10:26 pm
I had countless problems getting it work (especially if I moved up or left or stood still the circle changed into this huge X thing :O) but I finally got it working! (Took a few periods in school tho :P)
Title: Re: Learning Axe! And made a program
Post by: epic7 on November 23, 2011, 04:14:38 pm
I was programming in school before. My teacher took it away and I started freaking out. She said she thought I was doing "innapropriate things" because of my "over-the-top reaction" :P
Title: Re: Learning Axe! And made a program
Post by: parserp on November 23, 2011, 04:18:42 pm
I was programming in school before. My teacher took it away and I started freaking out. She said she thought I was doing "innapropriate things" because of my "over-the-top reaction" :P
is that even possible on a calc?
Title: Re: Learning Axe! And made a program
Post by: epic7 on November 23, 2011, 04:27:27 pm
That's exactly what I was thinking when she said that.
Title: Re: Learning Axe! And made a program
Post by: Jonius7 on November 24, 2011, 02:09:03 pm
That sucks. Oh well, teachers are hardly ever appreciating or even acknowledging calculator program.
Title: Re: Learning Axe! And made a program
Post by: Spyro543 on December 01, 2011, 03:23:34 pm
I turned the velocity program into some fun bouncy program :D
Attached is a screenshot, SVELDRAW (source), and BOUNCE (executable). Press [CLEAR] to exit, [DEL] to reset the velocity, and arrow keys to move the ball.

That sucks. Oh well, teachers are hardly ever appreciating or even acknowledging calculator program.
Well, I showed this program to my science teacher, and he really liked it (both the program and that I'm interested in physics.)