What is wrong with this line of Lc3 code?

若如初见. 提交于 2019-12-13 01:56:10

问题


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:


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 ;....


来源:https://stackoverflow.com/questions/30179798/what-is-wrong-with-this-line-of-lc3-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!