a2d/desk.acc/show.text.file/stf.s

1327 lines
31 KiB
ArmAsm
Raw Normal View History

2017-08-29 03:58:09 +00:00
.setcpu "65C02"
.org $800
.include "prodos.inc"
.include "auxmem.inc"
.include "a2d.inc"
2017-09-01 05:53:07 +00:00
zp_code_stash := $0020 ; Scratch space used for "call 1000 main" trampoline
2017-08-29 03:58:09 +00:00
start: jmp copy2aux
2017-09-01 05:53:07 +00:00
save_stack:.byte 0
;;; Copy $800 through $13FF (the DA) to aux
2017-08-30 02:07:44 +00:00
.proc copy2aux
2017-08-29 03:58:09 +00:00
tsx
2017-09-01 05:53:07 +00:00
stx save_stack
2017-08-29 03:58:09 +00:00
sta RAMWRTON
2017-09-01 05:53:07 +00:00
ldy #0
src: lda start,y ; self-modified
dst: sta start,y ; self-modified
2017-08-29 03:58:09 +00:00
dey
2017-09-01 05:53:07 +00:00
bne src
2017-08-29 03:58:09 +00:00
sta RAMWRTOFF
2017-09-01 05:53:07 +00:00
inc src+2
inc dst+2
2017-08-29 03:58:09 +00:00
sta RAMWRTON
2017-09-01 05:53:07 +00:00
lda dst+2
2017-08-29 03:58:09 +00:00
cmp #$14
2017-09-01 05:53:07 +00:00
bne src
2017-08-30 02:07:44 +00:00
.endproc
2017-09-01 05:53:07 +00:00
;;; Copy the following "call_1000_main" routine to $20
.scope
2017-08-29 03:58:09 +00:00
sta RAMWRTON
sta RAMRDON
2017-08-30 02:07:44 +00:00
ldx #(call_1000_main_end - call_1000_main)
2017-09-01 05:53:07 +00:00
loop: lda call_1000_main,x
2017-08-31 03:46:50 +00:00
sta zp_code_stash,x
2017-08-29 03:58:09 +00:00
dex
2017-09-01 05:53:07 +00:00
bpl loop
jmp call_init
.endscope
2017-08-29 03:58:09 +00:00
.proc call_1000_main
2017-08-30 02:07:44 +00:00
sta RAMRDOFF
2017-08-29 03:58:09 +00:00
sta RAMWRTOFF
jsr L1000
sta RAMRDON
sta RAMWRTON
rts
2017-08-30 02:07:44 +00:00
.endproc
call_1000_main_end:
2017-08-29 03:58:09 +00:00
2017-09-01 05:53:07 +00:00
.proc call_init
;; run the DA
jsr init
;; tear down/exit
2017-08-29 03:58:09 +00:00
sta ALTZPON
lda LCBANK1
lda LCBANK1
sta RAMRDOFF
sta RAMWRTOFF
2017-09-01 05:53:07 +00:00
ldx save_stack
2017-08-29 03:58:09 +00:00
txs
2017-09-01 05:53:07 +00:00
rts
.endproc
;;; ==================================================
;;; ProDOS MLI calls
2017-08-29 03:58:09 +00:00
.proc open_file
2017-08-30 01:47:15 +00:00
jsr copy_params_aux_to_main
2017-08-29 03:58:09 +00:00
sta ALTZPOFF
2017-08-29 15:40:35 +00:00
MLI_CALL OPEN, open_params
2017-08-29 03:58:09 +00:00
sta ALTZPON
2017-08-29 16:08:46 +00:00
jsr copy_params_main_to_aux
2017-08-29 03:58:09 +00:00
rts
2017-08-30 01:47:15 +00:00
.endproc
2017-08-29 03:58:09 +00:00
.proc read_file
2017-08-30 01:47:15 +00:00
jsr copy_params_aux_to_main
2017-08-29 03:58:09 +00:00
sta ALTZPOFF
2017-08-29 15:40:35 +00:00
MLI_CALL READ, read_params
2017-08-29 03:58:09 +00:00
sta ALTZPON
2017-08-29 16:08:46 +00:00
jsr copy_params_main_to_aux
2017-08-29 03:58:09 +00:00
rts
2017-08-30 01:47:15 +00:00
.endproc
2017-08-29 03:58:09 +00:00
.proc get_file_eof
2017-08-30 01:47:15 +00:00
jsr copy_params_aux_to_main
2017-08-29 03:58:09 +00:00
sta ALTZPOFF
2017-08-29 15:45:32 +00:00
MLI_CALL GET_EOF, get_eof_params
2017-08-29 03:58:09 +00:00
sta ALTZPON
2017-08-29 16:08:46 +00:00
jsr copy_params_main_to_aux
2017-08-29 03:58:09 +00:00
rts
2017-08-30 01:47:15 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-30 01:47:15 +00:00
.proc set_file_mark
jsr copy_params_aux_to_main
2017-08-29 03:58:09 +00:00
sta ALTZPOFF
2017-08-29 15:47:42 +00:00
MLI_CALL SET_MARK, set_mark_params
2017-08-29 03:58:09 +00:00
sta ALTZPON
2017-08-29 16:08:46 +00:00
jsr copy_params_main_to_aux
2017-08-29 03:58:09 +00:00
rts
2017-08-30 01:47:15 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-30 01:47:15 +00:00
.proc close_file
jsr copy_params_aux_to_main
2017-08-29 03:58:09 +00:00
sta ALTZPOFF
2017-08-29 15:45:32 +00:00
MLI_CALL CLOSE, close_params
2017-08-29 03:58:09 +00:00
sta ALTZPON
2017-08-29 16:08:46 +00:00
jsr copy_params_main_to_aux
2017-08-29 03:58:09 +00:00
rts
2017-08-30 01:47:15 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:53:07 +00:00
;;; ==================================================
2017-08-29 16:08:46 +00:00
;;; Copies param blocks from Aux to Main
.proc copy_params_aux_to_main
2017-08-29 16:08:46 +00:00
ldy #(params_end - params_start + 1)
2017-08-29 03:58:09 +00:00
sta RAMWRTOFF
2017-08-29 16:08:46 +00:00
loop: lda params_start - 1,y
sta params_start - 1,y
2017-08-29 03:58:09 +00:00
dey
2017-08-29 16:08:46 +00:00
bne loop
2017-08-29 03:58:09 +00:00
sta RAMRDOFF
rts
2017-08-29 16:08:46 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-29 16:08:46 +00:00
;;; Copies param blocks from Main to Aux
.proc copy_params_main_to_aux
2017-08-29 16:08:46 +00:00
pha
2017-08-29 03:58:09 +00:00
php
sta RAMWRTON
2017-08-29 16:08:46 +00:00
ldy #(params_end - params_start + 1)
loop: lda params_start - 1,y
sta params_start - 1,y
2017-08-29 03:58:09 +00:00
dey
2017-08-29 16:08:46 +00:00
bne loop
2017-08-29 03:58:09 +00:00
sta RAMRDON
plp
pla
2017-08-29 16:08:46 +00:00
rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-29 16:08:46 +00:00
;;; ----------------------------------------
params_start:
;;; This block gets copied between main/aux
2017-08-29 15:40:35 +00:00
2017-09-01 05:53:07 +00:00
;;; ProDOS MLI param blocks
.proc open_params
2017-08-29 15:45:32 +00:00
.byte 3 ; param_count
2017-09-01 01:38:49 +00:00
.addr pathname ; pathname
2017-08-29 15:40:35 +00:00
.addr $0C00 ; io_buffer
ref_num:.byte 0 ; ref_num
.endproc
2017-08-29 15:40:35 +00:00
2017-09-01 05:39:06 +00:00
default_buffer := $1200
.proc read_params
2017-08-29 15:45:32 +00:00
.byte 4 ; param_count
ref_num:.byte 0 ; ref_num
2017-09-01 05:39:06 +00:00
buffer: .addr default_buffer ; data_buffer
2017-08-29 15:40:35 +00:00
.word $100 ; request_count
.word 0 ; trans_count
.endproc
2017-08-29 15:40:35 +00:00
.proc get_eof_params
2017-08-29 15:45:32 +00:00
.byte 2 ; param_count
ref_num:.byte 0 ; ref_num
2017-08-29 15:47:42 +00:00
.byte 0,0,0 ; EOF (lo, mid, hi)
.endproc
2017-08-29 15:40:35 +00:00
.proc set_mark_params
2017-08-29 15:47:42 +00:00
.byte 2 ; param_count
ref_num:.byte 0 ; ref_num
2017-08-29 15:47:42 +00:00
.byte 0,0,0 ; position (lo, mid, hi)
.endproc
2017-08-29 15:45:32 +00:00
.proc close_params
2017-08-29 15:45:32 +00:00
.byte 1 ; param_count
ref_num:.byte 0 ; ref_num
.endproc
2017-08-29 16:08:46 +00:00
2017-09-01 05:12:02 +00:00
pathname: ; 1st byte is length, rest is full path
2017-09-01 01:38:49 +00:00
.byte $00,$00,$00,$00,$00,$00,$00,$00
2017-08-29 03:58:09 +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
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00
2017-09-01 01:38:49 +00:00
2017-08-29 03:58:09 +00:00
L0945: .byte $00
L0946: .byte $00
L0947: .byte $00
L0948: .byte $00
L0949: .byte $00
2017-08-29 16:08:46 +00:00
L094A: .byte $00,$00,$00,$00
params_end:
;;; ----------------------------------------
.byte $00,$00,$00,$00
2017-08-29 03:58:09 +00:00
L0952: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
L095A: .byte $00
L095B: .byte $FA
L095C: .byte $01
L095D: .byte $00
L095E: .byte $00
L095F: .byte $00
L0960: .byte $00
L0961: .byte $00
L0962: .byte $00
L0963: .byte $00
L0964: .byte $00
L0965: .byte $00
L0966: .byte $00,$00
L0968: .byte $00
L0969: .byte $00
L096A: .byte $00
L096B: .byte $00
L096C: .byte $00
L096D: .byte $00
2017-08-31 04:13:25 +00:00
track_scroll_delta:
.byte $00
fixed_mode_flag:
.byte $00 ; 0 = proportional, otherwise = fixed
button_state:
.byte $00
2017-08-31 04:04:16 +00:00
.proc mouse_data ; queried by main input loop
2017-08-31 03:30:46 +00:00
xcoord: .word 0
ycoord: .word 0
2017-08-31 04:04:16 +00:00
elem: .byte 0
win: .byte 0
.endproc
2017-08-31 04:04:16 +00:00
;;; Possibly unused
2017-09-01 02:05:41 +00:00
L0977: .byte $64 ; ??? window id again?
2017-08-31 03:30:46 +00:00
xcoord1:.word 0 ; ???
ycoord1:.word 0 ; ???
.byte 0 ; ???
2017-08-31 04:04:16 +00:00
.proc close_btn ; queried after close clicked to see if aborted/finished
state: .byte 0 ; 0 = aborted, 1 = clicked
2017-08-31 03:30:46 +00:00
.byte 0,0
.endproc
2017-08-31 15:10:51 +00:00
.proc query_client_params ; queried after a client click to identify target
2017-08-31 03:30:46 +00:00
xcoord: .word 0
ycoord: .word 0
part: .byte 0 ; 0 = client, 1 = scroll bar, 2 = ?????
scroll: .byte 0 ; 1 = up, 2 = down, 3 = above, 4 = below, 5 = thumb
.endproc
2017-08-29 03:58:09 +00:00
L0986: .byte $00
L0987: .byte $00
2017-08-31 15:10:51 +00:00
.proc update_scroll_params ; called to update scroll bar position
type: .byte $00 ; 1 = vertical, 2 = horizontal ?
pos: .byte $00 ; new position (0...250)
.endproc
2017-08-31 05:13:41 +00:00
;;; Used when dragging vscroll thumb
2017-08-31 05:22:04 +00:00
.proc thumb_drag_params
2017-08-31 05:13:41 +00:00
type: .byte 0 ; vscroll = 1, hscroll = 2 ??
xcoord: .word 0
ycoord: .word 0
2017-09-01 05:12:02 +00:00
pos: .byte 0 ; position (0...255)
moved: .byte 0 ; 0 if not moved, 1 if moved
2017-08-31 05:13:41 +00:00
.endproc
2017-08-30 01:52:56 +00:00
2017-09-01 05:12:02 +00:00
.proc text_string
addr: .addr 0 ; address
len: .byte 0 ; length
.endproc
2017-08-30 01:52:56 +00:00
2017-09-01 02:05:41 +00:00
window_id := $64
.proc window_params
id: .byte window_id ; window identifier
unk: .byte 2 ; unknown - window flags?
.endproc
2017-08-29 03:58:09 +00:00
L0996: .byte $00
L0997: .byte $10
L0998: .byte $00,$C1
L099A: .byte $20
L099B: .byte $00,$FF
2017-08-31 03:41:54 +00:00
vscroll_pos:
.byte 0
2017-09-01 05:12:02 +00:00
.byte $00,$00,$C8,$00,$33,$00,$00 ; ???
.byte $02,$96,$00 ; ???
L09A8: .byte $0A ; start of block for an A2D call ($04, $06)
2017-08-29 03:58:09 +00:00
L09A9: .byte $00
L09AA: .byte $1C,$00,$00,$20,$80,$00
L09B0: .byte $00
L09B1: .byte $00
L09B2: .byte $00
L09B3: .byte $00
L09B4: .byte $00
L09B5: .byte $02
L09B6: .byte $96
L09B7: .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$FF,$00,$00,$00,$00,$00,$01
.byte $01,$00,$7F,$00,$88,$00,$00
L09CE: .byte $0A,$00,$1C,$00,$00,$20,$80,$00
.byte $00,$00,$00,$00,$00,$02,$96,$00
2017-08-29 16:08:46 +00:00
2017-09-01 05:53:07 +00:00
.proc init
2017-08-29 03:58:09 +00:00
L09DE: sta ALTZPON
lda LCBANK1
lda LCBANK1
lda #$00
2017-09-01 01:38:49 +00:00
sta pathname
2017-08-29 03:58:09 +00:00
lda $DF21
beq L09F6
lda $DF20
bne L09F7
L09F6: rts
L09F7: asl a
tax
lda $DFB3,x
sta $06
lda $DFB4,x
sta $07
ldy #$00
lda ($06),y
tax
inc $06
bne L0A0E
inc $07
L0A0E: lda #$05
sta $08
lda #$09
sta $09
jsr L0A72
lda #$2F
ldy #$00
sta ($08),y
2017-09-01 05:12:02 +00:00
inc pathname ; ???
2017-08-29 03:58:09 +00:00
inc $08
bne L0A28
inc $09
L0A28: lda $DF22
asl a
tax
lda $DD9F,x
sta $06
lda $DDA0,x
sta $07
ldy #$02
lda ($06),y
and #$70
bne L0A40
rts
L0A40: clc
lda $06
adc #$09
sta L0996
lda $07
adc #$00
sta L0997
ldy #$09
lda ($06),y
tax
dex
dex
clc
lda $06
adc #$0B
sta $06
bcc L0A61
inc $07
L0A61: jsr L0A72
lda #$1E
sta $27
lda #$40
sta $28
2017-08-31 03:46:50 +00:00
jsr zp_code_stash
2017-09-01 05:12:02 +00:00
jmp open_file_and_init_window
2017-09-01 05:53:07 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc L0A72 ; ???
ldy #$00
loop: lda ($06),y
2017-08-29 03:58:09 +00:00
sta ($08),y
iny
2017-09-01 05:12:02 +00:00
inc pathname ; ???
2017-08-29 03:58:09 +00:00
dex
2017-09-01 05:12:02 +00:00
bne loop
2017-08-29 03:58:09 +00:00
tya
clc
adc $08
sta $08
2017-09-01 05:12:02 +00:00
bcc end
2017-08-29 03:58:09 +00:00
inc $09
2017-09-01 05:12:02 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc open_file_and_init_window
lda #0
sta fixed_mode_flag
2017-09-01 05:12:02 +00:00
;; copy bytes (length at $8801) from $8802 to $10FF ???
2017-08-29 03:58:09 +00:00
ldx $8801
sta RAMWRTOFF
2017-09-01 05:12:02 +00:00
loop: lda $8802,x
2017-08-29 03:58:09 +00:00
sta L10FF,x
dex
2017-09-01 05:12:02 +00:00
bne loop
2017-08-29 03:58:09 +00:00
sta RAMWRTON
2017-09-01 05:12:02 +00:00
;; open file, get length
2017-08-30 01:47:15 +00:00
jsr open_file
lda open_params::ref_num
sta read_params::ref_num
sta set_mark_params::ref_num
sta get_eof_params::ref_num
sta close_params::ref_num
2017-08-30 01:47:15 +00:00
jsr get_file_eof
2017-09-01 05:12:02 +00:00
;; create window
2017-09-01 02:05:41 +00:00
A2D_CALL A2D_CREATE_WINDOW, window_params
2017-09-01 05:12:02 +00:00
A2D_CALL $04, L09A8 ; ???
2017-08-29 03:58:09 +00:00
jsr L1088
jsr calc_and_draw_mode
2017-09-01 01:38:49 +00:00
jsr draw_content
2017-08-31 03:46:50 +00:00
A2D_CALL $2B, 0
2017-09-01 05:12:02 +00:00
.endproc
input_loop:
A2D_CALL A2D_GET_BUTTON, button_state
lda button_state
2017-09-01 02:05:41 +00:00
cmp #1 ; was clicked?
bne input_loop ; nope, keep waiting
A2D_CALL A2D_GET_MOUSE, mouse_data
2017-09-01 05:39:06 +00:00
lda mouse_data::win ; in our window?
cmp #window_id
bne input_loop
2017-09-01 05:39:06 +00:00
;; which part of the window?
lda mouse_data::elem
cmp #A2D_ELEM_CLOSE
2017-08-30 14:38:59 +00:00
beq on_close_btn_down
2017-09-01 05:39:06 +00:00
2017-08-31 03:30:46 +00:00
ldx mouse_data::xcoord ; stash mouse location
stx xcoord1
stx query_client_params::xcoord
ldx mouse_data::xcoord+1
2017-08-31 03:30:46 +00:00
stx xcoord1+1
stx query_client_params::xcoord+1
ldx mouse_data::ycoord
2017-08-31 03:30:46 +00:00
stx ycoord1
stx query_client_params::ycoord
2017-09-01 05:39:06 +00:00
cmp #A2D_ELEM_TITLE
beq title
cmp #A2D_ELEM_TBD ; ???
beq input_loop
2017-08-31 03:30:46 +00:00
jsr on_client_click
jmp input_loop
2017-08-29 03:58:09 +00:00
2017-09-01 05:39:06 +00:00
title: jsr on_title_bar_click
jmp input_loop
2017-08-29 03:58:09 +00:00
2017-08-30 14:38:59 +00:00
.proc on_close_btn_down
2017-08-31 03:30:46 +00:00
A2D_CALL A2D_BTN_CLICK, close_btn ; wait to see if the click completes
lda close_btn::state ; did click complete?
2017-08-30 06:47:18 +00:00
beq input_loop ; nope
2017-08-30 01:47:15 +00:00
jsr close_file
2017-09-01 02:05:41 +00:00
A2D_CALL A2D_DESTROY_WINDOW, window_params
2017-08-30 06:47:18 +00:00
jsr UNKNOWN_CALL ; hides the cursor?
2017-08-29 03:58:09 +00:00
.byte $0C
2017-08-31 03:46:50 +00:00
.addr 0
2017-08-30 06:47:18 +00:00
rts ; exits input loop
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 03:30:46 +00:00
;;; How would control get here???? Dead code???
.proc maybe_dead_code
2017-08-29 03:58:09 +00:00
A2D_CALL $45, L0977
jsr L10FD
jsr L1088
lda #$02
cmp L09B5
bne L0B54
lda #$00
cmp L09B4
L0B54: bcs L0B73
lda #$00
sta L09B4
lda #$02
sta L09B5
sec
lda L09B4
sbc L0961
sta L09B0
lda L09B5
sbc L0962
sta L09B1
L0B73: lda L0998
ldx L0961
cpx #$00
bne L0B89
ldx L0962
cpx #$02
bne L0B89
and #$FE
jmp L0B8B
L0B89: ora #$01
L0B8B: sta L0998
sec
lda #$00
sbc L0961
sta $06
lda #$02
sbc L0962
sta $07
jsr L10DF
sta L0987
lda #$02
sta L0986
A2D_CALL $49, L0986
jsr calc_and_draw_mode
2017-08-29 03:58:09 +00:00
jmp L0DF9
2017-08-31 03:30:46 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 04:04:16 +00:00
;;; Non-title (client) area clicked
2017-08-31 03:30:46 +00:00
.proc on_client_click
A2D_CALL A2D_QUERY_CLIENT, query_client_params
lda query_client_params::part
2017-09-01 05:39:06 +00:00
cmp #A2D_VSCROLL
2017-08-31 03:41:54 +00:00
beq on_vscroll_click
2017-09-01 05:39:06 +00:00
cmp #A2D_HSCROLL
bne end
2017-09-01 05:12:02 +00:00
jmp on_hscroll_click
2017-08-31 03:41:54 +00:00
end: rts
2017-08-31 03:30:46 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 03:41:54 +00:00
.proc on_vscroll_click
2017-09-01 05:39:06 +00:00
L0BC9: lda #A2D_VSCROLL
2017-08-31 05:22:04 +00:00
sta thumb_drag_params::type
2017-08-31 15:10:51 +00:00
sta update_scroll_params::type
2017-08-31 03:30:46 +00:00
lda query_client_params::scroll
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_THUMB
2017-08-31 03:41:54 +00:00
beq on_vscroll_thumb_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_BELOW
2017-08-31 03:41:54 +00:00
beq on_vscroll_below_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_ABOVE
2017-08-31 03:41:54 +00:00
beq on_vscroll_above_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_UP
2017-08-31 03:41:54 +00:00
beq on_vscroll_up_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_DOWN
2017-08-31 03:30:46 +00:00
bne end
2017-08-31 03:41:54 +00:00
jmp on_vscroll_down_click
end: rts
2017-08-31 03:30:46 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 03:41:54 +00:00
.proc on_vscroll_thumb_click
2017-09-01 05:39:06 +00:00
jsr do_thumb_drag
2017-09-01 05:12:02 +00:00
lda thumb_drag_params::moved
2017-08-31 03:41:54 +00:00
beq end
2017-09-01 05:12:02 +00:00
lda thumb_drag_params::pos
2017-08-31 15:10:51 +00:00
sta update_scroll_params::pos
2017-08-29 03:58:09 +00:00
jsr L0D7C
2017-08-31 15:17:06 +00:00
jsr update_vscroll
2017-09-01 01:38:49 +00:00
jsr draw_content
2017-08-29 03:58:09 +00:00
lda L0947
2017-08-31 03:41:54 +00:00
beq end
2017-08-29 03:58:09 +00:00
lda L0949
2017-08-31 03:41:54 +00:00
bne end
2017-08-29 03:58:09 +00:00
jsr L0E1D
2017-08-31 03:41:54 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 03:41:54 +00:00
.proc on_vscroll_above_click
loop: lda vscroll_pos
beq end
2017-08-31 04:13:25 +00:00
jsr calc_track_scroll_delta
2017-08-29 03:58:09 +00:00
sec
2017-08-31 03:41:54 +00:00
lda vscroll_pos
2017-08-31 04:13:25 +00:00
sbc track_scroll_delta
2017-08-31 15:17:06 +00:00
bcs store
lda #$00 ; underflow
store: sta update_scroll_params::pos
2017-08-31 04:04:16 +00:00
jsr update_scroll_pos
bcc loop ; repeat while button down
2017-08-31 03:41:54 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 03:41:54 +00:00
.proc on_vscroll_up_click
loop : lda vscroll_pos
beq end
2017-08-29 03:58:09 +00:00
sec
2017-08-31 04:04:16 +00:00
sbc #1
2017-08-31 15:10:51 +00:00
sta update_scroll_params::pos
2017-08-31 04:04:16 +00:00
jsr update_scroll_pos
bcc loop ; repeat while button down
2017-08-31 03:41:54 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 04:04:16 +00:00
vscroll_max := $FA
2017-08-31 03:41:54 +00:00
.proc on_vscroll_below_click
loop: lda vscroll_pos
2017-08-31 04:04:16 +00:00
cmp #vscroll_max ; pos == max ?
2017-08-31 03:41:54 +00:00
beq end
2017-08-31 04:13:25 +00:00
jsr calc_track_scroll_delta
2017-08-29 03:58:09 +00:00
clc
2017-08-31 03:41:54 +00:00
lda vscroll_pos
2017-08-31 04:13:25 +00:00
adc track_scroll_delta ; pos + delta
2017-08-31 04:04:16 +00:00
bcs overflow
cmp #vscroll_max+1 ; > max ?
bcc store ; nope, it's good
overflow:
lda #vscroll_max ; set to max
2017-08-31 15:10:51 +00:00
store: sta update_scroll_params::pos
2017-08-31 04:04:16 +00:00
jsr update_scroll_pos
bcc loop ; repeat while button down
2017-08-31 03:41:54 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 03:41:54 +00:00
.proc on_vscroll_down_click
loop: lda vscroll_pos
2017-08-31 04:04:16 +00:00
cmp #vscroll_max
2017-08-31 03:41:54 +00:00
beq end
2017-08-29 03:58:09 +00:00
clc
2017-08-31 04:04:16 +00:00
adc #1
2017-08-31 15:10:51 +00:00
sta update_scroll_params::pos
2017-08-31 04:04:16 +00:00
jsr update_scroll_pos
bcc loop ; repeat while button down
2017-08-31 03:41:54 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 04:13:25 +00:00
.proc update_scroll_pos ; Returns with carry set if mouse released
2017-08-31 04:04:16 +00:00
jsr L0D7C
2017-08-31 15:17:06 +00:00
jsr update_vscroll
2017-09-01 01:38:49 +00:00
jsr draw_content
2017-08-31 04:04:16 +00:00
jsr was_button_released
2017-08-29 03:58:09 +00:00
clc
2017-08-31 04:04:16 +00:00
bne end
2017-08-29 03:58:09 +00:00
sec
2017-08-31 04:04:16 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 04:13:25 +00:00
.proc calc_track_scroll_delta
lda L0963 ; ceil(??? / 50)
ldx #0
loop: inx
2017-08-29 03:58:09 +00:00
sec
2017-08-31 04:13:25 +00:00
sbc #50
cmp #50
bcs loop
stx track_scroll_delta
2017-08-29 03:58:09 +00:00
rts
2017-08-31 04:13:25 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
;;; Unused in STF DA, so most of this is speculation
.proc on_hscroll_click
2017-09-01 05:39:06 +00:00
lda #A2D_HSCROLL
2017-08-31 05:22:04 +00:00
sta thumb_drag_params::type
2017-08-31 15:10:51 +00:00
sta update_scroll_params::type
2017-08-31 03:30:46 +00:00
lda query_client_params::scroll
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_THUMB
2017-09-01 05:12:02 +00:00
beq on_hscroll_thumb_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_AFTER
2017-09-01 05:12:02 +00:00
beq on_hscroll_after_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_BEFORE
2017-09-01 05:12:02 +00:00
beq on_hscroll_before_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_LEFT
2017-09-01 05:12:02 +00:00
beq on_hscroll_left_click
2017-09-01 05:39:06 +00:00
cmp #A2D_SCROLL_PART_RIGHT
2017-09-01 05:12:02 +00:00
beq on_hscroll_right_click
2017-08-29 03:58:09 +00:00
rts
2017-09-01 05:12:02 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc on_hscroll_thumb_click
2017-09-01 05:39:06 +00:00
jsr do_thumb_drag
2017-09-01 05:12:02 +00:00
lda thumb_drag_params::moved
beq end
lda thumb_drag_params::pos
2017-08-29 03:58:09 +00:00
jsr L10EC
lda $06
sta L09B0
lda $07
sta L09B1
clc
lda L09B0
adc L0961
sta L09B4
lda L09B1
adc L0962
sta L09B5
jsr L0DD1
2017-09-01 01:38:49 +00:00
jsr draw_content
2017-09-01 05:12:02 +00:00
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc on_hscroll_after_click
ldx #2
2017-08-29 03:58:09 +00:00
lda L099A
2017-09-01 05:12:02 +00:00
jmp hscroll_common
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc on_hscroll_before_click
ldx #254
lda #0
jmp hscroll_common
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc on_hscroll_right_click
ldx #1
2017-08-29 03:58:09 +00:00
lda L099A
2017-09-01 05:12:02 +00:00
jmp hscroll_common
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
.proc on_hscroll_left_click
ldx #255
lda #0
;; fall through
.endproc
.proc hscroll_common
sta compare+1
stx delta+1
loop: lda L099B
compare:cmp #$0A ; self-modified
bne continue
2017-08-29 03:58:09 +00:00
rts
2017-09-01 05:12:02 +00:00
continue:
clc
2017-08-29 03:58:09 +00:00
lda L099B
2017-09-01 05:12:02 +00:00
delta: adc #1 ; self-modified
bmi overflow
2017-08-29 03:58:09 +00:00
cmp L099A
2017-09-01 05:12:02 +00:00
beq store
bcc store
2017-08-29 03:58:09 +00:00
lda L099A
2017-09-01 05:12:02 +00:00
jmp store
overflow:
lda #0
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
store: sta L099B
2017-08-29 03:58:09 +00:00
jsr L0D5E
jsr L0DD1
2017-09-01 01:38:49 +00:00
jsr draw_content
2017-08-31 04:04:16 +00:00
jsr was_button_released
2017-09-01 05:12:02 +00:00
bne loop
2017-08-29 03:58:09 +00:00
rts
2017-09-01 05:12:02 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 05:13:41 +00:00
;; Used at start of thumb drag
2017-09-01 05:39:06 +00:00
.proc do_thumb_drag
2017-08-31 05:22:04 +00:00
lda mouse_data::xcoord
sta thumb_drag_params::xcoord
lda mouse_data::xcoord+1
2017-08-31 05:22:04 +00:00
sta thumb_drag_params::xcoord+1
lda mouse_data::ycoord
2017-08-31 05:22:04 +00:00
sta thumb_drag_params::ycoord
2017-09-01 05:39:06 +00:00
A2D_CALL A2D_DRAG_SCROLL, thumb_drag_params
2017-08-29 03:58:09 +00:00
rts
2017-08-31 05:22:04 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 02:05:41 +00:00
;;; Checks button state; z clear if button was released, set otherwise
2017-08-31 04:04:16 +00:00
.proc was_button_released
A2D_CALL A2D_GET_BUTTON, button_state
lda button_state
2017-08-31 04:04:16 +00:00
cmp #2
2017-08-29 03:58:09 +00:00
rts
2017-08-31 04:04:16 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:12:02 +00:00
;;; only used from hscroll code?
.proc L0D5E
lda L099B
2017-08-29 03:58:09 +00:00
jsr L10EC
clc
lda $06
sta L09B0
adc L0961
sta L09B4
lda $07
sta L09B1
adc L0962
sta L09B5
rts
2017-09-01 05:12:02 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:39:06 +00:00
.proc L0D7C ; ?? part of vscroll
lda #0
2017-08-29 03:58:09 +00:00
sta L09B2
sta L09B3
2017-08-31 15:10:51 +00:00
ldx update_scroll_params::pos
2017-09-01 05:39:06 +00:00
loop: beq L0D9B
2017-08-29 03:58:09 +00:00
clc
lda L09B2
2017-08-31 15:17:06 +00:00
adc #50
2017-08-29 03:58:09 +00:00
sta L09B2
2017-09-01 05:39:06 +00:00
bcc skip
2017-08-29 03:58:09 +00:00
inc L09B3
2017-09-01 05:39:06 +00:00
skip: dex
jmp loop
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:39:06 +00:00
.proc L0D9B ; ?? part of vscroll
clc
2017-08-29 03:58:09 +00:00
lda L09B2
adc L0963
sta L09B6
lda L09B3
adc L0964
sta L09B7
jsr L10A5
2017-08-31 15:17:06 +00:00
lda #0
2017-08-29 03:58:09 +00:00
sta L096A
sta L096B
2017-08-31 15:10:51 +00:00
ldx update_scroll_params::pos
2017-09-01 05:39:06 +00:00
loop: beq end
2017-08-29 03:58:09 +00:00
clc
lda L096A
2017-08-31 15:17:06 +00:00
adc #5
2017-08-29 03:58:09 +00:00
sta L096A
2017-09-01 05:39:06 +00:00
bcc skip
2017-08-29 03:58:09 +00:00
inc L096B
2017-09-01 05:39:06 +00:00
skip: dex
jmp loop
end: rts
.endproc
2017-08-29 03:58:09 +00:00
2017-08-31 15:10:51 +00:00
L0DD1: lda #2
sta update_scroll_params::type
2017-08-29 03:58:09 +00:00
lda L09B0
sta $06
lda L09B1
sta $07
jsr L10DF
2017-08-31 15:10:51 +00:00
sta update_scroll_params::pos
A2D_CALL A2D_UPDATE_SCROLL, update_scroll_params
2017-08-29 03:58:09 +00:00
rts
2017-08-31 15:17:06 +00:00
.proc update_vscroll ; update_scroll_params::pos set by caller
lda #1
2017-08-31 15:10:51 +00:00
sta update_scroll_params::type
A2D_CALL A2D_UPDATE_SCROLL, update_scroll_params
2017-08-29 03:58:09 +00:00
rts
2017-08-31 15:17:06 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 05:39:06 +00:00
.proc L0DF9 ; only called from dead code
jsr UNKNOWN_CALL
2017-08-30 02:07:44 +00:00
.byte $0C
2017-08-31 03:46:50 +00:00
.addr 0
2017-08-29 03:58:09 +00:00
A2D_CALL $04, L09A8
lda L0998
ror a
2017-09-01 05:39:06 +00:00
bcc skip
2017-08-29 03:58:09 +00:00
jsr L0DD1
2017-09-01 05:39:06 +00:00
skip: lda vscroll_pos
2017-08-31 15:10:51 +00:00
sta update_scroll_params::pos
2017-08-31 15:17:06 +00:00
jsr update_vscroll
2017-09-01 01:38:49 +00:00
jsr draw_content
jmp input_loop
2017-09-01 05:39:06 +00:00
.endproc
2017-08-29 03:58:09 +00:00
L0E1D: A2D_CALL $08, L0952
A2D_CALL $11, L09B0
A2D_CALL $08, L094A
rts
2017-09-01 01:38:49 +00:00
;;; Draw content ???
.proc draw_content
2017-09-01 05:39:06 +00:00
lda #0
2017-08-29 03:58:09 +00:00
sta L0949
jsr L1129
2017-08-30 01:47:15 +00:00
jsr set_file_mark
2017-09-01 05:39:06 +00:00
lda #<default_buffer
2017-09-01 01:38:49 +00:00
sta read_params::buffer
2017-08-29 03:58:09 +00:00
sta $06
2017-09-01 05:39:06 +00:00
lda #>default_buffer
2017-09-01 01:38:49 +00:00
sta read_params::buffer+1
2017-08-29 03:58:09 +00:00
sta $07
lda #$00
sta L0945
sta L0946
sta L0947
sta L0960
sta L096C
sta L096D
sta L0948
lda #$0A
sta L095F
jsr L0EDB
L0E68: lda L096D
cmp L096B
bne L0E7E
lda L096C
cmp L096A
bne L0E7E
jsr L0E1D
inc L0948
L0E7E: A2D_CALL $0E, L095D
sec
lda #$FA
sbc L095D
sta L095B
lda #$01
sbc L095E
sta L095C
jsr L0EF3
bcs L0ED7
clc
2017-09-01 05:12:02 +00:00
lda text_string::len
2017-08-29 03:58:09 +00:00
adc $06
sta $06
bcc L0EA6
inc $07
L0EA6: lda L095A
bne L0E68
clc
lda L095F
adc #$0A
sta L095F
bcc L0EB9
inc L0960
L0EB9: jsr L0EDB
lda L096C
cmp L0968
bne L0ECC
lda L096D
cmp L0969
beq L0ED7
L0ECC: inc L096C
bne L0ED4
inc L096D
L0ED4: jmp L0E68
L0ED7: jsr L1109
rts
2017-09-01 01:38:49 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 01:38:49 +00:00
.proc L0EDB ; ???
lda #$FA
2017-08-29 03:58:09 +00:00
sta L095B
lda #$01
sta L095C
lda #$03
sta L095D
lda #$00
sta L095E
sta L095A
rts
2017-09-01 01:38:49 +00:00
.endproc
2017-08-29 03:58:09 +00:00
L0EF3: lda #$FF
sta L0F9B
lda #$00
sta L0F9C
sta L0F9D
sta L095A
2017-09-01 05:12:02 +00:00
sta text_string::len
2017-08-29 03:58:09 +00:00
lda $06
2017-09-01 05:12:02 +00:00
sta text_string::addr
2017-08-29 03:58:09 +00:00
lda $07
2017-09-01 05:12:02 +00:00
sta text_string::addr+1
2017-08-29 03:58:09 +00:00
L0F10: lda L0945
bne L0F22
lda L0947
beq L0F1F
jsr L0FF6
sec
rts
L0F1F: jsr L100C
2017-09-01 05:12:02 +00:00
L0F22: ldy text_string::len
2017-08-29 03:58:09 +00:00
lda ($06),y
2017-08-30 02:07:44 +00:00
and #$7F ; clear high bit
2017-08-29 03:58:09 +00:00
sta ($06),y
inc L0945
2017-08-30 02:07:44 +00:00
cmp #$0D ; return character
2017-08-29 03:58:09 +00:00
beq L0F86
2017-08-30 02:07:44 +00:00
cmp #$20 ; space character
2017-08-29 03:58:09 +00:00
bne L0F41
sty L0F9B
pha
lda L0945
sta L0946
pla
L0F41: cmp #$09
bne L0F48
jmp L0F9E
L0F48: tay
lda $8803,y
clc
adc L0F9C
sta L0F9C
bcc L0F58
inc L0F9D
L0F58: lda L095C
cmp L0F9D
bne L0F66
lda L095B
cmp L0F9C
L0F66: bcc L0F6E
2017-09-01 05:12:02 +00:00
inc text_string::len
2017-08-29 03:58:09 +00:00
jmp L0F10
L0F6E: lda #$00
sta L095A
lda L0F9B
cmp #$FF
beq L0F83
2017-09-01 05:12:02 +00:00
sta text_string::len
2017-08-29 03:58:09 +00:00
lda L0946
sta L0945
2017-09-01 05:12:02 +00:00
L0F83: inc text_string::len
2017-08-29 03:58:09 +00:00
L0F86: jsr L0FF6
2017-09-01 05:12:02 +00:00
ldy text_string::len
2017-08-29 03:58:09 +00:00
lda ($06),y
cmp #$09
beq L0F96
cmp #$0D
bne L0F99
2017-09-01 05:12:02 +00:00
L0F96: inc text_string::len
2017-08-29 03:58:09 +00:00
L0F99: clc
rts
2017-08-29 16:08:46 +00:00
L0F9B: .byte 0
L0F9C: .byte 0
L0F9D: .byte 0
2017-09-01 02:05:41 +00:00
.proc L0F9E ; ???
lda #1
2017-08-29 03:58:09 +00:00
sta L095A
clc
lda L0F9C
adc L095D
sta L095D
lda L0F9D
adc L095E
sta L095E
2017-09-01 02:05:41 +00:00
ldx #0
loop: lda times70+1,x
2017-08-29 03:58:09 +00:00
cmp L095E
bne L0FC6
2017-09-01 02:05:41 +00:00
lda times70,x
2017-08-29 03:58:09 +00:00
cmp L095D
L0FC6: bcs L0FD1
inx
inx
2017-09-01 02:05:41 +00:00
cpx #14
beq done
jmp loop
L0FD1: lda times70,x
2017-08-29 03:58:09 +00:00
sta L095D
2017-09-01 02:05:41 +00:00
lda times70+1,x
2017-08-29 03:58:09 +00:00
sta L095E
jmp L0F86
2017-09-01 02:05:41 +00:00
done: lda #0
2017-08-29 03:58:09 +00:00
sta L095A
jmp L0F86
2017-09-01 02:05:41 +00:00
times70:.word 70
.word 140
.word 210
.word 280
.word 350
.word 420
.word 490
.endproc
2017-09-01 05:12:02 +00:00
;;; Draws a line of content
2017-08-29 03:58:09 +00:00
L0FF6: lda L0948
beq L100B
2017-09-01 05:12:02 +00:00
lda text_string::len
2017-08-29 03:58:09 +00:00
beq L100B
2017-08-31 03:30:46 +00:00
L1000: A2D_CALL A2D_DRAW_TEXT, text_string
2017-09-01 05:53:07 +00:00
lda #1
2017-08-29 03:58:09 +00:00
sta L0949
L100B: rts
2017-09-01 05:12:02 +00:00
L100C: lda text_string::addr+1
2017-09-01 05:39:06 +00:00
cmp #$12 ; #>default_buffer?
2017-08-29 03:58:09 +00:00
beq L102B
ldy #$00
L1015: lda $1300,y
2017-09-01 05:39:06 +00:00
sta default_buffer,y
2017-08-29 03:58:09 +00:00
iny
bne L1015
2017-09-01 05:12:02 +00:00
dec text_string::addr+1
lda text_string::addr
2017-08-29 03:58:09 +00:00
sta $06
2017-09-01 05:12:02 +00:00
lda text_string::addr+1
2017-08-29 03:58:09 +00:00
sta $07
L102B: lda #$00
sta L0945
jsr L103E
2017-09-01 01:38:49 +00:00
lda read_params::buffer+1
2017-09-01 05:39:06 +00:00
cmp #$12 ; #>default_buffer?
2017-08-29 03:58:09 +00:00
bne L103D
2017-09-01 01:38:49 +00:00
inc read_params::buffer+1
2017-08-29 03:58:09 +00:00
L103D: rts
2017-08-30 02:07:44 +00:00
L103E:
.scope
2017-09-01 01:38:49 +00:00
lda read_params::buffer
2017-08-30 02:07:44 +00:00
sta store+1
2017-09-01 01:38:49 +00:00
lda read_params::buffer+1
2017-08-30 02:07:44 +00:00
sta store+2
2017-08-29 03:58:09 +00:00
lda #$20
ldx #$00
sta RAMWRTOFF
2017-09-01 05:39:06 +00:00
store: sta default_buffer,x ; self-modified
2017-08-29 03:58:09 +00:00
inx
2017-08-30 02:07:44 +00:00
bne store
2017-08-29 03:58:09 +00:00
sta RAMWRTON
lda #$00
sta L0947
2017-08-30 01:47:15 +00:00
jsr read_file
2017-08-29 03:58:09 +00:00
pha
lda #$00
2017-09-01 01:20:36 +00:00
sta STARTLO
sta DESTINATIONLO
2017-08-29 03:58:09 +00:00
lda #$FF
2017-09-01 01:20:36 +00:00
sta ENDLO
2017-09-01 01:38:49 +00:00
lda read_params::buffer+1
2017-09-01 01:20:36 +00:00
sta DESTINATIONHI
sta STARTHI
sta ENDHI
sec ; main>aux
2017-08-29 03:58:09 +00:00
jsr AUXMOVE
pla
2017-08-30 02:07:44 +00:00
beq end
2017-08-29 03:58:09 +00:00
cmp #$4C
2017-08-30 02:07:44 +00:00
beq done
brk ; ????
done: lda #$01
2017-08-29 03:58:09 +00:00
sta L0947
2017-08-30 02:07:44 +00:00
end: rts
.endscope
2017-08-29 03:58:09 +00:00
L1088: sec
lda L09B4
sbc L09B0
sta L0961
lda L09B5
sbc L09B1
sta L0962
sec
lda L09B6
sbc L09B2
sta L0963
L10A5: lda L09B6
sta L0965
lda L09B7
sta L0966
lda #$00
sta L0968
sta L0969
L10B9: lda L0966
bne L10C5
lda L0965
cmp #$0A
bcc L10DE
L10C5: sec
lda L0965
sbc #$0A
sta L0965
bcs L10D3
dec L0966
L10D3: inc L0968
bne L10B9
inc L0969
jmp L10B9
L10DE: rts
L10DF: ldx #$04
L10E1: clc
ror $07
ror $06
dex
bne L10E1
lda $06
rts
L10EC: sta $06
lda #$00
sta $07
ldx #$04
L10F4: clc
rol $06
rol $07
dex
bne L10F4
rts
L10FD: lda #$15
L10FF: sta $27
lda #$40
sta $28
2017-08-31 03:46:50 +00:00
jsr zp_code_stash
2017-08-29 03:58:09 +00:00
rts
2017-09-01 02:05:41 +00:00
;;; if fixed mode, do a main->aux copy of a code block ???
2017-09-01 01:38:49 +00:00
.proc L1109
lda fixed_mode_flag ; if not fixed (i.e. proportional)
2017-09-01 02:05:41 +00:00
beq end ; then exit
2017-09-01 01:38:49 +00:00
lda #$00 ; start := $1100
2017-09-01 01:20:36 +00:00
sta STARTLO
2017-08-29 03:58:09 +00:00
lda #$7E
2017-09-01 01:38:49 +00:00
sta ENDLO ; end := $117E
2017-08-29 03:58:09 +00:00
lda #$11
2017-09-01 01:20:36 +00:00
sta STARTHI
sta ENDHI
2017-09-01 01:38:49 +00:00
dest := $8803
lda #>dest
2017-09-01 01:20:36 +00:00
sta DESTINATIONHI
2017-09-01 01:38:49 +00:00
lda #<dest
2017-09-01 01:20:36 +00:00
sta DESTINATIONLO
sec ; main>aux
2017-08-29 03:58:09 +00:00
jsr AUXMOVE
2017-09-01 02:05:41 +00:00
end: rts
2017-09-01 01:38:49 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 01:38:49 +00:00
.proc L1129 ; ???
2017-09-01 02:05:41 +00:00
lda fixed_mode_flag ; if not fixed (i.e. proportional)
beq end ; then exit
2017-08-29 03:58:09 +00:00
ldx $8801
lda #$07
2017-09-01 01:38:49 +00:00
loop: sta $8802,x
2017-08-29 03:58:09 +00:00
dex
2017-09-01 01:38:49 +00:00
bne loop
2017-09-01 02:05:41 +00:00
end: rts
2017-09-01 01:38:49 +00:00
.endproc
2017-08-29 03:58:09 +00:00
2017-09-01 01:38:49 +00:00
;;; On Title Bar Click - if it's on the Fixed/Proportional label,
;;; toggle it and update.
.proc on_title_bar_click
lda mouse_data::xcoord+1 ; mouse x high byte?
cmp label_left+1
bne :+
lda mouse_data::xcoord
cmp label_left
: bcc ignore
lda fixed_mode_flag
beq set_flag
dec fixed_mode_flag ; clear flag (mode = proportional)
2017-08-29 03:58:09 +00:00
jsr L1109
jmp redraw
2017-08-29 03:58:09 +00:00
set_flag:
inc fixed_mode_flag ; set flag (mode = fixed)
redraw: jsr draw_mode
2017-09-01 01:38:49 +00:00
jsr draw_content
sec ; Click consumed
2017-08-29 03:58:09 +00:00
rts
ignore: clc ; Click ignored
2017-08-29 03:58:09 +00:00
rts
.endproc
2017-08-29 03:58:09 +00:00
fixed_str: A2D_DEFSTRING "Fixed "
prop_str: A2D_DEFSTRING "Proportional"
;;; Scratch space for Fixed/Proportional drawing code
label_left: .word 0 ; left edge of label
2017-08-29 03:58:09 +00:00
L1186: .byte $00,$00,$00,$20,$80,$00,$00,$00
.byte $00,$00,$50,$00,$0A,$00
L1194: .byte $00,$00,$0A,$00
.proc calc_and_draw_mode
sec
2017-08-29 03:58:09 +00:00
lda L09AA
sbc #$0C
sta L1186
clc
lda L09A8
adc L0961
pha
lda L09A9
adc L0962
tax
sec
pla
sbc #$32
sta label_left
2017-08-29 03:58:09 +00:00
txa
sbc #$00
sta label_left+1
2017-09-01 02:05:41 +00:00
;; fall through...
.endproc
2017-09-01 02:05:41 +00:00
.proc draw_mode
2017-08-31 15:10:51 +00:00
A2D_CALL $06, label_left ; guess: setting up draw location ???
2017-08-29 03:58:09 +00:00
A2D_CALL $0E, L1194
lda fixed_mode_flag
beq else ; is proportional?
2017-08-31 03:30:46 +00:00
A2D_CALL A2D_DRAW_TEXT, fixed_str
jmp endif
2017-08-31 03:30:46 +00:00
else: A2D_CALL A2D_DRAW_TEXT, prop_str
2017-08-31 15:10:51 +00:00
endif: ldx #$0F
loop: lda L09CE,x
2017-08-29 03:58:09 +00:00
sta L09A8,x
dex
bpl loop
2017-08-29 03:58:09 +00:00
A2D_CALL $06, L09A8
rts
.endproc