DOSSEG .model small .stack .data cr equ 0dh lf equ 0ah in_num1 db 'Enter number 1: $' in_num2 db cr,lf,'Enter number 2: $' out_num1 db cr,lf,'Number 1 is now $' out_num2 db cr,lf,'Number 2 is now $' num1 dw ? num2 dw ? .code include asm_io.inc ;a macro for printing a string ;pass the name of the string as a paramter print_string macro msg lea dx,msg mov ah,09h int 21h endm ;a macro for reading a decimal number using READ_DECIMAL from ASM_IO.INC ;pass the variable to be read as a parameter read_num macro num call read_decimal mov num,ax endm ;a macro ro print a decimal number using PRINT_DECIMAL from ASM_IO.INC ;pass the word to be printed as a parameter print_num macro num mov ax,num call print_decimal endm ;a macro to push an address on the stack ;pass the variable as a parameter push_address macro var mov ax,offset var push ax endm push_value macro var mov ax,var push ax endm start: mov ax,@data mov ds,ax ;prompt and read the numbers print_string in_num1 read_num num1 print_string in_num2 read_num num2 ;pass both numbers by address push_address num1 push_address num2 call signed_order ;prompt and print both numbers print_string out_num1 print_num num1 print_string out_num2 print_num num2 mov ax,4c00h int 21h signed_order proc near push bp mov bp,sp mov si,[bp+4] ;address of num2 mov di,[bp+6] ;address of num1 mov ax,[di] ;value of num1 ;can't compare memory to memory cmp ax,[si] ;test if num1 <= num2 jle so_done ;if so, then nothing to do push [si] ;swap the values using the stack push [di] pop [si] pop [di] so_done: mov sp,bp ;all done, restore bp pop bp ret signed_order endp end start