Author Topic: Tilemapping in Axe  (Read 9946 times)

0 Members and 1 Guest are viewing this topic.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Tilemapping in Axe
« Reply #15 on: August 14, 2011, 06:55:27 pm »
What he said.
the A*8 is indeed because of the 8x8 tiles, and in {Q+B*24+P+A+GDB1}, Q+B*24 is interpreted as (Q+B)*24 because of left to right order of operations.  The width of the map is 24, so to get to the next row, you add 24, in this case, you add Q+B number of rows.  Add one to go one byte to the right, so P and A are added, plus the original pointer, GDB1.

Hem... Is it normal? IRL, or in C, the * operaotr has more priotiy than +...

Axe uses left to right order of operations. I would guess that the number one mistake beginner axe programmers make is forgetting this.
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Tilemapping in Axe
« Reply #16 on: August 28, 2011, 05:51:49 am »
Its done in Axe because its faster to compile and it forces you to write more optimized code (not necessarily more readable) since accumulators in assembly are naturally computed left to right.
« Last Edit: August 28, 2011, 05:52:31 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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: Tilemapping in Axe
« Reply #17 on: September 27, 2011, 02:44:32 pm »
It's a bit of a necro :P but I'm having some problems with this.
For a level stored column-by-column instead of row-by-row, what changes would be made to the formulas?  Would I switch the part where it multiplies width to multiplying my height?  Switch x- and y-coordinates?  Both?
Vy'o'us pleorsdti thl'e gjaemue

Offline C0deH4cker

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 258
  • Rating: +11/-1
    • View Profile
    • iNinjas Forum/Repo
Re: Tilemapping in Axe
« Reply #18 on: October 20, 2011, 05:10:08 pm »
For nibbles, cant you just do this?

Code: [Select]
:For(A,GDB1,GDB1+length(GDB1)-1)
:2*A->Z
:nib{Z}->M
:nib{Z+1}->N
:.display sprite M
:.display sprite N
:End

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Tilemapping in Axe
« Reply #19 on: October 21, 2011, 06:56:57 am »
For nibbles, cant you just do this?

Code: [Select]
:For(A,GDB1,GDB1+length(GDB1)-1)
:2*A->Z
:nib{Z}->M
:nib{Z+1}->N
:.display sprite M
:.display sprite N
:End
optimized with explanation ;)
Code: [Select]
:For(A,GDB1,GDB1+length(GDB1)-1)
:Z/16->M   //gets only the first 4 bits 'cause it rounds
:Z^16->N    //gets only last 4 bits(modulo)
:.display sprite M
:.display sprite N
:End

Offline C0deH4cker

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 258
  • Rating: +11/-1
    • View Profile
    • iNinjas Forum/Repo
Re: Tilemapping in Axe
« Reply #20 on: October 21, 2011, 11:55:11 am »
Cool thanks. should help me now.