Starting to identify input loop and widget clicks

This commit is contained in:
Joshua Bell 2017-08-29 22:10:33 -07:00
parent ba83687453
commit 8c962af1ec
4 changed files with 166 additions and 123 deletions

View File

@ -6,7 +6,9 @@
A2D := $4000
UNKNOWN_CALL := $8E00
A2D_TEXT := $19
A2D_TEXT := $19 ; { .addr data, .byte len }
A2D_GET_BUTTON := $2A ; { .byte state (0=up, 1=down?, 2=released?) }
A2D_GET_MOUSE := $40 ; { .word x, .word y, ????}
;;; Macros
.macro A2D_CALL op, addr

View File

@ -76,7 +76,9 @@ Current file: stf.s
000800 2 A2D := $4000
000800 2 UNKNOWN_CALL := $8E00
000800 2
000800 2 A2D_TEXT := $19
000800 2 A2D_TEXT := $19 ; { .addr data, .byte len }
000800 2 A2D_GET_BUTTON := $2A ; { .byte state (0=up, 1=down?, 2=released?) }
000800 2 A2D_GET_MOUSE := $40 ; { .word x, .word y, ????}
000800 2
000800 2 ;;; Macros
000800 2 .macro A2D_CALL op, addr
@ -321,13 +323,20 @@ Current file: stf.s
00096C 1 00 L096C: .byte $00
00096D 1 00 L096D: .byte $00
00096E 1 00 L096E: .byte $00
00096F 1 00 L096F: .byte $00
000970 1 00 L0970: .byte $00
000971 1 00 L0971: .byte $00
000972 1 00 L0972: .byte $00
000973 1 00 00 L0973: .byte $00,$00
00096F 1
00096F 1 fixed_mode_flag:
00096F 1 00 .byte $00 ; 0 = proportional, otherwise = fixed
000970 1
000970 1 button_state:
000970 1 00 .byte $00
000971 1
000971 1 mouse_data:
000971 1 00 00 mouse_x:.word 0 ; lo/hi of mouse x position
000973 1 00 00 mouse_y:.word 0 ; lo of mouse y position (hi = unused?) ?????
000975 1 00 L0975: .byte $00
000976 1 00 L0976: .byte $00
000977 1
000977 1
000977 1 64 L0977: .byte $64
000978 1 00 L0978: .byte $00
000979 1 00 L0979: .byte $00
@ -476,7 +485,7 @@ Current file: stf.s
000A89 1 60 L0A89: rts
000A8A 1
000A8A 1 A9 00 L0A8A: lda #$00
000A8C 1 8D 6F 09 sta L096F
000A8C 1 8D 6F 09 sta fixed_mode_flag
000A8F 1 AE 01 88 ldx $8801
000A92 1 8D 04 C0 sta RAMWRTOFF
000A95 1 BD 02 88 L0A95: lda $8802,x
@ -496,46 +505,49 @@ Current file: stf.s
000ABC 1 20 00 40 04 A2D_CALL $04, L09A8
000AC0 1 A8 09
000AC2 1 20 88 10 jsr L1088
000AC5 1 20 98 11 jsr L1198
000AC5 1 20 98 11 jsr draw_mode
000AC8 1 20 30 0E jsr L0E30
000ACB 1 20 00 40 2B A2D_CALL $2B, NULL
000ACF 1 00 00
000AD1 1 20 00 40 2A L0AD1: A2D_CALL $2A, L0970
000AD1 1
000AD1 1 input_loop:
000AD1 1 20 00 40 2A A2D_CALL A2D_GET_BUTTON, button_state
000AD5 1 70 09
000AD7 1 AD 70 09 lda L0970
000ADA 1 C9 01 cmp #$01
000ADC 1 D0 F3 bne L0AD1
000ADE 1 20 00 40 40 A2D_CALL $40, L0971
000AD7 1 AD 70 09 lda button_state
000ADA 1 C9 01 cmp #$01 ; was clicked?
000ADC 1 D0 F3 bne input_loop ; nope, keep waiting
000ADE 1
000ADE 1 20 00 40 40 A2D_CALL A2D_GET_MOUSE, mouse_data
000AE2 1 71 09
000AE4 1 AD 76 09 lda L0976
000AE4 1 AD 76 09 lda L0976 ; ??? UI element type ???
000AE7 1 C9 64 cmp #$64
000AE9 1 D0 E6 bne L0AD1
000AE9 1 D0 E6 bne input_loop
000AEB 1 AD 75 09 lda L0975
000AEE 1 C9 05 cmp #$05
000AF0 1 F0 2F beq L0B21
000AF2 1 AE 71 09 ldx L0971
000AF2 1 AE 71 09 ldx mouse_x
000AF5 1 8E 78 09 stx L0978
000AF8 1 8E 80 09 stx L0980
000AFB 1 AE 72 09 ldx L0972
000AFB 1 AE 72 09 ldx mouse_x+1
000AFE 1 8E 79 09 stx L0979
000B01 1 8E 81 09 stx L0981
000B04 1 AE 73 09 ldx L0973
000B04 1 AE 73 09 ldx mouse_y
000B07 1 8E 7A 09 stx L097A
000B0A 1 8E 82 09 stx L0982
000B0D 1 C9 03 cmp #$03
000B0F 1 F0 0A beq L0B1B
000B11 1 C9 04 cmp #$04
000B13 1 F0 BC beq L0AD1
000B13 1 F0 BC beq input_loop
000B15 1 20 B4 0B jsr L0BB4
000B18 1 4C D1 0A jmp L0AD1
000B18 1 4C D1 0A jmp input_loop
000B1B 1
000B1B 1 20 3A 11 L0B1B: jsr L113A
000B1E 1 4C D1 0A jmp L0AD1
000B1B 1 20 3A 11 L0B1B: jsr on_title_bar_click
000B1E 1 4C D1 0A jmp input_loop
000B21 1
000B21 1 20 00 40 43 L0B21: A2D_CALL $43, L097D
000B25 1 7D 09
000B27 1 AD 7D 09 lda L097D
000B2A 1 F0 A5 beq L0AD1
000B2A 1 F0 A5 beq input_loop
000B2C 1 20 AF 08 jsr close_file
000B2F 1 20 00 40 39 A2D_CALL $39, L0994
000B33 1 94 09
@ -590,7 +602,7 @@ Current file: stf.s
000BA5 1 8D 86 09 sta L0986
000BA8 1 20 00 40 49 A2D_CALL $49, L0986
000BAC 1 86 09
000BAE 1 20 98 11 jsr L1198
000BAE 1 20 98 11 jsr draw_mode
000BB1 1 4C F9 0D jmp L0DF9
000BB4 1
000BB4 1 20 00 40 48 L0BB4: A2D_CALL $48, L0980
@ -782,20 +794,20 @@ Current file: stf.s
000D36 1 D0 D0 bne L0D08
000D38 1 60 rts
000D39 1
000D39 1 AD 71 09 L0D39: lda L0971
000D39 1 AD 71 09 L0D39: lda mouse_x
000D3C 1 8D 8B 09 sta L098B
000D3F 1 AD 72 09 lda L0972
000D3F 1 AD 72 09 lda mouse_x+1
000D42 1 8D 8C 09 sta L098C
000D45 1 AD 73 09 lda L0973
000D45 1 AD 73 09 lda mouse_y
000D48 1 8D 8D 09 sta L098D
000D4B 1 20 00 40 4A A2D_CALL $4A, L098A
000D4F 1 8A 09
000D51 1 60 rts
000D52 1
000D52 1 20 00 40 2A L0D52: A2D_CALL $2A, L0970
000D52 1 20 00 40 2A L0D52: A2D_CALL A2D_GET_BUTTON, button_state
000D56 1 70 09
000D58 1 AD 70 09 lda L0970
000D5B 1 C9 02 cmp #$02
000D58 1 AD 70 09 lda button_state
000D5B 1 C9 02 cmp #$02 ; was down, now up???
000D5D 1 60 rts
000D5E 1
000D5E 1 AD 9B 09 L0D5E: lda L099B
@ -880,7 +892,7 @@ Current file: stf.s
000E11 1 8D 89 09 sta L0989
000E14 1 20 ED 0D jsr L0DED
000E17 1 20 30 0E jsr L0E30
000E1A 1 4C D1 0A jmp L0AD1
000E1A 1 4C D1 0A jmp input_loop
000E1D 1
000E1D 1 20 00 40 08 L0E1D: A2D_CALL $08, L0952
000E21 1 52 09
@ -1217,7 +1229,7 @@ Current file: stf.s
001105 1 20 20 00 jsr L0020
001108 1 60 rts
001109 1
001109 1 AD 6F 09 L1109: lda L096F
001109 1 AD 6F 09 L1109: lda fixed_mode_flag
00110C 1 F0 1A beq L1128
00110E 1 A9 00 lda #$00
001110 1 85 3C sta $3C
@ -1234,7 +1246,7 @@ Current file: stf.s
001125 1 20 11 C3 jsr AUXMOVE
001128 1 60 L1128: rts
001129 1
001129 1 AD 6F 09 L1129: lda L096F
001129 1 AD 6F 09 L1129: lda fixed_mode_flag
00112C 1 F0 0B beq L1139
00112E 1 AE 01 88 ldx $8801
001131 1 A9 07 lda #$07
@ -1243,26 +1255,30 @@ Current file: stf.s
001137 1 D0 FA bne L1133
001139 1 60 L1139: rts
00113A 1
00113A 1 AD 72 09 L113A: lda L0972
00113D 1 CD 85 11 cmp L1185
001140 1 D0 06 bne L1148
001142 1 AD 71 09 lda L0971
001145 1 CD 84 11 cmp L1184
001148 1 90 19 L1148: bcc L1163
00114A 1 AD 6F 09 lda L096F
00114D 1 F0 09 beq L1158
00114F 1 CE 6F 09 dec L096F
00113A 1 ;;; On Title Bar Click - is it on the Fixed/Proportional label?
00113A 1 .proc on_title_bar_click
00113A 1 AD 72 09 lda mouse_x+1 ; mouse x high byte?
00113D 1 CD 85 11 cmp label_left+1
001140 1 D0 06 bne :+
001142 1 AD 71 09 lda mouse_x
001145 1 CD 84 11 cmp label_left
001148 1 90 19 : bcc ignore
00114A 1 AD 6F 09 lda fixed_mode_flag
00114D 1 F0 09 beq set_flag
00114F 1 CE 6F 09 dec fixed_mode_flag ; clear flag (mode = proportional)
001152 1 20 09 11 jsr L1109
001155 1 4C 5B 11 jmp L115B
001155 1 4C 5B 11 jmp redraw
001158 1
001158 1 EE 6F 09 L1158: inc L096F
00115B 1 20 BD 11 L115B: jsr L11BD
001158 1 set_flag:
001158 1 EE 6F 09 inc fixed_mode_flag ; set flag (mode = fixed)
00115B 1 20 BD 11 redraw: jsr draw_mode2
00115E 1 20 30 0E jsr L0E30
001161 1 38 sec
001161 1 38 sec ; Click consumed
001162 1 60 rts
001163 1
001163 1 18 L1163: clc
001163 1 18 ignore: clc ; Click ignored
001164 1 60 rts
001165 1 .endproc
001165 1
001165 1 68 11 0D 46 fixed_str: A2D_DEFSTRING "Fixed "
001169 1 69 78 65 64
@ -1271,14 +1287,16 @@ Current file: stf.s
001179 1 72 6F 70 6F
00117D 1 72 74 69 6F
001184 1
001184 1 00 L1184: .byte $00
001185 1 00 L1185: .byte $00
001184 1 ;;; Scratch space for Fixed/Proportional drawing code
001184 1 00 00 label_left: .word 0 ; left edge of label
001186 1 00 00 00 20 L1186: .byte $00,$00,$00,$20,$80,$00,$00,$00
00118A 1 80 00 00 00
00118E 1 00 00 50 00 .byte $00,$00,$50,$00,$0A,$00
001192 1 0A 00
001194 1 00 00 0A 00 L1194: .byte $00,$00,$0A,$00
001198 1 38 L1198: sec
001198 1
001198 1 .proc draw_mode ; guess: this is computing draw location
001198 1 38 sec
001199 1 AD AA 09 lda L09AA
00119C 1 E9 0C sbc #$0C
00119E 1 8D 86 11 sta L1186
@ -1292,28 +1310,31 @@ Current file: stf.s
0011B0 1 38 sec
0011B1 1 68 pla
0011B2 1 E9 32 sbc #$32
0011B4 1 8D 84 11 sta L1184
0011B4 1 8D 84 11 sta label_left
0011B7 1 8A txa
0011B8 1 E9 00 sbc #$00
0011BA 1 8D 85 11 sta L1185
0011BD 1 20 00 40 06 L11BD: A2D_CALL $06, L1184
0011BA 1 8D 85 11 sta label_left+1
0011BD 1 .endproc
0011BD 1 .proc draw_mode2
0011BD 1 20 00 40 06 A2D_CALL $06, label_left ; guess: setting up draw location
0011C1 1 84 11
0011C3 1 20 00 40 0E A2D_CALL $0E, L1194
0011C7 1 94 11
0011C9 1 AD 6F 09 lda L096F
0011CC 1 F0 09 beq L11D7
0011C9 1 AD 6F 09 lda fixed_mode_flag
0011CC 1 F0 09 beq else ; is proportional?
0011CE 1 20 00 40 19 A2D_CALL A2D_TEXT, fixed_str
0011D2 1 65 11
0011D4 1 4C DD 11 jmp L11DD
0011D7 1
0011D7 1 20 00 40 19 L11D7: A2D_CALL A2D_TEXT, prop_str
0011D4 1 4C DD 11 jmp endif
0011D7 1 20 00 40 19 else: A2D_CALL A2D_TEXT, prop_str
0011DB 1 75 11
0011DD 1 A2 0F L11DD: ldx #$0F
0011DF 1 BD CE 09 L11DF: lda L09CE,x
0011DD 1 endif:
0011DD 1 A2 0F ldx #$0F
0011DF 1 BD CE 09 loop: lda L09CE,x
0011E2 1 9D A8 09 sta L09A8,x
0011E5 1 CA dex
0011E6 1 10 F7 bpl L11DF
0011E6 1 10 F7 bpl loop
0011E8 1 20 00 40 06 A2D_CALL $06, L09A8
0011EC 1 A8 09
0011EE 1 60 rts
0011EE 1
0011EF 1 .endproc
0011EF 1

