;license:MIT ;(c) 2018-9 by 4am ; ; ProDOS - functions for constructing and passing around ProDOS pathnames ; ; Public functions ; - SetPath ; - AddToPath ; kHGRTitleDirectory !byte 10 !raw "TITLE.HGR/" kDHGRTitleDirectory !byte 11 !raw "TITLE.DHGR/" kHGRActionDirectory !byte 11 !raw "ACTION.HGR/" kDHGRActionDirectory !byte 12 !raw "ACTION.DHGR/" kGRActionDirectory !byte 10 !raw "ACTION.GR/" kSHRArtworkDirectory !byte 12 !raw "ARTWORK.SHR/" kMiniAttractDirectory !byte 8 !raw "ATTRACT/" kAttractModeSlideshowDirectory !byte 3 !raw "SS/" kDemoDirectory !byte 5 !raw "DEMO/" kGameDirectory !byte 2 !raw "X/" kFXDirectory !byte 3 !raw "FX/" kPrelaunchDirectory !byte 10 !raw "PRELAUNCH/" kStandardPrelaunch !byte 8 !raw "STANDARD" kGlobalPrefsFilename !byte 10 !raw "PREFS.CONF" kAttractModeConfFile !byte 12 !raw "ATTRACT.CONF" kFXConfFile !byte 7 !raw "FX.CONF" kDFXConfFile !byte 8 !raw "DFX.CONF" kCreditsFile !byte 7 !raw "CREDITS" kHelpFile !byte 4 !raw "HELP" kTitleFile !byte 5 !raw "TITLE" kCoverFile !byte 5 !raw "COVER" kCoverFadeFile !byte 9 !raw "COVERFADE" kGRFizzleFile !byte 9 !raw "GR.FIZZLE" kSFXFizzleFile !byte 10 !raw "SHR.FIZZLE" ;------------------------------------------------------------------------------ ; SetPath/AddToPath ; append a length-prefixed string to gPathname ; SetPath will reset the path first ; ; in: A contains low byte of address of length-prefixed string to append ; Y contains high byte of address of length-prefixed string to append ; out: all registers and flags clobbered ; $02/$03 (PTR/PTR+1) clobbered ; MAX clobbered ; gPathname updated with concatenated length-prefixed string ;------------------------------------------------------------------------------ SetPath kRootDirectory=*+1 ldx #0 stx gPathname ; execution falls through here AddToPath +STAY PTR ldy #0 lda (PTR),y ; length of this segment beq @done tay iny sty MAX ldx gPathname ; current pathname length ldy #$01 - lda (PTR),y sta gPathname+1,x inx iny cpy MAX bcc - stx gPathname @done rts !if >kTitleFile != >kCoverFile { !error ">kTitleFile != >kCoverFile, uncomment LoadTitleOffscreen block in ui.offscreen and disable this check" }