# 代写辅导接单-CMPEN 472 Homework 7, The Pennsylvania State University CMPEN

CMPEN 472 Homework 7, The Pennsylvania State University CMPEN 472, The Pennsylvania State University

Due: Oct. 16, 2023 11:30pm

Objective

Ecalc> Ecalc>

Ecalc> Ecalc>

Ecalc> Ecalc>

Ecalc> Ecalc>

Ecalc>

123+4 123+4=127 96*15 96*15=1440 456@5

456@

Invalid

7h4*12

7h

Invalid

3*54312

3*54312

Invalid

003-678

003-678=-675 100+999*2

100+999*

Invalid input format 555/3

555/3=185

input format input format input format

;due to 5th digit

Homework 7

To learn how to use arithmetic instructions, simple command line parsing, and write basic I/O system subroutines.

Textbook Reading (for next homework):

1. Chapter 9: Section 9.1, Section 9.2 2. Chapter 9: Section 9.4, Section 9.5

Instruction

1. Write a program to make an elementary calculator, displayed on the HyperTerminal connected to the HCS12 board.

2. The calculator rules are:

1. Input positive decimal integer numbers only

2. Input and output maximum four digit numbers only

3. Valid operators are: +, -, *, and /

4. Input number with leading zero is OK

5. Input only two numbers and one operator in between, no spaces

6. Show 'Ecalc> 'prompt and echo print user keystrokes unltil Return key

7. Repeat print user input and print answer after the '=' sign

8. In case of an invalid input format, repeat print the user input until the error character

9. In case of an invalid input format, print error message on the next line: 'Invalid input

format'

10. Keep 16bit internal binary number format, detect and flag overflow error

11. Use integer division and truncate any fraction

3. The HyperTerminal display should look something like the following:

2023/10/13 09:45

Ecalc>

Ecalc>

Ecalc>

Ecalc> Ecalc>

CMPEN 472 Homework 7, The Pennsylvania State University

7*(45+123)

7*(

Invalid input format 78*9999

78*9999

Overflow error -2*123

-

Invalid input format 73/15

73/15=4

4. Make your program user friendly by giving directions as to how to correctly use your program.

5. You may want to see the Flow Chart of the above algorithm.

6. Also, make your program 'fool-proof', never crash or stop based on wrong user response.

7. You may add other features or decorations.

8. Design the program to start at \$3100 and data to start at \$3000.

9. Be sure to put much comments so that grader and others can clearly and quickly understand your program. Comments are very important in assembly language programs.

10. Copy your 'main.asm' file to 'cmpen472hw7_YourLastName.asm'. For example, mine will be 'cmpen472hw7_choi.asm' (Do not ZIP your file.)

11. Turn-in your project source code file through Penn State CANVAS. Upload your source code file into the CANVAS Assignment's Homework submission. Be sure to select CMPEN 472 class and correct Homework number, and with correct file name.

Congratulations on your seventh CMPEN 472 homework completion!

Epilogue:

Flow chart for the Homework 7. Click here. Aid for the Homework 7. Click here.

Email:51zuoyejun

@gmail.com