0% found this document useful (0 votes)
40 views2 pages

Program 2 - 2s Complement of 8-Bit Number

Uploaded by

Mohit Verma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Program 2 - 2s Complement of 8-Bit Number

Uploaded by

Mohit Verma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

8085 Programs

Program 2: 2s complement of an 8-bit number. Flowchart: Start

Load accumulator with operand from memory.

Complement accumulator.

Increment accumulator.

Store the result from accumulator to memory.

Stop

Program: Address 2000 2001 2002 2003 2004 2005 2006 2007 2008 HLT CMA INR STA A 3001H Mnemonics LDA Operand 3000H Opcode 3A 00 30 2F 2C 32 01 30 76 Remarks Load H-L pair with data from 3000H. Lower-order of 3000H. Higher-order of 3000H. Complement accumulator. Increment accumulator. Store the result at memory location 3001H. Lower-order of 3001H. Higher-order of 3001H. Halt.

Gursharan Singh Maninder Kaur

Page 1 of 2

8085 Programs

Explanation: This program finds the 2s complement of an 8-bit number stored in memory location 3000H. Let us assume that the operand stored at memory location 3000H is 85H. The operand is moved to accumulator from memory location 3000H. Then, its complement is found by using CMA instruction. One is added to accumulator by incrementing it to find its 2s complement. The result is stored at memory location 3001H.

Output: Before Execution: 3000H: 85H

After Execution: 3001H: 7BH

Gursharan Singh Maninder Kaur

Page 2 of 2

You might also like