Author Topic: Help Request - ERROR INVALID TOKEN  (Read 4335 times)

0 Members and 1 Guest are viewing this topic.

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Help Request - ERROR INVALID TOKEN
« on: December 03, 2013, 06:05:34 am »
What can I use to set the dimensions of a matrix if dim( isn't a valid token.
 EDIT: It seems like [A] is an invalid token, 
{7,11->dim([A]
Fill(1,[A]
« Last Edit: December 03, 2013, 06:22:22 am by Omar Chehab »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #1 on: December 03, 2013, 06:30:42 am »
I fact there isn't any matrix in axe. All you can have is buffer and data, meaning that you have a long list of byte.

If you want to work with a pseudo matrix system, you can code it : for example I want a 8*8 matrix (so 64 elements)


Code: [Select]
Buffer(64)->GDB1  //I create a area Inside of the program, wich is 64 bytes long (so 1 element is one bytes)
//GDB1 is a pointer to this area, an adress use to access to it.

//if I want to acess to the element X,Y I mostly use something like this :
{Y*8+X+GDB1}

//as we work with "list", we need to jump from 8 in 8 with the Y coordinate, and 1 by 1 with the X
//brackets is used to read a byte at the adress provided inside

in general we got this :
Code: [Select]

Buffer(dimX*dimY)->GDB1

//read :
{Y*dimX+X+GDB1}
//dimX dimY dimension of the matrix.

remember though that this work with one byte value (between 0-255)

the paragraph pointer on programming rubric in the documatation pdf explain this, so you might want to read it  :P

Edit: I forget to precise it, but when you read you must set the X,Y value to the coordinate you want retrive. You can of course change the variable, or the name of the pointer
« Last Edit: December 03, 2013, 06:32:31 am by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #2 on: December 03, 2013, 07:27:34 am »
Alright, so defining and reading is covered but how about writing in a certain part?

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #3 on: December 03, 2013, 09:29:41 am »
That works exactly the same way, we use the Sto-> operator to write something to the memory:

Code: [Select]
//write :
value->{Y*dimX+X+GDB1}
//dimX dimY dimension of the matrix, value an integer between 0 and 255

And keep in mind: Axe isn't like TI-Basic at all, both languages share some same keywords, but behave quite different. You cannot simply compile a TI-Basic program with Axe.
« Last Edit: December 03, 2013, 09:30:12 am by MGOS »

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #4 on: December 04, 2013, 12:45:11 pm »
Alright, I learnt how pointers work and how they replace the TI basic variables. One thing though, how come this doesn't work?
Code: [Select]
[05050505050505050505050505050505050505050505050505]->GDB1
While A<=24
[05050505050505050505050505050505050505050505050505]
A+1->A
End
while this works:
Code: [Select]
[05050505050505050505050505050505050505050505050505]->GDB1
[05050505050505050505050505050505050505050505050505]
[05050505050505050505050505050505050505050505050505]
""
""
etc...

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #5 on: December 04, 2013, 12:49:33 pm »
data are implemented in the program in compilation time, meaning that you can't use a loop to create them. In fact, you're first program is compiled like this :

Code: [Select]

While A<=24
A+1->A
End

[05050505050505050505050505050505050505050505050505]->GDB1
[05050505050505050505050505050505050505050505050505]

(all data are put at the end and are not repeat)
« Last Edit: December 04, 2013, 12:50:00 pm by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #6 on: December 04, 2013, 12:54:42 pm »
Alright so the solution to my problem is to just hardcode all 25 lines into it x.x? Or is there an alternate in order to compress this madness?? :w00t:

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #7 on: December 04, 2013, 12:55:12 pm »
To add on to that, if you are filling GDB1 with data that is all 5, then you should just create a buffer GDB1, and then use Fill( to fill it with 5s

Like so:

Code: [Select]
Buff([wanted size of GDB1 in Bytes])->GDB1

Fill(GDB1,[size of GDB1],5)

You can even simplify it to:

Code: [Select]
Buff([wanted size of GDB1],5)->GDB1

I suggest you read the commands.html in the axe zip. It's really helpful once you understand the basics!

EDIT: :ninja: 'd by Omar
« Last Edit: December 04, 2013, 12:56:03 pm by pimathbrainiac »
I am Bach.

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #8 on: December 04, 2013, 01:10:11 pm »
Thanks! :D Just what I needed a buffer should have thought of that... Sorry I forgot about it... I'll re read the commands files I don't wanna bother this awesome community with my obvious questions!

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #9 on: December 04, 2013, 01:11:24 pm »
Dude, feel free to ask. I too asked some obvious questions when I was first here.
I am Bach.

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #10 on: December 04, 2013, 01:25:02 pm »
Ummm calculator froze after i ran my program, its not responding to any inputs... I have a backup but its like 3 hours old... what should i do??

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #11 on: December 04, 2013, 01:27:12 pm »
Wait until you're sure it's completely frozen, then yank the batteries out. Sorry.

What did you set [wanted size of GDB1 in bytes] to?

You're not supposed to put it in brackets if you did.
I am Bach.

Offline Omar Chehab

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +0/-0
    • View Profile
Re: Help Request - ERROR INVALID TOKEN
« Reply #12 on: December 04, 2013, 01:36:11 pm »
Ehh no big deal, i know i didnt put [] and i put 625 bytes to buffer. First run worked fine second run froze, i think its cuz of rand^### that i put i was testing stuff just recovered and made a new backup dont worry nothing lost..