https://github.com/tesneddon/zk
I ran into one problem building it on x86: the lack of public availability of a BLISS compiler. There's exactly one source file written in BLISS (converted from MACRO-32, the version I would've preferred to have):
Code: Select all
%TITLE 'IFC$RTL_MACRO - IFC Run-Time System code in BLISS'
MODULE IFC$RTL_BLISS(IDENT = 'X01.00-00'
%IF %BLISS(BLISS32V) %THEN
,ADDRESSING_MODE(EXTERNAL = GENERAL)
%FI
) =
BEGIN
!
! Edit History:
! 13-Sep-2009 TES Converted the MACRO-32 module to BLISS.
!
!
GLOBAL ROUTINE IFC$MESSAGE : NOVALUE =
BEGIN
EXTERNAL ROUTINE
IFC$MESSAGE_LIST : NOVALUE;
BUILTIN
ARGPTR;
IFC$MESSAGE_LIST(ARGPTR());
END;
GLOBAL ROUTINE IFC$MESSAGE_INDENT : NOVALUE =
BEGIN
EXTERNAL ROUTINE
IFC$MESSAGE_INDENT_LIST : NOVALUE;
BUILTIN
ARGPTR;
IFC$MESSAGE_INDENT_LIST(ARGPTR());
END;
END
ELUDOM
Code: Select all
[asynchronous, external(ifc$message)] function $message(
%immed message_codes : [list] unsigned) : unsigned;
extern;
[asynchronous, external(ifc$message_indent)] function $message_indent(
%immed message_codes : [list] unsigned) : unsigned;
extern;
Code: Select all
type ...
$message_args = array[0..30] of integer;
[global] function ifc$message_indent_list(
ap : $message_args) : unsigned;
var i, fao_count, column : integer;
message_code : unsigned;
begin
...
end;
[global] function ifc$message_list(
var ap : $message_args) : unsigned;
var i, fao_count : integer;
message_code : unsigned;
begin
...
end;
I tried to write some C functions to manually loop through va_list and copy the va_count and parameters into a list to pass to the implementation functions, and amazingly got ifc$message() to mostly work, but the indented messages, which I assume are going through ifc$message_indent(), aren't printing. So when I try to read objects in the game, it says "The sign reads:" and then nothing.
What would be the preferred way to do this Pascal variable argument hackery in an x86-friendly way? Can the wrappers be written efficiently in C with compiler intrinsics? Is the original MACRO-32 version available, and if so, would that actually be the shortest way to do the wrapper? Or can someone with expertise in this wizardry supply such a wrapper from the BLISS version? Thanks!