(This post is part of a series on the subject of my hobby project, which is recreating the C source code for the 1989 game F-15 Strike Eagle II by reverse engineering the original binaries.)

As far as the code reconstruction is concerned, I’m stuck again. After completing several small routines, I encountered one which I can’t seem to write in a form that would match the original opcodes, due to a stray jmp short that I can’t replicate. It has happened before, so I shelved it and moved on, confident that I would likely get a bathroom epiphany sooner or later as has been the case thus far. I completed several more routines, then came upon one that I can’t make any sense of, again. It seems to have been compiled with optimizations turned on, and code motion came down hard on this one. Neither a goto-based mess which matches the layout of the instructions, nor a more reasonable (but reordered) implementation, nor cleaned up Ghidra-generated code did the trick this time.

It’s time for a change of pace, so I’m going to write about something more fun than dry assembly instructions, namely the game assets, specifically the static images that are used for the briefing/debriefing screens, as well as some in-flight graphics. Those are the .PIC and .SPR files:

ninja@RYZEN:451.03$ ls *.pic *.spr
1.pic        256rear.pic   adv.pic       dbicons.spr  hiscore.pic  libya.spr  persian.spr  title16.pic
2.pic        256right.pic  armpiece.pic  death.pic    jp.spr       me.spr     promo.pic    title640.pic
256left.pic  3.pic         ceurope.spr   desk.pic     labs.pic     medal.pic  rear.pic     vn.spr
256pit.pic   4.pic         cockpit.pic   f15.spr      left.pic     ncape.spr  right.pic    wall.pic

Some of these files are duplicated because the game can run in multiple graphics modes. For the VGA/MCGA adapter, the 256-color variants are used for the in-game flight graphics (all intro/briefing/debriefing graphics is 16 color only even for VGA). For the inferior (CGA/MDA) display types, I think the 16 color images are used and automatically scaled down in colors on the go.

  • 1/2/3/4.pic - not part of the actual game, they have to do with the slideshow demos included on the expansion disk. These seem to be using a different encoding scheme, but I don’t care about them really.
  • [256]left/[cock]pit/rear/right.pic are the 16- and 256-color variants of the cockpit views; front, left, right and rear (with the pilot’s head visible).
  • adv.pic - advertisement for other Microprose games displayed during the intro
  • title[16|640].pic - the title screen, including the credits in two variants - the 320x200, 16 color one, and one in high resolution (640x350, 16 colors)
  • ceurope/jp/libya/me/ncape/persian/vn.spr - the map screens used in the debriefing, where your flight route and destroyed targets are displayed.
  • dbicons.spr - icons used in the debriefing for events that occured during the mission (enemy plane shot down, ground target destroyed, F-15 hit etc.)
  • death/desk/medal/promo.pic - screens shown in the debriefing when the pilot has died, was moved to a desk job, got a medal or a rank upgrade
  • hiscore.pic - the “World’s Greatest F15 Pilots” selection screen where you pick your pilot.
  • labs.pic - the “MPS Labs” logo displayed during the intro
  • wall.pic - the stationary background used to show the mission selection and briefing, with the military guy pointing to the menu items with his hand.

That leaves us with two files that I think are the most interesting, namely armpiece.pic and f15.spr. The first is the different arm positions of the military guy used in the mission briefing, and interestingly also the icons with the medals etc. used on the pilot selection screen are placed here:

armpiece.pic

I haven’t seen some of the medals and the tombstone symbols used anywhere, guessing they are just leftovers from different things they were trying.

The second file, f15.spr is even more interesting because it contains the 2D sprites used for the cockpit graphics:

f15.spr

I’m guessing the lines and dots pattern must be the compass heading tape at the top of the HUD, the climb ladder or something like that. There’s also the radar symbology for hostile planes, SAMs, etc. Several small icons are used for the in-game map display. The explosion sprite is overlaid on top of a 3D target view in one of the MFDs when that target is hit. The real mystery is what appears to be the top of the pilot’s helmet (which to my knowledge never changes appearance in-game), and the linear sprite below that. And a “C:>” DOS prompt, what’s up with that? All in all, pretty neat!

Now, I have mentioned before that I’ve seen some of the PIC decoding code (apparently written in assembly) in START.EXE before. It had a lot of bit shifting and didn’t make much sense at first glance, so I did not dwell on it much. Based on online research, I was suspecting the encoding scheme to involve RLE with LZW compression, but didn’t check that hypothesis. In any case, I’m still focusing on reconstructing the C code, with the porting of the assembly routines to be handled later (how, I’m still not sure just yet).

So if I don’t know the decoding scheme, how am I able to look inside these images? Well, by cheating of course. The first image show by the game is the labs.pic Microprose logo, so if I rename a PIC/SPR file to that name and start the game, it will show me what’s inside and I can do a screen capture in DosBox. Sometimes, the colors will be off (especially for the 256 color images) because the game uses different palettes for some of the images, but not so much as to make the image unrecognizable.

In an even more fortunate turn of events, a certain talented individual had become interested and taken it upon himself to decode the elusive PIC format, across its apparent multiple incarnations over the evolution span of Microprose games from that era. He was kind enough to also write down his experiences in doing so, and I highly recommend reading a series on it on his blog. Better yet, this might lead to a functional encoder, letting us replace the images and do some basic modding of the game. Exciting times!

What that will mean for the reconstruction project, I’m not yet sure. I’m not too tied to the idea of faithfully recreating the assembly routines if I don’t need to, so perhaps it will save me work from rewriting the PIC decoder mess into C. Or maybe I will need to do that anyway, who knows. In any case, I’m happy and grateful to CanadianAvenger for this effort, and excited to have gotten this insight into the actual game assets. It gives me a kick, and I can only imagine what it will be like when we can unpack and view the 3D models in high res… then replace them with better ones… Yowza!

Now if I can only figure out how to get these goddamn assembly opcodes to match…