Hey guys! I am just getting started in assembly language and my head hurts from staring at this problem. I'll paste in the program requirements, then my program and show where I am stuck...any help would be appreciated..I have a test in 7 hrs!!
Problem:
Number Conversion
In this lab, you will be converting a sequence of characters read from the console into a simple unsigned integer number.
You will need four sections in your program:
Part 1 - Sign on
Print out a simple program message with the name of your program and a prompt for the user to enter an integer number. We will ask the user to type in at most four digits only. You may assume (never a good idea in real life) that the user is smart, and only enters what you ask: four or less digits followed by the Enter key. (No error checking is needed beyond this).
Part 2 - Getting user data
Read the user input using the get_kb routine defined in the C library (include the asm_io line for this to work). This routine returns a single character in the EAX register - only the low 8 bits (AL) are of interest. This routine does not echo the character the user typed on the screen - if you want that to happen, you will need to use the print_char routine to make that happen.
Part 3 - Converting the characters to numbers
The character you get from the user ends up in the AL register as a binary number that is the ASCII code for the key pressed. You will need to convert this code into the right numerical value (look at the ASCII code table and you will see that the digits are in order starting at a code of 30h. So to convert the code for the digit 3, we could subtract 30h from that code and we would get a binary value of 3. Sound right?
Think about how you would do the rest of the conversion. You will see the user
Problem:
Number Conversion
In this lab, you will be converting a sequence of characters read from the console into a simple unsigned integer number.
You will need four sections in your program:
Part 1 - Sign on
Print out a simple program message with the name of your program and a prompt for the user to enter an integer number. We will ask the user to type in at most four digits only. You may assume (never a good idea in real life) that the user is smart, and only enters what you ask: four or less digits followed by the Enter key. (No error checking is needed beyond this).
Part 2 - Getting user data
Read the user input using the get_kb routine defined in the C library (include the asm_io line for this to work). This routine returns a single character in the EAX register - only the low 8 bits (AL) are of interest. This routine does not echo the character the user typed on the screen - if you want that to happen, you will need to use the print_char routine to make that happen.
Part 3 - Converting the characters to numbers
The character you get from the user ends up in the AL register as a binary number that is the ASCII code for the key pressed. You will need to convert this code into the right numerical value (look at the ASCII code table and you will see that the digits are in order starting at a code of 30h. So to convert the code for the digit 3, we could subtract 30h from that code and we would get a binary value of 3. Sound right?
Think about how you would do the rest of the conversion. You will see the user