Sign in Join
Wiki copytemporary

Win16: what changed

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

OldNewLine
11## Overview
22
3-A Win16 cross compiler is currently being developed in FPC trunk (the development version). It targets Windows 3.0 or later.
3+A 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
9-The 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:
9+The 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
11-- the Open Watcom linker - WLINK
12-- the Open Watcom library manager - WLIB
13-- the Netwide Assembler - [NASM](http://www.nasm.us/)
11+ * the Open Watcom linker - WLINK
12+ * the Open Watcom library manager - WLIB
13+ * the Netwide Assembler - [NASM](<http://www.nasm.us/>)
1414
15-In 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.
15+In 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
19-- make sure **nasm**, **wlink** and **wlib** are in your path
20-- checkout fpc trunk:
19+ * make sure **nasm** , **wlink** and **wlib** are in your path
20+ * checkout fpc trunk:
2121
22-```text
23-git clone -b main https://gitlab.com/freepascal.org/fpc/source.git fpc
2422```
23+git clone -b main <https://gitlab.com/freepascal.org/fpc/source.git> fpc
24+```
2525
26-- 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):
26+ * 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):
2727
28-```text
29-make clean all OS_TARGET=win16 CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=-WmLarge BINUTILSPREFIX= PP=/usr/bin/ppc386
3028```
29+make clean all OS_TARGET=win16 CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=**-WmLarge** BINUTILSPREFIX= PP=**/usr/bin/ppc386**
30+```
3131
32-- 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):
32+ * 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):
3333
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"
3734```
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+```
3838
3939## Status
4040
41-The 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.
41+The RTL compiles. Note 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.
4242
43-Creating DLLs is not yet supported.
43+Creating DLLs is not yet supported.
4444
45-Even 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.
45+Even 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.
4646
47-Screenshot of fpctris, working under Windows for Workgroups 3.11:
47+Screenshot of fpctris, working under Windows for Workgroups 3.11:
4848
49-![](/wiki-images/8/8e/Fpctris_wfwg311.png)
49+[![fpctris wfwg311.png](/wiki-images/c/c0/fpctris_wfwg311.png)](</File:fpctris_wfwg311.png>)
5050
5151---
52-*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).*
53-Category: Cross compilation
54-Category: FPC
55-Category: FPC internals
56-Category: Operating Systems and Platforms
57-Category: Windows
52+*From the Free Pascal wiki, page "Win16", as the Internet Archive kept it on 2025-08-18, last changed on 2025-03-10. 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).*

Back to history