Re: A83: ASM Help


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

Re: A83: ASM Help



here is code help


Joe Wingbermuehle wrote:

> call graphcopy_v or something like that is somewhere in your code. Put it
> after you redraw the sprite only, not with the routine or after every time
> you call the routine. You should have it only once in the main loop
> actually.
>
> Joe Wingbermuehle
> http://www.usmo.com/~joewing/
>
> -----Original Message-----
> From: Gary Hanson <ghanson@bellsouth.net>
> To: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
> Date: Wednesday, October 28, 1998 9:16 PM
> Subject: Re: A83: ASM Help
>
> >
> >i just use movax's sprite routine so i don't know what u r talkin bout
> >
> >Joe Wingbermuehle wrote:
> >
> >> Don't call the buffer copy routine so often, or use a faster buffer copy
> >> routine. Never call a buffer copy routine when you're sprite is off!
> That's
> >> probably what you're doing.... You won't see flicker if you don't copy
> the
> >> buffer when the sprite is off.
> >>
> >> Joe Wingbermuehle
> >> http://www.usmo.com/~joewing/
> >>
> >> -----Original Message-----
> >> From: Gary Hanson <ghanson@bellsouth.net>
> >> To: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
> >> Date: Wednesday, October 28, 1998 9:06 PM
> >> Subject: Re: A83: ASM Help
> >>
> >> >
> >> >well i know it doesn't flicker when i mover it slow but what if my
> program
> >> >depends on a sprite running around all the time??
> >> >
> >> >David Phillips wrote:
> >> >
> >> >> Flicker is caused by two things:  slow erase/move/draw cycle and the
> slow
> >> >> lcd refresh rate.  There is nothing you can do about the lcd being
> slow,
> >> >> besides not trying to move graphics too fast.  The other thing that
> >> causes
> >> >> flicker is waiting too long after you erase the sprite to redraw it.
> The
> >> >> basic setup for sprites is to erase them, compute their new positions,
> >> then
> >> >> redraw all of them.  If too much time passes after they are erased
> before
> >> >> they are redrawn, the user will perceive that as flicker.
> >> >>
> >> >> However, because the 83 uses a display controller and not a memory
> mapped
> >> >> display, there should not be any flicker caused by this, because it
> >> should
> >> >> only be dumped to the display controller after the sprites have been
> >> >> completely erased and redrawn.  You are probably just moving a sprite
> too
> >> >> fast, as usually happens on your first sprite program where all you do
> is
> >> >> move a sprite around the screen.  Waiting longer in between frames
> should
> >> >> solve your problem.
> >> >>
> >> >> -----Original Message-----
> >> >> From: Gary Hanson <ghanson@bellsouth.net>
> >> >> To: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
> >> >> Date: Wednesday, October 28, 1998 8:45 PM
> >> >> Subject: Re: A83: ASM Help
> >> >>
> >> >> >
> >> >> >no im talkin about when its moving across the screen and it still
> blinks
> >> >> even when i
> >> >> >make it move 2 pixels at a time
> >> >> >Olle Hedman wrote:
> >> >> >
> >> >> >> The reson why it blinks when you hold down a key is not the
> >> >> spriteroutine.. its
> >> >> >> in your codeing..  I assume now that you mean it is blinking when
> you
> >> >> hold down
> >> >> >> a key, and the sprite isnt moving.. (like its at the edge of the
> >> screen
> >> >> >> or such..) the way to solve this is to never erase a sprite unless
> you
> >> >> are going
> >> >> >> to move it.. i you do..  it will flicker.. I mean..  when its at
> the
> >> >> edge, not
> >> >> >> only skip the changeing of spriteposition.. also skip the updating
> of
> >> the
> >> >> >> sprite..
> >> >> >>
> >> >> >> /Olle Hedman - alh
> >> >> >>
> >> >> >> Gary Hanson wrote:
> >> >> >> >
> >> >> >> > i already know some basic Assembly for the ti-83 from a help file
> i
> >> >> >> > downloaded but i wanna find out about better stuff like stuff
> used
> >> to
> >> >> >> > program pacman for sos and how to set it up to make levels with
> >> numbers
> >> >> >> > and stuff where can i find out about this plz help i am stuck on
> a
> >> game
> >> >> >> >
> >> >> >> > also does anyone have a sprite routine that doesn't blink when u
> >> hold
> >> >> >> > down a key (movax's)
> >> >> >> > help!
> >> >> >> > felix
> >> >> >
> >> >> >
> >> >
> >> >
> >> >
> >
> >
> >


.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "felix.inc"
.LIST
#DEFINE mse_x 8265h
#DEFINE mse_y 8266h

.org 9327h

  nop
  jr      ProgStart
 .dw     $0000
 .dw     GameName
ProgStart:
         call _clrLCDFull 	
         call _runIndicOff 	
         call _grbufclr 	; Clear the graph buffer.
         call _homeup
         jp z,moveloop
         ld a,10 		;Initial X & Y coords of mouse.
         ld (mse_x),a 	
         ld a,10
         ld (mse_y),a
         jp moveloop

moveloop:
        call putmse 		;Call putmse
        jp getky

getky: 				;routine getkey
         ld a,0ffh
         out (1),a
         ld a,0feh
         out (1),a
         in a,(1)
         cp k_left 		
         jp z,left 		
         cp k_right 		
         jp z,right 		
         cp k_up 		
         jp z,up
         cp k_down
         jp z,down
         ld a,0ffh
         out (1),a 
         ld a,0fdh
         out (1),a
         in a,(1)
         cp k_clear 		;If the key clear...
         jp z,quit 		;...quit.
         jp getky 		;Repeat.

left:
         call putmse
         ld a,(mse_x) 	;Load XCoord Variable into A
         dec a 		;Decrease A
         dec a
         cp 0
         jp z,lbound
         ld (mse_x),a 	;Load back into mse_x
         jp moveloop 	;goto moveloop
right:          
         call putmse          
         ld a,(mse_x) 	;Load XCoord Variable into A
         inc a 		;Increase A
         inc a
         cp 88
         jp z,rbound
         ld (mse_x),a 	;Load back into mse_x
         jp moveloop 	;goto moveloop
down:          
         call putmse
         ld a,(mse_y) 	;Load YCoord Variable into A
         dec a 		;Decrease A
         dec a
         cp 0
         jp z,bbound
         ld (mse_y),a 	;Load back into mse_y
         jp moveloop 	;goto moveloop
up: 
         call putmse
         ld a,(mse_y) 	;Load YCoord Variable into A
         inc a 		;Increase A
         inc a
         cp 56
         jp z,tbound
         ld (mse_y),a 	;Load back into mse_y
         jp moveloop 	;goto moveloop
putmse:
         ld a,(mse_y) 
         ld e,a 		
         ld a,(mse_x) 	
         ld bc,mouse 	;Load sprite name to bc
         call SPRXOR 	;Call movax' Sprite Routine 
         call _grbufcpy_v
         ret

quit:
         call _clrLCDFull
         call _grbufclr
         call _dispDone
         ret

mouse:		; Here is the sprite for the mouse.  0=off, 1=on.
 	.db %01111110
 	.db %01111110
 	.db %01011010
        .db %01111110
        .db %01011010
 	.db %01100110
 	.db %01111110
 	.db %01111110

;  Z80  Sprite83  Movax
; Sprite xor routine v1.0
; Coded by Hannes Edfeldt in 1997

; This routine uses xor to draw the sprite, therefore
; you can erase the sprite by just drawing it again at
; the same x and y coordinates. See xordemo.z80 for an
; example of how to use this routine.

; Feel free to use this routine in your own productions

; as long as you give me some credit.

; This file should of course be viewed in a DOS texteditor ;)

; Hannes Edfeldt -+- movax@algonet.se -+- http://www.algonet.se/~movax

; 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 

; Z80 Sprite83  movax
GameName:
 .db "BomberMan v0.01a  By: FeliX",0
lbound:
 ld a,2
 ld (mse_x),a
 jp moveloop
rbound:
 ld a,86
 ld (mse_x),a
 jp moveloop
tbound:
 ld a,54
 ld (mse_y),a
 jp moveloop
bbound:
 ld a,2
 ld (mse_y),a
 jp moveloop
;All tutorials Copyright (c) James Matthews 1998, unless specified.

.end
END

References: