home *** CD-ROM | disk | FTP | other *** search
- ; ------------------------------------------------------------------
- ;
- ; The following is the source code for a sample disk-based blackbox.
- ; It takes the following parameters:
- ;
- ; FILE_NAME: a pointer to a text variable (text is always by ref.)
- ; PASSED_INTEGER: an integer, passed by value
- ; RETURNED_INTEGER: an integer, passed by reference
- ; RETURNED_CHECK: a check box, passed by reference.
- ;
- ; For the sake of simplicity, the BlackBox does not perform any
- ; elaborate function, but merely adds 2 to the passed integer and
- ; returns the sum in the returned integer, and returns a 1 in
- ; returned check if file_name is not an empty string, and a 2 if
- ; file_name is an empty string.
- ;
- ; The pointer to the parameter block that is returned by the int 0F3H
- ; call points to the language_type integer value. The parameter after
- ; that will be the last parameter requested by the BlackBox. The
- ; first parameter requested by the blackbox will be at the highest
- ; address.
- ;
- ; Again, the form and style of a disk-based BlackBox is largely up to the
- ; preference of the developer. Notice that a stack segment is declared
- ; since a disk-based blackbox should be written as a stand-alone .EXE.
- ;
- ; ------------------------------------------------------------------
-
-
-
-
-
- data segment byte public 'DATA'
-
-
- parameter_structure STRUC
-
- language_value dw ? ; passed by value
- returned_check dd ? ; passed by reference
- returned_integer dd ? ; passed by reference
- passed_integer dw ? ; passed by value
- file_name dd ? ; passed by reference
-
- parameter_structure ENDS
-
-
- parameter_block dd ? ; address of parameter block
-
-
- data ends
-
-
- stack segment para stack 'STACK'
-
- db 1024 dup (0)
-
- stack ends
-
-
- cseg segment byte public 'CODE'
- assume cs:cseg, ds:data, ss:stack
-
-
- public sample_disk_blackbox
- sample_disk_blackbox proc
-
- mov ax,data
- mov ds,ax ; initialize the ds register
-
- mov ax,214*256 + 7
- int 0F3H ; get the pointer to the parameters
-
- mov word ptr parameter_block,bx
- mov word ptr parameter_block[2],dx
-
- les di,parameter_block
- mov ax,es:[di].passed_integer ; move into ax the integer
- inc ax
- inc ax ; add two to passed integer
-
- les di,es:[di].returned_integer ; make es:[di] point to
- ; returned integer
- mov word ptr es:[di],ax
-
- les di,parameter_block
- les di,es:[di].file_name ; make es:[di] point to
- ; file name
-
- mov al,1 ; initialize al for not empty
-
- cmp byte ptr es:[di],0 ; compare first byte to 0
- jne sample_disk_blackbox_exit
-
- mov al,2 ; set al to empty check value
-
- public sample_disk_blackbox_exit
- sample_disk_blackbox_exit:
- les di,parameter_block
- les di,es:[di].returned_check ; es:[di] points to check
-
- mov byte ptr es:[di],al
-
- mov ax,4C00H ; terminate program
- int 21H
-
- sample_disk_blackbox endp
-
- cseg ends
-
- end sample_disk_blackbox