Re: A86: Sprites


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

Re: A86: Sprites



Yeah - it seems not to view it at all - oh well, i guess I just have to use
Put and Remove sprite =)
				Ahmed

At 06:58 PM 9/27/97 +0000, you wrote:
>Strange...  I used the same routines, and even a PutSprite that I wrote in my
>test for sprites in my Mario game, and it doesn't display the sprites...  I
>used Dan Eble & James Yopp's FindPixel routine and the PutSpriteXOR that
>Trent Lillehaugen posted (and it looks like you're using the same ones), but
>0 into bc, pointed hl to sprite (same format as yours) and called
>PutSpriteXOR and it did nothing...  Is that what's happening to you?
>
>~Steve
>
>In a message dated 97-09-27 11:23:20 EDT, Ahmed El-Helw writes:
>
>> 
>>  Hello Guys - I wonder if anyone can tell me what is wrong w/this ?  I
>>  stored 0 into landy and 0 into landx as a test, but the only way it works
>>  is ld a,0 ld b,a , same w/c.  Why ?  Here is the part of the source ...
>>  Please help if you can!
>>  
>>  ------------------------
>>  
>>  dispLander:
>>  	ld	a,(landy)
>>  	ld	b,a
>>  	ld	a,(landx)
>>  	ld	c,a
>>  	ld	hl,SHIP
>>  	call	PutSpriteXOR
>>  	ret
>>  
>>  ---------------------------
>>  
>>  And here are the sprite routines and the sprite.
>>  
>>  -----------------------------
>>  
>>  PutSpriteXOR: ; Puts a sprite stored at (HL) at B,C
>>        push bc           ; save BC
>>        push de           ; save DE
>>        push hl   ; save HL
>>        push hl   ; save HL
>>        ld e,b
>>        ld d,c
>>        call FindPixel ; NOTE i did not include the FindPixel Routine..
>>                             ;its the one found on this list earlier!
>>        ld de,$FC00  ; DE points to VID MEM
>>        ex de,hl                  ; DE = VID MEM + PIXEL LOC
>>        pop hl                    ; HL = PIC LOC
>>        ld b,(hl)                 ; get first byte from PIC LOC (width)
>>        inc hl                    ; HL = next byte in PIC LOCATION
>>        ld c,(hl)                 ; get second byte from PIC LOC (height)
>>        inc hl                    ; HL = START OF PIC
>>        push hl                   ; save HL
>>        pop ix   ; IX = START OF PIC
>>        ex de,hl                  ; HL = VID MEM + PIXEK LOC DE = START OF
>>  PIC
>>  PS_NewRow:
>>        push bc                   ; save BC
>>        ld d,(ix)   ; D = next byte of PIC
>>        inc ix   ; IX points to next byte
>>        push af                   ; save AF
>>        push hl   ; save HL
>>  PS_NewCol:
>>        rl d   ; Rotate Left D
>>        ld e,a   ; e = a
>>        jr nc,PS_NoPixel        ; if No Carry then goto NoPixel
>>        ;************ can be OR or XOR or AND or whatever :)  *****
>>        xor (hl)                   ; a = a or (hl)
>>        ;***************************************************
>>        ld (hl),a                 ; hl = hl or a (basically)
>>        jr PS_NextPixel
>>  PS_NoPixel:
>>        cpl
>>        and (hl)
>>        ld (hl),a
>>  PS_NextPixel:
>>        ld a,e                    ; get A back
>>        rrca                      ; rotate right circular
>>        jr nc,PS_SameByte  ; if no carry then same byte
>>        inc hl                    ; else HL points to next byte in PIC
>>  PS_SameByte:
>>        djnz PS_NewCol            ; go to next column
>>        pop hl
>>        pop af
>>        ld de,16
>>        add hl,de
>>        pop bc
>>        dec c
>>        jr nz,PS_NewRow
>>        pop hl
>>        pop de
>>        pop bc
>>        ret
>>  
>>  FindPixel:
>>          ld a,e
>>          and $07         ; a = bit offset
>>          ld b,0
>>          ld c,a
>>          ld hl,FP_Bits
>>          add hl,bc
>>          ld b,(hl)       ; b = bitmask for (hl)
>>  ;56 t-states up to this point
>>          ld a,d
>>          rlca            ; multiply y by 4
>>          rlca
>>          ld l,a
>>          ld h,0
>>          add hl,hl       ; multiply y by 4 again
>>          add hl,hl       ;   because there are 16 bytes in a pixel row
>>          ld a,e
>>          rrca            ; divide x by 8 (8 pixels/byte)
>>          rrca
>>          rrca
>>          and $0F
>>          ld c,a
>>          ld a,b          ; now a = bitmask for (hl)
>>          ld b,$FC
>>          add hl,bc       ; hl -> byte in LCD memory
>>  ;150 t-states up to this point
>>          ret
>>  FP_Bits: .db $80,$40,$20,$10,$08,$04,$02,$01
>>  
>>  ;-----------------------------------------------------
>>  
>>  SHIP:
>>     	.db 8,8
>>     	.db %00011000
>>     	.db %00100100
>>     	.db %00100100
>>     	.db %00100100
>>     	.db %01000010
>>     	.db %01011010
>>     	.db %11100111
>>     	.db %00011000
>>  
>>  ------------------------------------
>>  
>
>
Ahmed El-Helw
ahmed3@worldnet.att.net
http://ahmed1.home.ml.org
The Ultimate TI-83 Site!
http://asm86.home.ml.org
The Ultimate TI-86 ASM Site
ICQ :  3350394
__________________________
Member of The TI-Files!
http://ti-files.home.ml.org
Member of KickASM
http://kickasm.home.ml.org


References: