Question: Compile and execute the existing Assembly code on the left side of the screen. The following is the code that should be displayed: (Complineonline, n.d.)
Compile and execute the existing Assembly code on the left side of the screen. The following is the code that should be displayed: (Complineonline, n.d.)
***************************************************************************** ; PROC: Our_Print(STRING, LENGTH) ; PURPOSE: Implements the system write call. ; INPUT: STRING [edi] :: Address of the string to print ; LENGTH [esi] :: Length of the string ; OUTPUT: eax :: Returns 0 if successful, else -1. If successful, then the ; Contents of the given string [ecx] contains the convert integer. ; USES: eax :: Contains high/low-order nibble of byte to convert ; NOTES: ; ***************************************************************************** _Our_Print: ; Start of procedure definition push eax ; Save off the current contents of the regs push ebx push ecx push edx %ifdef _WINDOWS_ ; hStdOut = GetstdHandle( STD_OUTPUT_HANDLE) push -11 call _GetStdHandle@4 mov ebx, eax ; WriteFile( hstdOut, message, length(message), &bytes, 0); push 0 lea eax, [ebp-4] push eax push (message_end - message) push message push ebx call _WriteFile@20 %else ; Instructor Question 4: What are we doing here? mov eax, 4 ; System call number (sys_write) mov ebx, 1 ; File descriptor (stdout) mov ecx, edi ; Address of the message to write mov edx, esi ; Message length int 0x80 ; Call the kernel %endif Done_Our_Print: pop eax ; Restore the previous contents of the regs pop ebx pop ecx pop edx ret ; End of procedure definition
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
