From 4cae80557b80a7c84bec594042d48027df2156b8 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 27 Aug 2024 16:58:55 -0400 Subject: [PATCH] cliff: merge a lot more code --- games/peasant_mini/cliff/hgr_sprite.s | 147 +++++++----------- games/peasant_mini/cliff/zp.inc | 4 +- .../disk38_files/graphics_entry/Makefile~ | 32 ---- 3 files changed, 56 insertions(+), 127 deletions(-) delete mode 100644 games/riven_hgr/disk38_files/graphics_entry/Makefile~ diff --git a/games/peasant_mini/cliff/hgr_sprite.s b/games/peasant_mini/cliff/hgr_sprite.s index b227f730..bc05005a 100644 --- a/games/peasant_mini/cliff/hgr_sprite.s +++ b/games/peasant_mini/cliff/hgr_sprite.s @@ -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 diff --git a/games/peasant_mini/cliff/zp.inc b/games/peasant_mini/cliff/zp.inc index 293eea09..f9c426d4 100644 --- a/games/peasant_mini/cliff/zp.inc +++ b/games/peasant_mini/cliff/zp.inc @@ -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 diff --git a/games/riven_hgr/disk38_files/graphics_entry/Makefile~ b/games/riven_hgr/disk38_files/graphics_entry/Makefile~ deleted file mode 100644 index ecb8c505..00000000 --- a/games/riven_hgr/disk38_files/graphics_entry/Makefile~ +++ /dev/null @@ -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 -