Re: A86: Re: PutSprite


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

Re: A86: Re: PutSprite




Thanks for the routine.  I was wondering:  has anyone tried making an
unrolled putsprite routine?

At 05:48 PM 6/2/98 -0400, you wrote:
>
>Try this routine..
>Matt S. made this XOR, but you can de-Xorisize it by replacing every XOR to
>an Or.. that'll do the trick [ex. if it says xor a, change to or a..]
>                                                                            
>                    -Ahmed
>
>ahmedre@bellsouth.net
>
>http://asm8x.home.ml.org
>;------------------
>; Sprite Routine [XOR]
>;------------------
>;------------------
>;This Routine was converted by AVD from Movax's 83
>;------------------
>;hl = image
>;a = x coord
>;e = y coord
>PutSprite:
>       push    hl              ; Save sprite address
>;лллл   Calculate the address in graphbuf   лллл
>        ld      hl,0            ; Do y*12
>        ld      d,0
> ex de,hl
> add hl,hl
> add hl,hl
> 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,$FC00
>        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,15           ; 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)            ; xor=erase/blit
>        ld      (hl),a
>        inc     de
>        push    bc
>        ld      bc,16
>        add     hl,bc
>        pop     bc
>        djnz    ALOP1
>DONE1:
>        ret
>;мллллллллллллм SPRITE
>мллллллллллллллллллллллллллллллллллллллллллллллллллллллл
>-----Original Message-----
>From: David Phillips <electrum@tfs.net>
>To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
>Date: Monday, June 01, 1998 6:21 PM
>Subject: Re: A86: Re: PutSprite
>
>
>>
>>No offense, but I think he wants strictly 8x8, not a variable sized
>>routine.  I am also interested in a strictly 8x8 routine, since it would be
>>faster and not require storing the size with the data.
>>
>>At 05:27 PM 6/1/98 -0400, you wrote:
>>>
>>>>What's the best, most efficient way to draw an 8x8 sprite a given
>location
>>>on
>>>>the screen?  (Not XORing it to the screen)
>>>
>>>I posted a PutSprite routine earlier for 8 by X or 16 by X sprites on May
>>>7th. Check back on your messages folder
>>>
>>>
>>
>>
>>// David Phillips
>>// mailto:electrum@tfs.net
>>// AIM: electrum32
>>
>
>


// David Phillips
// mailto:electrum@tfs.net
// AIM: electrum32


References: