Microprocessors and Interfacing Assignment No.2 Lab Manual 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

MICROPROCESSORS AND INTERFACING

ASSIGNMENT NO.2

LAB MANUAL 1
 That the starting address of the section of memory holding
code(CS) is 0100h.

 The data segment (DS) is a section of memory that contains most


data used by the program. Here the value DS is 0100h.

 The Initially the value of Intsruction Pointer(IP) will be 0000h.

 The instruction pointer (IP), is used by the microprocessor to find


the next sequential instruction in a program located with in the
code segment.

INSTRUCSTION OFFSET ADDRESS


MOV AL,chr 0100:0000

ADD AL,bytevar 0100:0003

MOV bytevar,AL 0100:0007

XCHG AL,AH 0100:000A

MOV AX,wordvar 0100:000C

MOV AX,0B800h 0100:000F

MOV DS,AX 0100:0012

MOV CL,'A' 0100:0014

MOV CH,1101_1111b 0100:0016

MOV BX,15Eh 0100:0018

MOV [BX],CX 0100:001B

RET 0100:001D

CODE MACHINE LANGUAGE CODE


MOV AL,chr MOV AL,[00086h]

ADD AL,bytevar ADD AL,[00083h]

MOV bytevar,AL MOV [00083h],AL

XCHG AL,AH XCHG AL,AH

MOV AX,wordvar MOV AX, [00084h]

MOV AX,0B800h MOV AX,0B800h

MOV DS,AX MOV DS,AX

MOV CL,'A' MOV CL,041h

MOV CH,1101_1111b MOV CH,0DFh

MOV BX,15Eh MOV BX,0015Eh

MOV [BX],CX MOV [BX],CX

RET RET

VALUES OF REGISTERS BEFORE VALUES OF REGISTERS AFTER


EXECUTION EXECUTION
AL = 00 AL = 00

AH = 00 AH = B8

AX = 0000 AX = B800

DS = 0100 DS = B800

CL = 00 CL = 41

CH = 00 CH = DF

BX = 0000 BX = 015E

CX = 0000 CX = DF41

IP = 0000 IP = FF00

OPERATION AND SINGLE LINE COMMENT FOR EACH INSTRUCTION:

MOV AL,chr

; move value of variable chr to register AL


ADD AL,bytevar

; add values of variable bytevar and register AL

MOV bytevar,AL

; move value of register AL to variable bytevar

XCHG AL,AH

; exchange the content of AL register with the AH register

MOV AX,wordvar

; move value of variable wordvar to register AX

MOV AX,0B800h

; copy 0B800h to AX register

MOV DS,AX

; copy value of AX register to DS register

MOV CL,'A'
; copy the ascii value of character ‘A’ to CL register

MOV CH,1101_1111b

; copy the hexadecimal value of 1101111 to CH

MOV BX,15Eh

; copy value 0015Eh to BX register

MOV [BX],CX

; Copies CX into the data segment memory location addressed by BX

RET

;return control to the operating system

The out put of the code is character A

You might also like