Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1476

Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz

From D Finnigan <dog_cow@macgui.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz
Date 2015-01-12 18:39 +0000
Organization Mac GUI
Message-ID <dog_cow-1421087988@macgui.com> (permalink)
References <dog_cow-1421085783@macgui.com> <0b8c643e-175b-4c18-8582-3973d54049de@googlegroups.com>

Show all headers | View raw


wssimms wrote:
> Am Montag, 12. Januar 2015 13:03:06 UTC-5 schrieb D Finnigan:
>> This routine came up in a discussion in comp.sys.apple2 in November.
>> 
>> It was published on pages 52 and 53 of the the Winter 1980 edition of The
>> Apple Orchard Magazine. Following is my summary of the article and the
>> source listing.
>> 
>> 
>> Binary-to-Decimal Shortcut
>> (Small is Beautiful)
>> 
>> by Steve Wozniak
>> 
> 
> This seems like the most obvious way to do a binary to decimal conversion
> on the 6502, but I like the Woz-optimization (Woztimization?) of doing a
> ROL in the high byte of the result instead of another round of ADC/STA.
>

Furthermore, in this article, Woz goes on to say:

The algorithm works as follows. The first bit shifted out of the binary
argument carries a weight of 2 to the 15th. It is added to the result which
is subsequently doubled 15 times (in decimal), restoring the proper weight
component. Each bit is treated in this manner.

The high-order result byte, DEC2, can be shifted left at step (3) instead of
added to itself in decimal since it will not exceed 9 ($FFFF = 06 55 35). If
this is done, DEC2 need not be initialized to zero, since the original
contents will be shifted out during execution. This optimization is
implemented in the following 6502 subroutine [listed in my initial article -
DF].

-- 
]DF$
Apple II Book: http://macgui.com/newa2guide/
Usenet: http://macgui.com/usenet/  <-- get posts by email!
Apple II Web & Blog hosting: http://a2hq.com/

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz D Finnigan <dog_cow@macgui.com> - 2015-01-12 18:02 +0000
  Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz wssimms@gmail.com - 2015-01-12 10:22 -0800
    Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz D Finnigan <dog_cow@macgui.com> - 2015-01-12 18:39 +0000
  Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz jbrooks@blueshiftinc.com - 2015-09-25 21:12 -0700
    Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz qkumba <peter.ferrie@gmail.com> - 2015-10-02 08:27 -0700
      Re: Binary-to-Decimal Conversion Subroutine 27-Apr-80 Woz John Brooks <jbrooks@blueshiftinc.com> - 2015-10-03 08:31 -0700

csiph-web