Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;=====================================================
- TileMap1:
- ;=====================================================
- ;Inputs:
- ; DE=MapLoc
- ; BC=TileLoc
- ; HL=MapWidth
- ; A=TileLogic
- ; (TempWord2)=Map X
- ; (TempWord3)=Map Y
- ;=====================================================
- and 7
- ld (TempWord1),a
- push bc
- push hl
- push de
- ld bc,(TempWord3)
- call HL_Times_BC
- ld bc,(TempWord2)
- add hl,bc
- pop bc \ add hl,bc
- pop de \ push hl
- ld hl,-12 \ add hl,de
- pop de
- ld (TempWord2),hl
- xor a \ ld (TempWord1+1),a
- pop bc
- ;DE points to first Map Element
- ;(TempWord2) is the map width thing
- ;BC points to the sprite data
- TileMap1loop:
- ld h,12
- ld a,(de) \ inc de
- dec h
- jr nz,$+9
- ld hl,(TempWord2)
- add hl,de
- ex de,hl
- ld h,12
- push hl
- ld h,0 \ ld l,a
- add hl,hl
- add hl,hl
- add hl,hl
- add hl,bc
- ld a,(TempWord1+1)
- call DrawTile
- ld (TempWord1+1),a
- pop hl
- jr nz,TileMap1Loop+2
- ret
- DrawTile:
- ;Input:
- ; A is the tile number to draw plus
- ; HL points to the sprite data
- ;Output:
- ; A is incremented by 1
- ; BC is not changed
- ; DE is not changed
- ; HL is not changed
- ; z flag set if A is 96
- cp 96 \ ret z
- push af
- push hl
- push de
- push bc
- ex de,hl
- ;DE points to sprite
- ld c,a \ ld l,12
- call C_Div_L
- ;a+bc*96
- ld h,b \ ld l,c
- add hl,hl \ add hl,bc
- add hl,hl \ add hl,hl
- add hl,hl \ add hl,hl
- add hl,hl
- ld c,a \ add hl,bc
- ld bc,(BufPtr)
- add hl,bc
- ld bc,0108h
- ld a,(TempWord1)
- call DrawSpriteXxY
- pop bc
- pop de
- pop hl
- pop af
- inc a
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement