Skip to content

picosonic/D3

Repository files navigation

D3

This project is a source port of Fantasy World Dizzy from the ZX Spectrum / Amstrad CPC computers z80 codebase to the BBC Micro in 6502 assembler.

The game was the third in the Dizzy series and was released on many platforms back in 1989, but never the BBC Micro. The only release for the 6502 CPU was on the Commodore 64. Unfortunately the stock BBC Micro lacked the required RAM to fit all the levels, sprites, music, text and game logic.

I've included playback of the original speech sample (Digitized on a C64 by G.Raeburn) and the Dizzy 2 painting closeup. The PCM playback used ideas and portions of code from here and here.

NOTE : This project requires at least 2 x 16k banks of sideways RAM to be available. So it will work on a BBC Master or a standard BBC Micro with added sideways RAM.

Folder structure

root folder - Javascript test code

beeb - contains all the BBC micro source code and assets required to build the project

info - information gathered from various sources which aided the porting process

original_source - original z80 source code

Building

Development of this project has been done with Linux and as such the build scripts and environment are tailored to it. A Visual Studio Code project is included.

The build script, named "make.sh" can run either from the command line or from within Visual Studio Code. It will attempt to build anything which it thinks has changed.

img2beeb - a short C program to convert images to a Beeb friendly format. This uses the DevIL image library. I use it to convert the loader screen (XSCR) and Dizzy 2 screen (TREPIC) from png with associated palette files.

exomizer - a utility to compress data, I mainly use it to make things load faster. This is available from Exomizer website. Currently I've only used it on the loading screen.

SPEECH - a standalone BBC Micro machine code program to play back the original PCM speech sample, this is run from the BASIC loader.

MELODY - also a standalone BBC Micro machine code program to play back the loader music as used on the Atari ST version, this will be played from the BASIC loader too.

RMDATA - the room data which is compiled from all the binary representation of the rooms, with offsets to each room being generated as RMTABLE. I originally paged this data in from disc on a room-by-room basis and so have included some of the text which only appears in that room, but using SWRAM negates the need for this. I've also created a "strings" room, which only contains static text just to move it out of the main source code. This is stored in the first SWRAM slot found.

XDATA - an extra blob of static data, including the frames used to make up a level and the Dizzy sprites. I may add the Dizzy sprite mask data back in which I previously removed to save space. This is stored in the second SWRAM slot found.

The BASIC loader uses a bit of embedded machine code to search for SWRAM. To create this I first tokenise the BASIC to binary (loadertok.bin) then append the machine code, which is hidden by the BASIC EOF token. Although I need to leave some blank space between them for BASIC variable use.

I use the excellent beebasm assembler to build all the components of the project and to generate a .SSD disc image file.

Running on real hardware

On my childhood BBC Micro model B, I've installed a solderless 32k RAM+ROM upgrade kit.

Then I've used a Gotek device powered by the BBC Micro auxillary power port to load the software via the floppy disc interface. This is the quickest way to test it on real hardware by putting built SSD files onto a USB stick.

I have also tried SD2BBC, but it's a bit slower due to having to add the SSD to an MMB file using MMBExplorer.

Currently I'm detecting the SWRAM by cycling through the slots with ROMSEL to test writeability, although I'm aware that not all legacy SWRAM solutions supported this method. So at some point in the future I'll extend the SWRAM code to support more hardware.

Running in an emulator

I have tested the code on several emulators.

Using b2 - single SWRAM (13) by default, either enable another or use BBC B + 128k / BBC Master config.

Using beebjit - default BBC Micro config has no SWRAM by default. Specify with e.g. -swram 0 and -swram 1 or use Master 128 config.

Using BeebEm - default BBC Micro config has 4 x SWRAM slots 4-7 enabled. BBC B + has 3 x SWRAM slots 0-1 and 12, and both BBC B + Integra-B and BBC Master 128 have 4 x SWRAM slots 4-7.

Using jsbeeb - default BBC Micro config has 8 x SWRAM slots 0-7 enabled.

Test

As part of the development, I made use of Javascript to rapidly prototype some of the routines for decoding and displaying the data.

Online level viewer and tester

Credits

Original source/assets copyright to respective owner(s).

I found the original source code via Wireframe Magazine issue 19.