This commit is contained in:
4am 2018-03-27 17:17:47 -04:00
parent 3c0dc8c505
commit 78dcea8dcf
7 changed files with 137 additions and 99 deletions

View File

@ -9,9 +9,11 @@
;
; Public variables
; - gCurrentGame byte 0..kNumberOfGames-1
; populated by LoadGlobalPreferences so other code can index into GAMES array for quick access to game shortnames
; - gNeedToSavePrefs byte 0=false, 1=true
; set to 1 if prefs have changed. SaveGlobalPreferences won't write to disk if this is 0.
;
; Public constants
; Public constants (all length-prefixed strings)
; - kForce40
; - kForceUpper
; - kScriptToFile
@ -149,6 +151,12 @@ LoadGlobalPreferences
.vallen !byte 0
.val !fill 15
;------------------------------------------------------------------------------
; SaveGlobalPreferences
;
; in: current ProDOS prefix is the same as the PITCH.DARK.CONF file
; out: all registers and flags clobbered
;------------------------------------------------------------------------------
SaveGlobalPreferences
lda gNeedToSavePrefs
bne +

View File

@ -10,6 +10,13 @@
WAIT = $FCA8
SPEAKER = $C030
;------------------------------------------------------------------------------
; SoftBell
;
; in: none
; out: all registers preserved
; all flags clobbered
;------------------------------------------------------------------------------
SoftBell
php
phx

View File

@ -9,8 +9,6 @@
; - CreateButton
; - CreateTitleView
; - PaintTitleView
; - SetCheckboxByPref
; - SetPrefByCheckbox
;
; ROM routines
@ -21,6 +19,15 @@ NORMAL = $FE84
ID_TITLE = 0
!zone {
;------------------------------------------------------------------------------
; CreateRadio/CreateCheckbox/CreateButton
; creates a WeeGUI UI control with the 'raw title' option set
;
; in: stack contains 2 bytes of parameters:
; +1 [word] pointer to WeeGUI view configuration block
; out: $00/$01 clobbered
; all registers clobbered
;------------------------------------------------------------------------------
CreateRadio
ldx #WGCreateRadio
!byte $2C ; hide next 2 bytes
@ -47,6 +54,14 @@ CreateButton
sta PARAM0
jmp WeeGUI
;------------------------------------------------------------------------------
; CreateTitleView
; creates the standard title bar on top row of screen
;
; in: none
; out: A,X clobbered
; title view selected
;------------------------------------------------------------------------------
CreateTitleView
ldx #WGCreateView ; create title bar on top line
lda #<viewTitle
@ -55,6 +70,14 @@ CreateTitleView
sta PARAM1
jmp WeeGUI
;------------------------------------------------------------------------------
; PaintTitleView
; paints the title bar
;
; in: none
; out: all registers clobbered
; title view selected
;------------------------------------------------------------------------------
PaintTitleView
ldx #WGSelectView
lda #ID_TITLE
@ -80,70 +103,3 @@ viewTitle
.stringTitle
!raw " Pitch Dark ",0
}
!zone {
SetCheckboxByPref
+PARAMS_ON_STACK 3
ldy #1
lda (PARAM),y
sta .id
iny
lda (PARAM),y
sta .key
iny
lda (PARAM),y
sta .key+1
jsr okvs_get
!word gPrefsStore
.key !word $FDFD ; set at runtime
bcs .exit
jsr okvs_as_boolean
beq .exit
ldx #WGSelectView
.id=*+1
lda #$FD ; set at runtime
jsr WeeGUI
ldx #WGSetState
lda #1
sta PARAM0
jsr WeeGUI
.exit rts
}
!zone {
SetPrefByCheckbox
+PARAMS_ON_STACK 3
ldy #1
lda (PARAM),y
sta .id
iny
lda (PARAM),y
sta .key
iny
lda (PARAM),y
sta .key+1
ldx #WGSelectView
.id=*+1
lda #$FD ; set at runtime
jsr WeeGUI
ldx #WGGetState
jsr WeeGUI
lda PARAM0
and #1
sta .value+1
jsr okvs_update
!word gPrefsStore
.key !word $FDFD ; set at runtime
!word .value
rts
.value !byte 1
!byte $FD ; set at runtime
}

View File

@ -9,10 +9,10 @@
; - RepaintSomeViews
;
MAGICRTS = $FF58 ; used to set overflow bit
MAGICRTS = $FF58 ; used to set overflow bit
; View IDs (application-specific, acceptable range 0..15, no duplicates)
; ID_TITLE is defined in paintcommon.a
; ID_TITLE is defined in ui.common.a
ID_PREVIOUS = 1
ID_OPTIONS = 2
ID_NEXT = 3
@ -31,8 +31,7 @@ ID_DESCRIPTION = 13
; call WeeGUI to create all application views
;
; in: WeeGUI loaded and initialized
; out: all registers clobbered
; all flags clobbered
; out: all registers and flags clobbered
;------------------------------------------------------------------------------
CreateViews
jsr CreateTitleView
@ -91,8 +90,7 @@ CreateViews
;
; in: WeeGUI loaded and initialized
; CreateViews has been called
; out: all registers clobbered
; all flags clobbered
; out: all registers and flags clobbered
; $00/$01 clobbered
;------------------------------------------------------------------------------
PaintAllViews
@ -110,8 +108,7 @@ PaintAllViews
; in: WeeGUI loaded and initialized
; CreateViews has been called
; LoadGameInfo has been called to load new game description text
; out: all registers clobbered
; all flags clobbered
; out: all registers and flags clobbered
;------------------------------------------------------------------------------
RepaintSomeViews
jsr .paintInfoView
@ -119,6 +116,7 @@ RepaintSomeViews
jmp .paintDescriptionView
;------------------------------------------------------------------------------
; internal functions
.paintHRView
ldx #WGSelectView

View File

@ -169,8 +169,6 @@ HandleKey
}
;------------------------------------------------------------------------------
!zone {
callback_previous
lda gCurrentGame

View File

@ -7,6 +7,7 @@
; - OptionsDialog
;
!zone {
; View IDs (application-specific, acceptable range 0..15, no duplicates)
; ID_TITLE is defined in paintcommon.a
ID_OPTIONS_FRAME = 1
@ -17,13 +18,30 @@ ID_OPTIONS_AUTOSCRIPT = 5
ID_OPTIONS_OK = 6
ID_OPTIONS_CANCEL = 7
!zone {
; action keys for options screen
.keys
!byte $CF,ID_OPTIONS_OK ; O
!byte $EF,ID_OPTIONS_OK ; o
!byte $8D,ID_OPTIONS_OK ; Return
!byte $C3,ID_OPTIONS_CANCEL ; C
!byte $E3,ID_OPTIONS_CANCEL ; c
!byte $9B,ID_OPTIONS_CANCEL ; Esc
!byte $B4,ID_OPTIONS_FORCE40 ; 4
!byte $D5,ID_OPTIONS_FORCEUPPER ; U
!byte $F5,ID_OPTIONS_FORCEUPPER ; u
!byte $C6,ID_OPTIONS_SCRIPTTOFILE ; F
!byte $E6,ID_OPTIONS_SCRIPTTOFILE ; f
!byte $D3,ID_OPTIONS_AUTOSCRIPT ; S
!byte $F3,ID_OPTIONS_AUTOSCRIPT ; s
.endkeys
;------------------------------------------------------------------------------
; OptionsDialog
; call WeeGUI to create and paint all option screen views
; call WeeGUI to create and paint option screen, and run to completion
;
; in: WeeGUI loaded and initialized
; out: all registers clobbered
; out: exits via MainScreen
; all registers clobbered
; all flags clobbered
;------------------------------------------------------------------------------
OptionsDialog
@ -146,22 +164,8 @@ OptionsDialog
jsr HandleOptionsKey
bra .runLoop
; action keys for options screen
.keys
!byte $CF,ID_OPTIONS_OK ; O
!byte $EF,ID_OPTIONS_OK ; o
!byte $8D,ID_OPTIONS_OK ; Return
!byte $C3,ID_OPTIONS_CANCEL ; C
!byte $E3,ID_OPTIONS_CANCEL ; c
!byte $9B,ID_OPTIONS_CANCEL ; Esc
!byte $B4,ID_OPTIONS_FORCE40 ; 4
!byte $D5,ID_OPTIONS_FORCEUPPER ; U
!byte $F5,ID_OPTIONS_FORCEUPPER ; u
!byte $C6,ID_OPTIONS_SCRIPTTOFILE ; F
!byte $E6,ID_OPTIONS_SCRIPTTOFILE ; f
!byte $D3,ID_OPTIONS_AUTOSCRIPT ; S
!byte $F3,ID_OPTIONS_AUTOSCRIPT ; s
.endkeys
;------------------------------------------------------------------------------
; internal functions
HandleOptionsKey
ldx #.endkeys-.keys
@ -202,6 +206,73 @@ callback_options_ok
callback_options_cancel
jmp MainScreen
!zone {
SetCheckboxByPref
+PARAMS_ON_STACK 3
ldy #1
lda (PARAM),y
sta .id
iny
lda (PARAM),y
sta .key
iny
lda (PARAM),y
sta .key+1
jsr okvs_get
!word gPrefsStore
.key !word $FDFD ; set at runtime
bcs .exit
jsr okvs_as_boolean
beq .exit
ldx #WGSelectView
.id=*+1
lda #$FD ; set at runtime
jsr WeeGUI
ldx #WGSetState
lda #1
sta PARAM0
jsr WeeGUI
.exit rts
}
!zone {
SetPrefByCheckbox
+PARAMS_ON_STACK 3
ldy #1
lda (PARAM),y
sta .id
iny
lda (PARAM),y
sta .key
iny
lda (PARAM),y
sta .key+1
ldx #WGSelectView
.id=*+1
lda #$FD ; set at runtime
jsr WeeGUI
ldx #WGGetState
jsr WeeGUI
lda PARAM0
and #1
sta .value+1
jsr okvs_update
!word gPrefsStore
.key !word $FDFD ; set at runtime
!word .value
rts
.value !byte 1
!byte $FD ; set at runtime
}
.viewFrame
!byte ID_OPTIONS_FRAME ; view ID
!byte 2 ; style (decorated frame)