Sign in Join
Wiki copytemporary

Win16: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Overview
22
33A Win16 cross compiler is currently being developed in FPC trunk (the development version). It targets Windows 3.0 or later.
44
55## Requirements
66
77### FPC trunk
88
99The compiler is a cross compiler that runs at least on Windows (both x86 and x64), Linux, and Mac OS X. For compiling programs, it needs:
1010
1111- the Open Watcom linker - WLINK
1212- the Open Watcom library manager - WLIB
1313- the Netwide Assembler - [NASM](http://www.nasm.us/)
1414
1515In theory it should be able to run on any platform, supported by FPC, where NASM and the Open Watcom tools are available. This includes DOS via the GO32V2 extender. However, because the Watcom tools for DOS are compiled with a different extender, there are some issues related to long file names and the passing of long command line arguments.
1616
1717### Building a snapshot manually
1818
1919- make sure **nasm**, **wlink** and **wlib** are in your path
2020- checkout fpc trunk:
2121
22-`git clone -b main `[`https://gitlab.com/freepascal.org/fpc/source.git`](https://gitlab.com/freepascal.org/fpc/source.git)` fpc`
22+```text
23+git clone -b main https://gitlab.com/freepascal.org/fpc/source.git fpc
24+```
2325
2426- enter the fpc directory and build the compiler with the following command (replace **/usr/bin/ppc386** with the full path to the stable (3.0.4) FPC compiler binary; replace **-WmLarge** with **-WmMedium**, **-WmCompact** or **-WmSmall** if you want to use another memory model, although using **large** is recommended):
2527
26-`make clean all OS_TARGET=win16 CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=`**`-WmLarge`**` BINUTILSPREFIX= PP=`**`/usr/bin/ppc386`**
28+```text
29+make clean all OS_TARGET=win16 CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=-WmLarge BINUTILSPREFIX= PP=/usr/bin/ppc386
30+```
2731
2832- install the snapshot (replace **linux** and **i386** with the OS and CPU you're using; replace **INSTALL_PREFIX** with the directory you want the snapshot installed):
2933
30-`make crossinstall OS_SOURCE=`**`linux`**` CPU_SOURCE=`**`i386`**` OS_TARGET=win16 CPU_TARGET=i8086 PP=compiler/ppcross8086 CROSSOPT=`**`-WmLarge`**` \`\
31-`    BINUTILSPREFIX= INSTALL_PREFIX=`**`/home/blablabla/fpc-i8086/snapshot-win16/large`**` OPT="-CX -XXs"`
34+```text
35+make crossinstall OS_SOURCE=linux CPU_SOURCE=i386 OS_TARGET=win16 CPU_TARGET=i8086 PP=compiler/ppcross8086 CROSSOPT=-WmLarge \
36+ BINUTILSPREFIX= INSTALL_PREFIX=/home/blablabla/fpc-i8086/snapshot-win16/large OPT="-CX -XXs"
37+```
3238
3339## Status
3440
3541The RTL compiles. Not that not all packages work in memory models, other than **large** or **medium**. This is because, currently the **small** and **compact** memory models don't support generating far procedures (the *far* directive is ignored in these models), and that's what the Win16 API expects to use for callback functions. The RTL supports long file names when run under Windows 95+/2000+. The **dos** unit works (unlike Borland Pascal 7, it is still called **dos** and not **windos**). Most of the core win16 api is available through the **wintypes** and **winprocs** units, similarly to Borland Pascal 7. The **win31** unit is also available, providing support for the extra APIs, added in Windows 3.1. The **crt**, **video**, **keyboard** and **mouse** units compile and work (although there's no mouse supported implemented yet), by providing an emulated text console (since Win16 applications can be GUI only). Note that **crt** is also called **crt** (and not **wincrt** like in BP7). FPC demo program *fpctris* works. *Samegame* should also work, as soon as mouse input support is added to the kvm units. **FV** (*Free Vision*) also compiles and mostly works, but is not well tested and may have bugs. The **sysutils** unit compiles, but does not yet work. The **graph** unit is **not** yet implemented. However, the **objects** and **objpas** units are available and work.
3642
3743Creating DLLs is not yet supported.
3844
3945Even though created EXE files are marked to support Windows 3.0 real mode, the real mode support is not stable yet (it needs all functions, including internal ones to be exported, which is not yet implemented). Therefore, running under protected mode Windows is highly recommended.
4046
4147Screenshot of fpctris, working under Windows for Workgroups 3.11:
4248
4349![](/wiki-images/8/8e/Fpctris_wfwg311.png)
4450
4551---
4652*From the Free Pascal wiki, page "Win16", as it stood on 2023-11-10 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
4753Category: Cross compilation
4854Category: FPC
4955Category: FPC internals
5056Category: Operating Systems and Platforms
5157Category: Windows

Back to history