mirror of
https://github.com/mi57730/a2d.git
synced 2025-01-21 02:34:03 +00:00
Eliminate some magic numbers
This commit is contained in:
parent
787f39a2d8
commit
2f2ae6827c
@ -46,11 +46,11 @@ A2D_BTN_CLICK := $43
|
||||
A2D_QUERY_CLIENT:= $48
|
||||
;; .word xcoord of query
|
||||
;; .word ycoord of query
|
||||
;; .byte part (0 = client, 1 = vscroll bar, 2 = hscroll bar)
|
||||
;; .byte part (0 = client, 1 = vscroll, 2 = hscroll)
|
||||
;; .byte scroll (1 = up/left, 2 = down/right, 3 = above/before, 4 = below/after, 5 = thumb)
|
||||
|
||||
A2D_SCROLL_THUMB_DRAG:= $4A
|
||||
;; .byte type (1 = vertical, 2 = horizontal)
|
||||
A2D_DRAG_SCROLL:= $4A
|
||||
;; .byte type (1 = vscroll, 2 = hscroll)
|
||||
;; .word xcoord of mouse
|
||||
;; .word ycoord of mouse
|
||||
;; .byte position (0...255)
|
||||
@ -60,6 +60,29 @@ A2D_UPDATE_SCROLL:= $4B
|
||||
;; .byte type (1 = vertical, 2 = horizontal)
|
||||
;; .byte pos (new position 0...250)
|
||||
|
||||
;;; Used in A2D_GET_MOUSE
|
||||
A2D_ELEM_CLIENT := 2
|
||||
A2D_ELEM_TITLE := 3
|
||||
A2D_ELEM_TBD := 4 ; ???
|
||||
A2D_ELEM_CLOSE := 5
|
||||
|
||||
;;; Used in A2D_QUERY_CLIENT, A2D_DRAG_SCROLL, A2D_UPDATE_SCROLL
|
||||
A2D_CLIENT := 0
|
||||
A2D_VSCROLL := 1
|
||||
A2D_HSCROLL := 2
|
||||
|
||||
;;; Used in A2D_QUERY_CLIENT
|
||||
A2D_SCROLL_PART_UP := 1
|
||||
A2D_SCROLL_PART_LEFT := 1
|
||||
A2D_SCROLL_PART_DOWN := 2
|
||||
A2D_SCROLL_PART_RIGHT := 2
|
||||
A2D_SCROLL_PART_ABOVE := 3
|
||||
A2D_SCROLL_PART_BEFORE := 3
|
||||
A2D_SCROLL_PART_BELOW := 4
|
||||
A2D_SCROLL_PART_AFTER := 4
|
||||
A2D_SCROLL_PART_THUMB := 5
|
||||
|
||||
|
||||
;;; Macros
|
||||
.macro A2D_CALL op, addr
|
||||
jsr A2D
|
||||
|
@ -123,11 +123,11 @@ Current file: stf.s
|
||||
000800 2 A2D_QUERY_CLIENT:= $48
|
||||
000800 2 ;; .word xcoord of query
|
||||
000800 2 ;; .word ycoord of query
|
||||
000800 2 ;; .byte part (0 = client, 1 = vscroll bar, 2 = hscroll bar)
|
||||
000800 2 ;; .byte part (0 = client, 1 = vscroll, 2 = hscroll)
|
||||
000800 2 ;; .byte scroll (1 = up/left, 2 = down/right, 3 = above/before, 4 = below/after, 5 = thumb)
|
||||
000800 2
|
||||
000800 2 A2D_SCROLL_THUMB_DRAG:= $4A
|
||||
000800 2 ;; .byte type (1 = vertical, 2 = horizontal)
|
||||
000800 2 A2D_DRAG_SCROLL:= $4A
|
||||
000800 2 ;; .byte type (1 = vscroll, 2 = hscroll)
|
||||
000800 2 ;; .word xcoord of mouse
|
||||
000800 2 ;; .word ycoord of mouse
|
||||
000800 2 ;; .byte position (0...255)
|
||||
@ -137,6 +137,29 @@ Current file: stf.s
|
||||
000800 2 ;; .byte type (1 = vertical, 2 = horizontal)
|
||||
000800 2 ;; .byte pos (new position 0...250)
|
||||
000800 2
|
||||
000800 2 ;;; Used in A2D_GET_MOUSE
|
||||
000800 2 A2D_ELEM_CLIENT := 2
|
||||
000800 2 A2D_ELEM_TITLE := 3
|
||||
000800 2 A2D_ELEM_TBD := 4 ; ???
|
||||
000800 2 A2D_ELEM_CLOSE := 5
|
||||
000800 2
|
||||
000800 2 ;;; Used in A2D_QUERY_CLIENT, A2D_DRAG_SCROLL, A2D_UPDATE_SCROLL
|
||||
000800 2 A2D_CLIENT := 0
|
||||
000800 2 A2D_VSCROLL := 1
|
||||
000800 2 A2D_HSCROLL := 2
|
||||
000800 2
|
||||
000800 2 ;;; Used in A2D_QUERY_CLIENT
|
||||
000800 2 A2D_SCROLL_PART_UP := 1
|
||||
000800 2 A2D_SCROLL_PART_LEFT := 1
|
||||
000800 2 A2D_SCROLL_PART_DOWN := 2
|
||||
000800 2 A2D_SCROLL_PART_RIGHT := 2
|
||||
000800 2 A2D_SCROLL_PART_ABOVE := 3
|
||||
000800 2 A2D_SCROLL_PART_BEFORE := 3
|
||||
000800 2 A2D_SCROLL_PART_BELOW := 4
|
||||
000800 2 A2D_SCROLL_PART_AFTER := 4
|
||||
000800 2 A2D_SCROLL_PART_THUMB := 5
|
||||
000800 2
|
||||
000800 2
|
||||
000800 2 ;;; Macros
|
||||
000800 2 .macro A2D_CALL op, addr
|
||||
000800 2 jsr A2D
|
||||
@ -297,10 +320,12 @@ Current file: stf.s
|
||||
0008EF 1 00 ref_num:.byte 0 ; ref_num
|
||||
0008F0 1 .endproc
|
||||
0008F0 1
|
||||
0008F0 1 default_buffer := $1200
|
||||
0008F0 1
|
||||
0008F0 1 .proc read_params
|
||||
0008F0 1 04 .byte 4 ; param_count
|
||||
0008F1 1 00 ref_num:.byte 0 ; ref_num
|
||||
0008F2 1 00 12 buffer: .addr $1200 ; data_buffer
|
||||
0008F2 1 00 12 buffer: .addr default_buffer ; data_buffer
|
||||
0008F4 1 00 01 .word $100 ; request_count
|
||||
0008F6 1 00 00 .word 0 ; trans_count
|
||||
0008F8 1 .endproc
|
||||
@ -605,12 +630,15 @@ Current file: stf.s
|
||||
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 mouse_data::win ; click target??
|
||||
000AE7 1 C9 64 cmp #window_id ; is in window??
|
||||
000AE4 1 AD 76 09 lda mouse_data::win ; in our window?
|
||||
000AE7 1 C9 64 cmp #window_id
|
||||
000AE9 1 D0 E6 bne input_loop
|
||||
000AEB 1 AD 75 09 lda mouse_data::elem ; which UI element?
|
||||
000AEE 1 C9 05 cmp #$05 ; 5 = close btn
|
||||
000AEB 1
|
||||
000AEB 1 ;; which part of the window?
|
||||
000AEB 1 AD 75 09 lda mouse_data::elem
|
||||
000AEE 1 C9 05 cmp #A2D_ELEM_CLOSE
|
||||
000AF0 1 F0 2F beq on_close_btn_down
|
||||
000AF2 1
|
||||
000AF2 1 AE 71 09 ldx mouse_data::xcoord ; stash mouse location
|
||||
000AF5 1 8E 78 09 stx xcoord1
|
||||
000AF8 1 8E 80 09 stx query_client_params::xcoord
|
||||
@ -620,14 +648,15 @@ Current file: stf.s
|
||||
000B04 1 AE 73 09 ldx mouse_data::ycoord
|
||||
000B07 1 8E 7A 09 stx ycoord1
|
||||
000B0A 1 8E 82 09 stx query_client_params::ycoord
|
||||
000B0D 1 C9 03 cmp #$03 ; 3 = title bar
|
||||
000B0F 1 F0 0A beq :+
|
||||
000B11 1 C9 04 cmp #$04 ; 4 = ???
|
||||
000B0D 1
|
||||
000B0D 1 C9 03 cmp #A2D_ELEM_TITLE
|
||||
000B0F 1 F0 0A beq title
|
||||
000B11 1 C9 04 cmp #A2D_ELEM_TBD ; ???
|
||||
000B13 1 F0 BC beq input_loop
|
||||
000B15 1 20 B4 0B jsr on_client_click
|
||||
000B18 1 4C D1 0A jmp input_loop
|
||||
000B1B 1
|
||||
000B1B 1 20 3A 11 : jsr on_title_bar_click
|
||||
000B1B 1 20 3A 11 title: jsr on_title_bar_click
|
||||
000B1E 1 4C D1 0A jmp input_loop
|
||||
000B21 1
|
||||
000B21 1 .proc on_close_btn_down
|
||||
@ -701,35 +730,35 @@ Current file: stf.s
|
||||
000BB4 1 20 00 40 48 A2D_CALL A2D_QUERY_CLIENT, query_client_params
|
||||
000BB8 1 80 09
|
||||
000BBA 1 AD 84 09 lda query_client_params::part
|
||||
000BBD 1 C9 01 cmp #1 ; 1 = vertical scroll bar
|
||||
000BBD 1 C9 01 cmp #A2D_VSCROLL
|
||||
000BBF 1 F0 08 beq on_vscroll_click
|
||||
000BC1 1 C9 02 cmp #2 ; 2 = horizontal scroll bar ???
|
||||
000BC3 1 D0 03 bne end ; 0 = client area
|
||||
000BC1 1 C9 02 cmp #A2D_HSCROLL
|
||||
000BC3 1 D0 03 bne end
|
||||
000BC5 1 4C 95 0C jmp on_hscroll_click
|
||||
000BC8 1 60 end: rts
|
||||
000BC9 1 .endproc
|
||||
000BC9 1
|
||||
000BC9 1 .proc on_vscroll_click
|
||||
000BC9 1 A9 01 L0BC9: lda #1 ; 1 = vertical
|
||||
000BC9 1 A9 01 L0BC9: lda #A2D_VSCROLL
|
||||
000BCB 1 8D 8A 09 sta thumb_drag_params::type
|
||||
000BCE 1 8D 88 09 sta update_scroll_params::type
|
||||
000BD1 1 AD 85 09 lda query_client_params::scroll
|
||||
000BD4 1 C9 05 cmp #5
|
||||
000BD4 1 C9 05 cmp #A2D_SCROLL_PART_THUMB
|
||||
000BD6 1 F0 14 beq on_vscroll_thumb_click
|
||||
000BD8 1 C9 04 cmp #4
|
||||
000BD8 1 C9 04 cmp #A2D_SCROLL_PART_BELOW
|
||||
000BDA 1 F0 62 beq on_vscroll_below_click
|
||||
000BDC 1 C9 03 cmp #3
|
||||
000BDC 1 C9 03 cmp #A2D_SCROLL_PART_ABOVE
|
||||
000BDE 1 F0 31 beq on_vscroll_above_click
|
||||
000BE0 1 C9 01 cmp #1
|
||||
000BE0 1 C9 01 cmp #A2D_SCROLL_PART_UP
|
||||
000BE2 1 F0 49 beq on_vscroll_up_click
|
||||
000BE4 1 C9 02 cmp #2
|
||||
000BE4 1 C9 02 cmp #A2D_SCROLL_PART_DOWN
|
||||
000BE6 1 D0 03 bne end
|
||||
000BE8 1 4C 60 0C jmp on_vscroll_down_click
|
||||
000BEB 1 60 end: rts
|
||||
000BEC 1 .endproc
|
||||
000BEC 1
|
||||
000BEC 1 .proc on_vscroll_thumb_click
|
||||
000BEC 1 20 39 0D jsr start_thumb_drag
|
||||
000BEC 1 20 39 0D jsr do_thumb_drag
|
||||
000BEF 1 AD 90 09 lda thumb_drag_params::moved
|
||||
000BF2 1 F0 1C beq end
|
||||
000BF4 1 AD 8F 09 lda thumb_drag_params::pos
|
||||
@ -829,25 +858,25 @@ Current file: stf.s
|
||||
000C95 1
|
||||
000C95 1 ;;; Unused in STF DA, so most of this is speculation
|
||||
000C95 1 .proc on_hscroll_click
|
||||
000C95 1 A9 02 lda #2
|
||||
000C95 1 A9 02 lda #A2D_HSCROLL
|
||||
000C97 1 8D 8A 09 sta thumb_drag_params::type
|
||||
000C9A 1 8D 88 09 sta update_scroll_params::type
|
||||
000C9D 1 AD 85 09 lda query_client_params::scroll
|
||||
000CA0 1 C9 05 cmp #5
|
||||
000CA0 1 C9 05 cmp #A2D_SCROLL_PART_THUMB
|
||||
000CA2 1 F0 11 beq on_hscroll_thumb_click
|
||||
000CA4 1 C9 04 cmp #4
|
||||
000CA4 1 C9 04 cmp #A2D_SCROLL_PART_AFTER
|
||||
000CA6 1 F0 3F beq on_hscroll_after_click
|
||||
000CA8 1 C9 03 cmp #3
|
||||
000CA8 1 C9 03 cmp #A2D_SCROLL_PART_BEFORE
|
||||
000CAA 1 F0 43 beq on_hscroll_before_click
|
||||
000CAC 1 C9 01 cmp #1
|
||||
000CAC 1 C9 01 cmp #A2D_SCROLL_PART_LEFT
|
||||
000CAE 1 F0 4E beq on_hscroll_left_click
|
||||
000CB0 1 C9 02 cmp #2
|
||||
000CB0 1 C9 02 cmp #A2D_SCROLL_PART_RIGHT
|
||||
000CB2 1 F0 42 beq on_hscroll_right_click
|
||||
000CB4 1 60 rts
|
||||
000CB5 1 .endproc
|
||||
000CB5 1
|
||||
000CB5 1 .proc on_hscroll_thumb_click
|
||||
000CB5 1 20 39 0D jsr start_thumb_drag
|
||||
000CB5 1 20 39 0D jsr do_thumb_drag
|
||||
000CB8 1 AD 90 09 lda thumb_drag_params::moved
|
||||
000CBB 1 F0 29 beq end
|
||||
000CBD 1 AD 8F 09 lda thumb_drag_params::pos
|
||||
@ -924,14 +953,14 @@ Current file: stf.s
|
||||
000D39 1 .endproc
|
||||
000D39 1
|
||||
000D39 1 ;; Used at start of thumb drag
|
||||
000D39 1 .proc start_thumb_drag
|
||||
000D39 1 .proc do_thumb_drag
|
||||
000D39 1 AD 71 09 lda mouse_data::xcoord
|
||||
000D3C 1 8D 8B 09 sta thumb_drag_params::xcoord
|
||||
000D3F 1 AD 72 09 lda mouse_data::xcoord+1
|
||||
000D42 1 8D 8C 09 sta thumb_drag_params::xcoord+1
|
||||
000D45 1 AD 73 09 lda mouse_data::ycoord
|
||||
000D48 1 8D 8D 09 sta thumb_drag_params::ycoord
|
||||
000D4B 1 20 00 40 4A A2D_CALL A2D_SCROLL_THUMB_DRAG, thumb_drag_params
|
||||
000D4B 1 20 00 40 4A A2D_CALL A2D_DRAG_SCROLL, thumb_drag_params
|
||||
000D4F 1 8A 09
|
||||
000D51 1 60 rts
|
||||
000D52 1 .endproc
|
||||
@ -961,21 +990,24 @@ Current file: stf.s
|
||||
000D7B 1 60 rts
|
||||
000D7C 1 .endproc
|
||||
000D7C 1
|
||||
000D7C 1 A9 00 L0D7C: lda #0
|
||||
000D7C 1 .proc L0D7C ; ?? part of vscroll
|
||||
000D7C 1 A9 00 lda #0
|
||||
000D7E 1 8D B2 09 sta L09B2
|
||||
000D81 1 8D B3 09 sta L09B3
|
||||
000D84 1 AE 89 09 ldx update_scroll_params::pos
|
||||
000D87 1 F0 12 L0D87: beq L0D9B
|
||||
000D87 1 F0 12 loop: beq L0D9B
|
||||
000D89 1 18 clc
|
||||
000D8A 1 AD B2 09 lda L09B2
|
||||
000D8D 1 69 32 adc #50
|
||||
000D8F 1 8D B2 09 sta L09B2
|
||||
000D92 1 90 03 bcc L0D97
|
||||
000D92 1 90 03 bcc skip
|
||||
000D94 1 EE B3 09 inc L09B3
|
||||
000D97 1 CA L0D97: dex
|
||||
000D98 1 4C 87 0D jmp L0D87
|
||||
000D97 1 CA skip: dex
|
||||
000D98 1 4C 87 0D jmp loop
|
||||
000D9B 1 .endproc
|
||||
000D9B 1
|
||||
000D9B 1 18 L0D9B: clc
|
||||
000D9B 1 .proc L0D9B ; ?? part of vscroll
|
||||
000D9B 1 18 clc
|
||||
000D9C 1 AD B2 09 lda L09B2
|
||||
000D9F 1 6D 63 09 adc L0963
|
||||
000DA2 1 8D B6 09 sta L09B6
|
||||
@ -987,17 +1019,17 @@ Current file: stf.s
|
||||
000DB3 1 8D 6A 09 sta L096A
|
||||
000DB6 1 8D 6B 09 sta L096B
|
||||
000DB9 1 AE 89 09 ldx update_scroll_params::pos
|
||||
000DBC 1 F0 12 L0DBC: beq L0DD0
|
||||
000DBC 1 F0 12 loop: beq end
|
||||
000DBE 1 18 clc
|
||||
000DBF 1 AD 6A 09 lda L096A
|
||||
000DC2 1 69 05 adc #5
|
||||
000DC4 1 8D 6A 09 sta L096A
|
||||
000DC7 1 90 03 bcc L0DCC
|
||||
000DC7 1 90 03 bcc skip
|
||||
000DC9 1 EE 6B 09 inc L096B
|
||||
000DCC 1 CA L0DCC: dex
|
||||
000DCD 1 4C BC 0D jmp L0DBC
|
||||
000DD0 1
|
||||
000DD0 1 60 L0DD0: rts
|
||||
000DCC 1 CA skip: dex
|
||||
000DCD 1 4C BC 0D jmp loop
|
||||
000DD0 1 60 end: rts
|
||||
000DD1 1 .endproc
|
||||
000DD1 1
|
||||
000DD1 1 A9 02 L0DD1: lda #2
|
||||
000DD3 1 8D 88 09 sta update_scroll_params::type
|
||||
@ -1019,20 +1051,22 @@ Current file: stf.s
|
||||
000DF8 1 60 rts
|
||||
000DF9 1 .endproc
|
||||
000DF9 1
|
||||
000DF9 1 20 00 8E L0DF9: jsr UNKNOWN_CALL
|
||||
000DF9 1 .proc L0DF9 ; only called from dead code
|
||||
000DF9 1 20 00 8E jsr UNKNOWN_CALL
|
||||
000DFC 1 0C .byte $0C
|
||||
000DFD 1 00 00 .addr 0
|
||||
000DFF 1 20 00 40 04 A2D_CALL $04, L09A8
|
||||
000E03 1 A8 09
|
||||
000E05 1 AD 98 09 lda L0998
|
||||
000E08 1 6A ror a
|
||||
000E09 1 90 03 bcc L0E0E
|
||||
000E09 1 90 03 bcc skip
|
||||
000E0B 1 20 D1 0D jsr L0DD1
|
||||
000E0E 1 AD 9D 09 L0E0E: lda vscroll_pos
|
||||
000E0E 1 AD 9D 09 skip: lda vscroll_pos
|
||||
000E11 1 8D 89 09 sta update_scroll_params::pos
|
||||
000E14 1 20 ED 0D jsr update_vscroll
|
||||
000E17 1 20 30 0E jsr draw_content
|
||||
000E1A 1 4C D1 0A jmp input_loop
|
||||
000E1D 1 .endproc
|
||||
000E1D 1
|
||||
000E1D 1 20 00 40 08 L0E1D: A2D_CALL $08, L0952
|
||||
000E21 1 52 09
|
||||
@ -1044,14 +1078,14 @@ Current file: stf.s
|
||||
000E30 1
|
||||
000E30 1 ;;; Draw content ???
|
||||
000E30 1 .proc draw_content
|
||||
000E30 1 A9 00 lda #$00
|
||||
000E30 1 A9 00 lda #0
|
||||
000E32 1 8D 49 09 sta L0949
|
||||
000E35 1 20 29 11 jsr L1129
|
||||
000E38 1 20 9C 08 jsr set_file_mark
|
||||
000E3B 1 A9 00 lda #$00
|
||||
000E3B 1 A9 00 lda #<default_buffer
|
||||
000E3D 1 8D F2 08 sta read_params::buffer
|
||||
000E40 1 85 06 sta $06
|
||||
000E42 1 A9 12 lda #$12
|
||||
000E42 1 A9 12 lda #>default_buffer
|
||||
000E44 1 8D F3 08 sta read_params::buffer+1
|
||||
000E47 1 85 07 sta $07
|
||||
000E49 1 A9 00 lda #$00
|
||||
@ -1256,11 +1290,11 @@ Current file: stf.s
|
||||
00100B 1 60 L100B: rts
|
||||
00100C 1
|
||||
00100C 1 AD 92 09 L100C: lda text_string::addr+1
|
||||
00100F 1 C9 12 cmp #$12
|
||||
00100F 1 C9 12 cmp #$12 ; #>default_buffer?
|
||||
001011 1 F0 18 beq L102B
|
||||
001013 1 A0 00 ldy #$00
|
||||
001015 1 B9 00 13 L1015: lda $1300,y
|
||||
001018 1 99 00 12 sta $1200,y
|
||||
001018 1 99 00 12 sta default_buffer,y
|
||||
00101B 1 C8 iny
|
||||
00101C 1 D0 F7 bne L1015
|
||||
00101E 1 CE 92 09 dec text_string::addr+1
|
||||
@ -1272,7 +1306,7 @@ Current file: stf.s
|
||||
00102D 1 8D 45 09 sta L0945
|
||||
001030 1 20 3E 10 jsr L103E
|
||||
001033 1 AD F3 08 lda read_params::buffer+1
|
||||
001036 1 C9 12 cmp #$12
|
||||
001036 1 C9 12 cmp #$12 ; #>default_buffer?
|
||||
001038 1 D0 03 bne L103D
|
||||
00103A 1 EE F3 08 inc read_params::buffer+1
|
||||
00103D 1 60 L103D: rts
|
||||
@ -1286,7 +1320,7 @@ Current file: stf.s
|
||||
00104A 1 A9 20 lda #$20
|
||||
00104C 1 A2 00 ldx #$00
|
||||
00104E 1 8D 04 C0 sta RAMWRTOFF
|
||||
001051 1 9D 00 12 store: sta $1200,x ; self-modified
|
||||
001051 1 9D 00 12 store: sta default_buffer,x ; self-modified
|
||||
001054 1 E8 inx
|
||||
001055 1 D0 FA bne store
|
||||
001057 1 8D 05 C0 sta RAMWRTON
|
||||
|
Binary file not shown.
@ -145,10 +145,12 @@ params_start:
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.endproc
|
||||
|
||||
default_buffer := $1200
|
||||
|
||||
.proc read_params
|
||||
.byte 4 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
buffer: .addr $1200 ; data_buffer
|
||||
buffer: .addr default_buffer ; data_buffer
|
||||
.word $100 ; request_count
|
||||
.word 0 ; trans_count
|
||||
.endproc
|
||||
@ -432,12 +434,15 @@ input_loop:
|
||||
bne input_loop ; nope, keep waiting
|
||||
|
||||
A2D_CALL A2D_GET_MOUSE, mouse_data
|
||||
lda mouse_data::win ; click target??
|
||||
cmp #window_id ; is in window??
|
||||
lda mouse_data::win ; in our window?
|
||||
cmp #window_id
|
||||
bne input_loop
|
||||
lda mouse_data::elem ; which UI element?
|
||||
cmp #$05 ; 5 = close btn
|
||||
|
||||
;; which part of the window?
|
||||
lda mouse_data::elem
|
||||
cmp #A2D_ELEM_CLOSE
|
||||
beq on_close_btn_down
|
||||
|
||||
ldx mouse_data::xcoord ; stash mouse location
|
||||
stx xcoord1
|
||||
stx query_client_params::xcoord
|
||||
@ -447,14 +452,15 @@ input_loop:
|
||||
ldx mouse_data::ycoord
|
||||
stx ycoord1
|
||||
stx query_client_params::ycoord
|
||||
cmp #$03 ; 3 = title bar
|
||||
beq :+
|
||||
cmp #$04 ; 4 = ???
|
||||
|
||||
cmp #A2D_ELEM_TITLE
|
||||
beq title
|
||||
cmp #A2D_ELEM_TBD ; ???
|
||||
beq input_loop
|
||||
jsr on_client_click
|
||||
jmp input_loop
|
||||
|
||||
: jsr on_title_bar_click
|
||||
title: jsr on_title_bar_click
|
||||
jmp input_loop
|
||||
|
||||
.proc on_close_btn_down
|
||||
@ -523,35 +529,35 @@ L0B8B: sta L0998
|
||||
.proc on_client_click
|
||||
A2D_CALL A2D_QUERY_CLIENT, query_client_params
|
||||
lda query_client_params::part
|
||||
cmp #1 ; 1 = vertical scroll bar
|
||||
cmp #A2D_VSCROLL
|
||||
beq on_vscroll_click
|
||||
cmp #2 ; 2 = horizontal scroll bar ???
|
||||
bne end ; 0 = client area
|
||||
cmp #A2D_HSCROLL
|
||||
bne end
|
||||
jmp on_hscroll_click
|
||||
end: rts
|
||||
.endproc
|
||||
|
||||
.proc on_vscroll_click
|
||||
L0BC9: lda #1 ; 1 = vertical
|
||||
L0BC9: lda #A2D_VSCROLL
|
||||
sta thumb_drag_params::type
|
||||
sta update_scroll_params::type
|
||||
lda query_client_params::scroll
|
||||
cmp #5
|
||||
cmp #A2D_SCROLL_PART_THUMB
|
||||
beq on_vscroll_thumb_click
|
||||
cmp #4
|
||||
cmp #A2D_SCROLL_PART_BELOW
|
||||
beq on_vscroll_below_click
|
||||
cmp #3
|
||||
cmp #A2D_SCROLL_PART_ABOVE
|
||||
beq on_vscroll_above_click
|
||||
cmp #1
|
||||
cmp #A2D_SCROLL_PART_UP
|
||||
beq on_vscroll_up_click
|
||||
cmp #2
|
||||
cmp #A2D_SCROLL_PART_DOWN
|
||||
bne end
|
||||
jmp on_vscroll_down_click
|
||||
end: rts
|
||||
.endproc
|
||||
|
||||
.proc on_vscroll_thumb_click
|
||||
jsr start_thumb_drag
|
||||
jsr do_thumb_drag
|
||||
lda thumb_drag_params::moved
|
||||
beq end
|
||||
lda thumb_drag_params::pos
|
||||
@ -651,25 +657,25 @@ loop: inx
|
||||
|
||||
;;; Unused in STF DA, so most of this is speculation
|
||||
.proc on_hscroll_click
|
||||
lda #2
|
||||
lda #A2D_HSCROLL
|
||||
sta thumb_drag_params::type
|
||||
sta update_scroll_params::type
|
||||
lda query_client_params::scroll
|
||||
cmp #5
|
||||
cmp #A2D_SCROLL_PART_THUMB
|
||||
beq on_hscroll_thumb_click
|
||||
cmp #4
|
||||
cmp #A2D_SCROLL_PART_AFTER
|
||||
beq on_hscroll_after_click
|
||||
cmp #3
|
||||
cmp #A2D_SCROLL_PART_BEFORE
|
||||
beq on_hscroll_before_click
|
||||
cmp #1
|
||||
cmp #A2D_SCROLL_PART_LEFT
|
||||
beq on_hscroll_left_click
|
||||
cmp #2
|
||||
cmp #A2D_SCROLL_PART_RIGHT
|
||||
beq on_hscroll_right_click
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc on_hscroll_thumb_click
|
||||
jsr start_thumb_drag
|
||||
jsr do_thumb_drag
|
||||
lda thumb_drag_params::moved
|
||||
beq end
|
||||
lda thumb_drag_params::pos
|
||||
@ -746,14 +752,14 @@ store: sta L099B
|
||||
.endproc
|
||||
|
||||
;; Used at start of thumb drag
|
||||
.proc start_thumb_drag
|
||||
.proc do_thumb_drag
|
||||
lda mouse_data::xcoord
|
||||
sta thumb_drag_params::xcoord
|
||||
lda mouse_data::xcoord+1
|
||||
sta thumb_drag_params::xcoord+1
|
||||
lda mouse_data::ycoord
|
||||
sta thumb_drag_params::ycoord
|
||||
A2D_CALL A2D_SCROLL_THUMB_DRAG, thumb_drag_params
|
||||
A2D_CALL A2D_DRAG_SCROLL, thumb_drag_params
|
||||
rts
|
||||
.endproc
|
||||
|
||||
@ -781,21 +787,24 @@ store: sta L099B
|
||||
rts
|
||||
.endproc
|
||||
|
||||
L0D7C: lda #0
|
||||
.proc L0D7C ; ?? part of vscroll
|
||||
lda #0
|
||||
sta L09B2
|
||||
sta L09B3
|
||||
ldx update_scroll_params::pos
|
||||
L0D87: beq L0D9B
|
||||
loop: beq L0D9B
|
||||
clc
|
||||
lda L09B2
|
||||
adc #50
|
||||
sta L09B2
|
||||
bcc L0D97
|
||||
bcc skip
|
||||
inc L09B3
|
||||
L0D97: dex
|
||||
jmp L0D87
|
||||
skip: dex
|
||||
jmp loop
|
||||
.endproc
|
||||
|
||||
L0D9B: clc
|
||||
.proc L0D9B ; ?? part of vscroll
|
||||
clc
|
||||
lda L09B2
|
||||
adc L0963
|
||||
sta L09B6
|
||||
@ -807,17 +816,17 @@ L0D9B: clc
|
||||
sta L096A
|
||||
sta L096B
|
||||
ldx update_scroll_params::pos
|
||||
L0DBC: beq L0DD0
|
||||
loop: beq end
|
||||
clc
|
||||
lda L096A
|
||||
adc #5
|
||||
sta L096A
|
||||
bcc L0DCC
|
||||
bcc skip
|
||||
inc L096B
|
||||
L0DCC: dex
|
||||
jmp L0DBC
|
||||
|
||||
L0DD0: rts
|
||||
skip: dex
|
||||
jmp loop
|
||||
end: rts
|
||||
.endproc
|
||||
|
||||
L0DD1: lda #2
|
||||
sta update_scroll_params::type
|
||||
@ -837,19 +846,21 @@ L0DD1: lda #2
|
||||
rts
|
||||
.endproc
|
||||
|
||||
L0DF9: jsr UNKNOWN_CALL
|
||||
.proc L0DF9 ; only called from dead code
|
||||
jsr UNKNOWN_CALL
|
||||
.byte $0C
|
||||
.addr 0
|
||||
A2D_CALL $04, L09A8
|
||||
lda L0998
|
||||
ror a
|
||||
bcc L0E0E
|
||||
bcc skip
|
||||
jsr L0DD1
|
||||
L0E0E: lda vscroll_pos
|
||||
skip: lda vscroll_pos
|
||||
sta update_scroll_params::pos
|
||||
jsr update_vscroll
|
||||
jsr draw_content
|
||||
jmp input_loop
|
||||
.endproc
|
||||
|
||||
L0E1D: A2D_CALL $08, L0952
|
||||
A2D_CALL $11, L09B0
|
||||
@ -858,14 +869,14 @@ L0E1D: A2D_CALL $08, L0952
|
||||
|
||||
;;; Draw content ???
|
||||
.proc draw_content
|
||||
lda #$00
|
||||
lda #0
|
||||
sta L0949
|
||||
jsr L1129
|
||||
jsr set_file_mark
|
||||
lda #$00
|
||||
lda #<default_buffer
|
||||
sta read_params::buffer
|
||||
sta $06
|
||||
lda #$12
|
||||
lda #>default_buffer
|
||||
sta read_params::buffer+1
|
||||
sta $07
|
||||
lda #$00
|
||||
@ -1068,11 +1079,11 @@ L1000: A2D_CALL A2D_DRAW_TEXT, text_string
|
||||
L100B: rts
|
||||
|
||||
L100C: lda text_string::addr+1
|
||||
cmp #$12
|
||||
cmp #$12 ; #>default_buffer?
|
||||
beq L102B
|
||||
ldy #$00
|
||||
L1015: lda $1300,y
|
||||
sta $1200,y
|
||||
sta default_buffer,y
|
||||
iny
|
||||
bne L1015
|
||||
dec text_string::addr+1
|
||||
@ -1084,7 +1095,7 @@ L102B: lda #$00
|
||||
sta L0945
|
||||
jsr L103E
|
||||
lda read_params::buffer+1
|
||||
cmp #$12
|
||||
cmp #$12 ; #>default_buffer?
|
||||
bne L103D
|
||||
inc read_params::buffer+1
|
||||
L103D: rts
|
||||
@ -1098,7 +1109,7 @@ L103E:
|
||||
lda #$20
|
||||
ldx #$00
|
||||
sta RAMWRTOFF
|
||||
store: sta $1200,x ; self-modified
|
||||
store: sta default_buffer,x ; self-modified
|
||||
inx
|
||||
bne store
|
||||
sta RAMWRTON
|
||||
|
Loading…
x
Reference in New Issue
Block a user