home *** CD-ROM | disk | FTP | other *** search
- Disk-Based BlackBoxes can be written easily in Turbo Pascal, and they act
- somewhat like overlaid files when a Turbo Pascal program is created using
- LAYOUT.
-
- Because a Disk-Based Blackbox is basically a normal, self-contained
- executable program, the stand-alone code you write in Turbo Pascal needs
- only follow a few simple rules to be converted.
-
- 1. Any memory which is allocated by the disk-based blackbox MUST be
- deallocated before exiting the program.
-
- 2. Any File Handles which are opened must be closed before exiting the
- program.
-
- 3. The Disk-Based BlackBox CANNOT leave the screen in text mode before
- exiting, and it should preserve the top two lines of the screen in
- case a menu is present from the calling procedure.
-
- 4. The Interrupt vectors 0F3H and 0F4H cannot be replaced.
-
- 5. The program must exit normally, it cannot terminate and stay resident.
-
- 6. LAYOUT and programs in the langauges C and BASIC will not recognize
- the REAL type, so make sure that any BlackBoxes you write take that
- into account, and do not expect type real to be either passed to or
- returned from your BlackBox.
-
-
- The procedure for calling a disk-based blackbox is as follows:
-
- 1. The parameters are pushed on the stack as if calling a memory-based
- blackbox. Note that the last parameter pushed will always be the
- LANGUAGE_TYPE integer value.
-
- 2. The value of the stack pointer and stack segment is stored in the
- graphics device driver using int 0F3H
-
- 3. An EXEC call (DOS CALL 21H, subfunction 4BH) is made to load and
- execute the disk-based blackbox.
-
- 4. Your Disk-Based BlackBox makes a call to int 0F3H to obtain the
- stored pointer to the passed data.
-
- 5. Whatever action required is performed.
-
- 6. Return whatever status values using the pointers passed.
-
- 6. Your Disk-Based BlackBox exits normally, after having deallocated any
- allocated memory and closing any file handles.
-
- 7. The calling program continues execution.
-
-
- The call for obtaining the pointer to the passed data is:
-
- GET_BLACKBOX_PARAM_PTR (@parameter_block);
-
- parameter_block is defined as a pointer to a record whose structure
- is determined by the parameters requested by the BlackBox. Please
- note that the address of the parameter_block pointer is passed, not
- the pointer itself.
-
- The first field in the parameter block record is always an integer
- value, LANGUAGE_TYPE, which indicates the language of the calling
- procedure. Then those parameters in the header file follow in reverse
- order.
-
- Example: A Disk-Based BlackBox which asks for
-
- 1. A File Name (pointer to array of characters)
- 2. An Integer Value (passed by value)
- 3. An Integer Variable (passed by reference)
- 4. A CheckBox Variable (passed by reference)
-
- The Structure for the parameter block would be:
-
- BlackBox_Parameter_Block = record
-
- language_type : integer; { contained by all parameter blocks}
- CheckBox_Variable : ^byte; { CheckBoxes are of type byte }
- Integer_Variable : ^integer;
- int Integer_Value : integer;
- File_Name : ^char;
-
- end;
-
- var
- parameter_block : ^BlackBox_Parameter_Block;
-
-
- In order to access the GET_BLACKBOX_PARAMETER_PTR call, you must use the
- unit BBXPTR_P.TPU on this disk. If you are using Turbo Pascal version 5.0,
- you must use unit BBXPTRP5.TPU on this disk.