sb: use page flipping

This commit is contained in:
Vince Weaver 2023-06-03 18:37:14 -04:00
parent 7ec3ce6856
commit ce03614991
9 changed files with 107 additions and 13 deletions

View File

@ -116,8 +116,8 @@ TITLE: title.o
title.o: title.s zx02_optim.s \
zp.inc hardware.inc \
hgr_logo_scroll.s audio.s hgr_sprite.s \
hgr_sprite_big.s \
purple.s lc_detect.s \
hgr_sprite_big.s hgr_copy_fast.s \
purple.s lc_detect.s hgr_tables.s \
title_sound/purple.btc.zx02 \
title_graphics/czmg4ap_title.hgr.zx02 \
title_graphics/videlectrix_top.hgr.zx02 \

View File

@ -18,7 +18,7 @@ Strongbadzone:
+ Sprites with mask?
+ Animate side walls
+ Move head
+ Faster hgr copy?
Cliff:
+ Lots

View File

@ -8,8 +8,13 @@
.include "zp.inc"
.include "hardware.inc"
div7_table = $400
mod7_table = $500
hposn_high = $600
hposn_low = $700
hires_start:
strongbadzone_start:
;===================
; set graphics mode
@ -84,7 +89,7 @@ load_background:
sta ZX0_src+1
lda #$20
lda #$80
jsr full_decomp
@ -101,8 +106,33 @@ load_background:
;===========================
main_loop:
inc FRAME
;==========
; flip page
;==========
lda DRAW_PAGE
beq draw_page2
draw_page1:
bit PAGE2
lda #0
beq done_flip
draw_page2:
bit PAGE1
lda #$20
done_flip:
sta DRAW_PAGE
;========================
; copy over backgrund
;========================
jsr hgr_copy
inc FRAME
;===========================
; move head
@ -113,7 +143,7 @@ main_loop:
bne no_move_head
lda STRONGBAD_X
cmp #22
cmp #21
bcs reverse_head_dir
cmp #12
bcs no_reverse_head_dir
@ -164,7 +194,6 @@ no_move_head:
check_keypress:
lda KEYPRESS
; bpl check_keypress
bpl done_keyboard_check
bit KEYRESET ; clear the keyboard strobe
@ -194,11 +223,18 @@ done_keyboard_check:
jmp main_loop
move_left:
lda PLAYER_X
beq no_more_left
dec PLAYER_X
no_more_left:
jmp main_loop
move_right:
lda PLAYER_X
cmp #29 ; bge
bcs no_more_right
inc PLAYER_X
no_more_right:
jmp main_loop
@ -226,6 +262,7 @@ wait_until_keypress:
.include "zx02_optim.s"
.include "hgr_sprite_big.s"
.include "cycle_colors.s"
.include "hgr_copy_fast.s"
.include "asplode_graphics/sb_sprites.inc"

44
games/sb/hgr_copy_fast.s Normal file
View File

@ -0,0 +1,44 @@
;=========================================================
; hgr copy from $2000 to $4000
;=========================================================
; copy $2000 to $4000
; would be faster if we unroll it, but much bigger
; 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:
ldx #0 ; 2
lda #$80 ; 2
sta hgr_copy_smc+2 ; 4
lda DRAW_PAGE
clc
adc #$20
; lda #$20 ; 2
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
cmp #$A0 ; 2
bne hgr_copy_column ; 2/3
rts ; 6

View File

@ -1,7 +1,7 @@
div7_table = $9C00
mod7_table = $9D00
hposn_high = $9E00
hposn_low = $9F00
;div7_table = $9C00
;mod7_table = $9D00
;hposn_high = $9E00
;hposn_low = $9F00

View File

@ -183,7 +183,7 @@ sector_array:
length_array:
.byte 40, 16, 16, 32 ; TITLE, DUCK, ROOF, ASPLODE
.byte 40, 16, 16, 40 ; TITLE, DUCK, ROOF, ASPLODE
.byte 32, 32, 32 ; TARGET, CLIFF, RAT

View File

@ -10,6 +10,11 @@
.include "zp.inc"
.include "hardware.inc"
div7_table = $9C00
mod7_table = $9D00
hposn_high = $9E00
hposn_low = $9F00
fortnight_start:
lda #$20

View File

@ -6,6 +6,10 @@
.include "zp.inc"
.include "hardware.inc"
div7_table = $9C00
mod7_table = $9D00
hposn_high = $9E00
hposn_low = $9F00
hires_start:
@ -189,6 +193,9 @@ wait_until_keypress:
;=========================
; see if number pressed
cmp #27
beq load_loop
cmp #'7'
beq draw_edga_jr

View File

@ -29,6 +29,7 @@ title_sprites.inc: czmg4ap_title_sprites.png
$(HGR_SPRITE) -s -l empty_sprite czmg4ap_title_sprites.png 105 131 118 138 > title_sprites.inc
$(HGR_SPRITE) -s -l arrow_sprite czmg4ap_title_sprites.png 105 111 118 118 >> title_sprites.inc
$(HGR_SPRITE) -s -l purple_sprite czmg4ap_title_sprites.png 175 83 230 102 >> title_sprites.inc
$(HGR_SPRITE) -s -l edga_jr_sprite czmg4ap_title_sprites.png 0 0 69 71 >> title_sprites.inc
####