Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: willrandship on June 10, 2010, 03:19:22 pm

Title: Why doesn't my Map Drawer Work?
Post by: willrandship on June 10, 2010, 03:19:22 pm
Code: [Select]
.TILEMAP
.SPRITES
[003C424242423C00]->Pic10
[00003C3C3C3C0000]->Pic20
.First Is top sprite, second bottom.
.MAP TEST
[00000000]->GDB1
[00000000]
[00000000]
[00000000]
[00000000]
[00000000]
[00000000]
[00000000]
LBL DP
ClrDraw
ClrDrawr
For(y,0,7)
For(X,0,7)
Pt-On(X*8,Y*8,Y*8+X+GDB1*16+Pic10)
Pt-On(X*8,Y*8,Y*8+X+GDB1*16+Pic20)r
Repeat getKey(15)
DispGraphrr
End

This, instead of drawing some nice sprites in an 8x8 grid, Draws Speckly garbage all over the grid. I think it's a problem with my GDB or Pic referencing, but I can't figure out how to fix it. Any help?
Title: Re: Why doesn't my Map Drawer Work?
Post by: nemo on June 10, 2010, 03:25:05 pm
in "Y*8+X+GDB1*16+Pic10" are you sure those are the correct order of operations? i'm not completely sure i haven't tested this on my calc yet (programming it in now) but shouldn't it be Y*8+X+GDB1+Pic10? i'll edit this post later.
Title: Re: Why doesn't my Map Drawer Work?
Post by: Quigibo on June 10, 2010, 03:27:31 pm
You're reading from an 8x16 grid.  Don't forget, each hex digit is half a byte.  You need them in pairs unless you're doing half-byte compression.
Title: Re: Why doesn't my Map Drawer Work?
Post by: cooliojazz on June 10, 2010, 03:28:48 pm
Yeah, there shouldn't be the *16 to the GDB1. Why'd you put that there, just curious? Also, you're map is 4 bytes wide, so it would be Y*4, not 8...
Title: Re: Why doesn't my Map Drawer Work?
Post by: willrandship on June 10, 2010, 03:59:44 pm
Well, the order of operations were correct, but I forgot the 2-digit byte rule (again)

the x16 was to get the Pic10 and Pic20 to the correct sprite. So, sprite 0 would be at +0, 1 would be +16 and 3 would be at +48

I changed the map to be 8 by 8 now...I also added {} to GDB1. That's the way to take the value at that location, right? That may have been one of the major issues.

Well, this time it shows the sprite I made at the top corner of the screen, but the rest is still a jumbled mess.
Title: Re: Why doesn't my Map Drawer Work?
Post by: cooliojazz on June 10, 2010, 04:01:58 pm
They would be at the correct place without *16... and no, you don't want {} because that argument is a memory location, the routine grabs the value itself.
EDIT: Hold on, never mind, i think your right, except it would be *8, since thats how big the tiles are right? the second part is still an issue tho =P
Title: Re: Why doesn't my Map Drawer Work?
Post by: willrandship on June 10, 2010, 04:04:58 pm
ok, thanks. I'll fix it again.
.
.
.
Well, It certainly did Something different. The scramblings are all now uniform, but I keep getting this weird stairs effect. Here' I'll get a screenshot if I can.

Edit: here's a screenie from my camera. I couldn't get the flash to shut off.

BTW the blue pixels are from the flash.

Edit2: Shrank the image. Sorry about that.
Title: Re: Why doesn't my Map Drawer Work?
Post by: jsj795 on June 10, 2010, 04:24:55 pm
can u post the source code that made this happen? It still seems like random RAM garbage bytes
Title: Re: Why doesn't my Map Drawer Work?
Post by: Builderboy on June 10, 2010, 04:29:19 pm
You want

Code: [Select]
Pt-On(X*8,Y*8,{Y*8+X+GDB1}*8+Pic10)
:)
Title: Re: Why doesn't my Map Drawer Work?
Post by: willrandship on June 10, 2010, 05:07:21 pm
Thanks! Now it works!

Now, to make the sprites for it....