DATA SEGMENT STRING1 DB 99H, 12H, 56H, 45H, 36H, 78H, 34H, 23H, 67H, 89H DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX, DATA MOV DS, AX MOV CH, 09H ; Outer loop counter for 10-1 = 9 iterations UP2: MOV CL, 09H ; Inner loop counter for 10-1 = 9 comparisons LEA SI, STRING1 UP1: MOV AL, [SI] MOV BL, [SI+1] CMP AL, BL JC DOWN MOV DL, [SI+1] XCHG [SI], DL MOV [SI+1], DL DOWN: INC SI DEC CL JNZ UP1 DEC CH JNZ UP2 INT 3 CODE ENDS END START
Team Answered question May 25, 2024