2018-02-09 01:38:26 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018 by 4am
|
|
|
|
;
|
|
|
|
; Global and per-game preferences
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - LoadGlobalPreferences
|
2018-03-24 23:03:00 +00:00
|
|
|
; - SaveGlobalPreferences
|
2018-03-16 18:17:45 +00:00
|
|
|
;
|
|
|
|
; Public variables
|
|
|
|
; - gCurrentGame byte 0..kNumberOfGames-1
|
2018-03-24 23:03:00 +00:00
|
|
|
;
|
|
|
|
; Public constants
|
|
|
|
; - kForce40
|
|
|
|
; - kForceUpper
|
|
|
|
; - kSort
|
|
|
|
; - kLastPlayed
|
2018-02-09 01:38:26 +00:00
|
|
|
|
|
|
|
!zone {
|
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
|
|
|
|
gCurrentGame
|
|
|
|
!byte 0
|
2018-03-24 23:03:00 +00:00
|
|
|
|
|
|
|
kForce40
|
|
|
|
!byte 14
|
|
|
|
!raw "FORCE40COLUMNS"
|
|
|
|
kForceUpper
|
|
|
|
!byte 14
|
|
|
|
!raw "FORCEUPPERCASE"
|
|
|
|
kSort
|
|
|
|
!byte 4
|
|
|
|
!raw "SORT"
|
|
|
|
kLastPlayed
|
|
|
|
!byte 10
|
|
|
|
!raw "LASTPLAYED"
|
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
|
|
|
|
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
|
2018-03-24 23:03:00 +00:00
|
|
|
!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
|
2018-03-24 23:03:00 +00:00
|
|
|
!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
|
2018-03-24 23:03:00 +00:00
|
|
|
!word kSort
|
2018-03-24 16:04:09 +00:00
|
|
|
!word .debugsortvalue
|
2018-03-24 23:03:00 +00:00
|
|
|
!byte 11
|
2018-03-24 16:04:09 +00:00
|
|
|
|
2018-03-24 23:03:00 +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
|
2018-03-24 23:03:00 +00:00
|
|
|
!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
|
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
|
|
|
|
2018-03-24 16:04:09 +00:00
|
|
|
.debug0
|
|
|
|
!byte 1
|
|
|
|
!raw "0"
|
|
|
|
|
|
|
|
.debugsortvalue
|
|
|
|
!byte 4
|
|
|
|
!raw "NAME"
|
|
|
|
|
2018-03-24 23:03:00 +00:00
|
|
|
.debuglastplayed
|
|
|
|
!byte 6
|
|
|
|
!raw "ZORK.I"
|
|
|
|
|
|
|
|
kByDifficulty
|
|
|
|
!byte 10
|
|
|
|
!raw "DIFFICULTY"
|
2018-02-09 01:38:26 +00:00
|
|
|
}
|