home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / tools / bgi_tool / device.inc < prev    next >
Text File  |  1989-05-30  |  6KB  |  207 lines

  1. ; ************************************************************************
  2. ; File: Device.inc
  3. ;
  4. ; Copyright (c) 1988,1989  Borland International, Inc.
  5. ;
  6. ; Purpose: define all the strucs/macros for the BGI interface
  7. ;
  8. ; Last Update: 9/30/88
  9. ;
  10. ; Updates:
  11. ;
  12. ; ************************************************************************
  13.  
  14. callBGI macro    p
  15.     ifndef    BGI_add                ; long call device driver ovr
  16.     extrn    BGI_add:dword            ; though pointer to driver
  17.     endif
  18.     mov    si,$&p                ; (si) is the function code
  19.     call    dword ptr BGI_add
  20.     endm
  21.  
  22. BGIstat macro    p                ; get es:<si> --> ddo status
  23.     ifndef    stable
  24.     extrn    stable:dword
  25.     endif
  26.     les    si,cs:dword ptr stable        ; get location of status to si
  27.     add    si,$&p                ; offset to correct location
  28.     endm
  29.  
  30. ; **********************************************************************
  31.  
  32. ; The following macro builds the required BGI header block
  33.  
  34. BGI    macro    name                ; the following macro builds
  35.     public    name                ; the required ddo header block
  36. name    proc    far                ; the vector table must be at
  37.                         ; 'ddovec' if vector not speced
  38.     push    ds                ; (push ds, push cs are signature)
  39.     push    cs                ; make ds=cs
  40.     pop    ds
  41.     cld                    ; just in case
  42.     push    bp                ; 6 bytes
  43.     call    [DDOVEC+si]            ; call the local function
  44.     pop    bp
  45.     pop    ds                ; restore
  46.     ret                    ; far
  47. name    endp
  48.     db    'CB'                ; just for fun
  49.     dw    ?
  50. EMULATE:ret                    ; emulate function (nop until
  51.     dw    0,0                ; patched by loader)
  52. RESERVED:
  53. NONE:    ret                    ; near ret for unused functions
  54.     endm
  55.  
  56. ; ************** the device driver vector table definition **************
  57.  
  58. $ddo        struc
  59.  
  60. $install    dw    ?    ; install device.
  61.                 ; required to return es:<bx> to status table.
  62.  
  63. $init        dw    ?    ; (bh)=texture (bl)= background color to use.
  64.                 ; ready device for output.
  65.                 ; es:[di] --> rotate,xclip1,yclip1,xclip2,yclip2
  66.  
  67. $clear        dw    ?    ; clear graphics device and ready it for
  68.                 ; output.
  69.  
  70. $post        dw    ?    ; make picture visible. used for making
  71.                 ; printer bitmaps visible, for unloading
  72.                 ; the plotter pen, or for restoring screen.
  73.  
  74. $move        dw    ?    ; used by text, arc, symbol, draw, fill etc.
  75.                 ; set c.p. (ax,bx) = (x,y)
  76.  
  77. $draw        dw    ?    ; draw to (ax,bx) = (x,y)
  78.  
  79. $vect        dw    ?    ; (ax,bx,cx,dx) = x0,y0,x1,y1
  80.  
  81. $poly        dw    ?    ; draw polygon.
  82.                 ; ax=0 start new polygon definition
  83.                 ; ax=1 close and trace poly
  84.                 ; ax=2 close,  fill poly and trace
  85.                 ; ax=3 close and fill poly
  86.                 ; ax=4 draw points and don't capture
  87.                 ; ax=5 turn off polygon capture
  88.                 ; ax=6 draw polygon at es:[bx] and (cx) points
  89.                 ; ax=7 fill & trace polygon at es:[bx] with (cx) points
  90.                 ; ax=8 fill polygon at es:[bx] with (cx) points
  91.  
  92. $dbar        dw    ?    ; bar fill (cpx,cpy,ax,bx)=x0,y0,x1,y1
  93.                 ; (bx,cx)=dx,dy for 3d (with outline)
  94.  
  95. $patbar        dw    ?    ; pattern bar (no outline)
  96.  
  97. $darc        dw    ?    ; draw arc
  98.  
  99. $piesl        dw    ?    ; (ax,bx)= start ang, end ang
  100.                 ; (cx,dx)= x radius, y radius
  101.                 ; center is a cp. (with outline)
  102.  
  103. $fellipse    dw    ?    ; (ab,bx) = x radius, yradius
  104.                 ; (no outline)
  105.  
  106. $palette    dw    ?    ; load a palette entry
  107.                 ; (ax)=entry # (bx)=value
  108.                 ; if (ax)=-1 set background
  109.  
  110. $allpalette    dw    ?    ; load the full palette
  111.                 ; es:[bx] --> palette array
  112.  
  113. $color        dw    ?    ; set active draw color & pattern fill color
  114.                 ; (al)= draw (trace) color (ah)=fill color
  115.  
  116. $fstyle        dw    ?    ; (al)=fill pattern #
  117.                 ; (al)=0 no fill, 1 solid ...
  118.                 ; (ah)=background color (normally 0)
  119.                 ; (used only if pattern in al > 80h)
  120.                 ; if (al)=ff es:<bx>--> pattern definition
  121.  
  122. $lstyle        dw    ?    ; (al)=0(solid) 1(dotted) 2(centerline) 3(dash)
  123.                 ; 4(use pattern) (bx)=bit pattern
  124.                 ; (cx)=line width (normally one)
  125.  
  126. $tstyle        dw    ?    ; (al)=font (ah)=style
  127.                 ; (bx)=x charsize (cx)=y charsize
  128.                 ; if (al)=ff es:<bx>--> font definition table
  129.                 ; changes all params to those available.
  130.  
  131. $text        dw    ?    ; draw text. es:<bx> --> <string>, (0)
  132.  
  133. $textsize    dw    ?    ; text length.
  134.  
  135. $textinfo    dw    ?    ; extended text settings.
  136.  
  137. $flood        dw    ?    ; floodfill (ax,bx) = x,y seed coordinate.
  138.  
  139. $getpix        dw    ?    ; read pixel @(ax,bx) to (dl)
  140.  
  141. $putpix        dw    ?    ; put (dl) to pixel @(ax,bx)
  142.  
  143. $bitmaputil    dw    ?    ; returns (es:[bx]) = bitmap utilities.
  144.                 ;    dw gotographic
  145.                 ;    dw exitgraphic
  146.                 ;    dw putpix
  147.                 ;    dw getpix
  148.                 ;    dw pixelsperbyte
  149.                 ;    dw setwritemode
  150.  
  151. $savebitmap    dw    ?    ; es:[bx]--> buffer to save bitmap to.
  152.                 ; contain bitmap size (pixels) in 1st 2 words
  153.                 ; cx = start x    dx = start line # y
  154.  
  155.  
  156. $restorebitmap    dw    ?    ; es:[bx]--> bitmap buffer to restore.
  157.                 ; contains bitmap size (pixels) in 1st 2 words
  158.                 ; cx=start x dx= start y to put
  159.                 ; (al) = bitblt op (copy, xor, comp, etc.)
  160.  
  161. $setclip    dw    ?    ; extended function to set clip window
  162.                 ; (ax,bx)-(cx,dx) = clip rectangle
  163.  
  164. $query_color    dw    ?    ; extended function for color information
  165.  
  166. $escape        dw    ?    ; escape function for direct i/o
  167.  
  168. $symbol        dw    ?    ; draw symbol (al) = symbol #
  169.                 ; if (al)=ff es:<bx>--> symbol definition
  170.  
  171. $reserve    dw    ?    ; 32 reserved entry points
  172.  
  173. $user        dw    ?    ; User available entry points
  174.  
  175. $ddo        ends
  176.  
  177. ; ************** the device driver status table definition **************
  178.  
  179. $status struc
  180. $stat    db    0        ; 0 = no errors
  181. $devtyp db    0        ; device type 0=screen 1=printer 2=plotter
  182. $xres    dw    639        ; full resolution
  183. $yres    dw    199
  184. $xefres dw    639        ; effective resolution
  185. $yefres dw    199
  186. $xinch    dw    9000        ; device size in inches*1000
  187. $yinch    dw    7000
  188. $aspec    dw    21200        ; aspect ratio
  189. $chsiz    dw    808h        ; standard char size x,y (points)
  190. $coltbl dw    9090h        ; color tables
  191. $status ends
  192.  
  193. ; **********************************************************************
  194. ; this struc defines the info struc returned from the
  195. ; bgi bitmaputil function call @(es:[bx])
  196. $bitmapinfo    struc
  197. $gotographic    dw    ?
  198. $exitgraphic    dw    ?
  199. $putpixel    dw    ?
  200. $getpixel    dw    ?
  201. $bitsperpixel    dw    ?
  202. $setpage    dw    ?    ; draw page in (al)
  203. $setvisual    dw    ?    ; visual display page (al)
  204. $setwritemode    dw    ?    ; set write mode (al)
  205. $bitmapinfo    ends
  206.  
  207.