Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: ACagliano on April 07, 2010, 12:07:25 pm

Title: A little help
Post by: ACagliano on April 07, 2010, 12:07:25 pm
I am redesigning my Pokemon battle simulator, using Axe. So I have a few questions.

1. How do I use commands like GridOff and AxesOff in Axe.

2. Once I create an AppVar, how do I store data into it? And how do I recall data from it?

3. And are screen parameter vars, like Xmax supported?

And I may have more as I go on.
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 12:14:17 pm
I haven't messed with 2, but for 1 and 3, you don't need to change Windows settings at all. Axe doesn't use them to draw graphics. Everything is pixel by pixel. Like when using xLIB, you would just need to erase the graph buffer then update the LCD content through Axe commands.

ClrDraw
DispGraph
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 12:17:35 pm
Ok. Fair enough. And what about text commands. If I wanted to display simple text on the homescreen, how would i do it.
Title: Re: A little help
Post by: calc84maniac on April 07, 2010, 12:19:00 pm
Ok. Fair enough. And what about text commands. If I wanted to display simple text on the homescreen, how would i do it.
I'm pretty sure this info is in the Axe documentation
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 12:20:05 pm
I didnt understand it, but never mind.

(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)
(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)
(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)(http://www.omnimaga.org/Themes/omnimaga4/images/english/modify.gif)

What about storing and recalling to and from appvars. The documentation tells u how to create/remove/select/ and archive/dearchive but i dont believe how to actually store data to them.

And I'm having problems: here is my test code.

ClrHome
Fix 4
Output(1,1,POKEMON
Pause 1000

When I compile this, it displays nothing.

EDIT by DJ Omnimaga: merged close double-posts (there were under 6 hours)
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 12:44:03 pm
I'm not too sure if Output can be used this way. If I remember, you had to store the text to a pointer like Str1 then do Output(1,1,Str1. Also I am not sure if Fix works with Output. I think it was just Text (graph screen).
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 12:48:12 pm
This worked...

Output(0,0,"Pokemon
With no closing Quote (Err: Bad Symbol) or Closing Parenthasis (the parenthasis is displayed)


Can an Axe Parser program archive itself?
Title: Re: A little help
Post by: SirCmpwn on April 07, 2010, 01:09:19 pm
Can an Axe Parser program archive itself?

Yes.  Technically, it is not running the actual program, but a copy of the actual program, so you can archive it.  You just need assembly routines.
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 01:13:40 pm
Now, I am trying to test for the presence of the program's storing appvar (POKE). Now, the documentation says GetCalc() returns 0 if not found OR Archived. How do I determine which so the program can enter install if not found, or just unarchive if archived.

And how do I store data to the appvar and recall it later.
Title: Re: A little help
Post by: Quigibo on April 07, 2010, 02:11:55 pm
After you select the name of the appvar, immediately unarchive it.  Then, when you try to do getCalc() you're sure that if it existed, its definitely in RAM and so it only returns 0 if it doesn't exist.

To write data, you have to store the pointer that is returned by getCalc() either into a variable or in RAM.  Then you read and write to that location as if it were any other RAM location.  The same way you would do 100->{L1+6}  You can do 100->{A+6} if you stored the appvar pointer to A.
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 02:15:04 pm
After you select the name of the appvar, immediately unarchive it.  Then, when you try to do getCalc() you're sure that if it existed, its definitely in RAM and so it only returns 0 if it doesn't exist.

To write data, you have to store the pointer that is returned by getCalc() either in a variable or in RAM.  Then you read and write to that location as if it were any other RAM location.  The same way you would do 100->{L1+6}  You can do 100->{A+6} if you stored the appvar pointer to A.

Thank you. So much. I was having a migraine. But, if I run unarchive on an Appvar, it wont throw an error if it doesnt exist?
Title: Re: A little help
Post by: Quigibo on April 07, 2010, 02:18:32 pm
Nope.  Just nothing happens.

Oh wait a minute!  I forgot to document that!  The Archive/Unarchive command returns 1 if it actually performed an unarchive/archive and 0 otherwise.
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 02:21:39 pm
Ok. Cool. I should be pretty set now, outside of a few questions about sprites:

Is it possible to do a larger than an 8x8 sprite, using the current commands?

And, if I need to write data to a memory location where the integer is larger than 255, it gets more complex. What is the procedure for that?

Edit: And What are the getKey codes Axe uses.
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 02:53:58 pm
Can an Axe Parser program archive itself?

Yes.  Technically, it is not running the actual program, but a copy of the actual program, so you can archive it.  You just need assembly routines.
I assume to do this Axe uses some of the hidden 8 KB of RAM on the 83+, right? (The calc has 32 KB of RAM but only 24 is avaliable to the user)
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 05:35:17 pm
I believe to do anything larger than 8x8 sprites (up to 16x16, I think) you have to use routines which there is one provided by Quigibo and one other person who's name escapes me, I'll find those in a second. But I'm fairly sure there is no command supporting larger than 8x8 (I may be wrong though).

As for the getKey commands, I'm pretty sure they are the same as xLib. DJ posted something I think, I'll find that too.


Ok, so I searched and found the two routines showing how to display larger sprites (Up to 16x16, I think. I don't know exactly the size limit) by Quigibo here (http://ourl.ca/4057/84098) and LordConiupiter here (http://ourl.ca/4129/83922) (the post that actually shows it though this one (http://ourl.ca/4129/83923) that DJ posted; LordConiupiter's post just provides the download)

In regards of the getKey commands. I was correct in saying they are the same as xLib. Here (http://ourl.ca/4304) is the post DJ made about them.
Title: Re: A little help
Post by: _player1537 on April 07, 2010, 05:44:11 pm
yes, they are the same as Xlib, and I made one 16x16 routine, then someone else made the other one.  You can use different sizes, but you have to use bitmasking to do so.
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 05:52:08 pm
You made one too? Well now there are three that I know about :P
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 06:31:40 pm
I made one 16x16 routine
post
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 06:43:39 pm
Ok. Now, I see the commands for writing to and from pointers, but I'm not exactly sure how to use them or how to get the right bytes. In the TI-Basic version, I had a list containing the following terms:
LP1:

(1): Tackles remaining (max value-200)   
(2): Attack 2 remaining (max value-200)
(3): Attack 3 remaining (max value-200)
(4): Attack 4 remaining (max value-200)
(5): Current HP (max value-70)             
(6): Max HP (max value-70)
(7): Current Level (max value-20)
(8): Current Experience Points (max value-1000) ****
(9): Potions Owned (max value-50)
(10): Money Owned (max value-1000) *****
(11): Pokemon Owned (max value-3)

Please can someone tell me how to move this data between the appvar POKE and memory location named anything, preferably a list. I will definiately screw this part up.
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 07:41:30 pm
I just learned the hard way never to code, in Axe, a loop that repeats and test it without an escape key. Time to start over. S@%t.
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 07:45:55 pm
ouch sorry to hear x.x, I hope you had some backups x.x

Else I guess next time it may be best to do some in case. Tip: group your files twice (in case of ERR:VERSION, better do it twice in case), compile, test. If it fails then you can ungroup.

Also don't double-post (unless it has been 6 hours or 1 if it's a project thread of yours).
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 07:48:21 pm
Sorry. I keep doing that.

1. No, I didnt have backups, but now im doing it on my computer and using Wabbitemu to test.
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 07:49:35 pm
Aaah ok, I guess that works too. I wonder if SourceCoder can be reliable for working on projects?
Title: Re: A little help
Post by: _player1537 on April 07, 2010, 10:10:07 pm
I made one 16x16 routine
post
Here's the link to mine: http://img179.imageshack.us/img179/155/scr2430391.jpg (http://img179.imageshack.us/img179/155/scr2430391.jpg)
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 10:14:07 pm
mhmm x.x

So basically you ddint make any after all or did you post the wrong pic/link?
Title: Re: A little help
Post by: _player1537 on April 07, 2010, 10:17:36 pm
lol, sorry, I failed at that...  Let me post the real link...  Sorry
http://ourl.ca/4129/81958 (http://ourl.ca/4129/81958)
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 10:18:44 pm
Lol ok, thanks :)

I'll download all 3 now so I don't need to search all of them later.
Title: Re: A little help
Post by: SirCmpwn on April 07, 2010, 10:20:50 pm
Lol, i just posted that picture on cemetech SAX, and it ends up all the way over here at omnimaga.
Wow.
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 10:41:19 pm
I guess the internet spreads pretty fast :P

Oh well I guess it might be nice to go back on-topic tho :P
Title: Re: A little help
Post by: SirCmpwn on April 07, 2010, 10:42:16 pm
[in a high pitched voice:] It's a small world after all.  It's a small world after all...
Is it stuck in your head yet?
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 11:06:47 pm
To Quigbo: I'm sorry. This is like the 15 millionth time I've asked this question. Can you write up for me a full detail on how to use the pointers commands to store the data between two places and how to access individual parts of the data as you would a list. If you can explain this, I think I may not need anymore help. Thanks
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 11:14:24 pm
Quigibo isn't the only person who knows about them so there are a few people who could do it (SirCmpwn, Builderboy, Ztrumpet possibly (can't remember how much you know, Z :P), etc.). Just gotta wait for someone to answer is all. I would do it if I knew more about pointers, and Axe in general. Sadly though, I do not. Sorry.
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 11:16:06 pm
It doesn't necessarily need to be Quigibo who has to do it. There are a lot of people here who could explain it in great detail. Personally, I would do it if I knew more about them (and Axe in general).

