mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2024-12-11 09:49:17 +00:00
f5c097e70f
- added error handling - no more massive library; just a subroutine per file. This is because Merlin doesn't like large files. - added a "minify" BASIC utility that gets rid of *most* comments in a source textfile. This dramatically reduces space used if you're not terribly interested in non-inline comments. - TFILL,THLIN,TVLIN and TPUT not directly access the video memory (page one), making for a much faster draw without interfering COUT. - some stylistic changes, primarily to TFILL - change required files to minified versions only. The whole files can be found on disk 2. - got a norovirus so pretty much couldn't do anything requiring sustained attention, so focused on small things here and not on my dayjob. Cool. - created a required.vars file that separates variables and settings from the other required files. Not minified. - This current bout of revision will probably be the last, once all initial 6 disks are revamped, that focuses on all subroutines/macros in a given library at a single push. After this round, commits will be done on a subroutine or related file basis.
282 lines
7.2 KiB
Plaintext
282 lines
7.2 KiB
Plaintext
*
|
|
********************************
|
|
* *
|
|
* -< STDIO DEMO >- *
|
|
* *
|
|
* VERSION 00.03.00 *
|
|
* *
|
|
* 13-JAN-2019 *
|
|
* *
|
|
********************************
|
|
* *
|
|
* NATHAN D. RIGGS *
|
|
* NATHAN.RIGGS@OUTLOOK.COM *
|
|
* *
|
|
********************************
|
|
*
|
|
** ASSEMBLER DIRECTIVES
|
|
*
|
|
CYC AVE
|
|
EXP OFF
|
|
TR ON
|
|
DSK STDIO.DEMO
|
|
OBJ $BFE0
|
|
ORG $6000
|
|
*
|
|
*``````````````````````````````*
|
|
* TOP INCLUDES (HOOKS,MACROS) *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
PUT REQUIRED.VARS
|
|
PUT REQUIRED.HOOKS.MIN
|
|
USE REQUIRED.MAC.MIN
|
|
USE STDIO.MAC.MIN
|
|
PUT STDIO.HOOKS.MIN
|
|
*
|
|
*``````````````````````````````*
|
|
* PROGRAM MAIN BODY *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
JSR HOME ; CLEAR SCREEN
|
|
*
|
|
** SINCE THE STDIO LIBRARY HAS MACROS IN
|
|
** ADDITION TO ROUTINES THAT FUNCTION ON
|
|
** THEIR OWN, THIS DEMO WILL PRIMARILY USE
|
|
** MACROS TO ILLUSTRATE THEIR FUNCTIONS.
|
|
*
|
|
** PRN SIMPLY PRINTS A STRING OF TEXT TO THE
|
|
** SCREEN AT THE CURRENT CURSOR POSITION, OR
|
|
** PRINTS THE DATA AT A PARTICULAR MEMORY ADDRESS.
|
|
** IT ACCOMPLISHES THIS BY DETERMINING IF THE
|
|
** PARAMETER IS A STRING OR AN ADDRESS, THEN CALLING
|
|
** EITHER XPRINT OR DPRINT.
|
|
*
|
|
** THE ROUTINE QUITS PRINTING ONCE THE VALUE
|
|
** OF 00 IS ENCOUNTERED, IN THE CASE OF PRINTING
|
|
** PROM MEMORY.
|
|
*
|
|
** MACRO: PRN "STRING" <OR> PRN STRING_ADDRESS
|
|
*
|
|
PRN "THE PRN MACRO SIMPLY ",8D
|
|
PRN "DISPLAYS A LITERAL STRING ",8D
|
|
PRN "OR DATA LOCATED AT A SPECIFIC ",8D
|
|
PRN "ADDRESS (THE LATTER WILL BE SHOWN",8D
|
|
PRN "AFTER THE INP MACRO.",8D8D
|
|
PRN "NOTE THAT A NEW LINE CAN BE SENT ",8D
|
|
PRN "BY ADDING ,8D AFTER THE ENDING ",8D
|
|
PRN "STRING DELIMITER.",8D8D
|
|
_WAIT
|
|
*
|
|
** MACRO: PCR, NO PARAMETERS
|
|
*
|
|
PRN "YOU CAN ALSO GET A NEWLINE",8D
|
|
PRN "BY USING THE PCR"
|
|
PCR
|
|
PCR
|
|
PCR
|
|
PRN "ROUTINE."
|
|
PCR
|
|
PCR
|
|
PCR
|
|
_WAIT
|
|
*
|
|
** MACRO: INP, NO PARAMETERS
|
|
*
|
|
JSR HOME
|
|
PRN "THE INP MACRO ACCEPTS UP TO",8D
|
|
PRN "255 CHARACTERS AND STORES THEM",8D
|
|
PRN "IN [RETURN]. THIS CAN BE EASILY",8D
|
|
PRN "PRINTED IMMEDIATELY WITH PRN BY",8D
|
|
PRN "USING THE ADDRESS MODE.",8D8D
|
|
PRN "ENTER SOMETHING: "
|
|
INP
|
|
PCR
|
|
PCR
|
|
PRN "YOU WROTE: ",8D8D
|
|
PRN RETURN
|
|
PCR
|
|
PCR
|
|
_WAIT
|
|
*
|
|
** MACRO: GKEY, NO PARAMETERS
|
|
*
|
|
PRN "THE GKEY MACRO SIMPLY GETS",8D
|
|
PRN "A SINGLE KEYPRESS, STORED IN .A",8D8D
|
|
GKEY
|
|
*
|
|
** MACRO: SCPOS X_POSITION;Y_POSITION
|
|
** MACRO: SETCX X_POSITION
|
|
** MACRO: SETCY Y_POSITION
|
|
*
|
|
JSR HOME
|
|
SCPOS #10;#15
|
|
PRN "SCPOS POSITIONS THE CURSOR"
|
|
PRN " AT THE GIVEN X,Y."
|
|
_WAIT
|
|
SETCY #20
|
|
SETCX #1
|
|
PRN "SETCX SETS X POSITION "
|
|
SETCY #22
|
|
PRN "SETCY SETS THE Y"
|
|
_WAIT
|
|
*
|
|
** MACRO: CURF NUMBER_OF_SPACES
|
|
** CURB NUMBER_OF_SPACES
|
|
** CURU NUMBER_OF_SPACES
|
|
** CURD NUMBER_OF_SPACES
|
|
*
|
|
JSR HOME
|
|
PRN "THE CURSOR CAN ALSO BE MOVED"
|
|
_WAIT
|
|
CURF #10
|
|
PRN "RELATIVE TO THE CURRENT"
|
|
_WAIT
|
|
CURD #03
|
|
PRN "POSITION WITH THE CURF,CURD,"
|
|
_WAIT
|
|
CURD #8
|
|
SETCX #12
|
|
CURB #10
|
|
PRN "CURB AND"
|
|
CURU #05
|
|
PRN "CURU (FORWARD, DOWN, BACK, UP)"
|
|
_WAIT
|
|
*
|
|
** MACRO: RCPOS X_POSITION;Y_POSITION
|
|
*
|
|
JSR HOME
|
|
PRN "AAAAAAAAAA"
|
|
SCPOS #05;#05
|
|
PRN "AABBCC",8D8D8D
|
|
RCPOS #05;#05
|
|
STA $300
|
|
PCR
|
|
PRN "THE RCPOS MACRO RETURNS THE",8D
|
|
PRN "CHARACTER AT THE GIVEN X,Y",8D
|
|
PRN "LOCATION. THE CHAR A 5,5",8D
|
|
PRN "IS: "
|
|
LDA $300
|
|
JSR COUT1
|
|
PCR
|
|
PCR
|
|
_WAIT
|
|
*
|
|
** MACRO: PDL PADDLE_NUMBER
|
|
*
|
|
JSR HOME
|
|
PRN "THE PDL MACRO READS THE",8D
|
|
PRN "CURRENT STATE OF THE PADDLE",8D
|
|
PRN "AND RETURNS THAT STATE",8D
|
|
PRN "IN .Y.",8D8D
|
|
PRN "MOVE THE PADDLE A BIT TO SEE",8D
|
|
PRN "THE VALUE OF Y CHANGE.",8D8D
|
|
PRN "(PRESS A KEY FIRST, TO START)"
|
|
_WAIT
|
|
LDA #0
|
|
STA $300
|
|
LDA #0
|
|
STA $310
|
|
JSR HOME
|
|
PLP
|
|
PDL 0
|
|
TYA
|
|
JSR COUT1
|
|
INC $300
|
|
LDA $300
|
|
CMP #255
|
|
BNE PLP
|
|
INC $310
|
|
LDA $310
|
|
CMP #4
|
|
BEQ XPLP
|
|
BNE PLP
|
|
XPLP
|
|
*
|
|
** MACRO: PBX PADDLE_BUTTON_NUMBER
|
|
*
|
|
JSR HOME
|
|
PRN "THE PBX MACRO RETURNS 1 INTO",8D
|
|
PRN "THE ACCUMULATOR IF THE PROMPTED",8D
|
|
PRN "PADDLE BUTTON IS PRESSED. THIS",8D
|
|
PRN "IS USUALLY PB0 OR PB1. THE",8D
|
|
PRN "APPLE KEYS ARE ALSO MAPPED HERE.",8D
|
|
PRN "PRESS PADDLE BUTTON ZERO OR OPEN",8D
|
|
PRN "APPLE TO CONTINUE."
|
|
LDA #0
|
|
PBLP
|
|
PBX PB0
|
|
CMP #1
|
|
BNE PBLP
|
|
*
|
|
** MACRO: TVLIN Y_START;Y_END;X_POSITION;FILL_CHAR
|
|
** THLIN X_START;X_END;Y_POSITION;FILL_CHAR
|
|
*
|
|
** TFILL X_START;X_END;Y_START;Y_ENDLFILL_CHAR
|
|
*
|
|
JSR HOME
|
|
PRN "TVLIN CREATES A VERTICAL LINE",8D
|
|
PRN "OF TEXT, WHILE THLIN CREATES",8D
|
|
PRN "A HORIZONTAL LINE OF TEXT. YOU",8D
|
|
PRN "SPECIFY THE COORDS / FILL CHAR.",8D8D
|
|
TVLIN #08;#18;#10;#$AA
|
|
_WAIT
|
|
THLIN #10;#30;#08;#$AA
|
|
_WAIT
|
|
TVLIN #8;#18;#30;#$AA
|
|
THLIN #10;#31;#17;#$AA
|
|
_WAIT
|
|
THLIN #0;#39;#0;#$AA
|
|
TVLIN #0;#23;#0;#$AA
|
|
THLIN #0;#39;#23;#$AA
|
|
TVLIN #00;#23;#39;#$AA
|
|
_WAIT
|
|
TFILL #0;#0;#39;#23;#$AA
|
|
_WAIT
|
|
TFILL #10;#5;#30;#17;#$A0
|
|
_WAIT
|
|
SCPOS #12;#7
|
|
PRN "AND TFILL FILLS A",8D
|
|
SCPOS #12;#9
|
|
PRN "GIVEN AREA WITH"
|
|
SCPOS #12;#11
|
|
PRN "A FILL CHAR"
|
|
_WAIT
|
|
JSR HOME
|
|
PRN "LASTLY, THE TPUT MACRO SIMPLY",8D
|
|
PRN "PLOTS A GIVEN CHARACTER TO THE",8D
|
|
PRN "SCREEN VIA DIRECT MEMORY ACCESS."
|
|
PRN " ",8D8D
|
|
_WAIT
|
|
TPUT #10;#10;#$AA
|
|
TPUT #11;#11;#$AA
|
|
TPUT #12;#12;#$AA
|
|
TPUT #13;#13;#$AA
|
|
TPUT #14;#14;#$AA
|
|
_WAIT
|
|
JSR HOME
|
|
PRN "FIN.",8D8D8D
|
|
TPUT #39;#23;#$AA
|
|
*
|
|
JMP REENTRY
|
|
*
|
|
*``````````````````````````````*
|
|
* BOTTOM INCLUDES *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
PUT REQUIRED.LIB.MIN
|
|
*
|
|
** INDIVIDUAL SUBROUTINE INCLUDES
|
|
*
|
|
* STDIO SUBROUTINES
|
|
*
|
|
PUT XPRINT.SUB.MIN
|
|
PUT DPRINT.SUB.MIN
|
|
PUT THLINE.SUB.MIN
|
|
PUT TVLINE.SUB.MIN
|
|
PUT CURSORUDBF.SUB.MIN
|
|
PUT TFILLA.SUB.MIN
|
|
PUT SINPUT.SUB.MIN
|
|
PUT GPBX.SUB.MIN
|
|
PUT TXTPUT.SUB.MIN
|
|
*
|