Arrange Numbers in an Ascending OrderWrite a program to arrange first 10 numbers from memory address 3000H in an ascending order.MVI B, 09 :'Initialize counter' START :'LXI H, 3000H: Initialize memory pointer' MVI C, 09H :'Initialize counter 2' BACK: MOV A, M :'Get the number' INX H :'Increment memory pointer' CMP M :'Compare number with next number' JC SKIP :'If less, don’t interchange' JZ SKIP :'If equal, don’t interchange' MOV D, M MOV M, A DCX H MOV M, D INX H :'Interchange two numbers' SKIP:DCR C :'Decrement counter 2' JNZ BACK :'If not zero, repeat' DCR B :'Decrement counter 1' JNZ START HLT :'Terminate program execution' - Study24x7
Social learning Network
05 Mar 2019 11:45 AM study24x7 study24x7

Arrange Numbers in an Ascending OrderWrite a program to arrange first 10 numbers from memory address 3000H in an ascending order.MVI B, 09 :"Initialize counter" START :"LXI H, 3000H: Initialize memory pointer" MVI C, 09H :"Initialize counter 2" ...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles