For my next project, I need a simple basic program (V.2+ compatible) to detect the CBM machine where the program is running.
This is a sample of my program:
Code: Select all
1 A=0:B=PEEK(65494):REM $FFD6 - LOAD KERNAL JUMP TABLE (LOW BYTE)
2 IFB=101THENA=1:PRINT"C128"
3 IFB=255THENA=2:PRINT"C16-PLUS/4":REM SHOULD BE 67 ????
4 IFB=158THENA=3:PRINT"C64":REM HOW TO DETECT THE 64DTV ?
5 IFB=66THENA=4:PRINT"VIC20"
6 REM B= 70 ; PET KERNAL 1
7 REM B=194 ; PET KERNAL 2
8 REM B= 1 ; PET KERNAL 4
9 REM B= 26 ; CBM II SHOULD BE RAM ???
10 IFA=0THENPRINT"YOU CANNOT USE THIS MACHINE"
The code looks on the low byte of the LOAD kernal JUMP TABLE (at least for machines that I need to check) In vice works but there are some strange things...
Problem 1:
C16-PLUS/4 the code in $FFD5 is JMP $F043 [$4C $43 $F0] so the $FFD6 value (65494) should be 67 [$43] but the programs report 255 [$FF] why ?
Problem 2:
I wish to detect the 64DTV so by looking on $FFD6 from a real C64 or from a 64DTV it always report 158, may I detect the 64DTV in some way ?
Problem 3:
I don't need to detect CBM II machines but I wish to understand to prevent problems, $FFD5 should contains RAM, in monitor the command fill $ffd6 $ffd6 $50 writes the value $50 on location $ffd6 but the basic programs always report 26, it's a VICE bug or is normal ?
Someone has another idea to detect a CBM machine from basic ?
Thanks.