second: chessboard falling

a hack but maybe good enough for now
This commit is contained in:
Vince Weaver 2023-11-03 17:00:18 -04:00
parent 1d54bddcb6
commit d4cedf0e7a
5 changed files with 122 additions and 12 deletions

View File

@ -1,3 +1,8 @@
hgr_clear_screen:
lda DRAW_PAGE
beq hgr_page1_clearscreen
lda #0
beq hgr_page2_clearscreen
hgr_page1_clearscreen:

View File

@ -21,6 +21,7 @@ chess.o: chess.s \
circles.s \
falling_bars.s \
sierzoom.s \
hgr_partial.s \
../irq_wait.s \
../zp.inc ../hardware.inc ../qload.inc \
graphics/chess_object2.hgr.zx02 \

View File

@ -35,6 +35,22 @@ chess_start:
; Load graphics
;===================
;=============================
; load chessboard image offscreen $6000
;=============================
lda #<chess_data
sta zx_src_l+1
lda #>chess_data
sta zx_src_h+1
lda #$60
jsr zx02_full_decomp
; wait until pattern1
pattern2_loop:
lda #2
@ -118,7 +134,43 @@ compact_inner_loop:
bne compact_loop
;=============================
; dropping board
;=============================
ldx #0
stx BOARD_COUNT
drop_board_loop:
jsr hgr_clear_screen
ldx BOARD_COUNT
lda board_y,X
sta HGR_DEST
lda board_starty,X
sta HGR_Y1
lda #0
sta HGR_X1
lda #40
sta HGR_X2
lda #192
sta HGR_Y2
jsr hgr_partial
jsr hgr_page_flip
; jsr wait_until_keypress
lda #10
jsr wait_ticks
inc BOARD_COUNT
lda BOARD_COUNT
cmp #7
bne drop_board_loop
;=============================
@ -130,16 +182,6 @@ compact_inner_loop:
bit PAGE2
; load image offscreen $6000
lda #<chess_data
sta zx_src_l+1
lda #>chess_data
sta zx_src_h+1
lda #$60
jsr zx02_full_decomp
lda #0
sta COUNT
sta DRAW_PAGE
@ -403,6 +445,7 @@ main_interference_done:
.include "sierzoom.s"
.include "../hgr_page_flip.s"
.include "falling_bars.s"
.include "hgr_partial.s"
; wait A * 1/50s
wait_irq:
@ -461,5 +504,15 @@ bounce_coords_y:
.byte 4, 20, 35, 45, 60, 70, 82, 102, 115
.byte 115,102, 82, 70, 60, 45, 35, 20, 4
; 148-192 = full = 44
; 0 frames in = 0 high, bottom=125+13 Y=125
; 4 frames in, 130-138 = 8 high bottom=138+17 Y=130
; 8 frames in, from 135-155 = 20 bottom=155+25 Y=135
;12 frames in, from 145-180 = 35 bottom=180 Y=145
board_y:
.byte 125,130,135,145,139,145,139
board_starty:
.byte 184,184,172,157,139,157,139

View File

@ -0,0 +1,46 @@
; copy partial part of screen from $6000 to DRAW_PAGE
; HGR_X1,HGR_Y1 to HGR_X2,HGR_Y2 source
; destination = Y at HGR_DEST
hgr_partial:
lda HGR_DEST
sta dest_y_smc+1
ldx HGR_Y1 ; Y1
hgr_partial_outer_loop:
lda hposn_low,X
sta INL
lda hposn_high,X
ora #$40 ; convert to $6000
sta INH
txa
pha
dest_y_smc:
ldx #100 ; DEST_Y
lda hposn_low,X
sta OUTL
lda hposn_high,X
clc
adc DRAW_PAGE
sta OUTH
pla
tax
ldy HGR_X1 ; X1
hgr_partial_inner_loop:
lda (INL),Y
sta (OUTL),Y
iny
cpy HGR_X2 ; X2
bne hgr_partial_inner_loop
inc dest_y_smc+1
inx
cpx HGR_Y2 ; Y2
bne hgr_partial_outer_loop
rts

View File

@ -95,8 +95,14 @@ TOTAL_RAM = $8F
;=============================
;=============================
; $D0-$DA = ?
; $D0-$D9 = hgr move
;=============================
HGR_X1 = $D0
HGR_X2 = $D1
HGR_Y1 = $D2
HGR_Y2 = $D3
HGR_DEST= $D4
BOARD_COUNT = $D5
WHICH_SLOT = $DA ; from boot sector
@ -176,7 +182,6 @@ Y2 = $F7
SCENE_COUNT = $F8
LAST_TYPE = $F9
; lens
LENS_X = $F0
LENS_Y = $F1