Re: A86: Sprites


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

Re: A86: Sprites



> to work for me...  Could you please send an example program using these
> routines?

------------------------------------------------------------------------
this uses dan eble's sprite routine

#include "asm86.h"
#INCLUDE "TI86ASM.INC"

.org $D748

  call _clrLCD

  ld e,0
  ld d,0
  ld hl,pic
  call DrawPic
  ret

; IN : D  = y (0-7 inclusive)
;      E  = x (0-15 inclusive)
;      HL-> sprite
;
; OUT: AF, BC, DE, HL, IX modified

DrawPic:
        push hl
        pop ix          ; ix-> sprite

        srl d           ; de = 128y+x (16 bytes/row, 8 rows)
        rra
        and $80
        or e            ; add x offset (remember x <= 15)
        ld e,a

        ld hl,$FC00     ; hl-> vid mem
        add hl,de       ; hl-> vid mem + offset


        ld b,8          ; initialize loop counter
        ld de,$0010     ; initialize line increment

; originally 30b/126t to this point
; now 19b/90t to this point

DrawPicLoop:
        ld a,(ix+0)     ; get byte from sprite
        ld (hl),a       ; put byte on screen
        inc ix          ; move to next byte in sprite
        add hl,de       ; move to next line on screen

; originally 10b/66t inside loop
; now 7b/47t inside loop

        djnz DrawPicLoop
        ret

pic:
.db %00111100
.db %01000010
.db %10100101
.db %10000001
.db %10100101
.db %10011001
.db %01000010
.db %00111100

.end
.end


References: