0
Oops, hello, good afternoon! I am in doubt if my pseudo code on Assembly is correct, if anyone can verify and explain to me why it is wrong I would appreciate it very much.
The code is simple. Imagine that I want to pass this passage:
for (int i = 1; i <= k; i++) {
b = b + n[i] * 2;
}
For a micro Assembly code, I got to this code.
0: $i := 1;
1: mar := $k; rd;
2: ac := mbr + 1;
3: ac := ac + inv($i); if n then goto 10;
4: ac := $n;
5: ac := ac + $i;
6: mar := ac; rd;
7: ac := mbr + mbr;
8: $b := ac + $b;
9: $i := $i + 1; goto 1;
10:
But I don’t know if I made a mistake because I’m learning Assembly now.
To know if your program is working do the table test or use a Mic1 simulator.
– Augusto Vasques