AppleIIAsm-Collection/source/disk1_stdio/T.STDIO.MAC
nathanriggs 82d0e74c1a 0.3.1 updates
some minor bugfixes, directory shuffling, added demo and utility disks
2019-01-26 21:02:17 -05:00

462 lines
12 KiB
Plaintext

*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* *
* STDIO.MAC *
* *
* AUTHOR: NATHAN RIGGS *
* CONTACT: NATHAN.RIGGS@ *
* OUTLOOK.COM *
* *
* VERSION: 0.2.0 *
* DATE: 12-DEC-2018 *
* ASSEMBLER: MERLIN 8 PRO *
* LICENSE: APACHE 2.0 *
* OS: DOS 3.3 *
* *
*------------------------------*
* *
* THIS IS A MACRO LIBRARY FOR *
* STDIO.LIB. *
* *
*------------------------------*
* *
* LIST OF MACROS *
* *
* PRN : FLEXIBLE PRINT *
* PCR : PRINT CARRIAGE RET *
* INP : SPECIAL INPUT *
* GKEY : GET SINGLE KEY *
* SCPOS : SET CURS POS AT X,Y *
* SETCX : SET CURSOR X *
* SETCY : SET CURSOR Y *
* CURF : CURSOR FORWARD *
* CURB : CURSOR BACKWARD *
* CURU : CURSOR UP *
* CURD : CURSOR DOWN *
* RCPOS : READ CURSOR POSITION *
* PDL : READ PADDLE STATE *
* PBX : READ PDL BTN X *
* TVLIN : TEXT VERTICAL LINE *
* THLIN : TEXT HORIZ LINE *
* TFILL : TEXT FILL AREA *
* TPUT : TEXT CHAR PLOT AT XY *
* *
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
*
*
*``````````````````````````````*
* PRN :: PRINT (NO <CR> ) *
*- -*
* EITHER PRINTS A STRING OF *
* TEXT PROVIDED, OR PRINTS THE *
* DATA FOUND AT THE SPECIFIED *
* MEMORY LOCATION. *
*- -*
* PARAMETERS *
* *
* IF FIRST LETTER OF VAR1 IS *
* A QUOTATION MARK, THEN PASS *
* CONTROL TO XPRINT. *
* *
* IF FIRST LETTER OF VAR1 IS *
* A DOLLAR SIGN, THEN IT IS A *
* MEMORY LOCATION, SO PASS TO *
* DPRINT. *
*- -*
* SAMPLE USAGE: *
* *
* PRN "HELLO!" *
* PRN $300 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PRN MAC
IF ",]1 ; --- IF PARAM=STRING
JSR XPRINT ; SPECIAL PRINT
ASC ]1 ; PUT STRING HERE
HEX 00 ; STRING TERMINATE
ELSE ; ELSE, PARAM IS
; MEMORY LOCATION
LDA #>]1 ; PUSH HIGH BYTE
PHA ; TO STACK
LDA #<]1 ; PUSH LOW BYTE
PHA
JSR DPRINT
FIN
<<<
*
*``````````````````````````````*
* PCR : PRINT CARRAIGE RETURN *
* *
* SIMPLY SENDS A CR AND LINE *
* FEED TO COUT (OR THE *
* EQUIVALENT, ANYHOW). *
*- -*
* SAMPLE USAGE: PCR *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PCR MAC
LDA #$8D
JSR COUT1
<<<
*
*``````````````````````````````*
* INP: INPUT MACRO *
* *
* INPUTS A STRING FROM KEYBRD *
* AND STORES IT IN [RETURN] *
*- -*
* SAMPLE USAGE: *
* *
* INP *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
INP MAC
JSR SINPUT
<<<
*
*``````````````````````````````*
* GKEY GETKEY *
* *
* WAITS FOR USER TO PRESS A *
* KEY, THEN STORES THAT IN .A *
*- -*
* SAMPLE USAGE: *
* *
* GKEY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
GKEY MAC
JSR GETKEY
LDY #0
STY STROBE
<<<
*
*``````````````````````````````*
* SCPOS : POSITION CURSOR X,Y *
*- -*
* SETS THE CURSOR POSITION. *
*- -*
* PARAMETERS *
* *
* ]1 = X POSITION *
* ]2 = Y POSITION *
*- -*
* SAMPLE USAGE: *
* *
* SCPOS #10;#10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
** WARNING: NO ERROR CONTROL
*
SCPOS MAC
LDX ]1
LDY ]2
STX CURSH
STY CURSV
JSR VTAB
<<<
*
*``````````````````````````````*
* SETCX : SET CURSOR HORIZ *
*- -*
* SETS THE HORIZONTAL POSITION *
* OF THE TEXT CURSOR. *
*- -*
* PARAMETERS *
* *
* ]1 = X POSITION *
*- -*
* SAMPLE USAGE: SETCX #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
** WARNING: NO ERROR CONTROL
*
SETCX MAC
LDX ]1
STX CURSH
JSR VTAB
<<<
*
*``````````````````````````````*
* SETCY: POSITION CURSOR VERT *
*- -*
* SET CURSOR VERTICAL POSITION *
*- -*
* PARAMETERS *
* *
* ]1 = Y POSITION *
*- -*
* SAMPLE USAGE: SETCY #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
** WARNING: NO ERROR CONTROL
*
SETCY MAC
LDY ]1
STY CURSV
JSR VTAB
<<<
*
*``````````````````````````````*
* CURF : TEXT CURSOR FORWRD *
*- -*
* MOVES THE CURSOR FORWARD BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* ]1 = NUMBER TO MOVE FORWARD *
*- -*
* SAMPLE USAGE: CURF #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURF MAC
LDA ]1
JSR CURSFOR
<<<
*
*``````````````````````````````*
* CURB :: TEXT CURSOR BACKWD *
*- -*
* MOVES THE CURSOR BACKWARD BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* ]1 = AMOUNT TO MOVE BACKWARD *
*- -*
* SAMPLE USAGE: CURB #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURB MAC
LDA ]1
JSR CURSBAK
<<<
*
*``````````````````````````````*
* CURU :: TEXT CURSOR UP *
*- -*
* MOVES THE CURSOR UP BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* ]1 = AMOUNT TO MOVE UP *
*- -*
* SAMPLE USAGE: CURU #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURU MAC
LDA ]1
JSR CURSUP
<<<
*
*``````````````````````````````*
* CURD :: TEXT CURSOR DOWN *
*- -*
* MOVES THE CURSOR DOWN BY *
* SPECIFIED AMOUNT. *
*- -*
* PARAMETERS *
* *
* ]1 = AMOUNT TO MOVE DOWN *
*- -*
* SAMPLE USAGE: CURD #10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
CURD MAC
LDA ]1
JSR CURSDN
<<<
*
*``````````````````````````````*
* RCPOS :: READ SCREEN AT XY *
*- -*
* READ THE CHARACTER AT POS *
* X,Y AND LOADS INTO ACCUM *
*- -*
* PARAMETERS *
* *
* ]1 = X POSITION *
* ]2 = Y POSITION *
*- -*
* SAMPLE USAGE: _RCXY #3;#9 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
** WARNING: NO ERROR CONTROL
*
RCPOS MAC
LDA ]1 ; ROW
LDY ]2 ; COLUMN
JSR $F847 ; GBASCALC ROUTINE
LDA ($26),Y ; LOW OF ADDR OF CHAR
<<<
*
*``````````````````````````````*
* PDL PADDLE / MOUSE INPUT *
*- -*
* SIMPLY READS STATE OF PADDLE *
* NUMBER [NUM] AND STORES IT *
* IN THE Y REGISTER. *
*- -*
* PARAMETERS *
* *
* ]1 = PADDLE NUMBER TO READ *
*- -*
* SAMPLE USAGE: PDL #0 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
** WARNING: NO ERROR CONTROL
*
PDL MAC ; GET PADDLE VALUE
LDX #]1 ; READ PADDLE # ]1 (USUALLY 0)
JSR PREAD ; PADDLE READING STORED IN Y
<<<
*
*``````````````````````````````*
* PBX :: PADDLE BUTTON X *
* *
* STORE 1 IN ACCUMULATOR IF *
* PADDLE BUTTON X IS PRESSED, *
* OTHERWISE STORE 0 IN ACCUM. *
*- -*
* PARAMETERS *
* *
* ]1 = PADDLE BUTTON TO READ *
* *
* PB0: $C061 PB1: $C062 *
* PB2: $C063 PB4: $C060 *
*- -*
* SAMPLE USAGE: PBX $C061 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PBX MAC
LDA #>]1
PHA
LDA #<]1
PHA
JSR GPBX
<<<
*
*``````````````````````````````*
* TVLIN :: TEXT VERTICAL LINE *
*- -*
* CREATES A VERTICAL LINE OF *
* TEXT AT THE CURRENT CURSOR *
* COLUMN CONSISTING OF THE *
* SPECIFIED CHARACTER. *
*- -*
* PARAMETERS *
* *
* ]1 = START OF VERTICAL LINE *
* ]2 = END OF VERTICAL LINE *
* ]3 = X POSITION OF LINE *
* ]4 = FILL CHARACTER *
*- -*
* SAMPLE USAGE: *
* *
* TVLIN #0;#10;#3;#$18 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TVLIN MAC
LDA ]1 ; Y START
PHA
LDA ]2 ; Y END
PHA
LDA ]3 ; X POSITION
PHA
LDA ]4 ; CHARACTER
PHA
JSR TVLINE
<<<
*
*``````````````````````````````*
* THLIN : TEXT HORIZONTAL LINE *
* *
* CREATES A HORIZONTAL LINE OF *
* TEXT FROM X1,Y TO X2,Y WITH *
* THE SPECIFIED CHARACTER. *
*- -*
* PARAMETERS *
* *
* ]1 = START OF HORIZONTL LINE *
* ]2 = END OF HORIZONTAL LINE *
* ]3 = Y POSITION OF LINE *
* ]4 = FILL CHARACTER *
*- -*
* SAMPLE USAGE: *
* *
* THLIN #0;#10;#12;#$18 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
THLIN MAC
LDA ]1 ; X START
PHA
LDA ]2 ; X END
PHA
LDA ]3 ; Y POS
PHA
LDA ]4 ; FILL CHAR
PHA
JSR THLINE
<<<
*
*``````````````````````````````*
* TFILL :: TEXT FILL *
*- -*
* FILL X1,Y1 TO X2,Y2 WITH *
* SPECIFIED CHARACTER. *
*- -*
* PARAMETERS *
* *
* PARAM1 = X1 *
* PARAM2 = Y1 *
* PARAM3 = X2 *
* PARAM4 = Y2 *
*- -*
* SAMPLE USAGE: *
* *
* TFILL #0;#10;#0;#10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TFILL MAC
LDA ]1 ; LEFT BOUNDARY
PHA
LDA ]2 ; TOP BOUNDARY
PHA
LDA ]3 ; RIGHT BOUNDARY
PHA
LDA ]4 ; BOTTOM BOUNDARY
PHA
LDA ]5 ; FILL CHAR
PHA
JSR TFILLA
<<<
*
*``````````````````````````````*
* TPUT :: TEXT CHARACTER PLOT *
*- -*
* PLOT A TEXT CHARACTER AT X,Y *
* DIRECTLY TO MEMORY. *
*- -*
* PARAMETERS *
* *
* PARAM1 = X *
* PARAM2 = Y *
* PARAM3 = CHARACTER *
*- -*
* SAMPLE USAGE: *
* *
* TPUT #$AA;#10;#10 *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
TPUT MAC
LDA ]1
PHA
LDA ]2
PHA
LDA ]3
PHA
JSR TXTPUT
<<<