Re: A82: A few Questions about 83--82 ASM


[Prev][Next][Index][Thread]

Re: A82: A few Questions about 83--82 ASM




In a message dated 12/31/98 9:40:26 PM Eastern Standard Time,
evil_sam@hotmail.com writes:

> > Also, what is
>  >>"add a,'0' " suppose to achieve?
>  
>     I think it means if a number is zero, it will display a zero.

ok, here it is in a nutshell
say hl=$FFFF which is 65535d.  in order to display this you must store each
number in a string, then call the ROM string routine.  so you have to divide
hl by 10 repeatedly (or any base, instead of call UNPACK_HL you can 'ld a,
"base" \ call UNPACK_HL+2' to display in another base.  If "base" is replaced
with 2, hl will be displayed in binary, but instead of 6 bytes in the string
you need 17.  this only works for bases greater than 10 if the alphabet is
right after the numbers in the ASCII set, which I'm not sure is true) and
store the remainders in the string.  the ASCII codes for each number are not
equivalent to the number, so you have to add the ASCII code for zero to each,
thus the "add a, '0'".  hmm I hope that made sense.
by the way in UNPACK_HL or UNPACK_HL+2, whichever you're using, the remainder
of the division is stored in 'a'

~Adamman