1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-25 06:31:25 +00:00
C02/include/run6502/direct.a02
2020-10-14 10:59:25 -04:00

51 lines
1.8 KiB
Plaintext

; C02 Module direct Assembly Language Routines for run6502 emulator
; This is the reference implementation of the direct module
; Requires external function FSCMD and FSDRVN (fileio.h02)
SUBROUTINE DIRECT
TOPDIR BYTE "/",0 ;Root Directory
UPDIR BYTE "..",0 ;Parent Directory
;getcwd(drv, &dir) - Get Current Directory
;Args: A = Drive Identifier
; Y,X = Pointer to String
;Returns: A = Length of Directory Name
; Y = Error Code (0 = None)
GETCWD: JSR FSADDR ;Set String Buffer Address
TAY ;Set Drive ID
CLC ;Set Mode to GETCWD
LDA #'U' ;Set Command to GETSETDIR
.FSCMDX JSR FSCMD ;Execute Command
TXA ;Return Length of Name
RTS
;chdir(drv, &dir) - Set Current Directory
;Args: A = Drive Identifier
; Y,X = Pointer to String
;Returns: A = Error Code (0 = None)
CHDIR: JSR FSNAME ;Set Directory Name
TAY ;Set Drive ID
SEC ;Set Mode to CHDIR
LDA #'U' ;Set Command to GETSETDIR
.FSCMDY JSR FSCMD ;Execute Command
TYA ;Return Length of Name
RTS
;rmdir(drv, &dir) - Create Directory
;Args: A = Drive Identifier
; Y,X = Address of Directory Name String
;Returns: A = Error Code (0 = None)
RMDIR: SEC ;Set Mode to RMDIR
BCS .MRDIR ;Execute MKRMDIR and Return Result
;mkdir(drv, &dir) - Create Directory
;Args: A = Drive Identifier
; Y,X = Address of Directory Name String
;Returns: A = Error Code (0 = None)
MKDIR: CLC ;Set Mode to MKDIR
.MRDIR JSR FSNAME ;Set Directory Name
TAY ;Set Drive ID
LDA #'X' ;Set Command to MKRMDIR
BNE .FSCMDY ;Execute Command and Return Result