Last Update: 10-July


FAQs for FPKPascal


This document answers frequently asked questions about FPK-Pascal.

Document Index:

  1. What is FPK-Pascal
  2. Where can I get the compiler ?
  3. OOP
  4. Comments (* *)
  5. Units
  6. Turbo Vision
  7. Compile System Unit
  8. Segment Violation Error
  9. Comparison with GNU-Turbo Pascal alpha
  10. Function Overloading
  11. Calling C functions
  12. DJGPP - the DOS extender
  13. Graph unit
  14. integrated Assembler Syntax
  15. memory and graphics access
  16. FPK-Pascal without a coprocessor
  17. FPK-Pascal and Windows-95
  18. use more than 4 Megabytes
  19. access i/o ports
  20. Known Bugs


  1. What is FPK-Pascal
  2. FPK-Pascal is a 32 bit Pascal compiler for DOS, OS/2 and Linux (OS/2 only in version 0.5.2, Linux planned for the near future).

    The compiler is written in Pascal and is able to compile the own sources. The sources are included. FPK-Pascal requires at least a 386 processor and XMS memory. It is reported to run on a 386 SX (25 MHz) with 2 Megabyte RAM. Suggested configuration is a 486 with 4 or 8 Megabyte.

        short history:
            6/93 project start
           10/93 first little programs work
            3/95 the compiler compiles the own sources
        

    But I'am working only may be 5 hours a week.

  3. Where can I get the compiler ?
  4. The compiler is available via FTP and WWW:

    http://www.brain.uni-freiburg.de/~klaus/fpk-pas
    ftp://ftp.uni-freiburg.de/pub/pc/msdos/fpk-pascal
  5. I tried to compile my tp7 code with it with your compiler, it seems that it can't recognized the OOP.
  6. The compiler supports OOP. Maybe there are some bugs look at BUGS (listing not yet available)

  7. It can't recognized the comment style like this (* .......... *)
  8. It's true, the compiler don't support (* ... *).
    It's not easy to do this. But the compiler supports nested comments like

      { This is a comment {{ ... }}}
    
  9. How can I build unit?
  10. It works like TP. The first keyword in the file must be UNIT (not case sensitive). The compiler will generate two files: XXX.PPU and XXX.O. The PPU file contains the interface informations for the compiler and the O-file the machine code (unix a.out styled object file). The main programs must contain a keyword USES.

  11. Will FPKPascal support TV (Turbo Vision) in the future?
  12. A port of TV for FPKPascal will be done. It will be completly rewritten for 32 bit. For information have a look at FreeVision home page

  13. How can I compile the system unit ?
  14. For recompiling the system unit, change to the directory
                   SOURCE/RTL/DOS
    Then type the following:
                   PPC386 -Us -q- -OGa -Sg system
    Now copy the new SYSTEM.PPU to BIN and SYSTEM.O to LIB
    
    The compiler switches do the following:
              -Us    generate a system unit
              -q-    print some statistics
              -OGa   easy optimizations for speed 
              -Sg    allow GOTO and LABEL (I think not required for the
                     system unit
    
  15. The compiler crashes with segment violation error.
  16. If you have some problems with PPC386 (Segment violation errors occur), try it with other compiler switches, if this not works send me please a bug report:

    fnklaemp@cip.ft.uni-erlangen.de

    Program crashes with a segment violation error.

    This error occurs mostly if the program accesses a memory location, which should not be accessed by the program.

  17. How does it compare to the GNU-Turbo Pascal alpha release ?
  18. FPKPascal has nothing to do with GNU Pascal. But it's using the GNU AS and the DOS Extender of DJ Delorie from GNU C for DOS.

  19. How does function overloading work?
  20. function overloading is implemented, like in C++:

    procedure a(i : integer);
    
      begin
      end;
    
    procedure a(s : string);
    
      begin
      end;
    
    begin
       a('asdfdasf");
       a(1234);
    end.
    
  21. How can I call C functions ?
  22. C calling conventions are implemented: The compiler pushes the parameters from right to left, but the procedure must clear the stack. For calling the C function strcmp declare the following:

      function _strcmp(s1 : pchar;s2 : pchar) : integer; [ SYSTEM ];
    

    or (since version 0.6.0):

      function _strcmp(s1 : pchar;s2 : pchar) : integer; [ C ];
    
  23. When did FPKPascal use DJGPP 2.0 ?
  24. I'am having some problems with DJGPP 2.0. And a second disavantage, in my opinion, is, that DJGPP 2.0 needs DPMI.

  25. How can I use the unit graph with FPKPascal ?
  26. Look at InitGraph

  27. Integrated Assembler syntax
  28. The syntax is different from the one in Borland Pascal.

    A description of the syntax can be found in the DJGPP FAQ
    http://www.delorie.com/djgpp/v2faq/faq102.html#Syntax
    or in Brennan's Guide to Inline Assembly
    http://www.rt66.com/~brennan/djgpp/djgpp_asm.html.

    Plus you can use this convertor program

  29. How to access DOS memory / How to do graphics
  30. The DOS memory is mapped to $e0000000 by the memory manager.

        type
           pbyte = ^byte;
        var
           mem,txt : pbyte;
        begin
           mem:=pbyte($e0000000);   { DOS memory }
           txt:=pbyte($e00b8000);   { VGA text   }
    
           { read the first 3 characters from top left of the screen }
           writeln(chr(txt[0]),chr(txt[2]),chr(txt[4]));
    
           { access BIOS data area, this example reads out memory size }
           writeln (mem[$40*16 + $13] + mem[$40*16 + $14] * 256);
        end.
        

    Writing to the graphics screen should be possible with: (code untested!)

        procedure putpixel (x,y,color:byte);
        var p : pointer;
        begin
           p := $e00a0000;
           (p+x+320*y)^ := color;
        end; 

    or

        screen := pointer($E00A0000);
        move(buffer,screen^,64000);
        
  31. FPK-Pascal without a math coprocessor
  32. The compiler and all compiled programs require a math coprocessor, but it's possible to include an emulator. This is done by setting the GO32 environment variable.

           SET GO32=driver [your grdriver] emu [path to PPVBINV]EMU387
        

    Example: with a vanilla VGA card and FPK-pascal installed to C:VPP, you would insert the following to your SET_PP.BAT :

           SET GO32=DRIVER C:\PP\DRIVERS\VGA.GRD EMU C:\PP\BIN\EMU387
        
  33. Windows-95
  34. There is a problem with the compiler and Win 95 with computers with less than 16 MB. First set in the properties of the DOS box the DPMI memory size to max value. Now try to start a demo program in the dos box, like HELLO (the start goes some time). If this works you can get the compiler work, you must recompile the compiler with a lower heap size, perhaps 2 or 4 MB (option -Chxxxx).

  35. access more than 4 megabytes
  36. FPK is set to normally only allocate 4 meg. If it just allocated all it could get, people running windows would have problems as windows increased the swap file size to give the program more memory, on and on until the swap file drive is full.

    You can while compiling specify the size of the heap with -Chxxxx.
    The default value is -Ch4000000. Try -Ch10000000 (with enough swap space!)

  37. Access i/o ports
  38. You have to use assembly language, which is AT&T style. You would type something like:

        asm
          movw PORTNUM,%dx
          movw DATA,%ax
          outw %ax,%dx
        end;  

    Where portnum is the port you want to send to and data is the data to send. If either of these are absolute numbers, include a dollar ($) sign before the number.

  39. known bugs and missing things


If there's something missing here, please tell Klaus Hartnegg, klaus@mailserv.brain.uni-freiburg.de

> How do you make colored text?

Well, like in TP:

uses crt;

begin textcolor(red); textbackground(blue); writeln('Hello world'); end.

For more color contants look to the source of the CRT unit.

> > How do you add a graphic (in a certain position)?

Which OS do you use ?


> When i compile my program TEST.PP and make TEST. to .EXE and delete the .O > .S . files my program does not work. Displays only : > > go32.exe: usuage: go32.....etc

Do ppc386 test.pp go32 test

or (to get a DOS executable)

ppc386 test.pp aout2exe test

and run the exe file with a simple test


back to FPKPascal homepage

fnklaemp@cip.ft.uni-erlangen.de