[TI-84 ASM] 8x8 tile routine
Posted: Fri 25 Jan, 2008 1:23 am
I've put together some code to draw 96 8x8 tiles to the screen (the entire 8 rows and 12 columns) However, it does not DO anything, and clears my RAM when I exit. My approach was to draw each COLUMN in succession because each individual tile was drawn top to bottom as well. Anybody care to analyze my code, and possibly give pointers on any optimization?
Code: Select all
.nolist
#define EQU .equ
#define equ .equ
#define END .end
#define end .end
#define b_call B_CALL
#include "ti83plus.inc"
.list
.org $9D93
.db t2ByteTok, tAsmCmp
CALL DrawTile
DrawTile:
;IX = Screen Address
;DE = Map address
;HL = Sprite address
;B = Counter
;C = Column Counter
LD IX, plotSscreen ;get starting screen address
LD DE, map+1 ;get location of map file
;get value of first map file item
LD A, (DE) ;get tile from the map value
LD H, 0
LD L, A
LD BC, tiles
ADD HL, BC ;add the tile location
LD C, 0
LD B, 12
PUSH BC
LD B, 8
PUSH BC
JR _SpriteRowLoop
_NextColumn:
INC C
PUSH BC
LD B, 0
LD IX, plotSscreen
ADD IX, BC
_NextRow:
INC DE ;get next tile from map
LD A, (DE)
LD L, A ;get tile from the map value
LD H, 0
PUSH DE
LD DE, tiles
ADD HL, DE ;add the tile location
POP DE
LD B, 8
_SpriteRowLoop:
LD A, (HL)
LD (IX), A ;draw sprite
PUSH DE
LD DE, 12
ADD IX, DE
POP DE
INC HL
DJNZ _SpriteRowLoop
POP BC
DJNZ _NextRow
POP BC
DJNZ _NextColumn
bcall(_GrBufCpy)
RET
;get next row, repeat above 4 steps 8 times
;get next column, repeat above 5 steps 12 times
;WIN
map:
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
.DB 1,2,3,4,5,6,7,8
tiles:
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.DB %10110110
.end
.end