Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #385
| From | aiiadict@gmail.com |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Re: FAST 6502 DIVIDE BY 14? |
| Date | 2012-08-14 13:53 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <da655564-da59-4eb0-bc15-a6f0b30e9af8@googlegroups.com> (permalink) |
| References | <4510fd05-bef3-433a-8f6d-764da886f214@googlegroups.com> <8c74c952-aa50-4257-85cd-3491d8ee923e@googlegroups.com> <k0ed1u$mif$1@news.xmission.com> <k0eddt$n0f$1@news.xmission.com> |
On Tuesday, August 14, 2012 1:45:47 PM UTC-7, datajerk wrote: > On 8/14/12 2:39 PM, Egan Ford wrote: > > > On 8/14/12 2:21 PM, 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 > > >> > > > > > > BLuRry beat me to it: > > > > > > lda #$5F ; load dividend in a > > > jsr div14 ; /14 it > > > sta result ; result is in a > > > rts > > > > > > div14: > > > sta dividend > > > lsr > > > lsr > > > lsr > > > adc dividend > > > ror > > > lsr > > > lsr > > > adc dividend > > > ror > > > lsr > > > lsr ;div by 7 > > > lsr ;div by 2 (14) > > > rts > > > > > > > > > > Here is a better one that give you /7 and /14. > > > > div14: > > lsr > > div7: > > sta dividend > > lsr > > lsr > > lsr > > adc dividend > > ror > > lsr > > lsr > > adc dividend > > ror > > lsr > > lsr > > rts > > > > Remainder is missing. Is that required? yUP... How do you get from divide by 7, or divide by 14, to the above code? I've seen descriptions of how to do it in 6502 assembly language textbooks, but I've never understood it. Rich
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
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