Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Science Below I am listing the instructions for the assignment and my current code. I am using VS 2022 community edition and I have

Computer Science

Below I am listing the instructions for the assignment and my current code. I am using VS 2022 community edition and I have to code this in x86. I keep getting errors with the code C2400. Is this a compiler issue or is there something wrong with my code? Could someone explain what seems wrong and how I can fix this to ensure that the code works as intended. Please do not just copy and paste the answer from other questions, I need someone to help me fix this issue. Thank you.

Set i1 and i2 to each have a value of 1. Develop a loop that will do the following for each iteration of the loop: 1) Add 3 to i1 and store the result into i1; 2) Multiply i2 by 3 and store the result into i2; Terminate the loop if either i1 becomes greater than 100 OR if both the following are true: more than 15 iterations of the loop have occurred AND i2 has reached a value of at least 999999. After the loop terminates do the following: 1) Set i3 to the number of times through the loop 2) Set i4 to the remainder of i1 divided by i3

#include using namespace std; int main() { unsigned long i1; unsigned long i2; unsigned long i3; unsigned long i4; _asm { section .data msg db "Results are: ",0 pri db "%d ",0 section .bss i1 resd 1 i2 resd 1 i3 resd 1 i4 resd 1

section .text global main extern printf

main: mov dword[i1],1 mov dword[i2],1 mov ecx,15

level: xor edx,edx xor eax,eax mov esi,[i1] cmp esi,97 ;Comparing if value is greater than 97 if it is then go to exit ja exit mov esi,[i2] cmp esi,999999 ;Comparing if value is greater than 97 if it is then go to exit add esi,3 mov [i1],esi ;adding three mov eax,[i2] mov ebx,3 mul ebx ;Multiplying by 3 mov [i2],eax loop level exit: xor edx,edx mov ebx,15 sub ebx,eax ;counting ilterations mov [i3],ebx mov eax,[i1] mov ebx,[i3] div ebx ;remainder mov [i4],edx

push msg call printf

push dword[i1] push pri call printf

push dword[i2] push pri call printf

push dword[i3] push pri call printf

push dword[i4] push pri call printf

add esp,36 ;empty stack

ret } cout << "results are " << (unsigned long)i1 << ", " << (unsigned long)i2 << ", " << (unsigned long)i3 << ", " << (unsigned long)i4 << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The error C2400 is a syntax error in Visual Studio indicating that there is a problem with the code ... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

Students also viewed these Programming questions

Question

What is the difference between persistence and self-determination?

Answered: 1 week ago