include 'emu8086.inc' org 100h; set location counter to 100h jmp CodeStart DataStart: promptMsg db "enter a number> ", 0 minMsg db "the smallest number is ", 0 newline db 13, 10, 0 num1 dw ? num2 dw ? CodeStart: ; prompt user to enter in a number mov si, offset promptMsg call print_string ; read in the number into cx call scan_num ; move the number to a variable mov num1, cx ; advance cursor to the next line mov si, offset newline call print_string ; prompt user to enter in a number mov si, offset promptMsg call print_string ; read in the number into cx call scan_num ; move the number to a variable mov num2, cx ; advance cursor to the next line mov si, offset newline call print_string ; print min message mov si, offset minMsg call print_string mov ax, num1 call print_num EndLabel: ret DEFINE_PRINT_STRING DEFINE_SCAN_NUM DEFINE_PRINT_NUM DEFINE_PRINT_NUM_UNS
Here is the orignal form of the code.
Here is when i modified it.
org 100h; set location counter to 100h jmp CodeStart DataStart: promptMsg db "enter a number> ", 0 minMsg db "the smallest number is ", 0 newline db 13, 10, 0 num1 dw ? num2 dw ? CodeStart: ; prompt user to enter in a number mov si, offset promptMsg call print_string ; read in the number into cx call scan_num ; move the number to a variable mov num1, cx ; advance cursor to the next line mov si, offset newline call print_string ; prompt user to enter in a number mov si, offset promptMsg call print_string ; read in the number into cx call scan_num ; move the number to a variable mov num2, cx ; advance cursor to the next line mov si, offset newline call print_string ; print min message mov si, offset minMsg call print_string mov ax, num1 cmp ax, num2 jmp CodeStart: jle num1, ax mov ax, num2 call print_num EndLabel: ret DEFINE_PRINT_STRING DEFINE_SCAN_NUM DEFINE_PRINT_NUM DEFINE_PRINT_NUM_UNS
Any help would be very much appreciated Thanks

New Topic/Question
Reply



MultiQuote



|