Re: A83: Basic Extention Program


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

Re: A83: Basic Extention Program




Exactually what I was thinking.

I started on the sprite one...  it hsouldn't be that hard but my logic
is screwed up and I don't have the time to work it out.  See what I am
doing wrong here.  It might be that the lists elements aren't next to
each other or something??


Also I think lists will be easier.  First of all you can use Sprxor
because it just takes the number and converts it to binary, to use
matrixes you would have to pixel plot them because of the 1,0,1 in the
matrix ect..  At least I think.


Jimmy


.NOLIST
#define equ .equ
#define EQU .equ
#define END .end
#include "ti83asm.inc"
#include "tokens.inc"
.LIST
_errundefined 	.equ 	467Bh
rlstobj 		.equ 	01h
.org 	9327h
	call 	_zerooop1     	
	ld 	hl, listname      
	ld 	de, op1           
	ld 	bc, 6             
	ldir               
	call  _chkfindsym    
	jp 	c, _errundefined
	inc	de
	inc	de
	push	de
	pop	bc   ; Now is pointer to first element

	call	_rclx
	ld	de, op1
	ld	a, e   ; X into a
	call	_rcly
	ld	de, op1  ; Y into e
	call	sprxor   ; Draw it

	ret


; SPRXOR 
; Xor 8x8 sprite þ a=x, e=y, bc=sprite address
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
; SPRXOR 
listname:
	.db rlstobj,tvarlst,"ASM",$00

.end
end
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com