Hello there, I am new here on this forum

. I tried out to compile this SCI32 source code with varying results

. The code is from an early C++-Era. One needs to correct a lot of grammar failures first wenn you want to compile this on the latest (1.9) OpenWatcom-Version. I managed to fix all the error messages but still didn't get it to work with OW v1.9. It seems to work however on early versions of Watcom C++ (10.6) and MASM 6.11. Testing with the Watcom Debugger I found out that the code crashes directly after running the opcode pseudo-machine. I managed to get both the debug version with the opcode debugger and the normal version compiled.
In the c++ version of the pmachine there was a lot of inline assembly code inserted which resulted stack balance errors wenn trying to run the code. They optimized the pmachine by making inline assembly jumping statements to other parts of the program out of control of the compiler. The problem with hidden jumping to other c++code positions without the compiler knowing is that you can't be sure it clears the stack propery and jumps back to the correct position.
One can see that the code was written in a transition period moving from C to C++ language. Some stuff like const values without type specifiers are not allowed anymore in modern C++ language. The used #define statements to implement template-like functionality. It must have been very hard for the original team to develop this code. in the win3.1 and win95 it was probably not easy to debug 32-bit dos protected mode applications. People had to do with a lot of system crashes. The code had to be fast and efficient also. They of course had no other choice then to implement some stuff with assembly code. There were probably also difficulties with implementing audio drivers and stuff under protected mode. I tend to prefer however the readable C-style-code like used in the game Doom of the time era and which is more easy to port to other platforms and compilers.
I got the pmachine to work again by removing this code and translating the assembly-code-optimized version in plain traditional C-code. The only game it seems to work with is Space Quest 6. The Adlib music is flawlessly. The only problem I still have is with the audio samples. These play way to slow wit a low of clicking. There seems to be a problem with updating the sound buffers which are sent to the soundcard. The Watcom debugger is not that good compared to modern day options and it is often losing track and displaying the false source code while running, perhaps I should try with Dosbox-Debugger an IDA Pro 5.0 like the scummvm dudes do.
There perhaps is too much of the legacy stuff in this code to use it as a base for further development. It may be more efficient to rewrite a SCI32 interpreter from ground up with modern stuff. There is however room for cool hacks like:
- changing the Pmachine to a Lua-interpreter
- Writing the game logic directly in C/C++ which can be loaded dynamically and interfaces with the kernel api
- Improve sound support, like supporting AC97 in dos mode
- Adding a proper SB16 driver with high samplerate support and auto-initializing DMA
- Adding support for modern day picture format like .PNG . GIF etc.
- improved midi support and synth emulation
- Adding a classic sierra text parser back
Greetz from Mr. Fox