Chapter 3
Chapter 3
Chapter 3
• System software
– Allows one to develop appln programs for MP-
based systems
– Includes:
• Editors –create and change source programs
• Compilers –translate high-level source code to machine
code
• Assemblers –translate assembly into binary or obj code
• Interpreters – execute one statement at a time
• Debuggers – interactive executing & debugging
• OS – performs resource mgt and human-machine
interaction
Program development steps
CONNECTOR
SUB
ROUTINE TERMINATION
Program development steps
START
READ VALUE
FROM SENSOR
ADD 7
STORE RESULT
IN MEMORY
WAIT 1 HOUR
24
SAMPLES?
STOP
Program development steps
• Pseudocodes
– English-like statements used to represent the
commonly used structures:
• SEQUENCE, IF-THEN-ELSE, WHILE-DO
– Early days approach: structured programming –
breaking problem into independent modules (or
reverse)
• E.g IF Temperature is less than 70 degrees THEN
Turn on heater
ELSE
Turn off heater
Program development steps
• Reading assignment:
– Standard Program Structures
• SEQUENCE
• IF – THEN
• IF – THEN – ELSE
• WHILE – DO
• REPEAT UNTIL
• CASE
Addressing Modes
Introduction
The 8086 addresses a segmented memory. The complete
physical address for a main memory slot (which has 1byte
capacity), is 20-bits long, is generated using segment and
offset registers (which contain segment and offset
addresses), each 16-bits long.
To generate physical address, the content of a segment
register(segment address) is shifted left bit-wise four times
and to this result, content of an offset register(offset
address) is added, to produce a 20-bit physical address.
The segment address value is to be taken from an
appropriate segment register depending upon whether
code segment(CS), data segment(DS) or stack
segment(SS) are to be accessed, while the offset may
be the content of IP, BX, SI, DI,SP or an immediate
16-bit value, depending upon the addressing mode.
…cont…
Thus the addressing modes describe the types of
operands and the way they are accessed
for executing an instruction.
Addressing modes:
– The different ways in which a processor can access data
that it operates on
– Indicated in the instruction in assembly languages
E.g. Move instruction format:
MOV destination, source
Source – could be a number, register or memory location
Destination – can be register or memory (1 of 24 ways)
NB: both source and destination can’t be memory locations in an
instruction
…cont…
2. Add the contents of the memory location 2000H:0500H to contents of 3000H:0600H and
store the result in 5000H:0700H.
Solution: Unlike the previous example programs, this program refers to the memory locations
in different segments, hence, while referring to each location, the data segment will have to
be newly initialized with the required value. Figure 5.13 shows the flow chart. The
instruction sequence for the above flow chart is given along with the comments.
…cont…
3. Move a byte string , 16-bytes long, from the offset 0200H to 0300H
in the segment 7000H.
4. Find out the largest number from an unordered array of sixteen 8-bit
numbers stored sequentially in the memory locations starting at
offset 0500H in the segment 2000H.