LC3 Assembly Square of N

梦想的初衷 提交于 2020-01-25 22:54:28
问题 Hi I'm trying to write a lc3 assembly program which computes the square of a number and stores it in r0, the integer is given as a parameter and is located in r1, the problem i noticed while debugging is during the first pass it initially adds 2, but the second pass it fails to add another 2 to r0 - My code is below any help is appreciated .orig x3FF8 ld r1,n ld r5,n square add r2,r1,#0 add r5,r5,#-1 add r0,r2,#0 brzp square brn theend theend halt n .fill #2 .end my final code thanks to the