tailieunhanh - Hardware and Computer Organization- P8

Hardware and Computer Organization- P8:Today, we often take for granted the impressive array of computing machinery that surrounds us and helps us manage our daily lives. Because you are studying computer architecture and digital hardware, you no doubt have a good understanding of these machines, and you’ve probably written countless programs on your PCs and workstations. | Chapter 7 instructions. ORG 400 Program starts at 400 start data2 D0 Load D0 data6 D1 Load D1 data7 D2 load D2 data3 D3 load D3 addr1 A0 load address register D1 A0 transfer byte to memory D2 A0 transfer second byte addr1 A1 load address D3 A1 Logical AND Stop here. The next instruction shows how a label is used JMP start Program loops forever END 400 Stop assembly here Comments on the program 1. The EQU END 400 and ORG 400 instructions are the pseudo-op instructions. They are instructions for the assembler they are not 68000 machine instructions and do not generate any 68000 code. 2. Also note that the default number system is decimal. To write a binary number such as 00110101 you would write it with the percent sign 00110101. Hexadecimal numbers such as 72CF are written with the dollar sign 72CF. 3. Notice that every instruction is commented. 4. Look at the code. Notice that most of the instructions are just moving data around. This is very common in assembly language programming. 5. The instruction D3 A1 is an example of another address mode called indirect addressing. In C we would call this a pointer. The parentheses around A1 mean that the value contained in the internal register A1 should be considered to be a memory address and not a data value. This instruction tells the computer to take the 16-bit quantity stored in register D3 and do a logical AND with the 16-bit value stored in memory at the address pointed to by the A1 register and then put the results back into the memory location pointed to by A1. 6. The instruction D1 A0 is an example of indirect addressing with post increment. The instruction moves a byte of data 8-bits from internal data register D1 to the memory location pointed to by the contents of address register A0. In this way it is similar to the previous instruction. However once the instruction is executed the contents of A0 are incremented by one byte so A0 .

TỪ KHÓA LIÊN QUAN