for loop - Introductory ARM - Assembly Error -


for class starting out arm assembly language, required implement simple for-loop described below:

h=1; (i=0, i<5, i++)     h=(h*3)-i; 

i have written following code in arm assembly:

     area prog2, code, readonly      entry       mov r0, #1;         initialize h=1      mov r1, #0;         initialize i=0 loop cmp r1, #5;         @ start of loop, compare 5      mullt r0, r0, #3;   if i<5, h=h*3      sublt r0, r0, r1;   if i<5, h=h-i (ties in previous line)      addlt r1, r1, #1;   increment if less 5      blt loop ;          repeat loop of less 5  stop b stop;             stop program      end 

the problem there error line

     mullt r0, r0, #3;   if i<5, h=h*3 

if delete code, works fine. cannot understand issue 1 line. error description given "bad register name symbol, expected integer register." have tried loading #3 register multiplying 2 registers, didn't help. changed error message "this register combination results in unpredictable behavior." new this, please offer basic instructions fix this. thanks.

mul requires operands registers, must use form mul r0, rn, r0 rn other suitable register.

if result , first operand same result unpredictable error says. due internal operation of processor. why must use r0, rn, r0 , not r0, r0, rn


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -