Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Elements Of Chemical Reaction Engineering

Authors: H. Fogler

6th Edition

013548622X, 978-0135486221

More Books

Students also viewed these Programming questions

Question

How Does the Economy Balance Supply and Demand?

Answered: 1 week ago