Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to run both programs together, 1 is C++ the other is assembly? ASM: .586P .MODEL FLAT, stdcall ; Flat Memory Model PUBLIC PROCEDURE1 _TEXT

How to run both programs together, 1 is C++ the other is assembly?

ASM:

.586P

.MODEL FLAT, stdcall ; Flat Memory Model

PUBLIC PROCEDURE1

_TEXT SEGMENT ; Tells the assembler what type of the following is

.data

primeArray DWORD 3,5,7,11,13,17,19,23,29,31,37,41,43,47

.code

PROCEDURE1 PROC Prime: DWORD

MOV ECX, 0

L1:

MOV eax, [primeArray+ecx*4]

CMP Prime, eax

JE L2

inc ECX

CMP ecx, 14

jl L1

mov eax, 0

RET

L2:

mov eax, 1

RET

PROCEDURE1 ENDP

_TEXT ENDS

END

C++:

#include

//prototype for COPYSTR extern function (in this case in asm file)

extern "C" int _stdcall PROCEDURE1( int);

int main()

{

char dest[100] = {0};

char* source = "Enter a number";

char* source1 = "The number is prime";

char* source2 = "Tne number is not prime";

int test1 = 7;

int prime = PROCEDURE1(test1);

if(prime == 1)

{

printf("%s ",source1);

}

else

{

printf("%s ",source2);

}

}

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 Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions