Name: Anonymous 2007-07-30 1:48 ID:e90hKK3s
i need the program to display the smaller of 2 numbers. it is done in assembly language. please help!
; include comments here for:
; your name
; source code filename
; program description
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
; include comments here for:
; your name
; source code filename
; program description
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