dos33fsprogs/games/peasant/hgr_sprite.s

82 lines
1.1 KiB
ArmAsm
Raw Normal View History

2021-09-17 02:51:55 +00:00
;===========================================
; hgr draw sprite (only at 7-bit boundaries)
;===========================================
2021-09-15 20:32:43 +00:00
; SPRITE in INL/INH
; Location at CURSOR_X CURSOR_Y
2021-09-17 02:51:55 +00:00
; xsize, ysize in first two bytes
2021-09-15 20:32:43 +00:00
; sprite AT INL/INH
2021-09-17 02:51:55 +00:00
hgr_draw_sprite:
ldy #0
lda (INL),Y
clc
adc CURSOR_X
sta h4231_width_end_smc+1 ; self modify for end of output
iny
lda (INL),Y
sta h4231_ysize_smc+1
2021-09-15 20:32:43 +00:00
; set up sprite pointers
2021-09-17 02:51:55 +00:00
clc
2021-09-15 20:32:43 +00:00
lda INL
2021-09-17 02:51:55 +00:00
adc #2
2021-09-15 20:32:43 +00:00
sta h4231_smc1+1
lda INH
2021-09-17 02:51:55 +00:00
adc #0
2021-09-15 20:32:43 +00:00
sta h4231_smc1+2
ldx #0 ; X is pointer offset
stx MASK ; actually row
hgr_42x31_sprite_yloop:
lda MASK ; row
clc
adc CURSOR_Y ; add in cursor_y
; calc GBASL/GBASH
tay ; get output ROW into GBASL/H
lda hposn_low,Y
sta GBASL
lda hposn_high,Y
sta GBASH
ldy CURSOR_X
h3231_inner_loop:
h4231_smc1:
2021-09-17 02:51:55 +00:00
lda $d000 ; get sprite pattern
2021-09-15 20:32:43 +00:00
sta (GBASL),Y ; store out
inx
iny
2021-09-17 02:51:55 +00:00
inc h4231_smc1+1
bne h4231_noflo
inc h4231_smc1+2
h4231_noflo:
h4231_width_end_smc:
2021-09-15 20:32:43 +00:00
cpy #6
bne h3231_inner_loop
inc MASK ; row
lda MASK ; row
2021-09-17 02:51:55 +00:00
h4231_ysize_smc:
2021-09-15 20:32:43 +00:00
cmp #31
bne hgr_42x31_sprite_yloop
rts