0

I would like to be able to have the user input a 1 or 0 and have whatever was inputted into an array. Here is what I have so far.

.model small

.stack 100h

.code

start:
my_arr db ?
mov dl, [my_arr]
mov [my_arr], al
add dl, '0'
mov ah, 2h
int 21h

end start

Basically I'm trying to get it to input into the array, then testing if the it worked by outputting the first element in the array. Right now all it outputs is N..which I'm assuming stands for null meaning nothing is being inputted in the array based on this code. Can somebody help me out?

2
Contributors
1
Reply
3
Views
8 Years
Discussion Span
Last Post by NotNull
0
start:
my_arr db ? ; the instruction pointer is running into junk!!!
mov dl, [my_arr] ; you didn't read any char from the keyboard
mov [my_arr], al
add dl, '0' 
mov ah, 2h
int 21h

change to:

.data
my_arr db ?
.code
start:
mov dx, seg my_arr
mov ds, dx

Check out MS-DOS INT 21h functions 01/06/07/08/0A/3F
for reading from the keyboard.

And it is printing an 'N' to the screen cuz your are printing
out the character specified in DL it doesn't mean NULL.

Edited by NotNull: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.