Sei sulla pagina 1di 5

Objective 1. To learn about the addressing modes available for the 80386 microprocessor. 2. To learn how to move data.

Introduction The available addressing modes in the 80386 microprocessor can be classified into Simple Addressing Modes and Complex Addressing Modes. Simple Addressing Modes includes Intermediate Addressing Mode, Register Addressing and Direct Addressing while Complex Addressing Modes includes Register Indirect Addressing Mode, Base Plus Index Addressing Mode and Register Relative Addressing Mode. The changes in content of register/memory address after each instruction in the source code can be observed by using Turbo Debugging. Procedure A. Experiment #1 Simple Addressing Modes 1. Source code was created as shown as below.

2. The source code was assembled to create object code and then linked to create executable file.

3. The changes in content of register/memory address after each instruction were observed by using Turbo Debugging and then recorded in a table. B. Experiment #2 Complex Addressing Modes 1. All the steps in Experiment #1 were repeated by replacing the source code as shown as below.

C. Experiment #3 Using Addressing Modes 1. An assembly language program that has two variables list1 and list2 was developed. list1 contains ABCD while list2 contains 012345. list1(3) was exchanged with list2(2) in the program.

Results A. Experiment #1 Simple Addressing Modes Instruction mov ax,5 mov bx,3FFFh mov cl,11001001b mov list,7A3Fh mov ch,cl mov ax,cx mov dx,list mov list,ax Register/Memory Address Intermediate Addressing ax bx cx ds Register Addressing cx ax Direct Addressing dx ds Content Before After 0000h 0000h 0000h 000Eh 00C9h 0005h 0000h 000Eh 0005h 3FFFh 00C9h 7A3Fh C9C9h C9C9h 7A3Fh 7A3Fh

B. Experiment #2 Complex Addressing Modes Instruction mov bx,offset list2 mov ax,seg list2 mov ds,ax mov ax,[bx] mov ax,"B" mov [bx],ax mov di,2 mov ax,[bx+di] mov ax,[bx+3] Register/Memory Address Register Indirect Addressing bx ax ds ax ax ds Base Plus Index Addressing di ax Register Relative Addressing ax Content Before After 0000h 0000h 0000h 0B0Fh 4241h 000Ch 0000h 0042h 4443h 000Ch 0B0Fh 0B0Fh 4241h 0042h 0042h 0002h 4443h 0444h

C. Experiment #3 Using Addressing Modes .model small .Stack 200h .data list1 db "ABCD$" list2 db "012345$" .code start: mov ax, seg list1 mov ds,ax mov bx, offset list1 mov ch, [bx+3] mov bx, offset list2 mov cl, [bx+2] mov bx, offset list1 mov [bx+3], cl mov bx, offset list2 mov [bx+2], ch mov ah,09h mov dx, offset list1 int 21h mov dx, offset list2 int 21h

;list1 data ;list2 data

;point to location of list1 ;take out 'D' ;point to location of list2 ;take out '2' ;point to location of list1 ;put '2' into 'D' position ;point to location of list2 ;put 'D' into '2' position

.exit end start

Program output:

Discussion 1. The changes in content of register/memory address after instruction in the source code can be observed using Turbo Debugger. 2. The sign $ at the end of variables of list1 and list2 in the source code is significant to specify the end of the displayed results. It avoids messy and irrelevant symbols present in program output. 3. In the experiment #3, D and 2 was exchanged between variables of list1 and list2 by using addressing modes. Conclusion The addressing modes available for the 80386 microprocessor were learnt by observing the moving process of data through Turbo Debugging.

Potrebbero piacerti anche