We stduying the 8086 and 386 using boarland linker.
while stduing for a test I have I came across a queation about menaging and printing 64bit numbers.
the numbers are represented as an array of chars (8) and I need to implement a rutine that puts the number in a string.
If it was a 32 bit number (long int) or 16 bit I would have just use a loop that does modulo 10, add the hascii of zero and put that in the string.
but the problem is I cant do the idiv/div action for 64 bit( if I divide by dword than it will work on EDX:EAX and thats what I want but the answer is than put to EDX and EAX and then I get devide overflow...
The form of the question (translated):
"In the following exercise you need to support actions on long long unsigned integers that are 64bit long. (8 bytes).
The inner representasion of the numbers will be the same as unsigned int (16bit) or long unsigned int (32bit).
Remeber that bytes in the memory are in order of significase meaning:
if the number takes adresses 1000-1007 than adress 1000 will store the least segnificant byte and the 1007 the most.
You are not allowed to use the Floate Proccessing unit, it does not support unsigned number anyway.
The c definition of the 64 bit number is:
typedef char INT64;
You are to write two assembly function called from C's main:
extern void INT64tostr( char str, INT64 ptr );
str is a string into which you need to put a 64bit number ptr (remember ptr is pointer to array)
extern void addINT64( INT64 ptr3, INT64 ptr1, INT64 ptr2 );
This rutine needs to sum two 64bit numbers and put in the third
remember all perameters are pointers.
You need to write it in model small. "
and it goes on with an example of printing fibonatchi numbers that goes really high...
I do not expect for you guys to completely solve this (unless you want to) but more of an algorithm on how to do the first one, as I said before the problem for me is puting in a string...
The second one is easier, I just do ADC (add with carry) for all but the first bytes and put that respecivly in the new array...
Its the first one I got stick with...
Thank you all in advance