Lecture 4 Sem5A 23 Part1
Lecture 4 Sem5A 23 Part1
Lecture 4 Sem5A 23 Part1
1
Programming Tools
2
Programming Tools
Editors
They are used for entering and modifying a
program in text form into the computer
e.g., Notepad
Assemblers, Interpreters, and Compilers
They are used for translating a program into
binary machine language which the
computer can understand and execute
3
Programming Tools
Linkers
They create an executable program by
linking a machine language program with
other separately translated binary
program modules and built-in function
libraries.
Loaders
They load an executable program into
memory for execution.
4
Programming Tools
Linking Loaders
They combine the functions of
the linker and loader.
Debuggers
They aid the programmer in
tracing and debugging a
program as it is executed
5
Programming Tools
6
Programming Tools
7
Programming Tools
8
Program Translation
On very early computers, programs were
written and entered in binary form
In fact, data entry required the program to
be entered one binary word at a time,
using switches on the front panel of the
computer, one switch for each bit in the
word
9
Program Translation
This LMC
program is 00 IN /input x
supposed to add 01 STO 05 /save x
two numbers 02 IN /input y
and output the 03 ADD 05 /y = y + x
result. It has one 04 OUT /output y
line missing. 05 DAT 00 /variable x
Addresses in
memory; not part of
the source code
11
Program Translation
Adding the
HALT 00 IN /input x
instruction 01 STO 06 /save x
requires other 02 IN /input y
adjustments to 03 ADD 06 /y = y + x
be made to 04 OUT /output y
the program 05 HLT /halt
06 DAT 00 /variable x
12
Program Translation
13
Program Translation
14
Program Translation
15
Assembly Language and the
Assembler
16
Assembly Language and the Assembler
17
Assembly Language
We saw earlier the advantage of representing the
LMC op codes by short mnemonic names such as
ADD or LDA
This made the program much easier to read and
write
The simplest form of assembler would simply
translate the mnemonic op codes into machine
language, using a lookup table to do the translation
18
Assembly Language
19
Assembly Language
20
Assembly Language
21
Assembly Language
Names for the
symbolic addresses START: IN
are chosen by the STO X
programmer IN
names should have ADD X
some meaning OUT
the simple example HLT
now becomes: X: DAT 00
22
Assembly Language
23
Assembly Language
24
Assembly Language
25
Assembly Language
26
Assembly Language
27
The Assembler
We will translate the simple program by hand.
Start at the top of the program, working through
each instruction, a line at time.
For each line, determine the type of instruction from
the mnemonic, and the number of memory
locations required for that instruction.
This information is stored in an operations table
28
The Assembler
30
The Assembler
31
The Assembler
32
The Assembler
33
The Assembler
34
The Assembler
LMC program
35
The Assembler
36
The Assembler
37
The Assembler
Also during the first symbol table
pass, a symbol table
will be created
containing each label
name that appears in START 00
the program, together X 06
with the memory
address corresponding
to that label name
address
symbol
38
The Assembler
39
The Assembler
43