;license:MIT ;(c) 2018 by 4am ; ; Global and per-game preferences ; ; Public functions ; - LoadGlobalPreferences ; ; 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 { TRUE = 1 FALSE = 0 kDefaultGame = 30 ; Zork I ; 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 ; 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 lda #kGlobalPrefsStore jsr okvs_init lda #kGlobalPrefsStore jsr okvs_append !word .force40 !word .debug0 !byte 0 lda #kGlobalPrefsStore jsr okvs_append !word .forceupper !word .debug0 !byte 0 lda #kGlobalPrefsStore jsr okvs_append !word .sort !word .debugsortvalue !byte 0 bra .exit ; TODO jsr LoadFile ; load prefs file at $2000 !word .globalPrefsFilename !word $2000 !word $2000 !word kProDOSFileBuffer bcs .exit .exit rts SaveGlobalPreferences ; TODO rts .globalPrefsFilename !byte 15 !raw "PITCH.DARK.CONF" .force40 !byte 14 !raw "FORCE40COLUMNS" .forceupper !byte 14 !raw "FORCEUPPERCASE" .sort !byte 4 !raw "SORT" .lastplayed !byte 10 !raw "LASTPLAYED" .debug0 !byte 1 !raw "0" .debugsortvalue !byte 4 !raw "NAME" }