AppleIIAsm-Collection/documentation/AppleIIAsm Library Collection Technical Manual/0.6.1/12.0 Quick_Reference_D7_MAC.CONVERT.md

37 lines
1.9 KiB
Markdown
Raw Normal View History

# Disk #7: Conversion
The Conversion Collection contains macros and subroutines for converting between different data types. This currently includes macros for converting a:
- numeric value to an integer string
- integer string to a numeric value
- numeric value to a hexadecimal string
- hexadecimal string to a numeric value
- numeric value to a binary string
- binary string to a numeric value
In future revisions, other conversions will include:
- string type conversions (preceding length byte, null-terminated, etc.)
- string to array
- array to string
Note that some of these subroutines are redundant due to the fact that some conversions are already available in the ROM. However, for the sake of understanding how these conversions work, they are provided here if for nothing more than illustration.
---
| MACRO | DEPENDENCY | PARAMETERS | ACTION | DESTROYS | CYCLES | BYTES |
| ------- | ------------------ | -------------------------------- | ------------------------------------------- | -------- | ------ | ----- |
| `I2STR` | SUB.HEX2INTASC.ASM | ]1 = Value to convert or address | Convert numeric value to integer string | NZCV | 290 | 172 |
| `STR2I` | SUB.INTASC2HEX.ASM | ]1 = String address | Convert integer string to numeric value | NZCV | 415 | 196 |
| `H2STR` | SUB.HEX2HEXASC.ASM | ]1 = Value to convert or address | Convert numeric value to hexadecimal string | NZCV | 97 | 59 |
| `STR2H` | SUB.HEXASC2HEX.ASM | ]1 = String address | Convert hexadecimal string to numeric value | NZCV | 116 | 71 |
| `B2STR` | SUB.HEX2BINASC.ASM | ]1 = Value to convert or address | Convert numeric value to binary string | NZCV | 262 | 167 |
| `STR2B` | SUB.BINASC2HEX.ASM | ]1 = String address | Convert binary string to numeric value | NZCV | 501 | 331 |