Help keep the free Atari 2600 programming episodes and code coming by supporting the channel on Patreon.
In this episode we explore what languages and processes were used when creating games for the Atari VCS when it was first launched, and how today we can use Visual Studio Code and the Atari Dev Studio to code and debug faster than ever before.
Released:
December 18, 2021
Original Link:
Code Faster With The Atari Dev Studio
GitHub Link:
s01e08 - Atari Dev Studio - Example
Welcome to 8Blit. In this episode, we’ll explore a little bit about how Atari VCS games were made in the past and how we can upgrade our current process using a free integrated development environment, along with a really great extension. I hope you’ll stick around as we’re introduced to Visual Studio Code and Atari Dev Studio.
So let’s get started!
When the Atari VCS first hit store shelves in September 1977, it sold over half a million units in its first year, with only nine games available in its library at launch. However, by the end of 1979, the VCS had a customer base of over two million units with an extended library of 36 games. Over the next decade or so, this expanded to over 30 million units and literally hundreds of available games.
Since the Atari VCS was discontinued in 1992, the homebrew scene has taken over the development of new games for the system, with a couple hundred releases over the years. Many of them are available to purchase on cartridges from the AtariAge website. I’ll include a link in the description. Even today, there’s an active developer community producing several games each year.
Some developers create for the VCS out of nostalgia, creating games for the first game console they had growing up and spent countless hours playing with family and friends. Others do it for the challenge: working with extremely limited resources on hardware meant only for simple games and pushing the limits of a system over 40 years old.
Whatever your reason, programming for the VCS can be baffling, even frustrating at times, but in the end it can be a very worthwhile and rewarding endeavour. When you finally create a stable screen, draw your first graphic, or start creating a new game, you become a part of the history, a part of the future, and a steward of the legacy of the Atari VCS.
If you Google the language originally used to program games for the VCS, you get some confusing results. Some people say the C language was used, another person insists they were programmed in Atari BASIC, but the majority consensus is on assembly language.
While C is an extremely flexible language and is certainly used to program for the 6502 and 6507 processors, the output of a purely C implementation would not be precise enough for most VCS games. The VCS requires precise timing due to hardware limitations, so to do this, the C implementation would most likely be an outer wrapper for embedded assembly instructions and therefore more assembly language than C language.
Atari BASIC, however, is entirely out of the question, as it used an interpreter to run BASIC code rather than compiling the code into the machine language that the 6502 processor executes. Atari BASIC was available in 1979, but it was first used with the Atari 8-bit line of computers and required its own cartridge to run the programs.
Assembly language, however, gives you the ability to control exactly what the processor is doing, which is essential to minimize the number of machine cycles your code uses to perform each task, such as drawing your player graphics and other game operations. This allows you not only to fit as much as possible into the limited time you have, but also to squeeze the game into the small cartridge size, which was only two kilobytes when the VCS was released. What do you think? Am I way off? What are your thoughts? Let me know in the comments below!
Originally, VCS games would have been programmed on one machine and sent to another machine with a cross-compiler, with the binary sent somewhere else to burn a test ROM to insert into a cartridge and then into VCS hardware. If there was a bug, then you’d review the code, make your corrections, and start the whole process again.
These days, we’re privileged enough to have access to several free tools for the VCS that enable us to build and test in a matter of seconds. We already have experience writing our code in a text editor, compiling it from the command line with the DASM assembler, and testing our creation within the Stella emulator. This is a great process and certainly more streamlined than what the original VCS developers had at their disposal. However, there are some other tools out there that make it even easier. One such tool is Atari Dev Studio.
Released in 2019, Atari Dev Studio is described as a “one-stop shop for any programmer.” That is, programmers wanting to develop for the Atari 2600 or 7800, which, if you’re here, I imagine is you!
Atari Dev Studio is an extension for Microsoft’s cross-platform Visual Studio Code and comes packaged with the batari Basic and 7800basic compilers and the DASM assembler, as well as the Stella and A7800 emulators. All of these are automatically installed and set up for you when you add the extension. It features syntax highlighting, a very handy reference tool, a sprite editor, and other bells and whistles. But enough talking about it. Let’s have a look at how to set it up, compile, and execute a program.
The first thing you’ll need is Visual Studio Code, which is available to download free for Windows, Linux, and macOS. I’ll include a link to the website in the video description. After you’ve downloaded and installed Visual Studio Code, open up the application. Let’s start by downloading all the 8Blit examples from GitHub. We’ll do this by cloning the 8Blit repository.
Just click on “Clone Git Repository,” and then, in the location box above, we’re going to paste the 8Blit repository URL, which will also be included in the video description.
A window will pop up where we can select which folder we want to clone the repository. I’m going to use my current working folder, but you can select any other folder on your machine. Once you have your folder selected, click “Select Repository Location.”
Visual Studio Code will start pulling all the files from the repository. Since the examples are all small text files, this should be completed quickly. When it’s done, you can click on the “Open” button to have Visual Studio Code open the cloned repository. In the Explorer bar, we can see a folder for each of the previous episodes. Let’s open up one of the examples from the last episode.
In the code tab, we can see the assembler source code, and we can scroll through it using the scroll bar on the right.
At this point, Visual Studio Code doesn’t know what to do with our code, which we can see when we try to run it. Currently, it thinks we’ve opened a plain text file. We can see this at the bottom left of the screen. From here, we can select what our file is, but if we look at the available types, none of them are for the DASM assembler.
Up at the top of the list, we can search the Visual Studio Code Marketplace for extensions that can handle files with the .asm extension. As you can see, there are lots of available extensions for assembly language, but the one we’re looking for today is Atari Dev Studio. Clicking on the extension will bring up an information page, and from there you can click on the “Install” button.
When it’s done installing, we can go back to our example code and see that it now features syntax highlighting, making it much easier to read, and the file type is now set to dasm. Plus, if we hover over an instruction, a handy popup window shows us additional information about each of the 6502 instructions, such as the name, the direction the data flows, what processor status flags it affects, the different addressing options, the number of bytes the instruction uses, and the number of machine cycles it takes to execute for each addressing mode.
We can try compiling the example using the little “play” button on the bottom bar. This will pass the code to the DASM assembler and show the results of the build in the Output window. Atari Dev Studio also installed the Stella emulator, which we can automatically launch after building our code by clicking on the little “rocket” icon.
When it comes time to draw your graphics, you can use the built-in Sprite Editor. Create a new project to define what console you’re using, the dimensions of the graphic, the regional palette you want, and how many colours to use. For the Atari 2600, one is the only option. You can set the background colour for the editor to make sure your background and sprite graphics will look good together. For the sprite, I’m going to choose a blue, select the “draw” tool, and then start drawing a character that might look familiar to you. If you make a mistake, you can use the “erase” tool to clean up.
Now that we have our first sprite, I’m going to duplicate it and then modify the new copy to create two frames for an animated character. We can save our project to work on later, as well as our palette. Most importantly, we can export our sprite into several different formats depending on the technology you’re using to build your game.
Opening up our saved file, we can see there’s a data table for two sprites in bottom-to-top orientation. If we copy the first one, paste it into our example file, add a zero byte at the top, and then click on the little rocket icon to assemble and launch Stella, we have our very own ghost from Ms. Pac-Man.
Overall, Atari Dev Studio is a solid extension for Visual Studio Code. It’s easy to use, not overly bloated with features you never asked for, and well supported. I highly recommend you give it a try. Let me know what you think in the comments.
I want to thank everyone for your continued support.
If I’ve piqued your interest in developing for the Atari VCS, or if you found this video interesting, please let me know with a like, a share, a comment, or all of the above. If you haven’t already done so, please consider subscribing to the channel to keep updated when new videos come out. As always, the example code for this episode and all previous episodes is available on our GitHub, which is linked in the description.
As always, thanks for watching, and I’ll catch you next time!