GCC has -mrtd but the args are pushed in reverse versus PASCAL. So asm routines have to use macros to obtain the stack arguments. For the complex call_nls assembly, revert the arguments in C using a preprocessor macro.
The resulting kernel and sys.com do not work yet (kernel prints 123 only). Some functions in sys.com are placeholders.