8086 program to subtract two 8 bit BCD numbers
Problem – Write a program in 8086 microprocessor to find out the Subtraction of two 8-bit BCD numbers, where numbers are stored from starting memory address 2000 : 500 and store the result into memory address 2000 : 600 and carry (borrow) at 2000 : 601.
- Load data from offset 500 to register AL (first number)
- Load data from offset 501 to register BL (second number)
- Subtract these two numbers (contents of register AL and register BL)
- Apply DAS instruction (decimal adjust)
- Store the result (content of register AL) to offset 600
- Set register AL to 00
- Add contents of register AL to itself with carry (borrow)
- Store the result (content of register AL) to offset 601
||MOV AL, 
||MOV BL, 
||SUB AL, BL
||DECIMAL ADJUST AL
||MOV , AL
||MOV AL, 00
||ADC AL, AL
||MOV , AL
- MOV AL,  load data from offset 500 to register AL.
- MOV BL,  load data from offset 501 to register BL.
- SUB AL, BL subtract contents of registers AL AND BL.
- DAS decimal adjust AL.
- MOV , AL store data from register AL to offset 600.
- MOV AL, 00 set value of register AL to 00.
- ADC AL, AL add contents of register AL to AL with borrow.
- MOV , AL store data from register AL to offset 601.
- HLT End.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!