Upload
duongthien
View
221
Download
2
Embed Size (px)
Citation preview
A Small Assembly Language Program
Figure C-1. (a) An assembly language program. (b) The corresponding tracer display.
The Processor Cycle
Steps for the execution of a single instruction:
• Fetch instruction from memory from code segment using PC.• Increment program counter.• Decode fetched instruction.
• Fetch necessary data from memory and/or CPU registers
• Perform instruction.• Store results of the instruction in memory and/or registers.• Go back to step 1 to start next instruction.
Flag or Condition Register
Bits set by arithmetic instructions and relate to result:
Z - result is zero
V - result generated an overflow
C - result generated a carry
A - Auxilary carry (out of bit 3)
Memory Organization and Segments
Four segments (chunks of memory) used by 8088
• The code segment.
• The data segment.
• The stack segment.• The extra segment.
Addressing (1)
Figure C-3. Operand addressing modes. The symbol # indicates a numerical value or label.
Addressing (2)
Figure C-3. Operand addressing modes. The symbol # indicates a numerical value or label.
The Tracer (2)
For each project we can have up to 6 files:
pr.s for the assembly source code.
pr.$ for the composite source file.
pr.88 for the load file.
pr.i for preset standard input.
pr.t for preset tracer commands.
pr.# for linking the assembly code to the load file.
Tracer Commands (1)
Figure C-11. Tracer commands. Each command must be followed by carriage return (the Enter key). Empty box indicates just
carriage return needed. Commands with no Address field listed above have no address. # symbol represents integer offset.
Tracer Commands (2)
Figure C-11. Tracer commands. Each command must be followed by carriage return (the Enter key). Empty box indicates just
carriage return needed. Commands with no Address field listed above have no address. # symbol represents integer offset.
General Registers Example
Figure C-13. (a) Part of a program. (b) The tracer register window after line 7 has been executed. (c) The registers.
Call Command and Pointer Registers (3)
Figure C-15. Execution of vecprod.s when it reaches line 28 for the first time.
Buffered and Random File Access (1)
Figure C-19. A program with buffered read and random file access.
Buffered and Random File Access (2)
Figure C-19. A program with buffered read and random file access.