Binary file not shown.

View File

@ -219,13 +219,20 @@ L096B: .byte $00
L096C: .byte $00
L096D: .byte $00
L096E: .byte $00
L096F: .byte $00
L0970: .byte $00
L0971: .byte $00
L0972: .byte $00
L0973: .byte $00,$00
fixed_mode_flag:
.byte $00 ; 0 = proportional, otherwise = fixed
button_state:
.byte $00
mouse_data:
mouse_x:.word 0 ; lo/hi of mouse x position
mouse_y:.word 0 ; lo of mouse y position (hi = unused?) ?????
L0975: .byte $00
L0976: .byte $00
L0977: .byte $64
L0978: .byte $00
L0979: .byte $00
@ -367,7 +374,7 @@ L0A74: lda ($06),y
L0A89: rts
L0A8A: lda #$00
sta L096F
sta fixed_mode_flag
ldx $8801
sta RAMWRTOFF
L0A95: lda $8802,x
@ -385,42 +392,46 @@ L0A95: lda $8802,x
A2D_CALL $38, L0994
A2D_CALL $04, L09A8
jsr L1088
jsr L1198
jsr draw_mode
jsr L0E30
A2D_CALL $2B, NULL
L0AD1: A2D_CALL $2A, L0970
lda L0970
cmp #$01
bne L0AD1
A2D_CALL $40, L0971
lda L0976
input_loop:
A2D_CALL A2D_GET_BUTTON, button_state
lda button_state
cmp #$01 ; was clicked?
bne input_loop ; nope, keep waiting
A2D_CALL A2D_GET_MOUSE, mouse_data
lda L0976 ; ??? UI element type ???
cmp #$64
bne L0AD1
bne input_loop
lda L0975
cmp #$05
beq L0B21
ldx L0971
ldx mouse_x
stx L0978
stx L0980
ldx L0972
ldx mouse_x+1
stx L0979
stx L0981
ldx L0973
ldx mouse_y
stx L097A
stx L0982
cmp #$03
beq L0B1B
cmp #$04
beq L0AD1
beq input_loop
jsr L0BB4
jmp L0AD1
jmp input_loop
L0B1B: jsr L113A
jmp L0AD1
L0B1B: jsr on_title_bar_click
jmp input_loop
;;; Close box clicked?
L0B21: A2D_CALL $43, L097D
lda L097D
beq L0AD1
beq input_loop
jsr close_file
A2D_CALL $39, L0994
jsr UNKNOWN_CALL
@ -472,7 +483,7 @@ L0B8B: sta L0998
lda #$02
sta L0986
A2D_CALL $49, L0986
jsr L1198
jsr draw_mode
jmp L0DF9
L0BB4: A2D_CALL $48, L0980
@ -663,18 +674,18 @@ L0D27: sta L099B
bne L0D08
rts
L0D39: lda L0971
L0D39: lda mouse_x
sta L098B
lda L0972
lda mouse_x+1
sta L098C
lda L0973
lda mouse_y
sta L098D
A2D_CALL $4A, L098A
rts
L0D52: A2D_CALL $2A, L0970
lda L0970
cmp #$02
L0D52: A2D_CALL A2D_GET_BUTTON, button_state
lda button_state
cmp #$02 ; was down, now up???
rts
L0D5E: lda L099B
@ -756,7 +767,7 @@ L0E0E: lda L099D
sta L0989
jsr L0DED
jsr L0E30
jmp L0AD1
jmp input_loop
L0E1D: A2D_CALL $08, L0952
A2D_CALL $11, L09B0
@ -1086,7 +1097,7 @@ L10FF: sta $27
jsr L0020
rts
L1109: lda L096F
L1109: lda fixed_mode_flag
beq L1128
lda #$00
sta $3C
@ -1103,7 +1114,7 @@ L1109: lda L096F
jsr AUXMOVE
L1128: rts
L1129: lda L096F
L1129: lda fixed_mode_flag
beq L1139
ldx $8801
lda #$07
@ -1112,36 +1123,42 @@ L1133: sta $8802,x
bne L1133
L1139: rts
L113A: lda L0972
cmp L1185
bne L1148
lda L0971
cmp L1184
L1148: bcc L1163
lda L096F
beq L1158
dec L096F
;;; On Title Bar Click - is it on the Fixed/Proportional label?
.proc on_title_bar_click
lda mouse_x+1 ; mouse x high byte?
cmp label_left+1
bne :+
lda mouse_x
cmp label_left
: bcc ignore
lda fixed_mode_flag
beq set_flag
dec fixed_mode_flag ; clear flag (mode = proportional)
jsr L1109
jmp L115B
jmp redraw
L1158: inc L096F
L115B: jsr L11BD
set_flag:
inc fixed_mode_flag ; set flag (mode = fixed)
redraw: jsr draw_mode2
jsr L0E30
sec
sec ; Click consumed
rts
L1163: clc
ignore: clc ; Click ignored
rts
.endproc
fixed_str: A2D_DEFSTRING "Fixed "
prop_str: A2D_DEFSTRING "Proportional"
L1184: .byte $00
L1185: .byte $00
;;; Scratch space for Fixed/Proportional drawing code
label_left: .word 0 ; left edge of label
L1186: .byte $00,$00,$00,$20,$80,$00,$00,$00
.byte $00,$00,$50,$00,$0A,$00
L1194: .byte $00,$00,$0A,$00
L1198: sec
.proc draw_mode ; guess: this is computing draw location
sec
lda L09AA
sbc #$0C
sta L1186
@ -1155,22 +1172,25 @@ L1198: sec
sec
pla
sbc #$32
sta L1184
sta label_left
txa
sbc #$00
sta L1185
L11BD: A2D_CALL $06, L1184
sta label_left+1
.endproc
.proc draw_mode2
A2D_CALL $06, label_left ; guess: setting up draw location
A2D_CALL $0E, L1194
lda L096F
beq L11D7
lda fixed_mode_flag
beq else ; is proportional?
A2D_CALL A2D_TEXT, fixed_str
jmp L11DD
L11D7: A2D_CALL A2D_TEXT, prop_str
L11DD: ldx #$0F
L11DF: lda L09CE,x
jmp endif
else: A2D_CALL A2D_TEXT, prop_str
endif:
ldx #$0F
loop: lda L09CE,x
sta L09A8,x
dex
bpl L11DF
bpl loop
A2D_CALL $06, L09A8
rts
.endproc