I need the code with the correct formatting because I'm going to copy it. Objectives: Implement a menu Apply Table-Drive

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

I need the code with the correct formatting because I'm going to copy it. Objectives: Implement a menu Apply Table-Drive

Post by answerhappygod »

I need the code with the correct formatting because I'mgoing to copy it.
Objectives:
Implement a menu
Apply Table-Driven Selection technique (Read Section 6.5.4)
Implement user defined procedures
Call user defined procedures
Apply Irvine32.inc library
Problem Description:
Create a program that functions as a simple Boolean calculatorfor 32-bit integers. It should display a menu that asks the user tomake a selection from the following list:
X AND Y
X OR Y
NOT X
X XOR Y
Exit Program
When the user makes a choice, call the corresponding procedure,which is one of the following four:
AND_op: Prompt the user for two hexadecimal integers. AND themtogether and display the result in hexadecimal
OR_op: Prompt the user for two hexadecimal integers. OR themtogether and display the result in hexadecimal.
NOT_op: Prompt the user for a hexadecimal integer. NOT theinteger and display the result in hexadecimal.
XOR_op: Prompt the user for two hexadecimal integers.Exclusive-OR them together and display the result inhexadecimal.
You may refer to Programming Exercises #5 and #6 on page 239
Sample Run:
After menu displayed, I chose 1. I use “Call ReadChar” to getuser input. However, ReadChar will not echo the char typed interminal window. So I use:
call ReadChar
call WriteChar
Explain Result:
12345678h in binary is 0001 0010 0011 0100 0101 0110 01111000
11112222h in binary is 0001 0001 0001 0001 0010 0010 00100010
So their bit-wise and is 0001 0000 0001 0000 0000 0010 0010 0000which is 101000220h
After hit any key, loop repeated. First it cleared the screen,then displayed menu for user to choose again. This time I chose 2and entered 12345678 and 11112222 and the result was 1335767A.
Explain Result:
12345678h in binary is 0001 0010 0011 0100 0101 0110 01111000
11112222h in binary is 0001 0001 0001 0001 0010 0010 00100010
So their bit-wise OR is: 0001 0011 0011 0101 0111 0110 0111 1010which is 1335767Ah
After hit any key, loop repeated. First it cleared the screen,then displayed menu for user to choose again. This time I chose 3and entered 12345678. The result was: EDCBA987
Explain Result:
12345678h in binary is 0001 0010 0011 0100 0101 0110 01111000
So its bit-wise NOT is 1110 1101 1100 1011 1010 1001 1000 0111which is EDCBA987h
After hit any key, loop repeated. First it cleared the screen,then displayed menu for user to choose again. This time I chose 4and entered 12345678 and 11112222 and the result was 0325745Ah
Explain Result:
12345678h in binary is 0001 0010 0011 0100 0101 0110 01111000
11112222h in binary is 0001 0001 0001 0001 0010 0010 00100010
So their bit-wise xor is 0000 0011 0010 0101 0111 0100 0101 1010which is 0325745A
After hit any key, the menu in new screen show up. This time Ichose option 5
Then I hit any key to exit to program.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply