Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that clears the screen, locates the cursor near the middle of the screen, prompts the user for two integers, adds the integers,

Write a program that clears the screen, locates the cursor near the middle of the screen, prompts the user for two integers, adds the integers, and displays their sum. You will need to use the ClrScr, Gotoxy, WriteString, Crlf, and ReadInt procedures from the Irvine32 library.

Using the ArrayScan program below as a model, implement the search using the LOOPZ instruction.

TITLE Scanning an Array ;Scan an array for the first nonzero value. INCLUDE Irvine32.inc .data intArray SWORD 0,0,0,0,1,20,35,-12,66,4,0 ;intArray SWORD 1,0,0,0 ;alternate test data ;intArray SWORD 0,0,0,0 ;alternate test data ;intArray SWORD 0,0,0,1 ;alternate test data noneMsg BYTE "A non-zero value was not found",0 .code main PROC mov ebx,OFFSET intArray ;point to the array mov ecx,LENGTHOF intArray ;loop counter L1: cmp WORD PTR [ebx],0 ;compare a value to zero jnz found ;found a value add ebx,2 ;point to next loop L1 ;contine the loop jmp notFound ;none found found: ;display the value movsx eax,WORD PTR[ebx] call WriteInt jmp quit notFound: ;display "not found" message mov edx,OFFSET noneMsg call WriteString quit: call crlf exit main ENDP END main 

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_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions