Melkhior’s Mansion – Project Update #7

Welcome to the latest project update for the conversion of Melkhior’s Mansion Spectrum Next!

It has been another productive week for the project. I’ve also spent time working with the Next team testing the core and CSPect emulator. My tooth has settled down too!

Work has continued this week on the 2D display engine as well as audio and project structure.

I spent the first part of the week adjusting the sample playback system as I decided to add a couple of sound effects plus I removed interrupts – they are turned off permanently now as I don’t need them and they only get in the way of my optimized stack based code. Interrupts were being used to synchronise the video display but now that task has been re-assigned to the copper audio engine.

Copper audio is a method used to play digital sound effects and music. The Next co-processor is able to output sample data to the DAC at a constant rate freeing the main Z80 CPU for other tasks. Four complex timing calculations are required to allow the copper audio to finish processing on the last visible scanline of the display. This creates a software frame sync across the four video modes that the game must support – VGA/HDMI, 50Hz/60Hz.

The trapdoor animation as seen in my teaser video late last year was added as it uses the 2D engine. It can be used to enter any room although it is used sparingly – just for the actual room linking with trapdoors.

You may recall that I have two versions of the conversion in development, the x86 emulated version and the actual Z80 Next version. Each version has been racing ahead of the other over the weeks as I work on the version that is most suited to the module I need to develop. This week saw the Next version race ahead of the x86 project as I coded the trapdoor animation directly in Z80. The projects were starting to become untidy so I decided it was a good time to review and organize the source code structure for both versions.

Similarities can now be seen between the two projects. This requires naming files and routines correctly and placing them in sections to keep both sets of source code tidy, consistent and in sync. Most of the foundations are complete so it was easy to separate the modules and set procedures in place to make sure I add future code and data in the correct sections. The foundations of the x86 version needed some work as their origin was a generic Windows application which did not match the game orientated Spectrum Next version.

Both projects now have the same structure.

The x86 project has the following unique sections:

Windows; Device drivers for frame buffer, input and sound.
Tools; XML parser and sprite cutter.
Virtual machine; Emulated Spectrum Next hardware.
Debug; Visual HUD to display real-time parameters.

The Z80 and x86 share the following structure:

Start-up; Initialization code.
Hardware; Tilemap, sprite, sound and input.
Library; Generic re-usable code modules.
Game code; Code specific to Melkhior’s Mansion.
Game data; Room, sprite and sample data.

The game data is shared between both projects as I only need one set.

I have worked on other areas of the project this week but they are too trivial to mention.

Overall, the conversion is progressing well and text book so far. I am hoping to start work on the 3D isometric engine in the later half of Next week. Development has started up again on the original PC version after a short break. I am excited to see how things are progressing and what new challenges await!

I will be back late next Sunday UK time (GMT) with my next update.

KevB aka 9bitcolor.

https://twitter.com/9bitcolor
https://twitter.com/EricRetro
https://twitter.com/hot_piping

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.