Any assembly programmers here?
#1
Hello Lurkers,

Here’s wondering if there are any fellow electrical/computer engineers here that could give me a little hand with an assignment.

See, as a final project in one of my classes my team has to code a calculator program. My part of the work consists of getting numbers from an external keypad device and sending them over to the arithmetic module of the program for calculation. The user is supposed to enter his numbers for calculations in decimal (base 10). I get those numbers encoded in ASCII from the keypad, convert them to HEX, and store them side by side in some buffer in RAM. So, what I have now in my buffer is a string of HEX-Encoded Decimal numbers.

Suppose the user enters: 1 2 3 4 5

This means that in my buffer I now have:

Buffer: $01 $02 $03 $04 $05 (1 byte long each)


My problem is this: how can I convert these HED’s to proper HEX to send them over to the arithmetic module (which, by the way, is expecting an 8-byte long HEX number as any of the two operands for the calculation)?

An easy way of doing this conversion is to simply multiply each individual HED by decimal 10^0, 10^1, 10^2, … 10^n, from less significant to most significant and adding all of these results. Problem? The biggest accumulator I have available can only hold 2 bytes, therefore the built-in multiplication instruction can only multiply 1-byte long numbers.

Can anybody give me any help with this? :(

The gods made heavy metal and they saw that is was good
They said to play it louder than Hell
We promised that we would
When losers say it's over with you know that it's a lie
The gods made heavy metal and it's never gonna die

- Manowar
Reply


Messages In This Thread
Any assembly programmers here? - by Ashkael - 11-28-2004, 06:41 AM
Any assembly programmers here? - by LavCat - 11-28-2004, 10:24 AM
Any assembly programmers here? - by Ashkael - 11-28-2004, 07:51 PM
Any assembly programmers here? - by LavCat - 11-29-2004, 03:13 AM
Any assembly programmers here? - by whyBish - 11-29-2004, 04:48 AM
Any assembly programmers here? - by whyBish - 11-29-2004, 05:06 AM
Any assembly programmers here? - by kandrathe - 11-29-2004, 04:48 PM
Any assembly programmers here? - by Ashkael - 12-02-2004, 04:42 AM
Any assembly programmers here? - by Ashkael - 12-02-2004, 04:45 AM
Any assembly programmers here? - by Ashkael - 12-02-2004, 04:48 AM
Any assembly programmers here? - by whyBish - 12-03-2004, 12:42 AM
Any assembly programmers here? - by whyBish - 12-03-2004, 12:45 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)