Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a general-purpose program that is able to add two 8 bytes length numbers. Numbers are saved in EBX: EAX and EDX: ECX Consider this

Write a general-purpose program that is able to add two 8 bytes length numbers. Numbers are saved in EBX: EAX and EDX: ECX Consider this sample call: Number1 QWORD = 1234567898765432h Number2 QWORD = 1234567898765432h Please write code in Masm (Microsoft assembly) No High-Level Assembly. And please don't separate the variables, keep it as it is. If you do split it please do it in the code part. If possible please use 1 loop anything more than inc, dec, mov, xchg, I don't know how to do that yet. Here is what I have, but it's not running properly. I have to manually do the carry and cannot use ADC. And these are the only instructions I can use

.386 .model flat,stdcall .stack 4096 ExitProcess proto,dwExitCode:dword

.data Number1 QWORD ? ; 1234567898765432 Number2 QWORD ? ; 1234567898765432 result QWORD ? ; 2468ACF130ECA864 carry DWORD 0 temp DWORD ?

.code MOV DWORD PTR Number1, eax MOV DWORD PTR (Number1 + 4), ebx MOV DWORD PTR Number2, ecx MOV DWORD PTR (Number2 + 4), edx MOV esi, 0 MOV ecx, 4

;-------------- L1: MOVZX eax, WORD PTR Number1[esi] MOVZX ecx, WORD PTR Number2[esi] ADD eax, ecx ADD eax, carry MOV WORD PTR result[esi], ax MOV temp, eax MOVZX eax, WORD PTR (temp +2) MOV carry, eax add esi, 2 LOOP L1 invoke ExitProcess,0 main endp end main

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

What is the principle of thermodynamics? Explain with examples

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago