0

I have a homework on emu8086, the purpose is to calculate the total amount of scores from 3 inputs, and get the computed average. the problem is when the total of my input is not divisible by 3, instead of giving me the proper results, it gives me a random number as a result. can anyone help?

here is my code

include 'EMU8086.inc'
org 100h

print 'Enter score in quiz 1: '
call scan_num
mov ax,cx

gotoxy 0,1

print 'Enter score in quiz 2: '
call scan_num
mov bx,cx  

gotoxy 0,2
 
print 'Enter score in quiz 3: '
call scan_num

add ax,bx
add ax,cx


gotoxy 0,4
print 'The total score is: '
call print_num

mov dl,3
div dl

gotoxy 0,5
print 'The average score is: '
call print_num


ret
define_scan_num
define_print_num_uns
define_print_num
Mipmoop
  • 11
  • 2
  • It's not random, AH=remainder, AL=quotient if you use 8-bit operand-size `div`. If that's not what you want, zero DX and use 16-bit division. – Peter Cordes Apr 16 '22 at 03:28

0 Answers0