Add Control Panel DA.

* Desktop pattern
* Double-click speed
* Joystick calibration
* Insertion point blink speed

Settings live in LCBANK1 at $FF80 and are persisted directly to DESKTOP2 when the DA closes. DeskTop itself is modified to pull values from there. IP blink routines are improved to not slow down when the mouse pointer is over the window.

Fixes #2, #31, #72
This commit is contained in:
Joshua Bell 2019-07-30 21:22:28 -07:00
parent daf6e87aec
commit 2415869008
11 changed files with 1762 additions and 32 deletions

View File

@ -37,6 +37,8 @@ https://github.com/inexorabletash/a2d/issues
* This Apple
* Gives details about the computer, expanded memory, and what's in each slot. (#29)
* Control Panel
* Allows editing the desktop pattern (#31), double-click speed (#2), insertion point blink speed. Also shows joystick calibration. (#72)
* Run Basic Here
* Launch BASIC.SYSTEM with PREFIX set to the current window's pathname. (#42)
* Key Caps

View File

@ -10,6 +10,8 @@ New desk accessories:
* [This Apple](this.apple.s)
* Gives details about the computer, expanded memory, and what's in each slot.
* [Control Panel](control.panel.s)
* Modify DeskTop settings: desktop pattern, double-click speed, insertion point blink speed. Also shows joystick calibration.
* [Eyes](eyes.s)
* Eyes that follow the mouse.
* [Screen Dump](screen.dump.s)
@ -21,6 +23,8 @@ New desk accessories:
* [Screen Saver](screen.saver.s)
* Visual distractions.
Note that the new desk accessories require an updated version of Apple II DeskTop and **will not work** with DeskTop 1.1 or MouseDesk.
See [API.md](API.md) for programming details
## Files

View File

@ -8,3 +8,4 @@ screen.dump
run.basic.here
key.caps
screen.saver
control.panel

1631
desk.acc/control.panel.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ da_window_id = 60
da_width = 400
da_height = 118
da_left = (screen_width - da_width)/2
da_top = 50
da_top = 45
.proc winfo
window_id: .byte da_window_id

View File

@ -316,3 +316,24 @@ GLYPH_SAPPLE = $1E
header_pointer .word ; 28 $1C
aux_type .word ; 30 $1E
.endstruct
;;; ============================================================
;;; Internals - Settings (modified by Control Panel)
DESKTOP2_SETTINGS_OFFSET = $A700
.scope DeskTop
.scope Settings
address := $FF80
length = $80
pattern := $FF80 ; .res 8
dblclick_speed := $FF88 ; .word
kDefaultDblClickSpeed = $12C
ip_blink_speed := $FF8A ; .byte
kDefaultIPBlinkSpeed = 60
.endscope
.endscope

View File

@ -12705,6 +12705,27 @@ RAMSLOT := DEVADR + $16 ; Slot 3, Drive 2
driver: jmp (RAMSLOT)
.endproc
;;; ============================================================
;;; Determine if mouse moved (returns w/ carry set if moved)
;;; Used in dialogs to possibly change cursor
.proc check_mouse_moved
ldx #.sizeof(MGTK::Point)-1
: lda event_coords,x
cmp coords,x
bne diff
dex
bpl :-
clc
rts
diff: COPY_STRUCT MGTK::Point, event_coords, coords
sec
rts
coords: DEFINE_POINT 0,0
.endproc
;;; ============================================================
@ -12766,7 +12787,7 @@ dialog_param_addr:
sta format_erase_overlay_flag
sta cursor_ip_flag
copy #prompt_insertion_point_blink_count, prompt_ip_counter
copy DeskTop::Settings::ip_blink_speed, prompt_ip_counter
copy16 #rts1, jump_relay+1
jsr set_cursor_pointer
@ -12787,7 +12808,7 @@ dialog_param_addr:
dec prompt_ip_counter
bne :+
jsr redraw_prompt_insertion_point
copy #prompt_insertion_point_blink_count, prompt_ip_counter
copy DeskTop::Settings::ip_blink_speed, prompt_ip_counter
;; Dispatch event types - mouse down, key press
: MGTK_RELAY_CALL MGTK::GetEvent, event_params
@ -12805,6 +12826,9 @@ dialog_param_addr:
beq prompt_input_loop
;; Check if mouse is over input field, change cursor appropriately.
jsr check_mouse_moved
bcc prompt_input_loop
MGTK_RELAY_CALL MGTK::FindWindow, event_coords
lda findwindow_which_area
bne :+
@ -14173,20 +14197,15 @@ set_penmode_xor2:
dex
bpl :-
lda #0
sta counter+1
lda machine_type ; Speed of mouse driver? ($96=IIe,$FA=IIc,$FD=IIgs)
asl a ; * 2
rol counter+1 ; So IIe = $12C, IIc = $1F4, IIgs = $1FA
sta counter
copy16 DeskTop::Settings::dblclick_speed, counter
;; Decrement counter, bail if time delta exceeded
loop: dec counter
bne :+
dec counter+1
bne exit
loop: dec16 counter
lda counter
ora counter+1
beq exit
: MGTK_RELAY_CALL MGTK::PeekEvent, event_params
MGTK_RELAY_CALL MGTK::PeekEvent, event_params
;; Check coords, bail if pixel delta exceeded
jsr check_delta
@ -15476,27 +15495,33 @@ start:
bmi is_iigs
;; IIe (or IIe Option Card, or Laser 128)
copy #$96, machine_type ; IIe
lda id_FB1E ; Is it a Laser 128?
cmp #$AC
bne :+
bne is_iie
copy #$80, is_laser128_flag
copy #$FD, machine_type ; Assume accelerated?
: jmp end
lda #$FD ; Assume accelerated?
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*4
jmp end
;; IIe (or IIe Option Card)
is_iie: lda #$96
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*1
jmp end
;; IIgs
is_iigs:
copy #$FD, machine_type ; IIgs
lda #$FD
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*4
jmp end
;; IIc or IIc+
is_iic: copy #$FA, machine_type ; IIc
lda id_FBBF ; ROM version
is_iic: lda id_FBBF ; ROM version
cmp #$05 ; IIc Plus = $05
bne :+
copy #$80, is_iic_plus_flag
: jmp end
: lda #$FA
ldxy #DeskTop::Settings::kDefaultDblClickSpeed*4
jmp end
id_FB1E: .byte 0
id_FBB3: .byte 0
@ -15504,6 +15529,14 @@ id_FBC0: .byte 0
id_FBBF: .byte 0
end:
sta machine_type
;; Only set if not previously configured
lda DeskTop::Settings::dblclick_speed
ora DeskTop::Settings::dblclick_speed+1
bne :+
stxy DeskTop::Settings::dblclick_speed
:
.endscope
;;; ============================================================
@ -15544,6 +15577,7 @@ end:
;;; Initialize MGTK
.scope
MGTK_RELAY_CALL MGTK::SetDeskPat, DeskTop::Settings::pattern
MGTK_RELAY_CALL MGTK::StartDeskTop, startdesktop_params
jsr desktop_main::set_mono_mode
MGTK_RELAY_CALL MGTK::SetMenu, splash_menu

View File

@ -168,7 +168,7 @@ LD2A9: .byte 0
double_click_flag:
.byte 0 ; high bit clear if double-clicked, set otherwise
;; Set to specific machine type; used for double-click timing.
;; Set to specific machine type
machine_type:
.byte $00 ; Set to: $96 = IIe, $FA = IIc, $FD = IIgs
@ -600,11 +600,8 @@ LD8E7: .byte 0
has_input_field_flag:
.byte 0
prompt_insertion_point_blink_count = $14
prompt_ip_counter:
.byte prompt_insertion_point_blink_count
.byte 1 ; immediately decremented to 0 and reset
prompt_ip_flag:
.byte 0
@ -1802,4 +1799,34 @@ app_mask:
;; Reserve $80 bytes for settings
PAD_TO $FF80
PAD_TO $10000
;;; ============================================================
;;; Settings - modified by Control Panel
;;; ============================================================
.scope settings
.assert * = DeskTop::Settings::address, error, "Address mismatch"
;; This is offset $A700 into DESKTOP2 file
.assert * = DeskTop::Settings::pattern, error, "Address mismatch"
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.byte %01010101
.byte %10101010
.assert * = DeskTop::Settings::dblclick_speed, error, "Address mismatch"
.word 0 ; $12C * 1, * 4, or * 32, 0 if not set
.assert * = DeskTop::Settings::ip_blink_speed, error, "Address mismatch"
.byte 60 ; 120, 60 or 30; lower is faster
;; Reserved for future use...
PAD_TO DeskTop::Settings::address + DeskTop::Settings::length
.endscope
.assert * = $10000, error, "Segment length mismatch"

View File

@ -43,7 +43,7 @@ routine_table: .addr $7000, $7000, $7000
sta L5104
sta L5103
sta L5105
lda #prompt_insertion_point_blink_count
lda DeskTop::Settings::ip_blink_speed
sta prompt_ip_counter
lda #$FF
sta LD920
@ -76,7 +76,7 @@ L5106: bit LD8EC
dec prompt_ip_counter
bne :+
jsr jt_blink_ip
copy #prompt_insertion_point_blink_count, prompt_ip_counter
copy DeskTop::Settings::ip_blink_speed, prompt_ip_counter
: MGTK_RELAY_CALL MGTK::GetEvent, event_params
lda event_kind
@ -88,7 +88,11 @@ L5106: bit LD8EC
: cmp #MGTK::EventKind::key_down
bne :+
jsr L59B9
: MGTK_RELAY_CALL MGTK::FindWindow, findwindow_params
jmp L5106
: jsr desktop_main::check_mouse_moved
bcc L5106
MGTK_RELAY_CALL MGTK::FindWindow, findwindow_params
lda findwindow_which_area
bne :+
jmp L5106

View File

@ -13,6 +13,7 @@
* If no files are selected, all files are sorted by type: DIR, then TXT, then SYS, then others in descending (numeric) order.
* Hold down **△** or **▲** when opening a folder using double-click or **File > Open** to close the parent folder.
* Note: Does not work with the **△O** shortcut.
* The Control Panel desk accessory writes settings back to the `DESKTOP2` file when it is closed. If it is not present, or is locked, the settings will not be saved for the next session.
# File Types

View File

@ -29,6 +29,8 @@ SHADOW := $C035 ; IIgs - inhibit shadowing
AN3_ON := $C05F ; AppleColor Adapter Card / Le Chat Mauve
AN3_OFF := $C05E
BUTN2 := $C063
RAMWORKS_BANK := $C071 ; RAMWorks bank selection ???
HR1_ON := $C0B3
@ -168,6 +170,9 @@ HIRESOFF := $C057
DHIRESON := $C05E
DHIRESOFF := $C05F
PADDL0 := $C064
PTRIG := $C070
;;; Routines
SLOT3ENTRY := $C300
AUXMOVE := $C311 ; carry set main>aux, carry clear aux>main