Does anyone know of any tutorials on how to convert a string of characters from dec to hex to oct and bin? If there are no tutorials, could someone give me the gist of it? Doesnt have to be code either, pseudo-code would be cool too.

I don't know about oct, but converting between hex,dec, and bin isn't that hard. Decimal can easily be converted to hex, and hex can easily be converted to binary. Try reading the Art Of Assembly, it clears everything up regarding those three bases (again I don't no much about oct, so..) good luck :alright:

I have a hard copy of AoA, it explains pretty good on how to convert a string to a number, but not how to convert a string to another base.

Here is a link to X-Calibre's Page, please look at this algorithm. He has many other great works here as well!

there are a couple of proc's in the masm32\m32lib directory (atodw and hextodw i think)

but not how to convert a string to another base.

string->machine representation of number.

machine representation of number->string in new base.

:)

There was an article, with code, in the Assembly Language Journal, for converting between some 64-bit bases. If you can't find it, let me know and I'll try and locate it.

Do you need fastest algos of subj or just theory?

The thing is that in the best algos there a big way was done

with math and low level optimization and simple theory

wouldn't be enough to understand the state of the art realization.

The thing is that in the best algos there a big way was done

with math and low level optimization and simple theory

wouldn't be enough to understand the state of the art realization.

I had the blow the dust off of the piece of work (I made it over 6 months ago). It will convert Dec to any base from 0 to 16.

In PERL:

With a little modification, this sub will do the reverse (hint: change / to *).

In PERL:

```
```

print &Base(174,16);

sub Base {

(my $Dec, my $Base) = @_;

my $Hex;

while ($Dec > 0)

{$Hex = (sprintf "%1.1X", ($Dec % $Base)) . $Hex; $Dec = int $Dec / $Base}

return $Hex }

With a little modification, this sub will do the reverse (hint: change / to *).

You are doing one pointless iteration

condition must be While num > base.

Last num will be already Base^0 * k AKA - last digit

condition must be While num > base.

Last num will be already Base^0 * k AKA - last digit

I'm not going to take the time to mess with it, but I think I did it that way so that the last digit gets appended within the loop; instead of copying the code and pasting after the loop. However, it doesn't add an extra digit to the string.