Question: Write in assembly language an RPN calculator function 'int RPNcalc(char *inp) for logic operations which takes a string-pointer argument to ASCII text and returns

Write in assembly language an RPN calculator function 'int RPNcalc(char *inp) for

Write in assembly language an RPN calculator function 'int RPNcalc(char *inp) for logic operations which takes a string-pointer argument to ASCII text and returns its calculated value or -1 if there is some error in the string. Use the TBB or TBH opcodes to process the string argument. Assume values are all 4-digit hex ASCII, operators are '1', '&', 'I' and '^' (OR, AND, NOT, XOR), values and operators are separated from each other by the space character, and newline ' ' marks the end of the calculation. Assume that the stack space required by the function will never exceed eight words. Example of operation: RPNcalc("0001 0001 | ") returns 0x0001 RPNcalc("00000001 00000002! ") returns 0x00000003 RPNcalc("00000001 00000002 & ") returns 0x00000000 RPNcalc("0001 0002 ^ FFFF ^ ") returns 0xFFFFFF00 RPNcalc("0001 0002 0004 0008 ||| ! " returns OxFFFFFFFO ... and so on. Create a set of test strings which demonstrate correct operation of the calculator. assume that the string is terminated by a NULL ('\0') and that 'newline' is OxA.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!