4cade/src/prodos.path.a

74 lines
1.7 KiB
Plaintext
Raw Normal View History

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 "/"
kHGRScreenshotDirectory
2018-10-28 18:04:52 +00:00
!byte 3
!raw "HGR"
kDHGRScreenshotDirectory
!byte 4
!raw "DHGR"
2018-09-13 13:53:04 +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"
2018-09-13 13:53:04 +00:00
;------------------------------------------------------------------------------
; ResetPath
; reset gPathname to length 0
;
; in: none
; out: X = 0
; A/Y preserved
;------------------------------------------------------------------------------
ResetPath
ldx #0
stx gPathname
rts
;------------------------------------------------------------------------------
; AddToPath
; append a length-prefixed string to gPathname
;
; 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
;------------------------------------------------------------------------------
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