I am trying to get a string from the user that I can store as a name and print back later, but for some reason whenever I run my program, it skips past any opportunity to enter a name and just prints out the next line, I am new to assembly and I am not sure what I am doing wrong.
When I run it, the error I get is “A2022 instruction operands must be the same size”. My assumption is that this is referring to the size in bytes of what I am trying to get, but I think that I already made it 20 bytes max? I am truly not sure what is wrong. I tried reading to EAX and EDX for ReadString, but that did not seem to change anything.
Here is the code:
INCLUDE Irvine32.inc
.data
promptName BYTE "What is your name? ", 0
promptHello BYTE "Hello there, ", 0
; (insert variable definitions here)
userName BYTE 20 DUP(?)
.code
main PROC
MOV EDX, OFFSET promptName
call WriteString
call ReadString
MOV userName, EAX
call CrLf
MOV EDX, OFFSET promptHello
call WriteString
MOV EDX, OFFSET userName
call WriteString
call CrLf