parse game configuration files

This commit is contained in:
4am 2018-02-05 12:17:06 -05:00
parent c22701ca06
commit c67660ec4e
3 changed files with 144 additions and 25 deletions

View File

@ -3,7 +3,7 @@
1986 Mystery
Difficulty: ***..
Difficulty: ^^^&&
Spurred by your natural curiosity, you stick around after the show in the
@ -34,7 +34,7 @@ Every circus has its seedy underside. But few are as dangerous as this.
1984 Adventure
Difficulty: ***..
Difficulty: ^^^&&
In Cutthroats, you are a skilled diver living on Hardscrabble Island, a
@ -55,7 +55,7 @@ story, you may find yourself diving for a different treasure.
1982 Mystery
Difficulty: *****
Difficulty: ^^^^^
A wealthy industrialist, Mr. Marshall Robner, locked himself in the upstairs
@ -83,7 +83,7 @@ facts better than any other, and you will know it when you reach it.
1983 Fantasy
Difficulty: ***..
Difficulty: ^^^&&
Welcome to the World of the Enchanter saga - a world where magic is
@ -115,7 +115,7 @@ observation and quick wits.
1984 Sci-Fi
Difficulty: ***..
Difficulty: ^^^&&
Don't Panic!
@ -145,7 +145,7 @@ befuddle yourself.
1987 Adventure
Difficulty: ***..
Difficulty: ^^^&&
As a child, you spent most of your summers with your Aunt Hildegard and
@ -171,7 +171,7 @@ house, not too far from Hollywood...
1983 Adventure
Difficulty: ****.
Difficulty: ^^^^&
You like to think of yourself as a bold and adventurous soldier of fortune,
@ -197,7 +197,7 @@ reputation and self-esteem, are at stake. For you are branded INFIDEL.
1986 Comedy
Difficulty: ***..
Difficulty: ^^^&&
1936. In the United States, a new miracle fabric called nylon is becoming
@ -234,7 +234,7 @@ of Phobos and save humanity! Are you "up" for the job?
1987 Horror
Difficulty: ***..
Difficulty: ^^^&&
In The Lurking Horror, you are a student at G.U.E. Tech. You have braved a
@ -258,7 +258,7 @@ lead to sights so horrifying that they will feed your nightmares for weeks.
1986 Mystery
Difficulty: **...
Difficulty: ^^&&&
In Moonmist, you are a famous young American detective. An old friend,
@ -283,7 +283,7 @@ These mysteries and others are waiting to test your wits in Moonmist.
1983 Sci-Fi
Difficulty: ***..
Difficulty: ^^^&&
After the fall of the Second Galactic Union in 1716 GY, a ten-thousand-year
@ -320,7 +320,7 @@ out for the Stellar Patrol...
1987 Romance
Difficulty: **...
Difficulty: ^^&&&
Plundered Hearts is set in the late 1600s, where you are living the gentle
@ -340,7 +340,7 @@ encounter danger, adventure ... and more than a touch of romance.
1984 Adventure
Difficulty: *....
Difficulty: ^&&&&
Welcome to the world of Infocom's junior interactive fiction, a world where:
@ -365,7 +365,7 @@ monster that is attacking it!
1984 Fantasy
Difficulty: ****.
Difficulty: ^^^^&
Welcome to the World of the Enchanter saga - a world where magic is
@ -404,7 +404,7 @@ And now, unbeknownst to you, Belboz has vanished.
1985 Fantasy
Difficulty: *****
Difficulty: ^^^^^
Welcome to the World of the Enchanter saga - a world founded on magic, where
@ -431,7 +431,7 @@ conclave that the final conflict between good and evil begins to unfold.
1982 Sci-Fi
Difficulty: *****
Difficulty: ^^^^^
The year is 2186. Humanity has established colonies on the moon, Mars, and
@ -468,7 +468,7 @@ from the outer fringes of the galaxy.
1987 Sci-Fi
Difficulty: ****.
Difficulty: ^^^^&
After the fall of the Second Galactic Union in 1716 GY, a ten-thousand-year
@ -517,7 +517,7 @@ for Stellar Patrol Issue Regulation Black Form Binders Request Form Forms...
1984 Mystery
Difficulty: ****.
Difficulty: ^^^^&
Halloween night.
@ -544,7 +544,7 @@ The murderer is in your midst, laughing behind your back.
1983 Sci-Fi
Difficulty: *****
Difficulty: ^^^^^
You are the Central Mentality on an advanced semi-automated planet. You were
@ -570,7 +570,7 @@ robots, you must save the planet from destruction.
1985 Fantasy
Difficulty: **...
Difficulty: ^^&&&
In Wishbringer, you're a postal clerk in a small seaside village called
@ -591,7 +591,7 @@ your town safe again. And you only have a few hours!
1984 Mystery
Difficulty: ***..
Difficulty: ^^^&&
In The Witness, you are a police detective working near Los Angeles. The
@ -626,7 +626,7 @@ it.
1980 Fantasy
Difficulty: ***..
Difficulty: ^^^&&
Welcome to ZORK! You are about to experience a classic interactive fantasy,
@ -652,7 +652,7 @@ ZORK II: THE WIZARD
1981 Fantasy
Difficulty: ****.
Difficulty: ^^^^&
Welcome to ZORK! You are about to experience a classic interactive fantasy,
@ -676,7 +676,7 @@ realm, is to avoid his capricious tricks and learn to control his magic.
1982 Fantasy
Difficulty: ****.
Difficulty: ^^^^&
Welcome to ZORK! You are about to experience a classic interactive fantasy,

Binary file not shown.

View File

@ -113,6 +113,7 @@ subdirectories ; length of this array must = kNumberOfGame
!byte 8
!raw "ZORK.III"
!zone {
LoadGameInfo
stz .path
lda #<kGameDirectory
@ -133,8 +134,125 @@ LoadGameInfo
!word $0800
!word $1400
!word $1C00
rts
; initialize all parser data
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)
; Replace all carriage returns with zeroes,
; because WeeGUI wants zero-terminated strings
; but I want to be able to edit files in a text editor.
cmp #$0D
bne +
lda #$00
sta ($00)
lda #$FF
sta bFoundCR
bra .next
+ cmp #$5E ; '^' -> closed-apple mousetext
bne +
lda #$40
sta ($00)
+ cmp #$26 ; '&' -> open-apple mousetext
bne +
lda #$41
sta ($00)
+ cmp #$5B ; '[' is section name start delimiter
beq .startsectionname
cmp #$5D ; ']' is section name end delimiter
beq .endsectionname
bit bInSectionName
bmi .parsesectionname
bvs .next
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
rts
.BEGIN_PARSER_DATA
bInSectionName
!byte 0
bFoundCR
!byte 0
iSection
!byte 0
iSectionsFound
!byte 0
sectionPointers ; array of pointers to start of each section (order matches constants used by parser)
addrInfo
!word 0
addrDescription
!word 0
addrVersions
!word 0
.END_PARSER_DATA
addToPath
sta $00
@ -157,3 +275,4 @@ addToPath
!byte $FD ; set at runtime
.pathbuffer
!fill 64 ; enough zeroes for any ProDOS pathname
}