AppleIIAsm-Collection/documentation/AppleIIAsm Library Collection Technical Manual/0.6.1/10.0 Quick_Reference_D5_MAC.STRINGS.md

40 lines
3.0 KiB
Markdown
Raw Normal View History

# Disk 5: Strings and Substrings
The Strings Collection of the AppleIIAsm Library is dedicated to macros used for handling strings and substrings. In particular, this refers to the default type of string: those with a preceding length-byte. If these macros need to be used on another type of string, such as a null-terminated string, then the `STRPC` macro should be used on the string first to convert it to a preceding length-byte type.
The strings collection can be divided further into two categories: those that deal with whole strings and those that deal with substrings exclusively. This is currently reflected in the fact that the macros are held in separate files and use different demos.
---
### MAC.STRINGS.ASM
| MACRO | DEPENDENCY | PARAMETERS | ACTION | DESTROYS | CYCLES | BYTES |
| ------- | ------------------ | ----------------------------------------- | -------------------- | -------- | ------ | ----- |
| `SCMP` | `SUB.STRCOMP.ASM` | ]1 = First string<br />]2 = Second string | Compare strings | NZCV | 110+ | 67 |
| `SCAT` | `SUB.STRCAT.ASM` | ]1 = First string<br />]2 = Second string | Concatenate strings | NZCV | 170+ | 113 |
| `STRIM` | `SUB.STRIM.ASM` | ]1 = String<br />]2 = Token | Trim string | NZCV | 123+ | 80 |
| `STRUP` | `SUB.STRUPPER.ASM` | ]1 = String | Convert to uppercase | NZCV | 114+ | 64 |
| `SLO` | `SUB.STRLOWER.ASM` | ]1 = String | Convert to lowercase | NZCV | 113+ | 64 |
| `SREV` | `SUB.STRREV.ASM` | ]1 = String | Reverse a string | NZCV | 70+ | 41 |
| `SCAP` | `SUB.STRCAP.ASM` | ]1 = String | Capitalize sentences | NZCV | 192+ | 117 |
### MAC.SUBSTRINGS.ASM
| MACRO | DEPENDENCY | PARAMETERS | ACTION | DESTROYS | CYCLES | BYTES |
| ------ | -------------------- | ------------------------------------------------------ | --------------------------- | -------- | ------ | ----- |
| `SPOS` | `SUB.SUBPOS.ASM` | ]1 = String<br />]2 = Substring | Get substring position | NZCV | 205+ | 136 |
| `SCPY` | `SUB.SUBCOPY.ASM` | ]1 = Source string<br />]2 = Index<br />]3 = Length | Copy substring | NZCV | 95+ | 71 |
| `SDEL` | `SUB.SUBDEL.ASM` | ]1 = Source string<br />]2 = Index<br />]3 = Length | Delete substring | NZCV | 135+ | 79 |
| `SINS` | `SUB.SUBINS.ASM` | ]1 = Source string<br />]2 = Substring<br />]3 = Index | Insert substring | NZCV | 177+ | 111 |
| `STOK` | `SUB.SUBTOK.ASM` | ]1 = String<br />]2 = Token<br />]3 = Token number | Find tokenized substring | NZCV | 182+ | 118 |
| `SCNT` | `SUB.SUBCHARCNT.ASM` | ]1 = String<br />]2 = Character | Count character occurrences | NZCV | 88+ | 57 |