I ran into a few tricky issues getting this code to compile and run correctly on x86. I've resolved them in this PR.
1) Lacking a BLISS compiler, I rewrote the wrapper code that converts the $message and $message_indent calls to pass the arguments as a list to the Pascal implementations. On non-VAX, the compiler has to make a fake argument block to pass to the callee since the first 6 arguments are passed in registers. I figured out what the original MACRO-32 code must've looked like and wrote my own version to use in place of the BLISS version, which was itself rewritten from MACRO-32. It looks like the game code uses up to 9 params for $message calls and up to 7 params for $message_indent calls, but I set MAX_ARGS to 10 for both wrappers to be on the safe side.
2) Hacked zk/zklink_time.pas to never print a negative number for version, which caused a build failure for me. I haven't looked yet to see why it calculated -48 for the version.
3) The bug that caused me the most grief was messages like the sign in the first room not printing. I saw "The sign reads:" and then nothing. My first commit was to remove pairs of "0, 0" params in the $message lines that had those, which caused the sign to start printing, but I realized those "0, 0" pairs were supposed to print a blank line. It turns out the VSI Pascal compiler is generated bad code when you use the optional parameters feature ("truncate"). The shortest fix was to modify the one call to put_scroll_dx with no parameters (the one to print a blank line that was failing) to pass all three parameters, with an empty descriptor.
I ran into a few tricky issues getting this code to compile and run correctly on x86. I've resolved them in this PR.
1) Lacking a BLISS compiler, I rewrote the wrapper code that converts the $message and $message_indent calls to pass the arguments as a list to the Pascal implementations. On non-VAX, the compiler has to make a fake argument block to pass to the callee since the first 6 arguments are passed in registers. I figured out what the original MACRO-32 code must've looked like and wrote my own version to use in place of the BLISS version, which was itself rewritten from MACRO-32. It looks like the game code uses up to 9 params for $message calls and up to 7 params for $message_indent calls, but I set MAX_ARGS to 10 for both wrappers to be on the safe side.
2) Hacked zk/zklink_time.pas to never print a negative number for version, which caused a build failure for me. I haven't looked yet to see why it calculated -48 for the version.
3) The bug that caused me the most grief was messages like the sign in the first room not printing. I saw "The sign reads:" and then nothing. My first commit was to remove pairs of "0, 0" params in the $message lines that had those, which caused the sign to start printing, but I realized those "0, 0" pairs were supposed to print a blank line. It turns out the VSI Pascal compiler is generated bad code when you use the optional parameters feature ("truncate"). The shortest fix was to modify the one call to put_scroll_dx with no parameters (the one to print a blank line that was failing) to pass all three parameters, with an empty descriptor.
With these changes, now I can play ZK.