Porting DOS games to modern platforms
Posted: Tue Jan 28, 2025 2:57 am
you mean this line?
should be changed to this?
Short guide: cicodis places stop(xyz) when not sure how some piece of code should be transformed. This internally triggers an assertion, so you need some IDE to debug it. Some games do not properly mark end of the function and cicodis continues disassembling the data part which follows. In this case you need to pass "-terminator 01ed:fb8f" as in https://github.com/gabonator/Projects/b ... es/cico.sh
Otherwise it should not crash on most real mode games (most games made before 1993). Please send me link to the game you are converting.
Finding the right flags: There is some recommended set of flags, e.g.
Load address is set to match how DOSBOX loads the game, so I can compare generated code side by side with dosbox debugger.
Finding the tables - simply run the game and wait util it reaches some "callIndirect" function. It should throw an assertion in Visual Studio, note down the segment and offset (arguments to callIndirect) and add to the commandline, keep adding missing methods until you will get something like . This is the slowest method, more efficient is to look at the code, understand the jump/call table and add some record like . First address is the address of indirect call, then the address of the table, number of entries, what kind of entries are stored there and which register is used as index. This might be a bit complicated at first, so I recommend the first approach.
To get more familiar with CLI interface, just look for cico.sh scripts in the https://github.com/gabonator/Projects/t ... it/gamelib folder
Code: Select all
cmake -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF -DCAPSTONE_X86_SUPPORT=ON ..
Code: Select all
cmake -G "MinGW Makefiles" -DCAPSTONE_BUILD_TESTS=OFF -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF -DCAPSTONE_X86_SUPPORT=ON ..
Otherwise it should not crash on most real mode games (most games made before 1993). Please send me link to the game you are converting.
Finding the right flags: There is some recommended set of flags, e.g.
Code: Select all
-load 01ed -ctx -reloc -segofscomment -stackguard -recursive start
Finding the tables - simply run the game and wait util it reaches some "callIndirect" function. It should throw an assertion in Visual Studio, note down the segment and offset (arguments to callIndirect) and add to the commandline
Code: Select all
-indirect 1234:5678
Code: Select all
-indirect 2da3:0cb7,2a41:0359,2188:3f13,2188:1fb9,2188:2850...
Code: Select all
-jumptable 1020:42e6 168f:6efb 30 callwords bx
To get more familiar with CLI interface, just look for cico.sh scripts in the https://github.com/gabonator/Projects/t ... it/gamelib folder