Here's the assignment:
Write a program in assembly such that it contains a subroutine which performs the AND operation with the entry of register
R6
and hexadecimal #0001h. And then repeat it by applying the same operation to five successive memory locations. Use an appropriate addressing mode.
For the first part, I just did and.w #0001h, R6
. For the second part, I was hinted to use indexed mode and to use this format:
Loop
mov.w (0)R4, R6
call and_subroutine
add 2, R4
jmp Loop
And use cmp
to exit out of this loop. Before I can figure out how to do the rest of the problem, I wanted to test out bits and I entered:
mov.w #0200h, R4
mov.w (0)R4, R6
and.w #0001h, R6
mov.w (2)R4, R6
For the (0)R4
and (2)R4
lines, it gives me this error:
Unexpected trailing operand(s)
I tried taking out the last 2 lines trying with just (0)R4
, but that didn't help the error. Anyone know what I'm doing wrong?