TI-82 ASM
By: a guest | Mar 21st, 2010 | Syntax:
Z80 Assembler | Size: 1.49 KB | Hits: 43 | Expires: Never
#include "CRASH82.INC"
.DB "TI-82 ASM",0
1/>ld a,$8c ; set rom page 4
1/>out (2),a ; (needed for FIND_PIXEL)
ROM_CALL(CLEARLCD)
1/>call Clear_GRAPH_MEM ; clear GRAPH_MEM
1/>ld hl,TestSprite ; load address of sprite in HL
1/>ld bc,44*256+28 ; b = 44 = x / c = 28 = y
1/>call PutSprite ; put the sprite at (44,28)
ROM_CALL(DISP_GRAPH) ; copy GRAPH_MEM to LCD
ROM_CALL(KEY_HAND) ; wait for a key
1/>ret
Clear_GRAPH_MEM: ; routine that clears
1/>ld hl,GRAPH_MEM ; the GRAPH_MEM (fills
1/>ld de,GRAPH_MEM+1 ; it with zeros)
1/>ld (hl),0
1/>ld bc,767
1/>ldir
1/>ret
PutSprite: ; disassembling is for noobs
1/>push bc
1/>push de
1/>push hl
1/>push hl
1/>ld a,63
1/>sub c
1/>ld c,a
1/>call FIND_PIXEL
1/>ld de,GRAPH_MEM
1/>add hl,de
1/>ex de,hl
1/>pop hl
1/>ld b,(hl)
1/>inc hl
1/>ld c,(hl)
1/>inc hl
1/>push hl
1/>pop ix
1/>ex de,hl
PS_NewRow:
1/>push bc
1/>ld d,(ix)
1/>inc ix
1/>push af
1/>push hl
PS_NewCol:
1/>rl d
1/>ld e,a
1/>jr nc,PS_NoPixel
1/>or (hl)
1/>ld (hl),a
1/>jr PS_NextPixel
PS_NoPixel:
1/>cpl
1/>and (hl)
1/>ld (hl),a
PS_NextPixel:
1/>ld a,e
1/>rrca
1/>jr nc,PS_SameByte
1/>inc hl
PS_SameByte:
1/>djnz PS_NewCol
1/>pop hl
1/>pop af
1/>ld de,12
1/>add hl,de
1/>pop bc
1/>dec c
1/>jr nz,PS_NewRow
1/>pop hl
1/>pop de
1/>pop bc
1/>ret
TestSprite:
.db 8, 8
.db %11111111
.db %10001011
.db %10000101
.db %10001011
.db %11010101
.db %10101011
.db %11010101
.db %11111111
.end