Question

I tried to write the inst x0000 which means BR with nzp=0 and offset 0.

I wrote BR #0 in the simulator.

Instead of giving me that x0000 on the simulator, I get 0x0E00 which means nzp is 111.

What is the correct way of doing this?

Was it helpful?

Solution 2

You can do NOP because if nzp=000 it means that the PC won't change, so you just need to pass this instruction.

Another option is do LABEL .fill x0000 because the instruction code of BR with nzp=0 and offset 0 will be just 000.

OTHER TIPS

You cannot have nzp=000. A number is either negative, zero or positive.

According to this course on LC3 from UPenn

LC-3 has three 1-bit condition code registers

  • N - negative
  • Z - zero
  • P - positive (greater than zero)

Exactly one will be set at all times.
Based on the last instruction that altered a register.

BR will assemble to branch-always, which is exactly the same as BRnzp, which is why you're seeing that in the assembled code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top