pitch-dark/src/prefs.a

118 lines
2.3 KiB
Plaintext
Raw Normal View History

;license:MIT
;(c) 2018 by 4am
;
; Global and per-game preferences
;
; Public functions
; - LoadGlobalPreferences
; - SaveGlobalPreferences
2018-03-16 18:17:45 +00:00
;
; Public variables
; - gCurrentGame byte 0..kNumberOfGames-1
;
; Public constants
; - kForce40
; - kForceUpper
; - kSort
; - kLastPlayed
!zone {
kDefaultGame = 30 ; Zork I
2018-03-16 18:17:45 +00:00
; global storage for parsed preference values
gCurrentGame
!byte 0
kForce40
!byte 14
!raw "FORCE40COLUMNS"
kForceUpper
!byte 14
!raw "FORCEUPPERCASE"
kSort
!byte 4
!raw "SORT"
kLastPlayed
!byte 10
!raw "LASTPLAYED"
;------------------------------------------------------------------------------
; LoadGlobalPreferences
;
; in: current ProDOS prefix is the same as the PITCH.DARK binary
; out: all registers and flags clobbered
;------------------------------------------------------------------------------
LoadGlobalPreferences
lda #kDefaultGame
sta gCurrentGame
2018-03-24 16:04:09 +00:00
jsr okvs_init
2018-03-24 19:28:55 +00:00
!word gPrefsStore
2018-03-24 16:04:09 +00:00
jsr okvs_append
2018-03-24 19:28:55 +00:00
!word gPrefsStore
!word kForce40
2018-03-24 16:04:09 +00:00
!word .debug0
!byte 0
jsr okvs_append
2018-03-24 19:28:55 +00:00
!word gPrefsStore
!word kForceUpper
2018-03-24 16:04:09 +00:00
!word .debug0
!byte 0
jsr okvs_append
2018-03-24 19:28:55 +00:00
!word gPrefsStore
!word kSort
2018-03-24 16:04:09 +00:00
!word .debugsortvalue
!byte 11
2018-03-24 16:04:09 +00:00
jsr okvs_append
!word gPrefsStore
!word kLastPlayed
!word .debuglastplayed
!byte 16
jsr okvs_update
2018-03-24 19:28:55 +00:00
!word gPrefsStore
!word kSort
!word kByDifficulty
2018-03-24 19:28:55 +00:00
bcs .exit
;jmp $ff59
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
2018-03-24 16:04:09 +00:00
.debug0
!byte 1
!raw "0"
.debugsortvalue
!byte 4
!raw "NAME"
.debuglastplayed
!byte 6
!raw "ZORK.I"
kByDifficulty
!byte 10
!raw "DIFFICULTY"
}