Author Topic: How to properly use lists in Axe (1.1.2)?  (Read 11747 times)

0 Members and 1 Guest are viewing this topic.

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
How to properly use lists in Axe (1.1.2)?
« on: August 29, 2012, 02:05:01 pm »
Well, was porting a few of my programs from Ti-Basic to Axe, and I've hit a stumbling block. I went through the docs, but can't figure out how to properly use lists in Axe (along with getkey).

Here is my first try for the Axe code:
Code: [Select]
:For(A,1,4)
:Repeat Ans
:getKey→K
:End
:Copy(K,L1(A))
:End
This waits for 4 key-presses and puts them in a list, but it doesn't work. For some reason Getkey only has unicode garbage, and even that doesn't seem to be saved to the list.

What am I doing wrong?
« Last Edit: August 29, 2012, 02:37:26 pm by The Elite Noob »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: How to properly use lists in Axe (1.2.5)?
« Reply #1 on: August 29, 2012, 02:33:01 pm »
First of all, what is Axe 1.2.5 ? ???

Next thing, the getKey routine sucks. Using getKey(#) is a lot faster. But I xan see why you need the basic getKey command in your program so don't change it if you don't want :)

Also, the Copy() command copies from one pointer to another and needs a size argument, so yours should not work, and even with a third argument, it won't work. I guess what you want to do is K→L1(A) but it won't work either, see next point :P

Finally, the L1 list doesn't exist. L1 is a pointer to some free memory location.
You need to replace all your L1(A) by {L1+A}
This should work then :)

[edit] I didn't see it two minutes ago but you are using Ans, which is not an Axe variable.
Just replace this
 Repeat Ans
 getKey→K
 End

by this
 getKeyr
 →K

or this
 0
 Repeat
  getKey
 End
 →K
« Last Edit: August 29, 2012, 02:37:50 pm by Hayleia »
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

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #2 on: August 29, 2012, 02:39:00 pm »
Thanks, really appreciate it :D also I meant Axe 1.1.2, was probably thinking about something else :p. Also it works :D Gotta love axe.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #3 on: August 29, 2012, 02:57:45 pm »
Thanks, really appreciate it :D
No problem. Omnimaga is really the place to be if you need help with Axe. I got help too when I needed it so I am just giving back ^^

Also, I edited my post like 9 times, not sure if you saw the last version of it.

Moreover, I only think of it now but {A+L1} is more optimised than {L1+A} ;)
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

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: How to properly use lists in Axe (1.1.2)?
« Reply #4 on: August 29, 2012, 03:43:34 pm »
When I saw the title I was starting in fact to wonder where you got Axe 1.2.5 O.O

By the way welcome to the forums. I hope you enjoy your stay and Axe programming.

Just an off-topic question: Noticing your location in your profile, do you live right on the US/Canada border?

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #5 on: August 29, 2012, 03:53:48 pm »
Yea, mistake on my part, also thanks :D, Finally No, I do move quite often between them, about very few months. Also do you think you can tell me what's wrong.

Now I have the lists (L6), and put data in it with
Code: [Select]
K->{B+L6}. However it doesn't seem to actually be put in the list?
« Last Edit: August 29, 2012, 03:56:45 pm by The Elite Noob »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to properly use lists in Axe (1.1.2)?
« Reply #6 on: August 29, 2012, 03:59:52 pm »
Are you drawing anything to the screen? Remember that L6 is actually the main buffer that holds the screen data, so if you use any drawing or text commands it'll overwrite whatever you have there. (Same thing with L3 and grayscale drawing commands, since L3 is the buffer used in grayscale drawing.)
« Last Edit: August 29, 2012, 04:00:26 pm by Deep Thought »




Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #7 on: August 29, 2012, 04:01:08 pm »
Whoa, did not know that. should I use L1 instead then?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to properly use lists in Axe (1.1.2)?
« Reply #8 on: August 29, 2012, 04:02:11 pm »
It's all in the documentation (Commands.html):
Quote from: Commands.html
L1 = 714 bytes (saveSScreen) Volatility: LOW
L2 = 531 bytes (statVars) Volatility: LOW (Do not use this area when custom interrupts are enabled, including Mirage OS)
L3 = 768 bytes (appBackUpScreen) Volatility: MED (Saving to back-buffer will corrupt)
L4 = 256 bytes (tempSwapArea) Volatility: MED (Corrupt when archiving/unarchiving in program)
L5 = 128 bytes (textShadow) Volatility: MED ("Disp","Output", and "ClrHome" will corrupt)
L6 = 768 bytes (plotSScreen) Volatility: HIGH (Any buffer drawing will corrupt)




Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #9 on: August 29, 2012, 04:04:05 pm »
Hmm, i'll try to do a custom list then. But when I do say LKEY, it says it doesn't exist?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to properly use lists in Axe (1.1.2)?
« Reply #10 on: August 29, 2012, 04:09:20 pm »
You have to define LKEY first. The L1–L6 pointers already point to specific addresses in RAM—that's why you can use them. If you need more data space, you'll need to clear enough room for it in your program using Buff( and assign it a GDB#, Str#, or Pic# name. For example, you could do:
Buff(256)→GDB0
Now you have a two hundred fifty-six–byte area you could use like any of the L1–L6 areas.

The difference is that the new buffer you created is actually in the program memory, so that command instantly adds 256 bytes to the size of your program.




Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #11 on: August 29, 2012, 04:11:07 pm »
Oh, okay then, is it possible to create something with Buff that is permanent?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to properly use lists in Axe (1.1.2)?
« Reply #12 on: August 29, 2012, 04:14:54 pm »
What do you mean by "permanent"?
« Last Edit: August 29, 2012, 04:15:07 pm by Deep Thought »




Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to properly use lists in Axe (1.1.2)?
« Reply #13 on: August 29, 2012, 04:15:40 pm »
Something not in program memory, something that can be accessed from multiple programs?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: How to properly use lists in Axe (1.1.2)?
« Reply #14 on: August 29, 2012, 04:17:39 pm »
You'll have to store it in a user variable, like an appvar. There's a tutorial on it here.