Win16: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Win16
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Overview | |
| 2 | + | ||
| 3 | + | A Win16 cross compiler is currently being developed in FPC trunk (the development version). It targets Windows 3.0 or later. | |
| 4 | + | ||
| 5 | + | ## Requirements | |
| 6 | + | ||
| 7 | + | ### FPC trunk | |
| 8 | + | ||
| 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: | |
| 10 | + | ||
| 11 | + | - the Open Watcom linker - WLINK | |
| 12 | + | - the Open Watcom library manager - WLIB | |
| 13 | + | - the Netwide Assembler - [NASM](http://www.nasm.us/) | |
| 14 | + | ||
| 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. | |
| 16 | + | ||
| 17 | + | ### Building a snapshot manually | |
| 18 | + | ||
| 19 | + | - make sure **nasm**, **wlink** and **wlib** are in your path | |
| 20 | + | - checkout fpc trunk: | |
| 21 | + | ||
| 22 | + | `git clone -b main `[`https://gitlab.com/freepascal.org/fpc/source.git`](https://gitlab.com/freepascal.org/fpc/source.git)` fpc` | |
| 23 | + | ||
| 24 | + | - 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): | |
| 25 | + | ||
| 26 | + | `make clean all OS_TARGET=win16 CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=`**`-WmLarge`**` BINUTILSPREFIX= PP=`**`/usr/bin/ppc386`** | |
| 27 | + | ||
| 28 | + | - 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): | |
| 29 | + | ||
| 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"` | |
| 32 | + | ||
| 33 | + | ## Status | |
| 34 | + | ||
| 35 | + | 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. | |
| 36 | + | ||
| 37 | + | Creating DLLs is not yet supported. | |
| 38 | + | ||
| 39 | + | 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. | |
| 40 | + | ||
| 41 | + | Screenshot of fpctris, working under Windows for Workgroups 3.11: | |
| 42 | + | ||
| 43 | + |  | |
| 44 | + | ||
| 45 | + | --- | |
| 46 | + | *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).* | |
| 47 | + | Category: Cross compilation | |
| 48 | + | Category: FPC | |
| 49 | + | Category: FPC internals | |
| 50 | + | Category: Operating Systems and Platforms | |
| 51 | + | Category: Windows |
