I expanded the BASIC script interpreter in basicscript-03.zip to include an example of how you can share variables between your program and the script. For example, you can set a counter in your program, pass that value to the script, and have the script update the value, and then use the new value in your program. Note that since the make file is for Qt, I suggest you compile with
g++ *.cpp -o basicscript.
ConsoleBasic class now shares two variables with the script, in addition to the
CLS command we added in the previous post. An integer variable
counter and a string in
name$ are now read and modified in the
sharedvariable.b sample script.
Continue reading Basic Interpreter With Shared Variables
I expanded the BASIC script interpreter in http://8bitcoder.com/downloads/basicscript-02.zip to include an example of how you can extend the interpreter and add your own commands to it. Sorry about the Makefile depending on Qt. I’ll create a generic Makefile next version I release.
I created a
ConsoleBasic object, then added the
cls command. You can see I add it in the constructor, then in
execAddonCommand I check the token that is passed in to figure out what command I should execute, which in this case can only be one command, then clear the screen via ANSI escape codes.
Next example will show how to make your C++ variables available to BASIC.
class ConsoleBasic : public SmallBasic
ConsoleBasic(const char* pszFilename)
m_cls = addCommand("cls");
bool execAddonCommand(const int tok)
if(tok == m_cls)
I had a few people interested in my BASIC interpreter that I was using as an embedded script interpreter. I had started using it in my MUD but pulled it out and made a stand alone example. It still needs a little cleanup and i still need to create an example of how to add more commands to it. See basicscript-01.zip. You can run the script with “basicscript hello.b“. hello.b uses a few commands and shows how you can use labels instead of line numbers. Line numbers are supported as well. Don’t be too hard on the code, I wrote it back in 2001!
CpuEmulator is a CPU emulator project that aims to emulate a CPU (the 6809 to start with), it’s registers, and system memory. It will allow you to monitor registers, flags and memory as you step through code. Having done SharpiEmu for the Sharp PC–1360 Pocket Computer, the concept seems pretty simple. The 6809 has a number of addressing modes, and different opcodes for the same mnemonic. So I’m expecting it to be somewhat more of a challenge.
Initial version will emulate the CPU, memory, and text video mode.
- Emulate 6809 instructions
- Emulate 32×16 & 80×24 text modes
- Emulate the Coco3’s MMU
- 4K all the way up to 512KB memory options
- Debugger that steps through code, shows current state of registers, selected memory block, and source code from a listing file.
- Break points. They are remembered between runs.
- Memory watcher. When memory at a certain addresses are modified, a breakpoint is triggered so you can see what modified it.
Continue reading 6809 CPU Emulator project started
Bouncy Ball 2 Progress Report 1. First things first. We need to get the Coco 3 into it’s high resolution graphics mode, then display a little something. To start out small, I decided to create a program that sets the video mode, uses the MMU to map in the video memory, then clears the screen. That part was easy, although understanding the MMU was a little whacky.
Continue reading Bouncy Ball 2 Progress Report #1
Radio Shack Catalog Number 26–3143. The Orchestra–90 CC is a stereo 8-bit audio player for the Color Computer. It works by mapping two addresses in the Coco’s address space to two 8-bit DACs. $FF7A is for left, and $FF7B is for the right. This is the first time I have been able to use this cart, never mind program it! So far, it’s pretty easy to program.
Continue reading Orchestra 90 CC Stereo Music Synthesizer
Bouncy Ball version 1.0 has been released, and in time for the 2016 25th Cocofest. I was working on a timer bug, and RGB mapping, while Simon was working on the end game sequence. I owe him a case of beer for his efforts, staying up till 2am his time, on a work day! I am so looking forward to watching people play on my Coco 3.
Continue reading Bouncy Ball Version 1 Available
There was an interesting thread on Facebook this week that was talking about optimization. They took an imaginary sprite routine and optimized the crap out of it. In this article I’m going walk through the various stages of optimization and provide my own analysis of why the changes were made, and why (or if) the optimization was any good.
I’m going to assume you know how, or are familiar with some arcane programming language, and are either somewhat familiar with assembly or enjoy punishing your brain.
You might be surprised with the results of version 5 and 5p. Sometimes less instructions doesn’t always mean faster.
Continue reading Optimizing an Imaginary Sprite
After a successful (and surprisingly easy) setup of my Raspberry Pi 1 model B+ (also called an RPi), I decided to start working on a little weather app. While I like the look of the stock weather app on the iPhone, it is always missing, some bit of information I want. Like how much snow is expected in a couple days, and what the chance of snow is. As a result, I find myself going to Weather Underground to get the rest of the info I want. So, I decided to put my RPi 1 to work and create a system that will automatically download the weather and send me an email in the morning with a complete report.
Continue reading My Raspberry Pi and the weather
I’ve been working on optimizing my level rendering routine, and am now integrating changes back into Bouncy Ball. First kick at the can, and the results are rather humorous.
Continue reading Reintegrating level renderer with Bouncy Ball
In this article I talk about optimizing the level rendering routine for my game Bouncy Ball for the Color Computer. With the help of the mad man Simon Jonassen, I was able to take the render routine from 7 fps to 50 fps! I was quite surprised at the results. I made a video at the end of this article, and explain things in detail here. I also list a couple resources you might want to have in your back pocket.
Continue reading Optimization, inside the mind of a mad man
I started working on converting my level renderer for Bouncy Ball to assembly. Check out the video below. The C is on the left, assembly on the right. The speed difference is about double the frame rate. Although, in the video I forgot that the C version is double buffering, and the assembly isn’t. Assembly also isn’t printing text. So I fixed both versions behind the scenes.
Continue reading Render conversion to assembly
Awesome progress over this new years weekend. I started with a 4 page TODO list, and I have all but the end of game sequence done. I still have levels to build, joystick support, and then in-game sound and (maybe) music to implement. Sound will be via Simon’s irq driven routine. I even had some time to start work on Bouncy Ball’s official web page, and some package art. Now though, I think it’s time to take a short breather and maybe type in another BASIC program. I’m thinking Connect 4. I remember having that one typed in and added some Coco 3 hi-res graphics and sound to it.
Continue reading Bouncy Ball Beta 1 almost ready
You can now download a playable demo. I fixed the joystick button read routines. Use button 1 on either joystick to move forward, button 2 to move backwards. I don’t map RGB colors yet, so your colors will be different on an RGB monitor. See the README.txt in the zip file.
I have been thinking about game AI the last couple weeks, and since I’ve been working on a retro themed game for a retro Coco 3, an old book on BASIC games came to mind; Tim Hartnell’s Giant Book Of Computer Games. Tim was a self taught programmer and the author of several successful books on computer programming.
A few nights back I couldn’t sleep, so I decided it would be relaxing to type in a program from Tim’s book. My first choice was Reversi, but there was either an error in the printed source, or I miss-typed something and the program just wouldn’t run. My second choice was Gomoku, which ran the first time I typed RUN. The game has a strong defensive AI, but not much on the offensive side. I’m thinking it would be fun to work on that part of the AI. But that’s for another post.
Continue reading Gomoku BASIC ported to C
My second demo video of Bouncy Ball is available. Since last meeting our snowball hero, there have been a few cosmetic updates, and now has 3 levels. They play well, but not yet tuned for difficulty. The biggest change is the flashy new title page, with a few place holder items.
Continue reading Bouncy Ball Demo Video 2
The levels in Bouncy Ball are not all that complicated to store in memory. But they are taking up a bit of memory, which is a bit of a concern if we don’t want to have to resort to reading the levels from disk. With some simple compression, I have been able to shrink a level from 5880 bytes to 870 bytes. That’s a 6:1 ratio, or over 6 times smaller!
Continue reading Compressing Bouncy Ball levels
Published my first demo video of Bouncy Ball just in time for Xmas. I decided to make it xmas themed after hearing about another Coco coder, John Linville made a game called Xmas Rush. It had evil snowmen that you had to save xmas trees from. That also helped me figure out what my story line would be. Since John was busy saving the trees in the forest, the evil snowmen stole everyones xmas trees from their homes, and brought them back to snowman’s land.
Continue reading Bouncy Ball Demo Video 1