| | |
C and Assembly Mixed-Mode Hex comparison program
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi, I have an assignment where i have to write a C and assembly mixed-mode program.
I am unsure how to do no. 2, namely, how to determine if it's a valid ASCII HEX digit or just garbage. Suggestions?
- The c program takes in two characters which stand for two hex characters.
- The assembly procedure then passes each character in turn to a C function which determines if the character is a valid ASCII HEX digit (namely 0-F).
- If both characters are valid the assembly language procedure then compares the two HEX digits and returns the larger to the main program.
- The main C program then prints out the larger digit.
I am unsure how to do no. 2, namely, how to determine if it's a valid ASCII HEX digit or just garbage. Suggestions?
•
•
Join Date: Sep 2009
Posts: 3
Reputation:
Solved Threads: 0
0
#3 20 Days Ago
So far I have my C file taking in 2 characters:
And I'm just not sure how to verify if their HEX or just normal characters (so either 0-9 or A-F). I was thinking I could just do a bunch of if statements comparing each of them (or make a HEX array, and for loop through it comparing along the way), but is there a better way to do this?
Assembly Syntax (Toggle Plain Text)
char char1, char2; printf ("Enter a character: "); scanf ("%c", &char1); while (getchar () != '\n')//so that the program doesn't take in the carriage return as input continue; printf ("Enter another character: "); scanf ("%c", &char2); while (getchar () != '\n')//so that the program doesn't take in the carriage return as input continue;
And I'm just not sure how to verify if their HEX or just normal characters (so either 0-9 or A-F). I was thinking I could just do a bunch of if statements comparing each of them (or make a HEX array, and for loop through it comparing along the way), but is there a better way to do this?
0
#4 20 Days Ago
•
•
•
•
So far I have my C file taking in 2 characters:
Assembly Syntax (Toggle Plain Text)
char char1, char2; printf ("Enter a character: "); scanf ("%c", &char1); while (getchar () != '\n')//so that the program doesn't take in the carriage return as input continue; printf ("Enter another character: "); scanf ("%c", &char2); while (getchar () != '\n')//so that the program doesn't take in the carriage return as input continue;
And I'm just not sure how to verify if their HEX or just normal characters (so either 0-9 or A-F). I was thinking I could just do a bunch of if statements comparing each of them (or make a HEX array, and for loop through it comparing along the way), but is there a better way to do this?
![]() |
Similar Threads
- Square root program without sqrt or pwr (C++)
- Big Issue with Assembly Startup (Assembly)
- Running a program from Cmd Prmt in Vista (Java)
- 8086, hex to decimal program (Assembly)
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Help with program to convert hex to dec (Assembly)
- Java 5 with Mac OS X (Java)
- Little Help with a RBG to HEX code program... (C++)
- Using x86 Assembly Language with Microsoft Visual C++ (C++)
Other Threads in the Assembly Forum
- Previous Thread: Noob looking for guidance
- Next Thread: Making a File Compressor. Need Help
| Thread Tools | Search this Thread |





