Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a x64 MASM program: In your .data? segment, declare 4 integer variables (byte, word, dword, qword) in order of ascending size. In your .code

Write a x64 MASM program:

In your .data? segment, declare 4 integer variables (byte, word, dword, qword) in order of ascending size. In your .code segment, move the following (hexadecimal) values into your variables:

  • 7369206dh
  • 6dh
  • 202020216e754620h (you may need a register to help move this one)
  • 7361h

Using the WriteFile Windows API, display your data on the console.

Copy/Paste the console output to the end of your source code, and explain how this works. Submit your .asm file in Canvas

I did half of the code

comment ~

Author: NAme

Project: Project2-a

Description: Intro to data declarations

~

CONSOLE equ -11

extrn ExitProcess: PROTO

extrn GetStdHandle: PROTO

extrn WriteFile: PROTO

extrn ReadFile: PROTO

.data?

num1 byte ? ;handle to console standard out

num2 word ? ; number bytes actually written

num3 dword ?

num4 qword ?

stdout qword ?

numWrite qword ?

.code

mainCRTStartup PROC

sud rsp, 40 ;reserve shadow space

mov bnum, 6dh ; first value

;etc........

mov rax, num64

mov ax, num16 ;rax not cleared

mov rax, num64

mov eax, num32 ;clears upper half rax

;move immediate operands into rax

mov rax,num64

mov al, Offh ; rax not cleared

mov rax, num64

mov ax, Offffh ; rax not cleared

mov rsx, num64

mov eax, Offffffffh ; clears upper half rax

;Get handle id to console window & keyboard

add rsp, 40 ;restore shadow

mov rbx, 0 ;return code

Call ExitProcess ;windows exit

mainCRTStartup ENDP

END

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions