Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m working on an assignment that requires irvine32 using lower assebly languag

ID: 3582402 • Letter: I

Question

I'm working on an assignment that requires irvine32 using lower assebly language.

You need to create a number system conversion program. The program should contain a menu that allows the user to choose to convert an integer to hexadecimal, hexadecimal to integer, integer to binary, and hexadecimal to binary.

Requirements:

Display a menu for the user to enter a value for the operation they want to perform. The menu should also contain a value to let the user quit.

Example: Enter 1 for integer to binary conversion, Enter 2 for hexadecimal to integer conversion.

The program should allow the user to do any number of conversion operations until they choose to quit.

Hint: this is where a loop will be helpful.

You need to create a procedure for each conversion and call the procedure based on the user's choice.

Make the functions flexible so they could be used in any program and not rely on specific variables.

You must document your procedures by using comments to describe the procedure's purpose, inputs it receives, and outputs it returns.

You will need to use the functions from the Irvine32 library (described in chapter 5 ) to read a binary, integer, or hex value; you will need other functions to display the value in the "converted" form.

Hint: you don't need to do any conversion other than taking a value stored in a memory location and writing it on the screen using a specific function.

You must use jump instructions for all branches and not the .IF, .ELSE, .ELSEIF, and other conditional directive structures.

You should make use of comments in your code.

Explanation / Answer

#include //Always use meaningful names for types typedef unsigned char boolean; #define True 't' #define FALSE (!True) //this is a really neat trick for swapping values efficiently void swap(long* a,long *b) { *a=*a^*b;*b=*b^*a;*a=*a^*b; } //Here's a readability improvement #define until(condition) while(!(condition)) int main(int n, char*args[]){ double *d; int i; char input[5]; //should be long enough for most doubles. boolean sorted = FALSE; //In C, you need to specify the array size beforehand, so ask printf("Please enter the length of the array "); gets(input); //scan the input string and convert to a value sscanf(input,"%s",&input[0]); n=(long)atol(input); //allocate space, make sure you get the order of arguments right. d = calloc(sizeof(double),n); //Get and sort the array until (sorted) { for (i=0;i