Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
19 May, 2013, 06:44:33 *
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 ... 7 8 [9] 10 11 ... 110   Go Down
  Print  
Author Topic: Axe Q&A -  (Read 59340 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
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 #120 on: 03 March, 2011, 06:15:17 »
0

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




willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 08 May, 2013, 01:10:38
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2638


Total Post Ratings: +66

View Profile
« Reply #121 on: 03 March, 2011, 06:19:35 »
0

He doesn't understand non-OO langs yet. Aka, teach the concept of pointers.
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 #122 on: 03 March, 2011, 06:34:17 »
+3

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 Smiley

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: 22 March, 2011, 18:56:29 by Deep Thought » Logged




willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 08 May, 2013, 01:10:38
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2638


Total Post Ratings: +66

View Profile
« Reply #123 on: 03 March, 2011, 06:36:04 »
0

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 Smiley

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 Tongue), but mostly useful Tongue
« Last Edit: 14 June, 2011, 21:45:12 by DJ_O » 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 #124 on: 03 March, 2011, 06:39:01 »
0

I like pointers better than references. With pointers you can do anything Cheesy
Logged




willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 08 May, 2013, 01:10:38
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2638


Total Post Ratings: +66

View Profile
« Reply #125 on: 03 March, 2011, 07:01:16 »
0

The nice thing about C++ is you can do both Cheesy
Logged

Binder News
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 13 May, 2013, 22:50:58
Date Registered: 26 October, 2010, 22:05:05
Location: In a pit on an island somewhere in the Atlantic.
Posts: 779


Total Post Ratings: +43

View Profile
« Reply #126 on: 03 March, 2011, 07:21:05 »
0

The nice thing about Java is that because almost everything is a pointer (primitives aren't), you don't need both.Smiley
« Last Edit: 03 March, 2011, 07:21:46 by Binder News » Logged

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:




ralphdspam
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 09:10:11
Date Registered: 01 February, 2011, 07:58:40
Location: California, USA
Posts: 841


Total Post Ratings: +36

View Profile
« Reply #127 on: 03 March, 2011, 08:11:36 »
0

Thanks, Deep Thought!
I wish someone explained it like that when I was first learning Axe.
Logged

ld a, 0
ld a, a
ee511
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 14 July, 2011, 21:17:32
Date Registered: 12 February, 2011, 21:39:12
Posts: 19

Total Post Ratings: 0

View Profile
« Reply #128 on: 03 March, 2011, 15:43:25 »
0

but how would you store the "input" data to a string? would it be
input->p
copy(p,str1,length(p))
Logged
Freyaday
The One And Only Serial Time Killing Catboy-Loli-Ballerino
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 02:48:30
Date Registered: 24 February, 2011, 17:10:56
Location: ¿¿¿
Posts: 1887


Total Post Ratings: +108

View Profile WWW
« Reply #129 on: 03 March, 2011, 17:45:19 »
0

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

In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


Beware the Bitulator! ,.,./`My Artwork!
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Yesterday at 22:53:31
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3106


Total Post Ratings: +120

View Profile
« Reply #130 on: 03 March, 2011, 21:53:46 »
0

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.

Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 01:30:08
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #131 on: 03 March, 2011, 21:55:10 »
0

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.
Logged
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Yesterday at 22:53:31
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3106


Total Post Ratings: +120

View Profile
« Reply #132 on: 03 March, 2011, 21:56:36 »
0

I was partially right, I cee...
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
NinjaKnight
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 16 March, 2011, 02:51:36
Date Registered: 03 February, 2011, 22:31:56
Location: Everywhere.
Posts: 20

Total Post Ratings: +2

View Profile
« Reply #133 on: 04 March, 2011, 06:45:05 »
0

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

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
Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Online Online

Gender: Male
Last Login: Today at 06:22:10
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3272


Total Post Ratings: +267

View Profile WWW
« Reply #134 on: 04 March, 2011, 09:32:47 »
0

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: 04 March, 2011, 09:34:07 by Darl181 » Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
Pages: 1 ... 7 8 [9] 10 11 ... 110   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.434 seconds with 31 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.