[Coco] Question on 6309 TFM command

Robert Gault robert.gault at att.net
Sun Nov 13 21:17:45 EST 2016


L. Curtis Boyle wrote:
> Has anyone tested the TFM command when going from a single memory location, writing to a range (TFM r0,r1+), to see if it takes the same # of cycles as it would with both source and destination registers updating (TFM r0+,r1+). That’s what some of the 6309 docs say it does, but wondering if it is more optimized than that if it doesn’t have to update the source ptr (or possibly even the data byte itself, if it knows it is outside of the I/O range, perhaps).
>
> If it is in fact the same speed either way, then filling a contiguous, large chunk of memory with a single byte would be faster using a stack blast, 6809 style (although it would take more RAM).
>
> L. Curtis Boyle
> curtisboyle at sasktel.net
>
> TRS-80 Color Computer Games website
> http://www.lcurtisboyle.com/nitros9/coco_game_list.html
>
>
>
>

Curtis,

While I have used that opcode, I've not timed it. In fact, it would be very hard 
to time those specific opcodes without including all the other opcodes required 
to get the two of interest to run. That being said, I just ran a test that would 
seem to indicate that speed of TFM r0,r1+ and TFM r0+,r1+ are essentially the same.

Here are the programs for the test using my EDTASM6309 to create the assembly 
code and run on a Coco3. My program SWREAD creates a new string function DATE$ 
that reads the hardware clock.

TEST
10 PCLEAR1:LOADM"TFM"
20 PRINT DATE$:EXEC:PRINT DATE$

00100 	ORG	$E80
00110 * THIS IS A TEST OF THE TFM OPCODE
00120 START	LDB	#255	number of repeats
00130 S2	LDX	#$2000
00140 	LDY	#$6F00		storage for the source
00150 	LDW	#$4000		number of bytes to change
00160 	LDA	#$3A		value
00170 	STA	,Y
00180 	TFRR	Y,X		same as tfm r0,r1+
00190 	DECB			loop
00200 	BNE	S2
00210 	RTS
00220 	END	START

Elapsed time equals 7 seconds.

TEST2
10 PCLEAR1:LOADM"TFM2"
20 PRINT DATE$:EXEC:PRINT DATE$

00100 	ORG	$E80
00110 * THIS IS A TEST OF THE TFM OPCODE
00120 START	LDB	#255
00130 S2	LDX	#$2000
00140 	LDY	#$2000		now regX and regY are the same
00150 	LDW	#$4000
00160 	LDA	#$3A		left to keep the overhead the same
00170 	STA	,Y		     "
00180 	TFRP	Y,X		same as tfm r0+,r1+
00190 	DECB
00200 	BNE	S2
00210 	RTS
00220 	END	START

Elapsed time the same as above, 7 seconds.

Does this answer your question? :)

Robert



More information about the Coco mailing list