HtoD1 - zero: mov word ptr [edi],30h jmp dtaexit sign: jns...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
.386 .model flat,stdcall option casemap:none o include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc i includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib i dwtoa proto dwValue:DWORD, lpBuffer:DWORD d .data? szOut db 256 dup(?) .data . .code start: mov eax, 128h mov ecx, 128h add eax, ecx push offset szOut push eax call dwtoa push MB_OK push offset szOut push offset szOut push NULL call MessageBox push NULL call ExitProcess dwtoa proc dwValue:DWORD, lpBuffer:DWORD d push ebx push esi push edi mov eax, dwValue mov edi, [lpBuffer] test eax,eax jnz sign
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: zero: mov word ptr [edi],30h jmp dtaexit sign: jns pos mov byte ptr [edi],'-' neg eax add edi, 1 pos: mov ecx, 3435973837 mov esi, edi .while (eax > 0) mov ebx,eax mul ecx shr edx, 3 mov eax,edx lea edx,[edx*4+edx] add edx,edx sub ebx,edx add bl,'0' mov [edi],bl add edi, 1 .endw mov byte ptr [edi], 0 ; terminate the string ; We now have all the digits, but in reverse order. .while (esi < edi) sub edi, 1 mov al, [esi] mov ah, [edi] mov [edi], al mov [esi], ah add esi, 1 .endw dtaexit: pop edi pop esi pop ebx ret dwtoa endp d end start...
View Full Document

This note was uploaded on 11/15/2010 for the course ECE 265 taught by Professor N /a during the Spring '08 term at Ohio State.

Page1 / 2

HtoD1 - zero: mov word ptr [edi],30h jmp dtaexit sign: jns...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online