I've written a simple code to get a student information like name and ID, but in the code when I want to get input the interrupt doesn't work I mean int 21h/ah=0Ah It pauses when the interrupt is reached but just accepts Enter from keyboard not any number or characters, here my code :
stack segment
dw 128 dup (?)
stack ends
data segment
name0 db 30,?,30 dup('$')
id0 db 10,?,10 dup('$')
menu db "1-Enter student name:",0Dh,0Ah
db "2-Enter student ID:",0Dh,0Ah
db "3-Printing the student name and ID:",0Dh,0Ah,
db "4-Exit",0Dh,0Ah
db "Please Select :",'$'
selection db 1,?,4
show0 db "(s)he is ",'$'
show1 db " his/her ID ",'$'
; address1 db 2 dup(?)
; address2 db 2 dup(?)
data ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
;mov ax, data1
mov es, ax
push bp
mov bp,sp
xor cx,cx
loop1:
;cx is reserved
push offset menu
call print
lea dx,selection
mov ah,0Ah
int 21h ; <----- doesn't work
lea bx,selection
mov cl,[bx+2]
cmp cl,1
je getname_scope
cmp cl,2
je getid_scope
cmp cl,3
je showinfo
ret0:
cmp cl,4
jne loop1
jmp exit
getname_scope:
mov bx, offset name0
push bx
call Get
jmp ret0
getid_scope:
lea bx,id0
push bx
call Get
jmp ret0
showinfo:
push offset show0
call print
push offset name0+2
call print
push offset show1
call print
push offset id0+2
call print
jmp ret0
exit:
; wait for any key....
mov ah, 1
int 21h
pop bp
mov ax, 4c00h ; exit to operating system.
int 21h
code ends
proc Get near
push bp
mov bp,sp
lea dx,[bp+4]
mov ah,0Ah
int 21h
pop bp
ret
Get endp
proc print near
push bp
mov bp,sp
mov dx,[bp+4]
mov ah, 9
int 21h
pop bp
ret
end start ; set entry point and stop the assembler.
what's wrong with the code ? how to