Slide 91 of 97
Notes:
Here we see the dotP linear assembly program in its proper format. The .Proc says this piece of code is to be sent to the assembly optimizer. We begin the code with .Proc and end it with the .endproc. This defines the scope of the assembly optimizer over this piece of code.
On that . proc line, we indicate the registers that contain any arguments this code receives. In this case, another function is passing me arguments in A4, B4, A6 and B3.
The dot REG line declares the registers we will use in our code. Here we have a pointer to M, a pointer to N, M and N themselves, and the product, sum and count.
Since another function is sending me arguments, we need to assign those arguments to the registers. We indicate here that we are being passed a pointer of M in A4, so we use a move A4 P underscore N. Similar syntax is used for the other arguments.
We indicate the number of times we’ll need to go through the loop using dot trip 40 to show the minimum number of loop iterations. At the end of the loop, we pass the final sum out to another function using move sum into A4. And for the N product, we pass A4 out to the other function.