The Lords of Midnight: DOS & Z80 disassembly

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

The Lords of Midnight: DOS & Z80 disassembly

Post by mrcook »

Hot on the heels of my last project, here's a disassembly of both the PC DOS and ZX Spectrum versions of The Lords Of Midnight (ID #6604).

Github: https://github.com/mrcook/lords-of-midnight-disassembly

I guess there's not much to say about the game - you all know of it - and tbh, Chris Wild released a large potion of the DOS source code, so basically, I stole that and just added a few extra bits.

Still, I think it's interesting to see how similar the DOS / Z80 versions of the game are, though I suppose as the DOS version is an almost byte-for-byte conversion, that's to be expected -- here's Chris' notes (at icemark.com) on the conversion process.

One caveat is that I've not yet tried building a binary from either ASM, so perhaps there's still some work to be done there.

P.S. I think I'm done with disassemblies now -- enough is enough. I do though have dreams of writing a program to do this automatically for speccy games....one day!
Wall_Axe
Manic Miner
Posts: 500
Joined: Mon Nov 13, 2017 11:13 pm

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by Wall_Axe »

are there any comments, like morkin can only do this if this
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by mrcook »

Basically just general high level stuff:

* Is it Night
* Is It Dawn
* Any of DoomDarks Army Here?
* Are we Hidden?
* Anything in this location?
crabfists
Drutt
Posts: 29
Joined: Tue Sep 20, 2022 11:52 am

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by crabfists »

Good work on the disassembly! I've enjoyed browsing your work online. It would be a shame to see you stop.

Have you considered using the Spectrum Analyser tool? It's drastically improved my progress on doing disassemblies. The end result can be the same, as it supports exporting to skoolkit format.

https://colourclash.co.uk/spectrum-analyser/

We setup a Discord server to talk about reverse engineering speccy games. You are welcome to come and join us :)
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by mrcook »

Thanks for the kind words crabfists.

I remember the tool when you first released it. Loved the concept but I struggled to get it running at the time. I tried again earlier this year and was sort of able to get it running, but it still didn't play well with macos.

I find disassembly work to be very repetitive from a keyboard/mouse usage perspective, and alas that just kills my fingers. Because of the DOS source code, this project was pretty easy -- less than 2 weeks -- yet even after just this short amount of time, my fingers are now in a bit of pain -- yup, I'm an old man!

Reverse engineering is definitely a young persons game :P :P
pobtastic
Drutt
Posts: 32
Joined: Fri May 29, 2020 8:21 pm
Location: United Kingdom

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by pobtastic »

mrcook wrote: Tue Nov 28, 2023 8:56 pm Reverse engineering is definitely a young persons game :razz: :razz:
I hope not! :lol:
mrcook wrote: Mon Nov 27, 2023 4:52 pm P.S. I think I'm done with disassemblies now -- enough is enough. I do though have dreams of writing a program to do this automatically for speccy games....one day!
I'm very sad to hear this, I've loved your disassemblies too - if anything, I've always been quite inspired by yours and the way you write things up.

About automation ... I've kind of done this myself, I have a few scripts I use now for both generating the files/ folders for holding the code and for producing the commented control files. It does tend to make the output a little "dry" though ... but it's great for a first draft, and then I'll go over it and update the comments to be a bit more explanatory and add some block comments and labels etc. Happy to give you access to my drafts repo if you want to have a look?
catmeows
Manic Miner
Posts: 718
Joined: Tue May 28, 2019 12:02 pm
Location: Prague

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by catmeows »

@mrcook I wonder, since you mentioned DOS version closely follows z80 version, what are yours feeling about 86 instruction set when you compare it to Z80 ?
Proud owner of Didaktik M
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by mrcook »

pobtastic wrote: Wed Nov 29, 2023 12:35 pm ...I've loved your disassemblies too - if anything, I've always been quite inspired by yours and the way you write things up.
Thanks awfully !
pobtastic wrote: Wed Nov 29, 2023 12:35 pm About automation ... I've kind of done this myself, I have a few scripts I use now...Happy to give you access to my drafts repo if you want to have a look?
I appreciate the offer but for now I need to get back to my main side-project --- I needed a bit of a break so LOM was a nice diversion :)

I've been following your work (good stuff btw :- ) and it was quite obvious you'd put together some tool. Perhaps if I wait long enough you'll have developed it into the thing I've been thinking about :) Now that Skoolkid Richard has produced that tsfiles repository we've much easier access to the tape contents, so it's ripe for some automation.
mrcook
Drutt
Posts: 46
Joined: Tue Jun 09, 2020 7:31 pm

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by mrcook »

catmeows wrote: Wed Nov 29, 2023 12:48 pm @mrcook I wonder, since you mentioned DOS version closely follows z80 version, what are yours feeling about 86 instruction set when you compare it to Z80 ?
TBH I don't really have much of an opinion. I'm not actually super experienced in assembly and one is as much the same as the other to me. :)
crabfists
Drutt
Posts: 29
Joined: Tue Sep 20, 2022 11:52 am

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by crabfists »

mrcook wrote: Tue Nov 28, 2023 8:56 pm I remember the tool when you first released it. Loved the concept but I struggled to get it running at the time. I tried again earlier this year and was sort of able to get it running, but it still didn't play well with macos.
It's not my tool actually. I'm just helping out with releases and stuff. I'm also working on the cpc version.
mrcook wrote: Tue Nov 28, 2023 8:56 pm I find disassembly work to be very repetitive from a keyboard/mouse usage perspective, and alas that just kills my fingers. Because of the DOS source code, this project was pretty easy -- less than 2 weeks -- yet even after just this short amount of time, my fingers are now in a bit of pain -- yup, I'm an old man!
I feel you. If I go at it too hard my body ends up regretting it and I have to take a step back for a while. I feel old sometimes too! Hopefully you can find a balance so you can continue with the reverse engineering.
User avatar
ketmar
Manic Miner
Posts: 713
Joined: Tue Jun 16, 2020 5:25 pm
Location: Ukraine

Re: The Lords of Midnight: DOS & Z80 disassembly

Post by ketmar »

catmeows wrote: Wed Nov 29, 2023 12:48 pm @mrcook I wonder, since you mentioned DOS version closely follows z80 version, what are yours feeling about 86 instruction set when you compare it to Z80 ?
i wasn't asked, but i have the opinion! ;-) 16-bit x86 is bearable. 32-bit x86 is a masochistic nightmare. 64-bit x86 is a nightmare of a masochistic nightmare. just try to write an assembler for all of them, and you'll see for yourself. i recently wrote 32-bit x86 assembler, and it wasn't fun expirience at all.
Post Reply