Reputation: 559
I am workin on a pretty big program in Assembly
I have a bit of a problem in this specific piece of code
ToArray proc _FH:word ; _FH File Handler ;non-void function returns -1 if error
LOCALS
push AX BX CX
MOV BX, _FH
MOV CX, 400
MOV DX, offset FileBuffer
MOV AH, 3FH
INT 21H
JC ErrorReading
call puts, offset Read_Success
JMP DONE
ErrorReading:
call puts, offset Read_Error
MOV DX,-1
DONE:
pop CX BX AX
ret
ToArray endp
I have { 1 2 5 6 } in the opened file but after callin INT 21H it just fills the array with 80241 80241..
Why is this happening :?
Upvotes: 0
Views: 76
Reputation: 58427
from having 1 3 5 6 I have 8241 8243 8245...
That looks like correct data to me.
The decimal numbers 8241 8243 8245
when viewed as hexadecimal would be 0x2031 0x2033 0x2035
. 0x20
is the ascii code for the space character, 0x31
is the ascii code for '1'
, and so on. So you're looking at the string "1 3 5 "
. It's just that you picked a representation of the data that makes this hard to see.
Unless the file is using Unicode or some other multi-byte character encoding you're better off viewing the characters as bytes rather than words.
Upvotes: 2