Dale - Computer Science Illuminated 227

Dale - Computer Science Illuminated 227 - Get data...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
200 Chapter 7 Low-Level Programming Languages The machine-language program is shown in binary in the second column and in hexadecimal in the third column. Note that we need to construct the operation specifier in binary because it is made up of a 5-bit opcode, a 1-bit register specifier, and a 2-bit addressing-mode specifier. Once we have the complete eight bits, we can convert it to hexadecimal. We could construct the operand specifier directly in hexadecimal. Hand Simulation Let’s simulate this program’s execution by following the steps of the fetch/execute cycle. Such traces by hand really drive home the steps that the computer carries out. Recall the four steps in the fetch-execute cycle: ± Fetch the next instruction (from place named in the program counter). ± Decode the instruction (and update program counter).
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Get data (operand) if needed. Execute the instruction. There are six instructions in our program. Lets assume that they are in contiguous places in memory with the first instruction stored in memory locations 00000002. Execution begins by loading 0000 into the program counter (PC). At each stage of execution, lets examine the PC (program counter) and the IR (instruction register). The program does not access the A register or the X register, so we do not bother to show Module Write "H" Write "e" Write "l" Write "l" Write "o" Stop Binary Instruction 00011 1 11 1111111110110111 Hex Instruction )1 11C> 00011 1 11 1111111110011010 )1 11!O 00011 1 11 1111111110010011 )1 11!R 00011 1 11 1111111110010011 )1 11!R 00011 1 11 1111111110010000 )1 11!F 11111 1 11 11...
View Full Document

This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.

Ask a homework question - tutors are online