Sie sind auf Seite 1von 5

Machine Problem 3

Segmentation and
Addressing Modes

Edison Joshua Valisto


August 17, 2015

Objective:

Addressing modes in the 8086 processor.


Segmentation: Physical Segments and Logical Segments.

Procedure:
1. Assemble, Link and Run program 1.
2. Calculate both the effective and physical addresses of each instruction.
Put the results on the given table.
3. Assemble, Link and Run program 2.
4. Fill in table 2, associated with program 2, in which you specify only the
addressing mode, for both source and destination, for each instruction.
5. Include the tables in your lab report.

Data:
Table 1: Physical and Logical Address
Addressing
Mode
Immediate
Register
Immediate
Immediate
Immediate
Immediate
Immediate
Immediate
Immediate

Code

Type
Immediate

Effective
Address
0723:0000

Physical
Address
07230

MOV
AX,@DATA
MOV DS,AX
LEA
DX,MESSAGE
MOV AH,09H
MOV AH, 0AH
MOV DX,
OFFSET BUF
LEA
DX,MESSAGE2
LEA DX, BUF
MOV
AX,4C00H

Register
Immediate

0723:0003
0723:0005

07233
07235

Immediate
Immediate
Immediate

0723:0008
0723:000C
0723:000E

07238
0723C
0723E

Immediate

0723:0013

07243

Immediate
Immediate

0723:001A
0723:0021

0724A
07251

Table 2: Addressing Modes


Addressing
Mode
Immediate
Immediate
Immediate
Immediate
Immediate
Immediate
Immediate
Direct
Direct

Direct
Immediate
Immediate
Direct
Immediate
Immediate

Code

Type

LEA
DX,PROMPT
MOV AH,09H
MOV AH,0AH
LEA DX,
BUFFER
LEA DX, CRLF
LEA
DX,STRING1
MOV BH,00H
MOV
BL,BUFFER[1]
MOV
BUFFER[BX+2
]
LEA
DX,BUFFER[2]
LEA
DX,STRING2
MOV AH, 02H
MOV
DL,BUFFER[1]
ADD DL, 30H
MOV
AX,4C00H

Immediate
Immediate
Immediate
Immediate
Immediate
Immediate
Immediate
Memory
Memory

Memory
Immediate
Immediate
Memory
Immediate
Immediate

Code:
.model small
.data
msg1 db 10,13,"Enter a string. Max of 20 chracters: $"
msg2 db 10,13,"The string you entered: $"
str db 20
db 20 DUP(?)
.code
main proc
mov ax, @data
mov ds, ax

lea dx, msg1


mov ah, 09h
int 21h
lea dx, str
mov ah, 0ah
int 21h
mov
mov
mov
add

bx,
ah,
al,
bx,

dx
0
ds:[bx+1]
ax

mov [bx+2], '$'


lea bx, str
mov ch, 0
mov cl, [bx+1]
jcxz exit
add bx, 2
lower:
xor [bx], 20h
inc bx
loop lower
lea dx, msg2
mov ah, 09h
int 21h
lea dx, str+2
mov ah, 09h
int 21h
jmp exit
exit:
.exit
endp
end

Analysis/Observation:
The code used above is for converting a lower case letter to upper case
letter and vice versa. The code uses indexing to access each part or letter of
the string. The string manipulation is still not well practiced until now but
observations on some given codes about string manipulation can manage

the lack of knowledge in such field. The XOR instruction is also used instead
of ADD so that the conversion can take place vice versa from lower to upper
case. It is also used to accommodate the space input.
Regarding the addressing modes, some instructions can be viewed in
the debug tab on the emu8086 emulator. It displays the logical address of
the instruction and the actual code for the instruction to identify the
addressing mode. The computations on physical address can be learned on
the handout and from the internet.

Das könnte Ihnen auch gefallen