pitch-dark/src/prefs.a

87 lines
2.0 KiB
Plaintext
Raw Normal View History

;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
!zone {
2018-03-16 18:17:45 +00:00
TRUE = 1
FALSE = 0
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
;------------------------------------------------------------------------------
; 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
lda #kDefaultGame
sta gCurrentGame
2018-03-16 18:17:45 +00:00
bra .exit
; TODO
jsr LoadFile ; load prefs file at $2000
!word .globalPrefsFilename
2018-03-16 18:17:45 +00:00
!word $2000
!word $2000
!word kProDOSFileBuffer
2018-03-16 18:17:45 +00:00
bcs .exit
.exit
rts
SaveGlobalPreferences
; TODO
rts
.globalPrefsFilename
!byte 15
!raw "PITCH.DARK.CONF"
2018-03-16 18:17:45 +00:00
.globalPrefsKeys
!word .force40
!word .forceupper
!word .sort
!word .lastplayed
.force40
!byte 14
!raw "FORCE40COLUMNS"
.forceupper
!byte 14
!raw "FORCEUPPERCASE"
.sort
!byte 4
!raw "SORT"
.lastplayed
!byte 10
!raw "LASTPLAYED"
}