diff --git a/src/constants.a b/src/constants.a index d43337595..1d6aa0579 100644 --- a/src/constants.a +++ b/src/constants.a @@ -9,7 +9,7 @@ ; D000..E611 - persistent data structures (per-game cheat categories, ; gGlobalPrefsStore, gGamesListStore) ; ...unused... -; EC41..FFF9 - main program code +; EC5F..FFF9 - main program code ; FFFA..FFFF - NMI, reset, IRQ vectors ; ; LC RAM BANK 2 @@ -99,7 +99,7 @@ BestMatchIndex = $FD ; byte ; $FF ; used by ParseGamesList ; main memory -gPathname = $1F00 ; used by SetPath/AddToPath +gPathname = $BFD0 ; used by SetPath/AddToPath gKeyLen = $1F00 ; used by ParseGamesList gKey = $1F01 UILine1 = $1FB0 diff --git a/src/glue.launch.a b/src/glue.launch.a index d0c801ae9..28ef35de2 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -105,35 +105,47 @@ PlayGame @pfile !word $FDFD !word $0106 - ldx #1 ; construct path to game's startup file - sec ; which is always /X/game/game - !byte $2c --- pha - clc - php - ldy #0 - lda (SAVE), y - tay - iny - sty MAX - ldy #0 - lda #'X' - sta ProDOS_prefix+1 - lda #'/' -- inx - sta ProDOS_prefix, x - iny - lda (SAVE), y - cpy MAX - bne - - txa - plp - bcs -- - stx ProDOS_prefix + ; we start by placing the subdirectory name at gPathname+kGameDirectoryLen + ; to leave room for the GameDirectory name as the parent + lda #kGameDirectoryLen + sta gPathname + +LDAY SAVE + jsr AddToPath + + ; then we save the length of the resulting string without the count byte + + ldx gPathname + dex + txa + pha + + ; attach the separator + + inc gPathname + lda #'/' + sta gPathname+1,x + + ; then attach the game name + + +LDAY SAVE + jsr AddToPath + + ; don't look while I do this + ; we "place" a string at gPathname+kGameDirectoryLen + ; whose length is the subdirectory name and game name + ; then we load it + ; the load sets the path to the GameDirectory + ; and then finds the subdirectory name and game name right after it + ; and attaches it to the path by overwriting the count byte + + sec + lda gPathname + sbc #kGameDirectoryLen + sta gPathname+kGameDirectoryLen jsr LoadFile ; load the game startup file - !word kRootDirectory - !word ProDOS_prefix + !word kGameDirectory + !word gPathname+kGameDirectoryLen !word 0 ; use file's default address pla diff --git a/src/prodos.impl.a b/src/prodos.impl.a index 7d44875aa..41638328c 100644 --- a/src/prodos.impl.a +++ b/src/prodos.impl.a @@ -524,7 +524,7 @@ ProDOS_fatal ;only for debugging, will be removed ;;*=$bf58 ;; !fill $18 ;filled by init instead -ProDOS_prefix=$bfd0 +ProDOS_prefix=gPathname ; !fill $2e } end_promote diff --git a/src/prodos.path.a b/src/prodos.path.a index 805f3f251..090134b14 100644 --- a/src/prodos.path.a +++ b/src/prodos.path.a @@ -51,6 +51,7 @@ kDemoDirectory kGameDirectory !byte 2 !raw "X/" +kGameDirectoryLen = 3 ; we need this elsewhere kFXDirectory !byte 3 @@ -144,7 +145,3 @@ AddToPath stx gPathname @done rts - -;!if >kTitleFile != >kCoverFile { -; !error ">kTitleFile != >kCoverFile, uncomment LoadTitleOffscreen block in ui.offscreen and disable this check" -;} diff --git a/src/ui.animation.a b/src/ui.animation.a index d9f35c314..c065ae174 100644 --- a/src/ui.animation.a +++ b/src/ui.animation.a @@ -42,13 +42,6 @@ MaybeAnimateTitle + !word $FDFD !word 0 - ldy kAnimatedTitleDirectory - sty ProDOS_prefix ; temporarily set 'root' directory to -- lda kAnimatedTitleDirectory,y;/title.animated/ so animation file - sta ProDOS_prefix, y ; can load other files in the same subdirectory - dey - bne - - ldx #5 ; copy prelaunch code - lda @titleAnimPrelaunch,x sta $106,x diff --git a/src/ui.attract.mode.a b/src/ui.attract.mode.a index 6ad687742..61c8e7975 100644 --- a/src/ui.attract.mode.a +++ b/src/ui.attract.mode.a @@ -150,13 +150,6 @@ RunAttractModule !word kStandardPrelaunch !word $0106 - ldy kDemoDirectory - sty ProDOS_prefix ; temporarily set 'root' directory to -- lda kDemoDirectory, y ; /demos/ directory so demos can can load - sta ProDOS_prefix, y ; other resources in the same directory - dey - bne - - jsr LoadFile ; load self-running demo into its default address (varies) !word kDemoDirectory @key !word $FDFD