You are on page 1of 2

ALGORITHM: (ASCENDING ORDER) 1. Start the program. 2. Move data to CX register and move CX data to D1 register 3.

Move 2200 to the BX register and move the content of 2200 to memory of AX. 4. Compare the content of AX with 2202 5. Jump on borrow to rep 6. Move the data in memory to AX and move Data from AX to AI 7. Add Data to BX register and go to loop2 8. Perform no operation and move data & D1 to CX 9. Go to the loop 10. Stop the program PROGRAM: ADDRESS 2000 2003 2005 2008 200A 200D 200F 2012 201A 2017 2019 201A REP LOOP2 LOOP1 LABEL OPCODE B9, 07, 00 89 CF BB, 00, 22 8B, 07 3B, 47, 02 72, 05 87, 47, 02 89, 07 83, C3, 02 F2, EF 90 89, F9 MNEMONICS MOV MOV MOV MOV CMP JB XCHG MOV ADD LOOP NOP MOV OPERAND CX, 07
COMMENTS

Move data to CX reg Move CX data to DI, CX direg Move 2200 to the BX, 2200 BX reg Move the content of AX, AI [BX] 2200 to memory of AX Compare the content AX,AI[BX+2] `of ax with 2202 jump on borrow to REP rep Move the data in AX,AI[BX+2] memory to AX Move data from AX AI[BX],AX to AI Add data to BX BX,2 register LOOP2 Go to loop2 No operation CX, DI Move data of DI to

CX 201C 201E INPUT: 1200 0007 1202 0006 1204 0005 1206 0004 OUTPUT: 1200 0001 1202 0002 1204 0003 0007 1206 0004 1208 0005 120A 0006 120C E2, E5 F4 1208 0003 120A 0002 120C 0001 LOOP HLT LOOP1 Go to loop1 Stop the process

You might also like