0

I am studying asm, and I know that if I would like to take a number from keyboard, I can simple do this:

inputarea db 3 DUP(' '),'$' mov ah,0Ah mov dx,offset inputarea int 21h 

In this case, I can write symbols until I reach 255. But there is a db(data byte) type, so in this case I can only write max 3 numbers which is correct to asm to execute it (123 , 100 and so on...). But If have Data Word, or DD types, how many symbols I can write which can be executed?

Hint: for example, If I have type 'data byte', so this will exlude memory of 1 byte. And there is able to store only 3 numbers. What about others types?

1 Answer 1

1

I know that if I would like to take a number from keyboard, I can simple do this: ...

No, its not that simple - you have to setup a transfer buffer correctly. Function 0ah reads from standard input and writes the characters it reads into a buffer, see Interrupts MS-DOS Function Calls (INT 21h), page 4:

count = 80 KEYBOARD STRUCT maxInput BYTE count ; max chars to input inputCount BYTE ? ; actual input count buffer BYTE count DUP(?) ; holds input chars KEYBOARD ENDS .data inputarea KEYBOARD <> .code mov ah, 0Ah mov dx, OFFSET inputarea int 21h 

Then, you will end up with a string in the input buffer which you need to convert to a number.

Sign up to request clarification or add additional context in comments.

2 Comments

another version I think is: inputarea db 3,?,3 DUP(' '). isn't it?
Yes, this should work also - the above structure basically expands to that

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.