[A83] Re: tile maps and stuff


[Prev][Next][Index][Thread]

[A83] Re: tile maps and stuff




Cool....can someone explain how this code works?


  

  D Weiss <dwedit@hotmail.com> wrote: 

I suggest TCPA's tilemap routine:

;Input map address in DE
Drawmap:
ld hl, plotsscreen
ld bc, 8*256+0
DrawmapLoop:
ld a, (de)
push de
push hl
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld de, tiles
add hl, de
ex de, hl
pop hl
push bc
ld b, 8
push hl
DrawmapLoop2:
ld a, (de)
ld (hl),a
inc de
push bc
ld bc, 12
add hl, bc
pop bc
djnz DrawmapLoop2
pop hl
pop bc
pop de
inc de
inc hl
inc c
ld a, c
cp 12
jr nz, Drawmaploop
ld c,0
push de
ld de, 7*12
add hl, de
pop de
djnz Drawmaploop
ret


For the actual map, use a bunch of .db's:
Make sure it's 12 wide and 8 high (these are bytes, 0-255)


Map:
.db 1,1,1,1,1,1,1,1,1,1,0,0
.db 1,0,0,0,0,1,0,0,0,1,0,0...


(continue this 12 wide and 8 high)

Then tiles: (use .db %00000000) 0=white, 1=black

Tiles:
.db %10000000
.db %00001000
.db %00100000
.db %00000000
.db %00000010
.db %01000000
.db %00001000
.db %00000001

.db %11111111
.db %10000001
.db %10000001
.db %11111111
.db %11111111
.db %00011000
.db %00011000
.db %11111111


>From: Jeff Ruud
 
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: [A83] tile maps and stuff
>Date: Tue, 20 Feb 2001 19:11:41 -0800 (PST)
>
>
>How do i make a program that reads a tile map such as:
>000110001
>000000001
>101010111
>101010101
>or anything. I tried looking at source code to different programs but that 
>doesn't really help me, cuz nothing is explained. Basically i just want to 
>know how to read all of those ones and zeros at the bottom of the screen 
>and make a tile map out of it.
>
>Thanks for the help.....
>
>
>
>---------------------------------
>Do You Yahoo!?
>Yahoo! Auctions - Buy the things you want at great prices!
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com





---------------------------------
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices!




References: