mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-09-27 19:57:56 +00:00
.
This commit is contained in:
parent
3c0dc8c505
commit
78dcea8dcf
10
src/prefs.a
10
src/prefs.a
@ -9,9 +9,11 @@
|
|||||||
;
|
;
|
||||||
; Public variables
|
; Public variables
|
||||||
; - gCurrentGame byte 0..kNumberOfGames-1
|
; - 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
|
; - 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
|
; - kForce40
|
||||||
; - kForceUpper
|
; - kForceUpper
|
||||||
; - kScriptToFile
|
; - kScriptToFile
|
||||||
@ -149,6 +151,12 @@ LoadGlobalPreferences
|
|||||||
.vallen !byte 0
|
.vallen !byte 0
|
||||||
.val !fill 15
|
.val !fill 15
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; SaveGlobalPreferences
|
||||||
|
;
|
||||||
|
; in: current ProDOS prefix is the same as the PITCH.DARK.CONF file
|
||||||
|
; out: all registers and flags clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
SaveGlobalPreferences
|
SaveGlobalPreferences
|
||||||
lda gNeedToSavePrefs
|
lda gNeedToSavePrefs
|
||||||
bne +
|
bne +
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
WAIT = $FCA8
|
WAIT = $FCA8
|
||||||
SPEAKER = $C030
|
SPEAKER = $C030
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; SoftBell
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: all registers preserved
|
||||||
|
; all flags clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
SoftBell
|
SoftBell
|
||||||
php
|
php
|
||||||
phx
|
phx
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
; - CreateButton
|
; - CreateButton
|
||||||
; - CreateTitleView
|
; - CreateTitleView
|
||||||
; - PaintTitleView
|
; - PaintTitleView
|
||||||
; - SetCheckboxByPref
|
|
||||||
; - SetPrefByCheckbox
|
|
||||||
;
|
;
|
||||||
|
|
||||||
; ROM routines
|
; ROM routines
|
||||||
@ -21,6 +19,15 @@ NORMAL = $FE84
|
|||||||
ID_TITLE = 0
|
ID_TITLE = 0
|
||||||
|
|
||||||
!zone {
|
!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
|
CreateRadio
|
||||||
ldx #WGCreateRadio
|
ldx #WGCreateRadio
|
||||||
!byte $2C ; hide next 2 bytes
|
!byte $2C ; hide next 2 bytes
|
||||||
@ -47,6 +54,14 @@ CreateButton
|
|||||||
sta PARAM0
|
sta PARAM0
|
||||||
jmp WeeGUI
|
jmp WeeGUI
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; CreateTitleView
|
||||||
|
; creates the standard title bar on top row of screen
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: A,X clobbered
|
||||||
|
; title view selected
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
CreateTitleView
|
CreateTitleView
|
||||||
ldx #WGCreateView ; create title bar on top line
|
ldx #WGCreateView ; create title bar on top line
|
||||||
lda #<viewTitle
|
lda #<viewTitle
|
||||||
@ -55,6 +70,14 @@ CreateTitleView
|
|||||||
sta PARAM1
|
sta PARAM1
|
||||||
jmp WeeGUI
|
jmp WeeGUI
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; PaintTitleView
|
||||||
|
; paints the title bar
|
||||||
|
;
|
||||||
|
; in: none
|
||||||
|
; out: all registers clobbered
|
||||||
|
; title view selected
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
PaintTitleView
|
PaintTitleView
|
||||||
ldx #WGSelectView
|
ldx #WGSelectView
|
||||||
lda #ID_TITLE
|
lda #ID_TITLE
|
||||||
@ -80,70 +103,3 @@ viewTitle
|
|||||||
.stringTitle
|
.stringTitle
|
||||||
!raw " Pitch Dark ",0
|
!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
|
|
||||||
}
|
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
; - RepaintSomeViews
|
; - 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)
|
; 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_PREVIOUS = 1
|
||||||
ID_OPTIONS = 2
|
ID_OPTIONS = 2
|
||||||
ID_NEXT = 3
|
ID_NEXT = 3
|
||||||
@ -31,8 +31,7 @@ ID_DESCRIPTION = 13
|
|||||||
; call WeeGUI to create all application views
|
; call WeeGUI to create all application views
|
||||||
;
|
;
|
||||||
; in: WeeGUI loaded and initialized
|
; in: WeeGUI loaded and initialized
|
||||||
; out: all registers clobbered
|
; out: all registers and flags clobbered
|
||||||
; all flags clobbered
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
CreateViews
|
CreateViews
|
||||||
jsr CreateTitleView
|
jsr CreateTitleView
|
||||||
@ -91,8 +90,7 @@ CreateViews
|
|||||||
;
|
;
|
||||||
; in: WeeGUI loaded and initialized
|
; in: WeeGUI loaded and initialized
|
||||||
; CreateViews has been called
|
; CreateViews has been called
|
||||||
; out: all registers clobbered
|
; out: all registers and flags clobbered
|
||||||
; all flags clobbered
|
|
||||||
; $00/$01 clobbered
|
; $00/$01 clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
PaintAllViews
|
PaintAllViews
|
||||||
@ -110,8 +108,7 @@ PaintAllViews
|
|||||||
; in: WeeGUI loaded and initialized
|
; in: WeeGUI loaded and initialized
|
||||||
; CreateViews has been called
|
; CreateViews has been called
|
||||||
; LoadGameInfo has been called to load new game description text
|
; LoadGameInfo has been called to load new game description text
|
||||||
; out: all registers clobbered
|
; out: all registers and flags clobbered
|
||||||
; all flags clobbered
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
RepaintSomeViews
|
RepaintSomeViews
|
||||||
jsr .paintInfoView
|
jsr .paintInfoView
|
||||||
@ -119,6 +116,7 @@ RepaintSomeViews
|
|||||||
jmp .paintDescriptionView
|
jmp .paintDescriptionView
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
; internal functions
|
||||||
|
|
||||||
.paintHRView
|
.paintHRView
|
||||||
ldx #WGSelectView
|
ldx #WGSelectView
|
||||||
|
@ -169,8 +169,6 @@ HandleKey
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
!zone {
|
!zone {
|
||||||
callback_previous
|
callback_previous
|
||||||
lda gCurrentGame
|
lda gCurrentGame
|
||||||
|
109
src/ui.options.a
109
src/ui.options.a
@ -7,6 +7,7 @@
|
|||||||
; - OptionsDialog
|
; - OptionsDialog
|
||||||
;
|
;
|
||||||
|
|
||||||
|
!zone {
|
||||||
; View IDs (application-specific, acceptable range 0..15, no duplicates)
|
; View IDs (application-specific, acceptable range 0..15, no duplicates)
|
||||||
; ID_TITLE is defined in paintcommon.a
|
; ID_TITLE is defined in paintcommon.a
|
||||||
ID_OPTIONS_FRAME = 1
|
ID_OPTIONS_FRAME = 1
|
||||||
@ -17,13 +18,30 @@ ID_OPTIONS_AUTOSCRIPT = 5
|
|||||||
ID_OPTIONS_OK = 6
|
ID_OPTIONS_OK = 6
|
||||||
ID_OPTIONS_CANCEL = 7
|
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
|
; 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
|
; in: WeeGUI loaded and initialized
|
||||||
; out: all registers clobbered
|
; out: exits via MainScreen
|
||||||
|
; all registers clobbered
|
||||||
; all flags clobbered
|
; all flags clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
OptionsDialog
|
OptionsDialog
|
||||||
@ -146,22 +164,8 @@ OptionsDialog
|
|||||||
jsr HandleOptionsKey
|
jsr HandleOptionsKey
|
||||||
bra .runLoop
|
bra .runLoop
|
||||||
|
|
||||||
; action keys for options screen
|
;------------------------------------------------------------------------------
|
||||||
.keys
|
; internal functions
|
||||||
!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
|
|
||||||
|
|
||||||
HandleOptionsKey
|
HandleOptionsKey
|
||||||
ldx #.endkeys-.keys
|
ldx #.endkeys-.keys
|
||||||
@ -202,6 +206,73 @@ callback_options_ok
|
|||||||
callback_options_cancel
|
callback_options_cancel
|
||||||
jmp MainScreen
|
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
|
.viewFrame
|
||||||
!byte ID_OPTIONS_FRAME ; view ID
|
!byte ID_OPTIONS_FRAME ; view ID
|
||||||
!byte 2 ; style (decorated frame)
|
!byte 2 ; style (decorated frame)
|
||||||
|
Loading…
Reference in New Issue
Block a user