• Axe Q&A 5 5
Currently:  

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

0 Members and 2 Guests are viewing this topic.

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 #120 on: March 02, 2011, 11:15:17 pm »
so i can treat it as a string? is there any way to store the output of "input" directly to a string?

Of course. As long as the input is only capital letters and numbers, it should show up perfectly. If the user inputs other characters, though, they may show up as weird characters.




Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Axe Q&A
« Reply #121 on: March 02, 2011, 11:19:35 pm »
He doesn't understand non-OO langs yet. Aka, teach the concept of pointers.

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 #122 on: March 02, 2011, 11:34:17 pm »
Ah. Well here's a breakdown:

When you get as low-level as Axe, everything's stored as individual bytes. A variable (A-Z and theta) is 2 bytes (in Axe), a floating-poiint number is 9 bytes, etc. Your calculator has 32,768 bytes of RAM for you to work with. They're just stored one after the other, 32,768 in a row. There's no way to tell the bytes apart, so that's why each one is given an address.

Think of it this way: You've got 32,768 houses lined up in a row that look exactly identical. What really matters is what's in each house, which could be a number from 0 to 255. How do you tell them apart? By using addresses. Each address is a number between $8000 and $FFFF, and they all point to a distinct hou-- er, byte. Hence addresses are called pointers :)

You can literally store anything here, since they're all numbers anyway. You could represent a string as a sequence of bytes; maybe one particular string you need starts at address $C38E and runs to $C390 (three bytes). $C38E would be the pointer that points to the string.

And then since each pointer is just a number, you can store that in a variable too. The input simply asks the user to input a string, stores it to a string structure somewhere in RAM, and returns the pointer to (address of) the string. That's all that input→P does: it gets an input string, stores it somewhere, then stores the pointer to the string into variable P. You can then display the contents of that string by calling Disp P, for example.

(This is because Disp takes a pointer as an argument and displays the string starting at that address. When you do something like "HELLO"→GDB0:Disp GDB0, all that Axe does is stick the bytes of the string "HELLO" into the program memory and define GDB0 as the address of that string.)

Hope that helps (and hope that clears some stuff up for other people, too)!
« Last Edit: March 22, 2011, 12:56:29 pm by Deep Thought »




Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Axe Q&A
« Reply #123 on: March 02, 2011, 11:36:04 pm »
Quote from: Deep Thought
Ah. Well here's a breakdown:

When you get as low-level as Axe, everything's stored as individual bytes. A variable (A-Z and theta) is 2 bytes (in Axe), a floating-poiint number is 9 bytes, etc. Your calculator has 32,768 bytes of RAM for you to work with. They're just stored one after the other, 32,768 in a row. There's no way to tell the bytes apart, so that's why each one is given an address.

Think of it this way: You've got 32,768 houses lined up in a row that look exactly identical. What really matters is what's in each house, which could be a number from 0 to 255. How do you tell them apart? By using addresses. Each address is a number between $8000 and $FFFF, and they all point to a distinct hou-- er, byte. Hence addresses are called pointers :)

You can literally store anything here, since they're all numbers anyway. You could represent a string as a sequence of bytes; maybe one particular string you need starts at address $C38E and runs to $C390 (three bytes). $C38E would be the pointer that points to the string.

And then since each pointer is just a number, you can store that in a variable too. The input simply asks the user to input a string, stores it to a string structure somewhere in RAM, and returns the pointer to (address of) the string. That's all that input→P does: it gets an input string, stores it somewhere, then stores the pointer to the string into variable P. You can then display the contents of that string by calling Disp P, for example.

(This is because Disp takes a pointer as an argument and displays the string starting at that address. When you do something like "HELLO"→GDB0:Disp GDB0, all that Axe does is stick the bytes of the string "HELLO" into the program memory and define GDB0 as the address of that string.)

