[A83] Re: 16x16 tile map
[Prev][Next][Index][Thread]
[A83] Re: 16x16 tile map
I made one for casino kid... here it is... don't criticize, it works..
-joel seligstein
joel@basm.org
www.basm.org
-- Attached file included as plaintext by Listar --
-- File: BIGMAP.INC
;16x16 Tilemap Routine - by Joel Seligstein
;joel@basm.org - www.basm.org
;I know this routine is crappy, but it works.
;
;Input: DE = Map location
; All sprites are at label tiles:
;Output: ionLargeSprite is used to display the tilemap
; Buffer is copied to screen with ionFastCopy [can be removed]
big_map:
ld l,0 ;y coord=0
ld b,4
big_map2:
push bc
ld b,6 ;6 sprites per line
xor a ;x coord=0
big_map3:
push de ;save map location
push bc ;save b for djnz
push af ;save x coord
push hl ;save y coord
ld a,(de) ;map location -> a
ld h,0 ;hl=map loc
ld l,a ;hl=map loc
add hl,hl ;hl+hl=2 hl
add hl,hl ;hl+hl=4 hl
add hl,hl ;hl+hl=8 hl
add hl,hl ;hl+hl=16 hl
add hl,hl ;hl+hl=32 hl
ld de,tiles ;load location of tiles
add hl,de ;tile loc + (16 * tile number) = current tile
push hl ;push to pop as ix
pop ix ;pop hl as ix
pop hl ;pop y coord
pop af ;pop x coord
push af ;save x coord
push hl ;save y coord
ld c,2 ;2*8=16 pixels wide
ld b,16 ;16 pixels tall
call ionLargeSprite ;call sprite routine
pop hl ;pop y coord
pop af ;pop x coord
pop bc ;pop b for djnz
pop de ;pop map location
inc de ;increase map location by one
add a,16 ;increase x coord by 16
djnz big_map3 ;repeat!!!
pop bc
push hl
ld hl,42
add hl,de
ex de,hl
pop hl
ld a,16
add a,l
ld l,a
djnz big_map2
call ionFastCopy
ret