VS64 - The C64 Development EnvironmentVS64 is an open-source extension for Visual Studio Code. The VS64 extension makes it easy to develop software for the C64 using Visual Studio Code. It provides in-depth support for 6502 assemblers, C and C++ compilers and the BASIC programming language. It comes with a project and build system, compilers and converters for BASIC and resource files, and it integrates well with all the advanced features of Visual Studio Code, such as the task and launch system, debugging and introspection and language grammar and semantics support.
Features and Supported Languages/Toolkits
Quick and Start (TL;DR)Getting StartedThe quickest start is by opening the command palette and run the "VS64: Getting Started" command. If you want to do some manual steps or adjustments, these are the individual things to look at:
Creating Projects QuicklyThe "Create Project" commands are a great tool to configure and re-configure a code project. Whenever such a command is issued, the current workspace will be scanned and a fresh project configuration file will be generated based on the existing source files. Afterwards, everything should be ready to build and run. SetupACME Cross-AssemblerVS64 supports the ACME Cross-Assembler.
In case you did a manual or custom installation, please make sure you updated the VS64 settings with the correct ACME installation path. Kick AssemblerVS64 supports Kick Assembler.
Please make sure you check the VS64 settings for the correct KickAssembler installation path. LLVM-MOS CompilerVS64 also supports the LLVM-MOS C/C++ Compiler.
Please make sure you update the VS64 settings with the correct LLVM-MOS installation and include paths. CC65 CompilerVS64 also supports the CC65 6502 C Compiler.
In case you did a manual or custom installation, please make sure you update the VS64 settings with the correct CC65 installation and include paths. Oscar64 CompilerVS64 also supports the Oscar64 C Compiler.
In case you did a customized installation, please make sure you update the VS64 settings with the correct Oscar65 installation and include paths. BASIC CompilerVS64 supports compiling BASIC source to binary programs.
In order to use the basic compiler, just add your BASIC source files to the "sources" list of the project file. Crunching BASIC CodeThe basic compiler supports crunching of BASIC code:
To enable this feature, just set the build mode in the project file to "release":
Upper/Lower Case Character SetIn order to properly use the different ROM character sets in BASIC programs, remapping of upper/lower case character codes is needed. This can be achieved in two different ways:
Example of properly using the upper/lower case character set in source code:
Example of BASIC compiler flags in the project file instead of the
Raw StringsIn order to use characters without upper/lower case conversion, use single quoted raw strings:
Auto-NumberingThe compiler adds line numbers automatically. In case a basic line does not contain a line number, it uses 'last number + 1'. Whenever static line numbers are given in the source code, automatic counters continue from there. For example:
Will be compiled to:
Use of LabelsIn addition to using line numbers as jump targets, the basic compiler also lets you use labels. Here's one example:
Will be compiled to:
PETSCII Control CharactersThe usage of PETSCII control characters is supported via the extended string control character syntax:
A control token within a string is either a {mnemonic}, {number}, {$hex}, {0xhex}, {%binary} or {0bbinary}.
Resource CompilationVS64 comes with an integrated resource compiler that turns media files into plain source code to be directly referenced by the code and compiled into the binary. Currently, the supported media formats are:
In order to use the resource compiler, just add your resources files to the "sources" list of the project file.
VICE EmulatorIn addition to the internal 6502 cpu emulator, VS64 also supports debugging using the VICE emulator.
In case you did a manual or custom installation, please make sure you update the VS64 settings with the correct VICE executable.
Commander X16 EmulatorVS64 provides launch integration for the Commander X16 emulator.
Please make sure you update the VS64 settings with the correct x16emu executable. General UsageThe VS64 extension provides a convienient editing, build and run environment. This is done by providing syntax highlighting, seamless integration to the task, build and launch system, an embedded 6502 CPU emulator for fast and precise evaluation of 6502 code and integration of the VICE C64 emulator for advanced system debugging. For further analysis, an integrated disassembler and BASIC-decompiler for C64 program files is provided. For details, please look at the provided example projects for ACME, LLVM-MOS, CC65 or BASIC. Build SystemVS64 provides a meta build system which is based on the Ninja build toolkit. Dependency scanning and the generation of intellisense information is supported. Syntax HighlightingSupport for ACME assember syntax is provided. Syntax highlighting for KickAssembler is partially implemented. The recommended file extension is Project ConfigurationThe VS64 extension is mainly controlled and configured using a per-workspace project configuration file The general structure of the file is like this:
A more extensive project file for CC65 using source and resource files could like like this:
A project file for CC65 could like like this:
To specify resource compiler flags and options, add a section
A project file for a BASIC program could look like this:
Example project file to use C++ for the Commander X16:
Project name, also defines the name of the output program file
Project description, for information purposes.
Defines all used source and resource files. The build system will keep track of changes of these files. Resources files will be translated to language-specific to binary data declarations.
Specifies which build toolkit is used. Currently supported are
Specifies the target system which the binaries should be generated for. Default is the C64, possible settings are dependent on the used toolkit.
Can be used instead of 'sources' in simple projects. Defines the main source file which is compiled and used as the entry point for recursive dependency scanning.
Defines either a
Optional project specific compiler defines. The project defines are added to the global defines as specified in the settings.
Optional project include paths for the compiler. The project specific include paths are added and overlay the global include paths specified in the settings.
Optional argument list to be added to the build tool command line arguments. For more fine grained setting, use the 'assemblerFlags', 'compilerFlags' and 'linkerFlags' attributes.
Optional arguments to be added to the assembler command.
Optional arguments to be added to the compiler command.
Optional arguments to be added to the linker command. Example to use a specific linker configuration for cc65:
Overrides the path to the compiler executable. The default path is specified in the settings.
Optional parameters for the resource compiler. Currently, the following list of parameters is supported:
Example:
Optional arguments to be added to the resource compiler command. Use this to force the resource compiler to produce a specific output format, where format can be
Disassembler and BASIC De-CompilerVS64 supports on-the-fly disassembly of .prg files containing either machine code or BASIC programs.
In order to use it, just open a IntelliSense SupportThe VS64 build system supports the IntelliSense editing features of Visual Studio Code. Project settings, include paths and defines are automatically provided to the IntelliSense system. Further information about IntelliSense can be found here. Background CompilationWhenever a referenced source file or the project settings file is modified and saved, it is automatically compiled to a C64 (cbm) If compilation is successful, that program file can either be run/debugged with the embedded debugger based on a defined launch configuration (see Debugger Launch Configuration), or it can be loaded into a VICE emulator session to run an advanced debugging session. If compilation fails, the ACME outputs are shown in the problems view as well as in the output terminal view. DebuggingDebugging FeaturesThe VS64 extension comes with a built-in 6502 CPU emulator that allows very fast edit-build-run cycles. The limitation is important to understand: it is not a full C64 emulation. It executes 6502 machine code as fast as possible - and integrates nicely to the Visual Studio Code debugger interface. But it does not emulate any of the C64 custom chips (the VIC, SID, CIA, etc.). To still run C64 code similar to what would happen on a real C64, the bank switching and handling of ROM memory areas is supported. Also, basic startup behavior is supported in a way that actual C64 program files can be loaded and executed. As another option for debugging, a VICE emulator session can be launched or attached to perform advanced debugging steps in an acurate C64 system emulation. Supported debugging features:
Debugging support for the CC65 toolkit
Debugging support for the LLVM Toolkit (Elf/Dwarf):
Debugging support for the BASIC Toolkit:
Debugger Launch ConfigurationIn order to debug a compiled C64 program (
Can be either "6502" to run the integrated 6502 cpu emulator, "vice" to run a VICE emulator based debugging session or "x16" to launch the Commander X16 emulator.
Use "launch" here to run a new emulation session. In case "vice" is selected as debugger type, then a new VICE process is started.
Use "attach" to attach to a running VICE process. VICE needs to have the binary monitor interface enabled, or has to be started with the
Any name you want to use is fine.
Optional name of host running a VICE emulator with enabled binary monitor. If not specified, 'localhost' will be used.
Optional port number of running a VICE emulator with enabled binary monitor. If not specified, the binary monitor default port '6502' will be used.
A 16-bit address in decimal or $hexadecimal form.
Optional task name, can be Debugger Watch ExpressionsThe debugger supports different kinds of watch expressions: registers, constant values and addresses. Here are a few examples for direct, symbolic and indirect watch expressions:
Preferences/Settings ReferenceTo setup the C64 development environment, go to Preferences>Settings to open the settings window. Build System Settings
Path to Acme installation. Example:
Path to KickAssembler installation. Example:
Path to Cc65 installation. Example:
Path to LLVM-MOS installation. Example:
Global build defines.
Global build include paths.
Global build command line options.
Path to custom Ninja build executable. Example:
Path to custom Python installation. Example:
Path to Java executable. Example:
Path to a Python script to be used as a drop-in replacement for the VS64 BASIC compiler (bc.py).
Path to a Python script to be used as a drop-in replacement for the VS64 resource compiler (rc.py).
Enable auto build before running or debugging. Emulator Settings
Path to Vice emulator executable. Example:
Additional VICE emulator command line options.
Port number to use to connect to the VICE emulator debug interface (6502 is the default).
Path to X16 emulator executable. Example:
Additional X16 emulator command line options. Misc Settings
Set console output verbosity level (error, warn, info, debug, trace).
Set default charset for the BASIC compiler and disassembler ("big/graphics" for character set 1, or "small/big" for character set 2).
Can be used to disable recursive parsing of assembly files. Mostly used for debugging purposes. Default and recommendation is to leave it enabled.
Enable the welcome page. This setting is automatically disabled after the welcome page has been shown. Open SourceThis package includes open source from other developers and I would like to thank all of those:
Links
|