Fenyx4 / u4-decompiled

Decompiled source code for the PC version of Ultima IV - Quest Of The Avatar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lots of information/tools/remakes about "Ultima IV - Quest Of The Avatar" have been made, but so far, no one really gave an insight of the binary itself. To be more precise, of the executables of the PC version of the game (ported by James Van Artsdalen). There are two of them: AVATAR.EXE and TITLE.EXE

Basically, what I did is reverse engineer them to obtain a list of source files, that, when compiled and linked, produce new executables very close to the original ones (there are maybe 10 bytes difference for each executable).

Some of the source files are in assembly code. The biggest chunk is in C language, which means that it should be easier to read it. Of course, since this is a reverse-engineered from binary, files|variables|functions names were lost and I had to come up with new naming. I hope you like it.

Concerning the compiler, I used "Microsoft C Compiler 4.00". Which is certainly the version that was used to build the original game.

Very good remakes of the game exist already; this project is not intended to compete with them at all. Instead, interested people can take a look at the code to understand some algorithms, coding technics from another age, ...

I hope you enjoy browsing the code ! ergonomy_joe

Steps to compile with "Microsoft C Compiler 4.00"

  1. Download dosbox https://www.dosbox.com
  2. Launch dosbox
  3. Use Ctrl+F12 to speed up to ~15k cycles. It speeds up builds.
  4. MOUNT c "[Local-Directory]/SRC" e.g. MOUNT c "E:\projects\u4-decompiled\SRC"

  5. Download tools
    1. Go to https://www.pcjs.org/software/pcx86/util/other/unp/4.11/
    2. In the dropdown under the command prompt select "UNP (Executable Unpacker) Source"
    3. Click "Load" and then "Save"
    4. In the dropdown select "MS C 4.00 (Disk 1)"
    5. Rename downloaded file to MSC1.img
    6. In the dropdown select "MS C 4.00 (Disk 2)"
    7. Rename downloaded file to MSC2.img
    8. In the dropdown select "MS C 4.00 (Disk 3)"
    9. Rename downloaded file to MSC3.img
    10. In the dropdown select "MS Macro Assembler 3.00"
    11. Rename downloaded file to MASM300.img
    12. Go to https://winworldpc.com/product/borland-turbo-c/2x
    13. Download "Borland Turbo C 2.0 (3.5)"
    14. Extract disk2.img from download and place with other img files
  6. Extract tools
    1. mkdir C:\tools

    2. mkdir C:\tools\MSC400

    3. mkdir C:\tools\MASM300

    4. mkdir C:\tools\MASM300\LIB

    5. mkdir C:\tools\MASM300\INCLUDE

    6. mkdir C:\tools\turboc20

    7. mkdir C:\ORIGINAL

    8. MOUNT d "[Local Directory with img files]"

    9. imgmount a D:\UNP411~1.IMG -t floppy

    10. copy A:\UNP.EXE C:\TOOLS

    11. imgmount -u a

    12. imgmount a D:\MSC1.IMG -t floppy

    13. copy A:*.* C:\tools\MSC400

    14. imgmount -u a

    15. imgmount a D:\MSC2.IMG -t floppy

    16. copy A:\EXEPACK.EXE C:\tools

    17. imgmount -u a

    18. imgmount a D:\MSC3.IMG -t floppy

    19. copy A:*.* C:\tools\MSC400\LIB

    20. copy A:\LINK.EXE C:\tools\MSC400

    21. imgmount -u a

    22. imgmount a D:\MASM300.IMG -t floppy

    23. copy A:\LINK.EXE C:\tools\MASM300

    24. copy A:\LINK.EXE C:\tools

    25. copy A:\MASM.EXE C:\tools\MASM300

    26. imgmount -u a

    27. imgmount a D:\disk2.img -t floppy

    28. copy A:\MAKE.EXE C:\TOOLS\TURBOC20

  7. Build
    1. DOIT

About

Decompiled source code for the PC version of Ultima IV - Quest Of The Avatar


Languages

Language:C 76.0%Language:Assembly 23.8%Language:Batchfile 0.3%