Frequently Asked Questions
This article is translated to Serbo-Croatian language by Jovana Milutinovich from Webhostinggeeks.com.
- Can commercial applications be developed with FrameworkPascal?
- How can I get direct access to program data?
- Can I perform arithmetic operations with pointers?
- Why can't I setup the LFB video mode with the GRAPH unit?
- Why can't I setup LFB SVGA video modes in RAW DOS, if they work under Windows' 95?
- I am trying to make a TSR program with FRAMEWORKPASCAL Pascal, but it doesn't work. Why?
- How do I write interrupt handlers with FrameworkPascal?
- I use the OVERLOAD reference to define the '*' operator for fixed-point variables in a unit, but it has no affect. Why?
- How do I allocate a memory block in the 1st megabyte of memory?
- How does one create and/or use DLLs in MS-DOS protected mode applications?
- How does one write Windows GUI applications with the FrameworkPascal compiler?
- I tried to recompile my old TP sources with the FrameworkPascal compiler, but got a couple of error messages. Is something wrong there?
- I have created a Win32 GUI application which uses the Graph library. Why doesn't it work?
- How do I get rid of the PMODE/W logo in my MS-DOS applications?
- I need to call a real mode interrupt (say int 21h), and I have to set DS:DX to the segment:offset of some data variable. How can I do that?
- Why is the "Single-Step" command in the built-in debugger so slow?
- When I try to run the program I'm writing, FrameworkPascal Pascal does not warn me about my "code errors".
- You wrote that FrameworkPascal compiler is equipped with a high-level debugger. I don't understand what "high-level debugger" means.
For instance, does it allow one to set breakpoints, perform step-through execution,find run time errors, etc?
- How can I find information about Windows API and Pascal functions?
- How could I edit and compile resource files (.res, .rc files include menus, accelerator keys, dialog boxes, icons and bitmap and are abutted to programs executable)?
1. Can application developed with FrameworkPascal be distributed or sold?
With what versions of TMT and FrameworkPascal?
Owners of unrestricted TMT4, TMT5 and FrameworkPascal license may distribute
or sell application created by them.
Applications created with educational and restricted personal versions may not be distributed or sold.
2. How can I get direct access to program data?
FrameworkPascal uses a flat memory model. That means, that all
code, static and temporary (alocated with the GetMem procedure) data is
stored in the same segment. Thus you can get access to your data using a linear offset
from the start of the memory object. The example below shows you, how to get direct access
to a memory block which is allocated with the GetMem procedure.
- var
- P: Pointer; Dummy: Byte;
i: DWORD;
- begin
- GetMem(P, 100000);
- for
i := 0 to 99999
do
- Byte((P + i)^) := Random(256);
- for
i := 0 to
99999 do
- Dummy := Byte((P + i)^);
- end.
Also you can use the built-in assembler to get high speed direct access to memory.
Example:
- asm
- mov edi, [P]
// P is a pointer to a data block in memory
- mov ecx, [SIZE]
// SIZE is the size of the data block
- mov al, 0FFh
// Assign a value to fill
- rep stosb
// Fill the data block with the $FF value
- end
;
3. Can I to perform arithmetic operations with pointers?
Yes, you can. You can to use the
Inc() and Dec()
procedures. Also you can increase and decrease a pointer using
"+" and "-" operators.
Example:
- var
- ScrAddr: Pointer;
- begin
- // ScrAddr points to the first byte of VGA memory
- // (higher left pixel)
- ScrAddr := Pointer($A0000);
- // Now ScrAddr points to the last byte of VGA memory
- // (lower right pixel)
- ScrAddr := ScrAddr + 63999;
- end
.
4. Why can't I setup the LFB video mode with the GRAPH unit?
The Linear Flatframe Buffer (LFB) is supported only if your video card has VESA
VBE version 2.0 or higher. Old video cards with VESA VBE version 1.2
or lower do not supports LFB without a special VESA VBE driver. We reccomend the SciTech
Display Doctor 5.3 or higher to get access to LFB on old video cards, which do not support
VESA VBE 2.0. The SciTech Display Doctor is availible at: http://www.scitechsoft.com
5. Why can't I setup LFB SVGA video modes in RAW DOS, if they work under Windows' 95?
In this case you are compiling your program with the
PMODE-based extender. This extender does not support function 800h of the DPMI host under
RAW DOS, but under Windows 95 your program works since it uses the DPMI host of Windows
95. We recommend that you compile your programs with new PMODE/W, WDOSX and DOS/4GW based
extenders, that support function 800h of the DPMI host even under RAW DOS.
6. I am trying to make a TSR program with FrameworkPascal, but
it doesn't work. Why?
FrameworkPascal creates MS-DOS 32-bit protected mode programs
and is not intended for making real mode applications, such as TSR's.
7. How do I write interrupt handlers with FrameworkPascal?
The example below shows you a simple method of working with
interrupt-handlers.
- program
IntDemo;
- {$ifndef __DOS__}
Wrong compilation target
{$endif}
uses Dos, Crt;
- var
- Int1CSave: FarPointer;
- Time: LongInt;
- /////////////////////////////////////////////////////
- procedure TimerHandler; interrupt;
- var
- StoreX, StoreY: Word;
- begin
- Inc(time);
- StoreX := WhereX;
- StoreY := WhereY;
- GotoXY(1, 1);
- Write(time);
- GotoXY(StoreX, StoreY);
- end; {TimerHandler}
- /////////////////////////////////////////////////////
- begin
- ClrScr;
- Time := 0;
- GetIntVec($1C, Int1CSave);
- SetIntVec($1C, @TimerHandler);
- Writeln;
- Writeln('Type something and press "ENTER" to exit');
- Readln;
- SetIntVec($1C, Int1CSave);
- end.
8. I made a fixed-point library for FrameworkPascal. I use the
OVERLOAD reference to define the '*' operator for fixed-point variables, but it has no
affect. Why? Part of my unit is below:
- {16.16 fixed-point math unit}
- unit Fix1616;
-
- interface
- type Fixed16 = LongInt;
- function FixMulFix(F1, F2: Fixed16): Fixed16;
-
- implementation
- function FixMulFix(F1, F2: Fixed16): Fixed16;
- assembler;
- asm
- mov eax,F1
- mov edx,F2
- imul edx
- sal eax,1
- adc edx,0
- shrd eax,edx,16
- end;
- OVERLOAD * = FixMulFix;
- end.
You should place the OVERLOAD declaration
in the INTERFACE section of the unit. A FixMulFix function
declaration must look like this:
- function FixMulFix(F1, F2: Fixed16): Fixed16;
- OVERLOAD * = FixMulFix;
- ...
9. How do I allocate a memory block in the 1st megabyte of
memory?
You should use the DOSMemoryAlloc (to
allocate a memory block) and DOSMemoryFree (to free a memory block)
functions from the DPMI unit.
Example:
- program DpmiDemo;
- {$ifndef __DOS__}
Wrong compilation target
{$endif}
- uses
DPMI;
- var
- rmSeg: Word;
- LinAddr: DWord;
- rmRegs: TRmRegs;
- i: DWord;
- begin
- // Allocate 256 bytes in lower memory and store the address
- // of the real mode segment
- rmSeg := DOSMemoryAlloc(256);
- if rmSeg = 0then
- begin
- Writeln('Not enough lower memory!');
- Halt(0);
- end;
- // Obtain linear protected mode address of real mode segment
- LinAddr := DWord(rmSeg) * 16;
- // Clear rmRegs structure (fill it with zero)
- ClearRmRegs(rmRegs);
- // VBE function 4F00h - GetVESAInfo
- rmRegs.AX := $4F00;
- // Real mode ES register = segment of allocated memory block
- rmRegs.ES := rmSeg;
- // Call VBE function 4F00h, which fills allocated block of
- // memory with VESA VBE information
- RealModeInt($10, rmRegs);
- Write('Signature: ');
- // Read the first 4 bytes from the lower memory block and
- // display them on the screen. If your video card supports VESA
- // VBE, you will see the word 'VESA'
- for i := LinAddr
to LinAddr + 3
do
Write(char(Pointer(i)^));
- // Free allocated memory block
- DOSMemoryFree(rmSeg);
- end.
10. How does one create and/or use DLLs in MS-DOS protected mode applications?
FrameworkPascal does not support DLL generation for MS-DOS protected mode applications or the use of DLL directly in DOS (in a same way as for
OS/2 or Win32 applications). However, there is a way to do that using the DLL Manager by the Virtual Research Group, which is downloadable from this page.
11. How does one write Windows GUI applications with the FrameworkPascal compiler?
FrameworkPascal provide a number of simple sample Windows GUI programs.
You can start by studying, modifying and extending those for your needs. If you are
converting existing code of starting from a prototype do not hesitate to contact support and ask for
a custom model application which we may be able to prepare for you.
12, I tried to recompile my old
TP sources with the FrameworkPascal compiler, but got a couple of error messages. Is something
wrong there?
Some sources written for
16 bit Turbo Pascal need slight modifications to compile in FrameworkPascal 32 bit mode. For instance,
16-bit assembler or inline directives need to be modified to 32 bit.
13. I have created a Win32 GUI
application which uses the Graph library. Why doesn’t it work?
The Graph library unit for Win32 requires that Microsoft
DirectX 3 or higher be installed. The latest version of the DirectX distributive is
downloadable from here..
14. How do I get rid of the PMODE/W logo in MS-DOS applications?
This logo is a part PMODE/W license and it can't be removed.
The same is true for the DOS4/GW-based stub (WSTUB.EXE). However we can suggest that you
use another DOS extender, such as PASSTUB.EXE, TMTSTUB.EXE, CWSTUB.EXE or TMT32.EXE. For any of
these you can disable the logo by means of -$logo- compiler
directive.
15. I need to call a real mode interrupt (say int 21h),
and I have to set DS:DX to the segment:offset of some data variable.
How can I do that?
It's possible to emulate the real mode interrupt by means
of special DPMI function, which is implemented in MsDos and Intr
procedures (see our on-line help system for the DOS unit description). Just keep in mind,
that you have to allocate a data block in the low memory area (1st megabyte) using AllocDosMemoryBlock
or DosMemoryAlloc function from the DPMI unit.
16. Why is the "Single-Step" command in the built-in debugger so slow?
In single-step mode the build-in debugger suspends and resumes
the application every time when it performs each single CPU instruction.
We strongly recommend that you avoid using the single-step command if
it possible. Use the run-to-cursor command instead. It is more useful
and isn't slow.
17. When I try to run the program I'm writing in TMT, TMT does not warn me
about my "code errors". It just says:
[Run
Error]: whatever.EXE is not found.
How could I get rid of this problem?
It seems you are using an older TMT Lite version DOS only compiler under
Windows NT (Windows NT 3/4, Windows 2000, or Windows XP). The problem is that
the Win32 IDE can't work properly with MS-DOS version of compiler under NT.
There are two ways to resolve your problem: use Win'9x, or buy the TMT Pascal
Multi-target edition, which works fine with any Win32 operating system
including Windows NT 3/4, Windows 2000, and Windows XP.
18. You wrote
that FrameworkPascal compiler is equipped with a high-level debugger. I don't
understand what "high-level debugger" means. For instance, does it allow one
to set breakpoints, perform step-through execution, find run time errors,
etc?
"High-level debugger" means the following:
1) The built-in
debugger does not allow you to debug the application on assembly language level. The lowest debugging unit is a Pascal source line, not an Assembly
language instruction.
2) With our debugger you may set breakpoints, perform run-to-cursor execution and find run-time errors
3) There is no
step-through command, however you may perform a slow single-step execution. Nevertheless we would recommend you to use the run-to-cursor operation instead,
because it isn't slow and it's more powerful.
4) You may also analyze your local and global variables, as well as the CPU registers when your program is
stopped at a breakpoint, or after performing the run-to-cursor command.
19. How can I find information about Windows API and Pascal functions?
Extensive information is available in the built in help system of the FrameworkPascal
IDE and on line at http://www.frameworkpascal.com/online_docs.htm.
A few simple steps will likely to take you to relevant information. Help for Windows API and Pascal functions is likely to be
in the IDE help system. Type the term you are interested in in the IDE and press F1.
If the term has an entry in the help its page will open. If it doesn't have a page search for that term either in the help
content or as a keyword from the main IDE Help menu. If you are interested in specific unit you can find its entry in the
On Line table of content, accessible from the link above. For a more general search you can use Google advance
search while limiting the search to www.frameworkpascal.com. It will list all the help and sample pages
the term you are searching apears in.
Another useful source of information are the sample programs. Try searching for functions and keywords your are interested in in the
Sample directory .pas files. You can use the Search / Find In Files menu in the IDE, enter the path in the Mask item in
the search dialog box or choose it from the drive map by clicking the path icon to the right of the item. The search result will
show up in the Find Files window at the bottom of the IDE work space and clicking on a file name will open it.
20. How could I edit and compile resource files (.res, .rc files include menus, accelerator keys,
dialog boxes, icons and bitmap and are abutted to programs executable)?
You can use the Microsoft Dialog Editor for Windows NT (dlgedit.exe) which is included in the distributive. On other
hand, you may use any other dialog editor, such as a WEditRes utility which is a part of a freeware LCC compiler
(http://www.cs.virginia.edu/~lcc-win32).
rc files are quite simple to edit manualy. This two line batch file:
path = C:\Program Files\FWP.6\BIN;%path%
rc SeditSQL
will compile the rc file using the rc compiler found in the bin directory.
Adding menus, menu items, accelerator keys and icons is quite simple and faster when modifying rc files
provided with smaple model programs.
Edit your rc file using the IDE editor and run the command listed in the batch file above.
The RC compiler report syntax error with their line numbers.