fish: clean up some things

/ no longer exits
	mask sprite code handles odd columns
	title screen no longer blinks in at start
This commit is contained in:
Vince Weaver 2024-06-12 23:06:05 -04:00
parent e2170d5111
commit 9629883c53
4 changed files with 123 additions and 63 deletions

View File

@ -196,21 +196,21 @@ load_background:
jsr full_decomp
; lda #<bg_data
; sta ZX0_src
; lda #>bg_data
; sta ZX0_src+1
; lda #$40
;===================
; set up variables
; have it show garbage on page2 briefly
; this is better than re-showing title
; ideally we'd just clear the screen I guess
bit PAGE2
bit HIRES
bit FULLGR
bit SET_GR
bit PAGE1
lda #$20
sta DRAW_PAGE
; re-set up hgr tables
@ -449,6 +449,7 @@ deploy_red_fish:
sta RED_FISH_STATE_PTR
lda #FISH_SPRITE_LONG
; lda #FISH_SPRITE_RED
sta RED_FISH_SPRITE
lda #17
@ -619,11 +620,14 @@ check_keypress:
; clear high bit
and #$7f
and #$df ; convert lowercase to upper
cmp #27 ; escape
beq done_game
; do this after or else '/' counts as escape
and #$df ; convert lowercase to upper
cmp #'J' ; jig
beq do_jig
cmp #'L' ; lure

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -1,54 +0,0 @@
; special case
;=========================================================
; hgr copy from $A000/$8000 to current DRAW_PAGE
;=========================================================
; would be faster if we unroll it, but much bigger
; old numbers
; 14+ ((14*256)+20)*32 + 5 = 115347 = 8.6fps
; theoretical unrolled, 30*6 bytes bigger (180 bytes?)
; 2 + ((9*32)+5)*256 + 5 = 75015 = 13.3 fps
hgr_copy:
; copy from in A ($80/$A0)
sta hgr_copy_smc+2 ; 4
clc
adc #$20
sta hgr_copy_end_smc+1
; lda #$A0 ; 2
ldx #0 ; 2
lda DRAW_PAGE
clc
adc #$20
sta hgr_copy_smc+5 ; 4
hgr_copy_column:
hgr_copy_smc:
lda $8000,X ; 4
sta $2000,X ; 5
dex ; 2
bne hgr_copy_column ; 2nt/3t
inc hgr_copy_smc+2 ; 6
inc hgr_copy_smc+5 ; 6
lda hgr_copy_smc+2 ; 4
hgr_copy_end_smc:
cmp #$C0 ; 2
bne hgr_copy_column ; 2/3
rts ; 6

View File

@ -12,6 +12,10 @@
hgr_draw_sprite_mask:
lda SPRITE_X
ror
bcs hgr_draw_sprite_mask_odd
ldy #0
lda (INL),Y ; load xsize
clc
@ -89,4 +93,110 @@ hsm_sprite_ysize_smc:
rts
;===================
; odd!
;===================
; adjust colors with shift
hgr_draw_sprite_mask_odd:
ldy #0
lda (INL),Y ; load xsize
clc
adc SPRITE_X
sta hsmo_sprite_width_end_smc+1 ; self modify for end of line
iny ; load ysize
lda (INL),Y
sta hsmo_sprite_ysize_smc+1 ; self modify
; point smc to sprite
lda INL ; 16-bit add
sta hsmo_sprite_smc1+1
lda INH
sta hsmo_sprite_smc1+2
lda MASKL
sta hsmo_mask_smc1+1
lda MASKH
sta hsmo_mask_smc1+2
ldx #0 ; X is pointer offset
stx CURRENT_ROW ; actual row
ldx #2
hgr_smo_sprite_yloop:
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
clc ; assume 0 for start
php ; store 0 carry on stack
hgr_smo_sprite_inner_loop:
hsmo_sprite_smc1:
lda $f000,X ; load sprite data
plp ; restore carry from last
rol ; rotate carry
bcs hsmo_blue_orange
hsmo_purple_green:
asl
php
clc
bcc hsmo_done_pal
hsmo_blue_orange:
asl
php
sec
hsmo_done_pal:
ror
eor (GBASL),Y ; load bg
hsmo_mask_smc1:
and $f000,X
eor (GBASL),Y
sta (GBASL),Y ; store to screen
inx ; increment sprite offset
iny ; increment output position
hsmo_sprite_width_end_smc:
cpy #6 ; see if reached end of row
bne hgr_smo_sprite_inner_loop ; if not, loop
plp
inc CURRENT_ROW ; row
lda CURRENT_ROW ; row
hsmo_sprite_ysize_smc:
cmp #31 ; see if at end
bne hgr_smo_sprite_yloop ; if not, loop
rts