home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bgi256-3.zip / BGI256.ASM < prev    next >
Assembly Source File  |  1993-02-08  |  4KB  |  136 lines

  1.  
  2. ;BGI256.ASM
  3. ;Copyright 1991,1992,1993 Knight Software
  4. ;P.O. Box 22902, Milwaukie, OR 97269
  5. ;BGI driver for Super VGA 256 color modes
  6. ;    History:
  7. ;       17 May 1991 - first release
  8. ;       10 Jun 1991 - Added ability to control pixel backgrounds
  9. ;       19 Aug 1992 - fixed windowing errors 
  10. ;       20 Aug 1992 - fixed VESA selection for Diamond Stealth
  11. ;                     which uses non-sequencial memory in 800x600
  12. ;       22 Nov 1992 - Adapted for protected mode operation
  13. ;    22 Dec 1992 - released working floodfill
  14. ;       30 Jan 1993 - corrected version 2 header (wasn't working with TP6)
  15.  
  16. ;======================================================================
  17.  
  18. BGIVERSION EQU 3   ;select target BGI version 2 or 3
  19.  
  20. ;**********************************************************************
  21. ;The following macro builds the required BGI header block.
  22. ;This macro is derived from Borland's own BGI toolkit
  23. ;from the DEVICE.INC file for compatibilty.
  24. BGI    macro    name        ; the following macro builds
  25.     public    name        ; the required ddo header block
  26.  
  27.      IF BGIVERSION LT 3
  28.  
  29. name    proc    far        ; the vector table must be at
  30.                 ; 'ddovec' 
  31.     push    ds        ; (push ds, push cs are signature)
  32.     push    cs        ; make ds=cs
  33.     pop    ds
  34.     cld            ; just in case
  35.     push    bp        ; 6 bytes
  36.     call    [DDOVEC+si]    ; call the local function
  37.     pop    bp        
  38.     pop    ds        ; restore regs
  39.     ret            ; ret far
  40. name    endp
  41.     db    'CB'
  42.     db    0        ; spare area
  43. verID    db    BGIVERSION    ; version id is at offset 15
  44. ;emulate must be at offset 16 
  45. EMULATE:ret            ; emulate function (nop until
  46.     dw    0,0        ; patched by loader)
  47. RESERVED:
  48. NONE:    ret            ; near ret for unused functions
  49.      ELSE
  50.  
  51. name    proc    far        ; the vector table must be at
  52.                 ; 'ddovec' 
  53.     push    ds        ; 
  54.     MOV    DS,CS:[ALIAS]    ; 
  55.     cld            ; clr dir flag just in case
  56.     push    bp        ; 
  57.     call    [DDOVEC+si]    ; call the local function
  58.     pop    bp        
  59.     pop    ds        ; restore regs
  60.     ret            ; ret far
  61. name    endp
  62. verID    db    BGIVERSION        ; version id is at offset 15
  63. ;alias must be at offset 16 with emulate at offset 18
  64. ALIAS    dw    0
  65. EMULATE:ret            ; emulate function (nop until
  66.     dw    0,0        ; patched by loader)
  67. RESERVED:
  68. NONE:    ret            ; near ret for unused functions
  69.  
  70.      ENDIF
  71.  
  72.     endm
  73.  
  74. ;**********************************************************************
  75. ;Code segment *must* be first - only code and data segments allowed
  76.  
  77. _TEXT    SEGMENT PARA PUBLIC 'CODE'
  78.      IF BGIVERSION LT 3
  79.     ASSUME  DS:_TEXT, CS:_TEXT
  80.      ELSE
  81.     ASSUME  DS:_DATA, CS:_TEXT
  82.      ENDIF
  83.  
  84.     BGI    BGI256        ; Define the interface type
  85.  
  86.     INCLUDE SBASE.INC       ; Include base interface code
  87.     INCLUDE SHARD.INC    ; Include init/bank subroutines
  88.     INCLUDE    SPIXEL.INC    ; Include pixel subroutines
  89.     INCLUDE SLINE.INC    ; Include line subroutines
  90.     INCLUDE SBIT.INC    ; Incluce bitmap subroutines
  91.     INCLUDE    SBLT.INC    ; Include blt subroutines
  92.     INCLUDE STEXT.INC    ; Include text subroutines
  93.     INCLUDE    SFLOOD.INC    ; Include floodfill subroutines
  94.  
  95.      IF BGIVERSION LT 3
  96.     INCLUDE INITDATA.INC    ; do this if version 2 driver
  97.     INCLUDE    SDATA.INC    ; Include all data / variables
  98.     INCLUDE    SPAL.INC    ; Include default palette data
  99.      ENDIF
  100.  
  101.  
  102. ;------------------------------------------------------------
  103. ; <-- If you are creating your own custom driver, comment -->
  104. ; <-- out the hardware specific driver here and add your  -->   
  105. ; <-- own custom include file for you specific hardware.  -->
  106.  
  107. ;hardware specific code - select one appropriate include file
  108. ;    INCLUDE V7INIT.INC    ; Include V7 init subroutines
  109. ;    INCLUDE TRIDENT.INC    ; Include Trident init subroutines
  110.     INCLUDE SVESA.INC    ; Include VESA init subroutines
  111.  
  112. _TEXT    ENDS
  113.  
  114.  
  115. ;**********************************************************************
  116. ;Note: Data segment *must* be after code segment (for protected mode)
  117.  
  118.      IF BGIVERSION GE 3
  119. _DATA    SEGMENT PARA PUBLIC 'DATA'    ;declare the data segment
  120.     ASSUME DS:_DATA, CS:Nothing
  121.  
  122.     INCLUDE INITDATA.INC    ; InitData *MUST* be first in data seg
  123.     INCLUDE    SDATA.INC    ; Include all data / variables
  124.     INCLUDE    SPAL.INC    ; Include default palette data
  125.  
  126.     ; <-- if you need your own additional custom data space -->
  127.     ; <-- add it here as a custom include file.             -->
  128.  
  129. _DATA    ENDS
  130.      ENDIF
  131.  
  132. ;**********************************************************************
  133.  
  134.     END
  135.  
  136.