EX.NO:4

CODE CONVERSION USING 8085 MICROPROCESSOR

AIM: To write an assembly language for the following code conversion: a)Decimal to Hexadecimal b)Hexadecimal to Decimal

APPARATUS REQUIRED: 8085 micrprocessor kit Power supply(0-5)v

a)DECIMAL TO HEXADECIMAL ALGORITHM: STEP1: Load the immediate 16 Bit data specified within the instruction into HL register pair. STEP2: Copy the content of memory location pointed by the ‘HL”register pair into ‘A’ register STEP 3: Copy the content of accumulator to ‘d’ register STEP4: ’AND’ the immediate data (F0) in to the accumulator STEP5: Shift the accumulator value to the right by one position. Repeat STEP6 for four times. STEP6: Copy the immediate value (0A) to ‘C’ register STEP7: Copy the content of accumulator to ‘B’ register and Clear the accumulator content STEP8: Add the content of the ‘B’ register with the accumulator and store the result in the accumulator .Decrement ‘C’ register STEP9: Check for non-zero value. If Z≠0, jump to STEP11 ,else copy the content from ‘A’ to ‘B’ register and ‘D’ to ‘A’ register STEP10: ’AND’ the immediate data (0F) in to the accumulator STEP11: Add the content of the ‘B’ register with the accumulator and store the result in the accumulator. STEP12: Store the result in the memory location in 4500 from the accumulator.

DECIMAL TO HEXA-DECIMAL PROGRAM MEMORY ADDRESS

LABEL

4500 4501 4502

MNEUMONIC CODE LXI

4503 4504 4504 4505

OPCODE COMMENTS

H,4100 21 00 41

MOV A,M MOV D,A ANI A,F0

LOADS THE IMMEDIATE 16 BIT DATA SPECIFIED WITH IN THE INSTRUCTION INTO HL PAIR

7E 57 E6 F0

COPY THE CONTENT OF MEMORY LOCATION POINTED BY THE HL REGISTER PAIR INTO 'A' REGISTER COPY THE CONTENO OF 'D' TO 'A' LOGICALLY 'AND' THE IMMEDIATE VALUR (F0) WITH THE ACCUMULATOR CONTENT

4506

RRC

0F

SHIFT THE ACCUMULATOR CONTENT BY ONE POSITION TO THE RIGHT

4507

RRC

0F

SHIFT THE ACCUMULATOR CONTENT BY ONE POSITION TO THE RIGHT

0F

SHIFT THE ACCUMULATOR CONTENT BY ONE POSITION TO THE RIGHT

4508

RRC

4509 450A 450B 450C 450D 450E 450F 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 451A 451B

RRC MVI

C,0A

MOV B,A XRA A L1

ADD DCR JNZ

B C L1

MOV B,A MOV A,D ANI 0F

ADD STA

HLT

B 4500

0F 0E 0A 47 AF 80 05 C2 0E 45 47 7A E6 0F 80 32 00 45 76

SHIFT THE ACCUMULATOR CONTENT BY ONE POSITION TO THE RIGHT LOAD THE IMMEDIATE VALUE (0A) TO 'C' REG. COPY THE CONTENT OF 'A' TO 'B' REG. CLEAR THE ACCUMULATOR CONTENT A=A+B:AND STORE THE RESULT IN THE ACCUMULATOR DECREMENT 'C' REG. BY ONE IF 'Z≠0' JUMP TO L1(450E) COPY THE CONTENT OF 'A' TO 'B' REG. COPY THE CONTENT OF 'D' TO 'A' REG. LOGICALLY 'AND' THE IMMEDIATE VALUR (0F) WITH THE ACCUMULATOR CONTENT A=A+B:AND STORE THE RESULT IN THE ACCUMULATOR STORE THE RESULT IN SPECIFIED ADDRESS HALT THE PROGRAM

DECIMAL TO HEXADECIMAL

INPUT ADDRESS

DATA

OUTPUT ADDRESS

DATA

MANUAL CALCULATION:

b)HEXA-DECIMAL TO DECIMAL ALGORITHM: STEP1: Load the immediate value 00H to ‘E’ register. STEP2: Copy the content of ‘E’ to ‘D’ register STEP 3: Load the input data from the memory laocation to the accumulator. STEP4: Compare the immediate value(64) and the accumulator. STEP5: Check for carry condition. If ‘A’ < ‘64’,jump to STEP7 else subtract the immediate value (64)to the accumulator STEP6: Increment ‘E’ register and jump back to STEP4 STEP7: Compare the immediate value(0A) and the accumulator. STEP8: Check for carry. If ‘A’ < ‘0A’, jump to STEP 9 else subtract the aacumulator value from the immediate value (0A),Increment ‘D’ register and jump to STEP4 STEP9: Copy the content of accumulator to ‘B’ register and ‘A’ to ‘E’ registers. STEP10: Store the result (hundreds) in the specified memory location and copy the content of ‘D’ to ‘A’ register. STEP11: Store the result (tens) in the specified memory location and copy the content of ‘B’ to ‘A’ register STEP12: Store the result (ones) in the specified memory location.

