AppleIIAsm-Collection/documentation/AppleIIAsm Library Collection Technical Manual/0.6.1/6.0 Quick_Reference_D1_MAC.REQUIRED.md
Nathan D Riggs c28c9d87da Disk 1: REQUIRED disk and documentation
Cleaned up disk one documentation, both inline and in the manual
2021-06-06 21:50:54 -04:00

106 lines
5.4 KiB
Markdown

## Disk 1 Macros: The Required Collection
Disk 1: REQUIRED contains three main macro files, unlike most disks which only contain a single macro file. They are as follows:
- [MAC.REQUIRED.ASM](#macrequiredasm)
- Contains all of the Macros required by the rest of the library collection. This must always be included in the main program. This also contains emulation macros for a select number of 65C02 instructions, if limited to a 6502 instruction set.
- [MAC.ALIAS.8080.ASM](#macalias8080asm)
- These are aliases for some instructions in the 8080 instruction set. Note that these may not work exactly like the 8080 versions, and are considered works-in-progress.
- [MAC.ALIAS.Z80.ASM](#macaliasz80asm)
- These are aliases for some instructions in the Z80 instruction set. Like with the previous alias file, these are works-in-progress.
Be sure to consult the detailed reference for Disk 1: The Required Library for further explanation of how the macros work, their source code, and an explanation of the source code of any subroutines the macros may rely upon.
### MAC.REQUIRED.ASM
| MACRO | DEPENDENCY | PARAMETERS | ACTION | DESTROYS | CYCLES | BYTES |
| --- | --- | --- | --- | --- | --- | --- |
| `_AXLIT` | none | **\]1** = memory address | Determine if address sent is direct or indirect and parse accordingly in registers.<br /><br /> **.A** = address low byte<br />**.X** = address high byte |NZ|8|6|
| `_AXSTR` | `_AXLIT` | **\]1** = memory address | Determine if literal string or address is sent and parse accordingly.<br /><br />.**A** = address low byte<br />.**X** = address high byte |NZ|11|9+|
| `_ISLIT` | none | **\]1** = memory address | Determine if address sent is direct or indirect and parse accordingly onto the stack<br /><br />.**A** = address low byte<br />.**X** = address high byte |NZ|14|8|
| `_ISSTR` | `_ISLIT` | **\]1** = memory address | Determine if parameter is a literal string or address and parse address accordingly to the stack.<br /><br />.**A** = address low byte<br />.**X** = address high byte |NZ|13 or 8|10+ or 6|
| `_MLIT` | none | **\]1** = memory address<br />**\]2** = destination ZP address | Determine if address sent is direct or indirect and parse accordingly to zero page<br /><br />.**A** = address low byte <br />.**X** = address high byte |NZ|16|12|
| `_MSTR` | `_ISLIT` | **\]1** = memory address<br />**\]2** = destination ZP address | Determine if parameter passed is a literal string and parse address accordingly to the zero page<br /><br />.**A** address low byte <br />.**X** = address high byte |NZ|15 or 8|14+ or 6|
| `_PRN` | `__P` | **\]1** = string to print | Print a literal string to the screen. |NZCV|161+|9+|
| `_WAIT` | `__w` | none | Loop until a button is pressed.<br /><br />.**A** = keypress value |NZ|14+|10|
| `BEEP` | none | **\]1** = length of beep | Make beeping sound | NZC | 108+ | 15 |
| `CLRHI` | none | none | high nibble of .**A** cleared | NZC | 10 | 6 |
| `DUMP` | `_AXLIT`;<br />`__DUMP` | **\]1** = memory address<br />**\]2** = number of bytes to dump | Dump a region of memory to the screen<br /><br />.**A** = number of bytes displayed |NZCV|811+|16|
| `GBIT` | none | **\]1** = byte to check<br />**\]2** = bit mask | Get bit from .**A** at specified location in byte.<br /><br />.**A** = 0 or 1 | NZ | 14 | 15 |
---
### MAC.ALIAS.8080.ASM
| MACRO | DEPENDENCIES | PARAMETERS | ACTION | CYCLES | BYTE |
| ----- | ------------ | ---------- | ------ | ------ | ---- |
| `CALL` |none|label to `JSR` to| mimics `JSR` instruction | 6 | 3 |
|`RET`|none|none| mimics `RTS` instruction|6|1|
|`JA`|none|label to `JMP` to| `JMP` if .**A** > `CMP`|14|9|
|`JAE`|none|label to `JMP` to| `JMP` if .**A** >= `CMP`|8|4|
|`JB`|none|label to `JMP` to| `JMP` if .**A** < `CMP`|8|4|
|`JBE`|none|label to `JMP` to| `JMP` if .**A** <= `CMP`|1|6|
|`JC`|none|label to `JMP` to| `JMP` if .**C** = 1|8|4|
|`JE`|none|label to `JMP` to| `JMP` if **EQUAL**|8|4|
|`JG`|none|label to `JMP` to| `JA`|11|9|
|`JGE`|none|label to `JMP` to| `JAE`|8|4|
|`JL`|none|label to `JMP` to| `JB`|8|4|
|`JLE`|none|label to `JMP` to| `JBE`|11|6|
|`JNC`|none|label to `JMP` to| `JMP` if .**C** = 0|8|4|
|`JNE`|none|label to `JMP` to| `JMP` if **NOT EQUAL**|8|4|
|`JZ`|none|label to `JMP` to| `JMP` if .**Z** = 1|8|4|
|`JNZ`|none|label to `JMP` to| `JMP` if .**Z** = 0|8|4|
|`JS`|none|label to `JMP` to| `JMP` if **SIGNED**|8|4|
|`JNS`|none|label to `JMP` to| `JMP` if **NOT SIGNED**|8|4|
|`JO`|none|label to `JMP` to| `JMP` if **OVERFLOW** = 1|8|4|
|`JNO`|none|label to `JMP` to| `JMP` if **OVERFLOW** = 0|8|4|
|`ANC`|none|**\]1** = first addend<br />**\]2** = second addend| Add No Carry (ADD in 8080)|12|8|
|`SNC`|none|**\]1** = Minuend<br />**\]2** = Subtrahend| Subtract No Carry (SUB in 8080)|12|8|
|`PUSHA`|none|none| Push All Registers|30|14|
|`PULLA`|none|none| Pull All Registers|19|24|
|`POPA`|none|none| `PULLA`|19|24|
---
### MAC.ALIAS.Z80.ASM
| MACRO | DEPENDENCIES | PARAMETERS | ACTION | CYCLES | BYTE |
| ----- | ------------ | ---------- | ------ | ------ | ---- |
|`CPL`|none|none| Invert bits in .**A**|2|2|
|`JP`|none|label to `JMP` to| `JMP` equivalent|5|1|
|`LD`|none|????| move value from source to destination (non-operational)|?|?|
|`POP`|none|none| `PLA` equivalent|4|1|
|`SCF`|none|none| `SEC` equivalent|2|1|
---
[Return to Table of Contents](0.0%20Title_to_TOC)
[Disk 2 Quick Reference -- STDIO Macros and Subroutines](7.0%20Quick_Reference_D2_MAC.STDIO.md)