mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-09-27 19:57:56 +00:00
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
;license:MIT
|
|
;(c) 2018 by 4am
|
|
;
|
|
; Global and per-game preferences
|
|
;
|
|
; Public functions
|
|
; - LoadGlobalPreferences
|
|
|
|
!zone {
|
|
kDefaultGame = 29 ; Zork I
|
|
kPrefsRecord = $0800
|
|
kPrefsLength = 1
|
|
kPrefsCurrentGame = kPrefsRecord + 0
|
|
|
|
;------------------------------------------------------------------------------
|
|
; LoadGlobalPreferences
|
|
;
|
|
; in: current ProDOS prefix is the same as the PITCH.DARK binary
|
|
; out: all registers and flags clobbered
|
|
;------------------------------------------------------------------------------
|
|
LoadGlobalPreferences
|
|
jsr LoadFile ; load prefs file at $0800
|
|
!word .globalPrefsFilename
|
|
!word kPrefsRecord
|
|
!word kPrefsLength
|
|
!word kProDOSFileBuffer
|
|
bcs .useDefaults
|
|
lda kPrefsCurrentGame
|
|
cmp #kNumberOfGames
|
|
bcs .useDefaults
|
|
sta gCurrentGame
|
|
rts
|
|
.useDefaults
|
|
lda #kDefaultGame
|
|
sta gCurrentGame
|
|
rts
|
|
|
|
SaveGlobalPreferences
|
|
lda gCurrentGame
|
|
sta kPrefsCurrentGame
|
|
jsr SaveFile
|
|
!word .globalPrefsFilename
|
|
!byte $06
|
|
!word $0000
|
|
!word kPrefsRecord
|
|
!word kPrefsLength
|
|
!word kProDOSFileBuffer
|
|
rts
|
|
|
|
.globalPrefsFilename
|
|
!byte 15
|
|
!raw "PITCH.DARK.CONF"
|
|
}
|