Turbo Pascal overlays (overleden? ha!) (Announce)
> > Maybe TP55 included some example code for it, I think?
Yes, it has OVRDEMO*.PAS, but that's fairly minimal.
I gleaned some useful info from Franz Glaser's old website.
> There is an overlay chapter in SWAG.
There might be a unit that loads overlays to XMS in there. (Default is conventional or EMS only.) Haven't checked closely. Most people in DOS these days already have XMS loaded (286+). EMS isn't super rare (especially EMM386), but I never load it by default anymore.
> DXE is slightly different since afaik DXE can be created using separate
> generation. IOW it can be used to create plugins for already existing
> (compiled) programs.
DXEGEN just uses an *.O file. TPC.EXE generates the .OVR from specified units (*.TPU) and main program (main .PAS). It also needs/forces far calls (intra-unit? across units they were always far, AFAIK).
> Afaik the 16-bit dos maintainers mainly has demo compos as usecase, and
> overlays overall increase binary size
TP 5.5 is much smaller output than FPC (but also weaker, of course). It's probably a bad idea to use proprietary, compiler-specific (overlay) code, if it can be avoided. Smartlinking helps, of course.
Okay, so here's the deal:
Just to play around, I have a small project that is nine files (8 units and one main .PAS), not even 600 lines total. It doesn't use the heap at all (so uses roughly 33 kb of memory). The generated .EXE is about 15 kb (uncompressed). I'm using TP 5.5's OOP, so I can easily avoid using four of five units if I don't need that extra functionality (just don't use or declare those objects in main). So that part won't get linked in, and that can save me (up to) roughly 10 kb on the .EXE. That's the best, most portable way, I think (rather than relying on old TP-only overlays). That much is confirmed to work fine on various TP-compatible compilers.
However, with TP 5.5, I can make four of those units into an overlay. The .OVR is about 6 kb and the main .EXE will be about 9 kb. No, it's not mandatory, two of the five objects' functionality won't need the functions in the overlay. So I can still partially run that .EXE without the .OVR found, if I'm careful. BTW, using an overlay literally only saves me 2 kb of memory here! Also, UPX won't compress the .OVR (not sure about PKlite or whatever else). You could almost pretend .OVR is a .DLL here, but it's not worth it. The overlaid (subset) main .EXE (two units' functionality), if compressed by UPX, is slightly larger than the (full) .EXE from before (five units' functionality, when using no overlays)!
Probably not a great example use for overlays, but I tried anyways. (I don't know OOP "design patterns" at all.) It could definitely be a useful feature, but not so much here. (Remember I rebuilt old NASM 0.98.39 with Turbo C++ 1.01? I assume NASM's preprocessor would make a great overlay since you only need it at the beginning. But I have no idea how to fix that yet. I still need to read the physical manuals there.)
P.S. By coincidence, it's Niklaus Wirth's birthday. Happy 86th!
Complete thread:
- MSA assembler released under MIT - DosWorld, 10.11.2019, 13:44 (Announce)
- MSA assembler released under MIT - tom, 10.11.2019, 19:00
- MSA assembler released under MIT - DosWorld, 12.11.2019, 14:42
- MSA assembler released under MIT - Rugxulo, 15.11.2019, 03:24
- MSA assembler released under MIT - DosWorld, 15.11.2019, 16:38
- MSA2 and TP7 overlays - Rugxulo, 02.12.2019, 20:47
- MSA2 and TP7 overlays - marcov, 03.12.2019, 16:37
- MSA2 and TP7 overlays - Rugxulo, 04.12.2019, 03:59
- MSA2 and TP7 overlays - marcov, 04.12.2019, 10:41
- Turbo Pascal overlays (overleden? ha!) - Rugxulo, 16.02.2020, 03:48
- Turbo Pascal overlays - Rugxulo, 18.02.2020, 03:03
- Turbo Pascal overlays & NASM Preprocessor - ecm, 05.03.2020, 16:42
- Turbo Pascal overlays (overleden? ha!) - Rugxulo, 16.02.2020, 03:48
- MSA2 and TP7 overlays - marcov, 04.12.2019, 10:41
- MSA2 and TP7 overlays - Rugxulo, 04.12.2019, 03:59
- MSA2 and TP7 overlays - rr, 03.12.2019, 21:34
- MSA2 and TP7 overlays - Rugxulo, 14.12.2019, 13:28
- MSA2 and TP7 overlays - rr, 14.12.2019, 23:42
- MSA2 and TP7 overlays - marcov, 15.12.2019, 21:07
- MSA2 and TP7 overlays - Rugxulo, 16.12.2019, 19:15
- MSA2 and TP7 overlays - marcov, 15.12.2019, 21:07
- MSA2 and TP7 overlays - rr, 14.12.2019, 23:42
- MSA2 and TP7 overlays - DosWorld, 15.12.2019, 21:42
- MSA2 and one-pass assemblers - Rugxulo, 16.12.2019, 19:32
- MSA2 compilation with GCC - Rugxulo, 12.02.2020, 08:18
- MSA2 and TP7 overlays - marcov, 03.12.2019, 16:37
- MSA assembler released under MIT - Rugxulo, 15.11.2019, 03:24
- MSA assembler released under MIT - DosWorld, 12.11.2019, 14:42
- MSA assembler released under MIT - tom, 10.11.2019, 19:00