Hi Tom, On 22 November 2017 at 09:57, Tom Ehlert <t...@drivesnapshot.de> wrote: > as a side note: if gcc has no far pointers, its usability as a 16 bit > compiler is serious limited.
There is one now, finally, since T.K. Chia started working on the IA16 port in June. https://github.com/tkchia/gcc-ia16/ I managed to compile the FD kernel with it even with the crazy memory model. Some magic was involved. Results aren't stellar (the size is similar to Turbo C, i.e. ~80k uncompressed for 86 + FAT32; OW is closer to 70k), but I have been pestering the developer with bug reports and the compiler steadily improves. Notes: this works int __far *p; this does not work: int __far p; -- all accesses to p need to be wrapped using *MK_FP(DosDataSeg, &x) etc. It's just a macro, ie. DOSDATA(p) = 1; in the init code. Alternatively said: ia16-elf-gcc and binutils does not support OMF, only ELF, and therefore NO segment relocations, as ELF is flat. The kernel needs to compute the value of DosDataSeg at runtime and store it somewhere. A linker script can still create a kernel.exe with 0 relocations and a 32-byte custom header. void (__far *p)(void); -- kernel only uses very few of those. can use void __far *p and a little bit of asm to call a far function pointer. Also the compiler only understands cdecl and no pascal calling convention, so that meant quite a few changes to the asm interfaces -- simple work reverting the argument order and using ret instead of ret n. I'll submit the changes once the other compilers can compile it again :) I find it rather striking that after 17 years that Linux distributions have not been able to distribute FreeDOS and DOSEMU as free software in there base distributions because of a dependency on not-completely-free compilers somebody finally implemented far pointers in GCC. Bart ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel