Author Topic: Ti Basic to Axe  (Read 8081 times)

0 Members and 1 Guest are viewing this topic.

Offline Dreeass

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Ti Basic to Axe
« on: March 23, 2013, 07:15:58 pm »
You all do not know me here because this is my first post here so I'll tell you all a bit about myself to start off. I've started to develop Java first a while back and since then I'm more into web development, especially PHP since Ruby and Python aren't really my preference. And since I need my calculator which is a Ti-84 Plus, I was interesting in the built in programming language. After some playing around, I noticed it was a slow and not a very wide language if you know what I mean. So I looked up if some other languages existed for the Ti family and came across some and Axe looked the best.

But the simple programs I got on my calculator give quite a few errors and I looked all across Google to find my answers and I really can't find them. That's why I signed up here, to get my questions answered and get into Axe. My first question is how do I define a list in Axe, I'm used to using dim( in Ti basic and List or Array in Java, but don't know how Axe works yet.
« Last Edit: March 23, 2013, 07:21:05 pm by Dreeass »

Offline Dapianokid

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 539
  • Rating: +46/-27
  • That one dude
    • View Profile
Re: Ti Basic to Axe
« Reply #1 on: March 23, 2013, 07:17:32 pm »
Oi, welcome to Omnimaga Dreeass!!
I'm not the person to answer your questions, but that's what originally brought me to the calculator programming world!
Keep trying.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Ti Basic to Axe
« Reply #2 on: March 23, 2013, 08:00:33 pm »
Welcome to omni ! ;) Have some peanuts, straight from the factory. :P
!peanuts
To answer your question, there's no list in axe. You just handle data directly with pointers and stuff. You should look at some tutorials (there are a few here).

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Ti Basic to Axe
« Reply #3 on: March 23, 2013, 08:35:43 pm »
you don't need to define a list in axe.

You have 6 memory locations you can use that vary in size and dangers. L1/L2/L3.../L6
You can access these locations with the "{" and "}"
For example {L1 + 4} would access one byte of RAM at location L1+4

You can easily use this to make a list.
for example. if you wanted to make a list of  10 random one byte numbers, you could do this

For (A,0,9)
Rand^256 -> {L1 + A}
End

hope i explained that well enough.

Rand makes a random number between 0 and 65535 i think.
^256 is modulus (you don't really need it as it'd only save 8 bits to that location anyways, but o added it to... um not sure why i did)
A is a variable
{L1 + A} is a changing memory location as A is changing.
« Last Edit: March 23, 2013, 08:38:30 pm by Happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Dreeass

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Ti Basic to Axe
« Reply #4 on: March 23, 2013, 08:41:57 pm »
you don't need to define a list in axe.

You have 6 memory locations you can use that vary in size and dangers. L1/L2/L3.../L6
You can access these locations with the "{" and "}"
For example {L1 + 4} would access one byte of RAM at location L1+4

You can easily use this to make a list.
for example. if you wanted to make a list of  10 random one byte numbers, you could do this

For (A,0,9)
Rand^256 -> {L1 + A}
End

hope i explained that well enough.

Rand makes a random number between 0 and 65535 i think.
^256 is modulus (you don't really need it as it'd only save 8 bits to that location anyways, but o added it to... um not sure why i did)
A is a variable
{L1 + A} is a changing memory location as A is changing.
Can you explain to me how I can access it, for example when I would build a snake game I would need to store the locations of the snake to delete and calculate the next position.

Offline ThatTreeOverThere

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
    • View Profile
Re: Ti Basic to Axe
« Reply #5 on: March 23, 2013, 11:22:23 pm »
So to store something into RAM, you simply store into the memory location with a pointer (in code, X -> {L1+4} would store X to that value)

So instead of accessing something like L1(5), you access the fifth byte with {L1+4}. The other stuff carries over from TI-Basic, mostly, except that you're only storing a byte. If you want full 16 bit values (up to 65535) you simply add the r after the curly brackets like this: {L1+4}r
Also, one more thing. L1 is just a pointer to a free piece of RAM. It's not a list, and if you allocate more RAM for yourself or write into program data, you can use that too. I remember seeing something here about pointer arithmetic... see http://axe.eeems.ca/Documentation.pdf, page 13

Offline Dreeass

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Ti Basic to Axe
« Reply #6 on: March 24, 2013, 08:28:18 am »
So to store something into RAM, you simply store into the memory location with a pointer (in code, X -> {L1+4} would store X to that value)

So instead of accessing something like L1(5), you access the fifth byte with {L1+4}. The other stuff carries over from TI-Basic, mostly, except that you're only storing a byte. If you want full 16 bit values (up to 65535) you simply add the r after the curly brackets like this: {L1+4}r
Also, one more thing. L1 is just a pointer to a free piece of RAM. It's not a list, and if you allocate more RAM for yourself or write into program data, you can use that too. I remember seeing something here about pointer arithmetic... see http://axe.eeems.ca/Documentation.pdf, page 13
So I cannot define a specific length to it, I need to know how long I will make it? I think I got it.

Can I make an integer or double or whatever in Axe and call it whatever I want?

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Ti Basic to Axe
« Reply #7 on: March 24, 2013, 09:03:14 am »
Those locations i believe have a specific length. They're generally called saferam areas, they're areas in RAM that you can generally safely use to store data during the execution of your program without worrying about overwriting important data (other programs, etc.). You can also create a space using the free RAM of the calculator. Using the saferam areas won't take up any extra user RAM as that memory has been set aside specifically for that purpose (or for things that you probably won't use while executing your program).

EDIT: But you don't have to use up that much memory, if you only need ten bytes you only need to use ten bytes. Using more or less won't change the amount of free RAM needed to run your program.
« Last Edit: March 24, 2013, 09:05:08 am by chickendude »

Offline ThatTreeOverThere

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +0/-0
    • View Profile
Re: Ti Basic to Axe
« Reply #8 on: March 24, 2013, 09:09:08 am »
Dreeass: you can store whatever you want, wherever you want. However, if you store something into the TI-OS RAM area or some other unsafe place, or you treat a pointer as an integer or a fixed point number as a float or even a signed as an unsigned, you get no warnings. Everything will just break or act unexpectedly. Java and TI-Basic are at least nice in that respect, but you get something more like C here. (and a good thing too, it's faster :) ) I recommend writing down what you're storing and where.

Offline Dapianokid

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 539
  • Rating: +46/-27
  • That one dude
    • View Profile
Re: Ti Basic to Axe
« Reply #9 on: March 24, 2013, 07:10:58 pm »
The thought process and logic involved in writing games is different in Axe from other languages, because those programs and games are written for and run on much more powerful devices. This is a really low-tech device, so think minimalist!
Keep trying.

Offline Dreeass

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: Ti Basic to Axe
« Reply #10 on: March 24, 2013, 08:12:17 pm »
Can you link me to a basic guide on Axe if there is one?

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Ti Basic to Axe
« Reply #11 on: March 24, 2013, 11:07:18 pm »
First of all: There aren't really any "data types", everything is all about byte arrays and how you use them. And now that I've said that, let me tell you what the data types are :P
There are 8-bit or 1-byte numbers which have a signed range of -128 to 127 (equivalent to a java byte) or an unsigned range of 0-255. Note that unsigned and signed aren't really any different, it's all about what commands you use with them.
Then there are 16-bit or 2-byte numbers which have a signed range of -32,768 to 32,767 (equivalent to a java short) or an unsigned range of 0-65,535. There are also 8.8 fixed point numbers, which are also 16-bit, but have a signed range of -128 to 127 and also have a fractional part with a resolution of 8-bits, for representation of decimal numbers. These are not the huge range floating point numbers you are used to, but they can still be very useful at times.
Next, about the guide, have you read the pdf included in the axe zip?
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Re: Re: Ti Basic to Axe
« Reply #12 on: March 25, 2013, 02:37:20 am »
I recommend writing down what you're storing and where.
Really ? I never write anything down when coding, could it be Axe, ASM, TI BASIC or computer. :P

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Ti Basic to Axe
« Reply #13 on: March 25, 2013, 02:41:17 am »
I used to write things down when coding in Axe, to know where each pointer points to, but since now pointers can have custom (and descriptive) names, I don't need it anymore.
And I always write everything down for ASM, even the code that I first write in pseudo code then in Axe then in ASM, but my programs still don't work :P
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s