2018-09-13 13:53:04 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018 by 4am
|
|
|
|
;
|
|
|
|
; ProDOS - functions for constructing and passing around ProDOS pathnames
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - ResetPath
|
|
|
|
; - AddToPath
|
|
|
|
;
|
|
|
|
; Public constants
|
|
|
|
; - kPathSeparator
|
|
|
|
|
|
|
|
kPathSeparator
|
|
|
|
!byte 1
|
|
|
|
!raw "/"
|
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
kHGRTitleDirectory
|
2019-02-09 01:48:07 +00:00
|
|
|
!byte 9
|
|
|
|
!raw "TITLE.HGR"
|
|
|
|
|
|
|
|
kDHGRTitleDirectory
|
|
|
|
!byte 10
|
|
|
|
!raw "TITLE.DHGR"
|
2018-10-28 18:04:52 +00:00
|
|
|
|
2018-12-29 18:29:17 +00:00
|
|
|
kHGRActionDirectory
|
2019-02-09 01:48:07 +00:00
|
|
|
!byte 10
|
|
|
|
!raw "ACTION.HGR"
|
2018-12-29 18:29:17 +00:00
|
|
|
|
2019-02-09 01:48:07 +00:00
|
|
|
kDHGRActionDirectory
|
|
|
|
!byte 11
|
|
|
|
!raw "ACTION.DHGR"
|
2018-09-13 13:53:04 +00:00
|
|
|
|
2019-01-13 23:55:40 +00:00
|
|
|
kSHRArtworkDirectory
|
2019-02-09 01:48:07 +00:00
|
|
|
!byte 11
|
|
|
|
!raw "ARTWORK.SHR"
|
2019-01-13 23:55:40 +00:00
|
|
|
|
2018-10-27 22:47:27 +00:00
|
|
|
kAttractModeSlideshowDirectory
|
|
|
|
!byte 2
|
|
|
|
!raw "SS"
|
|
|
|
|
2018-10-28 21:20:48 +00:00
|
|
|
kDemoDirectory
|
|
|
|
!byte 4
|
|
|
|
!raw "DEMO"
|
|
|
|
|
2019-01-08 19:10:26 +00:00
|
|
|
kGameDirectory
|
|
|
|
!byte 1
|
|
|
|
!raw "X"
|
|
|
|
|
2018-10-29 23:23:43 +00:00
|
|
|
kFXDirectory
|
|
|
|
!byte 2
|
|
|
|
!raw "FX"
|
|
|
|
|
2018-09-13 13:53:04 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2019-06-19 02:40:17 +00:00
|
|
|
; SetPath/AddToPath
|
2018-09-13 13:53:04 +00:00
|
|
|
; append a length-prefixed string to gPathname
|
2019-06-19 02:40:17 +00:00
|
|
|
; SetPath will reset the path first
|
2018-09-13 13:53:04 +00:00
|
|
|
;
|
|
|
|
; 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
|
|
|
|
; $00/$01 clobbered
|
|
|
|
; gPathname updated with concatenated length-prefixed string
|
|
|
|
;------------------------------------------------------------------------------
|
2019-06-19 02:40:17 +00:00
|
|
|
SetPath
|
2019-06-20 17:56:31 +00:00
|
|
|
ldx #0
|
|
|
|
stx gPathname
|
2019-06-19 02:40:17 +00:00
|
|
|
; execution falls through here
|
2018-09-13 13:53:04 +00:00
|
|
|
AddToPath
|
|
|
|
+STAY $00
|
|
|
|
ldx gPathname ; current pathname length
|
|
|
|
ldy #0
|
|
|
|
lda ($00),y ; length of this segment
|
|
|
|
tay
|
|
|
|
iny
|
|
|
|
sty @len
|
|
|
|
ldy #$01
|
|
|
|
- lda ($00),y
|
|
|
|
sta gPathname+1,x
|
|
|
|
inx
|
|
|
|
iny
|
|
|
|
@len=*+1
|
|
|
|
cpy #$FD ; SMC
|
|
|
|
bcc -
|
|
|
|
stx gPathname
|
|
|
|
rts
|