The LD instruction
The LD function is how data gets moved within this Z80 processor. That's pretty important.
LD C,2 is a simple LD function that will take the value of 2 and put that value into register C.
LD B,C is a LD function that will take the value in C (the 2) and put that value into register B.
LD E,0AAH is a LD function that will put the HEX value (hence the H) into register F.
LD H,11111111B will put that binary value into register H.
You can also do all of these using double registers, to denote 2 byte entities (like memory locations in RAM!)
These instructions all do the same thing (shamelessly taken from the z80 instructions manual):
LD B,073H
LD B,01110011B
LD B,65
LD B,“s”
We use LD functions to move from RAM.
LD A,0FFH - register A now contains the value of 255.
LD BC, 5364 - puts the value of 5364 into the double register BC.
LD (BC),A - puts the 255 from register A into memory location 5364 (BC).
LD E, (BC) - pulls the 255 from memory location 5364 (BC) into register E.
LD (BC), 200 - puts the contents of C into memory 200, and B into memory 201. (Take note that it is backwards.)
The LD instruction
The LD function is how data gets moved within this Z80 processor. That's pretty important.
LD C,2 is a simple LD function that will take the value of 2 and put that value into register C.
LD B,C is a LD function that will take the value in C (the 2) and put that value into register B.
LD E,0AAH is a LD function that will put the HEX value (hence the H) into register F.
LD H,11111111B will put that binary value into register H.
You can also do all of these using double registers, to denote 2 byte entities (like memory locations in RAM!)
These instructions all do the same thing (shamelessly taken from the z80 instructions manual):
LD B,073H
LD B,01110011B
LD B,65
LD B,“s”
We use LD functions to move from RAM.
LD A,0FFH - register A now contains the value of 255.
LD BC, 5364 - puts the value of 5364 into the double register BC.
LD (BC),A - puts the 255 from register A into memory location 5364 (BC).
LD E, (BC) - pulls the 255 from memory location 5364 (BC) into register E.
LD (BC), 200 - puts the contents of C into memory 200, and B into memory 201. (Take note that it is backwards.)
Demonstration of the indicated keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
/* * Sample code block */ #include <stdio.h> int main() { return(0); }
Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:
lab46:~$ cd src lab46:~/src$ gcc -o hello hello.c lab46:~/src$ ./hello Hello, World! lab46:~/src$