[A83] A Routine To Display Big Sprites


[Prev][Next][Index][Thread]

[A83] A Routine To Display Big Sprites




Does anybody has a routine to display 16x16 sprites, especially a XOR 
routine. Movax's routine is only for 8x8. Or do I have to program it for ION 
using, ION putbigsprite.
I have also a problem with text. When I display text on the screen and after 
that I put a moving 8x8 sprite on the screen, the text dissapears.
Also when I displayed an 8x8 moving sprite, using Movax routine, the 
movement was terribly slow, I could do it faster in basic, I used this 
code(don't look at the crappy sprite:
.NOLIST			;Necessary stuff,
#define end .end
#define END .end
#define equ .equ
#define EQU .equ
#include "ti83asm.inc"
#include "tokens.inc"
.LIST
#DEFINE shipx 8265h
#DEFINE shipy 8266h

KClear		.equ 191
.org 9327h		; Begin
progstart:
	call _clrLCDFull
	ld hl,256*0+1   ; in the routine
	ld (pencol),hl
	ld hl,nameandversion
	call _vputs
	ld b,0
	ld c,56
	ld d,94
	ld e,56
	ld h,1
	call _Iline
	ld a,0
	ld (shipx),a
	ld a,20
	ld (shipy),a
clearloop:
	ld a,0ffh
	out (1),a
	ld a, 0fdh
	out (1),a
	in a,(1)
	cp KClear
	jp z, startgame
flyship:
	call drawship
	ld a,(shipx)
	inc a
	ld (shipx),a
	call drawship
	jr clearloop
drawship:
	ld a,(shipy)
        ld e,a
        ld a,(shipx)
        ld bc,ship 	;Load sprite name to bc
        call SPRXOR 	;Call movax' Sprite Routine
        call _grbufcpy_v
        ret


startgame:
	ret
ship:
	.db %0000000000000000
	.db %0000000000000000
	.db %0100000001000000
	.db %0011101100111011
	.db %0100010001000100
	.db %0111111101111111
	.db %0000000000000000
	.db %0000000000000000
SPRXOR:

        push    bc              ; Save sprite address

;====   Calculate the address in graphbuf   ====

        ld      hl,0            ; Do y*12
        ld      d,0
        add     hl,de
        add     hl,de
        add     hl,de

        add     hl,hl
        add     hl,hl

        ld      d,0             ; Do x/8
        ld      e,a
        srl     e
        srl     e
        srl     e
        add     hl,de

        ld      de,8e29h
        add     hl,de           ; Add address to graphbuf

        ld      b,00000111b     ; Get the remainder of x/8
        and     b
        cp      0               ; Is this sprite aligned to 8*n,y?
        jp      z,ALIGN


;====   Non aligned sprite blit starts here   ====

        pop     ix              ; ix->sprite
        ld      d,a             ; d=how many bits to shift each line

        ld      e,8             ; Line loop
LILOP:  ld      b,(ix+0)        ; Get sprite data

        ld      c,0             ; Shift loop
        push    de
SHLOP:  srl     b
        rr      c
        dec     d
        jp      nz,SHLOP
        pop     de

        ld      a,b             ; Write line to graphbuf
        xor     (hl)
        ld      (hl),a

        inc     hl
        ld      a,c
        xor     (hl)
        ld      (hl),a

        ld      bc,11           ; Calculate next line address
        add     hl,bc
        inc     ix              ; Inc spritepointer

        dec     e
        jp      nz,LILOP        ; Next line

        jp      DONE1


;====   Aligned sprite blit starts here   ====

ALIGN:                          ; Blit an aligned sprite to graphbuf
        pop     de              ; de->sprite

        ld      b,8
ALOP1:  ld      a,(de)
        xor     (hl)
        ld      (hl),a
        inc     de
        push    bc
        ld      bc,12
        add     hl,bc
        pop     bc
        djnz    ALOP1

DONE1:
        ret

nameandversion:
	.db "Ultimate Bomber v 0.11",0

.end
END

------------------------------------------------
"If I have seen farther than others, it is because I was standing on the 
shoulders of giants." - scientist Sir Isaac Newton, in a letter to his 
colleague Robert Hooke, February 1676.




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





Follow-Ups: