Chapter 6 – Low-level Programming Languages Computer

Chapter 6 – Low-level Programming Languages
Computer - programmable electronic device that can store, retrieve, and process data -- Data and
instructions to manipulate the data are logically the same and can be stored in the same place
Machine language -- language made up of binary coded instructions built into the hardware of a
particular computer and used directly by the computer
Characteristics of machine language:
Every processor type has its own set of specific machine instructions
The relationship between the processor and the instructions it can carry out is
completely integrated
Each machine-language instruction does only one very low-level task
Virtual computer -- hypothetical machine designed to contain the important features of a real
computer that we want to illustrate
Pep/8 -- virtual computer designed by Stanley Warford that has 39 machine-language instructions
Download Pep/8 here
Features in Pep/8
- The program counter (PC) (contains the address of the next instruction to be executed)
- The instruction register (IR) (contains a copy of the instruction being executed)
- The accumulator (A register)
- The memory unit is made up of 65,636 bytes of storage
Architecture of Pep/8
Instruction Format
- Operation code - specifies which instruction is to be carried out
- Register specifier - specifies which register is to be used (only use A in this chapter)
- Addressing-mode specifier - says how to interpret the operand part of the instruction
Difference between immediate addressing mode and direct addressing mode
Is there something we are
not telling you about the
addressing mode specifier?
How can you tell?
Some Pep/8 instructions
What do these instructions mean?
Written Algorithm of Hello
Hand Simulation
What is the fetch/execute
How much is the PC
Let’s try this with the Pep/8 Simulator
Write an algorithm for creating a machine-language program that adds 2+2 and stores the result into
memory at address 0020. Implement this using the Pep/8 Simulator.
Assembly Language - language that uses mnemonic codes to represent machine-language instructions
Assembler - program that reads each of the instructions in mnemonic form and translates it into the
machine-language equivalent
Pep/8 Assembly Language
Remember –
d -> direct
i -> immediate
Assembler directive
– instructions to the
assembler, rather
than instruction to
be translated
Assembly language version of the program “Hello”
The assembler listing
Problem: Read and sum three values and print the sum
Let’s write #45 from page 192 of text.
Assume we want to add any number of nums. What would we do? Let’s look at page 170 of text.
Homework #8
pg. 189-191 – #16-20, 24, 25, 2729, 33-36, 38, 40