home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l010 / 5.ddi / PASCAL5.ARC / BBX_PAS.DOC next >
Encoding:
Text File  |  1989-12-20  |  3.4 KB  |  94 lines

  1. Disk-Based BlackBoxes can be written easily in Turbo Pascal, and they act
  2. somewhat like overlaid files when a Turbo Pascal program is created using
  3. LAYOUT.
  4.  
  5. Because a Disk-Based Blackbox is basically a normal, self-contained
  6. executable program, the stand-alone code you write in Turbo Pascal needs
  7. only follow a few simple rules to be converted.
  8.  
  9. 1.  Any memory which is allocated by the disk-based blackbox MUST be
  10.     deallocated before exiting the program.
  11.  
  12. 2.  Any File Handles which are opened must be closed before exiting the
  13.     program.
  14.  
  15. 3.  The Disk-Based BlackBox CANNOT leave the screen in text mode before
  16.     exiting, and it should preserve the top two lines of the screen in
  17.     case a menu is present from the calling procedure.
  18.  
  19. 4.  The Interrupt vectors 0F3H and 0F4H cannot be replaced.
  20.  
  21. 5.  The program must exit normally, it cannot terminate and stay resident.
  22.  
  23. 6.  LAYOUT and programs in the langauges C and BASIC will not recognize
  24.     the REAL type, so make sure that any BlackBoxes you write take that
  25.     into account, and do not expect type real to be either passed to or
  26.     returned from your BlackBox.
  27.  
  28.  
  29. The procedure for calling a disk-based blackbox is as follows:
  30.  
  31. 1.  The parameters are pushed on the stack as if calling a memory-based
  32.     blackbox.  Note that the last parameter pushed will always be the
  33.     LANGUAGE_TYPE integer value.
  34.  
  35. 2.  The value of the stack pointer and stack segment is stored in the
  36.     graphics device driver using int 0F3H
  37.  
  38. 3.  An EXEC call (DOS CALL 21H, subfunction 4BH) is made to load and
  39.     execute the disk-based blackbox.
  40.  
  41. 4.  Your Disk-Based BlackBox makes a call to int 0F3H to obtain the
  42.     stored pointer to the passed data.
  43.  
  44. 5.  Whatever action required is performed.
  45.  
  46. 6.  Return whatever status values using the pointers passed.
  47.  
  48. 6.  Your Disk-Based BlackBox exits normally, after having deallocated any
  49.     allocated memory and closing any file handles.
  50.  
  51. 7.  The calling program continues execution.
  52.  
  53.  
  54. The call for obtaining the pointer to the passed data is:
  55.  
  56.     GET_BLACKBOX_PARAM_PTR (@parameter_block);
  57.  
  58.     parameter_block is defined as a pointer to a record whose structure
  59.     is determined by the parameters requested by the BlackBox.    Please
  60.     note that the address of the parameter_block pointer is passed, not
  61.     the pointer itself.
  62.  
  63.     The first field in the parameter block record is always an integer
  64.     value, LANGUAGE_TYPE, which indicates the language of the calling
  65.     procedure.    Then those parameters in the header file follow in reverse
  66.     order.
  67.  
  68.     Example:  A Disk-Based BlackBox which asks for
  69.  
  70.      1. A File Name (pointer to array of characters)
  71.      2. An Integer Value (passed by value)
  72.      3. An Integer Variable (passed by reference)
  73.      4. A CheckBox Variable (passed by reference)
  74.  
  75.     The Structure for the parameter block would be:
  76.  
  77.     BlackBox_Parameter_Block = record
  78.  
  79.      language_type    : integer;        { contained by all parameter blocks}
  80.      CheckBox_Variable   : ^byte;        { CheckBoxes are of type byte }
  81.      Integer_Variable    : ^integer;
  82.      int Integer_Value   : integer;
  83.      File_Name         : ^char;
  84.  
  85.     end;
  86.  
  87.     var
  88.      parameter_block     : ^BlackBox_Parameter_Block;
  89.  
  90.  
  91. In order to access the GET_BLACKBOX_PARAMETER_PTR call, you must use the
  92. unit BBXPTR_P.TPU on this disk.  If you are using Turbo Pascal version 5.0,
  93. you must use unit BBXPTRP5.TPU on this disk.
  94.