Perhaps you may first try get it running with the large memory model, and if this runs, try to optimize it for a smaller memory model? The following least compiles for me, with A BUNCH of warnings, and the binary is 68k in size, comparing to 11k in the bin folder (did you UPX compress it or is it the actual size?)

ppcross8086 -Mtp -WmLarge KEYB.PAS

Warnings like:

Warning: Use of +offset(%ebp) is not compatible with regcall convention

look rather fishy, considering we are dealing with 16-bit code.

Your unaltered source leads to the following warnings, mainly dealing with the inline assemly.

Free Pascal Compiler version 3.2.2 [2021/05/19] for i8086

Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: MS-DOS 16-bit real mode
Compiling KEYB.PAS
KEYB.PAS(23,2) Warning: The switch "$E" is not supported by the currently selected target
KEYB.PAS(23,2) Warning: Unsupported switch "$L"
KEYB.PAS(23,2) Warning: Unsupported switch "$N"
KEYB.PAS(23,2) Warning: Unsupported switch "$Y"
KEYB.PAS(281,41) Warning: Size suffix and destination or source size do not match KEYB.PAS(298,41) Warning: Size suffix and destination or source size do not match KEYB.PAS(464,21) Warning: Use of +offset(%ebp) is not compatible with regcall convention KEYB.PAS(471,24) Warning: Use of +offset(%ebp) is not compatible with regcall convention
KEYB.PAS(474,4) Warning: Label not defined "changecpexit"
KEYB.PAS(549,40) Warning: Size suffix and destination or source size do not match
KEYB.PAS(620,4) Warning: Label not defined "NotReplace"
KEYB.PAS(660,25) Warning: Use of +offset(%ebp) is not compatible with regcall convention KEYB.PAS(962,40) Warning: Size suffix and destination or source size do not match KEYB.PAS(1015,24) Warning: Use of +offset(%ebp) is not compatible with regcall convention KEYB.PAS(1016,24) Warning: Use of +offset(%ebp) is not compatible with regcall convention
KEYB.PAS(1020,4) Warning: Label not defined "ChainScancodeEnd"
KEYB.PAS(1245,41) Warning: Size suffix and destination or source size do not match KEYB.PAS(1344,40) Warning: Size suffix and destination or source size do not match
KEYB.PAS(1510,4) Warning: Label not defined "no100"
KEYB.PAS(1510,4) Warning: Label not defined "no101"
KEYB.PAS(1510,4) Warning: Label not defined "no161"
KEYB.PAS(1676,4) Warning: Label not defined "WaitReady1"
KEYB.PAS(1908,4) Warning: Label not defined "jmp1"
KEYB.PAS(1908,4) Warning: Label not defined "jmp2"
KEYB.PAS(1908,4) Warning: Label not defined "ende"
KEYB.PAS(1908,4) Warning: Label not defined "BufferFull1"
KEYB.PAS(1908,4) Warning: Label not defined "ende2"
KEYB.PAS(2412,18) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2630,14) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2631,28) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2653,17) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2654,17) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2655,17) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2656,17) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(2987,12) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(3316,23) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(3328,23) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(3344,21) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(3349,27) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(3358,9) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined KEYB.PAS(3358,22) Note: Call to subroutine "function Ptr(sel:Word;off:Word):^untyped; far;" marked as inline is not inlined
KEYB.PAS(2923,6) Note: Local variable "pb" not used
Linking KEYB.exe
3466 lines compiled, 0.1 sec, 60578 bytes code, 4080 bytes data
27 warning(s) issued

15 note(s) issued


Greetings, Bernd

On 01.01.2024 22:01, Aitor Santamaría via Freedos-devel wrote:
Hello there!

Sorry for being late on the topic.

The following link directs to the forum item that I opened when trying to re-compile FD-KEYB under FPC. Basically, KEYB needs to use different procedures to store a key in the buffer, depending on the parameters and system configuration. The problem occurs when I need to select the adequate key storing procedure to a variable that will be called from the assembly bit. It also occurs in some other parts.

In order to make the program small, I am compiling it under the compact mode. I tried it and had this error last October, and as no one posted a reply, I haven't tried it again, but can do it (or maybe someone here can guess where the problem is).

I get a problem using both the standar or the TP mode, and doing @Procedure or without the @.
You can read the full details here, maybe someone has a hint:

Far pointer versus Pointer in 16-bit DOS (freepascal.org) <https://forum.lazarus.freepascal.org/index.php/topic,60973.msg457397.html#msg457397>

Thanks in advance,
Aitor











On Mon, 13 Nov 2023 at 00:40, Rugxulo via Freedos-devel <freedos-devel@lists.sourceforge.net> wrote:

Hi,

On Sun, Nov 12, 2023 at 5:46 AM Bernd Böckmann via Freedos-devel
<freedos-devel@lists.sourceforge.net> wrote:
>
> On 12.11.2023 02:44, Rugxulo via Freedos-devel wrote:
>
> But I still have not found an elegant solution yet to do a
widening conversion of an untyped pointer from near to far.
> Should be rarely needed though. For a typed pointer
FarAddr(thing^) does the trick.

You can get the current code segment or data segment with the CSeg and
DSeg functions.

* https://www.freepascal.org/docs-html/rtl/system/seg.html

Also see the "absolute" keyword:

* https://wiki.freepascal.org/Absolute


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel



_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to