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
9c5d8f269b
commit
460204bcab
@ -7,9 +7,8 @@
|
|||||||
|
|
||||||
.include "a2d.inc"
|
.include "a2d.inc"
|
||||||
|
|
||||||
|
ROMIN2 := $C082
|
||||||
SPKR := $C030
|
SPKR := $C030
|
||||||
L0020 := $0020
|
|
||||||
L4015 := $4015
|
|
||||||
|
|
||||||
jmp copy2aux
|
jmp copy2aux
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ stash_stack: .byte 0
|
|||||||
end := last
|
end := last
|
||||||
|
|
||||||
sta ALTZPOFF
|
sta ALTZPOFF
|
||||||
lda $C082
|
lda ROMIN2
|
||||||
lda #<start
|
lda #<start
|
||||||
sta STARTLO
|
sta STARTLO
|
||||||
lda #>start
|
lda #>start
|
||||||
@ -99,6 +98,7 @@ loop: lda routine,x
|
|||||||
|
|
||||||
lda #window_id
|
lda #window_id
|
||||||
jsr L08B4
|
jsr L08B4
|
||||||
|
|
||||||
bit L08B3
|
bit L08B3
|
||||||
bmi L089D
|
bmi L089D
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ L089D: lda #0
|
|||||||
.proc routine
|
.proc routine
|
||||||
sta RAMRDOFF
|
sta RAMRDOFF
|
||||||
sta RAMWRTOFF
|
sta RAMWRTOFF
|
||||||
jsr L4015
|
jsr JUMP_TABLE_15
|
||||||
sta RAMRDON
|
sta RAMRDON
|
||||||
sta RAMWRTON
|
sta RAMWRTON
|
||||||
rts
|
rts
|
||||||
@ -127,16 +127,18 @@ L089D: lda #0
|
|||||||
screen_height := 192
|
screen_height := 192
|
||||||
|
|
||||||
L08B3: .byte 0 ; ???
|
L08B3: .byte 0 ; ???
|
||||||
|
|
||||||
|
;; called with window_id in A
|
||||||
L08B4: sta query_box_params_id
|
L08B4: sta query_box_params_id
|
||||||
lda create_window_params_L0E02
|
lda create_window_params_top ; is top on screen?
|
||||||
cmp #screen_height-1
|
cmp #screen_height-1
|
||||||
bcc :+
|
bcc :+ ; yes
|
||||||
lda #$80
|
lda #$80 ; no, so ... ???
|
||||||
sta L08B3
|
sta L08B3
|
||||||
rts
|
rts
|
||||||
|
|
||||||
: A2D_CALL A2D_QUERY_BOX, query_box_params
|
: A2D_CALL A2D_QUERY_BOX, query_box_params
|
||||||
A2D_CALL A2D_SET_BOX1, L0DB3
|
A2D_CALL A2D_SET_BOX1, set_box_params
|
||||||
lda query_box_params_id
|
lda query_box_params_id
|
||||||
cmp #window_id
|
cmp #window_id
|
||||||
bne :+
|
bne :+
|
||||||
@ -147,41 +149,39 @@ L08B4: sta query_box_params_id
|
|||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Param Blocks
|
;;; Param Blocks
|
||||||
|
|
||||||
;; following memory space is re-used
|
;; following memory space is re-used so x/y overlap
|
||||||
.proc drag_window_params
|
.proc drag_window_params
|
||||||
id := * + 0
|
id := * + 0
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc map_coords_params
|
.proc map_coords_params
|
||||||
id := * + 0
|
id := * + 0
|
||||||
screenx := * + 1
|
screenx := * + 1 ; x overlap
|
||||||
screeny := * + 3
|
screeny := * + 3 ; y overlap
|
||||||
clientx := * + 5
|
clientx := * + 5
|
||||||
clienty := * + 7
|
clienty := * + 7
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
query_target_params := *+1
|
|
||||||
query_target_params_queryx := *+1
|
|
||||||
query_target_params_queryy := *+3
|
|
||||||
query_target_params_element := *+5
|
|
||||||
query_target_params_id := *+6
|
|
||||||
|
|
||||||
.proc get_input_params
|
.proc get_input_params
|
||||||
state: .byte 0
|
state: .byte 0
|
||||||
key := *
|
key := *
|
||||||
modifiers := *+1
|
modifiers := *+1
|
||||||
|
|
||||||
xcoord := *
|
xcoord := * ; x overlap
|
||||||
ycoord := *+2
|
ycoord := *+2 ; y overlap
|
||||||
.byte 0,0,0,0 ; storage for above
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
.proc query_target_params
|
||||||
|
queryx := * ; x overlap
|
||||||
|
queryy := *+2 ; y overlap
|
||||||
|
element := *+4
|
||||||
|
id := *+5
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.byte 0,0,0,0 ; storage for above
|
||||||
|
.byte 0,0,0,0
|
||||||
|
|
||||||
L08E0: .byte 0
|
.byte 0,0 ; ???
|
||||||
L08E1: .byte 0
|
|
||||||
L08E2: .byte 0
|
|
||||||
L08E3: .byte 0,0,0
|
|
||||||
|
|
||||||
.proc close_click_params
|
.proc close_click_params
|
||||||
clicked:.byte 0
|
clicked:.byte 0
|
||||||
@ -189,10 +189,11 @@ clicked:.byte 0
|
|||||||
|
|
||||||
.proc query_box_params
|
.proc query_box_params
|
||||||
id: .byte 0
|
id: .byte 0
|
||||||
addr: .addr $0DB3
|
addr: .addr set_box_params
|
||||||
.endproc
|
.endproc
|
||||||
query_box_params_id := query_box_params::id
|
query_box_params_id := query_box_params::id
|
||||||
|
|
||||||
|
;; Puzzle piece row/columns
|
||||||
cw := 28
|
cw := 28
|
||||||
c1 := 5
|
c1 := 5
|
||||||
c2 := c1 + cw
|
c2 := c1 + cw
|
||||||
@ -223,10 +224,10 @@ space_positions: ; left, top for all 16 holes
|
|||||||
.word c4,r4
|
.word c4,r4
|
||||||
|
|
||||||
.proc pattern_table
|
.proc pattern_table
|
||||||
.addr piece1, piece2, piece3, piece4, piece5, piece6, piece7
|
.addr piece1, piece2, piece3, piece4
|
||||||
.addr piece8, piece9, piece10, piece11, piece12, piece13, piece14
|
.addr piece5, piece6, piece7, piece8
|
||||||
p15: .addr piece15
|
.addr piece9, piece10, piece11, piece12
|
||||||
p16: .addr piece16
|
.addr piece13, piece14, piece15, piece16
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;; Current position table
|
;; Current position table
|
||||||
@ -241,7 +242,7 @@ left: .word 0
|
|||||||
top: .word 0
|
top: .word 0
|
||||||
addr: .addr 0
|
addr: .addr 0
|
||||||
stride: .byte 4
|
stride: .byte 4
|
||||||
.byte 0,0,0,0,0
|
.byte 0,0,0,0,0 ; ???
|
||||||
width: .word 27
|
width: .word 27
|
||||||
height: .word 15
|
height: .word 15
|
||||||
.endproc
|
.endproc
|
||||||
@ -521,7 +522,7 @@ piece16:
|
|||||||
|
|
||||||
|
|
||||||
.proc fill_rect_params
|
.proc fill_rect_params
|
||||||
.word 1, 0, $79, $44
|
.word 1, 0, default_width, default_height
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc pattern_speckles
|
.proc pattern_speckles
|
||||||
@ -534,6 +535,7 @@ piece16:
|
|||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
;; ???
|
||||||
.byte $00,$FF,$FF,$FF,$FF,$FF,$FF,$FF
|
.byte $00,$FF,$FF,$FF,$FF,$FF,$FF,$FF
|
||||||
.byte $FF,$00
|
.byte $FF,$00
|
||||||
|
|
||||||
@ -559,13 +561,17 @@ draw_rc: .byte $00
|
|||||||
draw_end: .byte $00
|
draw_end: .byte $00
|
||||||
draw_inc: .byte $00
|
draw_inc: .byte $00
|
||||||
|
|
||||||
destroy_window_params:
|
.proc destroy_window_params
|
||||||
L0D9C: .byte $33,$73,$00,$F7,$FF,$AD,$0D,$01
|
id: .byte window_id
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.byte $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)
|
;; SET_BOX1 params (filled in by QUERY_BOX)
|
||||||
L0DB3: .byte $00,$00,$00,$00,$00,$00,$00,$00
|
set_box_params:
|
||||||
|
.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
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
@ -574,11 +580,13 @@ L0DB3: .byte $00,$00,$00,$00,$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
|
||||||
|
|
||||||
|
default_left := 220
|
||||||
|
default_top := 80
|
||||||
default_width := $79
|
default_width := $79
|
||||||
default_height := $44
|
default_height := $44
|
||||||
|
|
||||||
.proc create_window_params
|
.proc create_window_params
|
||||||
id: .byte $33
|
id: .byte window_id
|
||||||
flags: .byte A2D_CWF_ADDCLOSE
|
flags: .byte A2D_CWF_ADDCLOSE
|
||||||
title: .addr name
|
title: .addr name
|
||||||
hscroll:.byte 0
|
hscroll:.byte 0
|
||||||
@ -593,8 +601,8 @@ h_a: .word default_height
|
|||||||
w_b: .word default_width
|
w_b: .word default_width
|
||||||
h_b: .word default_height
|
h_b: .word default_height
|
||||||
|
|
||||||
left: .word $DC
|
left: .word default_left
|
||||||
top: .word $50
|
top: .word default_top
|
||||||
saddr: .addr A2D_SCREEN_ADDR
|
saddr: .addr A2D_SCREEN_ADDR
|
||||||
stride: .word A2D_SCREEN_STRIDE
|
stride: .word A2D_SCREEN_STRIDE
|
||||||
hoffset:.word 0
|
hoffset:.word 0
|
||||||
@ -608,9 +616,15 @@ height: .word default_height
|
|||||||
.byte $00,$00,$00,$00,$01,$01,$00,$7F
|
.byte $00,$00,$00,$00,$01,$01,$00,$7F
|
||||||
.byte $00,$88
|
.byte $00,$88
|
||||||
|
|
||||||
.byte $00,$00,$DC,$00,$50,$00
|
.byte $00,$00
|
||||||
.byte $00,$20,$80,$00,$00,$00,$00,$00
|
.word default_left
|
||||||
.byte $79,$00,$44,$00,$FF,$FF,$FF,$FF
|
.word default_top
|
||||||
|
.addr A2D_SCREEN_ADDR
|
||||||
|
.word A2D_SCREEN_STRIDE
|
||||||
|
.byte $00,$00,$00,$00
|
||||||
|
.word default_width
|
||||||
|
.word default_height
|
||||||
|
.byte $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
|
.byte $00,$00
|
||||||
@ -618,7 +632,7 @@ height: .word default_height
|
|||||||
.endproc
|
.endproc
|
||||||
name: PASCAL_STRING "Puzzle"
|
name: PASCAL_STRING "Puzzle"
|
||||||
|
|
||||||
create_window_params_L0E02 := create_window_params::top
|
create_window_params_top := create_window_params::top
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
;;; Create the window
|
;;; Create the window
|
||||||
@ -636,7 +650,9 @@ loop: tya
|
|||||||
|
|
||||||
lda #window_id
|
lda #window_id
|
||||||
jsr L08B4
|
jsr L08B4
|
||||||
A2D_CALL $2B
|
A2D_CALL $2B ; ???
|
||||||
|
|
||||||
|
;; Scramble?
|
||||||
L0E70: ldy #3
|
L0E70: ldy #3
|
||||||
L0E72: tya
|
L0E72: tya
|
||||||
pha
|
pha
|
||||||
@ -688,10 +704,10 @@ ploop: lda position_table+1,y
|
|||||||
;; click - where?
|
;; click - where?
|
||||||
on_click:
|
on_click:
|
||||||
A2D_CALL A2D_QUERY_TARGET, query_target_params
|
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
|
||||||
lda query_target_params_element
|
lda query_target_params::element
|
||||||
bne :+
|
bne :+
|
||||||
bail: rts
|
bail: rts
|
||||||
|
|
||||||
@ -938,7 +954,7 @@ L1072: A2D_CALL A2D_SET_PATTERN, pattern_speckles
|
|||||||
lda #window_id
|
lda #window_id
|
||||||
sta query_box_params::id
|
sta query_box_params::id
|
||||||
A2D_CALL A2D_QUERY_BOX, query_box_params
|
A2D_CALL A2D_QUERY_BOX, query_box_params
|
||||||
A2D_CALL A2D_SET_BOX1, L0DB3
|
A2D_CALL A2D_SET_BOX1, set_box_params
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;;; ==================================================
|
;;; ==================================================
|
||||||
@ -1035,7 +1051,7 @@ saved_zp:
|
|||||||
lda #window_id
|
lda #window_id
|
||||||
sta query_box_params::id
|
sta query_box_params::id
|
||||||
A2D_CALL A2D_QUERY_BOX, query_box_params
|
A2D_CALL A2D_QUERY_BOX, query_box_params
|
||||||
A2D_CALL A2D_SET_BOX1, L0DB3
|
A2D_CALL A2D_SET_BOX1, set_box_params
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user