Open source rewrite of the original Civilization game (1991) - OpenCiv1 Project

Maybe you know the answer to this @rahorvat but what is misc.exe? It seems to have been in a few Microprose games, and in the Civ media the file date is `1989-06-05` which predates the rest of the files by a lot.

Yes, these are just some shared utilities and/or functions. The CIV 1 actually seems to use only functions 2 and 3.
* Function 1 calls INT 16,1 - Get Keyboard Status (and returns 0 or -1 if a key is pressed)
* Function 2 calls INT 21,1 - Keyboard Input with Echo
* Function 3 calls INT 16,0 - Wait for Keypress and Read Character
* Function 4 reads BIOS 0x40:0x17 (Keyboard flag byte 0) and clears (right shift, left shift, CTRL and ALT key depressed status)
* Function 5 is same as function 4
* Function 6 reads Joystick / Game Port (0x201) status
* Function 7 reads Joystick position and button data
* Function 8 also reads Joystick position and button data but is different from function 7. Sorry, could not be bothered to analyze details ;)

If anyone want's to do any more digging, my CVL and EXE overlay specification is a way to go, off course if they didn't change the format at a later date ;)

Also there could be more utilities and/or functions based on a version of MISC.EXE

Cheers
 
don't worry about misc.exe, that file has been included in other Microprose games and just like mgraphic, egraphic etc. it was something Sid used on various titles before and after Civ. it would be nearly impossible for him and Bruce to create that game from scratch within a year.
oh btw: don't know how to break it you, but what you're doing has already been done. i have a working and playable game. bugs included. for research purposes. oops.
Well, don't know how to say this nicely than this, but why haven't you shared your work with others then?

My goal is to share the code with others and do a complete rewrite. I could have disassembled the game and said: Guys just use assembler to compile and that's that, but my goal is to transfer it to a more modern platform and language by not infringing on any copyright in the end :crazyeye:

Perhaps you can elaborate, is this a direct disassembly or a rewrite?

By rewrite I mean the new code that's working exactly as the original code.
I'm doing a complete rewrite, that's why it's taking so long to translate ;)

To comment on a MISC.EXE functions 2 and 3, they are already included in C library as getche() and getch(), but Sid Meier and/or Bruce Shelley used the template they used earlier as they worked together on the code. Also the internal copyright text is "MISCOVR.EXE 02-20-89".
 
Last edited:
Yes, these are just some shared utilities and/or functions. The CIV 1 actually seems to use only functions 2 and 3.

* Function 2 calls INT 21,1 - Keyboard Input with Echo
* Function 3 calls INT 16,0 - Wait for Keypress and Read Character
Amazing work! I assume it had to be some sort of shared library, but nice to know the actual facts of the situation.

but Bruce Shelley used the template they used earlier as they worked together on the code

Out of interest, how do you know it was Bruce and not Sid?
 
Hi everyone,
Sorry, but, I had to report a decent progress :smug:. I had managed to start the game, game save can be loaded by original DOS version and vice versa. But still have a problem with palette. For some reason colors are off in game window. Not all keys are mapped and usable. Also, you can see main and another two virtual screens that game uses, It's kinda funny to see how map is constructed... 🥳

Screen1.png
Screen2.png


Cheers
 
Nice job! I tried running it in Visual studio and I'm getting an exception thrown at
Code:
throw new Exception($"Unknown 0x21 interrupt 0x{this.oAX.High:x2}");
.
System.Exception: 'Unknown 0x21 interrupt 0x0a'
 
Nice job! I tried running it in Visual studio and I'm getting an exception thrown at
Code:
throw new Exception($"Unknown 0x21 interrupt 0x{this.oAX.High:x2}");
.

Hm,
I have tested the source on another machine without any CIV source and the code is working as expected.
The assumptions are:
- You are using VS2022 community version (don't know if this is important).
- You have fully functional (uncompressed latest exe version .05, see my decompressor from this thread) and installed CIV I at c:\dos\civ\ directory. It's where it's home directory resides (Images, palettes, overlays and save games are loaded/saved there, for now).

Check if you have the latest version from Git.

Also, I would like to know if this solved your problem and is working for you 😜
 
Last edited:
Hm,
I have tested the source on another machine without any CIV source and the code is working as expected.
The assumptions are:
- You are using VS2022 community version (don't know if this is important).
- You have fully functional (uncompressed latest exe version .05, see my decompressor from this thread) and installed CIV I at c:\dos\civ\ directory. It's where it's home directory resides (Images, palettes, overlays and save games are loaded/saved there, for now).

Check if you have the latest version from Git.

Also, I would like to know if this solved your problem and is working for you 😜
Ok thanks, it works now. I was working on older civ version. Keep it up and good luck.
 
Hi,
I have mapped all of the game keys, mouse works and have changed a lot of graphics code. There is also some bug when you click on terrain details (so, please don't click it :) ) it halts the game because it can't read the text from file properly. Will fix it later... (it's a very large function)

Cheers
 
  • Like
Reactions: axx
Moving units around, building a city, ... Looks cool so far. In a way what you're doing reminds me of devilution project.
Yes,
I looked at devilution project (interesting idea, all great minds think alike?), and it's kinda the similar idea. The d0c had this idea also, but his project unfortunately never took off.
I plan to:
  • reconstruct the code,
  • preserve original code as much as possible (for future reference),
  • and then to optimize code, fix bugs, add features and then,
  • publish it on a modern platform, with new graphic and music (so I don't violate any copyright laws 😮).
 
  • Like
Reactions: axx
Yes,
I looked at devilution project (interesting idea, all great minds think alike?), and it's kinda the similar idea. The d0c had this idea also, but his project unfortunately never took off.
I plan to:
  • reconstruct the code,
  • preserve original code as much as possible (for future reference),
  • and then to optimize code, fix bugs, add features and then,
  • publish it on a modern platform, with new graphic and music (so I don't violate any copyright laws 😮).
Brilliant! (I believe last two lines is what DevilutionX does for that project.)
Anyway it's nice to see some activity with bringing civ1 back to life, especially since progress on CivONE stopped.
 
Terrain details page is now working.
So, I'm cautiously saying that the code is in a playable condition!

There is sill a lot to do...

So, again, if someone is interested in this project to help me?

Will try to make an introduction to code, what is what, what needs to be done and such things... ;)
 
Last edited:
Terrain details page is now working.
So, I'm cautiously saying that the code is in a playable condition!

There is sill a lot to do...

So, again, if someone is interested in this project to help me?

Will try to make an introduction to code, what is what, what needs to be done and such things... ;)
Where do you need help/what needs to be done? I'm ok with C# but not so much with disassembly.
 
Where do you need help/what needs to be done? I'm ok with C# but not so much with disassembly.
Well,
that's a thing I need someone who knows assembly, at least at medium level to be able to translate assembly to C# counterpart.

I will make introduction to what needs to be done today/tomorrow, and how transcribing process should go so you'll have more info then.
 
  • Like
Reactions: axx
I was actually intending to go through this thread and analyze your code to get a better understanding of what you're doing.
I cracked a few simple programs with ollydbg 15 yrs ago, so I understand the concepts, but haven't been messing around with assembly much since then.
 
Top Bottom