Well, it seemed, Quigbo would be best, as he programmed the commands and knows their intricate workings.
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 11:21:23 pm
(I just edited my last post to show what I meant more.)

Well ya, he is the one developing Axe but I don't think he has been working with it in programming nearly as much as some other guys have (Quigibo, I'm very sorry if I'm mistaken. I don't mean to be telling false information if it is.). Plus he is also busy still developing Axe Parser and is in school and probably has other things going on too. Trust me, anyone of the guys I mentioned before would be able to explain it probably just as well if they chose to. I don't mean this to sound rude.
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 11:25:38 pm
Not taken as rude at all.

Maybe I'll read up on pointers online. It may help.

Edit: Yeah right. Search--"Using pointers in assembly". First result-- "Purchase a laser pointer for 4.99".
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 11:30:47 pm
Try this (http://en.wikipedia.org/wiki/Pointer_(computing)).
Title: Re: A little help
Post by: DJ Omnimaga on April 07, 2010, 11:39:49 pm
Didn't Axe Parser come with some text files explaining pointers in details with a TI-BASIC frame of mind?
Title: Re: A little help
Post by: ACagliano on April 07, 2010, 11:40:10 pm
It helps a little thanks, but it still leaves the part of knowing how to use Axe's commands. I will definately use an array for the reference.
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 11:42:00 pm
Ya, it does. But I can understand where ACagliano may come from in not understanding them still. I didn't fully understand the text document, though I did just read it once.
Title: Re: A little help
Post by: SirCmpwn on April 07, 2010, 11:46:20 pm
First, @meishe91, I'm flattered that you cited me as a reference.
Second, a pointer is a value that points to an offset in memory.  For instance, a pointer with a value of 10 points to the 10th byte (actually, it points to the 11th byte because it is zero-indexed, but lets say that it points to the 10th byte for now).  If that place in memory contains code, you can use a pointer to say, "execute this code."  If that place contains data, then you can say, "look at this data."  Code and data look the same in memory, the only difference being that executing data may accidently in your RAM.
Third, here is how applys to Axe, for methods and code:
Code: (Axe Basic) [Select]
ClrHome
sub(SH
Return
Lbl SH
Disp "Hello World!"
When Axe compiles, it saves the location of Lbl SH in the first run.  By location, I mean that it saves offset from the beginning.  So, if SH comes 10 bytes from the beginning, it remembers that SH is 10 bytes from the beginning.
The, it hits the "sub(SH" line.  It says to itself, "hey, I know where that is!  It's 10 bytes from the beginning!"  So, it tells the output program to jump to 10 bytes from the beginning, and come back when it's finished.

With storing data, it works the same way.  If you have:
Code: (Axe Basic) [Select]
[0102030405060708->Pic1
Pt-On(0,0,Pic1
Axe remembers that Pic1 points somewhere, and then supplys that location to the Pt-On command.

Questions?
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 11:54:45 pm
Well you seem to know what you're doing (besides the silly math errors you made the other day ;) Just kidding :P). But you're welcome.
Title: Re: A little help
Post by: SirCmpwn on April 07, 2010, 11:56:53 pm
silly math errors
I don't seem to recall any of these errors?
Title: Re: A little help
Post by: meishe91 on April 07, 2010, 11:57:51 pm
Let me see if I can find one, one second.

Reader's Digest:
Well, in base 10, you go from 0-9.  In hex, you go from 0-F.  (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F).  All data is stored as a single byte.  A byte is a pair of hex digits: 00 is 0, 0A is 10, FF is 256.  <- Recognize that number?  It's the maximum value of a byte.  A word is a pair of bytes, like BB6D.

But I'm only kidding, it was a joke :P
Title: Re: A little help
Post by: SirCmpwn on April 08, 2010, 12:07:17 am
Lol, I knew it was a joke.
My bad.
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 12:26:33 am
Ok. Now, I am done with all of the in-game variable manipulation. All thats left is to create the array, do sprites for the three starting pokemon, a sprite for the computer's enemy, do the actual battle system, then the saving to the AppVar. I got my work.
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 12:31:05 am
First, @meishe91, I'm flattered that you cited me as a reference.
Second, a pointer is a value that points to an offset in memory.  For instance, a pointer with a value of 10 points to the 10th byte (actually, it points to the 11th byte because it is zero-indexed, but lets say that it points to the 10th byte for now).  If that place in memory contains code, you can use a pointer to say, "execute this code."  If that place contains data, then you can say, "look at this data."  Code and data look the same in memory, the only difference being that executing data may accidently in your RAM.
Third, here is how applys to Axe, for methods and code:
Code: (Axe Basic) [Select]
ClrHome
sub(SH
Return
Lbl SH
Disp "Hello World!"
When Axe compiles, it saves the location of Lbl SH in the first run.  By location, I mean that it saves offset from the beginning.  So, if SH comes 10 bytes from the beginning, it remembers that SH is 10 bytes from the beginning.
The, it hits the "sub(SH" line.  It says to itself, "hey, I know where that is!  It's 10 bytes from the beginning!"  So, it tells the output program to jump to 10 bytes from the beginning, and come back when it's finished.

With storing data, it works the same way.  If you have:
Code: (Axe Basic) [Select]
[0102030405060708->Pic1
Pt-On(0,0,Pic1
Axe remembers that Pic1 points somewhere, and then supplys that location to the Pt-On command.

Questions?

On that, no. I think I can do that. My difficulty arises when I want to say... take Pic1 (above) and place it in an AppVar for use by the program in subsequent run. What I'm essentially inquiring about is the conversion from appvar to pointer and back again, without screwing up the data.

And, do all values for pointers have to be in hex?
Title: Re: A little help
Post by: SirCmpwn on April 08, 2010, 12:42:33 am
And, do all values for pointers have to be in hex?
No, but it really doesn't make sense to do it any other way, based on the layout and structure of the memory, among other things.

And for the pointer->AppVar thing, I haven't played with it too much, but I will do so and post instructions tomorrow.
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 12:49:20 am
ok. thanks. Your instructions just got my program completion from 2% to 35% within 10 minutes.

Now, I just want to double check something. Within the program, I will be using regular variables A through O, minus G, which I reserve for getKey stuff. So when I store those variables to an array, I can do

Code: [Select]
A->{LX}
B->{LX+1}
C->{LX+2}
...and so on

even if one or two of the variables max out at 1000, correct?
Title: Re: A little help
Post by: DJ Omnimaga on April 08, 2010, 12:55:27 am
And, do all values for pointers have to be in hex?
No, but it really doesn't make sense to do it any other way, based on the layout and structure of the memory, among other things.

it can be easier to read in some cases, right, tho?
Title: Re: A little help
Post by: Quigibo on April 08, 2010, 01:24:07 am
No!  The single bytes max out at 255 (or 127 if you're storing as positive and negative numbers instead of just positive).  To store larger numbers, they will have to take up 2 bytes.  Doubles give you up to 65535.

It makes the data storage a little tricky though since you have to remember that offsets with 2 byte variables is an offset by 2 for each variable.  You tell the parser to store 2 bytes by adding a r after the brackets.

So lets say A,B,and D are 2 byte variables and C and E are 1 byte.  You can store them like this:
A->{L1}r
B->{L1+2}r      B has to be 2 bytes after A
C->{L1+4}       C has to be 2 bytes after B
D->{L1+5}r      D is only 1 byte after C
E->{L1+7}       etc.

Notice how you have to leave enough room for each variable.  Usually, this can get pretty confusing to index the array if you mix 1 and 2 byte variables.  In that case, its sometimes a good idea to just make them all 2 byte variables just for convenience.

Quote
Well ya, he is the one developing Axe but I don't think he has been working with it in programming nearly as much as some other guys have
This is so true!  I haven't really had a lot of time to actually fool around with the language myself since I'm constantly spending that time on new features.  I bet all those people you mentioned have used it more than I have hours wise.  I'll let you in on a secret though.  My ultimate goal is to make the game "Frog Flap" for the calculator complete with music, grayscale, and saving.  That will be my final project when the final version comes out.  It's another minigame from warioware btw.
Title: Re: A little help
Post by: meishe91 on April 08, 2010, 01:36:38 am
That's a bummer you don't get to mess around with it that much. I bet everyone would understand if you wanted to take a few day or a week off to mess around some :) But that's cool about the upcoming project you plan to get done, sounds interesting.
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 01:44:31 am
Thanks Quigbo. So essentially, I'm doing what I did in my old Microsoft Word Simulator to store cursor location in ten files:

List size 2
File to recall: Doc3

So I'm pointing to term 5 for cursor Y and term 6 for X, except that Y is the first byte and X is the second. ok
Title: Re: A little help
Post by: Quigibo on April 08, 2010, 01:53:21 am
By the way, there is also the copy command which is conj().  You can use it to copy large blocks of data.  You would especially use it to save and load from appvars.  Lets say you want to save the entire graph buffer to an appvar.  Obviously you wouldn't want to store one element at a time and even a for loop would be slow and cumbersome.

conj copies however many consecutive bytes you want from one location to another.  So to copy all 768 bytes of the graph buffer to the appvar (lets say the pointer for that is in A) then you would do this:

conj(L6,A,768)

Since L6 is the graph buffer.  First argument is source, second is destination, and third is how many bytes.  Also you can load a saved screen from the appvar back into the buffer the same way:

conj(A,L6,768)
Title: Re: A little help
Post by: DJ Omnimaga on April 08, 2010, 02:35:13 am
I'll let you in on a secret though.  My ultimate goal is to make the game "Frog Flap" for the calculator complete with music, grayscale, and saving.  That will be my final project when the final version comes out.  It's another minigame from warioware btw.
:O nice ^^

But by final I hope you don't mean once Axe and Frog Flap are finished that you are quitting calc programming and the community completly? :O
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 02:36:07 am
So its conj(LX,POKE,27) (LX is a 14 slot array, each slot carrying 2 bytes, for a total of 27) to save to the appvar and conj(POKE,LX,27) to load back.

*L  in LX is actually the 'list' token.


And, Axe is throwing me a Bad Symbol when compiling, but I'll deal with that tomorrow. I need sleep now.
Title: Re: A little help
Post by: SirCmpwn on April 08, 2010, 08:48:38 am
No, after looking at the documentation, it appears to be done a different way (I have not tested this myself).
First of all, I can tell you that "LX" will not work.  You can only use L1-L6, and all those are is places in the RAM.  You don't actually modify user lists.
Now, assuming that you have all of your data in L1, this is how you would save it to the AppVar POKE:
Code: [Select]
Select(POKE)    // Select the AppVar POKE
Unarchive POKE  // Unarchive it if it already exists
GetCalc(27)->A  // Create/Overwrite an AppVar 27 bytes in size
conj(L1,A,27)  // Copy L1 to the AppVar

And to read from it:
Code: [Select]
Select(POKE)  // Select it
Unarchive POKE  // Unarchive it if it exists
GetCalc()->A  // Get a pointer to it
!If A
// It doesn't exist
Else
conj(A,L1,27)  // Load the data to L1
End
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 09:15:16 am
Ok. Now the parser is giving me Err: Duplicate in pass 2. What's going on? What does that mean?
Title: Re: A little help
Post by: calc84maniac on April 08, 2010, 02:23:31 pm
No, after looking at the documentation, it appears to be done a different way (I have not tested this myself).
First of all, I can tell you that "LX" will not work.  You can only use L1-L6, and all those are is places in the RAM.  You don't actually modify user lists.
Now, assuming that you have all of your data in L1, this is how you would save it to the AppVar POKE:
Code: [Select]
Select(POKE)    // Select the AppVar POKE
Unarchive POKE  // Unarchive it if it already exists
GetCalc(27)->A  // Create/Overwrite an AppVar 27 bytes in size
conj(L1,A,27)  // Copy L1 to the AppVar

And to read from it:
Code: [Select]
Select(POKE)  // Select it
Unarchive POKE  // Unarchive it if it exists
GetCalc()->A  // Get a pointer to it
!If A
// It doesn't exist
Else
conj(A,L1,27)  // Load the data to L1
End

That's not how you use the file commands. You will need to do this:
Code: [Select]
"POKE->Str1
Select(Str1)    // Select the AppVar POKE
If GetCalc(27)->A  // Create/Overwrite an AppVar 27 bytes in size
conj(L1,A,27)  // Copy L1 to the AppVar
Else
// Not enough memory
End
Title: Re: A little help
Post by: DJ Omnimaga on April 08, 2010, 05:42:15 pm
mhmm thanks for posting this, it might be helpful for me. Keep in mind Quigibo said those command syntax will change, tho (the new ones, that is), but it still makes things more clear for me now. :)
Title: Re: A little help
Post by: SirCmpwn on April 08, 2010, 06:54:41 pm
Thanks for clarifying, calc84maniac.
Also, you should be aware that you can use 8 digit mixed-case names for AppVars, so you *can* call your AppVar "Pokemon"
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 07:07:54 pm
Ok. Now, I have the array being saved, now lets say I want to save the hex sprite data, chosen pokemon name and attacks into the appvar too. I know that I would then have to change the 27 and would have to code more movements into the appvar. But, my question is, can I add the following to an appvar:

"SQUIRTLE  "    *note the two spaces. Will they be preserved?
Title: Re: A little help
Post by: SirCmpwn on April 08, 2010, 07:09:08 pm
The two spaces will not be preserved.  8 character max.
Title: Re: A little help
Post by: ACagliano on April 08, 2010, 07:13:53 pm
The two spaces will not be preserved.  8 character max.

No. I don't mean as its name. I mean inside it. The same way I'm putting an array inside it. I want to store the names for future use.
Title: Re: A little help
Post by: SirCmpwn on April 08, 2010, 07:14:56 pm
Oh, in that case, I believe they will.
Sorry for the confusion.
Title: Re: A little help
Post by: lafferjm on April 17, 2010, 05:17:41 pm
Alright I was wondering.  Suppose I had the following in my code:
Code: [Select]
[12345678->GDB1

How would I access each number seperatly?  I have tried:
Code: [Select]
{GDB1}->A

For the first element, and
Code: [Select]
{1+GDB1}->AFor the second element but it doesn't work.
Title: Re: A little help
Post by: Silver Shadow on April 17, 2010, 05:41:06 pm
This isn't correct:

Code: [Select]
[12345678->GDB1

THIS is correct:

Code: [Select]
[0102030405060708->GDB1
Title: Re: A little help
Post by: lafferjm on April 17, 2010, 07:35:07 pm
That fixed most of the problem but I still can't get the rest right.  I am trying to create a routine to get text input from the user and each value corresponds to a letter in the alphabet.  Right now the code I have looks like this:
Code: [Select]
.D
DiagnosticOff
[0102030405060708->GDB1
For(A,0,7
{A+GDB1}->B
If B
Disp "A"
End
If B=2
Disp "B"
End
If B=3
Disp "C"
End
If B=4
Disp "D"
End
If B=5
Disp "E"
End
If B=6
Disp "F"
End
If B=7
Disp "G"
End
If B=8
Disp "H"
End
End
The output is correct for the most part, but it looks like the following:
Code: [Select]
AABACADAEAFAGAH
Title: Re: A little help
Post by: Quigibo on April 17, 2010, 08:21:54 pm
You forgot the =1 for A.  If you omit it, then it is always true except for zero.  That's why it keeps showing all those As.

By the way I would do this:
Code: [Select]
.D
DiagnosticOff
[0102030405060708->GDB1
"ABCDEFGH"[]->GDB2
For(A,0,7
{A+GDB1}-1->B
Disp {B+GDB2}>Frac
End
Title: Re: A little help
Post by: lafferjm on April 17, 2010, 08:26:08 pm
Alright thanks.  I thought that just B itself would compare it to 1, not zero.  And thanks for that frac optimization as well.
Title: Re: A little help
Post by: DJ Omnimaga on April 27, 2010, 12:35:11 am
I would need some help with the Text command:

how would you display the content of a variable with it? Is it possible at all? I tried >Dec but it gave BAD SYMBOL error. Just doing Text(49,35,S causes garbage to show up
Title: Re: A little help
Post by: Quigibo on April 27, 2010, 12:50:31 am
That's coming next version for sure.  There isn't a built in OS-call to display an integer in an arbitrary position (that I know of) so I have to do a little work around by converting it to a float and then displaying it.  Its slower, but its somewhat small.
Title: Re: A little help
Post by: DJ Omnimaga on April 27, 2010, 12:52:19 am
ooh ok I see. What would be a workaround for this? I can't seem to figure out how to display only one character from a string (is it even possible at all with Text() anyway?). Should I just use a set of sprites instead?

Btw this is for title screen, where you can set game speed
Title: Re: A little help
Post by: Quigibo on April 27, 2010, 01:01:11 am
Yeah, when I add >Dec support for Text() I will also add the >Frac.

Temporarily, you can use the Output() feature to do this but it has to be aligned.
Title: Re: A little help
Post by: DJ Omnimaga on April 27, 2010, 02:08:21 am
yeah my issue was that I didn't want it aligned, but it shouldn't be an issue now since I decided to just show a sprite animation instead :P