2023-05-02 04:50:49 +00:00
|
|
|
;===========================================
|
2023-05-03 02:10:19 +00:00
|
|
|
; hgr draw sprite mask and save (only at 7-bit boundaries)
|
2023-05-02 04:50:49 +00:00
|
|
|
;===========================================
|
|
|
|
; SPRITE in INL/INH
|
2023-05-03 04:41:01 +00:00
|
|
|
; Location at SPRITE_X SPRITE_Y
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
; xsize, ysize in first two bytes
|
|
|
|
|
|
|
|
; sprite AT INL/INH
|
|
|
|
|
2023-05-03 04:41:01 +00:00
|
|
|
; save at OUTL/OUTH
|
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
hgr_draw_sprite_mask_and_save:
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
ldy #0
|
|
|
|
lda (INL),Y ; load xsize
|
2023-05-03 04:41:01 +00:00
|
|
|
sta (OUTL),Y
|
2023-05-02 04:50:49 +00:00
|
|
|
clc
|
2023-05-03 04:41:01 +00:00
|
|
|
adc SPRITE_X
|
2023-05-03 02:10:19 +00:00
|
|
|
sta sms_sprite_width_end_smc+1 ; self modify for end of line
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
iny ; load ysize
|
|
|
|
lda (INL),Y
|
2023-05-03 04:41:01 +00:00
|
|
|
sta (OUTL),Y
|
2023-05-03 02:10:19 +00:00
|
|
|
sta sms_sprite_ysize_smc+1 ; self modify
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 01:18:43 +00:00
|
|
|
; point smc to sprite
|
2023-05-02 04:50:49 +00:00
|
|
|
lda INL ; 16-bit add
|
2023-05-03 02:10:19 +00:00
|
|
|
sta sms_sprite_smc1+1
|
2023-05-02 04:50:49 +00:00
|
|
|
lda INH
|
2023-05-03 02:10:19 +00:00
|
|
|
sta sms_sprite_smc1+2
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 04:41:01 +00:00
|
|
|
; point smc to sprite
|
|
|
|
lda OUTL ; 16-bit add
|
|
|
|
sta backup_sprite_smc1+1
|
|
|
|
lda OUTH
|
|
|
|
sta backup_sprite_smc1+2
|
|
|
|
|
|
|
|
|
2023-05-03 01:18:43 +00:00
|
|
|
lda MASKL
|
2023-05-03 02:10:19 +00:00
|
|
|
sta sms_mask_smc1+1
|
2023-05-03 01:18:43 +00:00
|
|
|
lda MASKH
|
2023-05-03 02:10:19 +00:00
|
|
|
sta sms_mask_smc1+2
|
2023-05-03 01:18:43 +00:00
|
|
|
|
2023-05-02 04:50:49 +00:00
|
|
|
ldx #0 ; X is pointer offset
|
2023-05-03 01:18:43 +00:00
|
|
|
stx CURRENT_ROW ; actual row
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 01:18:43 +00:00
|
|
|
ldx #2
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
hgr_sms_sprite_yloop:
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 01:18:43 +00:00
|
|
|
lda CURRENT_ROW ; row
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
clc
|
2023-05-03 04:41:01 +00:00
|
|
|
adc SPRITE_Y ; add in cursor_y
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
; calc GBASL/GBASH
|
|
|
|
|
|
|
|
tay ; get output ROW into GBASL/H
|
|
|
|
lda hposn_low,Y
|
|
|
|
sta GBASL
|
|
|
|
lda hposn_high,Y
|
|
|
|
|
2023-05-03 04:41:01 +00:00
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
;hgr_sprite_page_smc:
|
|
|
|
; eor #$00
|
2023-05-03 04:41:01 +00:00
|
|
|
|
|
|
|
clc
|
|
|
|
adc DRAW_PAGE
|
2023-05-02 04:50:49 +00:00
|
|
|
sta GBASH
|
|
|
|
|
2023-05-03 04:41:01 +00:00
|
|
|
ldy SPRITE_X
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
sms_sprite_inner_loop:
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
lda (GBASL),Y ; load bg
|
2023-05-03 04:41:01 +00:00
|
|
|
backup_sprite_smc1:
|
|
|
|
sta $f000,X
|
2023-05-03 02:10:19 +00:00
|
|
|
sms_sprite_smc1:
|
2023-05-03 01:18:43 +00:00
|
|
|
eor $f000,X ; load sprite data
|
2023-05-03 02:10:19 +00:00
|
|
|
sms_mask_smc1:
|
2023-05-03 01:18:43 +00:00
|
|
|
and $f000,X
|
|
|
|
eor (GBASL),Y
|
2023-05-03 02:10:19 +00:00
|
|
|
sta (GBASL),Y ; store to screen
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 01:18:43 +00:00
|
|
|
inx ; increment sprite offset
|
|
|
|
iny ; increment output position
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
sms_sprite_width_end_smc:
|
2023-05-03 01:18:43 +00:00
|
|
|
cpy #6 ; see if reached end of row
|
2023-05-03 02:10:19 +00:00
|
|
|
bne sms_sprite_inner_loop ; if not, loop
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
|
2023-05-03 01:18:43 +00:00
|
|
|
inc CURRENT_ROW ; row
|
|
|
|
lda CURRENT_ROW ; row
|
2023-05-02 04:50:49 +00:00
|
|
|
|
2023-05-03 02:10:19 +00:00
|
|
|
sms_sprite_ysize_smc:
|
2023-05-03 01:18:43 +00:00
|
|
|
cmp #31 ; see if at end
|
2023-05-03 02:10:19 +00:00
|
|
|
bne hgr_sms_sprite_yloop ; if not, loop
|
2023-05-02 04:50:49 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
2023-05-03 04:41:01 +00:00
|
|
|
backup_sprite1 = $1800
|
|
|
|
backup_sprite2 = $1900
|