If you are experiencing issues with loading or running programs from USB on THEC64, try the following tips.
Your program isn’t loading on THEC64 or THEC64 Mini. It either doesn’t load at all or only partially loads before stopping or failing.
- Turn off the ‘Fast loader’ option in Media access or File loader by pressing button C on THEC64 Joystick. Now try loading your file again
- For d64 and g64 virtual disk files only, try adding an AD flag to the filename (see CHAPTER 8 in THEC64 User Manual, or see here for THEC64 Mini). This enables accurate disk mode, at the expense of longer loading times. Try loading your file again
- For any type of virtual disk file, try adding an RO flag to the filename (see CHAPTER 8 in THEC64 User Manual, or see here for THEC64 Mini). This enables read-only mode, which prevents any files from writing back to the virtual disk file. Try loading your file again
- Some programs will only load on a PAL or an NTSC computer model. Add a TN (for NTSC) or TP (for PAL) flag to your filename (see CHAPTER 8 in THEC64 User Manual, or see here for THEC64 Mini). Now try loading again.
- The program file is faulty, corrupt, incomplete, etc. Some programs could have been altered from the original and no longer operate correctly. Source a different version
Remember that you might have to combine various permutations of tips #1 – 4 in order to get your program to load, e.g. _ADROTP, or _ADTN, etc.
Your program loads, but it isn’t appears as though it is running incorrectly. This could appear as visual problems, audible issues or non-responsive controllers.
1. The joystick or controller isn’t responding.
Try specifying a different joystick port, as follows:
1.1 THEC64 range defaults to using joystick port 2 (for the C64 computer). Add the J1 flag to the filename and load the program again to try port 1 instead
1.2 The VIC 20 only had one joystick port, so there is no need to specify a joystick port via filename flags on the full-size THEC64. The VIC 20 program might not use a joystick at all (although you can map key presses to the joystick and therefore use one if you create a cjm file instead)
Note that if you use cjm files, then you have to include an entry for the joystick(s) for the program else joystick control won’t be available.
2. The screen is flickering or is showing jerky scrolling.
The program is most likely expecting to be run on a different computer model. Add either a TN (for NTSC) or TP (for PAL) flag to the filename and try loading your file again
3. The music sounds wrong.
Some programs run fine on either an NTSC or a PAL computer model, but the music was usually written with one or other specific video frequency in mind (50Hz for a PAL computer or 60Hz for an NTSC). Many programs don’t account for this difference, and so music intended for an NTSC model plays slower on an original PAL C64 at 50Hz, and music intended for a PAL model plays faster on an original NTSC C64 at 60Hz. The pitch of the music is also affected by this speed difference. If you only ever experienced a program running at 50Hz on a C64 computer for example, then you wouldn’t necessarily know that the music was actually running at a different speed (slower) than it was meant to.
Unlike the original PAL and NTSC C64 computers that output video at a fixed 50Hz and 60Hz respectively, the full-size THEC64 will run both PAL and NTSC models at either 50Hz or 60Hz, depending on the capability of your HD TV and which Video output setting you choose. It is the 50Hz or 60Hz setting that affects the speed of the music rather than the chosen PAL or NTSC computer model, as you might otherwise expect.
|HDMI Video output||Computer model||Program version||Music speed||Music pitch||Auto audio scaling|
As the table shows, running a specifically written PAL version of a program on an NTSC C64, or a specifically written NTSC version of a program on a PAL C64, will affect the pitch of the music. This is exactly the same as would happen on the original C64 computers.
Because THEC64 can run a C64 computer model at a video output rate that is impossible on an original C64, THEC64 applies an automatic correction to the music, called audio scaling. Without doing so, music would sound higher when running a PAL computer model at 60Hz output and lower when running an NTSC model at 50Hz (this is THEC64 Auto audio scaling shown in the final column of the table). This correction is unable to adjust the pitch of sampled audio playback and will therefore make SID (generated) audio out of tune with the sampled audio. For this reason, audio scaling can be disabled by adding an NS flag to the filename.
For the best experience, you should initialise THEC64 to match the video output native for your region. This means that if you reside in North America or owned an NTSC C64, you should select the 60Hz video output setting. If you reside outside of North America or owned a PAL C64, then you should select the 50Hz video output setting instead. Note that not all HD TVs are capable of displaying at 50Hz, in which case THEC64 will default to 60Hz and not give you the option to change to 50Hz.
If you think you have selected the wrong video output rate, you can re-initialise your THE64 by holding down the power button until you see THEC64 logo. THEC64 will then guide you through the initialisation process again. You can also perform a factory-reset via THEC64’s screens, but that will delete all of your saved games as part of the process.
4. Graphics or info in the top or bottom border is not in view at all, or is partially off the screen.
Precise up-scaling from the original screen resolution of the C64 or VIC 20 to modern HD standards means that the borders don’t quite fit into the 720p HD display. If your program needs either the top of bottom border, then use a cjm file to vertically shift the display up or down a certain number of display lines. Alternatively, sacrifice the precise up-scaling and squeeze both borders into the 720p displayed image by adding the FH flag to the filename (see CHAPTER 8 in THEC64 User Manual, or see here for THEC64 Mini). Now load your program again.
Firmware upgrades for THEC64 provide new features and/or correct any technical issues. We always recommend that you upgrade to the latest version of the firmware.
Ensure that your USB memory stick is formatted using FAT32 (with MBR), else your upgrade file will not be detected. See the FAQ for further details.
Visit here for the firmware upgrade details page for THEC64 Mini.
Version 1.3.2 – Changes
- Increases the length of displayed USB filenames in Media Access and the File loader
- Fixes an issue where filename flags are not detected if the USB filename contains multiple dots/periods/full stops
- Fixes an issue with the saved states location where multiple spaces are found in the USB filename
- Fixes the saved states location used on a USB stick to be unique per filename. Note that this may change the saved states location from previous firmware versions if the filename contains multiple dots/periods/full stops.
Previous changes included in version 1.3.2
- v1.3.1 – Fixes an issue when using Left Shift key and top-left arrow key for opening/closing THEC64 Menu from BASIC
- v1.3.1 – Fixes an issue regarding the current computer model setting and different model requirements specified in a cjm file
How to Upgrade THEC64
- In Classic mode, press MENU, select Options > Device settings > System information
- In Carousel mode, select Device settings (spanner icon) > System information
- Look for the Build version (e.g. theC64-1.3.0-amora)
- Check that the latest version linked to above is greater than the version installed on your device
- Download and save the file (e.g. theC64-1_4_0.bin) to your USB memory stick. Don’t place the file inside a folder on the stick or rename the file. If you do, THEC64 won’t find the upgrade
- Insert the USB memory stick into an unoccupied USB port on THEC64
- Press MENU and choose Device settings> System information from the menu
- The upgrade file is detected and you are asked to Close or Apply
- If you choose not to upgrade at this time, select Close and press FIRE, or just press the MENU button on the joystick If you Apply the upgrade, the following screen will appear showing the upgrade process:
After a successful upgrade, THEC64 will restart automatically.
You can check the firmware version afterwards by following point (1) above.
Note that you cannot install a firmware earlier than the build version currently installed.
If the default settings on THEC64 device aren’t suitable for your chosen program running from your USB stick, then customise how it loads using one of two methods:
- Add specific flags to the filename, or
- Create a cjm text configuration file (for each program file, or a default file for all compatible files in the same path)
Either method passes information to THEC64 device to load and run the program from the USB stick. Note that only a cjm text file can remap joystick functions.
Unless otherwise stated, these instructions apply to the File loader and the Media access functionality (the latter is only available on the full-size THEC64).
Add filename flags to each file
By adding flags to the end of the filename, you define which joystick port(s) are used, specify the machine type (PAL or NTSC), set a disk to be read-only, turn on accurate disk loading (for troublesome disk image files that won’t load quickly), disable the on-screen disk icon during drive access, and much more.
For example, the program on a virtual disk file called ‘c64-disk.d64’ requires a joystick connected to port 1 on the original C64 computer, rather than the more common port 2. Rename your d64 file ‘c64-disk_J1.d64’.
Below is a list of all the available flags:
|J1||This sets the primary joystick port as port 1. With a second Joystick connected, it automatically uses port 2. For VIC 20 programs (THEC64 only), this is the default and any port 2 settings are ignored.|
|J2||This sets the primary joystick port as port 2. With a second Joystick connected, it automatically uses port 1. Note that port 2 is the default for C64 computers, so it doesn’t *have* to be specified by this flag|
|AD||This flag turns ‘accurate disk drive’ mode on (for original slower but more accurate disk loading) and turns off the fast disk access mode, which is on by default|
|RO||This makes the disk file read-only (which prevents THEC64 device writing back to the disk file)|
|NI||This flag disables the drive icon from appearing on-screen during disk loading|
|TN||This runs the program on an NTSC computer. It doesn’t affect the HDMI output|
|TP||This runs the program on a PAL computer. It doesn’t affect the HDMI output|
|FH||This forces the entire display – including top and bottom borders – into the 720p output image, sacrificing the accurate display but showing everything (Firmware 1.3.1+)|
|NS||This disables audio scaling, which automatically compensates for the adjustments in pitch of generated (rather than sampled) audio when running a computer at different refresh rates (Firmware 1.3.1+)|
|M6||This instructs THEC64 to use a C64 computer. This is only used by the full-size THEC64|
|MV||This instructs THEC64 to use a VIC 20 computer. This is only used by the full-size THEC64|
Add flags to the end of the filename in any order. For example:
Introducing cjm files
The alternative to filename flags are cjm files, which have the additional benefit of being able to change controller buttons so you can map specified key presses to specific buttons. THEC64 device always uses a cjm file in preference to any filename flags or default settings.
THEC64 device will apply settings in the following order:
- If a cjm file is present for the program being loaded from a USB stick, its settings are applied;
- Otherwise, if a default cjm file is present in the folder containing the program (or one of its parent folders) then those settings are applied;
- Otherwise, any filename flags present at the end of the program filename are applied as settings;
- Otherwise, the default THEC64 device settings are applied to the program.
Creating a cjm file
Using a computer that can create new files, create a text file on the USB memory stick that includes joystick port requirements, machine type (PAL or NTSC) settings, accurate disk loading options, additional joystick button mappings and other settings.
You can use the standard text editors that come with Windows, Linux and Mac OS to create CJM files. Ensure that your file does end with a .cjm file extension, otherwise it will not be recognised by THEC64 Mini. For those who are interested, the files needs to be UTF-8 or ASCII encoded and must not contain any non-standard characters.
A cjm file for each virtual file
Save the cjm text file in the same folder as the program file on your USB stick. For example, ‘c64-disk.d64’ has a corresponding file ‘c64-disk.cjm’.
A cjm file that applies to multiple files
If you name the cjm file ‘thec64-default.cjm‘ then the settings contained within that file apply to every virtual file stored in the same directory (or any programs stored inside any child (sub) folders) on your USB stick, unless it has its own cjm file.
An example CJM file looks like this:
As you can see from the example given, each line in a cjm text file complies with the following:
type: value [,value]
|Entity name||Entity type||Values|
The X entity sets the parameters needed to configure the computer before it loads and runs the program.
The values are case sensitive and must be in lower case.
pal – This makes the program behave as though running on a European (PAL) C64. It doesn’t affect the HDMI output of THEC64 Mini.
ntsc – This makes the program behave as though running on a North American (NTSC) C64. It doesn’t affect the HDMI output of THEC64 or THEC64 Mini.
driveicon – This activates the on-screen drive icon, to show when a virtual disk is accessed.
readonly – This makes a disk read-only, meaning THEC64 Mini cannot write back to the disk.
accuratedisk – This switches ON accurate (slower) disk drive functionality, necessary for some programs to load correctly. This is off by default.
fullheight – This outputs the full height of the computer display when running the program, sacrificing the accurately scaled display to fit everything (including the top and bottom borders) into the 720p image
noaudioscale – This turns off the Audio scaling option, which is enabled by default.
|Entity name||Entity type||Values|
|Vertical display shift||V||-15 to +17 (C64)|
This number moves the screen position up or down over the stated range of display lines (pal). This is useful if a game has graphics that appear in the top or bottom border, as an HDMI 720p television screen can otherwise clip them. For ntsc programs, going above +7 or +8 could exhibit display problems at the bottom of the screen.
|Entity name||Entity type||Values|
|Joystick configuration||J||See following table for allowed values|
Note that the entity type is always a capital letter rather than lower case, e.g. an X rather than an x, otherwise THEC64 or THEC64 Mini will ignore the entity type and the values associated with it in the CJM file.
Joystick configuration consists of 13 values that define how the joystick is to operate in the program.
The first value (after the J: entity) defines the primary port (1 or 2, with primary indicated by an *), followed by what happens when the joystick is pushed UP, DOWN, LEFT or RIGHT. The next two values define what happens when the LEFT FIRE and RIGHT FIRE buttons are pressed. The next two values define what happens when the TL and TR triangle buttons are pressed. The next value is a shoulder trigger button (not available on THEC64 Joystick) but is usually assigned as a FIRE button. The next three values are buttons A, B and C on THEC64 Joystick. The following value is another shoulder trigger button not available on THEC64 Joystick, but again is usually assigned as FIRE. The final two values (only used in firmware 1.3.0 or above on either THEC64 device) are for controllers with two sticks that can also be pressed as a button. For example:
In the shown example, the joystick is behaving as if connected to port 2 on the original C64 computer. Moving up, down, left and right using the stick is as you would expect. Both FIRE buttons perform the same joystick fire (JF) function. Pressing TL on the joystick is the same as pressing the 1 key. Pressing TR is the same as pressing the 2 key, and buttons A, B and C do the same job as pressing keys A, B and C respectively. If using an alternative controller, pressing either shoulder trigger will FIRE, and pressing on either stick on some controllers will produce key press 3 and 4 respectively.
Joystick parameters are the port assignments first, then the joystick standard functions, then the button mapping:
|Joystick to key map ID||Description|
|JU JD JL JR JF||Joystick directions Up, Down, Left, Right and Fire|
|F1 F2 F3 F4 F5 F6 F7 F8||C64 function keys F1 to F8|
Assigning letters and numbers to joystick buttons is easy. For example, to assign pressing key A to a Joystick button, just enter A in the CJM data for the relevant button.
In all of the games provided with THEC64 and THEC64 Mini, the LEFT and RIGHT joystick FIRE buttons have the same function (JF) so both left and right-handed players can use either button as FIRE. However, the LEFT and RIGHT joystick FIRE buttons are independent, so you can assign one FIRE button to JF and the other to a different function if you wish in your CJM files.
In addition, for consistency all of the games on the GAMES CAROUSEL start by pressing TL or by pressing a FIRE button. If you wish to retain this logic, keep in mind how your program starts once it has finished loading when you assign joystick buttons in the CJM file. If FIRE does not start the program, then assign the appropriate key press to the TL button.
Download the Quick Guide or the main User Manual for the full-size THEC64 from this page.
Please only print these documents if you have to and if you do, please consider printing on paper that can be recycled. Thank you.
We recommend you ensure that your THEC64 is always running the latest up-to-date firmware.
THEC64 – Quick Guide
This is the Quick Guide, which is included in THEC64 box. This manual is intended to get THEC64 up and running. For full instructions, download THEC64 User Manual (below).
THEC64 – User Manual
This is the User Manual for THEC64, with full details on how to use all of the functionality, including VIC 20 mode and Media access.
For Warranty information, please visit the warranty page.
For firmware 1.2.0+ on THEC64 Mini or THEC64
Please read the guidance on using the File Loader (or read CHAPTER 8 of THEC64 User Manual for details regarding Media access on THEC64) before you read the following these additional instructions for enhancements to the use of CJM files.
Your THEC64 device allows you to override the default settings applied to a USB program through either filename flags, or a C64 Joystick Map (CJM) file. Starting with firmware 1.2.0 and above, you can provide default settings for all files within a folder. This is particularly useful if you have multiple files that you wish to apply the same settings for.
Creating a default configuration for a folder
To configure programs within a folder, you create a CJM file in exactly the same way you would if you were configuring an individual program, and place it in the folder with the special filename THEC64-default.cjm
If present, THEC64 device will use this CJM configuration whenever there is no file-specific CJM file for the program being loaded.
An important and useful point to note is that THEC64 device will apply the settings supplied by a thec64-default.cjm file to all programs within the folder in which it is placed, even if the programs are in sub-folders.
How THEC64 device applies settings
THEC64 device will apply settings in the following order:
1. If a CJM file is present for the program being loaded from a USB stick, its settings are applied;
2. Otherwise, if a default CJM file is present in the folder containing the program (or one of its parent folders) then those settings are applied;
3. Otherwise, any filename flags present at the end of the program filename are applied as settings;
4. Otherwise, the built-in default THEC64 device settings are applied to the program.
Structuring your files and folders on the USB stick
The folder level configuration feature works best when your virtual media files (d64, g64, tap, crt, etc.) and folders are arranged in a logical order on the USB memory stick. For example:
The content of the file is the same as you would expect from any other cjm file used by THEC64 device. For example, in the above \pal\j1 folder is thec64-default.cjm:
Every program stored in that folder will run on a PAL C64, and use Joystick port 1 as the primary controller.
If THEC64 device doesn’t find thec64-default.cjm file in the folder, then it comes out of the current folder and looks in the parent folder instead. It continues to behave this way, working its way back up the folder structure until it reaches the root of the USB memory stick.
If it doesn’t find thec64-default.cjm file then it will run the currently selected program file based upon an individually named cjm file, or by filename flags as you would expect. As a last resort it will apply the system default settings, which are joystick 2 as the primary port and either PAL or NTSC (based upon if THEC64 Mini is a European or North American model, respectively OR whatever the Computer model settings are on THEC64).
Note: If you need different settings for each program file (e.g. joystick buttons, vertical shift and so on), then use the standard cjm method, naming the cjm file after the individual C64 program file rather than using this alternative default method.
A number of useful C64-related web sites are listed below as web links. Start becoming creative using THEC64 Mini!
Although we do periodically check that the web sites listed below are legal, honest, decent and truthful, Retro Games Ltd cannot take responsibility for any pages maintained by third parties that are linked to from here.
Any views expressed by the content providers on the third party web sites listed above are not necessarily those of Retro Games Ltd.
CBM prg Studio is a Windows Integrated Development Environment (IDE) which allows you to type a BASIC or machine code program and convert it to a ‘.prg’ file (as used by THEC64 Mini, an original C64 and a number of other programs). It also includes character, sprite and screen editors and a fully featured 6510/65816 debugger…
The easiest way to start programming Commodore 64. Life is too short to read twenty-year-old books. Learn BASIC and 6502 Assembly with bite-sized video tutorials today!
RetroGameDev has been created to produce books, tutorials, and support for the retro game development community.
Growing fan group for THEC64 Mini console.
Join the new fan-run forum for THEC64 Mini.
Programming Guide for Video Gamers (Thanks for the suggestion, Dylan!)
Learn about traditional games development, learn to program and discover how to get a career in games.
Auto-load programs from a USB memory stick using the File Loader function.
Instructions for THEC64 Mini and THEC64 (Carousel mode)
Please note that these instructions always assume that the latest available firmware is installed on THEC64 Mini or THEC64. For the purpose of these instructions, THEC64 Mini and THEC64 are referred to as ‘THEC64 device’.
Using the File Loader function and a FAT32 (with MBR) formatted USB memory stick, THEC64 device can auto-load programs from various virtual file formats. Supported formats include:
Disk files: D64, G64, D81, D82
Tape files: T64, TAP
Cartridge files: CRT
Stand-alone program files: PRG, P00
To make file browsing and selection less arduous, the File Loader has a display limit of 256 files and/or folders per-folder, including the root of the memory stick.
In the absence of customised file loading by using flags in filenames or CJM text configuration files, THEC64 device applies default settings to any supported files found on a USB memory stick:
- The ‘Fast loader’ option speeds up loading times for programs that use the C64’s standard loading routines (tape or disk). Disable the option by pressing button C on the joystick before loading
- The ‘Faster disk access’ option specifically loads .d64 virtual disk files faster, but some programs or file types won’t load unless this functionality is disabled by using the slower but more authentic accurate drive mode. See Filename flags and CJM files for further information
- The primary joystick is set to port 2. The secondary joystick is set to port 1 only if a second joystick is connected before loading the program from USB. For VIC 20 programs (THEC64 only), port 1 is the default and port 2 is not available
- The type of computer chosen to load the program is based on whether THEC64 Mini firmware is North American (an NTSC C64 is chosen) and running at 60hz or European (a PAL C64 is chosen), running at 50Hz. On the full-size THEC64, it is based upon the Video output setting (60Hz or 50Hz) and what type of computer is current set as the default. Note that this does not affect the HDMI output
- No program-specific functions map to the joystick buttons other than the standard directions and the FIRE and MENU buttons
Many programs auto-load fine using the above default settings. If your program does not, or you wish to change the configuration, please see Filename flags and CJM files.
The full-size THEC64 users can alternatively use Media access in Classic mode to load these files, but the types of file and the default settings are the same, whether using File loader or Media access. See THEC64 User Manual for full details.
Using the File Loader
Whilst viewing the GAMES CAROUSEL, insert a USB memory stick that contains supported C64 files into an available USB port. After a few seconds, an icon appears beneath the GAMES CAROUSEL to confirm the USB memory stick is connected.
Highlight the USB icon and press FIRE. The FILE LOADER screen lists any supported files and folders stored in the root of the USB memory stick. Note that file extensions (for example, D64, TAP, CRT), flags added to filenames (for example _TP) and CJM files (for example, c64-disk.cjm) are NOT shown in the list on the File Loader screen.
Highlight a file and press FIRE. The selected file auto-loads and runs. How long it takes to load will vary based upon the type of file and the settings used to load it.
To browse folders, move the highlight over a folder and press FIRE. The contents of the sub-folder appear. A folder that is empty or does not contain any other folders or supported C64 files will display ‘No files found’.
When inside a folder on the USB memory stick, press button A on the joystick to move out of the current folder. Alternatively, push LEFT to come out of a folder when on the far left side of the File Loader list.
The C64 Fast Loader is on by default, speeding up loading times for any programs that use the computer’s internal loading routine. For those programs that do not load if the fast loader is on, press button C on the joystick (a red X appears over the Fast Loader icon) before you press FIRE to load. This turns the Fast loader off.
Note that the faster disk access function remains on unless you specifically turn it off via filename flags or a CJM file. See Filename flags and CJM files for full details.
Save/Load from USB
When loading a program file from a USB memory stick, the Save/Load state function saves and loads on the USB memory stick rather than on THEC64 device. You have four slots to save to per program.
Save files are stored inside a folder on the USB memory stick called .THEC64SAVE. Inside that folder are sub-folders that contain your saves. For example, .THEC64SAVES\c64-disk\ contains saved files for a virtual disk file called ‘c64-disk’.
BASIC and accessing a USB memory stick
Please note that the only file stored on a USB stick that can be loaded directly when running BASIC on THEC64 Mini is a disk image with the filename THEC64-drive8.d64. Please visit programming-in-c64-basic and faq for further details on BASIC and THEC64-drive8.d64 file.
Learn how to program using C64 BASIC, available on THEC64 Mini and THEC64.
The GAMES CAROUSEL on THEC64 Mini gives you access to the BASIC programming language. On the full-size THEC64, boot or switch to Classic mode to access BASIC.
If you want to follow through the BASIC examples, we strongly recommend connecting a USB keyboard to THEC64 Mini, rather than trying to use the Virtual Keyboard. Please read CHAPTER 6: KEYBOARDS In the User Guide PDF for THEC64 Mini before starting this introduction to BASIC.
Use the provided keyboard if accessing BASIC from Classic mode on the full-size THEC64.
If a compatible USB memory stick (formatted to FAT32) is attached to the full-size THEC64 or to THEC64 Mini, then you can save your BASIC code to the memory stick. For the USB stick to be detected on THEC64 Mini, attach it before BASIC is launched. Also see Saving and Loading below for further information.
Without a USB stick, you save to one of the four available save slots for BASIC on THEC64 Mini or THEC64 itself.
WHAT IS BASIC?
When you power-on a C64 computer, the first thing you see is BASIC. We provide access to BASIC for those who wish to experience programming using version 2 of the C64 variant of the Beginners All-purpose Symbolic Instruction Code.
BASIC is a high-level programming language, designed to be easy to use. It is an interpreted language, meaning any BASIC instructions you type have to be translated by the computer before it can run them. This actually happens quite quickly and is done invisibly and automatically by the computer.
Computers like natively ‘talk’ in machine code, which is a series of zeros (0) and ones (1). When they use machine code, they operate very fast. However, people don’t directly program in machine code, so we use a different way to send instructions to the computer, using programming languages that are closer to what we are used to.
Some programming languages are a few steps closer to machine code, and so they are interpreted (or translated if you prefer) quicker than those that aren’t.
BASIC has always been an excellent introduction to programming for complete beginners even though it is quite a few steps away from machine code.
Learning to program using C64 BASIC helps you think programatically, and it also teaches you how to type on a keyboard. Both of these skills are important to learn.
C64 BASIC has a series of keywords that tell the computer what to do next. Learn those and you will be writing BASIC code in no time at all. There are 71 BASIC keywords to discover.
If you think 71 sounds a lot, don’t worry. You don’t have to learn them all at once. Many of them are related to doing mathematical calculations, and only come into play when you start doing more complex coding. More on keywords later!
LAUNCHING C64 BASIC
When you first launch BASIC on a C64, you see a blue screen. It begins by revealing how much computer memory is available for programming. Underneath that information is a READY prompt and underneath that is a steadily blinking square cursor.
Staring at the cursor won’t get you very far. It’s ready and waiting for you to enter your first BASIC commands.
There are two ways of entering BASIC code. You can type it in and press RETURN. The computer will immediately try and run your code. However, to repeat the same code later on, you have to type it in again. That’s not so good. The second method is a lot more efficient. You place numbers at the start of each line of your code that tells the computer in which order to run them. The great thing is that using line numbers also means it won’t run your code until you type the RUN keyword *and* it means you don’t have to type it all in again (as long as you don’t turn off the computer).
YOUR FIRST BASIC PROGRAM
Below is an example BASIC program. We will look at each line of code in turn before doing this for real.
There are three separate lines of BASIC code to explain.
10 PRINT “RETRO GAMES LIMITED”
20 PRINT “HELLO WORLD!”
30 GOTO 10
Line 10 uses the keyword PRINT which sends whatever appears between the quotation marks “” to the computer screen (and not to a printer as you might expect!).
Line 20 does the same as line 10 but will send different words to the screen.
Line 30 instructs the computer to go to line 10, which places the computer in a loop of running line 10, then line 20, then line 30 telling it to go back to line 10 again and so on.
The line numbers are in units of ten just in case we want to insert extra lines of code, e.g. a line 15 that comes between line 10 and line 20. If you type a line of code that begins with the same line number as an existing line, the new line will replace the old one as soon as you press RETURN, without any warnings. If you type just the line number and nothing else then press RETURN, you delete that line number.
Now type each line exactly as you see it (above). Press RETURN at the end of each numbered line to commit that line to the computer’s memory and to move down a line, before starting to type the next one.
Press RETURN at the end of line 30.
If you make a mistake, use the Backspace key on your USB keyboard (or press the C button on the joystick when using the Virtual keyboard). Each press will erase the character immediately to the left of the cursor’s position on the screen.
If you’re happy that you’ve typed everything in correctly, type the RUN keyword (without a line number). Your code will then run!
If you’re wondering how to stop your new BASIC code from running forever, try pressing ESC (on a USB keyboard attached to THEC64 Mini) or RUN/STOP (if using the virtual keyboard or the full-size THEC64 keyboard). You have instructed the computer to BREAK into your code. Don’t worry – it’s not as bad as it sounds!
To see your code is still intact, you can type the following keyword at the square cursor:
Your three lines of code are displayed, safe and sound just as they were the last time you saw them.
Believe it or not, you’ve already used four BASIC keywords. To prove it, here is a table showing all 71 of them.
We’re now going to slightly change your code so that it only prints the two lines of text five times before stopping, rather than going on forever.
5 FOR A=1 TO 5
10 PRINT “RETRO GAMES LIMITED”
20 PRINT “HELLO WORLD!”
30 NEXT A
You should immediately notice that we have added a line number 5 and we have changed what was on line 30.
Look at these two new lines of code for a moment and ignore lines 10 and 20 in-between. These lines introduce two new concepts to your BASIC knowledge as well as two new keywords.
One concept is defining and using variables in your code. In this example, we are using ‘A’ as a container to temporarily store a number inside. The letter A was chosen but it could easily have been the word ‘WORLD’, so it could have read…
5 FOR WORLD=1 TO 5
10 PRINT “RETRO GAMES LIMITED”
20 PRINT “HELLO WORLD!”
30 NEXT WORLD
… and your program would still have worked. You could also have changed the number at the end of your line of code from 5 to 6, for example. Variable names are chosen by you and can (almost) be anything you like. However, there are rules to naming these handy variables for storing things in.
You can’t use reserved keywords used by BASIC or by the C64 for its own system variables. How do you know which ones can’t be used? Well, if you had used LIST as your variable name, running the program would have produced:
?SYNTAX ERROR IN 5
It’s not the most helpful of errors, but if the computer returns that error, you know something is wrong. Remember that index of C64 BASIC keywords? Don’t use any of those as names for your variables and you can’t go far wrong.
Try to keep your variable names short, but relevant where you can. If your code isn’t overly complex, then you can just use A, B, C and so on, just as long as you remember what they are used for!
Types of Variable
The only other thing to know is that there are three types of variable, and they are defined by what type of information is stored in them.
The two most common that you will use are integer and string variables.
An integer is simply a whole number, so no fractions or decimal points. A string is letters or letters and numbers.
How do you say which type of variable you want to use? For integers, you just use a name for your variable, without anything else, e.g. WORLD. For strings, you add a $ to the end of the variable name, so RECIPE$ might be used to store the name of your favourite cake or biscuit recipe, e.g. “Rocky Road”.
So, looking at your amended BASIC example, we know that ‘A’ is used to store a whole number (which can actually be between -32768 up to 32767). In our example, it is only going to reach a maximum value of 5.
Now let’s discuss the FOR and NEXT keywords. These are paired together and create a FOR… NEXT loop. What this does is from the FOR keyword, the computer stores a number inside ‘A’ that starts at 1 and will end at 5 (in this particular example).
Each time the running code encounters the NEXT ‘variable’ (NEXT A in our example), it returns to the line with the FOR keyword and increments (adds one to) the current number stored in the variable called ‘A’. The code then runs each line of code it comes across afterwards (i.e. line 10 and line 20) until it hits NEXT A again, then it returns to the FOR keyword and repeats the process until the value of ‘A’ equals 5, then it stops.
So, add in line 5 exactly as shown previously, change line 30, and then RUN the amended code and see what happens.
Now, it would be useful to show what the current value of ‘A’ is. Add a new line 25:
25 Print A
Now RUN your code again.
You can now see the two lines of printed text are followed by a number that goes up by one each time, e.g. 1, 2, 3, 4, 5.
It’s useful to see the value stored in variable ‘A’ as you can now see how it changes within that FOR… NEXT loop, adding one automatically whenever it reaches NEXT.
Let’s now make this look a little better by adding something to line 25.
25 PRINT “VARIABLE ‘A’ IS NOW“;A
The semi-colon at the end tells BASIC to keep the cursor on the same line as the text it is printing to the screen, and then display the value of the variable A.
RUN this latest version of your code.
That’s a little better. It’s clear now what those numbers mean and we’ve learned how to place the value of a variable into a PRINT command at the same time!
That almost concludes the introduction to C64 BASIC. However, before we finish, let’s learn how you can keep (save) your code so it can be run and amended in future.
Saving and Loading
You have a few available methods for saving your BASIC programs, with some of them depending on which product you are using.
Press the MENU button and select ‘Save/Load game’ and then save to an available slot as you would do for a game or program. BASIC has four available slots in the same way that any of the games on the carousel do.
If a compatible USB memory stick (formatted to FAT32 and using MBR) is attached whilst you are using BASIC, then you can save your program to a virtual disk stored on the USB stick:
You can save your BASIC code to a virtual disk file on the USB memory stick if have inserted the USB stick before BASIC is launched from the carousel. When launching BASIC, THEC64 Mini looks for a specific disk image file on the memory stick. If the file isn’t found, then THEC64-drive8.d64 file is automatically created on the USB memory stick for you. You will then be able to save and load to and from this file from BASIC.
Please note that on THEC64 Mini, to accommodate THEC64 Joystick, a USB Keyboard and a USB memory stick at the same time, you need to connect a separate powered USB hub (not supplied) which gives access to additional USB ports. Retro Games Ltd cannot guarantee that all USB hubs will work with THEC64 Mini.
The commands to save to the virtual disk are shown below.
As on THEC64 Mini, THEC64-drive8.d64 virtual disk file is automatically created on the connected USB stick if it is not found in the root of the stick. However, unlike on the Mini, you can choose to insert another disk image from the USB stick and save to that instead if you prefer. Just press the MENU button when in BASIC, select ‘Media access’ and then browse and insert the disk of your choice by pressing FIRE.
Now follow the instructions for using the save command as explained below.
With a compatible USB memory stick connected, you can save to the virtual disk file using the standard SAVE to disk command, e.g.
The name of the file goes between the speech marks and it can be whatever you like, as long as it isn’t longer than 15 characters. In this example, it’s nice and short. The number 8 after the filename is a device ID number for the virtual disk drive that uses your virtual disk file stored on your USB memory stick.
Press RETURN afterwards to begin the save.
BASIC will report ‘SAVING’ followed by your chosen filename, and when it is completed, it returns to the READY prompt and the square cursor.
To save over an existing file with the same filename, add @0: to the front, like this:
Please be aware that C64 BASIC won’t give any warnings that you are over-writing the file when you do this.
You can check that the save worked by using the VERIFY keyword.
If everything is okay, you will see VERIFYING followed by OK. What it does it compare the saved file with what is currently in the computer’s memory. If you have changed your BASIC program in any way since you saved, then VERIFY will fail.
Another time, ensure that the same USB storage device is connected as before, and then type the following command in BASIC to get your program back.
What’s on my disk?
From BASIC, you can look at a disk and see what files are on there. To do that requires use of the LOAD command, but in a slightly different way from before. Instead of typing a filename we are using the reserved variable $.
BASIC will report SEARCHING FOR $ followed by LOADING and then it returns to the READY prompt once again.
To see what’s on the disk is simple. Just type the following command:
Instead of listing BASIC code, this time the command shows what is on the disk.
In the above example, we have just one program on the disk and it’s the program we just saved called RGL. The program uses up 1 block on the disk and there are 663 blocks still free to save programs to in the future.
Be aware that if you load the directory of a disk and you currently have some BASIC code on the C64, the $ listing will replace the BASIC listing in the computer’s memory and you will lose your program (if you haven’t already saved it).
If you don’t have a USB stick attached, but decide to try saving to device 8 anyway, BASIC will look like it has successfully saved but when you load the directory of the disk it will be empty. This is because without USB storage, BASIC uses a disk image that can only be read, not saved to. The tell-tale sign is the name of the disk, which is READONLY instead of THEC64. The disk is completely empty and cannot have anything saved to it.
To overcome this, you can always save in one of the four save slots, then later on insert a USB memory stick into a spare USB port, return to BASIC, restore the save slot and then save to the virtual disk file using the SAVE command detailed earlier.
Before we finish, how many C64 BASIC commands have you used now?
You’re up to 11/71 commands already! We hope this small introductions has given you an interest to learn more. There are plenty of online resources available. Also, have a look at our Links page.
A video of this quick introductory tutorial (using THEC64 Mini) is also available to watch below.
If THEC64 or THEC64 Mini is not working as expected, there are a number of things to try:
- Ensure that the power supply you are using is sufficient for THEC64 Mini. This needs to be 5V/1A for the items supplied in THEC64 Mini box. When attaching any additional USB devices, a 1.5A or 2A power supply is recommended, as other USB devices may have different power requirements. If THEC64 Mini is under-powered then it is likely to not operate correctly or behave erratically
- Check that you are using the latest firmware for THEC64 or THEC64 Mini.
- Test THEC64 or THEC64 Mini by ensuring that it is connected directly to your TV or Monitor using the provided HDMI lead and is not using any other cables or devices in-between
- If you are using a USB hub on THEC64 Mini, we recommend a powered hub. Also see point 1
- If there is a time delay between performing an action on the joystick and seeing it on the screen, your TV is likely to be applying image processing which can cause a noticeable delay. Switch off all image processing options by consulting your TV manual. Some TVs include a special ‘Game Mode’ that you can also try
- If THEC64 Joystick is not working correctly, try connecting it to a desktop computer and testing it there. THEC64 Joystick works on Windows, Mac and Linux computers
- You can test the USB ports by connecting a USB gamepad/controller, USB keyboard or USB memory stick to each port and test them in turn
- If your USB memory stick isn’t detected, ensure that the USB stick is formatted to FAT32 with MBR (Master Boot Record). If formatting using Windows 10, ensure you perform a full format rather than enable ‘quick format’.
- For loading a D64 file from a USB memory stick when accessing BASIC on THEC64 Mini, the file must be named THEC64-drive8.d64. If you are naming the file using Windows, ensure you can see file extensions otherwise your file might be accidentally named THEC64-drive8.d64.d64 instead (for example). See Loading Programs in C64 BASIC for more information
- If your TV is playing sound from THEC64 Mini but is not displaying the picture, then it is likely to be unable to display the output signal. The North American model displays at 60Hz, whilst the European model displays at 50Hz. Try a different TV or monitor.
- You can also try a Factory reset, which deletes your chosen Language, Display and (on THEC64 Mini) the USB Keyboard settings, along with any stored saved game positions. A factory reset doesn’t remove any saves stored on a USB memory stick. This reset effectively restores THEC64 or THEC64 Mini to its initial factory condition (excluding the current firmware, which remains unaffected).
The crossed-out wheelie bin symbol confirms that your product should not be disposed of with your general household waste, but should be taken to your nearest recycling centre for safe and responsible disposal.
This will help prevent any potential negative impact on the environment and on human health and is in compliance with current EU legislation.
Please contact your local authority or retailer for further recycling advice.
In the first instance, customers should always refer to the following web site, which explains your consumer rights:
The first point of contact in the process should be between you and the retailer.
This warranty includes THEC64, THEC64 Mini and THEC64 Joystick (jointly referred to as ‘the Hardware’), the user interface software (referred to as the ‘UI’) and any original supplied games included with the Hardware at the time of payment/purchase (referred to as ‘the Games’). Collectively, they are referred to as ‘the Product’.
Subject to the terms and exclusions detailed below, Retro Games Ltd warrants to the original consumer purchasing the Product in any country of the European Economic Area or Switzerland (“you”) that, for a period of 24 months from the date of the payment/purchase of the Product by you, the Product will be free from defects in both materials and workmanship.
Please be aware that this warranty does not cover the following:
(a) software (other than the UI) or Games (whether included with the Product at the time of payment/purchase or not);
(b) accessories, peripherals or other items intended for use with the Product that are not manufactured by or for Retro Games Ltd (whether included with the Product at the time of payment/purchase or not);
(c) the Product if it has been resold, or used for rental or commercial purposes;
(d) defects in the Product that are caused by accidental damage, your and/or any third party’s negligence, unreasonable use, modification, use with products or software files not supplied, licensed or authorised for use with the Product by Retro Games Ltd (including, but not limited to, non-licensed game enhancements, copier devices, adapters, power supplies or non-licensed accessories), computer viruses or use of the product otherwise than in accordance with the respective instructions, or any other cause unrelated to defects in material and workmanship;
(e) defects in the Product that are caused by the use of faulty, damaged or inappropriate power supplies or related leads or connectors;
(f) the Product if it has been opened, modified or repaired by any person or company other than Retro Games Ltd or its authorised partners;
(g) loss of any data that has been loaded onto or stored on the Product by any person or company other than Retro Games Ltd or its authorised partners;
(h) loss of data or any other content, such as the UI or the supplied Games, as a result of formatting the memory of the Product.
IF YOU NEED TO MAKE A CLAIM
To make a valid claim under this warranty, you must firstly follow the process as described in the consumer rights article, linked to above. If you are unable to resolve your issue following that process, then you may do the following:
Notify Retro Games Ltd of the steps already taken and the perceived defect in the Product within 24 months of the date of the payment/purchase of the Product by you, and only when instructed to, return the Product to Retro Games Ltd within 30 days of notifying Retro Games Ltd of that defect. To make a claim, please contact us via our website contact form.
Before sending the Product to our customer support (after getting in touch using the contact form), you should remove or delete any private or confidential files or data stored on the Product.
By sending the Product to Retro Games Ltd you accept and agree that Retro Games Ltd will not be responsible for any loss, deletion or corruption of your files or data that has not been deleted or removed.
When sending the Product to Retro Games Ltd Customer Support:
- please use the original packaging supplied where possible;
- please provide a detailed description of the perceived defect;
- please attach a copy of your original proof of payment/purchase from the retailer you purchased the Product from, which indicates the date of payment/purchase of the Product and whom it was purchased from.
If, having inspected the Product, Retro Games Ltd accepts that the Product is defective as described, Retro Games Ltd will (at its sole discretion) either repair or replace the faulty part causing the defect, or replace the relevant element of the Product without charge to you.
If the above 24-month warranty period has already expired at the time the defect is notified to Retro Games Ltd or if the defect is not covered by this warranty, Retro Games Ltd may still be prepared to repair or replace the part causing the defect or replace the relevant element of the Product (at its sole discretion). For further information or, in particular, details of any charges for such services, please contact Retro Games Ltd Customer Support via our website contact form.
This manufacturer’s warranty does not affect any usual statutory rights which you may have under consumer protection legislation as the purchaser of goods. The benefits described here are in addition to those rights.