ECE 33: Introduction to Computer Engineering
Programming Assignment III
DUE: NOVEMBER 25, 1995

This assignment is supposed to teach you the use of an 8 bit processor (8085) to perform 16 bit arithmetic.

Write a program in 8085 assembly language to design a 16 bit calculator that can do the simple calculations of addition and subtraction. Your program should begin by describing its capabilities and then ask for an arithmetic sum. The user would type in a decimal integer less than or equal to 65535 (this is the largest integer that can be expressed in 16 bits. In binary, it is 1111...1). The user will then type in either + or - sign and follow it up with another number (again <= 65535). After entering the second number, the user types in = sign. The program should quickly spit out the answer and then prompt for another problem.

The program should end when user types in a Carriage Return on an empty line.

You may assume that the user will always type in values within the specified range and that the answer will also be within range (i.e., it will be a non-negative number less than or equal to 65535).

All wrong inputs should be erased and the program should beep at the user. Note that the correct inputs when the first number is being typed are digits '0' to '9' and operators '+' or '-' (which signify the end of the first number). The valid characters while the second number is being typed are digits '0' through '9' and the '=' sign which signifies the end of the second number.

In a typical run, the program opens up by saying:

Itsy 16 Bitsy Calculator
For a free sample, type in a problem. To end, type Carriage Return

Problem: _

The program is now waiting for the user input. User types in "155-25=" (excluding the quote marks ofcourse). The screen instantly becomes

Itsy 16 Bitsy Calculator
For a free sample, type in a problem. To end, type Carriage Return

Problem: 155-25=130

Problem: _

The user now decides to take up the calculator on its 16 bit challenge. He types in "10ABCD319+600.9E=". He finds that all the wrong character inputs ('A', 'B', 'C', 'D', '.' and 'E' here) are simply ignored by the computer, (they don't even appear on the screen!). Further, on each error, the computer beeps at him without fail. As soon as his input ends, the screen becomes:

Itsy 16 Bitsy Calculator
For a free sample, type in a problem. To end, type Carriage Return

Problem: 155-25=130

Problem: 10319+6009=16328

Problem: _

Satisfied that this is the calculator he was waiting for all his life, the user types in a Carriage Return to see the screen become:

Itsy 16 Bitsy Calculator
For a free sample, type in a problem. To end, type Carriage Return

Problem: 155-25=130

Problem: 10319+6009=16328

Problem:

Thank you for trying me out.
If you liked what you saw, you may buy me at the bursar's counter.

Name the program prog3. Submit files prog3.asm and prog3.hex (produced by a80) on a diskette. Also submit prog3.asm in printed form. Your program should clearly identify you (and your section) in the program header.

The programs will be graded for efficiency (compactness of the code and speed of execution), correct programming style, proper labels, good comments and pleasing interaction with the user (user interface). Please use your own imagination while designing the screen layout and messages. See the three example programs (example1.asm - example3.asm) to learn the correct programming style.