DOS-C is designed to be portable. This takes careful design and planning, but when you plan ahead portability becomes a simple task. It also helps you create better code.
There are three aspects to porting the kernel to multiple platforms. First, there's byte order. This is handled by src/fs/syspack.c, globals.h and all the fs code. Here, the byte order of all disk structures fundamental types (i.e., int, long, etc.) is handled by a preprocessor switch (NATIVE) that either defines macros that perform simple assignments or functions that perform the correct switch. These macros/functions are used throughout the fs code so that no assumptions is made regarding byte order.
Second, there are transparent types. Some operating systems, such as UNIX, handle this by typedefs such as size_t, dev_t, etc. I chose to use a similar approach, but I found that I had to modify it not only for transparent types but for segmented 8086 architectures. You'll find this in hdr/portab.h.
Third is the system call interface. The actual functions that correspond to each system call use C calling conventions. For FreeDOS, I chose to use an interrupt C function (see src/kernel/inthndlr.c) that takes advantage of the typical DOS C compiler (i.e., Borland and Microsoft) interrupt function stack frame and use a switch statement to decode the call number and the case statements as the interface to the C functions. In other architectures, this existed as a single entry dispatcher in the microkernel versions and as pointers to user space stacks in monolithic kernels.
A hidden part to the third interface is device driver call interface. For FreeDOS, this is an assembly language routine that obeys MS-DOS device driver conventions. In other architectures, this is a C function that interfaces a monitor or task manager and suspends/resumes activity based on device completion.
I started the design with platform independence in mind and I continue this design goal. As it turns out, I usually add new features first and then inspect the code and make changes in a later sequence or maintenance release. As of this moment, the code for v0.92.1 has been modified and I am currently testing the portability changes on an 80486 (Dell Precision 486DX2/50) 32-bit platform and alpha (DIGITAL Multia) 64-bit platform. When I'm done, I will announce the new release.
Please note that these are not complete kernels but simulations that run under linux.
I also started a C API in COMMAND.COM. You'll find this code in src/command/doslib.c. It is a preliminary definition and is subject to change as I migrate FreeDOS after v1.0.
If you want to know more about the kernel design, you can refer to my book where I go into much more detail regarding the interface layers and kernel "modules."