What is wrong with this line of Lc3 code?

2019-08-10 05:09发布

I am doing a practice exam question.

The Question is

Is there anything wrong in this line of LC3 code? (The starred line)

ADD R3, R3, 0;
**BRNZ ISPOS;**
HALT
.BLKW 250
ISPOS NOT R3, R3 ....

I saw that the starred line is Branch and the condition codes are negative and zero, basically go to label ISPOS if the condition code is negative or zero or halt the program otherwise.

I would say that this line of LC3 code has nothing wrong with it. Does anyone see any problems with it?

1条回答
够拽才男人
2楼-- · 2019-08-10 06:00

Yes, there are a couple different errors with this code segment.

Opcodes cannot have anything other than a label preceding them.

**BRNZ ISPOS;**

Must become:

BRNZ ISPOS;**

You cannot have any random characters after operands, unless they are commented out

ISPOS NOT R3, R3 ....

Must change to:

ISPOS NOT R3, R3 ;....
查看更多
登录 后发表回答