4 ; String handling routines (control terminated)
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's BASIC Assembler Supplement.
13 ; BAS is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; BAS is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with BAS. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
41 ; On entry: R0 == destination string
44 ; On exit: R0 == pointer to terminator of destination
46 ; Use: Copies a string from one block to another. It leaves the
47 ; destination pointer at the end of the string so that any
48 ; subsequent copies concatenate other bits on the same string.
49 ; Single characters can of course be appended with
58 ; On entry: R0 == pointer to string
60 ; On exit: R0 == length of the string
62 ; Use: Calculates the length of a string.
68 ; On entry: R0 == pointer to string A
69 ; R1 == pointer to string B
71 ; On exit: Flags as appropriate
73 ; Use: Case-sensitively compares two strings. You can use the
74 ; normal ARM condition codes after the compare, so you can
75 ; treat this fairly much like a normal CMP.
81 ; On entry: R0 == pointer to string A
82 ; R1 == pointer to string B
84 ; On exit: Flags as appropriate
86 ; Use: As for str_cmp above, but case-insensitive.
92 ; On entry: R0 == Pointer to skeleton
93 ; R1 == Pointer to output buffer
94 ; R2-R11 == Pointer to filler strings (optional)
96 ; On exit: R0 == Pointer to start of buffer
97 ; R1 == Pointer to terminating null
99 ; Use: Performs string substitution, filling in a skeleton string
100 ; containing placeholders with `filler' strings. The
101 ; placeholders are actually rather powerful. The syntax of
102 ; these is as follows:
104 ; `%' [<type>] <digit>
106 ; (spaces are for clarity -- in fact you must not include
107 ; spaces in the format string.)
109 ; <digit> is any charater between `0' and `9'. It refers to
110 ; registers R2-R11 (so `0' means R2, `5' is R7 etc.) How the
111 ; value is interpreted is determined by <type>.
115 ; s String. This is the default. The register is
116 ; considered to be a pointer to an ASCII string
117 ; (control terminated).
119 ; i Integer. The (signed) decimal representation is
120 ; inserted. Leading zeros are suppressed.
122 ; x Hex fullword. The hexadecimal representation of the
123 ; register is inserted. Leading zeros are included.
125 ; b Hex byte. The hexadecimal representation of the
126 ; least significant byte is inserted. Leading zeros
129 ; c Character. The ASCII character corresponding to the
130 ; least significant byte is inserted.
136 ; On entry: R0 == Pointer to skeleton
137 ; R2-R11 == Pointers to fillin strings
139 ; On exit: R0 == Pointer to error in buffer
140 ; R1 == Pointer to terminator
142 ; Use: Fills in an error skeleton (containing a 4 byte error number
143 ; and a control terminated skeleton string as for str_subst)
144 ; and returns the address of the filled in error block. The
145 ; error block is stored in a buffer obtained from str_buffer.
147 ; Filler strings may be held in the scratchpad.
151 ; ---- str_buffer ---
155 ; On exit: R1 == pointer to the next free buffer
157 ; Use: Returns a pointer to a 256-byte buffer. There are at present
158 ; 2 buffers, which are returned alternately.
162 ;----- That's all, folks ----------------------------------------------------