mirror of
https://github.com/mi57730/a2d.git
synced 2024-12-01 20:50:06 +00:00
Puzzle: routines and param blocks
This commit is contained in:
parent
44df378f29
commit
9c5d8f269b
@ -65,7 +65,7 @@ A2D_SET_BOX2 := $06 ; set vs. intersect? (not quite)
|
|||||||
;; (input length 16 bytes)
|
;; (input length 16 bytes)
|
||||||
;; .word left pixels from screen edge
|
;; .word left pixels from screen edge
|
||||||
;; .word top
|
;; .word top
|
||||||
;; .word addr A2D_SCREEN_ADDR ($2000)
|
;; .addr addr A2D_SCREEN_ADDR ($2000)
|
||||||
;; .word stride A2D_SCREEN_STRIDE ($80)
|
;; .word stride A2D_SCREEN_STRIDE ($80)
|
||||||
;; .word hoffset pixels scrolled
|
;; .word hoffset pixels scrolled
|
||||||
;; .word voffset
|
;; .word voffset
|
||||||
|
@ -24,4 +24,4 @@ verify "date"
|
|||||||
verify "puzzle"
|
verify "puzzle"
|
||||||
|
|
||||||
cat show_image_file.F1 > mount/SHOW.IMAGE.FILE.\$F1 \
|
cat show_image_file.F1 > mount/SHOW.IMAGE.FILE.\$F1 \
|
||||||
&& echo "Updated mounted file"
|
&& echo "Updated mountable file"
|
||||||
|
@ -78,7 +78,7 @@ stash_stack: .byte 0
|
|||||||
lda LCBANK1
|
lda LCBANK1
|
||||||
lda #0
|
lda #0
|
||||||
sta $08
|
sta $08
|
||||||
jmp L0E53
|
jmp create_window
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
window_id = $33
|
window_id = $33
|
||||||
@ -90,7 +90,7 @@ stash_stack: .byte 0
|
|||||||
dest := $20
|
dest := $20
|
||||||
|
|
||||||
;; copy following routine to $20 and call it
|
;; copy following routine to $20 and call it
|
||||||
ldx #(routine_end - routine)
|
ldx #sizeof_routine
|
||||||
loop: lda routine,x
|
loop: lda routine,x
|
||||||
sta dest,x
|
sta dest,x
|
||||||
dex
|
dex
|
||||||
@ -118,31 +118,31 @@ L089D: lda #0
|
|||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
routine_end := *
|
sizeof_routine := * - routine
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
|
;;; ???
|
||||||
|
|
||||||
|
screen_height := 192
|
||||||
|
|
||||||
L08B3: .byte 0 ; ???
|
L08B3: .byte 0 ; ???
|
||||||
L08B4: sta query_box_params_id
|
L08B4: sta query_box_params_id
|
||||||
lda L0E02
|
lda create_window_params_L0E02
|
||||||
cmp #$BF
|
cmp #screen_height-1
|
||||||
bcc L08C4
|
bcc :+
|
||||||
lda #$80
|
lda #$80
|
||||||
sta L08B3
|
sta L08B3
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;;; ==================================================
|
: A2D_CALL A2D_QUERY_BOX, query_box_params
|
||||||
|
|
||||||
L08C4: A2D_CALL A2D_QUERY_BOX, query_box_params
|
|
||||||
A2D_CALL A2D_SET_BOX1, L0DB3
|
A2D_CALL A2D_SET_BOX1, L0DB3
|
||||||
lda query_box_params_id
|
lda query_box_params_id
|
||||||
cmp #window_id
|
cmp #window_id
|
||||||
bne L08DA
|
bne :+
|
||||||
jmp L1072
|
jmp L1072
|
||||||
|
|
||||||
L08DA: rts
|
: rts
|
||||||
|
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Param Blocks
|
;;; Param Blocks
|
||||||
@ -182,7 +182,10 @@ L08E0: .byte 0
|
|||||||
L08E1: .byte 0
|
L08E1: .byte 0
|
||||||
L08E2: .byte 0
|
L08E2: .byte 0
|
||||||
L08E3: .byte 0,0,0
|
L08E3: .byte 0,0,0
|
||||||
L08E6: .byte 0
|
|
||||||
|
.proc close_click_params
|
||||||
|
clicked:.byte 0
|
||||||
|
.endproc
|
||||||
|
|
||||||
.proc query_box_params
|
.proc query_box_params
|
||||||
id: .byte 0
|
id: .byte 0
|
||||||
@ -190,17 +193,34 @@ addr: .addr $0DB3
|
|||||||
.endproc
|
.endproc
|
||||||
query_box_params_id := query_box_params::id
|
query_box_params_id := query_box_params::id
|
||||||
|
|
||||||
L08EA: .byte $05
|
cw := 28
|
||||||
L08EB: .byte 0
|
c1 := 5
|
||||||
L08EC: .byte $03
|
c2 := c1 + cw
|
||||||
L08ED: .byte $00,$21,$00,$03,$00,$3D,$00,$03
|
c3 := c2 + cw
|
||||||
.byte $00,$59,$00,$03,$00,$05,$00,$13
|
c4 := c3 + cw
|
||||||
.byte $00,$21,$00,$13,$00,$3D,$00,$13
|
rh := 16
|
||||||
.byte $00,$59,$00,$13,$00,$05,$00,$23
|
r1 := 3
|
||||||
.byte $00,$21,$00,$23,$00,$3D,$00,$23
|
r2 := r1 + rh
|
||||||
.byte $00,$59,$00,$23,$00,$05,$00,$33
|
r3 := r2 + rh
|
||||||
.byte $00,$21,$00,$33,$00,$3D,$00,$33
|
r4 := r3 + rh
|
||||||
.byte $00,$59,$00,$33,$00
|
|
||||||
|
space_positions: ; left, top for all 16 holes
|
||||||
|
.word c1,r1
|
||||||
|
.word c2,r1
|
||||||
|
.word c3,r1
|
||||||
|
.word c4,r1
|
||||||
|
.word c1,r2
|
||||||
|
.word c2,r2
|
||||||
|
.word c3,r2
|
||||||
|
.word c4,r2
|
||||||
|
.word c1,r3
|
||||||
|
.word c2,r3
|
||||||
|
.word c3,r3
|
||||||
|
.word c4,r3
|
||||||
|
.word c1,r4
|
||||||
|
.word c2,r4
|
||||||
|
.word c3,r4
|
||||||
|
.word c4,r4
|
||||||
|
|
||||||
.proc pattern_table
|
.proc pattern_table
|
||||||
.addr piece1, piece2, piece3, piece4, piece5, piece6, piece7
|
.addr piece1, piece2, piece3, piece4, piece5, piece6, piece7
|
||||||
@ -430,7 +450,7 @@ piece12:
|
|||||||
.byte px(%0100110),px(%0110011),px(%0001111),px(%1111110)
|
.byte px(%0100110),px(%0110011),px(%0001111),px(%1111110)
|
||||||
.byte px(%0110011),px(%0011001),px(%1011111),px(%1111110)
|
.byte px(%0110011),px(%0011001),px(%1011111),px(%1111110)
|
||||||
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
|
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
|
||||||
piece13: ; the gap
|
piece13: ; the hole
|
||||||
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111110)
|
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111110)
|
||||||
.byte px(%0111011),px(%1011101),px(%1101110),px(%1110110)
|
.byte px(%0111011),px(%1011101),px(%1101110),px(%1110110)
|
||||||
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111110)
|
.byte px(%0111111),px(%1111111),px(%1111111),px(%1111110)
|
||||||
@ -517,22 +537,34 @@ piece16:
|
|||||||
.byte $00,$FF,$FF,$FF,$FF,$FF,$FF,$FF
|
.byte $00,$FF,$FF,$FF,$FF,$FF,$FF,$FF
|
||||||
.byte $FF,$00
|
.byte $FF,$00
|
||||||
|
|
||||||
.proc set_pos_params ; for what ???
|
.proc set_pos_params ; for what ??? (board is at 5,3)
|
||||||
.word 5, 2
|
.word 5, 2
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
L0D91: .byte $70,$00,$00,$00
|
;; Param block for $0F call (4 bytes)
|
||||||
L0D95: .byte $00
|
L0D91: .byte $70,$00,$00,$00 ; ???
|
||||||
L0D96: .byte $00
|
|
||||||
L0D97: .byte $00
|
;; hole position (0..3, 0..3)
|
||||||
L0D98: .byte $00
|
hole_x: .byte 0
|
||||||
L0D99: .byte $00
|
hole_y: .byte 0
|
||||||
L0D9A: .byte $00
|
|
||||||
L0D9B: .byte $00
|
;; click location (0..3, 0..3)
|
||||||
|
click_y: .byte $00
|
||||||
|
click_x: .byte $00
|
||||||
|
|
||||||
|
;; param for draw_row/draw_col
|
||||||
|
draw_rc: .byte $00
|
||||||
|
|
||||||
|
;; params for draw_selected
|
||||||
|
draw_end: .byte $00
|
||||||
|
draw_inc: .byte $00
|
||||||
|
|
||||||
|
destroy_window_params:
|
||||||
L0D9C: .byte $33,$73,$00,$F7,$FF,$AD,$0D,$01
|
L0D9C: .byte $33,$73,$00,$F7,$FF,$AD,$0D,$01
|
||||||
.byte $00,$00,$00,$00,$00,$06,$00,$05
|
.byte $00,$00,$00,$00,$00,$06,$00,$05
|
||||||
.byte $00,$41,$35,$47,$37,$36,$49
|
.byte $00,$41,$35,$47,$37,$36,$49
|
||||||
|
|
||||||
|
;; SET_BOX1 params (filled in by QUERY_BOX)
|
||||||
L0DB3: .byte $00,$00,$00,$00,$00,$00,$00,$00
|
L0DB3: .byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
@ -541,44 +573,81 @@ L0DB3: .byte $00,$00,$00,$00,$00,$00,$00,$00
|
|||||||
.byte $00,$00,$20,$80,$00,$00,$00,$00
|
.byte $00,$00,$20,$80,$00,$00,$00,$00
|
||||||
.byte $00,$2F,$02,$B1,$00,$00,$01,$02
|
.byte $00,$2F,$02,$B1,$00,$00,$01,$02
|
||||||
.byte $06
|
.byte $06
|
||||||
L0DEC: .byte $33,$02,$4C,$0E,$00,$00,$00,$00
|
|
||||||
.byte $00,$00,$00,$00,$79,$00,$44,$00
|
default_width := $79
|
||||||
.byte $79,$00,$44,$00,$DC,$00
|
default_height := $44
|
||||||
L0E02: .byte $50,$00,$00,$20,$80,$00,$00,$00
|
|
||||||
.byte $00,$00,$79,$00,$44,$00,$FF,$FF
|
.proc create_window_params
|
||||||
|
id: .byte $33
|
||||||
|
flags: .byte A2D_CWF_ADDCLOSE
|
||||||
|
title: .addr name
|
||||||
|
hscroll:.byte 0
|
||||||
|
vscroll:.byte 0
|
||||||
|
hsmax: .byte 0
|
||||||
|
hspos: .byte 0
|
||||||
|
vsmax: .byte 0
|
||||||
|
vspos: .byte 0
|
||||||
|
.byte $00,$00 ; ???
|
||||||
|
w_a: .word default_width
|
||||||
|
h_a: .word default_height
|
||||||
|
w_b: .word default_width
|
||||||
|
h_b: .word default_height
|
||||||
|
|
||||||
|
left: .word $DC
|
||||||
|
top: .word $50
|
||||||
|
saddr: .addr A2D_SCREEN_ADDR
|
||||||
|
stride: .word A2D_SCREEN_STRIDE
|
||||||
|
hoffset:.word 0
|
||||||
|
voffset:.word 0
|
||||||
|
width: .word default_width
|
||||||
|
height: .word default_height
|
||||||
|
|
||||||
|
;; This is QUERY_BOX/SET_BOX cruft
|
||||||
|
.byte $FF,$FF
|
||||||
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$00
|
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$00
|
||||||
.byte $00,$00,$00,$00,$01,$01,$00,$7F
|
.byte $00,$00,$00,$00,$01,$01,$00,$7F
|
||||||
.byte $00,$88,$00,$00,$DC,$00,$50,$00
|
.byte $00,$88
|
||||||
|
|
||||||
|
.byte $00,$00,$DC,$00,$50,$00
|
||||||
.byte $00,$20,$80,$00,$00,$00,$00,$00
|
.byte $00,$20,$80,$00,$00,$00,$00,$00
|
||||||
.byte $79,$00,$44,$00,$FF,$FF,$FF,$FF
|
.byte $79,$00,$44,$00,$FF,$FF,$FF,$FF
|
||||||
.byte $FF,$FF,$FF,$FF,$FF,$00,$00,$00
|
.byte $FF,$FF,$FF,$FF,$FF,$00,$00,$00
|
||||||
.byte $00,$00,$01,$01,$00,$7F,$00,$88
|
.byte $00,$00,$01,$01,$00,$7F,$00,$88
|
||||||
.byte $00,$00,$06,$50,$75,$7A,$7A,$6C
|
.byte $00,$00
|
||||||
.byte $65
|
|
||||||
|
.endproc
|
||||||
|
name: PASCAL_STRING "Puzzle"
|
||||||
|
|
||||||
|
create_window_params_L0E02 := create_window_params::top
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Create the window
|
;;; Create the window
|
||||||
|
|
||||||
L0E53: jsr save_zp
|
.proc create_window
|
||||||
A2D_CALL A2D_CREATE_WINDOW, L0DEC
|
jsr save_zp
|
||||||
ldy #$0F
|
A2D_CALL A2D_CREATE_WINDOW, create_window_params
|
||||||
L0E5E: tya
|
|
||||||
|
;; init pieces
|
||||||
|
ldy #15
|
||||||
|
loop: tya
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
dey
|
dey
|
||||||
bpl L0E5E
|
bpl loop
|
||||||
|
|
||||||
lda #window_id
|
lda #window_id
|
||||||
jsr L08B4
|
jsr L08B4
|
||||||
A2D_CALL $2B
|
A2D_CALL $2B
|
||||||
L0E70: ldy #$03
|
L0E70: ldy #3
|
||||||
L0E72: tya
|
L0E72: tya
|
||||||
pha
|
pha
|
||||||
ldx position_table
|
ldx position_table
|
||||||
ldy #$00
|
ldy #0
|
||||||
L0E79: lda position_table+1,y
|
ploop: lda position_table+1,y
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
iny
|
iny
|
||||||
cpy #$0F
|
cpy #15
|
||||||
bcc L0E79
|
bcc ploop
|
||||||
|
|
||||||
stx position_table+15
|
stx position_table+15
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
@ -588,23 +657,26 @@ L0E79: lda position_table+1,y
|
|||||||
lda position_table+1
|
lda position_table+1
|
||||||
sta position_table
|
sta position_table
|
||||||
stx position_table+1
|
stx position_table+1
|
||||||
|
|
||||||
A2D_CALL A2D_GET_INPUT, get_input_params
|
A2D_CALL A2D_GET_INPUT, get_input_params
|
||||||
lda get_input_params::state
|
lda get_input_params::state
|
||||||
beq L0E70
|
beq L0E70
|
||||||
jsr check_victory
|
jsr check_victory
|
||||||
bcs L0E70
|
bcs L0E70
|
||||||
jsr L11BB
|
jsr draw_all
|
||||||
jsr L12D2
|
jsr find_hole
|
||||||
|
; fall through
|
||||||
|
.endproc
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Input loop and processing
|
;;; Input loop and processing
|
||||||
|
|
||||||
input_loop:
|
.proc input_loop
|
||||||
A2D_CALL A2D_GET_INPUT, get_input_params
|
A2D_CALL A2D_GET_INPUT, get_input_params
|
||||||
lda get_input_params::state
|
lda get_input_params::state
|
||||||
cmp #A2D_INPUT_DOWN
|
cmp #A2D_INPUT_DOWN
|
||||||
bne :+
|
bne :+
|
||||||
jsr L0ECB
|
jsr on_click
|
||||||
jmp input_loop
|
jmp input_loop
|
||||||
|
|
||||||
;; key?
|
;; key?
|
||||||
@ -614,7 +686,8 @@ input_loop:
|
|||||||
jmp input_loop
|
jmp input_loop
|
||||||
|
|
||||||
;; click - where?
|
;; click - where?
|
||||||
L0ECB: A2D_CALL A2D_QUERY_TARGET, query_target_params
|
on_click:
|
||||||
|
A2D_CALL A2D_QUERY_TARGET, query_target_params
|
||||||
lda query_target_params_id
|
lda query_target_params_id
|
||||||
cmp #window_id
|
cmp #window_id
|
||||||
bne bail
|
bne bail
|
||||||
@ -632,25 +705,30 @@ bail: rts
|
|||||||
;; close box?
|
;; close box?
|
||||||
: cmp #A2D_ELEM_CLOSE
|
: cmp #A2D_ELEM_CLOSE
|
||||||
bne check_title
|
bne check_title
|
||||||
A2D_CALL A2D_CLOSE_CLICK, L08E6
|
A2D_CALL A2D_CLOSE_CLICK, close_click_params
|
||||||
lda L08E6
|
lda close_click_params::clicked
|
||||||
beq bail
|
beq bail
|
||||||
L0EF9: A2D_CALL A2D_DESTROY_WINDOW, L0D9C
|
destroy:
|
||||||
|
A2D_CALL A2D_DESTROY_WINDOW, destroy_window_params
|
||||||
|
|
||||||
jsr UNKNOWN_CALL ; ???
|
jsr UNKNOWN_CALL ; ???
|
||||||
.byte $0C
|
.byte $0C
|
||||||
.addr 0
|
.addr 0
|
||||||
|
|
||||||
ldx #$09 ; copy following to ZP and run it
|
target = $20 ; copy following to ZP and run it
|
||||||
L0F07: lda L0F12,x
|
ldx #sizeof_routine
|
||||||
sta L0020,x
|
loop: lda routine,x
|
||||||
|
sta target,x
|
||||||
dex
|
dex
|
||||||
bpl L0F07
|
bpl loop
|
||||||
jmp L0020
|
jmp target
|
||||||
|
|
||||||
|
.proc routine
|
||||||
L0F12: sta RAMRDOFF
|
L0F12: sta RAMRDOFF
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
jmp exit_da
|
jmp exit_da
|
||||||
|
.endproc
|
||||||
|
sizeof_routine := * - routine
|
||||||
|
|
||||||
;; title bar?
|
;; title bar?
|
||||||
check_title:
|
check_title:
|
||||||
@ -669,8 +747,9 @@ check_key:
|
|||||||
bne :+
|
bne :+
|
||||||
lda get_input_params::key
|
lda get_input_params::key
|
||||||
cmp #$1B ; Escape
|
cmp #$1B ; Escape
|
||||||
beq L0EF9
|
beq destroy
|
||||||
: rts
|
: rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Map click to piece x/y
|
;;; Map click to piece x/y
|
||||||
@ -686,33 +765,33 @@ L0F3D: lda #window_id
|
|||||||
lda map_coords_params::clienty
|
lda map_coords_params::clienty
|
||||||
ldx map_coords_params::clientx
|
ldx map_coords_params::clientx
|
||||||
|
|
||||||
cmp #$03
|
cmp #r1
|
||||||
bcc nope
|
bcc nope
|
||||||
cmp #$14
|
cmp #r2+1
|
||||||
bcs :+
|
bcs :+
|
||||||
jsr find_click_y
|
jsr find_click_y
|
||||||
bcc nope
|
bcc nope
|
||||||
lda #0
|
lda #0
|
||||||
beq yep
|
beq yep
|
||||||
: cmp #$24
|
: cmp #r3+1
|
||||||
bcs :+
|
bcs :+
|
||||||
jsr find_click_y
|
jsr find_click_y
|
||||||
bcc nope
|
bcc nope
|
||||||
lda #1
|
lda #1
|
||||||
bne yep
|
bne yep
|
||||||
: cmp #$34
|
: cmp #r4+1
|
||||||
bcs :+
|
bcs :+
|
||||||
jsr find_click_y
|
jsr find_click_y
|
||||||
bcc nope
|
bcc nope
|
||||||
lda #2
|
lda #2
|
||||||
bne yep
|
bne yep
|
||||||
: cmp #$44
|
: cmp #r4+rh+1
|
||||||
bcs nope
|
bcs nope
|
||||||
jsr find_click_y
|
jsr find_click_y
|
||||||
bcc nope
|
bcc nope
|
||||||
lda #3
|
lda #3
|
||||||
|
|
||||||
yep: sta L0D98
|
yep: sta click_x
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -721,25 +800,25 @@ nope: clc
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc find_click_y
|
.proc find_click_y
|
||||||
cpx #$05
|
cpx #c1
|
||||||
bcc nope
|
bcc nope
|
||||||
cpx #$21
|
cpx #c2
|
||||||
bcs :+
|
bcs :+
|
||||||
lda #0
|
lda #0
|
||||||
beq yep
|
beq yep
|
||||||
: cpx #$3E
|
: cpx #c3+1
|
||||||
bcs :+
|
bcs :+
|
||||||
lda #1
|
lda #1
|
||||||
bne yep
|
bne yep
|
||||||
: cpx #$5A
|
: cpx #c4+1
|
||||||
bcs :+
|
bcs :+
|
||||||
lda #2
|
lda #2
|
||||||
bne yep
|
bne yep
|
||||||
: cpx #$75
|
: cpx #c4+cw
|
||||||
bcs nope
|
bcs nope
|
||||||
lda #3
|
lda #3
|
||||||
|
|
||||||
yep: sta L0D97
|
yep: sta click_y
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -750,32 +829,34 @@ nope: clc
|
|||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Process piece click
|
;;; Process piece click
|
||||||
|
|
||||||
|
hole_piece := 12
|
||||||
|
|
||||||
L0FBC: lda #$00
|
L0FBC: lda #$00
|
||||||
ldy L0D96
|
ldy hole_y
|
||||||
beq L0FC9
|
beq L0FC9
|
||||||
L0FC3: clc
|
L0FC3: clc
|
||||||
adc #$04
|
adc #$04
|
||||||
dey
|
dey
|
||||||
bne L0FC3
|
bne L0FC3
|
||||||
L0FC9: sta L0D99
|
L0FC9: sta draw_rc
|
||||||
clc
|
clc
|
||||||
adc L0D95
|
adc hole_x
|
||||||
tay
|
tay
|
||||||
lda L0D97
|
lda click_y
|
||||||
cmp L0D95
|
cmp hole_x
|
||||||
beq L1014
|
beq L1014
|
||||||
lda L0D98
|
lda click_x
|
||||||
cmp L0D96
|
cmp hole_y
|
||||||
beq L0FE2
|
beq L0FE2
|
||||||
L0FE1: rts
|
L0FE1: rts
|
||||||
|
|
||||||
L0FE2: lda L0D97
|
L0FE2: lda click_y
|
||||||
cmp L0D95
|
cmp hole_x
|
||||||
beq L0FE1
|
beq L0FE1
|
||||||
bcs L1000
|
bcs L1000
|
||||||
lda L0D95
|
lda hole_x
|
||||||
sec
|
sec
|
||||||
sbc L0D97
|
sbc click_y
|
||||||
tax
|
tax
|
||||||
L0FF4: lda position_table-1,y
|
L0FF4: lda position_table-1,y
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
@ -783,9 +864,9 @@ L0FF4: lda position_table-1,y
|
|||||||
dex
|
dex
|
||||||
bne L0FF4
|
bne L0FF4
|
||||||
beq L1055
|
beq L1055
|
||||||
L1000: lda L0D97
|
L1000: lda click_y
|
||||||
sec
|
sec
|
||||||
sbc L0D95
|
sbc hole_x
|
||||||
tax
|
tax
|
||||||
L1008: lda position_table+1,y
|
L1008: lda position_table+1,y
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
@ -793,13 +874,13 @@ L1008: lda position_table+1,y
|
|||||||
dex
|
dex
|
||||||
bne L1008
|
bne L1008
|
||||||
beq L1055
|
beq L1055
|
||||||
L1014: lda L0D98
|
L1014: lda click_x
|
||||||
cmp L0D96
|
cmp hole_y
|
||||||
beq L0FE1
|
beq L0FE1
|
||||||
bcs L1035
|
bcs L1035
|
||||||
lda L0D96
|
lda hole_y
|
||||||
sec
|
sec
|
||||||
sbc L0D98
|
sbc click_x
|
||||||
tax
|
tax
|
||||||
L1026: lda position_table-4,y
|
L1026: lda position_table-4,y
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
@ -810,9 +891,9 @@ L1026: lda position_table-4,y
|
|||||||
dex
|
dex
|
||||||
bne L1026
|
bne L1026
|
||||||
beq L104A
|
beq L104A
|
||||||
L1035: lda L0D98
|
L1035: lda click_x
|
||||||
sec
|
sec
|
||||||
sbc L0D96
|
sbc hole_y
|
||||||
tax
|
tax
|
||||||
L103D: lda position_table+4,y
|
L103D: lda position_table+4,y
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
@ -822,17 +903,17 @@ L103D: lda position_table+4,y
|
|||||||
iny
|
iny
|
||||||
dex
|
dex
|
||||||
bne L103D
|
bne L103D
|
||||||
L104A: lda #$0C
|
L104A: lda #hole_piece
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
jsr L11D9
|
jsr draw_col
|
||||||
jmp L105D
|
jmp L105D
|
||||||
|
|
||||||
L1055: lda #$0C
|
L1055: lda #hole_piece
|
||||||
sta position_table,y
|
sta position_table,y
|
||||||
jsr L11C8
|
jsr draw_row
|
||||||
L105D: jsr check_victory
|
L105D: jsr check_victory
|
||||||
bcc L106E
|
bcc L106E
|
||||||
ldx #$04
|
ldx #4
|
||||||
L1064: txa
|
L1064: txa
|
||||||
pha
|
pha
|
||||||
jsr play_sound
|
jsr play_sound
|
||||||
@ -840,7 +921,7 @@ L1064: txa
|
|||||||
tax
|
tax
|
||||||
dex
|
dex
|
||||||
bne L1064
|
bne L1064
|
||||||
L106E: jmp L12D2
|
L106E: jmp find_hole
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -852,7 +933,7 @@ L1072: A2D_CALL A2D_SET_PATTERN, pattern_speckles
|
|||||||
A2D_CALL A2D_SET_PATTERN, pattern_black
|
A2D_CALL A2D_SET_PATTERN, pattern_black
|
||||||
A2D_CALL A2D_SET_POS, set_pos_params
|
A2D_CALL A2D_SET_POS, set_pos_params
|
||||||
A2D_CALL $0F, L0D91 ; ???
|
A2D_CALL $0F, L0D91 ; ???
|
||||||
jsr L11BB
|
jsr draw_all
|
||||||
|
|
||||||
lda #window_id
|
lda #window_id
|
||||||
sta query_box_params::id
|
sta query_box_params::id
|
||||||
@ -917,26 +998,38 @@ saved_zp:
|
|||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Draw pieces
|
;;; Draw pieces
|
||||||
|
|
||||||
L11BB: ldy #$01
|
.proc draw_all
|
||||||
sty L0D9B
|
ldy #1
|
||||||
|
sty draw_inc
|
||||||
dey
|
dey
|
||||||
lda #$10
|
lda #16
|
||||||
sta L0D9A
|
sta draw_end
|
||||||
bne L11E6
|
bne draw_selected
|
||||||
L11C8: lda #$01
|
.endproc
|
||||||
sta L0D9B
|
|
||||||
lda L0D99
|
.proc draw_row ; row specified in draw_rc
|
||||||
|
lda #1
|
||||||
|
sta draw_inc
|
||||||
|
lda draw_rc
|
||||||
tay
|
tay
|
||||||
clc
|
clc
|
||||||
adc #$04
|
adc #4
|
||||||
sta L0D9A
|
sta draw_end
|
||||||
bne L11E6
|
bne draw_selected
|
||||||
L11D9: lda #$04
|
.endproc
|
||||||
sta L0D9B
|
|
||||||
ldy L0D95
|
.proc draw_col ; col specified in draw_rc
|
||||||
lda #$10
|
lda #4
|
||||||
sta L0D9A
|
sta draw_inc
|
||||||
L11E6: tya
|
ldy hole_x
|
||||||
|
lda #16
|
||||||
|
sta draw_end
|
||||||
|
;; fall through
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;; Draw pieces from A to draw_end, step draw_inc
|
||||||
|
.proc draw_selected
|
||||||
|
tya
|
||||||
pha
|
pha
|
||||||
A2D_CALL A2D_HIDE_CURSOR
|
A2D_CALL A2D_HIDE_CURSOR
|
||||||
lda #window_id
|
lda #window_id
|
||||||
@ -945,18 +1038,19 @@ L11E6: tya
|
|||||||
A2D_CALL A2D_SET_BOX1, L0DB3
|
A2D_CALL A2D_SET_BOX1, L0DB3
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
L1201: tya
|
|
||||||
|
loop: tya
|
||||||
pha
|
pha
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
tax
|
tax
|
||||||
lda L08EA,x
|
lda space_positions,x
|
||||||
sta draw_pattern_params::left
|
sta draw_pattern_params::left
|
||||||
lda L08EB,x
|
lda space_positions+1,x
|
||||||
sta draw_pattern_params::left+1
|
sta draw_pattern_params::left+1
|
||||||
lda L08EC,x
|
lda space_positions+2,x
|
||||||
sta draw_pattern_params::top
|
sta draw_pattern_params::top
|
||||||
lda L08ED,x
|
lda space_positions+3,x
|
||||||
sta draw_pattern_params::top+1
|
sta draw_pattern_params::top+1
|
||||||
lda position_table,y
|
lda position_table,y
|
||||||
asl a
|
asl a
|
||||||
@ -968,31 +1062,32 @@ L1201: tya
|
|||||||
A2D_CALL A2D_DRAW_PATTERN, draw_pattern_params
|
A2D_CALL A2D_DRAW_PATTERN, draw_pattern_params
|
||||||
pla
|
pla
|
||||||
clc
|
clc
|
||||||
adc L0D9B
|
adc draw_inc
|
||||||
tay
|
tay
|
||||||
cpy L0D9A
|
cpy draw_end
|
||||||
bcc L1201
|
bcc loop
|
||||||
A2D_CALL A2D_SHOW_CURSOR
|
A2D_CALL A2D_SHOW_CURSOR
|
||||||
rts
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Play sound
|
;;; Play sound
|
||||||
|
|
||||||
.proc play_sound
|
.proc play_sound
|
||||||
ldx #$80
|
ldx #$80
|
||||||
L1249: lda #$58
|
loop1: lda #$58
|
||||||
L124B: ldy #$1B
|
loop2: ldy #$1B
|
||||||
L124D: dey
|
delay1: dey
|
||||||
bne L124D
|
bne delay1
|
||||||
bit SPKR
|
bit SPKR
|
||||||
tay
|
tay
|
||||||
delay: dey
|
delay2: dey
|
||||||
bne delay
|
bne delay2
|
||||||
sbc #$01
|
sbc #1
|
||||||
beq L1249
|
beq loop1
|
||||||
bit SPKR
|
bit SPKR
|
||||||
dex
|
dex
|
||||||
bne L124B
|
bne loop2
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@ -1068,23 +1163,30 @@ nope: clc
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
;;; ==================================================
|
||||||
|
;;; Find hole piece
|
||||||
|
|
||||||
L12D2: ldy #$0F
|
.proc find_hole
|
||||||
L12D4: lda position_table,y
|
ldy #15
|
||||||
cmp #$0C
|
loop: lda position_table,y
|
||||||
beq L12DE
|
cmp #hole_piece
|
||||||
|
beq :+
|
||||||
dey
|
dey
|
||||||
bpl L12D4
|
bpl loop
|
||||||
L12DE: lda #0
|
|
||||||
sta L0D95
|
: lda #0
|
||||||
sta L0D96
|
sta hole_x
|
||||||
|
sta hole_y
|
||||||
|
|
||||||
tya
|
tya
|
||||||
L12E7: cmp #4
|
again: cmp #4
|
||||||
bcc L12F2
|
bcc done
|
||||||
sbc #4
|
sbc #4
|
||||||
inc L0D96
|
inc hole_y
|
||||||
bne L12E7
|
bne again
|
||||||
L12F2: sta L0D95
|
|
||||||
|
done: sta hole_x
|
||||||
rts
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
last := *
|
last := *
|
||||||
|
Loading…
Reference in New Issue
Block a user