Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me complete this code? Implement the following C program in MASM. Be sure to use proper spacing on all output. If necessary,

Can someone help me complete this code?

Implement the following C program in MASM. Be sure to use proper spacing on all output. If necessary, first key in the C program and then implement the MASM program to insure the MASM program works identically to the C program:

#include int main(){ int num1, num2; printf(" %s","Enter a value for num1: "); scanf("%d",&num1); printf(" %s","Enter a value for num2: "); scanf("%d",&num2); printf(" %s ","num1 num2"); printf("%s%d%s%d "," ",num1," ",num2); return 0; }

Heres what i did:

INCLUDELIB msvcrtd INCLUDELIB legacy_stdio_definitions INCLUDELIB ucrt

; Normal directives .386 .model flat,vC .stack 100h

; Prototypes printf PROTO argl:Ptr Byte, printlist:VARARG exit PROTO errorCode:DWORD scanf PROTO argl:Ptr Byte, printlist:VARARG

; Data segment .data

; Input format string in1fmt byte "%d", 0

; 32-bit signed integer num1 sdword ? num2 sdword ?

; Format string for printf msg0fmt byte "%s", 0 msg1fmt byte 0Ah, "%s%d",0Ah,0Ah,0 msg2fmt byte "%s%d%s%d",0Ah,0Ah,0

entry1 byte "Enter a value: " , 0 entry2 byte "Enter a value: " , 0 str1 byte " num1 num2" , 0 space byte " " , 0 .code

INVOKE printf, ADDR msg0fmt, ADDR entry1

INVOKE scanf, ADDR msg0fmt, ADDR num1

INVOKE printf, ADDR msg0fmt, ADDR entry2

INVOKE scanf, ADDR msg0fmt, ADDR num2

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago