Reputation: 866
I tried searching the forum for answer but all I got was taking input in 16bit or nasm. I tried using
push ecx
push edx
mov edx, offset myVar
mov ecx, sizeof myVar
call readstring
but it is not working as i expected. I am trying to take a string/character as input and increment it (Like from A to B) and print it on the screen. My code:
include irvine32.inc
.data
myVar BYTE ?
myVar2 BYTE ?
shifts DWORD 3
.code
main proc
push ecx
push edx
mov edx, offset myVar
mov ecx, sizeof myVar
call readstring
mov esi, offset [myVar]
mov al,[esi]
mov myVar2, al
mov eax, DWORD PTR myVar2
add eax, shifts
mov DWORD PTR myVar2,eax
mov edx, offset myVar2
call writestring
exit
main endp
end main
Code works fine if I initialize the myVar with a character and increment it but (adds a garbage ascii character to result too I dont know why) So I know the problem is with taking input.
Upvotes: 2
Views: 5112
Reputation: 866
Sorry, Book had the answer.
.data
buffer BYTE 21 DUP(0) ; input buffer
byteCount DWORD ? ; holds counter
.code
mov edx,OFFSET buffer ; point to the buffer
mov ecx,SIZEOF buffer ; specify max characters
call ReadString ; input the string
mov byteCount,eax ; number of characters
Upvotes: 2