Post Reply 
(15C) another approach to decimal <-> binary conversion
11-30-2017, 07:50 PM
Post: #2
RE: (15C) another approach to decimal <-> binary conversion
(11-29-2017 10:32 AM)jthole Wrote:  I've written my own conversion (not using an existing program as the basis, so I surely have made beginner mistakes), which prefixes the number with a "8". That makes sure the leading zeros are preserved, and can be easily read as "B" for binary ;-)

Ah, that's what the "8" is for. #-)

(11-29-2017 10:32 AM)jthole Wrote:  To start the program, input the decimal number you want to convert (no need to press enter), and press R/S.

If the program happens to be set to step 000 or 001, that is.

The five keys A...E on the 15C are there to avoid exactly this problem. Press f[A] and the program starts at LBL A. Or B, C, D or E, respectively. That's what these keys are for. In user mode you don't even have to press the [f] prefix.

So you should not waste these useful labels A...E for simple loops or the like. Have you program start with LBL A and replace the existing LBL A with, say LBL 0 or LBL 1 or another numeric label.

(11-29-2017 10:32 AM)jthole Wrote:  The binary number is returned in the X register (in reverse).

Not if you turn the calculator upside down. This was even the "b" becomes a suffix that makes sense: 81111000 then can be read as 0001111B. :-)

And finally... what about a version that returns a result in the correct order ?-)

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: (15C) another approach to decimal <-> binary conversion - Dieter - 11-30-2017 07:50 PM

User(s) browsing this thread: 1 Guest(s)