dos33fsprogs/games/sb/gr_putsprite.s

73 lines
951 B
ArmAsm
Raw Permalink Normal View History

2023-03-14 03:55:12 +00:00
;===============
2023-03-12 03:43:40 +00:00
; gr_put_sprite
2023-03-14 03:55:12 +00:00
;===============
; Sprite to display in INL/INH
; MASK (for transparency) on MASKL/MASH
2023-03-12 03:43:40 +00:00
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
2023-03-14 03:55:12 +00:00
; trashes A,X,Y
2023-03-12 03:43:40 +00:00
gr_put_sprite:
2023-03-14 03:55:12 +00:00
ldy #0
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
lda (INL),Y ; xsize
2023-03-12 03:43:40 +00:00
clc
adc XPOS
2023-03-14 03:55:12 +00:00
sta gps_xmax_smc+1 ; store xmas (self-modify)
2023-03-12 03:43:40 +00:00
iny ; 2
2023-03-14 03:55:12 +00:00
lda (INL),Y ; ysize
asl ; mul by 2
clc
adc YPOS
sta gps_ymax_smc+1
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
iny
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
tya
tax
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
lda INL
sta gps_src_smc+1
lda INH
sta gps_src_smc+2
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
gr_put_sprite_loop:
ldy YPOS
lda gr_offsets,Y
sta OUTL
lda gr_offsets+1,Y
clc
adc DRAW_PAGE
sta OUTH
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
ldy XPOS
gr_put_sprite_row:
cpy #40
bcs gr_put_sprite_dont_draw ; don't draw if out of bounds
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
gps_src_smc:
lda $f000,X
sta (OUTL),Y
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
gr_put_sprite_dont_draw:
iny
inx
gps_xmax_smc:
cpy #40
bne gr_put_sprite_row
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
inc YPOS
inc YPOS
lda YPOS
gps_ymax_smc:
cmp #40
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
bne gr_put_sprite_loop
2023-03-12 03:43:40 +00:00
2023-03-14 03:55:12 +00:00
gr_put_sprite_done:
2023-03-12 03:43:40 +00:00
rts ; return ; 6