StNtMaN 0 Newbie Poster

Create a simple calculator that has the following menu:

A – ADD
S – SUB
N – NEG
Q – Quit

Input option: A
Input number: 11
Ans = 11

Input option: S
Input number: 5
Ans = 6

Input option: N
Ans = -6

Input option: A
Input number: 10
Ans = 4

Input option: Q

Have the program print the menu once and have your answer set to zero (can't trust it). Then use the CHARI to input the command and the DECI and DECO to input and output the answer. You'll have to use the conditional branches, of course.

Note: Do NOT have a branch at the top like with the textbook examples. Place your data and the END of the program (before ."END") and have your program start at location 0 (with OUT the first branch). I'll ding you a point if you do.

Here is what I have so far...

A:       .BLOCK  1
S:       .BLOCK  2
N:       .BLOCK  3
main:         LDA      0,i 
again:   CHARI   A,d 
         LDBYTEA A,d
         CPA     '\n',i
         BREQ    again
again2:  CHARI   S,d
         LDBYTEA S,d
         CPA     '\n',i
         BREQ    again2
again3:  CHARI   N,d
         LDBYTEA N,d
         CPA     '\n',i
         BREQ    again3

choicea:       .ASCII  "Input option: A"
choices:       .ASCII  "Input option: S"
choicen:       .ASCII  "Input option: N" 

.end

Any help would be appreciated....I have barely any knowledge in assembly language and pep/8. I mainly work with java. A for effort??? heh!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.