Multicolor Character TV Snow with Sound Added: 13-Aug-2024 Updated: 30-Aug-2024 |
||
Over the years I've been fascinated with random number generation and displaying them graphically, resulting in the TV snow effect – if you owned an old-school television with a “rabbit ear” type antenna and stayed up late enough, you would have been treated to this effect. The concept is super simple, but there are myriad ways of displaying the data, with varying degrees of realism as a result. One case in point is with the Commodore 64. In the past I wrote a routine to write random numbers to all 8,000 pixels on the high-resolution screen in a loop. It wasn't until recently that a more efficient method occurred to me (better 40 years late than never, right? 😆)... and that involves the use of:
The idea is that instead of writing 8,000 bytes for each frame, we switch to custom character mode and write random numbers to the entire 2K block of character definitions and do this only once upon program initialization. Then we only need to write 1,000 random characters to screen memory for each frame. The result is a much faster overall frame rate and more realistic animation. Since multicolor characters are twice the normal width of standard characters, we render each random byte as two pixels high in order to preserve the aspect ratio. Another small optimization is setting the cursor color to 9 (1 = white bitwise OR'd with 8 for multicolor mode), then print CHR$(147) to clear the screen. This negates the need to write a routine for filling color memory starting at address $D800 – we can let the Kernal do that for us instead. A Zip file containing Acme and Kick source code, Prg and D64 files is available for download. Sample animation
|
Basic-only version (without sound) – slow to intialize, slow to render
Hybrid Basic / ML version (without sound) – fast to intialize, slow to render
Full ML version with Basic data loader (with sound) – fast to intialize, fast to render
|
Ram Skan 64 Added: 19-Aug-2024 Updated: 8-Sep-2024 |
||
This program is an enhanced version of a concept program published in Volume 5; Issue 2; page 21 of The Transactor Magazine from 1984. The original program (Ram Scan 64) was featured in a video on the 8-Bit Show And Tell YouTube channel a couple years ago, and I only happened to stumble upon it a few days ago. This humble program literally provides a window into the machine's memory that just can't be replicated by looking at a memory map in a reference guide... in large part because it updates in real time. This revision of the program displays the contents of memory starting from the address indicated in the banner on the bottom row of the screen. The value for the byte at that address is also shown, and corresponds to the highlighted character block at the top-left corner of the screen. Numbers are formatted as hexadecimal/decimal. Additional keyboard commands facilitate jumping to addresses at several different intervals. These are shown in the program listing. The original program wrapped within the same page when reaching the page boundary. This revision smoothly transitions to the previous or next page when the boundary is crossed. A few addresses of interest:
Fun project: Example 2 contains source code to set up an ISR that writes random numbers in the background to the block starting at address $1000. Try running that program, then run Ram Skan 64 and monitor address $1000. You should see random data being written continuously to the first block, as depicted in Figure 2. A Zip file containing Acme and Kick source code, Prg and D64 files is available for download. |
Basic data loader version
Example 1 – Source code to print the File Not Found error message
Example 2 – Source code to set up an ISR for generating random data
Figure 1.
Figure 2.
|
Smooth Full-Screen Text Scrolling Added: 5-Sep-2024 Updated: 14-Sep-2024 |
||
Scrolling text smoothly on the Commodore 64 isn't too tricky if it involves just a small section of the screen. To scroll the entire screen without jerkiness usually requires some form of double-buffering. This program uses that technique to horizontally scroll a sine wave pattern of dots that spans most of the screen height. Sample screenshot
In the initial mono revision, the entire screen buffer was copied on the eighth pixel shift and the pointers to the two screen buffers were swapped. This resulted in somewhat uneven rendering of the animation, due to the time involved in copying screen data. In the current revision, three rows are copied every time there is a shift of the the first seven pixels. For the eighth pixel, four rows are copied (7 * 3 = 21 + 4 = 25 rows total). The allows for a more even distribution of workload, resulting in a smoother animation. The color version of the program shifts both screen and color data. Since the address for Color RAM is fixed at $D800, there is no way for it to be buffered, unfortunately. So there is a slight inherent tradeoff in smoothness for the benefit of scrolling color data where it is not uniform across the entire screen. A Zip file containing Acme and Kick source code, Prg and D64 files is available for download. |
Sample Source Code
|
737 Demo Added: 14-Sep-2024 |
||
This modest demo is a re-creation of one I made back in 1987 using the Doodle drawing program for graphics and the PAL Assembler for the code which renders the animation. Unfortunately, the original floppy disk got corrupted over time, so this particular animation is a re-creation from 2008 that was compiled using C64Asm and then ported for the Acme Assembler. A Zip file containing source code, Prg and D64 files is available for download. |
Sample animation
|
Sound Skulptor Added: 14-Sep-2024 |
||
This program was created in 2008 and is based loosely on a concept described in the May, 1984 edition of Compute's Gazette Magazine (Part 1 / Part 2). This is an experimenter’s playground, providing access to virtually all SID registers via a point-and-click interface using a 1531 mouse (port 1) or joystick (port 2). Up to ten sound configurations can be loaded or saved at a time. The UI was designed to mimic more modern operating systems through the use of checkboxes, radio buttons, slider controls and up/down "spinner" controls for manipulating the various SID registers. A few keyboard shortcuts are also available and can be found in the program listing. A Zip file containing source code, Prg and D64 files is available for download. |
Screenshot
|
Character Dump Added: 14-Sep-2024 |
||
When a key is pressed, this program displays the eight single-byte values representing the bitmap pattern of that character. Values are shown for upright and ±90° orientation. I wrote this program back in 2007 to aid in creating a few custom characters for a demo that required them to be rotated (specifically, the "27" runway heading shown in the Chinook demo below). A Zip file containing source code, Prg and D64 files is available for download. |
Screenshot
|
Chinook Demo Added: 14-Sep-2024 |
||
Chinook helicopter demo with engine startup, taxi and takeoff... followed by continuous fly-bys until a key is pressed. A Zip file containing source code, Prg and D64 files is available for download. |
Screenshot
|
SID Scope Added: 14-Sep-2024 |
||
Activates the SID chip's random noise generator, then displays its output graphically in a double-buffered, high resolution horizontal scroller. A Zip file containing Prg and D64 files is available for download. |
Screenshot
|
KDemo Added: 14-Sep-2024 |
||
File this one under Abandonware® – it was a half-hearted attempt in 2007 to make a demo modeled partly from sprites lifted from my all-time favorite breakout game Krakout. It uses random background patterns that were A Zip file containing source code, Prg and D64 files is available for download. |
Screenshot
|
Screen Fills Added: 14-Sep-2024 Updated: 22-Sep-2024 |
||
Three ML screen-fill routines from Dec-2010 to Jan-2011 are included here: Spiral, Surround and Zigzag. Don't ask me why... I was bored, I guess. 🤷 Spiral effect
|
A newer borderless banner program with chicklet logo is included just because. A Zip file containing source code, Prg and D64 files is available for download. Borderless banner with chicklet logo
|
RLE-Compressed Graphics Added: 15-Sep-2024 |
||
This program demonstrates the use of Run Length Encoding (RLE) compression to reduce the size of images or data. In this example, the US flag has lots of repeating byte values for the stripes, making it a good use case for compression and was able to be reduced in size from 32 blocks down to just eight, or one quarter of its original size. A Zip file containing Acme and Kick source code, Prg and D64 files is available for download. Source code for compressing original data is also included (substitute screendata.asm with the name of your file containing byte values to be compressed). |
Sample screenshot
|
DOS Wedge Added: 20-Sep-2024 Updated: 21-Sep-2024 |
||
It seems like a right of passage for every Commodore enthusiast to eventually create their own implementation of a DOS wedge... and I guess I'm no exception. 😃 This one is a no-frills variety that just sticks to the basics like...
The program allows for pattern-matching (ie. '$FOO*' lists all files starting with 'FOO'). Filenames may be enclosed in quotes, but it is not required. A directory listing may be interrupted by pressing any key. Typing '@?' or 'SYS 49152' will display the list of available commands. A Zip file containing source code, Prg and D64 files is available for download. Screenshot showing available commands
|
Basic data loader version
|
Borderless Bouncy Sprites Added: 22-Sep-2024 Updated 1-Oct-2024 |
||
This is a minor evolution of the “borderless” banner hack above. I use the term loosely because the borders aren't actually being opened... it's just an illusion created by quickly switching the border and background colors at the raster level. Nothing really groundbreaking here... the sprites just traverse the screen, wrap around and repeat endlessly. The program uses a table of precalculated sine values for sprite Y locations, which would be prohibitively slow to calculate on-the-fly. CityXen did an excellent video on the topic. Originally, there were 256 values in the table, which made programming fairly straightforward since the byte holding the offset into the table could simply wrap around without needing to be checked. Unfortunately, the animation proved to be too slow when used together with raster effects... so the sine table was shortened to just 31 values, which I believe strikes a decent balance between animation pacing and screen jittering. Seven of the eight sprites are copied straight from character ROM (I mean, why reinvent the wheel?) and expanded horizontally and vertically. The upside to using this method is that the program weighs in at a scant 486 bytes; less than the amount of space for eight sprites. A Zip file containing source code, Prg and D64 files is available for download. |
Sample screenshot
|
Music From the BASIC Prompt Added: 17-Oct-2024 |
||
The Commodore community is full of creative people, but it's not every day you witness someone who thinks outside the box on this level. lftkryo (Linus Akesson) recently made a video titled Making 8-bit Music From Scratch at the Commodore 64 BASIC Prompt. As the title would suggest, it shuns the use of third-party software for creating a chiptune loop, and instead leverages the BASIC screen editor as its user interface. The concept of the program is to hand-code assembly instructions on-the-fly using decimal numbers in data statements, rather than using an assembler or jumping into a machine language monitor to code in hexadecimal, which is de rigueur practically everywhere else. Since support for hexadecimal is absent from BASIC 2.0, this is pretty much the only option if the goal is to work strictly within the constraints of a stock system (no cartridges – that would be cheating! 😁) This requires a high degree of discipline, knowledge, planning and maybe even a bit of luck, since a relative jump that is even one byte off in either direction can make the difference between a smooth-running program and one that ventures off into la-la land. Error-checking? Forget about it... BASIC says "sorry, no capiche." To borrow a car analogy, coding like this is for people who prefer a car with a manual transmission instead of an automatic, because they like the extra work (I happen to drive a manual, before anyone starts slinging tomatoes). Okay, I'll stop with the analogies now. The coding process is made slightly less tedious by grouping related blocks of code and data into separate pages - this also lends itself to more easily using the X and Y processor registers as indexes into data on separate pages, since the offsets are more predictable when coded this way. The program takes the least-significant byte of the Jiffy Clock and divides it by eight, providing a counter from 0-31 which runs at 7.5 clicks per second. This is convenient since it provides a suitable tempo for the musical score. It also provides a range of offsets to screen/color memory for eight bars × four columns per bar, while also affording enough space for line numbers and the REM command. |
Contrary to using standard A-G musical notation, character codes 0-31 (@ to ⇦) may be entered on the makeshift musical staff, consisting of REM statements (or directly on the screen in the expected character positions). This provides a roughly 2-½ octave range of contiguous notes, which is comparable to that of an entry-level keyboard. It takes some getting used to and I'm still very much a novice to the technique... but it's fun to drop a note here and there and then wait for the timing marker to loop around and confirm whether the note is in key or if I made a cringeworthy gaffe (we won't get into the hit-to-miss ratio... you don't want to know! 🤐). In the customized version of the program, Voice 1 notes determine the color of the raster band that appears in the bottom screen border. The pitch table is also reduced in size to cover just the range of values referenced by the program.
A Zip file containing Acme and Kick source code, Prg and D64 files is available for download. Source code is provided with the author's kind permission. |
Asteroid Belt Mini Game Added: 27-Oct-2024 Updated: 24-Dec-2024 |
||||||||||||||||||||||||||||||||||||||||||||||
As commander of the space ship, your objective is to navigate the asteroid belt without being struck. Fuel depletes over time, so you will need to continually intercept fuel pods (yellow dots) before it runs out. There are also UFOs in the area, so be careful! This mini game was inspired by an article of the same name in Issues 37 & 40 of Commodore Free Magazine from 2010. This implementation follows the same general theme with the following enhancements:
|
The keyboard controls are arranged so the game can be played using only the left hand (Z/X), both hands (Z/M) or only the right hand (ie. cursor keys in an emulator).
Basic loader
A Zip file containing Acme source code, Prg and D64 files is available for download. |