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?
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
- Alright, I did all of the steps and pasted the code onto my page, but there is no counter, just a bunch of funny looking text. What’s up?
- 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?
- How to add Nanolive Messenger Code in a Framed Page?