Need this simple game in LC-3 Binary

已关闭 已发布的 5 年前 货到付款
已关闭 货到付款

A Simple Guessing Game

Problem Statement

Your program will simulate a simple guessing game. The program has stored the value

6.

The program will continually ask the user to guess a number between 0 and 9 (see

sample

program input/output below.) The user enters the guess from the keyboard.

If the guess is larger than 6; the program should output:

Too big.

If the guess is smaller than 6; the program should output:

Too small.

When the user finally guesses correctly, the program will output:

Correct! You took # guesses.

where # is the number of guesses it took the user.

If after 9 guesses, the user has not correctly guessed the number, the program should

output

Game over. Correct answer is 6.

You do not need to check for invalid input (alphabetical characters, punctuation, etc). If

your program encounters any non digit character, the program should output

Invalid input.

Invalid input should still count as a guess.

You should use TRAP x20 (GETC), to read in a character from the keyboard. See Table

A.3 in Appendix A of the textbook for a listing of all trap vectors. You can use the

pseudo-op .STRINGZ to store a string into your program.

Hints and suggestions

Remember, all input and output functions use ASCII characters. You are responsible for

making any conversions that are necessary.

Before sitting down at the computer, give some serious thought to what this program

involves. Break it into sections. You might even want to draw a simple flow chart.

Comment your code! Not only does this help you debug your program, but it will make it

easier to remember what you did, should you need to look back at your code for future

projects (hint, hint). It also helps the graders, making them more likely to give partial

credit.

Your program should be written in LC-3 Assembly language, and tested using the LC-3

Simulator. The completed program should work using input from the keyboard and

output to the monitor.

Don't forget the ASCII code x0A. It causes the cursor to go to the next line (Newline).

Sample Input/Output

Guess a number: 5

Too small.

Guess again: 9

Too big.

Guess again: a

Invalid input.

Guess again: 6

Correct! You took 4 guesses.

Writing and testing your program

Your code should have a comment block at the beginning of the file containing

your

name, student number, and a brief description of the program.

Your description should serve as a general summary of your program's approach to the

problem and will aid in grading. It will also serve as a guideline for assigning partial

credit. It is in your best interest to make all of your ideas clear through this summary and

through commenting within your code.

IMPORTANT NOTE: The first line of your program must specify the memory

address of where you want your program to be placed (using the .ORIG pseudo-

op).

We request you place your program at x3000.

Need a full code for LC-3 Machine.

机器学习(ML)

项目ID: #18357724

关于项目

远程项目 活跃的5 年前