A86: Re: OP1=OP1 binary to decimal


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

A86: Re: OP1=OP1 binary to decimal




I don't know about the OPs, but if you can settle for registers, it's easy.
Just loop 8 times and shift right each time into the carry flag.  If the
carry flag is set, then the next digit in binary is a 1.  If not, then it's
a 0.  Converting back is a little bit tougher, because you can't easily
store a binary number in a register (why would you, though).  Assuming it's
in a string, as if converted from above, you do a reverse of above.  Clear
the destination register, then go through the string.  For each byte, shift
the register left and load the value of it ('0' = 48, '1' = 49) into the
first bit.

Converting binary to decimal and vice-versa is one thing where asm actually
IS easier than C...

-----Original Message-----
From: Cassady Roop <croop@oregontrail.net>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Thursday, November 05, 1998 8:31 PM
Subject: A86: OP1=OP1 binary to decimal


>
>To add to my last post, does anyone know of a call that converts a
>binary number in OP1 to a decimal number?
>
>I need the ability to convert an inputted binary number to decimal and
>display it, and vice-versa.  Also, how do I go about getting number
>input that are the actual numbers and not the keycodes; three digits?  I
>know someone told me a while back, but I accidentally deleted everything
>in my mailbox...