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

220 lines
6.2 KiB
Plaintext

*
********************************
* *
* -< ARRAYS DEMO >- *
* *
* VERSION 00.03.00 *
* *
* 15-JAN-2019 *
* *
********************************
* *
* NATHAN D. RIGGS *
* NATHAN.RIGGS@OUTLOOK.COM *
* *
********************************
*
** ASSEMBLER DIRECTIVES
*
CYC AVE
EXP ONLY
TR ON
DSK ARRAYS.DEMO
OBJ $BFE0
ORG $6000
*
*``````````````````````````````*
* TOP INCLUDES (HOOKS,MACROS) *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PUT REQUIRED.VARS
PUT REQUIRED.HOOKS.MIN
USE REQUIRED.MAC.MIN
USE ARRAYS.MAC.MIN
PUT ARRAYS.HOOKS
*
*``````````````````````````````*
* PROGRAM MAIN BODY *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
ARRAY1 EQU $300
ARRAY2 EQU $4000
*
** DIM81 CLEARS THE MEMORY AT THE SPECIFIED
** LOCATION AND SETS UP THE DATA CONFIGURATION
** FOR A 1D ARRAY (ARRAY LENGTH, ELEMENT LENGTH, DATA)
*
** MACRO: DIM81 ADDRESS;ARRAY_SIZE;ELEMENT_LENGTH;FILL_VAL
*
** NOTE THAT INDEXING STARTS AT 0, SO AN ARRAY
** OF TEN ELEMENTS WOULD BE LISTED AS 0..9
*
_PRNT " ",8D8D
_PRNT "THE DIM81 MACRO SIMPLY SETS",8D
_PRNT "UP A ONE-DIMENSIONAL ARRAY OF",8D
_PRNT "THE GIVEN SIZE WITH ELEMENTS OF",8D
_PRNT "A GIVEN LENGTH.",8D8D
_PRNT "DIM81 ARRAY1;#10;#1;#$AA RETURNS:",8D8D
DIM81 ARRAY1;#10;#1;#$AA
_DUMP ARRAY1;#2
_DUMP ARRAY1+2;#5
_DUMP ARRAY1+7;#5
_PRNT " ",8D8D
_WAIT
*
** PUT81 PUTS THE VALUE AT A SPECIFIED ADDRESS
** INTO THE ARRAY AT THE SPECIFIED INDEX.
*
** MACRO: PUT81 SRC_ADDR;DEST_ARRAY;INDEX
*
_PRNT "THE PUT81 MACRO PUTS THE VALUE FOUND",8D
_PRNT "AT THE SPECIFIED ADDRESS AND THEN",8D
_PRNT "INSERTS IT INTO THE GIVEN ARRAY AND",8D
_PRNT "INDEX.",8D8D
_PRNT "SO, PUT81 $320;ARRAY1;#1 AND ",8D
_PRNT "PUT81 $321;ARRAY1;#2 RESULTS IN: ",8D8D
LDA #$BB
STA $320
LDA #$CC
STA $321
PUT81 $320;ARRAY1;#1
PUT81 $321;ARRAY1;#2
_DUMP ARRAY1;#2
_DUMP ARRAY1+2;#5
_DUMP ARRAY1+7;#5
_PRNT " ",8D8D
_WAIT
*
_PRNT "NOTE THAT IF YOUR ELEMENT SIZE",8D
_PRNT "IS ONE BYTE.ONLY ONE BYTE IS COPIED;",8D
_PRNT "IF TWO BYTES, THEN TWO ARE COPIED,",8D
_PRNT "AND SO ON. THUS THE FOLLOWING:",8D8D
_PRNT "DIM81 ARRAY2;#10;#2;#$EE",8D
_PRNT "PUT81 $320;ARRAY2;#8",8D8D
_PRNT "RESULTS IN THE FOLLOWING:",8D8D
DIM81 ARRAY2;#10;#2;#$EE
PUT81 $320;ARRAY2;#8
_DUMP ARRAY2;#02
_DUMP ARRAY2+2;#5
_DUMP ARRAY2+7;#5
_DUMP ARRAY2+12;#5
_DUMP ARRAY2+17;#5
_WAIT
_PRNT " ",8D8D
_PRNT "ALSO NOTE THAT BECAUSE ELEMENT SIZES",8D
_PRNT "CAN VARY FROM 1 BYTE TO 255 BYTES,",8D
_PRNT "ALLOWING LITERAL VALUES IS IMPRACTICAL.",8D
_PRNT "THUS, BE SURE TO UTILIZE A PORTION",8D
_PRNT "OF MEM FOR PASSING TO AND FROM ARRAY ",8D
_PRNT "SUBROUTINES. THE [PARAM] ADDR IS GOOD",8D
_PRNT "FOR THIS.",8D8D
_WAIT
*
_PRNT " ",8D8D
*
** GET81 SIMPLY RETRIEVES THE VALUE IN AN
** ARRAY AT THE GIVEN INDEXED ELEMENT IN
** [RETURN].
*
** MACRO: GET81 ARRAY_ADDR;INDEX
*
_PRNT "THE GET81 MACRO GETS THE VALUE HELD",8D
_PRNT "IN THE GIVEN ELEMENT IN THE GIVEN",8D
_PRNT "ARRAY. THUS",8D8D
_PRNT "GET81 ARRAY2;#8 RETURNS:",8D8D
GET81 ARRAY2;#8
_DUMP RETURN;RETLEN
_PRNT " ",8D8D
_WAIT
*
** DIM82 CREATES A 2-DIMENSIONAL ARRAY WITH THE
** SPECIFIED ELEMENT LENGTH AND X,Y DIMENSIONS
*
** MACRO: DIM82 ARRAY_ADDR;X_DIM;Y_DIM;ELEM_LENGTH
*
DIM82 ARRAY2;#10;#10;#1;#$2D
_PRNT "DIM82 CREATES AN ARRAY LIKE DIM81,",8D
_PRNT "BUT IN 2-DIMENSIONS INSTEAD OF ONE.",8D8D
_PRNT "THUS DIM82 ARRAY2;#10;#10;#1;#$2D RETURNS: ",8D8D
_DUMP ARRAY2;#03
_DUMP ARRAY2+03;#10
_DUMP ARRAY2+13;#10
_DUMP ARRAY2+23;#10
_DUMP ARRAY2+33;#10
_DUMP ARRAY2+43;#10
_DUMP ARRAY2+53;#10
_DUMP ARRAY2+63;#10
_DUMP ARRAY2+73;#10
_DUMP ARRAY2+83;#10
_DUMP ARRAY2+93;#10
_PRNT " ",8D8D
_WAIT
*
** THE PUT82 MACRO MIRRORS PUT81, BUT IN 2 DIMENSIONS.
** IN SHORT, IT SIMPLY PUTS THE STRING OF BYTES
** FOUND AT SOURCE_ADDR THAT CORRELATE TO THE ARRAY'S
** ELEMENT LENGTH INTO THE SPECIFIED X,Y INDEX.
*
** MACRO: PUT82 SOURCE_ADDR;ARRAY_ADDR;X_INDEX;Y_INDEX
*
_PRNT "PUT82 ACTS LIKE PUT81, BUT IN TWO",8D
_PRNT "DIMENSIONS. ",8D8D
_PRNT "SO: PUT82 $320;ARRAY2;#1;#5 RETURNS",8D8D
LDA #$0F
STA $320
LDA #$FF
STA $321
PUT82 $320;ARRAY2;#01;#05
_DUMP ARRAY2;#03
_DUMP ARRAY2+03;#10
_DUMP ARRAY2+13;#10
_DUMP ARRAY2+23;#10
_DUMP ARRAY2+33;#10
_DUMP ARRAY2+43;#10
_DUMP ARRAY2+53;#10
_DUMP ARRAY2+63;#10
_DUMP ARRAY2+73;#10
_DUMP ARRAY2+83;#10
_DUMP ARRAY2+93;#10
_PRNT " ",8D8D
_WAIT
*
** FINALLY, GET82 GETS THE VALUE AT A GIVEN X,Y
** INDEX AND PLACES IT IN [RETURN] WITH THE
** ELEMENT LENGTH IN [RETLEN].
*
** MACRO: GET82 ARRAY_ADDR;X_INDEX;Y_INDEX
*
_PRNT "LIKEWISE, GET82 ACTS LIKE GET81,",8D
_PRNT "BUT IN TWO DIMENSIONS. ",8D8D
_PRNT "THUS: GET82 ARRAY2;#1;#5 RETURNS:",8D8D
GET82 ARRAY2;#1;#5
_DUMP RETURN;RETLEN
_WAIT
*
_PRNT " ",8D8D
_PRNT "FIN.",8D8D8D
*
JMP REENTRY
*
*``````````````````````````````*
* BOTTOM INCLUDES (ROUTINES) *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
PUT REQUIRED.LIB.MIN
*
** INDIVIDUAL SUBROUTINE INCLUDES
*
** 8-BIT 1-DIMENSIONAL ARRAY SUBROUTINES
*
PUT ADIM81.SUB.MIN
PUT AGET81.SUB.MIN
PUT APUT81.SUB.MIN
*
** 8-BIT 2-DIMENSIONAL ARRAY SUBROUTINES
*
PUT ADIM82.SUB.MIN
PUT AGET82.SUB.MIN
PUT APUT82.SUB.MIN
*