How to detect if it's BASIC 7.0 and whether it's a C128

Started by Edwing, January 24, 2007, 11:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Edwing

Hello!

Not everybody may know the following ways of detecting:

(A) If it's BASIC 7.0 or something else  and
(B) if it's a C64 or a C128 in C64 mode - which both would lead to the same answer in (A).

I hope the following example program will demonstrate my favourite technique in an entertaining way:

10 ?"{SHIFT-HOME}{CTRL-N}":p=peek(53296):f=fre(.)=fre(1)
20 if p=255 then print"This is running on a C64.":?"Fair enough...":end
25 if f and ((p and 252)=.) then print"This is running on some unknown machine...":end
30 print"{CTRL-O}Cool, a C128!"
40 print"{down}And it's running in ";:if f then print"C64";:go to 60
50 print"native and ";:if p=253 then print"fast";:else print"slow";
60 print" mode."

Note: $D030 is always $FF on a real C64. It is $FC on a C128 in slow mode (regardless of C64 or C128 mode) and $FD in fast mode.

$FE would mean slow mode with VIC display on hold, $FF same for fast mode - that way the computer runs even a bit faster but it screws up system timing. Turning this bit on in direct mode will crash the computer... Dooing it under program control will give a grey screen ... some say it can be used for producing a 60 Hz output on PAL machines and/or a monochrome VIC display. (There was an article about this in a German magazine, if anyone's interested I can try to look that up...)
 
Greetings,
George :)