2018-02-07 14:05:24 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018 by 4am
|
|
|
|
;
|
|
|
|
; Game descriptions and configuration
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - LoadGameInfo
|
|
|
|
;
|
|
|
|
; Public variables
|
|
|
|
; - gCurrentGame
|
|
|
|
;
|
2018-02-07 21:02:14 +00:00
|
|
|
; Public constants
|
|
|
|
; - kNumberOfGames
|
|
|
|
; - GAMES
|
|
|
|
;
|
2018-02-07 14:05:24 +00:00
|
|
|
|
|
|
|
!zone {
|
2018-02-12 00:17:28 +00:00
|
|
|
kNumberOfGames = 32
|
2018-02-07 21:02:14 +00:00
|
|
|
gCurrentGame
|
|
|
|
!byte $FD ; set at runtime
|
2018-02-08 17:00:20 +00:00
|
|
|
kTextRootDirectory
|
2018-02-03 17:01:34 +00:00
|
|
|
!byte 5
|
2018-02-08 17:00:20 +00:00
|
|
|
!raw "TEXT/"
|
2018-02-07 21:02:14 +00:00
|
|
|
GAMES ; length of this array must = kNumberOfGames, there is no range checking
|
2018-02-10 03:26:32 +00:00
|
|
|
!word .amfv
|
2018-02-03 16:45:41 +00:00
|
|
|
!word .ballyhoo
|
2018-02-10 03:26:32 +00:00
|
|
|
!word .beyondzork
|
|
|
|
!word .borderzone
|
|
|
|
!word .bureaucracy
|
2018-02-03 16:45:41 +00:00
|
|
|
!word .cutthroats
|
|
|
|
!word .deadline
|
|
|
|
!word .enchanter
|
|
|
|
!word .hgttg
|
|
|
|
!word .hollywoodhijinx
|
|
|
|
!word .infidel
|
|
|
|
!word .leathergoddesses
|
|
|
|
!word .lurkinghorror
|
|
|
|
!word .minizork
|
|
|
|
!word .moonmist
|
|
|
|
!word .planetfall
|
|
|
|
!word .plunderedhearts
|
|
|
|
!word .seastalker
|
2018-02-11 23:46:58 +00:00
|
|
|
!word .sherlock
|
2018-02-03 16:45:41 +00:00
|
|
|
!word .sorcerer
|
|
|
|
!word .spellbreaker
|
|
|
|
!word .starcross
|
|
|
|
!word .stationfall
|
|
|
|
!word .suspect
|
|
|
|
!word .suspended
|
2018-02-12 00:04:06 +00:00
|
|
|
!word .trinity
|
2018-02-03 16:45:41 +00:00
|
|
|
!word .wishbringer
|
|
|
|
!word .witness
|
|
|
|
!word .zorki
|
|
|
|
!word .zorkii
|
|
|
|
!word .zorkiii
|
2018-02-12 00:17:28 +00:00
|
|
|
!word .ztuu
|
2018-02-05 15:04:35 +00:00
|
|
|
|
|
|
|
; length-prefixed names of each subdirectory in game directory, 1 per game
|
2018-02-10 03:26:32 +00:00
|
|
|
.amfv
|
|
|
|
!byte 4
|
|
|
|
!raw "AMFV"
|
2018-02-03 16:45:41 +00:00
|
|
|
.ballyhoo
|
|
|
|
!byte 8
|
|
|
|
!raw "BALLYHOO"
|
2018-02-10 03:26:32 +00:00
|
|
|
.beyondzork
|
|
|
|
!byte 11
|
|
|
|
!raw "BEYOND.ZORK"
|
|
|
|
.borderzone
|
|
|
|
!byte 11
|
|
|
|
!raw "BORDER.ZONE"
|
|
|
|
.bureaucracy
|
|
|
|
!byte 11
|
|
|
|
!raw "BUREAUCRACY"
|
2018-02-03 16:45:41 +00:00
|
|
|
.cutthroats
|
|
|
|
!byte 10
|
|
|
|
!raw "CUTTHROATS"
|
|
|
|
.deadline
|
|
|
|
!byte 8
|
|
|
|
!raw "DEADLINE"
|
|
|
|
.enchanter
|
|
|
|
!byte 9
|
|
|
|
!raw "ENCHANTER"
|
|
|
|
.hgttg
|
|
|
|
!byte 5
|
|
|
|
!raw "HGTTG"
|
|
|
|
.hollywoodhijinx
|
|
|
|
!byte 9
|
|
|
|
!raw "HOLLYWOOD"
|
|
|
|
.infidel
|
|
|
|
!byte 7
|
|
|
|
!raw "INFIDEL"
|
|
|
|
.leathergoddesses
|
|
|
|
!byte 4
|
|
|
|
!raw "LGOP"
|
|
|
|
.lurkinghorror
|
|
|
|
!byte 14
|
|
|
|
!raw "LURKING.HORROR"
|
|
|
|
.minizork
|
|
|
|
!byte 9
|
|
|
|
!raw "MINI.ZORK"
|
|
|
|
.moonmist
|
|
|
|
!byte 8
|
|
|
|
!raw "MOONMIST"
|
|
|
|
.planetfall
|
|
|
|
!byte 10
|
|
|
|
!raw "PLANETFALL"
|
|
|
|
.plunderedhearts
|
|
|
|
!byte 9
|
|
|
|
!raw "PLUNDERED"
|
|
|
|
.seastalker
|
|
|
|
!byte 10
|
|
|
|
!raw "SEASTALKER"
|
2018-02-11 23:46:58 +00:00
|
|
|
.sherlock
|
|
|
|
!byte 8
|
|
|
|
!raw "SHERLOCK"
|
2018-02-03 16:45:41 +00:00
|
|
|
.sorcerer
|
|
|
|
!byte 8
|
|
|
|
!raw "SORCERER"
|
|
|
|
.spellbreaker
|
|
|
|
!byte 12
|
|
|
|
!raw "SPELLBREAKER"
|
|
|
|
.starcross
|
|
|
|
!byte 9
|
|
|
|
!raw "STARCROSS"
|
|
|
|
.stationfall
|
|
|
|
!byte 11
|
|
|
|
!raw "STATIONFALL"
|
|
|
|
.suspect
|
|
|
|
!byte 7
|
|
|
|
!raw "SUSPECT"
|
|
|
|
.suspended
|
|
|
|
!byte 9
|
|
|
|
!raw "SUSPENDED"
|
2018-02-12 00:04:06 +00:00
|
|
|
.trinity
|
|
|
|
!byte 7
|
|
|
|
!raw "TRINITY"
|
2018-02-03 16:45:41 +00:00
|
|
|
.wishbringer
|
|
|
|
!byte 11
|
|
|
|
!raw "WISHBRINGER"
|
|
|
|
.witness
|
|
|
|
!byte 7
|
|
|
|
!raw "WITNESS"
|
|
|
|
.zorki
|
|
|
|
!byte 6
|
|
|
|
!raw "ZORK.I"
|
|
|
|
.zorkii
|
|
|
|
!byte 7
|
|
|
|
!raw "ZORK.II"
|
|
|
|
.zorkiii
|
|
|
|
!byte 8
|
|
|
|
!raw "ZORK.III"
|
2018-02-12 00:17:28 +00:00
|
|
|
.ztuu
|
|
|
|
!byte 4
|
|
|
|
!raw "ZTUU"
|
2018-02-03 17:01:34 +00:00
|
|
|
|
2018-02-07 14:05:24 +00:00
|
|
|
.BEGIN_PARSER_DATA
|
|
|
|
bInSectionName
|
|
|
|
!byte 0
|
|
|
|
bFoundCR
|
|
|
|
!byte 0
|
|
|
|
iSection
|
|
|
|
!byte 0
|
|
|
|
iSectionsFound
|
|
|
|
!byte 0
|
|
|
|
|
|
|
|
; array of pointers to start of each section (order must match code)
|
|
|
|
sectionPointers
|
|
|
|
addrInfo
|
|
|
|
!word 0
|
|
|
|
addrDescription
|
|
|
|
!word 0
|
|
|
|
addrVersions
|
|
|
|
!word 0
|
|
|
|
.END_PARSER_DATA
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; LoadGameInfo
|
|
|
|
; load file with information about the current game
|
|
|
|
;
|
|
|
|
; in: gCurrentGame between 0 and (kNumberOfGames-1)
|
|
|
|
; out: if success, C clear and addrInfo, addrDescription, addrVersions
|
|
|
|
; populated with pointers to parsed data
|
|
|
|
; if error, C set
|
|
|
|
; all other registers and flags clobbered
|
|
|
|
;------------------------------------------------------------------------------
|
2018-02-03 17:01:34 +00:00
|
|
|
LoadGameInfo
|
2018-02-07 21:02:14 +00:00
|
|
|
jsr ResetPath
|
2018-02-08 17:00:20 +00:00
|
|
|
lda #<kTextRootDirectory
|
|
|
|
ldy #>kTextRootDirectory
|
2018-02-07 21:02:14 +00:00
|
|
|
jsr AddToPath
|
2018-02-05 15:04:35 +00:00
|
|
|
lda gCurrentGame
|
2018-02-03 17:01:34 +00:00
|
|
|
asl
|
|
|
|
tax
|
2018-02-07 21:02:14 +00:00
|
|
|
lda GAMES,x
|
|
|
|
ldy GAMES+1,x
|
|
|
|
jsr AddToPath
|
2018-02-05 15:04:35 +00:00
|
|
|
|
|
|
|
jsr LoadFile
|
2018-02-07 21:02:14 +00:00
|
|
|
!word gPathname
|
2018-02-03 17:01:34 +00:00
|
|
|
!word $0800
|
|
|
|
!word $1400
|
2018-02-09 01:38:26 +00:00
|
|
|
!word kProDOSFileBuffer
|
2018-02-07 14:05:24 +00:00
|
|
|
bcc .parseGameInfo
|
|
|
|
rts
|
2018-02-05 17:17:06 +00:00
|
|
|
|
2018-02-07 14:05:24 +00:00
|
|
|
.parseGameInfo
|
2018-02-05 17:17:06 +00:00
|
|
|
ldx #9 ; .END_PARSER_DATA-.BEGIN_PARSER_DATA-1
|
|
|
|
- stz .BEGIN_PARSER_DATA,x
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
stz $00
|
|
|
|
lda #$08
|
|
|
|
sta $01
|
|
|
|
lda mlilen
|
|
|
|
sta $02
|
|
|
|
lda mlilen+1
|
|
|
|
sta $03
|
|
|
|
parseloop
|
|
|
|
lda ($00)
|
2018-02-11 17:41:39 +00:00
|
|
|
cmp #$0A ; LF -> 0x00 (WeeGUI wants null-terminated strings)
|
2018-02-08 21:28:49 +00:00
|
|
|
bne .notCR
|
2018-02-05 17:17:06 +00:00
|
|
|
lda #$00
|
|
|
|
sta ($00)
|
|
|
|
lda #$FF
|
|
|
|
sta bFoundCR
|
|
|
|
bra .next
|
2018-02-08 21:28:49 +00:00
|
|
|
.notCR
|
|
|
|
cmp #$5B ; '[' is section name start delimiter
|
2018-02-05 17:17:06 +00:00
|
|
|
beq .startsectionname
|
|
|
|
cmp #$5D ; ']' is section name end delimiter
|
|
|
|
beq .endsectionname
|
|
|
|
bit bInSectionName
|
|
|
|
bmi .parsesectionname
|
|
|
|
bvs .next
|
2018-02-05 21:29:29 +00:00
|
|
|
tax
|
|
|
|
beq .nohighbit
|
2018-02-08 21:28:49 +00:00
|
|
|
cmp #$5E ; '^' -> closed-apple mousetext
|
2018-02-05 21:29:29 +00:00
|
|
|
bne +
|
|
|
|
lda #$40
|
|
|
|
sta ($00)
|
|
|
|
bra .nohighbit
|
|
|
|
+ cmp #$26 ; '&' -> open-apple mousetext
|
|
|
|
bne .highbit
|
|
|
|
lda #$41
|
|
|
|
sta ($00)
|
|
|
|
bra .nohighbit
|
|
|
|
.highbit
|
|
|
|
ora #$80
|
|
|
|
sta ($00)
|
|
|
|
.nohighbit
|
2018-02-05 17:17:06 +00:00
|
|
|
bit bFoundCR
|
|
|
|
bpl .next
|
|
|
|
stz bFoundCR
|
|
|
|
lda iSection
|
|
|
|
beq .next
|
|
|
|
; We found the start of the first line after the end of the section name.
|
|
|
|
; Save this address in the sectionPointers array.
|
|
|
|
asl
|
|
|
|
tax
|
|
|
|
lda $00
|
|
|
|
sta sectionPointers-2,x
|
|
|
|
lda $01
|
|
|
|
sta sectionPointers-1,x
|
|
|
|
stz iSection
|
|
|
|
bra .next
|
|
|
|
.startsectionname
|
|
|
|
lda #%11000000
|
|
|
|
sta bInSectionName
|
|
|
|
bra .next
|
|
|
|
.endsectionname
|
|
|
|
stz bInSectionName
|
|
|
|
bra .next
|
|
|
|
.parsesectionname
|
|
|
|
pha
|
|
|
|
lda #%01000000
|
|
|
|
sta bInSectionName
|
|
|
|
pla
|
|
|
|
cmp #$69 ; 'i'nfo
|
|
|
|
beq .info
|
|
|
|
cmp #$64 ; 'd'escription
|
|
|
|
beq .description
|
|
|
|
cmp #$76 ; 'v'ersions
|
|
|
|
beq .versions
|
|
|
|
bne .next
|
|
|
|
.info
|
|
|
|
lda #1
|
|
|
|
!byte $2C ; hide next LDA
|
|
|
|
.description
|
|
|
|
lda #2
|
|
|
|
!byte $2C ; hide next LDA
|
|
|
|
.versions
|
|
|
|
lda #3
|
|
|
|
sta iSection
|
|
|
|
inc iSectionsFound
|
|
|
|
.next
|
|
|
|
inc $00
|
|
|
|
bne +
|
|
|
|
inc $01
|
|
|
|
+ dec $02
|
|
|
|
bne +
|
|
|
|
dec $03
|
|
|
|
bmi .done
|
|
|
|
+ jmp parseloop
|
|
|
|
.done
|
|
|
|
lda iSectionsFound
|
|
|
|
cmp #$03
|
|
|
|
bne +
|
|
|
|
clc
|
|
|
|
rts
|
|
|
|
+ sec
|
2018-02-03 17:01:34 +00:00
|
|
|
rts
|
2018-02-05 17:17:06 +00:00
|
|
|
}
|