-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathincRenameCommand.asm
50 lines (40 loc) · 2.16 KB
/
incRenameCommand.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;*******************************************************************************
;* Rename Routine *
;* Syntax : rename or r shifted E 'file1' to 'file2' *
;*******************************************************************************
RENAME
lda #"r" ; DOS Command for RENAME
;*******************************************************************************
;* ProcessToFrom Routine *
;* Finds the filename 1 and filename 2 *
;*******************************************************************************
;* End Result of this should be a dos command like : *
;* ?:FileName2=Filename1 *
;*******************************************************************************
ProcessFromToCommand
sta DosCommandBuffer ; Store in DOS Buffer
lda #CHR_Colon ; DOS Command seperator ':'
sta DosCommandBuffer+1 ; Store in character character of Buffer
ldy #0 ; Init Y
CHRGETSpaceCheck 255
GetFilenameFromCommandLine FREERAM
CHRGETSpaceCheck CHR_Space
sty FREERAMLAST ; Temp Store Dos Buffer Index Away
GetTOFromCommandLine
jsr CHRGET ; Get Next Character from command line
ldy #2 ; Start Index Y @ 2
CHRGETSpaceCheck 255
GetFilenameFromCommandLine DosCommandBuffer
CHRGETSpaceCheck CHR_Space
lda #CHR_Equals ; Load '='
sta DosCommandBuffer,y ; store in DOS Buffer
iny ; Increase Y Index
ldx #0 ; Init X Index
@GetSecondFileName
lda FREERAM,x ; Load Character From First FileName
sta DosCommandBuffer,y ; Store in DOS Buffer
iny ; Increase DOS Buffer Index
inx ; Increase Filename1 Index
cpx FREERAMLAST ; Compare X with length of Filename1
bne @GetSecondFileName ; Not got there yet, go back for next character
jmp DOS ; Perform DOS Command