I'm taking a course now about computer organization and architecture. We've been given some exercises to do. One of them is to convert assembly code into machine instructions.
I'm stuck on converting movia
into a machine instruction.
I know it consists of 2 operations, orhi
and addi
.
This is the code in assembly:
movia r8, 50000
The exercise states that r0
is 0x0
, and r8
is 0x8
.
So, the orhi
would be: orhi r8, r0, %hiadj(50000)
and the add would be: addi r8, r8,%lo(50000)
I've gotten the orhi
to:
00000 01000 1100001101010000 110100
___________________r0____r8_______50000________0x34(opcode)
But I have to use the %hiadj
on the 50000! I don't know how to? I've searched around for it a bit but haven't found an answer clear enough.
I'm very new at this but really want to understand! So, how do you use the %hiadj
? Sorry if the question isn't clear, but if you'd like to help, I'll try and explain more.