Sunday, August 01, 2004

Dark Empire - Disassembled

OK, I've run the program on the SNA file and now have lines upon lines of assembly language.
Right. What do I do now?

Well I've been down the library reading up on the Z80. The book I referred to earlier (Introduction to Z80 assembly language by Ian Richard Sinclair), has been very useful, not just for the Z80, but for some of the general principles of how a computer works. The chapter I'm focussing on the moment contains a discussion of the Z80 architecture and how the registers are used in assembly language.

The next chapter will start into the nitty gritty. Hopefully from this I'll be able to work out how the assembly language from DE is structured.

Sunday, July 25, 2004

dZ80 for Windows and DOS

dZ80 for Windows and DOS

I've just been looking into disassembling SNA files. The old favourite "opening with notepad" has produced gobbly gook. World of Spectrum has offered some info on the layout, but it looks like I'm going to need a third party utility to help me out.

This program might offer what I need.

World of Spectrum - Remakes

World of Spectrum - Remakes

Hooray... Dark Empire isn't here :) Books: Windows Game Programming for Dummies (For Dummies) Books: Windows Game Programming for Dummies (For Dummies)

This is a great book for hobbyists like myself who want to get into Direct X quickly without having to learn a great deal of background material.

Microsoft DirectX: Home Page

Microsoft DirectX: Home Page

DirectX is a series of application programming interfaces built into Microsoft Windows. By using these interfaces, a programmer can create a game, focussing on the computer hardware as opposed to the usual windows programming conventions.

Note : The download on this page is for the DirectX runtime. This is the technology which the games incorporate at runtime. To access the programming libraries, search for the Direct X SDK. Be warned though - its about 250 meg!

Much of the programming technology caters for state-of-the-art 3D gaming. I hope to be focussing primarily on the DirectDraw interface, used for basic writing pixels and bitmaps to the screen. Search Results Books:

Ian Richard Sinclair

I've been reading "An Introduction to Z-80 Assembly Language" by Ian Sinclair at the library. This book is both informative and easy to understand. While I was in the Library, I did a search on other books that Mr Sinclair produced. He has written a wide range of computing books and has a thorough knowledge of a wide range of machines. He was born in 1932. I wonder if he's still alive?
I also wonder if its a coincidence he has the same surname as Clive.....



The idea of disassembling the original code for the game came from this site. This chap has produced pc versions of another sinclair classic trilogy, the Lords of Midnight. He has included the source code from the games and explained the process he has used to port the titles. This has been a great source of inspiration, and has given me ideas that I would not have thought of.

It is worth noting however that he has obtained the permission of Mike Singleton to do this, so until I have permission from David Bolton, I won't be able to provide as much information.


Originally I had the idea of writing a PC version of Dark Empire completely off the top of my head. One of the most impressive aspects of the game is the terraforming code which generates a new atlas for each game. Rather than reinvent the wheel I have decided how the original game tackles this.

This is not as easy as it sounds. The Spectrum has a Z80 processor, and the majority of games were written in assembly language. These are commands which are almost atomic (they can be converted directly into a number which is represented in electrical signals - telling the processor which task to perform). Subsequently, these games are several thousand lines long.

In the good old days, to disassemble these games, you would have needed a disassembler for the spectrum and I could imagine a lot of messing about with tapes!

Theoretically speaking, since games for the spectrum emulators are represented in single windows files (normally with the extension SNA), I should be able to disassemble the code from the SNA file, rather than through the emulator running a disassembler.

The End Product

The end product should be an installable Windows game. I would like to be able to distribute this game to those who are interested, but this will be dependent on getting copyright approval to do so.

Dark Empire

Dark Empire

Dark Empire was released on the spectrum in 1987 by MC Lothlorien. The aithor was David Bolton. The game started with the player having control of one army and city. Cities can produce additional units, and if located on the coast, can produce transports and warships. The idea is to explore the unrevealed terrain and take over other neutral cities that you encounter.

Meanwhile, the computer player is doing the same. Eventually both parties will bump into each other. The game ends when one team's units have been destroyed, and all enemy cities have been taken over.


Wherever possible, I shall try to illustrate the concepts that I have learn't through the project and will specify all references that I have used. In most cases I will paraphrase the documentation. Any references to the specific implementation of Dark Empire will have to be kept to a minimum, as at this moment of time, I have no permission from the Author (David Bolton) to do so.

Why a Blog?

I realise the blog name Retro Conversion is not particularly exciting. Unfortunately, both Dark Empire and Dark Republic (the proposed title of the finished product) were taken (and annoyingly not in use).

Because of the diary format of the blog, it is ideal for maintaining a progress log. I am notorious for letting projects slip, and not documenting as I go along, so hopefully this will help to motivate me to the bitter end :)

The blog will also provide links to resources which I have found useful.

The Purpose of this Blog

When I was a kid, I owned a Spectrum + and +3. Arguably, 8 bit machines produced some of the most addictive, creative games. Why? Because these machines were equipped with limited graphics, memory and sound, every line of programming had to count.

The technology required to create these games was frustratingly elusive to the average user. Most computer books in the library focussed on Cobol and Fortran applications, or the application of computers in business. With the advent of the internet, and with improved library collection facilities, a larger variety of information is available.

As I mentioned earlier, the games on the 8-bit micros had their limitations. In some cases they were frustratingly slow, or didnt realise their full potential due to machine restrictions. If these games were moved to a larger machine, such as the PC, then maybe their full potential could be realised.

Through the development of DirectX, the programmer has been given a low level interface to PC hardware on a Windows Platform. The DirectX SDK (available for free from Microsoft) provides a collection of interfaces to communicate with the low level functionality of the graphics and sound cards.

The aim of this project is to convert a spectrum title, Dark Empire, to the PC and build upon it.