mirror of
https://github.com/a2-4am/4cade.git
synced 2024-09-27 12:57:21 +00:00
98 lines
2.1 KiB
Plaintext
98 lines
2.1 KiB
Plaintext
;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 "/"
|
|
|
|
kHGRTitleDirectory
|
|
!byte 9
|
|
!raw "TITLE.HGR"
|
|
|
|
kDHGRTitleDirectory
|
|
!byte 10
|
|
!raw "TITLE.DHGR"
|
|
|
|
kHGRActionDirectory
|
|
!byte 10
|
|
!raw "ACTION.HGR"
|
|
|
|
kDHGRActionDirectory
|
|
!byte 11
|
|
!raw "ACTION.DHGR"
|
|
|
|
kSHRArtworkDirectory
|
|
!byte 11
|
|
!raw "ARTWORK.SHR"
|
|
|
|
kAttractModeSlideshowDirectory
|
|
!byte 2
|
|
!raw "SS"
|
|
|
|
kDemoDirectory
|
|
!byte 4
|
|
!raw "DEMO"
|
|
|
|
kGameDirectory
|
|
!byte 1
|
|
!raw "X"
|
|
|
|
kFXDirectory
|
|
!byte 2
|
|
!raw "FX"
|
|
|
|
;------------------------------------------------------------------------------
|
|
; ResetPath
|
|
; reset gPathname to length 0
|
|
;
|
|
; in: none
|
|
; out: X = 0
|
|
; A/Y preserved
|
|
;------------------------------------------------------------------------------
|
|
ResetPath
|
|
ldx #0
|
|
stx gPathname
|
|
rts
|
|
|
|
;------------------------------------------------------------------------------
|
|
; 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
|
|
; $00/$01 clobbered
|
|
; gPathname updated with concatenated length-prefixed string
|
|
;------------------------------------------------------------------------------
|
|
SetPath
|
|
jsr ResetPath
|
|
; execution falls through here
|
|
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
|