A CPUID cassette image was uploaded to the 'Tandy Color Computer (CoCo)' group on Facebook by Matteo Trevisan on 2017/07/31:
https://www.facebook.com/groups/2359462640/permalink/10155535779897641/
The CPUID code consists of a BASIC wrapper written by Stephen J. Woolham that pokes object code into RAM $D00, executes it, and uses the result to output a CPUID byte to location 157 in RAM.
The actual identification method is to setup the B accumulator with a known value $FF, then execute a 6309-only CLRD opcode.
The CLRD will clear the B accumulator if run on a true 6309.
If CLRD is run on a 6809, the 6809 does not recognize the opcode and treats it as a 1-byte NOP.
Next, a test is done to see if the zero flag is set.
If the CLRD executed, then B accumulator = 0 and Z flag = 1 (TRUE): Branch to the code that sets the output value in RAM location $9D to indicate a 6309.
Otherwise, set the output value in RAM location $9D to indicate a 6809.
Save out the result and exit.
10 '6309/6809 CPUID PROGRAM 20 'FOR THE COCO/COCOIII 30 'AND DRAGON 32/64 40 'BY STEPHEN J WOOLHAM 50 ' 60 START=&HD00 70 FOR I=START TO START+15:READ A$:POKE I,VAL("&H"+A$):C=C+PEEK(I):NEXT:IF C <> 1363 THEN PRINT"ERROR IN DATALINE":END 80 EXEC START 90 IF PEEK(157)=3 THEN CPU$="6309"ELSE IF PEEK(157)=9 THEN CPU$="6809" 100 PRINT"A "+CPU$+" CPU IS PRESENT...":END 110 DATA C6,FF,10,4F,5D,27,04,86,9,20,2,86,3,97,9D,39
0D00: C6 FF LDB #$FF 0D02: 10 4F CLRD 0D04: 5D TSTB 0D05: 27 04 BEQ $0D0B 0D07: 86 09 LDA #$09 0D09: 20 02 BRA $0D0D 0D0B: 86 03 LDA #$03 0D0D: 97 9D STA $9D 0D0F: 39 RTS
The 6309 Book by Chris Burke, section 4.2 in the second edition, includes a different identification method using the COMplement instruction.
6809 :: Tandy Color Computer :: MC6809E :: HD6309E