* ******************************** * * * -< ARRAYS DEMO >- * * * * VERSION 00.02.00 * * * * 12-DEC-2018 * * * ******************************** * * * NATHAN D. RIGGS * * NATHAN.RIGGS@OUTLOOK.COM * * * ******************************** * ** ASSEMBLER DIRECTIVES * CYC AVE EXP ONLY DSK ARRAYS.DEMO OBJ $BFE0 ORG $6000 * *``````````````````````````````* * TOP INCLUDES (HOOKS,MACROS) * *,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,* * PUT REQUIRED.HOOKS USE REQUIRED.MAC USE ARRAYS.MAC 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 * LDA #>ARRAY1 ; HIGH LOCATION FOR ARRAY PHA LDA #$300 PHA LDA #<$300 PHA LDA #14 ; ARRAY LENGTH + 2 PHA JSR __DUMP JSR __W * ** NOTE THAT INDEXING STARTS AT 0, SO AN ARRAY ** OF TEN ELEMENTS WOULD BE LISTED AS 0..9 * ** APUT81 COPIES DATA FROM ONE SPECIFIED LOCATION ** TO THE ELEMENT INDEXED IN AN ARRAY AT ANOTHER ** LOCATION. * *** MACRO: PUT81 $SRC_ADDR;ARRAY_ADDR;INDEX * LDA #$44 STA ARRAY2 LDA #$55 STA ARRAY2+1 LDA #>ARRAY2 ; ADDRESS TO COPY PHA LDA #ARRAY1 ; ARRAY ADDRESS PHA LDA #ARRAY1 PHA LDA #ARRAY1 PHA LDA #ARRAY2 PHA LDA #ARRAY2 PHA LDA #ARRAY2+3 PHA LDA #ARRAY2+7 PHA LDA #ARRAY2+11 PHA LDA #ARRAY2+15 PHA LDA #ARRAY1 ; SRC PHA LDA #ARRAY2 ; DEST PHA LDA #ARRAY2 PHA LDA #ARRAY2+3 PHA LDA #ARRAY2+7 PHA LDA #ARRAY2+11 PHA LDA #ARRAY2+15 PHA LDA #ARRAY2 PHA LDA #