Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I see that on page 13 of the notes, on line 22 (LD R0, #10). What is the significance of the # in this line of code?

code LD line notes page r0 significance
0
Posted

I see that on page 13 of the notes, on line 22 (LD R0, #10). What is the significance of the # in this line of code?

0

The # before a number indicates an “immediate mode” operand (immed). LD R0, #10 says to put a 10 into register 0. LD R0, 10 says to put the contents of the memory cell with address 10 into register 0 These are quite different. Without the sharp you have direct memory mode (dmem) LD R0 $A$ is also dmem mode since $A$ is just a name indicating an address. There are 6 other memory modes also. We will discuss them later or you can read about them in the sam doc. These memory address modes are fairly typical of assemblers. You probably used them in your assembly language course. By the way, the R0 itself is direct register mode (dreg). The first operand in a two operand instruction is always dreg mode, but you can also use dreg for the second operand. This and more is all explained in the SAM2 documentation in the docs directory in the distributed software.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123