Celebrate Halloween with Atari BASIC (10-15 mins)

Task: Celebrate Halloween with Atari BASIC

Needed: BASIC

Time: 10-15 minutes

Introduction

When Halloween was approaching I went on to the web to see if there were some fun BASIC programs designed specifically for the haunted day. Unfortunately, I didn’t find any. There are a few graphics demos of scary images but I couldn’t find any source code. So, I decided to design a pumpkin and implement it in BASIC using a refined character set. I did a recent post about redefined character sets if you would like to review how this is done before checking out the pumpkin code.

The first thing I needed to do was design the pumpkin pixel-by-pixel. I did this by mapping out a series of 8×8 grids in Powerpoint that each represents a letter or character that would get replaced by the new design.

Pumpkin Design in Powerpoint
Pumpkin Design in Powerpoint

This is tedious but exactly how it was done back in the day except then it was done using graph paper. To draw my pumpkin we need to redefine 16 characters. I am redefining characters A through P. I did this column by column. For example, grid A-1 represents the letter A while A-2 represents B, etc.

The next step is to convert each 8×8 grid to a vector of 8 decimal values that are calculated from the binary representation each row. Here, you start with the leftmost pixel as 128, the next one as 64, etc. with the rightmost pixel of each row as a 1. In other words, think of each row as a binary array with 1s where the pixels are lit up and 0s where they are blank. You then convert this binary number to a decimal number. The value for first row in A-1 is a decimal 0 while the second row is a 3. The next one is a 7. So, the decimal vector representing A-1 is 0, 3, 7, 7, 15, 15, 31, 31. The decimal vector for A-2 is 63, 63, 127, 127, 127, 127, 127, 127. These are presented in the code as DATA statements and read into the memory locations where the bitmaps for letters A through P are stored (we move all the characters from ROM to RAM for editing).

I used Graphics 2+16 here for the big block letters. Note a key difference from the character set code I presented in the previous post is that we use PRINT #6 statements here instead of just PRINT to print the characters on the screen. PRINT is only for Graphics 0. I repeated the pumpkins six times across the screen.

Instructions

Step 1

Here is the source code to draw six pumpkins on the screen.

Step 2

Simply copy this text to your clipboard and then paste it into the Altirra emulator running BASIC using the View tab and then paste text option at the bottom of that menu.

Step 3

To load BASIC in Altirra select the File menu and then choose Attach Special Cartridge and then BASIC at the bottom of that list. Alternatively you could load one of the many BASIC ATR files that are out there.

Six Pumpkins
Six Pumpkins in Altirra
Six Pumpkins on an Atari 800
Six Pumpkins on an Atari 800

Comments

I hope you find this additional example of using redefined character sets useful. See my previous post about saving BASIC programs like this to an ATR file that could be used to make a floppy disk for use on original hardware. I have shown above the image for both the Altirra and on my Sakata monitor connected to an Atari 800. Happy Halloween!