Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started