Launching 64 programs from a 128

How to launch a C64 program from a C128 in 128 mode:

100 REM MODE SELECT PROGRAM
120 REM VERSION 1.0
130 REM VARIABLES
140 M = ABS (PEEK(65533)=255)

Location 65533 will return a unique value depending on the mode / machine which is running.

  • 252 will be returned if in 64 mode
  • 255 will be returned if in 128 mode

Using the ABS function allows us to make the variable M equal to either 0 or 1, based on whether the statements enclosed in parenthesis after the ABS are true or not. Thus, if location 65533 holds a value of 255, M becomes 1. If some other value is found, M becomes 0.

150 IF M = 1 THEN 200
160 IF M = 0 THEN 300
170 PRINT "MACHINE TYPE UNKNOWN" 
180 END
200 PRINT "YOU ARE USING A COMMODORE 128"
210 END
300 PRINT "YOU ARE USING A COMMODORE 64"
310 END
This entry was posted in BASIC, Commodore, Programming, Software. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *