Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DOSBOX and MASMA 1. Collect two digits from the user Prompt the user for an integer. If a non-numeric input is entered, display an error

DOSBOX and MASMA

1. Collect two digits from the user

Prompt the user for an integer.

If a non-numeric input is entered, display an error message and end the program.

Then store the value of the integer in a variable.

Prompt the user for a second integer.

If a non-numeric input is entered, display an error message and end the program.

Then store the value of the integer in a second variable.

2. Use a loop to multiply the two values

Use aCXloop that will run the number of times indicated by the first user input.

Add the second value to an accumulator during each loop.

For example, if the first user entry is 8, and the second 5, then the loop will run 8 times adding 5 to the accumulator each time for a result of 40.

3. Display the result

Display the integer as an ASCII character.

Note that values below decimal 33 will produce output characters that may not be displayable.

; dseg segment public 'DATA' ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; constant and variable declerations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; CR equ 0Dh ; carriage return LF equ 0Ah ; line feed ; string to display prompt1 db 'Enter the first number: $' ; prompt asking for the first number prompt2 db 'Enter the second number: $' ; prompt asking for the second number strOut db 'The value produced is $' ; output string ; ; ; ;;;;;;;;;;;;;;;;;; ; dseg ends ; ; sseg segment stack 'STACK' db 32h dup('STACK') sseg ends ; ; cseg segment public 'CODE' assume cs:cseg,ds:dseg,ss:sseg ; ; START proc far ; set up return push ds ; store random value in stack xor ax, ax ; set ax to 0 push ax ; store 0 in stack mov ax, dseg ; initialize ds address mov ds, ax ; copy segment address ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; main ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; display prompt lea dx, prompt1 ; load string mov ah, 09h ; command to display string int 21h ; execute the command ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; end main ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ret ; return to DOS ; START endp ; end START procedure ; cseg ends ; end code segment ; end START ; end of file

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_2

Step: 3

blur-text-image_3

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

Students also viewed these Programming questions