The Question was
Write an assembly language program that corresponds to the following C++ program:
#include <iostream>
using namespace std;
int num;
int main () {
cin >> num;
num = num / 16;
cout << "num = " << num << endl;
return 0;
}
My code is
.model small
.stack 100h
.data
msg db "Enter number to perform modulus: $"
number1 db 0 #varuable to store user entered number
.code
mov ax,@data
mov ds,ax
call read
proc read
mov dx,offset msg #here printing message to get input from user
mov ah,09h
int 21h #reading integer
mov ah,01h
int 21h
mov number1,al #stored reading integer into number1
mov dx, 0
mov ax, number1
mov bx, 16 # ax contains remainder, dx contains quotient
div bx #divisin done
mov ah,ax
int 21h #printing result
ret
endp
end
what am I not doing right???