Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a WASP assembly language program that allows the user to play a game of higher/lower. The program will choose a random number from 1

Create a WASP assembly language program that allows the user to play a game of higher/lower. The program will choose a random number from 1 to 16. The user will try to guess what it is. If the user guesses a number that is too low, the program will say, Higher. If the user guesses a number that is too high, the program will say Lower. If the user guesses the correct number, the program will say, Correct., and also display the number of guesses the user made before getting the right answer.

Example output:

8 Higher 12 Lower 10 
Higher 11 Correct. You made 4 guesses. 

Hints: You can change the format of the output if you want, as long as it is still clear to the user.

Sometimes the user will enter two digits, and sometimes only one. If you want, you can ask the user to always use two digits so to input 7, they should type 07.

There is no function in WASP to get a random number. You can use the clock to get a random number, though. The current time in seconds is stored in memory location 0x00FF. If you do a bitwise AND calculation with the number 15, this will give you a number from 0 to 15. Add 1 to get a number from 1 to 16. For example, if you first store the time into register AX, you can then do

AND AX,0x0F

To get a number from 0 to 15 in AX.

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions