Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

BIRDY FLAP
==========

This is a simple version of the classic mobile Flappy Bird game, made for MSX2.

I had a few goals for this:
1. Learn to code a game in Z80 assembler
2. The game had to be complete, with a reasonable level of polish
3. The game had to feature smooth scrolling using MSX2 'set adjust' registers and border masking
4. The game had to run at 60fps
5. Try to work with AI to generate (parts of) the code
6. The game had to feature a flexible sound/music engine

Í have used VS-Code as the IDE, Glass 0.6 as the Z80 assembler, and OpenMSX for testing.

The main parts
--------------
main.asm    : The main gameplay engine
vdp.asm     : VDP routines to copy data to VRAM, set-up graphics mode, set up a back-buffer etc
psg.asm     : Routines to deal with the PSG soundchip
ssp.asm     : The 'SoundString Player' code for sound effects and music
graphics.asm: Graphics data (tiles, sprites)
sounds.asm  : Sounds/music SoundString data


The SoundStrings Player (ssp.asm)
---------------------------------
This part is mostly written by AI (Claude Sonnet 4.5 using Copilot in Agent mode).

I ended up with the following workflow:
1. Prompt Claude to write/update the specification (see spec_psg.txt)
2. Let claude generate/update the Z80 code in ssp.asm and update the spec when necessary
3. Test
4. Rinse and repeat

I found this workflow to work well for the following reasons:
1. The spec_psg.txt file keeps it easy to understand what the AI has created (or will create) in Z80 code
2. The spec_psg.txt file serves as a context that is much more structured than just a long session of user prompts
3. Because spec_psg.txt is much more strucured, it makes it easier for the AI to keep a clean context, and a more reliable input for code generation.
4. In practice, I found that the AI made a lot less mistakes this way. And when there were bugs, it was easier for the AI to fix them.

I was however quite specific about what I wanted from it, for example providing a detailed data format for the sound strings in my prompts.

For a detailed description of the SoundStrings Player, please refer to spec_psg.txt, but in short, the idea is this:
A SoundString is similar in concept as a null-teminated text string, but contains register updates of the PSG and control codes.
The program queues a SoundString in the SoundString Player, which will update the sound at every (VBLANK) interrupt according to the SoundString.
Examples of SoundString control codes are 'wait until next interrupt', 'call this other SoundString' and 'loop to there', so they are meant for
sequencing the sound.

Because the SoundStrings Player isn't specifically made for music, it can be quite a laborious process, but there's a useful frequency table with all 
the musical notes to help out a little bit. 
The upside of this low-level approach however is that it's very flexible and you can basically create anything you want with it. So you can create 
glissandos, arpeggios, define unique drum sounds, etc. and the sequencing control codes can help out too.
Tip: Either annotate music sound strings for better readability (annotate bars and beats for example), or generate music sound strings in an extarnal
program that is better suited to writing music (perhaps even importing MIDI data?).

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages