2018-02-09 01:38:26 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018 by 4am
|
|
|
|
;
|
|
|
|
; Global and per-game preferences
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - LoadGlobalPreferences
|
2018-03-16 18:17:45 +00:00
|
|
|
;
|
|
|
|
; Public variables
|
|
|
|
; - gForce40 byte 0=false, 1=true
|
|
|
|
; - gForceUpper byte 0=false, 1=true
|
|
|
|
; - gSort byte 0=name, 1=year, 2=genre, 3=difficulty
|
|
|
|
; - gCurrentGame byte 0..kNumberOfGames-1
|
|
|
|
; - gVersions[] array of fixed length records, each 16 bytes
|
2018-02-09 01:38:26 +00:00
|
|
|
|
|
|
|
!zone {
|
2018-03-16 18:17:45 +00:00
|
|
|
TRUE = 1
|
|
|
|
FALSE = 0
|
2018-03-22 13:31:21 +00:00
|
|
|
kDefaultGame = 30 ; Zork I
|
2018-03-16 18:17:45 +00:00
|
|
|
|
|
|
|
; global storage for parsed preference values
|
|
|
|
gForce40
|
|
|
|
!byte 0
|
|
|
|
gForceUpper
|
|
|
|
!byte 0
|
|
|
|
gSort
|
|
|
|
!byte 0
|
|
|
|
gCurrentGame
|
|
|
|
!byte 0
|
|
|
|
gVersions
|
|
|
|
!fill kNumberOfGames*16,0
|
2018-02-09 01:38:26 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; LoadGlobalPreferences
|
|
|
|
;
|
|
|
|
; in: current ProDOS prefix is the same as the PITCH.DARK binary
|
|
|
|
; out: all registers and flags clobbered
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
LoadGlobalPreferences
|
2018-03-16 18:17:45 +00:00
|
|
|
; set defaults first in case prefs file is missing or incomplete
|
|
|
|
lda #FALSE
|
|
|
|
sta gForce40
|
|
|
|
lda #FALSE
|
|
|
|
sta gForceUpper
|
|
|
|
lda #0
|
|
|
|
sta gSort
|
2018-02-09 01:38:26 +00:00
|
|
|
lda #kDefaultGame
|
|
|
|
sta gCurrentGame
|
|
|
|
|
2018-03-24 16:04:09 +00:00
|
|
|
lda #<kGlobalPrefsStore
|
|
|
|
ldy #>kGlobalPrefsStore
|
|
|
|
jsr okvs_init
|
|
|
|
|
|
|
|
lda #<kGlobalPrefsStore
|
|
|
|
ldy #>kGlobalPrefsStore
|
|
|
|
jsr okvs_append
|
|
|
|
!word .force40
|
|
|
|
!word .debug0
|
|
|
|
!byte 0
|
|
|
|
|
|
|
|
lda #<kGlobalPrefsStore
|
|
|
|
ldy #>kGlobalPrefsStore
|
|
|
|
jsr okvs_append
|
|
|
|
!word .forceupper
|
|
|
|
!word .debug0
|
|
|
|
!byte 0
|
|
|
|
|
|
|
|
lda #<kGlobalPrefsStore
|
|
|
|
ldy #>kGlobalPrefsStore
|
|
|
|
jsr okvs_append
|
|
|
|
!word .sort
|
|
|
|
!word .debugsortvalue
|
|
|
|
!byte 0
|
|
|
|
|
2018-03-16 18:17:45 +00:00
|
|
|
bra .exit
|
|
|
|
; TODO
|
|
|
|
jsr LoadFile ; load prefs file at $2000
|
2018-02-09 01:38:26 +00:00
|
|
|
!word .globalPrefsFilename
|
2018-03-16 18:17:45 +00:00
|
|
|
!word $2000
|
|
|
|
!word $2000
|
2018-02-09 01:38:26 +00:00
|
|
|
!word kProDOSFileBuffer
|
2018-03-16 18:17:45 +00:00
|
|
|
bcs .exit
|
|
|
|
.exit
|
|
|
|
rts
|
|
|
|
|
|
|
|
SaveGlobalPreferences
|
|
|
|
; TODO
|
2018-02-09 01:38:26 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
.globalPrefsFilename
|
|
|
|
!byte 15
|
|
|
|
!raw "PITCH.DARK.CONF"
|
2018-03-16 18:17:45 +00:00
|
|
|
|
|
|
|
.force40
|
|
|
|
!byte 14
|
|
|
|
!raw "FORCE40COLUMNS"
|
|
|
|
.forceupper
|
|
|
|
!byte 14
|
|
|
|
!raw "FORCEUPPERCASE"
|
|
|
|
.sort
|
|
|
|
!byte 4
|
|
|
|
!raw "SORT"
|
|
|
|
.lastplayed
|
|
|
|
!byte 10
|
|
|
|
!raw "LASTPLAYED"
|
2018-03-24 16:04:09 +00:00
|
|
|
|
|
|
|
.debug0
|
|
|
|
!byte 1
|
|
|
|
!raw "0"
|
|
|
|
|
|
|
|
.debugsortvalue
|
|
|
|
!byte 4
|
|
|
|
!raw "NAME"
|
|
|
|
|
2018-02-09 01:38:26 +00:00
|
|
|
}
|