mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-27 07:30:12 +00:00
sprites: start adding putsprite for asteroids
This commit is contained in:
parent
5db8dcc53a
commit
93e0f4af41
80
interlace_demo/gr_putsprite.s
Normal file
80
interlace_demo/gr_putsprite.s
Normal file
@ -0,0 +1,80 @@
|
||||
;=============================================
|
||||
; put_sprite
|
||||
;=============================================
|
||||
; Sprite to display in INH,INL
|
||||
; Location is SPRITE_XPOS,SPRITE_YPOS
|
||||
; Note, only works if SPRITE_YPOS is multiple of two
|
||||
|
||||
; NO TRANSPARENCY
|
||||
|
||||
; 28+ Y*(34+17+X*(18+13) + 5
|
||||
; 33 + Y*(51+31*X)
|
||||
|
||||
; so if 3*2 = 321 cycles??
|
||||
|
||||
put_sprite:
|
||||
|
||||
ldy #0 ; byte 0 is xsize ; 2
|
||||
lda (INL),Y ; 5
|
||||
sta CH ; xsize is in CH ; 3
|
||||
iny ; 2
|
||||
|
||||
lda (INL),Y ; byte 1 is ysize ; 5
|
||||
sta CV ; ysize is in CV ; 3
|
||||
iny ; 2
|
||||
|
||||
lda SPRITE_YPOS ; make a copy of ypos ; 3
|
||||
sta TEMPY ; as we modify it ; 3
|
||||
;===========
|
||||
; 28
|
||||
put_sprite_loop:
|
||||
sty TEMP ; save sprite pointer ; 3
|
||||
ldy TEMPY ; 3
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
clc ; 2
|
||||
adc SPRITE_XPOS ; add in xpos ; 3
|
||||
sta OUTL ; store out low byte of addy ; 3
|
||||
lda gr_offsets+1,Y ; look up high byte ; 4
|
||||
adc DRAW_PAGE ; ; 3
|
||||
sta OUTH ; and store it out ; 3
|
||||
ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
; OUTH:OUTL now points at right place
|
||||
|
||||
ldx CH ; load xsize into x ; 3
|
||||
;===========
|
||||
; 34
|
||||
put_sprite_pixel:
|
||||
lda (INL),Y ; get sprite colors ; 5
|
||||
iny ; increment sprite pointer ; 2
|
||||
|
||||
sty TEMP ; save sprite pointer ; 3
|
||||
ldy #$0 ; 2
|
||||
sta (OUTL),Y ; and write it out ; 6
|
||||
;============
|
||||
; 18
|
||||
|
||||
put_sprite_done_draw:
|
||||
|
||||
ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
inc OUTL ; increment output pointer ; 5
|
||||
dex ; decrement x counter ; 2
|
||||
bne put_sprite_pixel ; if not done, keep looping ; 3
|
||||
;==============
|
||||
; 13
|
||||
|
||||
; -1
|
||||
inc TEMPY ; each line has two y vars ; 5
|
||||
inc TEMPY ; 5
|
||||
dec CV ; decemenet total y count ; 5
|
||||
bne put_sprite_loop ; loop if not done ; 3
|
||||
;==============
|
||||
; 17
|
||||
|
||||
; -1
|
||||
rts ; return ; 6
|
||||
|
||||
|
||||
|
||||
|
@ -23,20 +23,25 @@ BASL = $28
|
||||
BASH = $29
|
||||
FRAME = $60
|
||||
BLARGH = $69
|
||||
SPRITE_XPOS = $E0
|
||||
SPRITE_YPOS = $E1
|
||||
DRAW_PAGE = $EE
|
||||
|
||||
|
||||
FIRE_X = $F0
|
||||
FIRE_Y = $F1
|
||||
YPOS = $F2
|
||||
YADD = $F3
|
||||
BLAST1 = $F4
|
||||
BLAST2 = $F5
|
||||
FIRE = $F6
|
||||
TEMP = $F7
|
||||
WHICH = $F8
|
||||
TEMPY = $F9
|
||||
LEVEL_DONE = $FA
|
||||
|
||||
YPOS = $F3
|
||||
YADD = $F4
|
||||
BLAST1 = $F5
|
||||
BLAST2 = $F6
|
||||
FIRE = $F7
|
||||
TEMP = $FA
|
||||
WHICH = $FB
|
||||
TEMPY = $FC
|
||||
LEVEL_DONE = $FD
|
||||
INL = $FC
|
||||
INH = $FD
|
||||
OUTL = $FE
|
||||
OUTH = $FF
|
||||
|
||||
@ -1013,7 +1018,7 @@ erase_fire:
|
||||
.include "gr_copy.s"
|
||||
.include "vapor_lock.s"
|
||||
.include "delay_a.s"
|
||||
|
||||
.include "gr_putsprite.s"
|
||||
|
||||
.assert >gr_offsets = >gr_offsets_done, error, "gr_offsets crosses page"
|
||||
.assert >wait_loop = >(wait_loop_end-1), error, "wait_loop crosses page"
|
||||
|
Loading…
x
Reference in New Issue
Block a user