Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i have two homework questions that i needed help with, its on assembly language

ID: 639245 • Letter: I

Question

i have two homework questions that i needed help with, its on assembly language and im using LC-3:

1 a) how might one use a single LC-3 instruction to move the value in R2 into R3?

b) the LC-3 has no subtract instruction. how could one preform the following operation using only three LC-3 instruction: R1 <--- R2 - R3

c) using only LC-3 instruction and without changing the contents of any register, how might one set condition codes based on the value that resides in R1?

d) is there a sequance of LC-3 instructions that will cause the condition codes at the end of the sequence to be N =1, Z=1, and P=0?

e)write an LC-3 instruction that clears the contents of R2

Explanation / Answer

Ah, good old LC-3. Just so you know, this is a super specific question for a particular book that has its own language. You happen to have lucked out because I read that book. This should really be in stackexchange though.

First question:

Second question:

For the record, the fact that you can't answer these questions shows that you were spacing out while reading the chapter or didn't quite understand it. I highly recommend re-reading it. This is a really basic question that is not meant to be challenging.

c)ADD R3, R3, #0

d)No, this would require the previous instruction to be both zero and positive at the same
time. Numbers cannot do that.

e)AND R4, R4, #0