
Finding the Lost Vikings – Reversing a Virtual Machine - jsnell
https://ryiron.wordpress.com/2017/02/01/finding-the-lost-vikings-reversing-a-virtual-machine/
======
_halgari
Fun fact: The Lost Vikings was created by Silicon Synapse. They were later
renamed "Blizzard Entertainment" and went on to make Warcraft/Starcraft. The
Vikings are now featured in Blizzard's game Heroes of the Storm:
[http://us.battle.net/heroes/en/heroes/the-lost-
vikings/](http://us.battle.net/heroes/en/heroes/the-lost-vikings/)

~~~
PhasmaFelis
And you can download the original for free, along with a couple of other
Blizzard classics:
[https://us.battle.net/account/download/?show=classic](https://us.battle.net/account/download/?show=classic)

~~~
csense
Whoa, this is awesome!

------
douche
It's really kind of cool how many of these old games were built on top of
their own custom vms.

Of course there is the Infocom Z-machine, going way back, that made porting
between all the different microcomputers of that era somewhat easier. Another
interesting writeup of this kind of an architecture is for Another World [1].
Along those lines, I wonder in the case of The Lost Vikings, how much of the
game code was able to be reused between the different platforms it was
released on (SNES, Genesis, PC, maybe Mac, I don't remember?)

[1]
[http://fabiensanglard.net/anotherWorld_code_review/index.php](http://fabiensanglard.net/anotherWorld_code_review/index.php)

~~~
digi_owl
I suspect the mix of CPUs in use back then had an impact.

After all, you had the 6502, Z80, 68000, and various x86 generation all
bouncing around (the 486 was introduced in 1989, this game was released in
1993).

The Sega Genesis/Mega Drive for example had both a 68000 and a Z80 inside it,
while the SNES used a 6502 clone.

~~~
vertex-four
The Mega Drive's Z80 was essentially just powerful enough to play music and
sounds - it couldn't really be used for much else, leaving the 68k to focus on
gameplay and manipulating the sprite-based Video Display Processor.

~~~
boomlinde
Only relatively speaking. The MD runs the games of the previous generation
(Master System) natively on the Z80. The hardware of the MD, including the VDP
and audio, is basically a superset of that of the MS.

~~~
vertex-four
While true, people expected better audio out of the Genesis than the Master
System, which involved more processing power.

------
Peaker
Why did they write their own VM?

Was it sort of a write-once, run everywhere thing? So they can reuse the game
code on various platforms?

~~~
groby_b
Having written games back in that time, I can at least tell you why I wrote my
own VM: You get a custom language/compiler, which makes iteration time
_significantly_ faster than recompiling your game yet again, for yet another
tiny tweak.

Or, worse, writing every bit of your game in assembly. (Worse in the sense of
time consumed. In the sense of fun had, the VM approach takes some of that
away ;)

~~~
ryiron
This is the impression I get from reversing it: the virtual machine mostly
assists quickly porting to other platforms.

I previously reversed another game engine called Comprehend (for 1980s
text/graphical adventure games) which also had a VM. I ended up talking with
one of the original developers, who said that portability was a major reason.
Their company wrote the original Apple 2 implementation, and then contracted
development for the other platforms out, so they just provided specs for the
VM. The Lost Vikings development may have been similar.

In the Lost Vikings the VM implementation was almost certainly written in
assembler. There are various tricks used in the binary which I don't think
compilers of the day were capable of. The other parts of the game also appear
to have probably been written in assembler, which I think is interesting since
it was developed quite late in the DOS era.

------
owlninja
Cool article and great game! Here is a video of someone doing a speedrun using
two controllers at once:
[https://www.youtube.com/watch?v=5LkoTGv2z6E](https://www.youtube.com/watch?v=5LkoTGv2z6E)

~~~
JustSomeNobody
Looks like Joel Spolsky in the second row behind the gamer (after he moves).

------
caf
I spent most of a Sydney-Vancouver flight rediscovering this game on the
seatback IFE (AirCanada used to have a SNES emulator of some sort in their
setup).

------
ayuvar
This kind of closes the loop on an interview I read a long time ago in a
magazine.

When Blizzard went to make the Mac (System 7) port of Warcraft 1, the guys
that were interviewed about it mentioned that the port was relatively easy
because the game code was relatively insulated from the OS and all they had to
do was update the OS-side code and keep the game logic running in "a thread."
(their words)

Probably this virtual machine model was continued at least to Warcraft 1,
which makes a lot of sense for a shop that was used to doing console ports of
their PC titles at the time.

------
ryiron
Thanks to whoever posted this, and glad that people are enjoying a little bit
of DOS games nostalgia. The tools I've developed (also linked in the blog
post) are all public domain if anybody wants to play around with them:
[https://github.com/RyanMallon/TheLostVikingsTools](https://github.com/RyanMallon/TheLostVikingsTools)

------
pjmlp
So many hours wasted playing this game! :)

Thanks for the article.

------
jeff_harris
Great writeup!

