Load a value into a register in LC3

user1874239 picture user1874239 · Apr 18, 2013 · Viewed 8.6k times · Source

Is there a single LC3 instruction to load a value into a register? I need to write some assembly code and I come to where I need to write just a single instruction to store the value 1 in R1.

Answer

Nexion picture Nexion · Apr 20, 2013
LD R1, value

Do a .fill on "value" with whatever value you want to load into R1. I don't believe there's a way to load a literal value into a register with a single line, but you can do it with one instruction and one label.