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


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

Re: FAST 6502 DIVIDE BY 14?

From BLuRry <brendan.robert@gmail.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: FAST 6502 DIVIDE BY 14?
Date 2012-08-14 13:24 -0700
Organization http://groups.google.com
Message-ID <2f20a756-26f0-4e6f-8e67-235323397bfc@googlegroups.com> (permalink)
References <4510fd05-bef3-433a-8f6d-764da886f214@googlegroups.com> <8c74c952-aa50-4257-85cd-3491d8ee923e@googlegroups.com>

Show all headers | View raw


A table would probably be faster though.  It would take only a few bytes more 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 table.

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.
> 
> 
> 
> Divide by 7:
> 
> DIVIDE_BY_SEVEN:
> 
>   LDA BYTE
> 
>   LSR    
> 
>   LSR    
> 
>   LSR    
> 
>   ADC BYTE
> 
>   ROR
> 
>   LSR
> 
>   LSR
> 
>   ADC BYTE
> 
>   ROR 
> 
>   LSR
> 
>   LSR
> 
>   RTS
> 
> 
> 
> On Tuesday, August 14, 2012 3:09:29 PM UTC-5, (unknown) wrote:
> 
> > i'VE seen tricks for doing different divides
> 
> > 
> 
> > using 6502...
> 
> > 
> 
> > 
> 
> > 
> 
> > are there any for divide by 14?
> 
> > 
> 
> > 
> 
> > 
> 
> > input = 1 byte
> 
> > 
> 
> > output = byte / 14, remainder 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > Rich

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


Thread

FAST 6502 DIVIDE BY 14? aiiadict@gmail.com - 2012-08-14 13:09 -0700
  Re: FAST 6502 DIVIDE BY 14? aiiadict@gmail.com - 2012-08-14 13:14 -0700
  Re: FAST 6502 DIVIDE BY 14? BLuRry <brendan.robert@gmail.com> - 2012-08-14 13:21 -0700
    Re: FAST 6502 DIVIDE BY 14? BLuRry <brendan.robert@gmail.com> - 2012-08-14 13:24 -0700
    Re: FAST 6502 DIVIDE BY 14? Egan Ford <datajerk@gmail.com> - 2012-08-14 14:39 -0600
      Re: FAST 6502 DIVIDE BY 14? Egan Ford <datajerk@gmail.com> - 2012-08-14 14:45 -0600
        Re: FAST 6502 DIVIDE BY 14? aiiadict@gmail.com - 2012-08-14 13:53 -0700
          Re: FAST 6502 DIVIDE BY 14? Egan Ford <datajerk@gmail.com> - 2012-08-14 14:59 -0600
          Re: FAST 6502 DIVIDE BY 14? Egan Ford <datajerk@gmail.com> - 2012-08-14 15:08 -0600
        Re: FAST 6502 DIVIDE BY 14? Egan Ford <datajerk@gmail.com> - 2012-08-14 14:54 -0600
  Re: FAST 6502 DIVIDE BY 14? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-14 15:38 -0700
    Re: FAST 6502 DIVIDE BY 14? aiiadict@gmail.com - 2012-08-16 21:25 -0700
  Re: FAST 6502 DIVIDE BY 14? Michael J. Mahon <mjmahon@aol.com> - 2012-08-14 19:14 -0500

csiph-web