## Disk 2 Macros: The STDIO Collection

Disk 2: STDIO contains four macro files, each dedicated to different aspects of standard input and output. They are:

- [MAC.COUT.STDOUT.ASM](#mac.cout.stdout.asm)
  - This package contains macros that use the Apple II's COUT functionality. This can range from simple printing to the screen and moving the cursor position to word-wrapping a null-terminated string to the screen until the entire string is read.
- [MAC.SCRMEM.STDIO.ASM](#mac.scrmeme.stdio.asm)
  - This package contains macros that deal directly with screen memory. This means that the macros tend to be **fast**, at least compared to COUT; thus, most of the macros found here have to do with plotting more complicated shapes to the screen rather than focus on simple text output alone. It should be noted that because these macros do not inform COUT of any screen memory changes, they do not exactly play well with using COUT.
- [MAC.STDIN.ASM](#mac.stdin.asm)
  - These macros focus on input from the keyboard and paddles. More unique input devices, like a mouse, may be supported in the future.
- [MAC.MISC.STDIO.ASM](#mac.misc.stdio.asm)
  - This package contains macros that do not easily fit in with any of the preceding three groupings. Some of these macros may move to different packages in the future, as their relevance to one set of functionalities rather than another becomes more apparent.





















### MAC.COUT.STDOUT.ASM

| MACRO   | DEPENDENCY             | PARAMETERS                                                   | ACTION                                                       | DESTROYS | CYCLES | BYTES |
| ------- | ---------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | ------ | ----- |
| `CURB`  | none                   | ]1 = # of spaces                                             | Move cursor backward                                         | NZCV     | 10+    | 7     |
| `CURD`  | none                   | ]1 = # of spaces                                             | Move cursor Downward                                         | NZCV     | 10+    | 7     |
| `CURF`  | none                   | ]1 = # of spaces                                             | Move cursor forward                                          | NZCV     | 10+    | 7     |
| `CURU`  | none                   | ]1 = # of spaces                                             | Move cursor upward                                           | NZCV     | 10+    | 7     |
| `PRN`   | `DPRINT`<br />`XPRINT` | ]1 = Memory address or literal string                        | Print a literal string or a null-terminated string to the display | NZCV     | 159+   | 34    |
| `SCPOS` | none                   | ]1 = Column <br/>]2 = Row                                    | Set Cursor Position                                          | NZCV     | 10+    | 8     |
| `SETCX` | none                   | ]1 = Column                                                  | Set Cursor Column                                            |          | 10+    | 8     |
| `SETCY` | none                   | ]1 = Row                                                     | Set Cursor Row                                               | NZCV     | 4+     | 5     |
| `SPRN`  | `PRNSTR`               | ]1 = memory address of string                                | Display a regular string                                     | NZCV     | 147+   | 35    |
| `TMORE` | `TXTMORE`              | ]1 = String Address<br />]2 = Line Length<br />]3 = Pause Interval | Word-wrap a null-terminated string to the display, pausing either at a regular line interval or every time a linefeed is encountered. | NZCV     | 482+   | 472   |



---



### MAC.SCRMEM.STDIO.ASM

| MACRO   | DEPENDENCY | PARAMETERS                                                   | ACTION                                                       | DESTROYS | CYCLES | BYTES |
| ------- | ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | ------ | ----- |
| `CPUT`  | `TXTPUT`   | ]1 = X-pos<br/>]2 = Y-pos<br/>]3 = character                 | Plot a character at the given X,Y coordinate                 | NZCV     | 91+    | 31    |
| `RCPOS` | none       | ]1 = Column <br/>]2 = Row                                    | Return a character located on screen at given coordinate     | NZCV     | 10+    | 6     |
| `SPUT`  | `STRPUT`   | ]1 = X-pos<br>]2 = Y-pos<br>]3 = String address              | Plot a string at the given X,Y coordinate                    | NZCV     | 124+   | 50    |
| `TCIRC` | `TCIRCLE`  | ]1 = Center X-position<br>]2 = Center Y-position<br>]3 = Radius<br>]4 = Fill value | Create a circle with a text character and display it at given screen coordinates | NZCV     | 627+   | 290   |
| `TCLR`  | `TXTCLR`   | ]1 = Fill Value                                              | Fill the text screen with a given character                  | NZCV     | 50+    | 42    |
| `THLIN` | `THLINE`   | ]1 = X-pos origin<br>]2 = X-pos destination<br>]3 = Y-position <br>]4 = Fill value | Create a horizontal line on the screen made of a single fill character | NZCV     | 107+   | 38    |
| `TVLIN` | `TVLINE`   | ]1 = Y-pos origin<br>]2 = Y-pos destination<br>]3 = X-position <br>]4 = Fill value | Create a vertical line on the screen made of a single fill character | NZCV     | 104+   | 45    |
| `TLINE` | `TBLINE`   | ]1 = X origin <br>]2 = Y origin <br>]3 = X dest <br>]4 = Y dest <br>]5 = fill value | Create a diagonal line an X,Y origin to an X,Y destination with a single fill character | NZCV     | 305+   | 198   |
| `TREC`  | `TRECT`    | ]1 = X Origin<br />]2 = Y Origin <br />]3 = X Destination<br />]4 = Y Destination<br />]5 = Fill Value | Create an unfilled rectangle on the text screen that is composed of a single character | NZCV     | 362+   | 115   |
| `TRECF` | `TRECTF`   | ]1 = X origin <br>]2 = Y origin <br>]3 = X dest<br>]4 = Y dest<br>]5 = Fill vallue | Create a filled rectangle on the screen made of a single fill character | NZCV     | 157+   | 77    |



---



### MAC.STDIN.ASM

| MACRO  | DEPENDENCY | PARAMETERS          | ACTION                                               | DESTROYS | CYCLES | BYTES |
| ------ | ---------- | ------------------- | ---------------------------------------------------- | -------- | ------ | ----- |
| `GKEY` | none       | none                | Wait for a keypress and hold the key value in **.A** | NZCV     | 11+    | 7     |
| `INP`  | `SINPUT`   | none                | input a line of text from the keyboard               | NZCV     | 64+    | 41    |
| `PBX`  | none       | ]1 = paddle button  | Read paddle button state                             | NZCV     | 8+     | 8     |
| `PDL`  | none       | ]1 = paddle address | Read the specified paddle value (0..255)             | NZCV     | 8+     | 5     |
| `WAIT` | none       | none                | wait for a keypress                                  | NZCV     | 9+     | 8     |



---



### MAC.MISC.STDIO.ASM

| MACRO   | DEPENDENCY | PARAMETERS                             | ACTION                          | DESTROYS | CYCLES | BYTES |
| ------- | ---------- | -------------------------------------- | ------------------------------- | -------- | ------ | ----- |
| `COL40` | none       | none                                   | Enter 40-column mode            | NZCV     | 8+     | 5     |
| `COL80` | none       | none                                   | Enter 80-column mode            | NZCV     | 8+     | 5     |
| `DIE80` | none       | none                                   | End 80-column mode              | NZCV     | 8+     | 5     |
| `TCTR`  | `TXTCENT`  | ]1 = short string <br>]2 = long string | Center a string in a given line | NZCV     | 47+    | 27    |



---



[Return to Table of Contents](0.0%20Title_to_TOC)

[Disk 3 Quick Reference -- Array Macros and Subroutines](8.0%20Quick_Reference_D3_MAC.ARRAYS)





