2022-03-08 05:49:10 +00:00
|
|
|
;===========================================
|
|
|
|
; hgr draw sprite (only at 7-bit boundaries)
|
|
|
|
;===========================================
|
|
|
|
; SPRITE in INL/INH
|
2022-03-09 20:15:38 +00:00
|
|
|
; Location at XPOS YPOS
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
; xsize, ysize in first two bytes
|
|
|
|
|
|
|
|
; sprite AT INL/INH
|
|
|
|
|
|
|
|
hgr_draw_sprite:
|
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y ; load xsize
|
|
|
|
clc
|
2022-03-09 20:15:38 +00:00
|
|
|
adc XPOS
|
2022-03-09 05:35:13 +00:00
|
|
|
sta sprite_width_end_smc+1 ; self modify for end of line
|
|
|
|
|
|
|
|
iny ; load ysize
|
|
|
|
lda (INL),Y
|
|
|
|
sta sprite_ysize_smc+1 ; self modify
|
|
|
|
|
|
|
|
; skip the xsize/ysize and point to sprite
|
|
|
|
clc
|
|
|
|
lda INL ; 16-bit add
|
|
|
|
adc #2
|
|
|
|
sta sprite_smc1+1
|
|
|
|
lda INH
|
|
|
|
adc #0
|
|
|
|
sta sprite_smc1+2
|
|
|
|
|
|
|
|
ldx #0 ; X is pointer offset
|
|
|
|
|
|
|
|
stx MASK ; actual row
|
|
|
|
|
|
|
|
hgr_sprite_yloop:
|
|
|
|
|
|
|
|
lda MASK ; row
|
|
|
|
|
|
|
|
clc
|
2022-03-09 20:15:38 +00:00
|
|
|
adc YPOS ; add in cursor_y
|
2022-03-09 05:35:13 +00:00
|
|
|
|
|
|
|
; calc GBASL/GBASH
|
|
|
|
|
|
|
|
tay ; get output ROW into GBASL/H
|
|
|
|
lda hposn_low,Y
|
|
|
|
sta GBASL
|
|
|
|
lda hposn_high,Y
|
|
|
|
|
|
|
|
; eor #$00 draws on page2
|
|
|
|
; eor #$60 draws on page1
|
|
|
|
hgr_sprite_page_smc:
|
|
|
|
eor #$00
|
|
|
|
sta GBASH
|
|
|
|
|
2022-03-09 20:15:38 +00:00
|
|
|
ldy XPOS
|
2022-03-09 05:35:13 +00:00
|
|
|
|
|
|
|
sprite_inner_loop:
|
|
|
|
|
|
|
|
sprite_smc1:
|
|
|
|
lda $d000 ; get sprite pattern
|
|
|
|
sta (GBASL),Y ; store out
|
|
|
|
|
|
|
|
inx
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
|
|
inc sprite_smc1+1
|
|
|
|
bne sprite_noflo
|
|
|
|
inc sprite_smc1+2
|
|
|
|
sprite_noflo:
|
|
|
|
|
|
|
|
sprite_width_end_smc:
|
|
|
|
cpy #6
|
|
|
|
bne sprite_inner_loop
|
|
|
|
|
|
|
|
|
|
|
|
inc MASK ; row
|
|
|
|
lda MASK ; row
|
|
|
|
|
|
|
|
sprite_ysize_smc:
|
|
|
|
cmp #31
|
|
|
|
bne hgr_sprite_yloop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2022-03-15 04:02:46 +00:00
|
|
|
hgr_sprite_page_toggle:
|
|
|
|
lda hgr_sprite_page_smc+1
|
|
|
|
eor #$60
|
|
|
|
sta hgr_sprite_page_smc+1
|
|
|
|
rts
|
2022-03-09 05:35:13 +00:00
|
|
|
|
|
|
|
;===========================================
|
|
|
|
; hgr draw sprite (only at 7-bit boundaries)
|
|
|
|
;===========================================
|
|
|
|
; autoshift version
|
|
|
|
; assumes sprite is drawn for even column
|
|
|
|
; and shifts it if in odd column
|
|
|
|
|
|
|
|
; SPRITE in INL/INH
|
2022-03-09 20:15:38 +00:00
|
|
|
; Location at XPOS YPOS
|
2022-03-09 05:35:13 +00:00
|
|
|
|
|
|
|
; xsize, ysize in first two bytes
|
|
|
|
|
|
|
|
; sprite AT INL/INH
|
|
|
|
|
|
|
|
hgr_draw_sprite_autoshift:
|
|
|
|
|
2022-03-08 05:49:10 +00:00
|
|
|
; self modify to shift for odd start location
|
|
|
|
|
|
|
|
; SEC=$38 0b0011 1000 CLC=$18 0b0001 10000
|
|
|
|
|
2022-03-09 20:15:38 +00:00
|
|
|
lda XPOS
|
2022-03-08 05:49:10 +00:00
|
|
|
lsr
|
|
|
|
bcc make_it_even
|
|
|
|
|
|
|
|
make_it_odd:
|
|
|
|
lda #$18
|
|
|
|
bne make_it_so
|
|
|
|
make_it_even:
|
|
|
|
lda #$38
|
|
|
|
make_it_so:
|
|
|
|
sta odd_even_smc
|
|
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
lda (INL),Y ; load xsize
|
|
|
|
clc
|
2022-03-09 20:15:38 +00:00
|
|
|
adc XPOS
|
2022-03-09 05:35:13 +00:00
|
|
|
sta sprite_width_end_smc_as+1 ; self modify for end of line
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
iny ; load ysize
|
|
|
|
lda (INL),Y
|
2022-03-09 05:35:13 +00:00
|
|
|
sta sprite_ysize_smc_as+1 ; self modify
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
; skip the xsize/ysize and point to sprite
|
|
|
|
clc
|
|
|
|
lda INL ; 16-bit add
|
|
|
|
adc #2
|
2022-03-09 05:35:13 +00:00
|
|
|
sta sprite_smc1_as+1
|
2022-03-08 05:49:10 +00:00
|
|
|
lda INH
|
|
|
|
adc #0
|
2022-03-09 05:35:13 +00:00
|
|
|
sta sprite_smc1_as+2
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
ldx #0 ; X is pointer offset
|
|
|
|
|
|
|
|
stx MASK ; actual row
|
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
hgr_sprite_yloop_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
lda MASK ; row
|
|
|
|
|
|
|
|
clc
|
2022-03-09 20:15:38 +00:00
|
|
|
adc YPOS ; add in cursor_y
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
; calc GBASL/GBASH
|
|
|
|
|
|
|
|
tay ; get output ROW into GBASL/H
|
|
|
|
lda hposn_low,Y
|
|
|
|
sta GBASL
|
|
|
|
lda hposn_high,Y
|
|
|
|
|
|
|
|
; eor #$00 draws on page2
|
|
|
|
; eor #$60 draws on page1
|
2022-03-30 03:13:46 +00:00
|
|
|
hgr_sprite_smc_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
eor #$00
|
|
|
|
sta GBASH
|
|
|
|
|
2022-03-09 20:15:38 +00:00
|
|
|
ldy XPOS
|
2022-03-08 05:49:10 +00:00
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
sprite_inner_loop_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
sprite_smc1_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
lda $d000 ; get sprite pattern
|
|
|
|
|
|
|
|
; lsr
|
|
|
|
|
|
|
|
odd_even_smc:
|
|
|
|
sec
|
|
|
|
bcs no_adjust
|
|
|
|
|
|
|
|
asl
|
|
|
|
php
|
|
|
|
clc
|
|
|
|
lsr
|
|
|
|
plp
|
|
|
|
ror
|
|
|
|
no_adjust:
|
|
|
|
;? Xcababab
|
|
|
|
;X cababab?
|
|
|
|
;? X0cababa
|
|
|
|
|
|
|
|
; clc ; rol asl
|
|
|
|
; rol
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sta (GBASL),Y ; store out
|
|
|
|
|
|
|
|
inx
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
inc sprite_smc1_as+1
|
|
|
|
bne sprite_noflo_as
|
|
|
|
inc sprite_smc1_as+2
|
|
|
|
sprite_noflo_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
sprite_width_end_smc_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
cpy #6
|
2022-03-09 05:35:13 +00:00
|
|
|
bne sprite_inner_loop_as
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
inc MASK ; row
|
|
|
|
lda MASK ; row
|
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
sprite_ysize_smc_as:
|
2022-03-08 05:49:10 +00:00
|
|
|
cmp #31
|
2022-03-09 05:35:13 +00:00
|
|
|
bne hgr_sprite_yloop_as
|
2022-03-08 05:49:10 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
2022-03-09 05:35:13 +00:00
|
|
|
|
2022-03-30 03:13:46 +00:00
|
|
|
|
|
|
|
hgr_sprite_as_toggle:
|
|
|
|
lda hgr_sprite_smc_as+1
|
|
|
|
eor #$60
|
|
|
|
sta hgr_sprite_smc_as+1
|
|
|
|
rts
|
2022-03-31 04:10:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;===========================================
|
|
|
|
; hgr draw sprite (only at 7-bit boundaries)
|
|
|
|
;===========================================
|
|
|
|
; autoshift version
|
|
|
|
; assumes sprite is drawn for even column
|
|
|
|
; and shifts it if in odd column
|
|
|
|
; ors with bg for lemming
|
|
|
|
|
|
|
|
; SPRITE in INL/INH
|
|
|
|
; Location at XPOS YPOS
|
|
|
|
|
|
|
|
; xsize, ysize in first two bytes
|
|
|
|
|
|
|
|
; sprite AT INL/INH
|
|
|
|
|
|
|
|
hgr_draw_sprite_or_autoshift:
|
|
|
|
|
|
|
|
; self modify to shift for odd start location
|
|
|
|
|
|
|
|
; SEC=$38 0b0011 1000 CLC=$18 0b0001 10000
|
|
|
|
|
|
|
|
lda XPOS
|
|
|
|
lsr
|
|
|
|
bcc make_it_even_or
|
|
|
|
|
|
|
|
make_it_odd_or:
|
|
|
|
lda #$18
|
|
|
|
bne make_it_so_or
|
|
|
|
make_it_even_or:
|
|
|
|
lda #$38
|
|
|
|
make_it_so_or:
|
|
|
|
sta odd_even_smc_or
|
|
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
lda (INL),Y ; load xsize
|
|
|
|
clc
|
|
|
|
adc XPOS
|
|
|
|
sta sprite_width_end_smc_as_or+1 ; self modify for end of line
|
|
|
|
|
|
|
|
iny ; load ysize
|
|
|
|
lda (INL),Y
|
|
|
|
sta sprite_ysize_smc_as_or+1 ; self modify
|
|
|
|
|
|
|
|
; skip the xsize/ysize and point to sprite
|
|
|
|
clc
|
|
|
|
lda INL ; 16-bit add
|
|
|
|
adc #2
|
|
|
|
sta sprite_smc1_as_or+1
|
|
|
|
lda INH
|
|
|
|
adc #0
|
|
|
|
sta sprite_smc1_as_or+2
|
|
|
|
|
|
|
|
ldx #0 ; X is pointer offset
|
|
|
|
|
|
|
|
stx MASK ; actual row
|
|
|
|
|
|
|
|
hgr_sprite_yloop_as_or:
|
|
|
|
|
|
|
|
lda MASK ; row
|
|
|
|
|
|
|
|
clc
|
|
|
|
adc YPOS ; add in cursor_y
|
|
|
|
|
|
|
|
; calc GBASL/GBASH
|
|
|
|
|
|
|
|
tay ; get output ROW into GBASL/H
|
|
|
|
lda hposn_low,Y
|
|
|
|
sta GBASL
|
|
|
|
lda hposn_high,Y
|
|
|
|
|
|
|
|
; eor #$00 draws on page2
|
|
|
|
; eor #$60 draws on page1
|
|
|
|
hgr_sprite_smc_as_or:
|
|
|
|
eor #$00
|
|
|
|
sta GBASH
|
|
|
|
|
|
|
|
ldy XPOS
|
|
|
|
|
|
|
|
sprite_inner_loop_as_or:
|
|
|
|
|
|
|
|
sprite_smc1_as_or:
|
|
|
|
lda $d000 ; get sprite pattern
|
|
|
|
|
|
|
|
; lsr
|
|
|
|
|
|
|
|
odd_even_smc_or:
|
|
|
|
sec
|
|
|
|
bcs no_adjust_or
|
|
|
|
|
|
|
|
asl
|
|
|
|
php
|
|
|
|
clc
|
|
|
|
lsr
|
|
|
|
plp
|
|
|
|
ror
|
|
|
|
no_adjust_or:
|
|
|
|
;? Xcababab
|
|
|
|
;X cababab?
|
|
|
|
;? X0cababa
|
|
|
|
|
|
|
|
; clc ; rol asl
|
|
|
|
; rol
|
|
|
|
|
|
|
|
ora (GBASL),Y
|
|
|
|
|
|
|
|
sta (GBASL),Y ; store out
|
|
|
|
|
|
|
|
inx
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
|
|
inc sprite_smc1_as_or+1
|
|
|
|
bne sprite_noflo_as_or
|
|
|
|
inc sprite_smc1_as_or+2
|
|
|
|
sprite_noflo_as_or:
|
|
|
|
|
|
|
|
sprite_width_end_smc_as_or:
|
|
|
|
cpy #6
|
|
|
|
bne sprite_inner_loop_as_or
|
|
|
|
|
|
|
|
|
|
|
|
inc MASK ; row
|
|
|
|
lda MASK ; row
|
|
|
|
|
|
|
|
sprite_ysize_smc_as_or:
|
|
|
|
cmp #31
|
|
|
|
bne hgr_sprite_yloop_as_or
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hgr_sprite_as_or_toggle:
|
|
|
|
lda hgr_sprite_smc_as_or+1
|
|
|
|
eor #$60
|
|
|
|
sta hgr_sprite_smc_as_or+1
|
|
|
|
rts
|
|
|
|
|