Space Junk is a fun little low resolution (GR mode) game written in SmartBASIC by Brian Sawyer in 1984. It’s available on the SmartBASIC Games III disk.

Space Junk video game screen

GR mode is GRRReat! 🐯

Had some fun this morning messing around with SmartBASIC and ADAM’s low resolution graphics (GR) mode. I’ve always loved the simplicity of its 40x40 grid and the fact that it has a convenient text area below it. I was working with sprites while in GR mode and it looks promising. Drawing and animating the higher resolution sprite over the chunky blocks of GR graphics certainly makes for an interesting combination. I’m feeling like its even got potential for some 👾 game concepts. We’ll see!

A sprite in ADAM's GR graphics mode.

Playing with SmartLOGO… it’s surprisingly powerful. Lots of learning to do! Found out that I can dump the byte data of a LOGO shape and use it in SmartBASIC 2.0 for a sprite. 🐢

60-Column Text Demo

I was checking out some of the demo programs on DEI’s FontPower disk and I came across one that featured 60-column text. It uses the shape table to store the characters which is a really cool technique. Seeing how legible it was made me think it’d be great for a communications program so I modified the demo program and came up with this. Not sure if I’ll finish it but it sure would be nice to have.

🌈 Spent time this morning in BASIC trying to produce “rainbow” text (a string with each character having a different colour all appearing on the same line). It’s not as trivial a task as it would seem to be! More experimentation is required. Excellent. 😄 #ColecoADAM

BASIC SmartWriter File Viewer

I’m happy to announce that this weekend I was able to complete and release my SmartWriter File Viewer BASIC program.

This has been a really fun project and the end result is a utility that I will personally get a lot of use from. One of the main reasons this project was so fun was that it involved disassembling SmartBASIC’s BLOAD routine and modifying it to do what I needed. I haven’t had much experience with assembly language so this gave me a chance to dig in and learn. I used the disassembler included with the legendary Hacker’s Guide To The ADAM. The Hacker’s Guide Volume 2 was also incredibly helpful as a reference for this project. Without its section on Tape Routines I don’t think I would’ve been able to do this at all. Huge shout-out to Peter and Ben Hinkle for writing these awesome guides back in 1985/86. The other book I used as a reference was “Programming the Z80” by Rodney Zaks which I’m sure I’ll be returning to again and again.

As I mentioned in a previous post the main thing I needed to do was get the BLOAD routine to accept SmartWriter files. After reading through the assembly code I found what I was looking for here at 21083:

21083 525B  3A9641  LD   A,(nn)    4196
21086 525E  FE02    CP   n
21088 5260  C2255F  JP   NZ,nn    5F25

Just before these instructions the routine loads the file header into memory location $4194. So the first line above is looking at the 3rd byte of the header (the file type) and the second line is comparing it to the value 02. If it doesn’t equal 2, the third line jumps to an error display routine (File Type Mismatch). In ADAM’s EOS, binary files have a file type of 2 whereas SmartWriter files have a file type of 1. Therefore all I had to do was modify memory location 21087 to contain the value of 1 like this:

POKE 21087, 1

Eureka! That was enough to get BLOAD to accept SmartWriter files. As a bonus, the routine would now neatly reject other binary files that would obviously be incompatible with my viewer program. Once I had this in place I started to figure out more of the routine and how it worked. There are some other modifications I had to make before I was done but this one was definitely the key. You can check out the rest of the changes and the entire code if you’d like by downloading the disk image over at the ADAM Archive.

Just a BASIC Saturday morning! 🤓 #ColecoADAM

I printed out a disassembly of the BLOAD routine [$5201] and spent some time studying it last night. Despite my limited assembly knowledge I’ve been able to figure out most of it including the key to making BLOAD accept SmartWriter files. 🎉 Progress! #ColecoADAM #Z80

Beginning With BLOAD

I’m planning to write a BASIC program to view SmartWriter documents. It would come in really handy since many program disks include their documentation in this format and it’s inconvenient to reboot into the word processor just to read them. At first glance this seemed like a pretty simple program to write however the BLOAD command refuses to load SmartWriter files (although they are cataloged as type “H” binary files) for some unknown reason. The OPEN command only works with text files so that won’t work either.

One solution I’m considering is modifying the BLOAD routine in memory so it will accept SmartWriter files and load them like any other binary file. This will take me in a bit over my head as I’m not comfortable in machine code or assembly language (yet) but it does turn this into a pretty interesting project. Stay tuned!

Super BASIC Plus is pretty awesome! There are a lot of SmartBASIC enhancements out there but this one is by far my favourite.

Sprites and Spaceships

I’ve been having a bit of fun with sprites and SmartBASIC this weekend. First I loaded up SpritePOWER which is a very nice sprite editor for ADAM that was created by Digital Express Inc. Digital Express created a lot of great software for the ADAM. SpritePOWER is really nice because it gives you the option of exporting your sprites as binary (so you can BLOAD them in BASIC), Z80 code (for use in assembly), or as an ASCII file of SmartBASIC code consisting of many DATA statements. For the BASIC code option it even lets you specify the starting line number and line increment value. Pretty slick.

I wanted to create a spaceship that I would later be able to fly with the joystick, so I’d need to create it facing in at least 4 different directions (I didn’t do the diagonal variants). I first created it facing east. SpritePOWER has a handy “flip grid” feature which made it easy to create the west-facing version. Unfortunately it doesn’t have a “rotate grid” feature.

To create the north/south facing sprites what I did was take a picture of the TV screen with my iPhone and then rotate the photo. This made it much easier for me to put the pixels in the right locations. Before long I had all 4 variations of my spaceship ready to fly! I opted to save my sprites in a binary format.

SpritePOWER Spaceship sprites

Coleco SmartBASIC 1.0 doesn’t offer any syntax support for sprites so using them involves knowing what and where to POKE. Thankfully, the SpritePOWER disk included a SmartBASIC program called “SpriteDemo” which showed me how to load and use my sprites. Part of the code even demonstrates how you can move a sprite onscreen using the joystick! I pulled this section of the code into its own program and modified it so that it would use my sprites. The original code would move the same sprite in any of the 4 directions. However, I wanted my program to change the sprite depending on which direction the ship was flying so I made those modifications too. If you’d like to see the SmartBASIC code, you can download it here.

There is something pretty satisfying about flying your own custom 8-bit spacecraft around the screen. Obviously there is a lot more I could do to enhance this code and possibly even use it as the foundation for a game. I may eventually do just that!