Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion FAST 6502 DIVIDE BY 14?

Received: by 10.66.74.40 with SMTP id q8mr852349pav.19.1345237708169;
        Fri, 17 Aug 2012 14:08:28 -0700 (PDT)
Path: g9ni90876035pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!backlog2.nntp.ams.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.138.MISMATCH!xlned.com!feeder5.xlned.com!feed.xsnews.nl!border-1.ams.xsnews.nl!plix.pl!newsfeed2.plix.pl!wsisiz.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin1!goblin.stu.neva.ru!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: BLuRry <brendan.rob...@gmail.com>
Newsgroups: comp.sys.apple2.programmer
Subject: Re: FAST 6502 DIVIDE BY 14?
Date: Tue, 14 Aug 2012 13:24:01 -0700 (PDT)
Organization: http://groups.google.com
Lines: 83
Message-ID: <2f20a756-26f0-4e6f-8e67-235323397bfc@googlegroups.com>
References: <4510fd05-bef3-433a-8f6d-764da886f214@googlegroups.com> <8c74c952-aa50-4257-85cd-3491d8ee923e@googlegroups.com>
NNTP-Posting-Host: 70.123.154.97
Mime-Version: 1.0
X-Trace: posting.google.com 1344975842 22647 127.0.0.1 (14 Aug 2012 20:24:02 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 14 Aug 2012 20:24:02 +0000 (UTC)
In-Reply-To: <8c74c952-aa50-4257-85cd-3491d8ee923e@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.123.154.97;
 posting-account=HyIOQgoAAAAfAUGOevdCSBhPYcDSPtM9
User-Agent: G2/1.0
Bytes: 2680
X-Original-Bytes: 2576
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

A table would probably be faster though.  It would take only a few bytes mo=
re to store a table for values 0-20 than it would to write the divide by 7 =
code.  But storing a div7 table would save some room, if you can stand the =
extra opcode for shifting A one place to the right before looking up the ta=
ble.

On Tuesday, August 14, 2012 3:21:56 PM UTC-5, BLuRry wrote:
> Consider divide by 14 as a divide by 2 (easy!) and then by 7.
>=20
>=20
>=20
> Divide by 7:
>=20
> DIVIDE_BY_SEVEN:
>=20
>   LDA BYTE
>=20
>   LSR   =20
>=20
>   LSR   =20
>=20
>   LSR   =20
>=20
>   ADC BYTE
>=20
>   ROR
>=20
>   LSR
>=20
>   LSR
>=20
>   ADC BYTE
>=20
>   ROR=20
>=20
>   LSR
>=20
>   LSR
>=20
>   RTS
>=20
>=20
>=20
> On Tuesday, August 14, 2012 3:09:29 PM UTC-5, (unknown) wrote:
>=20
> > i'VE seen tricks for doing different divides
>=20
> >=20
>=20
> > using 6502...
>=20
> >=20
>=20
> >=20
>=20
> >=20
>=20
> > are there any for divide by 14?
>=20
> >=20
>=20
> >=20
>=20
> >=20
>=20
> > input =3D 1 byte
>=20
> >=20
>=20
> > output =3D byte / 14, remainder=20
>=20
> >=20
>=20
> >=20
>=20
> >=20
>=20
> >=20
>=20
> >=20
>=20
> > Rich