home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------------------------------| April 4,1999
- ; "Drawsprite v1.2" |
- ;Description: Subroutine for fast sprite-graphics |
- ; for use with TI-82, with ASH 3.0 |
- ;-------------------------------------------------|
- ;-----------------------------------------|
- ;Author: Jakob Selbing, JSS (C) 1997-1999 |
- ; Comments, bugs, tips, anything on |
- ; your mind: |
- ; jakob_selbing@hotmail.com |
- ;-----------------------------------------|
- ;
- ;----------------------------------------------------|
- ;Credits: ASH-guys Dines and Mattias, Vikash R. Goel |
- ;----------------------------------------------------|
- ;
- ;How to use it
- ;----------------------------------------------------------------
- ;Call drawspriteloop with the x-position (0...88) stored in b,
- ;the y-position stored in c, the address of the sprite stored in de,
- ;and the number of rows your sprite is stored in slength.
- ;
- ;So if you want to draw a sprite on the third row, 20 pixels to
- ;the rigth, and have defined a sprite with 6 rows at the label
- ;"sprite1" you should do something like this:
- ;
- ; ld b,20 ;x-position, zero is the left edge of LCD
- ; ld c,3 ;y-position, zero is top line of LCD
- ; ld de,sprite1 ;this is the address of the first
- ; ;byte of the sprite
- ; ld a,6 ;this is the height of the sprite (i.e. rows)
- ; ld (slength),a
- ; call drawsprite
- ; ROM_CALL(DISP_GRAPH)
- ;
- ;ENJOY!!!!
- ;-----------------------------------------------------------------------
-
-
- #include "ti82.h"
-
- slength =TEXT_MEM+40
-
-
- drawsprite: ;Version 1.2, July 23 1998
- push de
- ld hl,$88B8
- ld de,12
- inc c
- DS_Row:
- dec c
- jr z,DS_Donerow
- add hl,de
- jr DS_Row
- DS_Donerow:
- ld a,b
- DS_Byte:
- cp 8
- jr c,DS_Donebyte
- sub 8
- inc hl
- jr DS_Byte
- DS_Donebyte:
- pop de
- push af
- DS_Return:
- pop af
- ex de,hl
- ld b,(hl)
- ld c,0
- push af
- DS_Shift:
- or a
- jr z,DS_Doneshift
- dec a
- srl b
- rr c
- jr DS_Shift
- DS_Doneshift:
- ex de,hl
- ld a,(hl)
- or b
- ld (hl),a
- inc hl
- ld a,(hl)
- or c
- ld (hl),a
- pop af
- inc de
- push de
- ld de,11
- add hl,de
- pop de
- push af
- ld a,(slength)
- dec a
- ld (slength),a
- or a
- jr nz,DS_Return
- pop af
- ret
-
- removesprite: ;Version 1.2, July 23 1998
- push de
- ld hl,$88B8
- ld de,12
- inc c
- RS_Row:
- dec c
- jr z,RS_Donerow
- add hl,de
- jr RS_Row
- RS_Donerow:
- ld a,b
- RS_Byte:
- cp 8
- jr c,RS_Donebyte
- sub 8
- inc hl
- jr RS_Byte
- RS_Donebyte:
- pop de
- push af
- RS_Return:
- pop af
- ex de,hl
- ld b,(hl)
- ld c,0
- push af
- RS_Shift:
- or a
- jr z,RS_Doneshift
- dec a
- srl b
- rr c
- jr RS_Shift
- RS_Doneshift:
- ex de,hl
- ld a,b
- cpl
- and (hl)
- ld (hl),a
- inc hl
- ld a,c
- cpl
- and (hl)
- ld (hl),a
- pop af
- inc de
- push de
- ld de,11
- add hl,de
- pop de
- push af
- ld a,(slength)
- dec a
- ld (slength),a
- or a
- jr nz,RS_Return
- pop af
- ret