So I decided to try my hand at making my own program! I saw this idea on another post on this forum, but forgot who it was, so I'm sorry I can't give credit to the person who inspired me. I will also give credit to the TI-BASIC Developer website for 1) teaching me how to use TI-BASIC and 2) teaching me the optimized code for movement on the graph screen. Good Idea Sorry for all of the credits, but I would feel guilty if I didn't include them.
The program will be all BASIC, but then might be converted to ASM when i learn enough. If needed/wanted I can post the source code a because I will be needing lots of help working through this.
Thanks
Cool! Good luck with this, although I would definitely wait to learn asm until you have the finer points worked out. It can sometimes be a challenge. Wink
When it comes to learning ASM, I think it depends on what experience you have with other languages. If you understand C and pointers, etc. then that certainly helps to understand some of the concepts of direct memory access Smile

I think it just takes time, patience and practice. Whilst I don't think many people refer to it these days, I learnt mostly from ASMGuru, and also by going over and over through the Texas Instruments TI-83 hardware/assembly documentation (a bunch of text files documenting ROM calls, significant RAM locations, etc.)

Nowadays I think the "28 Days" tutorials are probably the best starting point.

Edit: PS Good luck and have fun! Smile
JamesV wrote:
When it comes to learning ASM, I think it depends on what experience you have with other languages.

Ok I'll admit it, I have little to no programming experience with anything other than TIBASIC, but I have plenty of time to learn.

Ok so I ran into one of my first questions. I was looking at TI Developer when I saw the article about piecewise expressions. Then I looked at my code and saw this line:

Code:
If K=22: -C->C

Can this be changed into a piecewise expression?[/code][/quote]
Sure, but it probabaly won't save you any space, and I think it might even be one byte larger. You can do this:


Code:
C-2C(K=22->C
It works! Thanks a bunch!
MateoConLechuga wrote:
Sure, but it probabaly won't save you any space, and I think it might even be one byte larger. You can do this:


Code:
C-2C(K=22->C


It may be larger in some cases but it will always be faster than the If from what I recall. and where tricks like that become useful is for movement code where you can do something like

Code:
C+(K=24)-(K=26)->C:abs(remainder(C,94->C

to handle the rollover at the edge of the screen.
Yeah the code I got from TT Developer was:

Code:
min(60,max(0,A+sum(ΔList(K={25,34->A
Min(92,max(1,B+sum(ΔList(K={24,26->B


I understand some parts like the 60, 92 and a little bit of the Boolean logic, but other than that, it kinda confuses me. Could someone explain some of this? Thanks[/code]
Yeah, I personally don't use this because it seems slower to me than just doing a Boolean test, but here goes my explanation:


Code:
sum(ΔList(K={25,34 and sum(ΔList(K={24,26

This ΔList gets the difference between the two terms, so if you do K={25,34} and K=25, the list would then be {1,0}. Doing a ΔList gives you 1, and -1 if K=34. Does that make sense?


Code:
max(1, and max(0,

These just get whichever one is larger, which prevents it from moving somewhere it shouldn't. max(1) controls X, the other controls Y. max(a,b) returns a if a>b.


Code:
min(60 and min(92

Same as above, Min(92) controls X, the other controls Y. min(a,b) returns a if a<b.
MateoConLechuga wrote:
Yeah, I personally don't use this because it seems slower to me than just doing a Boolean test, but here goes my explanation:


Code:
sum(ΔList(K={25,34 and sum(ΔList(K={24,26

This ΔList gets the difference between the two terms, so if you do K={25,34} and K=25, the list would then be {1,0}. Doing a ΔList gives you 1, and -1 if K=34. Does that make sense?


Code:
max(1, and max(0,

These just get whichever one is larger, which prevents it from moving somewhere it shouldn't. max(1) controls X, the other controls Y. max(a,b) returns a if a>b.


Code:
min(60 and min(92

Same as above, Min(92) controls X, the other controls Y. min(a,b) returns a if a<b.


Well it makes a lot more sense than previously, so thanks a bunch! Now I understand the min and max command, but I'm still a little confused on the Δlist command. And, why would this be slower than the Boolean test? It seems pretty compact to me.
Think of it this way: ΔList just subtracts each previous term from the current one. So if you had the list {0,1}, the list would become {0-1}, which is just -1. ΔList shrinks the list size by one.

I consider it somewhat slower because sometimes it is not necessary to do all of these bounds checking, and accessing a list element, taking the sum, and comparing K to two numbers takes more time than just simply checking it.
I have to say, its been a while since I've done TI basic but that is some pretty slick code, nice work to however came up with that trick.

That said I feel like A+(K=25)-(K=34 is more readable and possibly faster to get the same thing as A+sum(ΔList(K={25,34

As Mateo said the List manipulation and math can be slower than the functions on reals and in cases like this reduce the readablilty of the code. If size is your goal the delta list method is good but for speed plain boolean tests are better as no list related operations are involved.
Thanks you guys, I'll take all of this into advice!

PS: Mateo, nice avatar!
Ok, so I got really distracted by the need for a Pxl and point converter. Is there anyone out there who has knowledge of such a program? I'm making it now, it's going to be really simple and uncomplex, so here's the code so far:

Code:

ClrHome
Disp "Assuming ΔX and ΔY=1"
Input "Xmin: ",X
Input "Ymax: ",Y
1->A
1->B
Repeat K=21            //modified TI Developer's movement code
getKey->K
If Ans
Pxl-Off(A,B
min(61,max(0,A+(K=25)-(K=34->A
min(92,max(1,B+(K=24)-(K=26->B
//Pxl to point conversion formula is here
Pxl-On(A,B
Text(1,1,A
Text(7,1,B
Text(_,_,_
Text(_,_,_
End

That's the gist of it, the blanks will be replace later with numbers/variables. If there is a download for something like this that would make it easier, but until then I'll just keep on coding. I also plan to edit/update this post in the future since I really don't feel like making a new post and typing up all that again. Very Happy [/code]
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement