store a number in array and display it problem
Hello guys!
I'm having difficulties storing an number in an array and displaying it on the screen. When i compile it dont have errors. But when i enter the 1st number on the screen, it just crashes. I'll post my code here for you guys to have a look.
Code:
.model small
.stack 100h
.data
num db 1 dup(?) ;array to store number
enter_number db "Please enter number from 1-7 only: $"
.code
main proc
mov ax,@data
mov ds,ax
call input
mov ax,4c00h
int 21h
main endp
input proc
mov ah,09h
mov dx,offset enter_number
int 21h
mov ah,0
int 16h
mov bx,0
mov num[bx],al
mov ah,0
mov dl,num[bx]
int 21h
input endp
end main
I seriously dont know what is the problem. May be i just started assembly not too long ago. Hope some 1 do show me how to code it correctly. I dont know where did i go wrong. Thanks!