2021-08-12 15:48:12 +00:00
|
|
|
|
2021-08-25 00:42:11 +00:00
|
|
|
;===============================================
|
2021-08-25 00:58:44 +00:00
|
|
|
; hgr 7x28 draw sprite
|
2021-08-25 00:42:11 +00:00
|
|
|
;===============================================
|
2021-08-12 15:48:12 +00:00
|
|
|
; SPRITE in INL/INH
|
|
|
|
; Location at CURSOR_X CURSOR_Y
|
|
|
|
|
|
|
|
; left sprite AT INL/INH
|
|
|
|
; right sprite at INL/INH + 14
|
|
|
|
; left mask at INL/INH + 28
|
|
|
|
; right mask at INL/INH + 42
|
|
|
|
|
2021-08-25 00:58:44 +00:00
|
|
|
hgr_draw_sprite_7x28:
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
; set up pointers
|
|
|
|
lda INL
|
2021-08-25 00:58:44 +00:00
|
|
|
sta h728_smc1+1
|
2021-08-12 15:48:12 +00:00
|
|
|
lda INH
|
2021-08-25 00:58:44 +00:00
|
|
|
sta h728_smc1+2
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
clc
|
|
|
|
lda INL
|
2021-08-25 00:58:44 +00:00
|
|
|
adc #28
|
|
|
|
sta h728_smc3+1
|
2021-08-12 15:48:12 +00:00
|
|
|
lda INH
|
|
|
|
adc #0
|
2021-08-25 00:58:44 +00:00
|
|
|
sta h728_smc3+2
|
2021-08-12 15:48:12 +00:00
|
|
|
|
2021-08-25 00:42:11 +00:00
|
|
|
ldx #0 ; X is row counter
|
2021-08-25 00:58:44 +00:00
|
|
|
hgr_7x28_sprite_yloop:
|
2021-08-25 00:42:11 +00:00
|
|
|
txa ; X is current row
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
clc
|
2021-08-25 00:42:11 +00:00
|
|
|
adc CURSOR_Y ; add in cursor_y
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
; calc GBASL/GBASH
|
2021-08-13 00:36:32 +00:00
|
|
|
|
2021-08-25 00:42:11 +00:00
|
|
|
tay ; get output ROW into GBASL/H
|
|
|
|
lda hposn_low,Y
|
2021-08-13 00:36:32 +00:00
|
|
|
sta GBASL
|
2021-08-25 00:42:11 +00:00
|
|
|
lda hposn_high,Y
|
2021-08-13 00:36:32 +00:00
|
|
|
sta GBASH
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
ldy CURSOR_X
|
|
|
|
|
2021-08-25 00:42:11 +00:00
|
|
|
lda (GBASL),Y ; load background
|
2021-08-25 00:58:44 +00:00
|
|
|
h728_smc3:
|
2021-08-25 00:42:11 +00:00
|
|
|
and $d000,X ; mask with sprite mask
|
2021-08-25 00:58:44 +00:00
|
|
|
h728_smc1:
|
2021-08-25 00:42:11 +00:00
|
|
|
ora $d000,X ; or in sprite
|
|
|
|
sta (GBASL),Y ; store out
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
inx
|
2021-08-25 00:58:44 +00:00
|
|
|
cpx #28
|
|
|
|
bne hgr_7x28_sprite_yloop
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;======================
|
2021-08-25 00:58:44 +00:00
|
|
|
; save bg 7x28
|
2021-08-12 15:48:12 +00:00
|
|
|
;======================
|
|
|
|
|
2021-08-25 00:58:44 +00:00
|
|
|
save_bg_7x28:
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
ldx #0
|
|
|
|
save_yloop:
|
|
|
|
txa
|
|
|
|
pha
|
|
|
|
|
|
|
|
clc
|
|
|
|
adc CURSOR_Y
|
|
|
|
|
|
|
|
|
|
|
|
; calc GBASL/GBASH
|
2021-08-13 00:36:32 +00:00
|
|
|
|
|
|
|
tax
|
|
|
|
lda hposn_low,X
|
|
|
|
sta GBASL
|
|
|
|
lda hposn_high,X
|
|
|
|
sta GBASH
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
pla
|
|
|
|
tax
|
|
|
|
|
|
|
|
ldy CURSOR_X
|
|
|
|
|
|
|
|
lda (GBASL),Y
|
2021-08-25 00:58:44 +00:00
|
|
|
sta save_sprite_7x28,X
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
inx
|
2021-08-25 00:58:44 +00:00
|
|
|
cpx #28
|
2021-08-12 15:48:12 +00:00
|
|
|
bne save_yloop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
;======================
|
2021-08-25 00:58:44 +00:00
|
|
|
; restore bg 7x28
|
2021-08-12 15:48:12 +00:00
|
|
|
;======================
|
|
|
|
|
2021-08-25 00:58:44 +00:00
|
|
|
restore_bg_7x28:
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
ldx #0
|
|
|
|
restore_yloop:
|
2021-08-25 00:42:11 +00:00
|
|
|
txa ; current row
|
2021-08-12 15:48:12 +00:00
|
|
|
clc
|
2021-08-25 00:42:11 +00:00
|
|
|
adc CURSOR_Y ; add in y start point
|
2021-08-12 15:48:12 +00:00
|
|
|
|
2021-08-25 00:42:11 +00:00
|
|
|
; calc GBASL/GBASH using lookup table
|
2021-08-12 15:48:12 +00:00
|
|
|
|
2021-08-25 00:42:11 +00:00
|
|
|
tay
|
|
|
|
lda hposn_low,Y
|
2021-08-13 00:36:32 +00:00
|
|
|
sta GBASL
|
2021-08-25 00:42:11 +00:00
|
|
|
lda hposn_high,Y
|
2021-08-13 00:36:32 +00:00
|
|
|
sta GBASH
|
2021-08-12 15:48:12 +00:00
|
|
|
|
|
|
|
ldy CURSOR_X
|
|
|
|
|
2021-08-25 00:58:44 +00:00
|
|
|
lda save_sprite_7x28,X
|
2021-08-12 15:48:12 +00:00
|
|
|
sta (GBASL),Y
|
|
|
|
|
|
|
|
inx
|
2021-08-25 00:58:44 +00:00
|
|
|
cpx #28
|
2021-08-12 15:48:12 +00:00
|
|
|
bne restore_yloop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;====================
|
|
|
|
; save area
|
|
|
|
;====================
|
|
|
|
|
2021-08-25 00:58:44 +00:00
|
|
|
save_sprite_7x28:
|
2021-08-12 15:48:12 +00:00
|
|
|
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
2021-08-25 00:58:44 +00:00
|
|
|
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|