16-BIT SUBTRACTION
AIM:
To write an assembly language program for the subtraction of two 16 – bit numbers using 8085.
APPARATUS REQUIRED:
8085 kit, power chord
ALGORITHM:
1. Start the program
2. Load the data to HL pair register
3. Exchange the content of HL and DE pair
4. Load the data to HL pair register
5. Subtract the content of E-register with the accumulator
5. Store the content of accumulator to 5100
6. Move the content of H to Acc
7. Subtract the content of accumulator to 5101
8. Stop the program.
PROGRAM:
ADDRESS | LABEL | OPCODE | MNEMONICS | OPERAND | COMMENTS |
4500 | | 2A, 00,55 | LHLD | 5500 | Load the data1 to hl register. |
4503 | | EB | XCHG | | Move the content of de to hl register |
4504 | | 2A, 02,55 | LHLD | 5002 | Load the data2 to hl pair register. |
4507 | | 7D | MOV | A, L | Move the content of l register to accumulator |
4508 | | 93 | SUB | E | Subtract e register and accumulator |
4509 | | 32,00,51 | STA | 5100 | Store the result |
450C | | 7C | MOV | A, H | Move h register to accumulator |
450D | | 9A | SBB | D | Subtract d register and accumulator |
450E | | 32,01,51 | STA | 5101 | Store the result. |
4511 | | 76 | HLT | | Stop the process |
INPUT: 5500 – 77 5501 – 66 OUTPUT: 5100 - 11
5502 – 88 5503 – 77 5101 - 11
RESULT:
Thus the assembly language program for 16-bit subtraction is executed and the results are verified.
0 comments:
Post a Comment