Author Topic: Axe Q&A  (Read 591531 times)

0 Members and 6 Guests are viewing this topic.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Axe Q&A
« on: February 12, 2011, 11:28:50 am »
Since we no longer have the Axe Parser general thread due to the forum split (and since q/a wasn't even that appropriate for the Axe Parser thread), this topic will be the new quick question/answer thread. :)
If you have any quick questions about Axe programming: things that you feel don't quite merit their own thread, feel free to post them here. :) Anyone able to answer your question will most certainly do so.

Questions like "What does [function] do" or "How do I do grayscale" are suited for this thread, while we encourage the creation of a new thread for more indepth questions and issues :)

FAQ/RANDOM:

Please, do not refer to Axe "lists" L1, L2, etc. as "lists." Instead, refer to them as "saferam" or "free ram." The term "list" is reserved for the OS lists that are used in plots and BASIC
Q-Help! Why doesn't Fill({L1},1000) work?
Fill() takes a pointer as an argument. Fill({L1},XXX) is incorrect. You want Fill(L1,XXX). Same with the Copy/Exch commands.[/green]

Q-Help! My program is inexplicably crashing on execution!
A-Asm programs have a size limit of 8192 bytes. If you compile for MOS/DCS, you have a limit of 8811 bytes of code, and unlimited data (well as much data that you can fit into RAM). If you're over 8811 bytes, you might want to think about compiling to an application, using Crabcake or Fullrene. or optimizing some more.

Q-How come this doesn't work: 0->{GDB1+xxxx}???
A-GDB1, Str1, etc. are all static pointers This means that you aren't supposed to change the data defined there. You can however, do this (called SMC; and be warned that it will not work in an application) by using Copy and Exch, or by storing the static pointer to a variable and then using that variable as a pointer instead, eg GDB1->theta:0->{theta}

Q-How do I do realistic gravity???
A: Check out Builderboy's physics lessons.
« Last Edit: March 03, 2012, 08:13:25 pm by squidgetx »

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #1 on: February 12, 2011, 02:38:15 pm »
Yay 1st question!

How to deal with variable string lengths, like as in an input routine?
I'm not a nerd but I pretend:

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #2 on: February 12, 2011, 02:39:06 pm »
what do you mean how to deal with them?  What do you need to do?

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #3 on: February 12, 2011, 02:41:35 pm »
I mean, if you put in some data in str1, the next time you start the program the same data is still in str1 ( maybe this is more like self-modifying-code )
I'm not a nerd but I pretend:

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: Axe Q&A
« Reply #4 on: February 12, 2011, 02:45:37 pm »
You mean saving back to the program? Because (as you probably know) Str1 isn't a real variable. It's a chunk of bytes in the program itself. So if you want to save back to the program, you have to find the program in memory, then calculate the offset of Str1 from the beginning of the program, then Copy( the bytes there. I made a little routine to do that in PapiJump :D Let's see if I can find it...




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #5 on: February 12, 2011, 02:47:11 pm »
Yes, restoring the default value of a string, that would help me out a whole lot times :D
I'm not a nerd but I pretend:

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: Axe Q&A
« Reply #6 on: February 12, 2011, 02:48:01 pm »
Yes, restoring the default value of a string, that would help me out a whole lot times :D


Wait, what exactly are you trying to do?




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #7 on: February 12, 2011, 02:49:10 pm »
nvm, what you said earlier
<offtopic> yay my axeparser usrbar changed lol </offtopic>
and, I lost :hyper:
« Last Edit: February 12, 2011, 02:50:00 pm by aeTIos »
I'm not a nerd but I pretend:

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #8 on: February 12, 2011, 02:51:06 pm »
Well if you use MirageOS, it has automatic copyBack, so anything you modify will stay modified.  Maybe just make your program for MirageOS/Doors?

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: Axe Q&A
« Reply #9 on: February 12, 2011, 02:53:25 pm »
Well if you use MirageOS, it has automatic copyBack, so anything you modify will stay modified.  Maybe just make your program for MirageOS/Doors?

That would work, and if by

Yes, restoring the default value of a string, that would help me out a whole lot times :D


you meant you want it to stay unmodified, just use a saferam area (L1, L2, etc.) and initialize it at the beginning of your program.




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #10 on: February 12, 2011, 02:54:25 pm »
Sorry, i'm not clear.
What I mean, is actually not the modifying. so if I set "0000->str1, the next time its loaded, it should be again "0000 and not "1111 or so.
I hope this is more clear and not ambiguous (is that the right word here?)

EDIT: and, Deep Thought, I've tried that earlier, but that didnt work ???

EDIT2: nvm, understood it.
« Last Edit: February 12, 2011, 02:59:24 pm by aeTIos »
I'm not a nerd but I pretend:

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #11 on: February 12, 2011, 02:56:04 pm »
So you want the Data to always be the same when you start the program?  The best way to do that would be to never modify it in the first place.  If you need to modify it, you can copy() it to a SafeRam location such as L1 and work with it from there

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #12 on: February 12, 2011, 02:58:47 pm »
Ah ok, I understand it, i'll try, thanks all!
I'm not a nerd but I pretend:

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #13 on: February 12, 2011, 02:59:50 pm »
Also note that if you are running from the homescreen, there are no issues and the data will always reset back to its default :)

Offline Elsewhere

  • LV2 Member (Next: 40)
  • **
  • Posts: 26
  • Rating: +5/-1
    • View Profile
Re: Axe Q&A
« Reply #14 on: February 12, 2011, 04:38:01 pm »
Okay, here's a question (or two):

The Text( command seems to only draw whatever you want it to for one frame at which point the text seems to disappear. Is this just how Text( works or am I doing something wrong? So, if I wanted to output text that would stay there (the graph screen) until I used ClrDraw, how would I go about doing that? (Sprites would be really inefficient, mind you).

Also, what does it mean when I try to run my program after compiling and get ERR:INVALID? I have ample RAM left (>15000) and tons of archive (>100000) so I couldn't think it'd be a memory issue, but all the same it happened after I wrote a few everyday lines. An example of the format these lines were in is:
Code: [Select]
:If A=0:If B=0:Text(1,1,"COOL"):End:EndAfter commenting those lines out it worked fine again, but if I bring one back my sprites glitch up and more makes me get ERR:INVALIDs again. My game is rather huge, using like, 30 pictures, all the letter variables, and a bit of L1, so it makes me think it might have to do with free RAM or whatever? Mind you, it's not an Axe error but a TI error I'm getting, after trying to run the game.