ALp Prog

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

6. a. Write a program to subtract a 16-bit BCD number from another 16-bit number.

lhld xchg lhld Mov sub Mov Mov sbb Mov Shld hlt

f200 f300 a,e l l,a a,d h h,a f400

6. b. Write a program to subtract a 16-bit BCD number from another 16-bit BCD number.

lhld xchg lhld Mov Sub daa Mov Mov Sbb daa Mov shld hlt

f200 f300 a,e l l,a a,d h h,a f400

7. a. Write a program to multiply two 8-bit numbers.

Lhld f200 mvi a,00 Mov b,a back: add h jnc next inr b next: dcr l jnz back movl,a movh,b shld f300 hlt

8. a. Write a program to find the largest and smallest of N numbers.


lda f200 Mov d,a lxi h f300 Mov b,m Mov c,m dcr d back:inx h Mov a,m cmp b jc next Mov b,a next:cmp c jnc step Mov c,a step:dcr d jnz back Mov a,b Sta f400 Mov a,c Sta f401 hlt

9. Write a program to sort the numbers in ascending and in descending order using bubble sort.

Mvi b 08 Rep: Lxi h f200 Movc,b Back: mova,m Inx h Cmp m Jc loc1 Jz loc1 Movd,m Movm,a

9 (a.Assinding)continue

Dcx h Movm,d Inx h Loc1: dcr c Jnz back Dcr b Jnz rep Lxi h f200 Mvi a, 00 Sta fff7

9 (a.Assinding)continue

Mvi a, f2 Sta fff8 Call updad(06bc) Mova,m Sta fff9 Call update(06d3) hlt

You might also like