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-21 01:39:21 +00:00
|
|
|
kNumberOfGames = 33
|
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
|
2018-02-21 01:39:21 +00:00
|
|
|
!word .nordandbert
|
2018-02-03 16:45:41 +00:00
|
|
|
!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"
|
2018-02-21 01:39:21 +00:00
|
|
|
.nordandbert
|
|
|
|
!byte 13
|
|
|
|
!raw "NORD.AND.BERT"
|
2018-02-03 16:45:41 +00:00
|
|
|
.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-03-03 22:45:39 +00:00
|
|
|
sectionPointers ; array of pointers to start of each section
|
|
|
|
addrVersions
|
2018-02-07 14:05:24 +00:00
|
|
|
!word 0
|
|
|
|
addrDescription
|
|
|
|
!word 0
|
2018-03-03 22:45:39 +00:00
|
|
|
addrInfo
|
2018-02-07 14:05:24 +00:00
|
|
|
!word 0
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; LoadGameInfo
|
|
|
|
; load file with information about the current game
|
|
|
|
;
|
|
|
|
; in: gCurrentGame between 0 and (kNumberOfGames-1)
|
2018-03-03 22:45:39 +00:00
|
|
|
; out: addrInfo, addrDescription, addrVersions populated
|
|
|
|
; all registers and flags clobbered
|
2018-02-07 14:05:24 +00:00
|
|
|
;------------------------------------------------------------------------------
|
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-05 17:17:06 +00:00
|
|
|
|
|
|
|
lda #$FF
|
2018-03-03 22:45:39 +00:00
|
|
|
sta $00
|
|
|
|
lda #$07
|
|
|
|
sta $01 ; ($00) points to start of data buffer
|
|
|
|
ldy #$00 ; index into ($00) pointing to current character
|
|
|
|
ldx #$04 ; index into sectionPointers array, stores pointer to start of each section
|
|
|
|
|
|
|
|
.convertSectionLoop
|
|
|
|
jsr IncAndGetChar
|
|
|
|
.convertSectionNoInc
|
|
|
|
cmp #$5B ; '['
|
|
|
|
beq .skipSectionName
|
|
|
|
cmp #$0A ; LF -> 0x00 (WeeGUI wants null-terminated strings)
|
|
|
|
beq .null
|
2018-02-08 21:28:49 +00:00
|
|
|
cmp #$5E ; '^' -> closed-apple mousetext
|
2018-03-03 22:45:39 +00:00
|
|
|
beq .ca
|
|
|
|
cmp #$26 ; '&' -> open-apple mousetext
|
|
|
|
beq .oa
|
2018-02-05 21:29:29 +00:00
|
|
|
ora #$80
|
2018-03-03 22:45:39 +00:00
|
|
|
!byte $2C
|
|
|
|
.null lda #$00
|
|
|
|
!byte $2C
|
|
|
|
.ca lda #$40
|
|
|
|
!byte $2C
|
|
|
|
.oa lda #$41
|
2018-03-03 16:41:09 +00:00
|
|
|
sta ($00),y
|
2018-03-03 22:45:39 +00:00
|
|
|
bra .convertSectionLoop
|
|
|
|
|
|
|
|
; We found the start of a new section, so skip to the first character on the next line
|
|
|
|
.skipSectionName
|
|
|
|
jsr IncAndGetChar
|
|
|
|
cmp #$0A ; LF
|
|
|
|
bne .skipSectionName
|
|
|
|
jsr IncAndGetChar
|
|
|
|
|
|
|
|
; We are at the start of a section, so save this address in the sectionPointers array
|
|
|
|
pha
|
2018-03-03 16:41:09 +00:00
|
|
|
tya
|
|
|
|
clc
|
|
|
|
adc $00
|
2018-03-03 22:45:39 +00:00
|
|
|
sta sectionPointers,x
|
2018-02-05 17:17:06 +00:00
|
|
|
lda $01
|
2018-03-03 16:41:09 +00:00
|
|
|
bcc +
|
|
|
|
inc
|
2018-03-03 22:45:39 +00:00
|
|
|
+ sta sectionPointers+1,x
|
2018-02-05 17:17:06 +00:00
|
|
|
pla
|
2018-03-03 22:45:39 +00:00
|
|
|
dex
|
|
|
|
dex
|
|
|
|
bpl .convertSectionNoInc
|
|
|
|
|
|
|
|
IncAndGetChar
|
|
|
|
iny
|
2018-02-05 17:17:06 +00:00
|
|
|
bne +
|
|
|
|
inc $01
|
2018-03-03 22:45:39 +00:00
|
|
|
+ lda ($00),y
|
2018-02-03 17:01:34 +00:00
|
|
|
rts
|
2018-02-05 17:17:06 +00:00
|
|
|
}
|