Computer detection routine

Started by Naquaada, March 27, 2008, 06:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Naquaada

Hi guys!

Here's a detection routine that checks for C128, C128 in 64 mode, real C64, display mode and Caps Lock status (it's ASCII/DIN on my kb).

10 PRINT CHR$(147):GOSUB 60010
20 PRINT "COMPUTER: ";CP$(1)
30 PRINT" DISPLAY: ";CP$(2)
40 PRINT"CAPS LOCK: "CP$(3)
59999 END

60000 REM *** SYSTEM DETECTION ***
60010 CP$(1)="C64":CP$(2)="40 CHARS":CP$(3)="OFF"
60020 CP=PEEK(65534):IF CP=23 THEN CP$(1)="C128":GOTO 60060
60030 POKE53296,204:IF PEEK(53296)=252 THEN PRINT"C128 IN 64 MODE"
60040 CP$(3)="UNKNOWN":IF CP$(1)="C64" THEN CP$(3)="N/A"
60050 RETURN
60060 IFPEEK(215)=128 THEN CP$(2)="80 CHARS"
60070 IFPEEK(211) AND 16 = 16 THEN CPS$(3)="ON"
60080 RETURN

BTW: Does the Preview function not work in Safari?

BigDumbDinosaur

Quote
60030 POKE53296,204:IF PEEK(53296)=252

That's not a good way to detect whether the machine is running in C-128 or C-64 mode.  If the machine is running as a 128 and happens to be in FAST mode, the POKE will revert the MPU clock to 1 MHz.  Also, you neglected to specify BANK 15 (which would cause a syntax error in C-64 mode).  You can't assume that the correct memory configuration will selected.
x86?  We ain't got no x86.  We don't need no stinking x86!