In   -
Out  string
Type AOF
Ver  1.00l

#Area "JFP:String" Code ReadOnly
#Rem Off
; *******************************************************************
; Subroutine:   strlen
; Description:  Finds a strings length
; Parameters:   r0-> string
; Returns:      r0 = length
; *******************************************************************
.|strlen|
   STMFD   (sp)!,{r2,link}
   REM     "Finding length of %$0"
   MOV     r14,#0
$loop
   LDRB    r2,[r0,r14]
   ADD     r14,r14,#1
   CMP     r2,#0
   BNE     $loop
   SUB     r0,r14,#1
   LDMFD   (sp)!,{r2,pc}^

; *******************************************************************
; Subroutine:   strcpy
; Description:  Copy a string
; Parameters:   r0-> block to copy to
;               r1-> string to copy
; Returns:      r0-> new copy of string
; *******************************************************************
.|strcpy|
   STMFD   (sp)!,{r0,r1,link}
   REM     "Copying %$1"
$loop
   LDRB    r14,[r1],#1
   STRB    r14,[r0],#1
   CMP     r14,#0
   BNE     $loop
   LDMFD   (sp)!,{r0,r1,pc}^

:

; ***************************************************************
; Name:         SkipWhitespace
; Function:     Skips whitespace
; On Entry:     r0 -> NUL-terminated string
; On Exit:      r0 -> first non-whitespace character
; Notes:        Not a standard ANSI routine
; ***************************************************************
.|SkipWhitespace|
        STMFD   R13!,{R14}
$lp
        LDRB    R14,[R0]
        TEQ     R14,#ASC" "
        TEQNE   R14,#8          ; tab is whtspce
        TEQNE   R14,#10
        TEQNE   R14,#13         ; so is lf/cr
        LDMNEFD R13!,{PC}^      ; ldm put first for optimization reasons
        ADD     R0,R0,#1
        B       $lp
:

; ***************************************************************
; Name:         SkipNonWhitespace
; Function:     Skips to end of string, or next whitespace
; On Entry:     r0 -> NUL-terminated string
; On Exit:      r0 -> first whitespace character, or \0
; Notes:        Not a standard ANSI routine
; ***************************************************************
.|SkipNonWhitespace|
        STMFD   R13!,{R14}
$lp
        LDRB    R14,[R0]
        TEQ     R14,#ASC" "
        TEQNE   R14,#8          ; tab is whtspce
        TEQNE   R14,#10
        TEQNE   R14,#13         ; so is lf/cr
        TEQNE   R14,#0          ; NUL is 'whitespace' in this definition
        ADDNE   R0,R0,#1
        BNE     $lp
        LDMFD   R13!,{PC}^
        