This document explains the programs on the disk image cputest.d64, which contains programs that will check for the kind of cpu in your 8bit cbm machine. Because the programs need to be loadable on all 8bit cbm machines, and the fact that the pet can only load at $0401, the programs have been constructed on a pet, and on other machines they will need to be loaded with ,8 (not ,8,1). There is only one program to load actually, it is called start, it loads all other programs to check for cpu specific differences, so to start everything off you do: load"start",8 run Below is a description of each program: START ----- The program start just reserves enough memory space so that the variable space will not interfere with the other loaded programs, and it loads the first cpu-test program called 'old6502' OLD6502 ------- CPU(s) runnable : old6502, new6502, c64dtv, 6509, 6510/7501/8500/8501/8502, 65SC02, 65C02, 65CE02, 4510, 65802, 65816 CPU(s) tested : old6502 CPU(s) left over : new6502, c64dtv, 6509, 6510/7501/8500/8501/8502, 65SC02, 65C02, 65CE02, 4510, 65802, 65816 Action when found : Print "Your cpu is an old6502" Action when not found: Load "65SC02ANDUP" This program tests for an old 6502, the old 6502 has a problem with the 'ROR' opcode, which gives the wrong result. The code used for this test is as follows: * = $0201 lda #$08 clc ror cmp #$04 beq @is_not_old6502 @is_old6502: lda #$01 bne @end_old6502 @is_not_old6502: lda #$00 @end_old6502: sta $0200 rts 65SC02ANDUP ----------- CPU(s) runnable : new6502, c64dtv, 6509, 6510/7501/8500/8501/8502, 65SC02, 65C02, 65CE02, 4510, 65802, 65816 CPU(s) tested : 65SC02, 65C02, 65CE02, 4510, 65802, 65816 CPU(s) left over : new6502, c64dtv, 6509, 6510/7501/8500/8501/8502 Action when found : Load "65802OR65816" Action when not found: Load "6509" This program tests for a 65SC02 or up, in all of those the flags in decimal mode give the correct result. The code used for this test is as follows: * = $0201 clc sed lda #$99 adc #$01 cld bne @is_not_65SC02_and_up @is_65SC02_and_up: lda #$01 bne @end_65SC02_and_up @is_not_65SC02_and_up: lda #$00 @end_65SC02_and_up: sta $0200 rts 65802OR65816 ------------ CPU(s) runnable : 65SC02, 65C02, 65CE02, 4510, 65802, 65816 CPU(s) tested : 65802, 65816 CPU(s) left over : 65SC02, 65C02, 65CE02, 4510 Action when found : Load "65816" Action when not found: Load "65CE02" This program tests for the SEP opcode of the 65802/65816. The code used for this test is as follows: * = $0201 clc .byte $e2, $01 ; NOP #$01 on 65C02/65SC02, LDA ($01,S),Y on ; 65CE02/4510 and SEP #$01 on 65802/65816. bcc @is_not_65802_or_65816 @is_65802_or_65816: lda #$01 bne @end_65802_or_65816 @is_not_65802_or_65816: lda #$00 @end_65802_or_65816: sta $0200 rts 65CE02 ------ CPU(s) runnable : 65SC02, 65C02, 65CE02, 4510 CPU(s) tested : 65CE02, 4510 CPU(s) left over : 65SC02, 65C02 Action when found : Load "4510" Action when not found: Load "65SC02" This program tests for the extra Z register of the 65CE02/4510. The code used for this test is as follows: * = $0201 .byte $a3, $A3 ; NOP NOP on 65C02/65SC02 and ; LDZ #$A3 on 65CE02/4510 lda #$00 .byte $6b ; NOP on 65C02/65SC02 and TZA on 65CE02/4510 cmp #$00 beq @is_not_65CE02 @is_65CE02: lda #$01 bne @end_65CE02 @is_not_65CE02: lda #$00 @end_65CE02: sta $0200 rts 4510 ---- CPU(s) runnable : 65CE02, 4510 CPU(s) tested : 4510 CPU(s) left over : 65CE02 Action when found : Print "Your cpu is a 4510" Action when not found: Print "Your cpu is a 65CE02" This program tests for the map instruction of the 4510. The code used for this test is as follows: * = $0201 lda #$00 .byte $5c ; MAP on 4510 and ; 4 byte NOP on 65CE02 lda #$01 nop sta $0200 rts 65SC02 ------ CPU(s) runnable : 65SC02, 65C02 CPU(s) tested : 65SC02 CPU(s) left over : 65C02 Action when found : Print "Your cpu is a 65SC02" Action when not found: Print "Your cpu is a 65C02" This program tests for the SMB7 opcode of the 65C02, which is missing on the 65SC02. The code used for this test is as follows: * = $0201 sei lda $f7 pha ldx #$00 stx $f7 .byte $f7, $f7 ; NOP NOP on 65SC02 and SMB7 $F7 on 65C02 cpx $f7 bne @is_not_65SC02 @is_65SC02: ldx #$01 bne @end_65SC02 @is_not_65SC02: ldx #$00 @end_65SC02: pla sta $f7 stx $0200 cli rts 65816 ----- CPU(s) runnable : 65802, 65816 CPU(s) tested : 65816 CPU(s) left over : 65802 Action when found : Print "Your cpu is a 65816" Action when not found: Print "Your cpu is a 65802" This program tests for access to more than 64K of memory. Note that this works on the SuperCPU because it has 128K of memory, but it might not work on a Flash8 or Turbo Process card, so this test might have to be revised once more information is known. The code used for this test is as follows: * = $0201 sei .byte $af, $00, $30, $00 ; lda $003000 .byte $cf, $00, $30, $01 ; cmp $013000 bne @is_65816 .byte $1a ; ina .byte $8f, $00, $30, $00 ; sta $003000 .byte $cf, $00, $30, $01 ; cmp $013000 beq @is_not_65816 @is_65816: ldx #$01 bne @end_65816 @is_not_65816: ldx #$00 @end_65816: .byte $3a ; dea .byte $8f, $00, $30, $00 ; sta $003000 stx $0200 cli rts 6509 ---- CPU(s) runnable : new6502, c64dtv, 6509, 6510/7501/8500/8501/8502 CPU(s) tested : 6509 CPU(s) left over : new6502, c64dtv, 6510/7501/8500/8501/8502 Action when found : Print "Your cpu is a 6509" Action when not found: Load "NEW6502" This program tests for the banking of the 6509. The code used for this test is as follows: * = $0201 sei lda $01 pha lda $00 pha lda $fe pha lda $ff pha lda #$00 sta $fe tay ldx #$01 lda #$02 sta $ff sty $01 lda ($fe),y sta $0200 stx $01 lda ($fe),y cmp $0200 bne @is_6509 eor #$ff sty $01 sta ($fe),y sta $0200 stx $01 lda ($fe),y cmp $0200 beq @is_not_6509 @is_6509: ldx #$01 jmp $0100 @is_not_6509: ldx #$00 jmp $0100 * = $0100 sty $01 lda $0200 eor #$ff sta ($fe),y pla sta $ff pla sta $fe pla sta $00 pla sta $01 stx $0200 cli rts NEW6502 ------- CPU(s) runnable : new6502, c64dtv, 6510/7501/8500/8501/8502 CPU(s) tested : new6502 CPU(s) left over : c64dtv, 6510/7501/8500/8501/8502 Action when found : Print "Your cpu is a NEW6502" Action when not found: Load "C64DTV" This program tests for the lack of a built-in I/O port at $00/$01. The code used for this test is as follows: * = $0201 sei lda $01 pha lda $00 pha ldy #$00 ldx #$FF sty $00 stx $01 stx $00 sty $00 cpx $01 bne @is_not_new6502 @is_new6502: ldx #$01 bne @end_new6502 @is_not_new6502: ldx #$00 @end_new6502: pla sta $00 pla sta $01 stx $0200 cli rts C64DTV ------ CPU(s) runnable : c64dtv, 6510/7501/8500/8501/8502 CPU(s) tested : c64dtv CPU(s) left over : 6510/7501/8500/8501/8502 Action when found : Print "Your cpu is a C64DTV" Action when not found: Print "Your cpu is a 6510/7501/8500/8501/8502" This program tests for the unability to set the upper two bits of $00. The code used for this test is as follows: * = $0201 sei ldy $00 lda #$FF sta $00 lda $00 cmp #$FF beq @is_not_c64dtv @is_c64dtv: ldx #$01 bne @end_c64dtv @is_not_c64dtv: ldx #$00 @end_c64dtv: sty $00 stx $0200 cli rts