Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.) Bitwise operations: AND, OR, NOT, shifting (to multiply and divide) %ifdef _WINDOWS_ %xdefine _SECTION_HDR_ segment %xdefine _START_ _main ; _main %xdefine _EXIT_ _exit extern _GetStdHandle@4 extern _WriteFile@20 extern _ExitProcess@4 %else %xdefine _SECTION_HDR_ section %xdefine _START_ _start %xdefine _EXIT_ _exit %endif _SECTION_HDR_ .data ; Data section CR db 0x0D ; ASCII Carriage Return LF db 0x0A ; ASCII Line Feed W dd 0x00000002 X dd 0x00000004 Y dd 0x00000008 Z dd 0x00000010 N db 0x03 ; Shift value W_CHAR db 'W' X_CHAR db 'X' Y_CHAR db 'Y' Z_CHAR db 'Z' N_CHAR db 'N' EQUAL_SIGN db ' = ' EQUAL_SIGN_LEN equ $ - EQUAL_SIGN ; Length of string HEX_IND db '0x' HEX_IND_LEN equ $ - HEX_IND ; Length of string MSG_A0 db 'W * Y = ' LEN_A0 equ $ - MSG_A0 ; Length of string MSG_A1 db 'W << N = ' LEN_A1 equ $ - MSG_A1 ; Length of string MSG_B0 db 'Z / Y = ' LEN_B0 equ $ - MSG_B0 ; Length of string MSG_B1 db 'Z >> N = ' LEN_B1 equ $ - MSG_B1 ; Length of string RESULT dd 0x00000000 VAR_STR_LEN equ 4 ; Length of string _SECTION_HDR_ .bss ; Uninitialized Data section VAR_STR resb VAR_STR_LEN global VAR_STR _SECTION_HDR_ .text ; Code section global _START_ ; Must be declared for using gcc ; ***************************************************************************** ; MACRO: Print_Result(MSG, LENGTH, RESULT) ; PURPOSE: Sends a formatted string to STDOUT ; INPUT: MSG [%1] :: Address of the string to print ; LENGTH [%2] :: Length of the message (string) ; RESULT [%3] :: Result (byte) -- to be converted to an ASCII string. ; OUTPUT: NONE ; USES: ; NOTES: ; ***************************************************************************** %macro Print_Msg 3 ; Print message mov edi, %1 ; STRING [edi] :: Address of the string to print mov esi, %2 ; LENGTH [esi] :: Length of the string call _Our_Print ; Print the HEXADECIMAL indicator (0x) mov edi, HEX_IND ; STRING [edi] :: Address of the string to print mov esi, HEX_IND_LEN ; LENGTH [esi] :: Length of the string call _Our_Print ; Convert the given byte to a character-string mov edi, [%3] ; BYTE [edi] :: Byte to convert to string mov esi, VAR_STR ; STRING [esi] :: Address of the string mov edx, VAR_STR_LEN ; LENGTH [edx] :: Length of the string call _Byte_to_String ; Print the converted byte integer mov edi, VAR_STR ; STRING [edi] :: Address of the string to print mov esi, 2 ; LENGTH [esi] :: Length of the string call _Our_Print ; Print an ASCII newline (CR) control-character mov edi, CR ; STRING [edi] :: Address of the string to print mov esi, 1 ; LENGTH [esi] :: Length of the string call _Our_Print ; Print an ASCII newline (LF) control-character mov edi, LF ; STRING [edi] :: Address of the string to print mov esi, 1 ; LENGTH [esi] :: Length of the string call _Our_Print %endmacro ; ***************************************************************************** ; MACRO: Print_Var(VAR_STR, VAR_STR_LEN) ; PURPOSE: Sends a formatted string to STDOUT ; INPUT: VAR_STR [%1] :: Address of the string to print ; VAR_STR_LEN [%2] :: Length of the message (string) ; OUTPUT: NONE ; USES: ; NOTES:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago