Re: A82: PutSprite Help


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

Re: A82: PutSprite Help



At 11:53 PM 9/23/97 -0400, you wrote:
>I cant get Putsprite to work look at my code someone please
>
>#include "ti82.h"
>#include "oldcall.h"
>#include "graph.h"
>
>.org START_ADDR
>.db "Sprite",0
>
>Init: 
>	ld hl, Sprite
>	ld b,10
>	ld c,10
>Loop:
>	ld hl, Sprite
>	ld b,10
>	ld c,10
>
>	CALL_(PutSprite)
>	CALL_(END)
Don't use a CALL_() here...it will put the calc in an infinite loop.
>	jr Loop
>
>END:
>	call GET_KEY
>	cp 15
>	ret z
>	ret
>PutSprite:
> push bc
> push de
> ld a,63
> sub c
> ld c,a
> push hl
> push hl
> ROM_CALL(FIND_PIXEL)
> ld de,$88B8                      ;CHANGED FROM $FC00 is that right?
Yep.
> add hl,de
> ex de,hl
> pop hl
> ld b,(hl)
> inc hl
> ld c,(hl)
> inc hl
> push hl
> pop ix
> ex de,hl
>PS_NewRow:
> push bc
> ld d,(ix)
> inc ix
> push af
> push hl
>PS_NewCol:
> rl d
> ld e,a
> jr nc,PS_NoPixel
> or (hl)
> ld (hl),a
> jr PS_NextPixel
>PS_NoPixel:
> cpl
> and (hl)
> ld (hl),a
>PS_NextPixel:
> ld a,e
> rrca
> jr nc,PS_SameByte
> inc hl
>PS_SameByte:
> djnz PS_NewCol
> pop hl
> pop af
> ld de,16
ERROR!!!!  This line needs to be ld de,12...NOT 16.  This indicates how
many bytes across the screen there are.  On the 85 there are 16, on the 82
there are 12.
> add hl,de
> pop bc
> dec c
> jr nz,PS_NewRow
> pop hl
> pop de
> pop bc
> ret
>
>Sprite:
>.db 6,6 
>.db %110011
>.db %100001
>.db %000000
>.db %000000
>.db %100001
>.db %110011
>
>#include "graph.inc"
>
>.end

Also, I notice that your source doesn't display the GRAPM_MEM to the
screen.  Remember to make a ROM_CALL to do that or you will end up with a
blank screen.

Hope that answers your question,

                 Thomas J. Hruska -- thruska@tir.com
Shining Light Productions -- "Meeting the needs of fellow programmers"
         http://www.geocities.com/SiliconValley/Heights/8504
                    http://shinelight.home.ml.org


References: