cliff: merge a lot more code

This commit is contained in:
Vince Weaver 2024-08-27 16:58:55 -04:00
parent eee39dfb6e
commit 4cae80557b
3 changed files with 56 additions and 127 deletions

View File

@ -25,7 +25,7 @@ hgr_draw_sprite:
clc
adc SPRITE_X
sta sprite_width_end_smc+1 ; self modify for end of line
sta osprite_width_end_smc+1 ; self modify for end of line
; sta osprite_width_end_smc+1 ; self modify for end of line
sta save_xend,Y
; handle ysize
@ -58,16 +58,6 @@ hgr_draw_sprite:
hgr_sprite_yloop:
; pick if even or odd code
lda SPRITE_X
ror
bcs hgr_draw_sprite_odd
;================================
hgr_draw_sprite_even:
lda CURRENT_ROW ; row
@ -88,15 +78,64 @@ hgr_draw_sprite_even:
ldy SPRITE_X
lda #$0
sta SPRITE_TEMP ; default high bit to 0
sta MASK_TEMP ; defailt high bit to 0
sprite_inner_loop:
; pick if even or odd code
lda SPRITE_X
ror
bcs hgr_draw_sprite_odd
;================================
hgr_draw_sprite_even:
sprite_smc1:
lda $f000,X ; load sprite data
sta TEMP_SPRITE
sprite_mask_smc1:
lda $f000,X ; mask
sta TEMP_MASK
jmp hgr_draw_sprite_both
hgr_draw_sprite_odd:
osprite_mask_smc1:
lda $f000,X ; load mask data
rol MASK_TEMP
rol
sta MASK_TEMP
and #$7f
sta TEMP_MASK
osprite_smc1:
lda $f000,X ; load sprite data
rol SPRITE_TEMP
rol
sta SPRITE_TEMP
and #$7f ; force purple/green
sta TEMP_SPRITE
hgr_draw_sprite_both:
lda (GBASL),Y ; load bg
backup_sprite_smc1:
sta $f000,X
sprite_smc1:
eor $f000,X ; load sprite data
sprite_mask_smc1:
and $f000,X ; mask
eor TEMP_SPRITE
and TEMP_MASK
eor (GBASL),Y
sta (GBASL),Y ; store to screen
@ -108,84 +147,6 @@ sprite_width_end_smc:
cpy #6 ; see if reached end of row
bne sprite_inner_loop ; if not, loop
jmp common_common
;============================================
hgr_draw_sprite_odd:
lda CURRENT_ROW ; row
clc
adc SPRITE_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
; clc
; adc DRAW_PAGE
sta GBASH
ldy SPRITE_X
lda #$0
sta SPRITE_TEMP ; default high bit to 0
lda #$ff ; because we have to invert FIXME
sta MASK_TEMP ; defailt high bit to 0
osprite_inner_loop:
lda (GBASL),Y ; load bg data
sta TEMP
obackup_sprite_smc1:
sta $f000,X ; store backup
osprite_mask_smc1:
lda $f000,X ; load mask data
eor #$FF
rol MASK_TEMP
rol
sta MASK_TEMP
and #$7f
and TEMP
sta TEMP
osprite_smc1:
lda $f000,X ; load sprite data
rol SPRITE_TEMP
rol
sta SPRITE_TEMP
and #$7f ; force purple/green
ora TEMP
sta (GBASL),Y ; store to screen
inx ; increment sprite offset
iny ; increment output position
osprite_width_end_smc:
cpy #6 ; see if reached end of row
bne osprite_inner_loop ; if not, loop
common_common:
inc CURRENT_ROW ; row
lda CURRENT_ROW ; row

View File

@ -280,8 +280,8 @@ SPRITE_X = $F7
SPRITE_Y = $F8
CURRENT_ROW = $F9
MASKL = $FA
MASKH = $FB
TEMP_SPRITE = $FA
TEMP_MASK = $FB
INL = $FC
INH = $FD
OUTL = $FE

View File

@ -1,32 +0,0 @@
include ../../../../Makefile.inc
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr
all: entry_graphics.inc
entry_graphics.inc: \
door_w.hgr.zx02 door_e.hgr.zx02 \
near_door_w.hgr.zx02 near_door_e.hgr.zx02
echo "door_w_zx02: .incbin \"door_w.hgr.zx02\"" > entry_graphics.inc
echo "door_e_zx02: .incbin \"door_e.hgr.zx02\"" >> entry_graphics.inc
echo "near_door_w_zx02: .incbin \"near_door_w.hgr.zx02\"" >> entry_graphics.inc
echo "near_door_e_zx02: .incbin \"near_door_e.hgr.zx02\"" >> entry_graphics.inc
####
%.hgr: %.png
$(PNG_TO_HGR) $< > $@
%.hgr.zx02: %.hgr
$(ZX02) -f $< $@
####
clean:
rm -f *~ *.o *.lst *.zx02 *.hgr entry_graphics.inc