Download - wk1to4
-
8/2/2019 wk1to4
1/266
von Neumann Stored Program concept
Main memory storing programs and data ALU calculating data
Control unit interpreting instructions from memoryand executing
Input and output equipment operated by controlunit
-
8/2/2019 wk1to4
2/266
von Neumann
-
8/2/2019 wk1to4
3/266
von Neumann
1000 x 40 bit words
Binary number 2 x 20 bit instructions
Set of registers (storage in CPU)
Memory Buffer Register Memory Address Register
Instruction Register
Instruction Buffer Register Program Counter
Accumulator
Multiplier Quotient
-
8/2/2019 wk1to4
4/266
Moores Law Increased density of components on chip
Gordon Moore - cofounder of Intel Number of transistors on a chip will double every year
Since 1970s development has slowed a little
Number of transistors doubles every 18 months Cost of a chip has remained almost unchanged
Higher packing density means shorter electrical paths,giving higher performance
Smaller size gives increased flexibility
Reduced power and cooling requirements
Fewer interconnections increases reliability
-
8/2/2019 wk1to4
5/266
Speeding it up
Pipelining On board cache
On board L1 & L2 cache
Branch prediction
Data flow analysis
Speculative execution
-
8/2/2019 wk1to4
6/266
Intel 8086 & 8088
The 8086 is a 16-bit microprocessor chip designed byIntel and introduced on the market in 1978, which gaverise to the x86 architecture.
Intel 8088, released in 1979, was essentially the samechip, but with an external 8-bit data bus (allowing the useof cheaper and fewer supporting logic chips), and isnotable as the processor used in the original IBM PC.
-
8/2/2019 wk1to4
7/266
Segmentation
Compilers for the 8086 commonly supported twotypes of pointer, "near" and "far".
Near pointers were 16-bit addresses implicitly
associated with the program's code or datasegment (and so made sense only in programssmall enough to fit in one segment).
Far pointers were 32-bit segment:offset pairs.
-
8/2/2019 wk1to4
8/266
Segmentation
To avoid the need to specify "near" and "far" on everypointer and every function which took or returned apointer, compilers also supported "memory models"which specified default pointer sizes.
The "small", "compact", "medium", and "large" modelscovered every combination of near and far pointers forcode and data.
The "tiny" model was like "small" except that code anddata shared one segment.
The "huge" model was like "large" except that allpointers were huge instead of far by default.Precompiled libraries often came in several versionscompiled for different memory models.
-
8/2/2019 wk1to4
9/266
-
8/2/2019 wk1to4
10/266
-
8/2/2019 wk1to4
11/266
-
8/2/2019 wk1to4
12/266
12
x86 Registers Category
Category Bit Register Name
General Purpose Register 32/16 E/AX,E/BX,E/CX,E/DX
General Purpose Register 8 AH,AL,BH,BL,CH,CL,DH,DL
Pointer Register 32/16 E/SP (Stack Pointer)
E/BP (Base Pointer)Index Register 32/16 E/SI (Source Index)
E/DI (Destination Index)
Segment Register 32/16 CS (Code Segment)
DS (Data Segment)
SS (Stack Segment)ES (Extra Segment)
Instruction Pointer Register 32/16 E/IP (Instruction Pointer)
Status Register (Flag) 32/16 E/FLAGS (Flag Register)
-
8/2/2019 wk1to4
13/266
13
General Purpose Registers This register is used for general data manipulation
Even CPU able to operate on the data stored in memory, the
same data can be process much faster if it is in register
Register Function
E/AX Accumulator Register
For arithmetic, logic and data transfer operation
E/BX Base Register
Also as address register
E/CX Count RegisterUsed for loop counter, shift and rotate bits
E/DX Data Register
Used in division and multiplication also I/O operation
-
8/2/2019 wk1to4
14/266
14
8-bit Data Division from 16-bit
16-bit register can be divided into two 8-bit
register (i.e AX=AH&AL, BX=BH&BL,CX=CH&CL, DX=DH&DL)
Figure 1: 8-bit Data Division from 16-bit
-
8/2/2019 wk1to4
15/266
15
16-bit Data form into 32-bit
Similarly, 32-bit register can be made from 16-
bit register i.e
EAX=undefined 16 bits +AX
EBX=undefined 16 bits +BX
ECX=undefined 16 bits +CXEDX=undefined 16 bits +DX
-
8/2/2019 wk1to4
16/266
-
8/2/2019 wk1to4
17/266
17
Segment Register
Main memory management in 8086 use segmentconcept
The following show the usage of segment in memory
Segment Usage
Code (CS) Space to store program that will be executed
Data (DS) Space to store data that will be processed
Stack (SS) Special space to store information needed by
microprocessor to execute subroutine orinterrupt service
Extra (ES) Function is the same as DS
-
8/2/2019 wk1to4
18/266
-
8/2/2019 wk1to4
19/266
19
Instruction Pointer Register (IP)
Register which stores instruction addressto be executed
Each time instruction is fetch from memoryto be executed in processor, IP contentwill be added so that it always show to thenext instruction
If branch instruction, the IP content will beloaded with new value which is the branchaddress
-
8/2/2019 wk1to4
20/266
20
Index Register and Pointer
This registers is used for storing relative shiftingvalue for memory address location
There are 2 pointer register:
Stack Pointer (SP) point to the top stack
Base Pointer (BP) used for fetch data in data segment There are 2 index register:
Source Index (SI) contains offset address for sourceoperand in data segment
Destination Index (DI) - contains offset value fordestination operand in DS
-
8/2/2019 wk1to4
21/266
-
8/2/2019 wk1to4
22/266
-
8/2/2019 wk1to4
23/266
Assembler
An assembler translates assembly language programsinto machine codes It resolves symbolic names for memory locations and
other entities.
-
8/2/2019 wk1to4
24/266
Assembler
There are two types of assemblers based on how manypasses through the source are needed to produce theexecutable program.
One-pass assemblers go through the source code onceand assumes that all symbols will be defined before anyinstruction that references them.
Two-pass assemblers (and multi-pass assemblers)create a table with all unresolved symbols in the firstpass, then use the 2nd pass to resolve these addresses.
The advantage of the two-pass assembler is thatsymbols can be defined anywhere in the programsource.
-
8/2/2019 wk1to4
25/266
Assembler
As a result, the program can be defined in a more logicaland meaningful way.
This makes two-pass assembler programs easier to readand maintain.
-
8/2/2019 wk1to4
26/266
Variable Declarations
Our compiler supports two types of variables:BYTEandWORD.
Syntax for a variable declaration:
nameDBvalue
nameDWvalue
DB - stays for Define Byte.DW - stays for Define Word.
-
8/2/2019 wk1to4
27/266
Syntax for a variable declaration:
nameDBvalue
nameDWvalue
DB - stays for Define Byte.
DW - stays for Define Word.name- can be any letter or digit combination
value- can be any numeric value in any supportednumbering system (hexadecimal, binary, or decimal), or"?" symbol for variables that are not initialized.
Variable Declarations
-
8/2/2019 wk1to4
28/266
Declare Variables
use DB to declare variables with small
values 0 to 255. use DW to declare variables with larger
values 0 to 65000.
C++: int HT=47, WD=2415, SZ; ASM: HT DB 47
WD DW 2415
SZ DW ?
unitialised value in ASM is denoted by ?
-
8/2/2019 wk1to4
29/266
comments / remarks
C++: comments denoted by //
anything after // will be ignored
in ASM: comments denoted by ;anything after ; will be ignored
C++ has multi-line comments enclosed by
/* and */. In ASM, each comment line mustbe individually preceded by ;
-
8/2/2019 wk1to4
30/266
Simple Assignments
The easiest expressions to convert to assemblylanguage are the simple assignments.
MOV instruction
Simple assignments copy a single value into avariable
variable := value Eg: C++: P = 5;
ASM: MOV P, 5 This move immediate instruction copies the
constant into the variable.
-
8/2/2019 wk1to4
31/266
Small Sample Program
ORG 100h
MOV AL, var1
MOV BX, var2RET ; stops the program.
VAR1 DB 7
var2 DW 1234h
-
8/2/2019 wk1to4
32/266
ORG
Program start address
ORG 100H
normally start at address 100H(hexadecimal)
-
8/2/2019 wk1to4
33/266
RET
similar to C++ return statement.
-
8/2/2019 wk1to4
34/266
Simple Assignments(MOV)
The easiest expressions to convert to assemblylanguage are the simple assignments.
Simple assignments copy a single value into a variable
variable := constant Eg: C++: P = 5;
ASM: MOV P, 5
This move immediate instruction copies the constant into
the variable.
-
8/2/2019 wk1to4
35/266
It is possible to enter numbers in anysystem, hexadecimal numbers shouldhave "h" suffix, binary "b" suffix, octal "o"
suffix, decimal numbers require no suffix.
mov AX, 46H ;hex
mov BX, 1011B ;binary
mov AH, 251o ;octal
mov CH, 36 ;decimal
-
8/2/2019 wk1to4
36/266
Assembler Directive/Pseudo-Ops
2 types of ASM statements
program instruction convert to machine code of the program, ADD,
SUB, MUL, MOV, DIV, etc
assembler directives (pseudo-ops) does not convert to machine code of the
program
info for the assembler eg:
variable declaration DB, DW program start address ORG
data, code, stack segment, .DATA, .CODE, .STACK
etc
-
8/2/2019 wk1to4
37/266
This example assignment copies a variable into a
variable P := Q The assignment above is somewhat complicated since
the 80x86 doesnt provide a memoryto-memory movinstruction.
Therefore, to copy one memory variable into another,you must move the data through a register.
Eg: C++: P = Q;
ASM: MOV AX, Q ;AX = QMOV P, AX ;P=AX=Q
Assignments (MOV)
-
8/2/2019 wk1to4
38/266
Addition (ADD)
Examples of common simple expressions:
X := Y + Z
ASM:
mov ax, y ;ax=y
add ax, z ;ax=ax+z=y+z
mov x, ax ;x=ax=y+z
-
8/2/2019 wk1to4
39/266
Arithmetic Expressions
Arithmetic expressions, in most high levellanguages, look similar to their algebraicequivalents:
X:=Y+Z; In assembly language, youll need severalstatements to accomplish this same task, e.g.,
mov ax, y ;ax=y
add z ;ax=ax+y=z+ymov x, ax ;x=ax=x+y
-
8/2/2019 wk1to4
40/266
Arithmatic Expressions
A math expression takes the form:
var := term1 op term2
Var is a variable, term1 and term2 are variables orconstants, and op is some arithmetic operator(+,-,*, /,etc)
ASM: op term1 term2
where
op = ADD, SUB, MUL, IMUL, DIV, IDIV, etc
-
8/2/2019 wk1to4
41/266
SUBTRACT (SUB)
X := Y - Z;
ASM:mov ax, y ;ax=y
sub ax, z ;ax=ax-z=y-z
mov x, ax ;x=ax=y-z
-
8/2/2019 wk1to4
42/266
INCREMENT (INC)
X := X + 1;
ASM:inc x
-
8/2/2019 wk1to4
43/266
DECREMENT (DEC)
X := X - 1;
ASM:dec x
Instruction Format
-
8/2/2019 wk1to4
44/266
Instruction Format
instruction has opcode + operand(s)
ADD AX, 2SUB BX, Y
MOV Z, 1584
INC Y
opcode is ADD, SUB, MOV, INC
operands are AX, BX, X, Y, 2, 1584
-
8/2/2019 wk1to4
45/266
Arithmetic Expressions
Arithmetic expressions, in most high level languages,look similar to their algebraic equivalents:
X:=Y+Z;
In assembly language, youll need several statements toaccomplish this same task, e.g.,
mov ax, y ;ax=y
add z ;ax=ax+y=z+ymov x, ax ;x=ax=x+y
-
8/2/2019 wk1to4
46/266
Complex Expressions
A complex function that is easy to convert to assemblylanguage is one that involves
three terms and two operators, for example:
W := W - Y - Z;
-
8/2/2019 wk1to4
47/266
Complex Expressions
Clearly the straight-forward assembly languageconversion of this statement will require two subinstructions.
However, even with an expression as simple as this one,
the conversion is not trivial.
There are actually two waysto convert this from thestatement above into assembly language:
mov ax, w
sub ax, y
sub ax, z
mov w, ax
-
8/2/2019 wk1to4
48/266
Debuggers and Debugging
The final, and almost certainly the most painful, part ofthe assembly language development process isdebugging.
Debuggingis simply the systematic process by which
bugs are located and corrected.
A debuggeris a utility program designed specifically to
help you locate and identify bugs.
-
8/2/2019 wk1to4
49/266
Debuggers and Debugging
One of the problems with debugging computer programsis that they operate so quickly.
Thousands of machine instructions can be executed in asingle second, and if one of those instructions isn't quiteright, it's past and gone long before you can identify
which one it is by staring at the screen. A debugger allows you to execute the machine
instructions in a program one at a time, allowing you topause indefinitely between each one to examine theeffects of the last instruction on the screen.
The debugger also lets you look at the contents of anylocation in memory, and the values stored in anyregister, during that pause between instructions.
-
8/2/2019 wk1to4
50/266
-
8/2/2019 wk1to4
51/266
-
8/2/2019 wk1to4
52/266
-
8/2/2019 wk1to4
53/266
-
8/2/2019 wk1to4
54/266
-
8/2/2019 wk1to4
55/266
-
8/2/2019 wk1to4
56/266
-
8/2/2019 wk1to4
57/266
-
8/2/2019 wk1to4
58/266
-
8/2/2019 wk1to4
59/266
-
8/2/2019 wk1to4
60/266
-
8/2/2019 wk1to4
61/266
-
8/2/2019 wk1to4
62/266
-
8/2/2019 wk1to4
63/266
-
8/2/2019 wk1to4
64/266
-
8/2/2019 wk1to4
65/266
-
8/2/2019 wk1to4
66/266
-
8/2/2019 wk1to4
67/266
-
8/2/2019 wk1to4
68/266
-
8/2/2019 wk1to4
69/266
-
8/2/2019 wk1to4
70/266
-
8/2/2019 wk1to4
71/266
-
8/2/2019 wk1to4
72/266
-
8/2/2019 wk1to4
73/266
-
8/2/2019 wk1to4
74/266
-
8/2/2019 wk1to4
75/266
-
8/2/2019 wk1to4
76/266
-
8/2/2019 wk1to4
77/266
-
8/2/2019 wk1to4
78/266
-
8/2/2019 wk1to4
79/266
-
8/2/2019 wk1to4
80/266
-
8/2/2019 wk1to4
81/266
-
8/2/2019 wk1to4
82/266
-
8/2/2019 wk1to4
83/266
-
8/2/2019 wk1to4
84/266
-
8/2/2019 wk1to4
85/266
-
8/2/2019 wk1to4
86/266
-
8/2/2019 wk1to4
87/266
-
8/2/2019 wk1to4
88/266
-
8/2/2019 wk1to4
89/266
-
8/2/2019 wk1to4
90/266
-
8/2/2019 wk1to4
91/266
-
8/2/2019 wk1to4
92/266
-
8/2/2019 wk1to4
93/266
-
8/2/2019 wk1to4
94/266
-
8/2/2019 wk1to4
95/266
-
8/2/2019 wk1to4
96/266
-
8/2/2019 wk1to4
97/266
-
8/2/2019 wk1to4
98/266
-
8/2/2019 wk1to4
99/266
-
8/2/2019 wk1to4
100/266
-
8/2/2019 wk1to4
101/266
-
8/2/2019 wk1to4
102/266
-
8/2/2019 wk1to4
103/266
-
8/2/2019 wk1to4
104/266
-
8/2/2019 wk1to4
105/266
-
8/2/2019 wk1to4
106/266
-
8/2/2019 wk1to4
107/266
-
8/2/2019 wk1to4
108/266
-
8/2/2019 wk1to4
109/266
-
8/2/2019 wk1to4
110/266
-
8/2/2019 wk1to4
111/266
-
8/2/2019 wk1to4
112/266
-
8/2/2019 wk1to4
113/266
-
8/2/2019 wk1to4
114/266
-
8/2/2019 wk1to4
115/266
-
8/2/2019 wk1to4
116/266
-
8/2/2019 wk1to4
117/266
-
8/2/2019 wk1to4
118/266
-
8/2/2019 wk1to4
119/266
-
8/2/2019 wk1to4
120/266
-
8/2/2019 wk1to4
121/266
-
8/2/2019 wk1to4
122/266
-
8/2/2019 wk1to4
123/266
-
8/2/2019 wk1to4
124/266
-
8/2/2019 wk1to4
125/266
-
8/2/2019 wk1to4
126/266
-
8/2/2019 wk1to4
127/266
-
8/2/2019 wk1to4
128/266
-
8/2/2019 wk1to4
129/266
-
8/2/2019 wk1to4
130/266
-
8/2/2019 wk1to4
131/266
-
8/2/2019 wk1to4
132/266
-
8/2/2019 wk1to4
133/266
-
8/2/2019 wk1to4
134/266
-
8/2/2019 wk1to4
135/266
-
8/2/2019 wk1to4
136/266
-
8/2/2019 wk1to4
137/266
-
8/2/2019 wk1to4
138/266
-
8/2/2019 wk1to4
139/266
-
8/2/2019 wk1to4
140/266
-
8/2/2019 wk1to4
141/266
-
8/2/2019 wk1to4
142/266
-
8/2/2019 wk1to4
143/266
-
8/2/2019 wk1to4
144/266
-
8/2/2019 wk1to4
145/266
-
8/2/2019 wk1to4
146/266
-
8/2/2019 wk1to4
147/266
-
8/2/2019 wk1to4
148/266
-
8/2/2019 wk1to4
149/266
-
8/2/2019 wk1to4
150/266
-
8/2/2019 wk1to4
151/266
-
8/2/2019 wk1to4
152/266
-
8/2/2019 wk1to4
153/266
-
8/2/2019 wk1to4
154/266
-
8/2/2019 wk1to4
155/266
-
8/2/2019 wk1to4
156/266
-
8/2/2019 wk1to4
157/266
-
8/2/2019 wk1to4
158/266
-
8/2/2019 wk1to4
159/266
-
8/2/2019 wk1to4
160/266
-
8/2/2019 wk1to4
161/266
-
8/2/2019 wk1to4
162/266
-
8/2/2019 wk1to4
163/266
-
8/2/2019 wk1to4
164/266
-
8/2/2019 wk1to4
165/266
-
8/2/2019 wk1to4
166/266
-
8/2/2019 wk1to4
167/266
-
8/2/2019 wk1to4
168/266
-
8/2/2019 wk1to4
169/266
-
8/2/2019 wk1to4
170/266
-
8/2/2019 wk1to4
171/266
-
8/2/2019 wk1to4
172/266
-
8/2/2019 wk1to4
173/266
-
8/2/2019 wk1to4
174/266
-
8/2/2019 wk1to4
175/266
-
8/2/2019 wk1to4
176/266
-
8/2/2019 wk1to4
177/266
-
8/2/2019 wk1to4
178/266
-
8/2/2019 wk1to4
179/266
-
8/2/2019 wk1to4
180/266
-
8/2/2019 wk1to4
181/266
-
8/2/2019 wk1to4
182/266
-
8/2/2019 wk1to4
183/266
-
8/2/2019 wk1to4
184/266
-
8/2/2019 wk1to4
185/266
-
8/2/2019 wk1to4
186/266
-
8/2/2019 wk1to4
187/266
-
8/2/2019 wk1to4
188/266
-
8/2/2019 wk1to4
189/266
-
8/2/2019 wk1to4
190/266
-
8/2/2019 wk1to4
191/266
-
8/2/2019 wk1to4
192/266
-
8/2/2019 wk1to4
193/266
-
8/2/2019 wk1to4
194/266
-
8/2/2019 wk1to4
195/266
-
8/2/2019 wk1to4
196/266
-
8/2/2019 wk1to4
197/266
-
8/2/2019 wk1to4
198/266
-
8/2/2019 wk1to4
199/266
-
8/2/2019 wk1to4
200/266
-
8/2/2019 wk1to4
201/266
-
8/2/2019 wk1to4
202/266
-
8/2/2019 wk1to4
203/266
-
8/2/2019 wk1to4
204/266
-
8/2/2019 wk1to4
205/266
-
8/2/2019 wk1to4
206/266
-
8/2/2019 wk1to4
207/266
-
8/2/2019 wk1to4
208/266
-
8/2/2019 wk1to4
209/266
-
8/2/2019 wk1to4
210/266
-
8/2/2019 wk1to4
211/266
-
8/2/2019 wk1to4
212/266
-
8/2/2019 wk1to4
213/266
-
8/2/2019 wk1to4
214/266
-
8/2/2019 wk1to4
215/266
-
8/2/2019 wk1to4
216/266
-
8/2/2019 wk1to4
217/266
-
8/2/2019 wk1to4
218/266
-
8/2/2019 wk1to4
219/266
-
8/2/2019 wk1to4
220/266
-
8/2/2019 wk1to4
221/266
-
8/2/2019 wk1to4
222/266
-
8/2/2019 wk1to4
223/266
-
8/2/2019 wk1to4
224/266
-
8/2/2019 wk1to4
225/266
-
8/2/2019 wk1to4
226/266
-
8/2/2019 wk1to4
227/266
-
8/2/2019 wk1to4
228/266
-
8/2/2019 wk1to4
229/266
-
8/2/2019 wk1to4
230/266
-
8/2/2019 wk1to4
231/266
-
8/2/2019 wk1to4
232/266
-
8/2/2019 wk1to4
233/266
-
8/2/2019 wk1to4
234/266
-
8/2/2019 wk1to4
235/266
-
8/2/2019 wk1to4
236/266
-
8/2/2019 wk1to4
237/266
-
8/2/2019 wk1to4
238/266
-
8/2/2019 wk1to4
239/266
-
8/2/2019 wk1to4
240/266
-
8/2/2019 wk1to4
241/266
-
8/2/2019 wk1to4
242/266
-
8/2/2019 wk1to4
243/266
-
8/2/2019 wk1to4
244/266
-
8/2/2019 wk1to4
245/266
-
8/2/2019 wk1to4
246/266
-
8/2/2019 wk1to4
247/266
-
8/2/2019 wk1to4
248/266
-
8/2/2019 wk1to4
249/266
-
8/2/2019 wk1to4
250/266
-
8/2/2019 wk1to4
251/266
-
8/2/2019 wk1to4
252/266
-
8/2/2019 wk1to4
253/266
-
8/2/2019 wk1to4
254/266
-
8/2/2019 wk1to4
255/266
-
8/2/2019 wk1to4
256/266
-
8/2/2019 wk1to4
257/266
-
8/2/2019 wk1to4
258/266
Opcode mnemonics
Instructions (statements) in assembly language are
generally very simple unlike those in high level
-
8/2/2019 wk1to4
259/266
generally very simple, unlike those in high-levellanguages. Generally, an opcode is a symbolic name for a single
executable machine language instruction, and there is atleast one opcode mnemonic defined for each machine
language instruction. Each instruction typically consists of an operationoropcodeplus zero or more operands.
Assembly directives / pseudo-ops
Assembly Directives are instructions thatd b h A bl
-
8/2/2019 wk1to4
260/266
Assembly Directives are instructions thatare executed by the Assembler atassembly time, not by the CPU at runtime.
Assembling the Source Code File
The text editor first creates a new text file, and later
changes that same text file as you extend modify andf bl l
-
8/2/2019 wk1to4
261/266
changes that same text file, as you extend, modify, andperfect your assembly language program. As a convention, most assembly language source code
files are given a file extension of .ASM. In other words, for the program named FOO, the
assembly language source code file would be namedFOO.ASM. It is possible to use file extensions other than .ASM, but I
feel that using the .ASM extension can eliminate someconfusion by allowing you to tell at a glance what a file is
for-just by looking at its name. All told, about nine different kinds of files can be involvedduring assembly language development-more if you takethe horrendous leap into Windows softwaredevelopment.
Assembling the Source Code File
Each type of file will have its own standard file extension.
Anything that will help you keep all that complexity in line
-
8/2/2019 wk1to4
262/266
Anything that will help you keep all that complexity in linewill be worth the (admittedly) rigid confines of a standardnaming convention.
As you can see from the flow in figure above, the editor
produces a source code text file, which we show ashaving the .ASM extension.
This file is then passed to the assembler program itself,for translation to a re locatable object module file with anextension of .OBJ.
When you invoke the assembler, DOS will load theassembler from disk and run it.
Assembling the Source Code File
The assembler will open the source code file you named
after the name of the assembler and begin processingth fil
-
8/2/2019 wk1to4
263/266
after the name of the assembler and begin processingthe file. Almost immediately afterward, it will create an object file
with the same name as the source file, but with an .OBJextension.
As the assembler reads lines from the source code file, itwill examine them, construct the binary machineinstructions the source code lines represent, and thenwrite those machine instructions to the object code file.
When the assembler comes to the end of the source
code file, it will close both source code file and objectcode file and return control to DOS.
Linking
In traditional assembly language work, what actually
happens is that the assembler writes an intermediatebj t d fil ith OBJ t i t di k
-
8/2/2019 wk1to4
264/266
happens is that the assembler writes an intermediateobject code file with an .OBJ extension to disk. You can't run this .OBJ file, even though it generally
contains all the machine instructions that your assemblylanguage source code file specified.
The .OBJ file needs to be processed by anothertranslator program, the linker. The linker performs a number of operations on the .OBJ
file, most of which would be meaningless to you at thispoint.
The most obvious task the linker does is to weaveseveral .OBJ files into a single .
Debuggers and Debugging
The final, and almost certainly the most painful, part of
the assembly language development process is
-
8/2/2019 wk1to4
265/266
the assembly language development process isdebugging.
Debuggingis simply the systematic process by whichbugs are located and corrected.
A debuggeris a utility program designed specifically to
help you locate and identify bugs.
Debuggers and Debugging
One of the problems with debugging computer programs
is that they operate so quickly
-
8/2/2019 wk1to4
266/266
is that they operate so quickly. Thousands of machine instructions can be executed in a
single second, and if one of those instructions isn't quiteright, it's past and gone long before you can identifywhich one it is by staring at the screen.
A debugger allows you to execute the machineinstructions in a program one at a time, allowing you topause indefinitely between each one to examine theeffects of the last instruction on the screen