HEXA-DECIMAL TO DECIMAL PROGRAM MEMORY ADDRESS 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 450A 450B 450C 450D 450E 450F 4510 4511

LABEL

L2

L1

MNEUMONIC OPCODE COMMENTS CODE MVI

E,00

MOV LDA

D,E 4200

CPI

64

JC

L1

SUI

64

INR JMP

E L2

CPI

0A

4512 4513 4514 4515

JC

L3

SUI

0A

4516 4517 4518 4519 451A 451B 451C 451D 451E 451F 4520 4521 4522 4523 4524 4525 4526 4527

INR JMP

A L1

L3

MOV MOV STA

B,A A,E 4600

MOV STA

A,D 4601

MOV STA

A,B 4602

HLT

1E 00 53 32 00 42 FE 64 DA 0E 45 D6 64 1C C3 06 45 FE 0A DA 1A 45 D6 0A 3C C3 11 45 47 7B 32 00 46 7A 32 01 46 78 32 02 46 76

INITIALISE 'E' REGISTER AS '00' COPY THE CONTENT OF 'E' TO 'D' REGISTER LOAD ACCUMULATOR WITH VALUE THROUGH ADDRESS 4200 COMPARE THE IMMEDIATE VALUE(64H) WITH THE ACCUMULATOR CHECK IF 'CY=1',JUMP TO L1(4511) SUBTRACT THE IMMEDIATE VALUE(64) WITH THE ACCUMULATOR INCREMENT 'E' REGISTER JUMP UNCONDITIONALLY TO L2(4506) COMPARE THE IMMEDIATE VALUE(0AH) WITH THE ACCUMULATOR CHECK IF 'CY=1',JUMP TO L3(451A) SUBTRACT THE IMMEDIATE VALUE(0A) WITH THE ACCUMULATOR INCREMENT 'A' REGISTER JUMP UNCONDITIONALLY TO L1(4511) COPY THE CONTENT OF 'A' TO 'B' REGISTER COPY THE CONTENT OF 'E' TO 'A' REGISTER STORE THE ACCUMULATOR CONTENT IN THE SPECIFIED ADDRESS(4600) COPY THE CONTENT OF 'D' TO 'A' REGISTER STORE THE ACCUMULATOR CONTENT IN THE SPECIFIED ADDRESS(4601) COPY THE CONTENT OF 'B' TO 'A' REGISTER STORE THE ACCUMULATOR CONTENT IN THE SPECIFIED ADDRESS(4602) HALT THE PROGRAM

HEXA-DECIMAL TO DECIMAL

INPUT ADDRESS

DATA

OUTPUT ADDRESS

DATA

MANUAL CALCULATION:

RESULT: Thus,the assembly language program for a code conversion was executed using 8085 microprocessor.

ex.no:4 code conversion using 8085 microprocessor

STEP8: Add the content of the 'B' register with the accumulator and store the ... STEP12: Store the result in the memory location in 4500 from the accumulator.

425KB Sizes 2 Downloads 172 Views

Recommend Documents

Microprocessor- 8085 (2).pdf
Page. 1. /. 2. Loading… Page 1 of 2. Page 1 of 2. Page 2 of 2. Page 2 of 2. Main menu. Displaying Microprocessor- 8085 (2).pdf. Page 1 of 2.

8085 Microprocessor - Ramesh Gaonkar.pdf
microprocessor's design. Page 4 of 330. 8085 Microprocessor - Ramesh Gaonkar.pdf. 8085 Microprocessor - Ramesh Gaonkar.pdf. Open. Extract. Open with.

8085 microprocessor by ramesh gaonkar pdf download
File: 8085 microprocessor by ramesh. gaonkar pdf download. Download now. Click here if your download doesn't start automatically. Page 1 of 1. 8085 microprocessor by ramesh gaonkar pdf download. 8085 microprocessor by ramesh gaonkar pdf download. Ope

8085 Microprocessors - PDFKUL.COM
which consists of various instructions such as MOV, ADD, SUB, JMP, etc. These instructions are written in the form of a program which is used to perform various operations such as branching, addition, subtraction, bitwise logical and bit shift operat

Online PDF The Conversion Code
Appointments, Close More Sales Full Popular PDF, PDF The Conversion Code: Capture Internet .... the strengths of social media, apps, and blogs to capture.