Hope that helps (and hope that clears some stuff up for other people, too)!
I love pointers sometimes, hate them others. It's useful, and annoying (especially when using disp :P), but mostly useful :P
« Last Edit: June 14, 2011, 03:45:12 pm by DJ_O »

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 #124 on: March 02, 2011, 11:39:01 pm »
I like pointers better than references. With pointers you can do anything :D




Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Axe Q&A
« Reply #125 on: March 03, 2011, 12:01:16 am »
The nice thing about C++ is you can do both :D

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Axe Q&A
« Reply #126 on: March 03, 2011, 12:21:05 am »
The nice thing about Java is that because almost everything is a pointer (primitives aren't), you don't need both.:)
« Last Edit: March 03, 2011, 12:21:46 am by Binder News »
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Axe Q&A
« Reply #127 on: March 03, 2011, 01:11:36 am »
Thanks, Deep Thought!
I wish someone explained it like that when I was first learning Axe.
ld a, 0
ld a, a

Offline ee511

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #128 on: March 03, 2011, 08:43:25 am »
but how would you store the "input" data to a string? would it be
input->p
copy(p,str1,length(p))

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #129 on: March 03, 2011, 10:45:19 am »
How many buffers are there, and how do I use them in Axe?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #130 on: March 03, 2011, 02:53:46 pm »
phew... I think 3: L3, L5,L6
L3: I think this is the backbuffer
L5: this is the buffer of the homescreen (where the chars are stored)
L6: this is the buffer for the screen.

You can call the buffers by using the list variables.

I'm not a nerd but I pretend:

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #131 on: March 03, 2011, 02:55:10 pm »
but how would you store the "input" data to a string? would it be
input->p
copy(p,str1,length(p))


Why would you need to copy the string somewhere else? It already exists in RAM at the location pointed to by the output of input. Also, copying the string to a static pointer could be dangerous if the string that the user entered is larger than the space you allocated for the Str1 pointer.


How many buffers are there, and how do I use them in Axe?

There are 3 buffers built into the operating system. L6 points to one, which is usually treated as the "main" buffer by programmers because that's the buffer the OS treats as the main buffer. This is also the buffer used with Axe's DispGraph by default. Another buffer is pointed to by L3, which Axe treats as the second buffer for grayscale images. Axe also has the option to use most of its drawing commands to this buffer in addition to the normal L6, which could be useful whether or not you're using grayscale. The final buffer allocated by the OS is L1, the last 54 bytes of which are used by the Axe variables by default. However, you can redefine the variables to point somewhere else and then use this whole buffer. And of course, you can always define your own buffers by just allocating 768 bytes of RAM for one. You could do that by adding 768 bytes of data to your program or making a 768-byte appvar.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #132 on: March 03, 2011, 02:56:36 pm »
I was partially right, I cee...
I'm not a nerd but I pretend:

Offline NinjaKnight

  • LV2 Member (Next: 40)
  • **
  • Posts: 20
  • Rating: +2/-0
  • Hey! Look behind you! It's a -- (runs)
    • View Profile
Re: Axe Q&A
« Reply #133 on: March 03, 2011, 11:45:05 pm »
How do I create a program with GetCalc(? I can create appvars just fine, but trying to create a program crashes. (It really just freezes, actually.)
Ninja vs. Chuck Norris == n/0. Both end with the world blowing up.

"We could use up two eternities in learning all that is to be learned about our own world and the thousands of nations that have arisen and flourished and vanished from it. Mathematics alone would occupy me eight million years."
-Mark Twain

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #134 on: March 04, 2011, 02:32:47 am »
And speaking of getcalc, did the syntax change by any chance?  b/c in a side program I'm writing GetCalc(Str1,384)→P only works something like a third of the time.
Yes, Str1 is defined, as appvLightSav.

How do I create a program with GetCalc(? I can create appvars just fine, but trying to create a program crashes. (It really just freezes, actually.)
Don't you get the prgm token from the catalog, then type the name of the desired program?
« Last Edit: March 04, 2011, 02:34:07 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue