Author Topic: can someone help me  (Read 7102 times)

0 Members and 1 Guest are viewing this topic.

Offline spud2451

  • LV2 Member (Next: 40)
  • **
  • Posts: 39
  • Rating: +3/-3
  • Life is simple, but we make it complicated ~conf.
    • View Profile
    • Red Rock Creative [Free Custom Websites]
can someone help me
« on: May 30, 2011, 02:47:56 pm »
 i'm a total noob at axe and i need some help understanding
pointers because you pretty much can't do anything without them 
« Last Edit: May 30, 2011, 02:48:24 pm by spud2451 »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: can someone help me
« Reply #1 on: May 30, 2011, 02:48:51 pm »
i'm a total noob at axe and i need some help understanding
pointers because pretty much can't do anything without them 

Hey there, I'd recommend this.

Hope you get it. Read it slowly, perhaps twice.

Offline spud2451

  • LV2 Member (Next: 40)
  • **
  • Posts: 39
  • Rating: +3/-3
  • Life is simple, but we make it complicated ~conf.
    • View Profile
    • Red Rock Creative [Free Custom Websites]
Re: can someone help me
« Reply #2 on: May 30, 2011, 02:50:30 pm »
thanks

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: can someone help me
« Reply #3 on: May 30, 2011, 02:51:29 pm »
thanks

No problem, you're welcome. Just keep in mind that text was written by Deep Thought.

Offline spud2451

  • LV2 Member (Next: 40)
  • **
  • Posts: 39
  • Rating: +3/-3
  • Life is simple, but we make it complicated ~conf.
    • View Profile
    • Red Rock Creative [Free Custom Websites]
Re: can someone help me
« Reply #4 on: May 30, 2011, 02:57:46 pm »
i read it 2 1/2 times and still don't get it  :banghead: i've never used pointers before 
« Last Edit: May 30, 2011, 02:59:32 pm by spud2451 »

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: can someone help me
« Reply #5 on: May 30, 2011, 03:11:39 pm »
look at it this way:
pointers reference a certain point in your calculator's memory.
For example, L1 points to a 'safe area' of memory which you can use to store stuff.
so the pointer {L1+2} would be 2 bytes after the start of L1
To access a certain point that you previously stored, just use the same pointer again.
Code: (example) [Select]
1 --> {L1+2}      //stores 1 to 2 bytes after L1
                           //now to check if that byte is 1:
If {L1+2} = 1
[insert code here]
End

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: can someone help me
« Reply #6 on: May 30, 2011, 03:13:41 pm »
Hi and welcome on the forums. I would also recommend checking the pointers section of the documentation. It is worded different so it might help a bit too.

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: can someone help me
« Reply #7 on: May 30, 2011, 03:15:59 pm »
Yeah... that could help :P
welcome, spud. I hope you enjoy omni ;D
[completely offtopic]we already have a member called potato :P[/completely offtopic]

Ashbad

  • Guest
Re: can someone help me
« Reply #8 on: May 30, 2011, 03:27:46 pm »
Here's a way you can think of pointers, since it's a harder-to-grasp concept with programming:

pointers can be thought as as 'elements' of a matrix which you may have used in something like math.  If not, you can think of them as "arrows" that point to a location in memory.  Memory is made up of bytes in successive order, and when you're working with Axe you'll be working with 65536 different locations in memory, each of them a byte.  I think once you understand this then the documentation will help from there :)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: can someone help me
« Reply #9 on: May 30, 2011, 03:37:52 pm »
If you're confused about pointers, remember that every piece of memory (called a byte) is assigned an address in hexadecimal by the processor, starting from 0x0000. A pointer is just the address of a particular memory location, meaning that it's a 16 bit number that identifies one byte in memory. They're called pointers because the numbers "point" to that address. Since pointers are numbers, you can do the normal mathematical operations on them like addition and subtraction to change them.

Take this Axe code as an example:

Code: [Select]
[0123456789ABCDEF00]->Str1
.The contents of Str1 are placed somewhere in the program by Axe and the symbol Str1 becomes a pointer to the memory holding the first value
Text(40,40,Str1>char
.Since characters are hexadecimal, we can print the string
.The pointer that is Str1 tells the text( directive to print the string starting from the address pointed to by Str1
Text(40,40,Str1+4>char
.We can also print only part of the string by adding 4 to the pointer. This means that that value Str1+4 points to the location four bytes after the location pointed to by Str1, which is partway through the string.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: can someone help me
« Reply #10 on: May 30, 2011, 03:40:32 pm »
Imagine the memory of your calculator is this:

Memory: AB0123456789ABCDEF00B0231253210214125124123123123122312AF2131231201012312312
Address: 0123456789...

Str1 is a pointer to the address 2, where the image starts in the memory.

(this is not really what happens, just an example).

Offline spud2451

  • LV2 Member (Next: 40)
  • **
  • Posts: 39
  • Rating: +3/-3
  • Life is simple, but we make it complicated ~conf.
    • View Profile
    • Red Rock Creative [Free Custom Websites]
Re: can someone help me
« Reply #11 on: May 30, 2011, 04:19:27 pm »
 know that but what i can't figure put is how to identify whats were in the calc and i dont know anything about hex codes

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: can someone help me
« Reply #12 on: May 30, 2011, 04:25:34 pm »
Just write on a paper what is were

example:
x position: L1
y position: L1+1
lives: L1+2
health: L1 + 3
...

now, if you want to store the health in A, you do {L1+3}->A
if you want to store B in the lives 'variable', you do B->{L1+2}
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline spud2451

  • LV2 Member (Next: 40)
  • **
  • Posts: 39
  • Rating: +3/-3
  • Life is simple, but we make it complicated ~conf.
    • View Profile
    • Red Rock Creative [Free Custom Websites]
Re: can someone help me
« Reply #13 on: May 30, 2011, 04:35:07 pm »
i know that but i want to be able to draw sprites

Offline BrownyTCat

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 420
  • Rating: +37/-8
    • View Profile
Re: can someone help me
« Reply #14 on: May 30, 2011, 04:54:55 pm »
i know that but i want to be able to draw sprites
Use the hex converter bundled with Axe.