Reading a BYTE as a DWORD in Masm?

Cmp BYTE PTR buffer + ecx, 30h To extract a BYTE as a DWORD you can do something like this: mov EAX, 0 mov AL, pointer or even better (thanks Martin): movzx EAX, pointer.

Martin, yes, better choice :) – Nick Dandoulakis Mar 13 '10 at 0:52 movzx eax, pointer is working but whenever I do movzx eax, pointer + ecx (since I'm getting more than one character inputs) it always puts just a zero into eax. – Help I'm in college Mar 13 '10 at 1:06 BYTE PTR buffer + ecx always evaluates to zero (where ecx is the number of items put into the buffer) For the record I'm beginning to suspect my professor isn't even trying to implement his ideas for programming assignments in MASM before he assigns them. We have done nothing with type conversions in MASM.

I've learned more about assembly so far trying to figure out his assignments using the internet and stack overflow than I've learned in class. – Help I'm in college Mar 13 '10 at 1:13 @Help I'm in college, if buffer contains a null terminated string and ecx has string's length, then buffer + ecx will be zero. – Nick Dandoulakis Mar 13 '10 at 1:16.

GetData PROC push ebp mov ebp, esp mov esi, ebp + 12 ; offset of buffer mov ebx, ebp + 8 ; where to write answer GETNUMBERSTRING: mov edx, esi mov ecx, BufferSize mov eax, 0 call ReadString mov ecx, eax ; set size to loop counter cld mov edx, 0 PROCESSSTRING: lodsb cmp al, 30h jl WRONG cmp al, 39h jg WRONG ; add digit into total edx sub al, 30h push eax ; multiply edx by 10 push ecx mov eax, edx mov ecx, 10 mul ecx mov edx, eax pop ecx pop eax push ebx ; add to the total movsx ebx, al add edx, ebx pop ebx loop PROCESSSTRING jmp DONE WRONG: call Crlf stringWriterEndl invalid jmp GETNUMBERSTRING DONE: mov ebx, edx pop ebp ret 8 getData ENDP That's what I needed to do.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions