Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
19 May, 2013, 06:30:17 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2   Go Down
  Print  
Author Topic: How to properly use lists in Axe (1.1.2)? -  (Read 555 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« on: 29 August, 2012, 20:05:01 »
0

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:

1
2
3
4
5
6
7
: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: 29 August, 2012, 20:37:26 by The Elite Noob » Logged

Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 09:26:23
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2043


Total Post Ratings: +254

View Profile
« Reply #1 on: 29 August, 2012, 20:33:01 »
0

First of all, what is Axe 1.2.5 ? Huh?

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 Smiley

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 Tongue

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 Smiley

[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: 29 August, 2012, 20:37:50 by Hayleia » Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #2 on: 29 August, 2012, 20:39:00 »
0

Thanks, really appreciate it Cheesy also I meant Axe 1.1.2, was probably thinking about something else :p. Also it works Cheesy Gotta love axe.
Logged

Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 09:26:23
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2043


Total Post Ratings: +254

View Profile
« Reply #3 on: 29 August, 2012, 20:57:45 »
0

Thanks, really appreciate it Cheesy
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} Wink
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Online Online

Gender: Male
Last Login: Today at 06:29:13
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50199


Total Post Ratings: +2611

View Profile WWW
« Reply #4 on: 29 August, 2012, 21:43:34 »
0

When I saw the title I was starting in fact to wonder where you got Axe 1.2.5 shocked

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?
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #5 on: 29 August, 2012, 21:53:48 »
0

Yea, mistake on my part, also thanks Cheesy, 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

1
K->{B+L6}
. However it doesn't seem to actually be put in the list?
« Last Edit: 29 August, 2012, 21:56:45 by The Elite Noob » Logged

Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 03:39:24
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #6 on: 29 August, 2012, 21:59:52 »
0

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: 29 August, 2012, 22:00:26 by Deep Thought » Logged




Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #7 on: 29 August, 2012, 22:01:08 »
0

Whoa, did not know that. should I use L1 instead then?
Logged

Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 03:39:24
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #8 on: 29 August, 2012, 22:02:11 »
0

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)
Logged




Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #9 on: 29 August, 2012, 22:04:05 »
0

Hmm, i'll try to do a custom list then. But when I do say LKEY, it says it doesn't exist?
Logged

Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 03:39:24
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #10 on: 29 August, 2012, 22:09:20 »
0

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.
Logged




Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #11 on: 29 August, 2012, 22:11:07 »
0

Oh, okay then, is it possible to create something with Buff that is permanent?
Logged

Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 03:39:24
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #12 on: 29 August, 2012, 22:14:54 »
0

What do you mean by "permanent"?
« Last Edit: 29 August, 2012, 22:15:07 by Deep Thought » Logged




Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 23:49:04
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #13 on: 29 August, 2012, 22:15:40 »
0

Something not in program memory, something that can be accessed from multiple programs?
Logged

Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Today at 03:39:24
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #14 on: 29 August, 2012, 22:17:39 »
0

You'll have to store it in a user variable, like an appvar. There's a tutorial on it here.
Logged




Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.266 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.