Fastest Divide by 6

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Wall_Axe
Manic Miner
Posts: 492
Joined: Mon Nov 13, 2017 11:13 pm

Re: Fastest Divide by 6

Post by Wall_Axe »

ohh thanks
antoniovillena
Drutt
Posts: 17
Joined: Sat Dec 09, 2017 9:07 pm

Re: Fastest Divide by 6

Post by antoniovillena »

That's faster:

Code: Select all

	LD	H, 0
	LD	D, H		; DE = HL
	LD	E,A
	ADD	A,A
	LD	L,A
	ADD	HL, HL	; x04
	ADD	HL, DE	; x05
	ADD	HL, HL	; x10
	ADD	HL, HL	; x20
	ADD	HL, DE	; x21
	ADD	HL, HL	; x42
	ADD	HL, DE	; x43
Ast A. Moore wrote: Sun Dec 31, 2017 6:52 pm Well, if your range is up to 77, then this will be 3 T states faster (dividend goes into A):

Code: Select all

	LD	H, 0
	LD	D, H		; DE = HL
	ld e,a
	add a,a
	ld l,a
	ADD	HL, HL	; x04
	ADD	HL, DE	; x05
	ADD	HL, HL	; x10
	ADD	HL, DE	; x11
	ADD	HL, HL	; x22
	ADD	HL, HL	; x44
	SBC	HL, DE	; x43
Post Reply