2018-04-18 20:48:20 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; check machine requirements (128K with 65C02) and quit to ProDOS if not met
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
lda MACHID
|
|
|
|
and #$30
|
|
|
|
cmp #$30 ; 128K?
|
|
|
|
beq + ; yes, continue
|
|
|
|
- jmp QuitToProDOS
|
|
|
|
+ inc ; 65C02-only INC instruction will clear Z flag
|
|
|
|
beq - ; if Z flag is still set, this is not a 65C02
|
|
|
|
|
2018-04-18 20:39:59 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; disconnect ProDOS /RAM disk in S3,D2
|
|
|
|
; (does not affect other RAM disks like RAMWorks or RAMFactor)
|
|
|
|
; see ProDOS TechNote #26 Polite Use of Auxiliary Memory
|
|
|
|
; and ProDOS 8 Technical Reference Manual 5.2.2.2 Disconnecting /RAM
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
lda RAM32
|
|
|
|
cmp NODEV
|
2018-04-19 14:05:48 +00:00
|
|
|
bne @maybeRAMdisk
|
2018-04-18 20:39:59 +00:00
|
|
|
lda RAM32+1
|
|
|
|
cmp NODEV+1
|
2018-04-19 14:05:48 +00:00
|
|
|
beq @noRAMdisk
|
|
|
|
@maybeRAMdisk
|
|
|
|
ldy DEVCNT
|
2018-04-18 20:39:59 +00:00
|
|
|
- lda DEVLST, y
|
|
|
|
and #$F3
|
|
|
|
cmp #$B3
|
2018-04-19 14:05:48 +00:00
|
|
|
beq @foundRAMdisk
|
2018-04-18 20:39:59 +00:00
|
|
|
dey
|
|
|
|
bpl -
|
2018-04-19 14:05:48 +00:00
|
|
|
bmi @noRAMdisk
|
|
|
|
@foundRAMdisk
|
2018-04-18 20:39:59 +00:00
|
|
|
- lda DEVLST+1, y ; move other devices up in list
|
|
|
|
sta DEVLST, y
|
|
|
|
beq + ; device list is zero-terminated
|
|
|
|
iny
|
|
|
|
bne - ; always branches
|
2018-04-19 02:01:24 +00:00
|
|
|
+ lda NODEV ; tell ProDOS there's no RAM disk anymore
|
2018-04-18 20:39:59 +00:00
|
|
|
sta RAM32
|
|
|
|
lda NODEV+1
|
|
|
|
sta RAM32+1
|
|
|
|
dec DEVCNT ; reduce ProDOS device count
|
2018-04-19 14:05:48 +00:00
|
|
|
@noRAMdisk
|
2018-04-18 20:39:59 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; clear options script and make checksum invalid
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
ldy #(kOnBeyondChecksum-kOnBeyondOptionsStruct)
|
|
|
|
lda #0
|
|
|
|
- sta kOnBeyondOptionsStruct,y
|
|
|
|
dey
|
|
|
|
bpl -
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; load file with master game list
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
jsr LoadFile ; load prefs file at $2000
|
2018-04-19 02:01:24 +00:00
|
|
|
!word kGamesListFilename
|
|
|
|
- !word $2000
|
2018-04-18 20:39:59 +00:00
|
|
|
!word kProDOSFileBuffer
|
|
|
|
|
|
|
|
jsr ParseKeyValueText ; parse contents into games list store
|
|
|
|
!word gGamesListStore
|
2018-04-19 02:01:24 +00:00
|
|
|
!word -
|
2018-04-18 20:39:59 +00:00
|
|
|
!byte 0
|
|
|
|
|
|
|
|
+LDAY SRC
|
|
|
|
+STAY gGlobalPrefsStore ; save pointer to free space for next store
|
|
|
|
bra +
|
|
|
|
|
2018-04-19 02:01:24 +00:00
|
|
|
kGamesListFilename
|
2018-04-18 20:39:59 +00:00
|
|
|
!byte 10
|
|
|
|
!raw "GAMES.CONF"
|
|
|
|
+
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; load global options and state (including current game) from file and populate
|
|
|
|
; global prefs store
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
stz gGlobalPrefsDirty
|
|
|
|
jsr LoadFile ; load prefs file at $2000
|
|
|
|
!word kGlobalPrefsFilename
|
2018-04-19 02:01:24 +00:00
|
|
|
- !word kGlobalPrefsBuffer
|
2018-04-18 20:39:59 +00:00
|
|
|
!word kProDOSFileBuffer
|
|
|
|
|
|
|
|
jsr ParseKeyValueText ; parse contents into global prefs store
|
|
|
|
!word gGlobalPrefsStore
|
2018-04-19 02:01:24 +00:00
|
|
|
!word -
|
2018-04-18 20:39:59 +00:00
|
|
|
!byte 16
|
|
|
|
|
|
|
|
+LDAY SRC
|
|
|
|
+STAY gVersionsStore ; save pointer to free space for next store
|
2018-04-19 02:01:24 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; get current game description and game-specific options
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
jsr LoadGameInfo
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; initialize WeeGUI and enable mouse support
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
jsr WGInit
|
|
|
|
ldx #WGEnableMouse
|
|
|
|
jsr WeeGUI
|