home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilsm
/
makealf
/
Source
/
s
/
finfo
next >
Wrap
Text File
|
1994-05-01
|
1KB
|
68 lines
; s.finfo
; routine to grab file information using OS_GBPB 11
; OS_File 23 would be better, but isn't RO2-friendly
; also included is a routine to split filename into directory & objname
; (non-destructively)
;
; int finfo(char *name, char *dirname, fileinfo *fblock);
; void fnsplit(const char *name, char *dbuf, char *nbuf);
GET h.asmregs
GET h.asmSWIs
AREA |A$$code|, CODE, READONLY
EXPORT finfo
EXPORT fnsplit
finfo MOV ip,sp
STMFD sp!,{r4-r6,lr}
MOV r6,r0
MOV r0,#11
MOV r4,#0
MOV r5,#256
floop MOV r3,#1
SWI SWI_OS_GBPB + XOS_Bit
BVS problem
BCS ok
CMN r4,#1
BNE floop
problem MOV r0,#1
LDMFD sp!,{r4-r6,pc}^
ok MOV r0,#0
LDMFD sp!,{r4-r6,pc}^
fnsplit STMFD sp!,{r4,r5,lr}
MOV r4,#0
STRB r4,[r1]
fnloop1 LDRB r3,[r0,r4]
CMP r3,#0
ADDNE r4,r4,#1
BNE fnloop1
fnloop2 SUBS r4,r4,#1
BLT nodot
LDRB r3,[r0,r4]
CMP r3,#'.'
BEQ dot
CMP r3,#':'
BNE fnloop2
ADD r5,r4,#1
MOV r3,#0
STRB r3,[r1,r5]
B fnloop3
dot MOV r5,r4
MOV r3,#0
STRB r3,[r1,r5]
fnloop3 SUBS r5,r5,#1
BLT nodot
LDRB r3,[r0,r5]
STRB r3,[r1,r5]
B fnloop3
nodot ADD r4,r4,#1
LDRB r3,[r0,r4]
STRB r3,[r2],#1
CMP r3,#0
BNE nodot
LDMFD sp!,{r4,r5,pc}^