Forum > Other OS

FPC32 (with db66/db67) in DOS

(1/2) > >>

microxa:
Hi! for me FPC is more 'asm' than 'hll', but for fun:
I got an excellent result, using just the patched 32-bit FPC code generator (for Win32 target).
Then just post-processing Win32-PE to normalize in DOS exe. Of course, the minimal/dummy RTL (system/sysinit/fpintres)  is used.

Funny, but incredibly wild, x86_16 machine code (for 386+) works very well!
tested under dosbox(real mode)/ntvdm(v86).

despite some restrictions, are obtained rather complicated program:
http://imgsharing.ru/94576286.png

Thanks for the powerful supercompiler!

it was needed for a long time.. I'm happy again, sometimes doing programming!

p.s.
may be interesing:
common changes (aasmcpu.pas) for functions taicpu.calcsize/taicpu.GenCode


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    function taicpu.calcsize(p:PInsEntry):shortint;      var        i,data:longint;        codes : pchar;      ...        exists_prefix_F2 := false;        exists_prefix_F3 := false;     { ...  }        data:=pInteger(codes)^ and $FFFFFF;        {fix  call [procedure call mem??] }        if data = $FF01D5 then inc(len,2) else begin        data:=0;         for i:=0 to ops-1 do data:=data or oper[i]^.ot;        data := data and $0E000004; //mem&reg32         if data = $00000004 then inc(len) else        if data = $0E000000 then inc(len) else        if data = $0E000004 then inc(len,2) else        begin           c:=ord(codes[1]);data:=pInteger(codes)^ and $FFFFFF;           case data of             $00C301, //retn            $00C901, //leave            $6001D5, //pushad            $6101D5, //popad            $CF01D5: //iretd                inc(len);           end;        end;  { original code }         repeat          c:=ord(codes^);          inc(codes); 

PascalDragon:

--- Quote from: microxa on October 09, 2020, 02:29:21 pm ---I got an excellent result, using just the patched 32-bit FPC code generator (for Win32 target).
Then just post-processing Win32-PE to normalize in DOS exe. Of course, the minimal/dummy RTL (system/sysinit/fpintres)  is used.

Funny, but incredibly wild, x86_16 machine code (for 386+) works very well!
tested under dosbox(real mode)/ntvdm(v86).
--- End quote ---

While that is an interesting experiment, you are aware that FPC fully supports 16-bit x86 through the i8086 target? ;)

microxa:
Hello PascalDragon.
yes, I know that ..
but there isn't exactly a 32 bit code generator.

By the way, version 3.2.0 has been successfully implemented for 16-bit mode, but version 3.3.1 unfortunately falls from memory burnout. But nevertheless, it was possible to transfer part of the optimizer modules (aoptx86, etc.) from version 3.3.1 to 3.2

I like this quest ..

lucamar:
Maybe I'm being dense (probably :-[ )  but I'll ask: what's the point? I mean, FPC by itself already does generate 32 bits, protected-mode apps in DOS, and there is already a 16-bit generator so ... what's is "special" about what you're doing?

I'm really interested: we have a few apps working on DOS, both FP 32 bits and TP 16 bits (which we'll convert to 16 bit FP as soon as we can and the 16 bits compiler becomes fully stable and tested). It would be nice to know whatever alternatives there are out there.

microxa:
This is just an instrumental feature, implemented simply as
helloworld. The only alternative - is manual assembly.

Navigation

[0] Message Index

[#] Next page

Go to full version