A86: Re: Re: Converting hex


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

A86: Re: Re: Converting hex




I haven't tried ... but can't you set the flag for hex and then call $4a33?


>
>Ok, the idea is pretty much the same.  What you want to do is break each
>byte into two nibbles (4 bits, or the size of a digit in hex or BCD).  Make
>that the lower nibble, then clear the high nibble.  If it's between 0-9,
add
>'0'.  If not, add 'A'.  Then just print it and get the next nibble.  Try
>this little routine I just wrote:
>
>;===========================================
>; DispAhex         [Assembly Coder's Zenith]
>;  prints A in hexadecimal
>; in: A = number to display
>; modified: AF, B, HL, OP1
>;===========================================
>DispAhex:
> ld hl,_OP1
> ld (hl),a
> ld b,2
>DispAhexl:
> xor a
> rld
> add a,48         ; '0'
> cp 58            ; '9' + 1
> jr c,DispAhexs
> add a,7          ; 'A' - '9'
>DispAhexs:
> call _putc
> djnz DispAhexl
> ret
>
>(I discovered some bugs in Assembly Studio 86 v3.0 when using character
>constants, which is why I used their number values instead)
>
>-----Original Message-----
>From: UnEven Software <uneven14@hotmail.com>
>To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
>Date: Sunday, November 08, 1998 10:15 PM
>Subject: A86: Converting hex
>
>
>>
>>I remember a while back someone explained how to convert binary to
>>decimal which helped me out.  And I was wondering if someone could do
>>the same for hex?  I'f appreciate it greatly.
>>
>>Matt
>>
>>______________________________________________________
>>Get Your Private, Free Email at http://www.hotmail.com
>