{{This routine passes variable parameters to a pasm program and into an array. Simple with no optimization}} CON _clkmode = xtal1 + pll16x '_xinfreq = 6_250_000 'MY BOARD AT 1OOMHZ DIFFERENT CRYSTAL _xinfreq = 5_000_000 'QUICKSTART 80 MHZ NORMAL CRYSTAL var long data long adder long matrix[10] long idx obj pst:"parallax serial terminal" pub main data := 60 'initial variable adder := 10 'var to add to the second array cell pst.start(115000) waitcnt(clkfreq*5 +cnt)'hold five sec to open the 'serial terminal and enable it cognew(@asm,@data )'start cog at the first variable address repeat idx from 0 to 3 'print the array cells cell [3] will be empty pst.str(string("matrix:")) pst.dec(matrix[idx]~)'post clear p 157 propeller manual pst.newline dat {{ working with three array cells. Budgeted for 10}} asm org 0 mov tempvar,par 'mov data var address from par to a temp address mov datvar,tempvar 'assign data variable address to datvar rdlong datvar,tempvar 'read the value from top object variable to asm variable add tempvar,#4 'mov over to next long to get adder variable mov addervar, tempvar 'get adder variable rdlong addervar,tempvar 'lode value from top object adder to addervar add tempvar,#4 'mov to next long to get matrix array address loop mov matrixvar,tempvar 'assign address array location wrlong datvar,matrixvar ''write the value to matrix[0] cell add matrixvar, #4 'move over to matrix[1] ********IMPORTANT ADDING HERE MOVES OVER TO NEXT LONG 'OF THE "RESERVED 10 LONGS FOR THE MATRIX[10]" add datvar, addervar 'NOW WE CAN ADD TO IT,add 20 to the value in the data variable wrlong datvar,matrixvar 'THEN WRITE IT TO THE NEXT ARRAY CELL, write the result to matrix[1] add matrixvar, #4 'mov over to next array cell sub datvar, #5 'subtract 5 and then write it to the cell wrlong datvar,matrixvar 'cell will be written to from the result of the subtraction 'reserved variables tempvar res 1 datvar res 1 addervar res 1 matrixvar res 10 'reserve 10 longs for an array of 10 matrix[10] prev res 1 fit