home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / asm32 / graphics.doc < prev    next >
Text File  |  1994-01-13  |  64KB  |  1,822 lines

  1.  
  2. ****************************** GRAPHICS *************************************
  3.  
  4. ASM32 Graphics (C) Copyright 1993 Douglas Herr
  5. All rights reserved
  6.  
  7. ASM32 recognizes and automatically supports several graphics modes,
  8. including several which are not recognized by IBM's BIOS.  You should
  9. assume that all ASM32 graphics subroutines write directly to the video
  10. hardware.
  11.  
  12. Locations on Graphics screens are defined by coordinate pairs such as (x,y).
  13. X-coordinates are the horizontal dimensions of the screen, and Y-coordinates
  14. are the vertical coordinates.  X = 0 is the at the left edge of the screen,
  15. and X = 719 is the right edge of a Hercules screen, while Y = 0 is the top
  16. edge of the screen and Y = 347 is the bottom (Hercules).  Thus, the
  17. coordinate specified by (719,0) is the extreme upper right corner of a
  18. Hercules screen.
  19.  
  20. Graphics subroutines as powerful and flexible as ASM32's can be quite
  21. large.  If you have licenced ASM32 source code, you can use several
  22. pre-defined conditional assembly directives to eliminate code from
  23. ASM32 object files if you do not want or need to support all graphics
  24. modes:
  25.  
  26.         NOHERC      eliminates all Hercules and InColor code
  27.         NOINCOLOR   eliminates code for the InColor card
  28.                (InColor works with Hercules monochrome code in 2 colors)
  29.         NO256       eliminates code for the three 256-color modes
  30.         NOCGA       eliminates code for CGA graphics modes
  31.         EVGA        assembles only instructions for the EGA/VGA-type
  32.                     16-color modes.
  33.  
  34. If you want to support only 16-color EGA/VGA-type modes, you may also use
  35. the EVGA32.LIB library to eliminate much of the code and data required
  36. for monochrome, InColor, CGA and 256-color modes.  EVGA32.LIB can eliminate
  37. several thousand bytes from your executable files.
  38.  
  39. Example:
  40.  
  41. WL32 mycode[.obj],,,EVGA32+ASM32
  42.  
  43. When using the EVGA32 library, EVGA32 must appear before ASM32 on the
  44. command line so that WL32 uses the subroutines in EVGA32.LIB instead of
  45. the general subroutines in ASM32.
  46.  
  47. EVGA32.LIB is provided with standard ASM32 registration.
  48.  
  49.  
  50. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  51.  
  52. Graphics modes and pages supported are:
  53.  
  54. Mode           Maximum x   Maximum y   Colors  Pages (1)  Equipment
  55.                 ("xmax")    ("ymax")
  56.  
  57. HGraph           719          347       2         0, 1    HGC, HGC+ (2)
  58. HGraph           719          347      16         0, 1    InColor  (2)
  59. 04h, 05h         319          199       4         0       CGA, EGA, MCGA, VGA
  60. 06h              639          199       2         0       CGA, EGA, MCGA, VGA
  61. 0Dh              319          199       16        0 - 7   EGA, VGA  (3)
  62. 0Eh              639          199       16        0 - 3   EGA, VGA  (3)
  63. 0Fh              639          349       4         0       EGA, VGA  (4)
  64. 10h              639          349       16        0, 1    EGA, VGA  (3,5)
  65. 11h              639          479       2         0       MCGA, VGA
  66. 12h              639          479       16        0       VGA
  67. 13h              319          199       256       0       MCGA, VGA
  68. 40h              639          399       2         0       ATT 6300
  69. 6Ah              799          599       16        0       VESA  (6)
  70. XMode16      up to 799     up to 599    16        0       Super EGA/VGA
  71. VGA13X      319 or 359    199 to 479    256       (7)     VGA
  72. SVGA16      799 or 1023   599 or 767    16        0       Super VGA (8)
  73. SVGA256     639 to 1023   399 to 767    256       0       Super VGA (8)
  74.  
  75. (1) page numbering begins with page 0.  Several modes have sufficient
  76.     memory available for additional page(s).
  77. (2) page 1 available after calling Use64k
  78. (3) EGA pages assumes 256k EGA memory
  79. (4) monochrome monitor only
  80. (5) EGA with 128k or more memory
  81. (6) VESA6A is supported by many Super VGA cards with multi-frequency
  82.     monitors
  83. (7) VGA13X pages available range from 0 to 3.  See VGA13X in MODE.DOC.
  84. (8) requires VGAKIT-compatible Super VGA and multi-frequency monitor.  See
  85.     WhichVGA in SYSTEM.DOC and SVGA16 and SVGA256 in MODE.DOC.
  86.  
  87. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  88.  
  89. BEZIER:        draw a Bezier curve on the screen
  90. Source:        bezier.asm (drawline.asm)
  91.  
  92. 80x87 or emulator required
  93.  
  94. Call with:     EBX pointing to curve coordinate data
  95.                ECX = number of points on curve (ECX > 0)
  96.                 a larger number of points on the curve will result in
  97.                 slower operation and a smoother curve.  In many cases
  98.                 ECX > 50 will not improve the appearance of the curve.
  99.  
  100.                 Four coordinates are required: two curve endpoints and
  101.                 two control points.  The curve endpoints (x0, y0) and
  102.                 (x3, y3) are similar to DrawLine's coordinates; if you
  103.                 call bezier with ECX = 1, you will see only a straight
  104.                 line between the endpoints.  The "control points" act
  105.                 like magnets, pulling the curve away from a straight line.
  106.                 At each endpoint, the curve is tangent to a line drawn
  107.                 between the endpoint and the adjacent control point
  108.                 ("adjacent" control point meaning adjacent in the data
  109.                 structure).
  110.  
  111. Returns:       nothing
  112. Uses:          all 80x87 registers
  113. Supports:      all ASM32 graphics modes; drawmode 0 not recommended
  114. Example:
  115.  
  116. include codeseg.inc
  117.  
  118. extrn   bezier:near
  119.  
  120. ; data
  121. extrn   drawmode:byte
  122. bz      dw 50,50            ; first endpoint:       (x0, y0)
  123.         dw 100,0            ; first control point:  (x1, y1)
  124.         dw 200,0            ; second control point: (x2, y2)
  125.         dw 250,175          ; second endpoint:      (x3, y3)
  126.                             ; note that both control points in this
  127.                             ; example pull the curve toward the top of the
  128.                             ; screen
  129.  
  130. ; code
  131. ; program fragment assumes 80x87 is installed
  132. ; and that the screen is in graphics mode
  133.         .
  134.         .
  135.         mov     drawmode,1  ; use foreground color
  136.         lea     ebx,bz      ; point to bezier curve data
  137.         mov     ecx,100     ; should be adequate
  138.         call    bezier
  139.  
  140.  
  141.  
  142. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  143.  
  144. BITBLOCKBYTES: calculate bytes required to save a bit block
  145. Source:        bbbytes.asm ($graph.asm)
  146.  
  147. Call with:     EBX pointing to x- and y-coordinate data (see example)
  148. Returns:       EAX = bytes required to save the bit block
  149. Uses:          EAX, flags
  150. Supports:      all ASM32 graphics modes; call BitBlockBytes while
  151.                the system is in the mode you intend to use.  Otherwise,
  152.                an incorrect byte size may be returned, leading to either
  153.                wasted memory or memory allocation errors.
  154. Example:
  155.  
  156. include codeseg.inc
  157.  
  158. extrn   bitblockbytes:near
  159.  
  160. ; data
  161. x0      dw 100,43         ; first corner at (100,43)
  162. x1      dw 175,143        ; second corner at (175,143)
  163.  
  164. ; code
  165.         .
  166.         .
  167.         .
  168.         lea    ebx,x0          ; EBX points to bit block corner data
  169.         call   bitblockbytes   ; returns EAX = byte size of buffer required
  170.  
  171.  
  172.  
  173. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  174.  
  175. BITPLANEBYTES: calculate bytes to save one plane of a bit block
  176.                alternate entry to BitBlockBytes; calculates bytes
  177.                required to save one plane of multi-plane modes
  178. Source:        bbbytes.asm ($graph.asm)
  179. Call with:     EBX pointing to x- and y-coordinate data
  180. Returns:       EAX = bytes required to save the bit plane
  181. Uses:          EAX, flags
  182. Supports:      all ASM32 graphics modes; call BitPlaneBytes while
  183.                the system is in the mode you intend to use.  If the
  184.                system is is not in a multi-plane mode, BitPlaneBytes
  185.                will give you the same results as BitBlockBytes.
  186.                Graphics modes with multiple planes are mode 0Fh (2 planes)
  187.                and all 16-color modes (4 planes).
  188. Example:
  189.  
  190. include codeseg.inc
  191.  
  192. extrn   bitplanebytes:near
  193.  
  194. ; data
  195. x0      dw 100,43         ; first corner at (100,43)
  196. x1      dw 175,143        ; second corner at (175,143)
  197.  
  198. ; code
  199.         .
  200.         .
  201.         .
  202.         lea    ebx,x0          ; EBX points to bit block corner data
  203.         call   bitplanebytes   ; returns EAX = byte size of buffer required
  204.  
  205.  
  206. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  207.  
  208. BUFFERDIM:     change logical buffer dimensions
  209.                does not change number of pixels displayed on screen;
  210.                used with ScreenOrigin.
  211. Source:        buffdim.asm ($graph.asm)
  212.  
  213. Call with:     EBX pointing to new buffer dimensions
  214.                Note that the logical buffer dimensions should be
  215.                greater than the dimensions displayed on the screen
  216.                The logical buffer dimensions must not create a plane size
  217.                greater than 64k; a logical pixel width of 800 + logical height
  218.                of 600 works out to 60,000 bytes per plane.
  219.  
  220.                If anything is displayed on the screen before changing
  221.                logical dimensions, it will be unreadable after calling
  222.                BufferDim if your logical x-dimension is not the same as
  223.                the screen's physical x-width.
  224.  
  225.                BufferDim does no error checking; you must determine if
  226.                the computer has an EGA or VGA (see GetCRT in SYSTEM.DOC)
  227.                and you must verify that the logical dimensions are greater
  228.                than the screen dimensions.
  229.  
  230.                Using BufferDim disables ASM32's multiple graphics pages
  231.                capabilities.
  232.  
  233. Returns:       nothing
  234. Uses:          nothing; all registers and flags are saved
  235. Supports:      EGA/VGA-type 16-color graphics modes
  236. Example:       see next page
  237.  
  238.  
  239.  
  240. (BufferDim example)
  241.  
  242. ; The computer has a 256k EGA card & EGA-only monitor 
  243. ; and I want to display an image that is 800 pixels wide
  244. ; and 600 pixels high.
  245. ; I'll use EGA mode 10h, switch to logical dimensions of 800x600,
  246. ; put the image in the video buffer & use ScreenOrigin to view
  247. ; various parts of the image
  248.  
  249. include codeseg.inc
  250.  
  251. public  mysub
  252. extrn   bufferdim:near, screenorigin:near
  253. extrn   loadpcx:near
  254.  
  255. include model.inc
  256.  
  257. include dataseg.inc
  258.  
  259. dim     dw 800,600              ; I want 800 logical x
  260.                                 ;  & 600 logical y
  261. xy      dw 0,0                  ; screen origin always starts at (0,0)
  262. fname   db '800x600.pcx',0      ; a .PCX file with an 800 x 600 image
  263. @curseg ends
  264.  
  265. include codeseg.inc
  266.  
  267. mysub   proc    near
  268. ; set up 640x350 16-color mode
  269.         mov    ax,10h           ; use BIOS to set mode
  270.         int    10h
  271.         lea    ebx,dim          ; point to logical buffer dimensions
  272.         call   bufferdim        ; set up 800x600 logical dimensions
  273.                                 ; NOTE: only one page available
  274.  
  275. ; program loads image to video buffer
  276.         lea    edx,fname        ; point to filename
  277.         call   loadpcx          ; get image
  278.  
  279. ; default screen origin: (0,0) of buffer is at (0,0) of screen
  280. ; change portion of buffer displayed to logical (100,100)
  281. ; at (0,0) of screen
  282.         lea    ebx,xy
  283.         mov    word ptr [ebx],100
  284.         mov    word ptr 2[ebx],100
  285.         call   screenorigin
  286.  
  287.  
  288. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  289.  
  290. CIRCLEASPECT:  modifies aspect ratio of circle
  291. Source:        drawcirc.asm ($graph.asm)
  292.  
  293. Call with:     AH = numerator of aspect ratio
  294.                AL = denominator of aspect ratio
  295.                AH <> 0, AL <> 0
  296.  
  297.                CircleAspect is used with DrawCircle to draw an ellipse.
  298.                An aspect ratio less than one makes a flat ellipse and an
  299.                aspect ratio greater than one makes a tall ellipse.
  300.                Aspect ratios greater than 5 or less than 1/5 may cause
  301.                unpredictable results.
  302.  
  303. Returns:       nothing
  304. Uses:          nothing; all registers and flags are saved
  305. Supports:      all ASM32 graphics modes
  306. Example:       see DrawCircle
  307.  
  308.  
  309.  
  310. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  311.  
  312. DEFGMODE:      restore ASM32's internal flags to use system graphics mode
  313.                (see ForceGMode)
  314. Source:        defgmode.asm
  315.  
  316. Call with:     no parameters
  317. Returns:       nothing
  318. Uses:          nothing
  319. Supports:      all ASM32 graphics modes
  320. Example:       see ForceGMode
  321.  
  322.  
  323.  
  324. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  325.  
  326. DRAWCIRCLE:    draw a circle
  327. Source:        drawcirc.asm ($graph.asm, $putdot.asm)
  328.  
  329. Call with:     EBX pointing to circle center coordinates and x-radius
  330.                Drawmodes supported are:
  331.                 4 = AND the foreground color with the screen
  332.                 3 = OR the foreground color with the screen
  333.                 1, 2 = use foreground color
  334.                 0 = XOR circle with existing screen
  335.                -1, -2 = use background color
  336.                -3 = OR the background color with the screen
  337.                -4 = AND the background color with the screen
  338.                See DrawMode for more information
  339.                See also CircleAspect
  340. Returns:       nothing
  341. Uses:          nothing
  342. Supports:      all ASM32 graphics modes
  343. Example:
  344.  
  345. include codeseg.inc
  346.  
  347. extrn   drawcircle:near, circleaspect:near
  348.  
  349. ; data
  350. xcenter dw 100              ; DrawCircle data must be words
  351. ycenter dw 100              ; the circle is centered at (100,100)
  352. xradius dw 50               ; x-dimension radius in pixels (>0)
  353.  
  354. ; code
  355.         .
  356.         .
  357.         .
  358.         mov   ah,5
  359.         mov   al,1          ; a tall ellipse
  360.         call  circleaspect
  361.  
  362.         lea   ebx,xcenter   ; EBX points to circle data
  363.         call  drawcircle    ; draw the circle
  364.  
  365.  
  366. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  367.  
  368. DRAWBOX:       draw a rectangle on a graphics screen
  369. Source:        drawbox.asm ($graph.asm, $vert.asm, $horiz.asm, several others)
  370.  
  371. Call with:     EBX pointing to box corner data
  372.                Drawmodes supported are:
  373.                 4 = AND the foreground color with the screen; color modes
  374.                 3 = OR the foreground color with the screen
  375.                 1, 2 = use foreground color: all modes
  376.                 0 = XOR foreground color with existing pixels
  377.                -1, -2 = use background color: all modes
  378.                -3 = OR the background color with the screen
  379.                -4 = AND the background color with the screen; color modes
  380.                See DrawMode for more information; see also LinePattern
  381. Returns:       nothing
  382. Uses:          nothing
  383. Supports:      all ASM32 graphics modes
  384. Example:
  385.  
  386. include codeseg.inc
  387.  
  388. extrn   drawbox:near
  389.  
  390. ; data
  391. x0      dw 25,10            ; first corner at (25,10); data is word size
  392. x1      dw 301,97           ; opposite corner at (301,97)
  393.  
  394. ; code
  395.         .
  396.         .
  397.         lea   ebx,x0         ; EBX points to box corner data
  398.         call  drawbox
  399.  
  400.  
  401. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  402.  
  403. DRAWLINE:      draw a line on a graphics screen
  404. Source:        drawline.asm ($graph.asm, $vert.asm, $horiz.asm,
  405.                              $loslope.asm, $hislope.asm, many others)
  406.  
  407. Call with:     EBX pointing to line endpoint data
  408.                Drawmodes supported are:
  409.                 4 = AND the foreground color with the screen; color modes
  410.                 3 = OR the foreground color with the screen
  411.                 1, 2 = use foreground color: all modes
  412.                 0 = XOR foreground color with existing pixels
  413.                -1, -2 = use background color: all modes
  414.                -3 = OR the background color with the screen
  415.                -4 = AND the background color with the screen; color modes
  416.                See DrawMode for more information; see also LinePattern
  417. Returns:       nothing
  418. Uses:          nothing
  419. Supports:      all ASM32 graphics modes
  420. Example:
  421.  
  422. include codeseg.inc
  423.  
  424. extrn   drawline:near
  425.  
  426. ; data
  427. x0      dw 25,10            ; first endpoint at (25,10); data is word size
  428. x1      dw 301,97           ; other end of line at (301,97)
  429.  
  430. ; code
  431.         .
  432.         .
  433.         lea   ebx,x0         ; [EBX] points to line coordinate data
  434.         call  drawline
  435.  
  436.  
  437. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  438.  
  439. DRAWMODE:      control ASM32 graphics drawing mode
  440. Source:        $graph.asm
  441.  
  442.                DrawMode is a public byte used to control the operation
  443.                of many ASM32 subroutines.  ASM32's default drawmode is 1.
  444.  
  445.                Typically, drawmodes have the following effects:
  446.                 2 = use foreground color only; text is printed without
  447.                     background, foreground only of line patterns or
  448.                     fill patterns is used
  449.                 1 = use foreground and background; text is printed with
  450.                     background, line patterns and fill patterns update
  451.                     both foreground and background
  452.                 0 = foreground color is XORed with the existing screen
  453.                     (not supported in 256-color or CGA 4-color modes)
  454.                -1 = characters or fill pattern drawn with foreground
  455.                     and background reversed
  456.                -2 = character or line drawn with background color only
  457.  
  458. Supports:      all ASM32 graphics modes
  459. Example:
  460.  
  461. include codeseg.inc
  462.  
  463. ; data
  464. extrn   drawmode:byte
  465.  
  466. ; code
  467.         .
  468.         .
  469.         mov     drawmode,2      ; print text with foreground color only
  470.  
  471.  
  472. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  473.  
  474. FILLAREA:      fills an irregular area on a graphics screen
  475. Source:        fillarea.asm ($graph.asm, $horiz.asm, $getdot.asm,
  476.                              several others)
  477.  
  478. Call with:     EBX pointing to seed pixel coordinates
  479.  
  480.                Fills many irregularly-shaped areas with color and/or
  481.                pattern, beginning at (x,y).  FillArea may not work
  482.                properly with regions which have concave boundaries
  483.                crossing horizontal lines.  The area's boundary is
  484.                defined by a solid line of non-zero pixels.
  485.                DrawModes supported are:
  486.                 2 = fill with foreground color only (if fill pattern
  487.                     has been defined): 16-color modes
  488.                 1 = fill with foreground (and background, if fillpattern
  489.                     defined): all modes
  490.                See also FillPattern.
  491. Returns:       nothing
  492. Uses:          nothing
  493. Supports:      all ASM32 graphics modes
  494. Example:
  495.  
  496. include codeseg.inc
  497.  
  498. extrn   fillarea:near
  499.  
  500. ; data
  501. x       dw 10,15         ; start fill operation at x=10, y=15
  502.  
  503. ; code
  504.         .
  505.         .
  506.         lea    ebx,x
  507.         call   fillarea
  508.  
  509.  
  510. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  511.  
  512. FILLBOX:       draw a filled rectangle on a graphics screen
  513. Source:        fillbox.asm ($graph.asm, $horiz.asm, several others)
  514.  
  515. Call with:     EBX pointing to box corner data
  516.                Drawmodes supported are:
  517.                 4 = AND the box with the pre-existing screen
  518.                 3 = OR the foreground color with the screen
  519.                 1, 2 = use foreground color
  520.                 0 = XOR foreground color with existing pixels
  521.                -1, -2 = use background color
  522.                -3 = OR the background color with the screen
  523.                -4 = AND the background color with pre-existing screen
  524.                See DrawMode for more information; also see FillPattern.
  525. Returns:       nothing
  526. Uses:          nothing
  527. Supports:      all ASM32 graphics modes
  528. Example:
  529.  
  530. include codeseg.inc
  531.  
  532. extrn   fillbox:near
  533.  
  534. ; data
  535. x0      dw 25,10            ; first corner at (25,10); data is word size
  536. x1      dw 301,97           ; opposite corner at (301,97)
  537.  
  538. ; code
  539.         .
  540.         .
  541.         lea   ebx,x0         ; [EBX] points to box corner data
  542.         call  fillbox
  543.  
  544.  
  545. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  546.  
  547. FILLPATTERN:   define an optional pattern for FillArea & FillBox
  548. Source:        fpattern.asm
  549.  
  550. Call with:     EBX pointing to ASCIIZ pattern string.
  551.                Up to 8 characters in the string will be used.
  552.                The pattern must be re-defined before each call to a line
  553.                drawing subroutine (FillArea, FillBox).
  554. Returns:       nothing
  555. Uses:          nothing
  556. Supports:      all ASM32 graphics modes except 256-color modes
  557. Example:
  558.  
  559. include codeseg.inc
  560.  
  561. extrn   fillbox:near
  562. extrn   fillpattern:near
  563.  
  564. ; data
  565. x0      dw 25,10            ; first corner at (25,10); data is word size
  566. x1      dw 301,97           ; opposite corner at (301,97)
  567. pattern db 8 dup(10101010b),0
  568.  
  569. ; code
  570.         .
  571.         .
  572.         lea   ebx,pattern   ; [EBX] points to pattern string
  573.         call  fillpattern   ; define the pattern
  574.         sub   ebx,8         ; [EBX] points to box corner data
  575.         call  fillbox       ; draw a patterned box
  576.  
  577.  
  578. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  579.  
  580. FORCEGMODE:    force ASM32 to use one particular graphics mode
  581.                this is handy for two-monitor systems
  582. Source:        defgmode.asm
  583.  
  584. Call with:     AL = graphics mode to use
  585.                forcegmode does not change the actual screen mode; what
  586.                it does is to force ASM32's central graphics control
  587.                to ignore the system mode.  Call defgmode to restore
  588.                ASM32's internal flags to the default state.
  589. Returns:       nothing
  590. Uses:          nothing
  591. Supports:      all ASM32 graphics modes (256-color modes not tested)
  592. Example:
  593.  
  594. include codeseg.inc
  595.  
  596. extrn   modecolor:near, modemono:near
  597. extrn   forcegmode:near, gcolor:near, defgmode:near
  598.  
  599. ; data
  600. gtext   db 'Graphics mode',0
  601. gpos    dd 0                   ; 2 words of zeros to position text
  602. ttext   db 'Text mode',0
  603.  
  604. ; code
  605.         .
  606. ; I want text on the monochrome screen and 16-color graphics on the EGA
  607.         call   modecolor       ; switch to color monitor
  608.         mov    v86r_ax,10h     ; set up graphics mode
  609.         mov    al,10h
  610.         int    30h
  611.         mov    al,10h          ; tell ASM32 to use mode 10h
  612.                                ; use AL = 13h for VGA 256-color modes
  613.                                ; use AL = 8 for Hercules (including InColor)
  614.         call   forcegmode      ; best to do this after the mode change
  615.         call   modemono        ; switch back to the monochrome monitor
  616.         mov    ax,010Ch        ; blue background, red foreground
  617.         call   gcolor
  618.         lea    esi,gtext       ; point to graphics message
  619.         lea    edx,gpos        ; positioned at upper left corner
  620.         call   gprint          ; prints on EGA in graphics mode
  621.  
  622.         lea    esi,ttext       ; point to text message
  623.         xor    dx,dx           ; upper left corner of text screen
  624.         mov    ah,7            ; normal color
  625.         call   tprint          ; display message on monochrome monitor
  626.         .
  627.         .
  628. ; sometime later, all done with this setup
  629.         call   defgmode        ; clear ASM32's internal graphics flags
  630.  
  631.  
  632. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  633.  
  634. GBASEADDRESS:  change ASM32 graphics base address
  635. Source:        gbaseadr.asm ($graph.asm)
  636.  
  637. Call with:     EAX = base address for alternate graphics BUFFER
  638.                if EAX = 0, default base segment is restored
  639.                GBaseSeg may be used to create and update off-screen graph
  640.                images, thus simulating multiple screen pages.
  641. Returns:       nothing
  642. Uses:          nothing
  643. Supports:      mode 04h, 05h, HGraph (monochrome only), 40h, 11h, 13h
  644.  
  645.                buffer size requirements:
  646.  
  647.                 mode 04h, 05h    16384 bytes
  648.                 HGraph, 40h      32768 bytes
  649.                 mode 11h         38400 bytes
  650.                 mode 13h         64000 bytes
  651.  
  652.                 You must call GBaseAddress AFTER switching the system to
  653.                 graphics mode, or it will not work; you must also call
  654.                 GBaseAddress with EAX = 0 before changing from one graphics
  655.                 mode to another, or the default base address may get messed
  656.                 up.
  657. Example:
  658.  
  659. public myprog
  660.  
  661. include codeseg.inc
  662.  
  663. extrn  gbaseaddress:near, drawbox:near
  664.  
  665. ; data
  666. boxdata dw 0,0,319,199
  667.  
  668. screen1 db 64000 dup (0)     ; second screen for mode 13h
  669.  
  670. ; code
  671. myprog proc
  672. ; mode 13h, 320x200x256 colors
  673.        mov     v86r_ax,13h
  674.        mov     al,10h
  675.        int     30h
  676.  
  677. ; use alternate buffer
  678.        lea     eax,screen1
  679.        call    gbaseaddress
  680.        lea     ebx,linedata
  681.        call    drawbox
  682.  
  683. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  684.  
  685. GCENTER:       centers a string on a graphics screen
  686. Source:        gcenter.asm (gprint.asm, $graph.asm, strlen.asm, f8x14.asm)
  687.  
  688. GCENTERX:      centers a double-width string on a graphics screen
  689. Source:        gcenterx.asm (gprintx.asm, $graph.asm, strlen.asm, f8x14.asm)
  690.  
  691. Call with:     ESI pointing to the string to print
  692.                EDX pointing to x- and y-coordinates
  693.                the x-coordinate is a placeholder; GCenter calculates the
  694.                correct x value before calling GPrint.
  695.  
  696.                Colors, drawmodes and character sizes are the same as
  697.                for GPrint or GPrintX.
  698. Returns:       x = calculated x-coordinate
  699. Uses:          nothing; all registers and flags are saved.
  700. Supports:      all ASM32 graphics modes
  701. Example:
  702.  
  703. include codeseg.inc
  704.  
  705. extrn   gcenter:near
  706.  
  707. ; data
  708. x       dw ?
  709. y       dw 2               ; print graph title 2 pixels down from the top
  710. title   db 'Graph title',0
  711.  
  712. ; code
  713.         .
  714.         .
  715.         lea    esi,title    ; ESI points to string
  716.         lea    edx,x        ; point to coordinates
  717.         call   gcenter      ; print the string, centered horizontally
  718.  
  719.  
  720. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  721.  
  722. GCLEAR:        clears the active portion of a graphics screen
  723.                uses background color
  724. Source:        gclear.asm ($graph.asm, $horiz.asm, others)
  725.  
  726. Call with:     no parameters
  727. Returns:       nothing
  728. Uses:          nothing
  729. Supports:      all ASM32 graphics modes
  730. Example:
  731.  
  732. include codeseg.inc
  733.  
  734. extrn   gclear:near
  735.  
  736. ; code
  737.         .
  738.         .
  739.         .
  740.         call  gclear
  741.  
  742. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  743.  
  744. GCOLOR:        update color used by ASM32 graphics
  745. Source:        gcolor.asm ($graph.asm)
  746.  
  747. Call with:     AL = foreground color
  748.                AH = background color
  749.  
  750.                for 4-color modes, colors may be 0-3
  751.                for 16-color modes, colors may be 0-15
  752.                for 256-color modes, colors may be 0-255
  753.  
  754. Returns:       nothing
  755. Uses:          nothing
  756. Supports:      all color graphics modes and mode 0Fh
  757.                GColor is ignored by 2-color modes
  758. Example:
  759.  
  760. include codeseg.inc
  761.  
  762. extrn   gcolor:near
  763.  
  764. ; code
  765.         .
  766.         .
  767.         .
  768.         mov   ah,bcolor      ; background color
  769.         mov   al,fcolor      ; foreground color
  770.         call  gcolor
  771.  
  772.  
  773. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  774.  
  775. GCOPY:         copies one page of graphics memory to another
  776. Source:        gcopy.asm ($graph.asm)
  777.  
  778. Call with:     BH = frompage
  779.                BL = topage
  780. Returns:       CF = error flag
  781.                 if CF = 0, no error
  782.                 if CF = 1, bad page number or frompage = topage
  783. Uses:          CF
  784. Supports:      Hercules and InColor (with Use64k)
  785.                EGA/VGA modes 0Dh, 0Eh, 0Fh, 10h
  786.                VGA13X [0,1,2]
  787. Example:
  788.  
  789. include codeseg.inc
  790.  
  791. extrn   gcopy:near
  792.  
  793. ; code
  794.         .
  795.         .
  796.         .
  797.         mov   bx,0001h       ; copy from page 0 to page 1
  798.         call  gcopy
  799.         jc    bad_page       ; uh oh, pages not supported
  800.  
  801.  
  802. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  803.  
  804. GCURSOR:       simulate text-mode cursor on graphics screen
  805. GUCURSOR:      simulate underscore cursor on graphics screen
  806. Source:        gcursor.asm ($graph.asm)
  807.  
  808. Call with:     EDX pointing to x- and y-coordinate word data
  809.                x and y are the coordinates of the UPPER LEFT corner of
  810.                a character block.  Note that text characters are
  811.                8 x-pixels wide and from 8 to 16 y-pixels high.
  812.  
  813.                GCursor and GUCursor maintain the simulated cursor while
  814.                the keyboard type-ahead buffer is empty.  GCursor shape
  815.                is an underscore when INSERT is off and a larger block
  816.                when INSERT is on.  GUCursor is an underscore regardless
  817.                of the state of the INSERT toggle.
  818. Returns:       nothing
  819. Uses:          EAX, ECX
  820. Supports:      all ASM32 graphics modes
  821. Example:
  822.  
  823. include codeseg.inc
  824.  
  825. extrn   gcursor:near, getkey:near
  826.  
  827. ; data
  828. x       dw 10,20        ; put the cursor in the character block at (10,20)
  829.  
  830. ; code
  831.         .
  832.         .
  833.         .
  834.         lea   edx,x
  835.         call  gcursor
  836.         call  getkey    ; retrieve the key that was pressed
  837.  
  838.  
  839. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  840.  
  841. GETBITBLOCK:   saves a portion of a graphics screen in memory
  842. Source:        bitblock.asm ($graph.asm, bb02.asm, bb04.asm, bb06.asm,
  843.                              bb08.asm, bb10.asm, bb12.asm, bb14.asm)
  844.  
  845. Call with:     EDI pointing to memory buffer for the bit block
  846.                EBX pointing to x & y coordinate data
  847.  
  848.                Note that a bit block copied from a 4-plane mode may
  849.                only be restored to a 4-plane mode; likewise, a bit
  850.                block saved from a 2-color mode should be restored to
  851.                a 2-color mode or to a single bit plane of a 16-color
  852.                mode.
  853. Returns:       nothing
  854. Uses:          nothing
  855. Supports:      all ASM32 graphics modes
  856.  
  857.  
  858.     If you do not intend to support all ASM32 graphics modes, you can
  859.     call mode-specific BitBlock subroutines to reduce .EXE size.
  860.     These subroutines use the same calling parameters as GetBitBlock
  861.     and PutBitBlock:
  862.  
  863.  
  864.     getbb02: mode 04h, 05h, 11h, 40h, HGraph (mono and InColor)
  865.     getbb06: mode 0Dh, 0Eh, 0Fh, 10h, 12h, SVGA16(0), XMODE16
  866.     getbb08: mode 13h
  867.     getbb10: VGA13X
  868.     getbb12: SVGA16
  869.     getbb14: SVGA256
  870.  
  871.  
  872.     putbb02: mode 04h, 05h, 11h, 40h, HGraph (mono only)
  873.     putbb04: HGraph (InColor only)
  874.     putbb06: mode 0Dh, 0Eh, 0Fh, 10h, 12h, SVGA16(0), XMODE16
  875.     putbb08: mode 13h
  876.     putbb10: VGA13X
  877.     putbb12: SVGA16
  878.     putbb14: SVGA256
  879.  
  880. Example on next page
  881.  
  882.  
  883. ; example of GetBitBlock use
  884.  
  885. include codeseg.inc
  886.  
  887. extrn   bitblockbytes:near, getbitblock:near, putbitblock:near
  888.  
  889. ; data
  890. ptr     dw ?                ; use this to save pointer to bit block
  891. x0      dw 100,43,175,143   ; save from (100,43) to (175,143)
  892.  
  893. ; code
  894.         .
  895.         .
  896.         lea   ebx,x0        ; point to block corners
  897.         call  bitblockbytes ; calculate byte requirement
  898.         jc    too_big       ; error control
  899.         mov   ebx,eax
  900.         sys   GetMemNear
  901.         jc    no_memory     ; more error control
  902.         mov   ptr,ebx       ; save near address of bit block
  903.         mov   edi,ebx       ; EDI points to buffer
  904.         lea   ebx,x0        ; EBX points to coordinate data
  905.         call  getbitblock
  906.         .
  907.         .
  908.  
  909. ; later . . .
  910.         lea   ebx,x0        ; put the bit block back where you found it
  911.         mov   edi,ptr       ; EDI points to buffer
  912.         call  putbitblock
  913.  
  914.  
  915. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  916.  
  917. GETBITPLANE:   saves one plane of a bit block in memory
  918. Source:        small & medium: bitplane.asm ($graph.asm, bb02.asm, bb04.asm
  919.                                bb06.asm, bb08.asm, bb10.asm, bb12.asm,
  920.                                bb14.asm)
  921.  
  922. Call with:     EDI pointing to memory buffer for the bit block
  923.                EBX pointing to x & y coordinate data
  924.                AL = plane number to save
  925.                valid plane numbers are 0 - 3 in 16-color modes
  926.                                        0 & 2 in EGA monochrome mode
  927.  
  928.                In 16-color modes, EGA/VGA and InColor planes are:
  929.                 0 = blue, 1 = green, 2 = red, 3 = gray (or intensity)
  930.                In EGA monochrome mode, plane 0 = normal, plane 2 = blink
  931.                 or intensity
  932.                The actual colors each plane represents may change
  933.                depending on the values in the pallete registers.
  934.  
  935. Supports:      all 16-color modes plus EGA monochrome
  936.                other modes: GetBitPlane works like GetBitBlock
  937.  
  938.  
  939. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  940.  
  941. GETVIEW:       returns a pointer to the current view coordinates for
  942.                the active page
  943. Source:        getview.asm ($graph.asm)
  944.  
  945. Call with:     no parameters
  946.                most ASM32 subroutines, except the GPrint series, Gload,
  947.                GCopy and GSave, limit their activity to the view region.
  948.                You may use the returned pointer to change the active
  949.                portion of the screen; be careful not to exceed the maximum
  950.                x1 and y1 values permitted by the current mode.  Also, x0
  951.                must always be less than x1 and y0 must always be less than
  952.                y1.
  953.                ASM32's defaults are:
  954.                 x0 = 0
  955.                 y0 = 0
  956.                 x1 = xmax
  957.                 y1 = ymax
  958.  
  959.                See also ResetView
  960.  
  961. Returns:       EBX pointing to the current view coordinates
  962. Uses:          EBX
  963. Supports:      all ASM32 graphics modes and pages
  964. Example:
  965.  
  966. include codeseg.inc
  967.  
  968. extrn   getview:near
  969.  
  970. x0 EQU word ptr [EBX]
  971. y0 EQU word ptr 2[EBX]
  972. x1 EQU word ptr 4[EBX]
  973. y1 EQU word ptr 6[EBX]
  974.  
  975. ; code
  976.         .
  977.         .
  978.         .
  979.         call   getview
  980.  
  981.  
  982. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  983.  
  984. GETDOT:        determine pixel value on graphics screen
  985. Source:        getdot.asm ($graph.asm, $getdot.asm, others)
  986.  
  987. Call with:     EBX pointing to pixel coordinate data
  988. Returns:       if CF = 0, AX = pixel value
  989.                if CF = 1, pixel coordinates outside active view area
  990. Uses:          EAX, CF
  991. Supports:      all ASM32 graphics modes
  992. Example:
  993.  
  994. include codeseg.inc
  995.  
  996. extrn   getdot:near
  997.  
  998. ; data
  999. x       dw 10,10             ; pixel at (10,10)
  1000.  
  1001. ; code
  1002.         .
  1003.         .
  1004.         .
  1005.         lea    ebx,x         ; point to pixel coordinates
  1006.         call   getdot        ; get pixel value
  1007.         jc     out_of_bounds ; oops
  1008.  
  1009.  
  1010.  
  1011. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1012.  
  1013. GLOAD:         loads a graphics screen saved as a disk file by GSave
  1014. Source:        gload.asm ($graph.asm, $gbytes.asm, $reset.asm, $plane.asm)
  1015.  
  1016. Call with:     EDX pointing to the name of the file to load
  1017.                the filename must be an ASCIIZ string in low memory
  1018. Returns:       AX = MS-DOS error code
  1019. Uses:          EAX, flags
  1020. Supports:      all ASM32 graphics modes
  1021. Example:
  1022.  
  1023. include codeseg.inc
  1024.  
  1025. extrn   gload:near
  1026.  
  1027. ; data
  1028. filename db 'graph.bin',0
  1029.  
  1030. ; code
  1031.         .
  1032.         .
  1033.         lea   edx,filename
  1034.         call  gload
  1035.  
  1036.  
  1037. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1038.  
  1039. GPAGE:         changes active and displayed graphics page
  1040.                GPage changes ASM32's default graphics page and displays
  1041.                the page.  See also UseGPage and ShowGPage.
  1042. Source:        gpage1.asm ($graph.asm, $herc.asm, gpage.asm)
  1043.  
  1044. Call with:     BL = page number.  See table at start of this GRAPHICS.DOC
  1045.                file.
  1046. Returns:       if CF = 0, no problem
  1047.                if CF = 1, bad page number requested
  1048. Uses:          CF
  1049. Supports:      EGA, VGA, Hercules, InColor: modes with more than one page
  1050. Example:
  1051.  
  1052. include codeseg.inc
  1053.  
  1054. extrn   gpage:near
  1055.  
  1056. ; code
  1057.         .
  1058.         .
  1059.         mov    bl,1          ; use and show page 1
  1060.         call   gpage
  1061.         jc     oops          ; uh oh, wrong mode
  1062.  
  1063. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1064.  
  1065. GPRINT:        prints ASCIIZ string on a graphics screen
  1066. Source:        gprint.asm ($graph.asm, f8x14.asm, $gp00.asm, $gp02.asm,
  1067.                            $gp06.asm, $gp08.asm, $gp10.asm, others)
  1068.  
  1069. Call with:     ESI pointing to the ASCIIZ string
  1070.                EDX pointing to x- and y-coordinate data
  1071.                drawmodes supported by GPrint are:
  1072.                 2 = foreground only; background pixels left alone
  1073.                 1 = foreground and background pixels updated with
  1074.                     current gcolor
  1075.                 0 = foreground color is XORed with the existing screen
  1076.                -1 = like drawmode 1, but foreground and background reversed
  1077.                -2 = like drawmode 2, but uses background color
  1078.                Any pixel position may be specified; does not wrap around
  1079.                from right side of screen to left.  Default character size
  1080.                is 8x8 for CGA modes and modes 0Dh, 0Eh and 13h, 8x14 for
  1081.                others.
  1082.                High ASCII characters are undefined in 8x8 pixel modes
  1083.                unless you call SmallText sometime earlier in the program.
  1084. Returns:       nothing
  1085. Uses:          ECX; all other registers and flags are saved
  1086. Supports:      all ASM32 graphics modes
  1087.                not all drawmodes supported with CGA modes 04h and 05h
  1088. Example:
  1089.  
  1090. include codeseg.inc
  1091.  
  1092. extrn   gprint:near
  1093.  
  1094. ; data
  1095. string  db 'print this, if you will',0
  1096. gpos    dw 0,0                          ; print at upper left corner
  1097.  
  1098. ; code
  1099.         .
  1100.         .
  1101.         .
  1102.         lea   esi,string
  1103.         lea   edx,gpos
  1104.         call  gprint
  1105.  
  1106. additional GPRINT information on next page
  1107.  
  1108. GPRINT will work with user-defined fonts up to 16 pixel rows high in all
  1109. modes with ymax > 200.  GPRINT reads a public data area in DGROUP to
  1110. determine the SEGMENT:OFFSET address of the font data, the number of pixel
  1111. rows per character and the byte increment between sucessive character
  1112. definitions.  Characters must be 8 pixels wide.
  1113.  
  1114. FONTDATA.ASM has the required font data:
  1115.  
  1116. public  f14seg
  1117. f14seg  dd OFFSET f8x14 ; offset of user-loaded font (8x14 default)
  1118.         db 14           ; byte size of character
  1119.         db 14           ; bytes from start of one char to start of next
  1120.  
  1121. Example:
  1122.  
  1123. include model.inc
  1124.  
  1125. extrn   $fopen:near, $fread:near
  1126.  
  1127. include dataseg.inc
  1128.  
  1129. ; data
  1130. extrn   f14seg:dword
  1131.  
  1132. fname   db 'c:\ramfont\italics.fnt',0   ; 8x14 characters
  1133. fbuffer db 4096 dup (0)                 ; all RAMFont fonts are 4096 bytes
  1134. ; the fonts supplied by Hercules with the Graphics Card Plus and InColor
  1135. ; card are a variety of sizes, but in each font file the byte increment
  1136. ; is always 16 bytes
  1137.  
  1138. @curseg   ends
  1139.  
  1140. include codeseg.inc
  1141.  
  1142. ; code
  1143.         .
  1144.         .
  1145.         lea     edx,fname       ; filename is in low memory
  1146.         call    fopen          ; open file for read
  1147.         mov     bx,ax           ; copy file handle to BX
  1148.         lea     edx,fbuffer     ; EDX points to buffer
  1149.         mov     cx,4096
  1150.         call    fread
  1151.         call    fclose         ; close file
  1152.         mov     f14seg,edx      ; update address of new font
  1153.         mov     f14seg+4,(16 shl 8) OR 14
  1154.                                 ; 14-pixel row character
  1155.                                 ; 16 bytes between character definitions
  1156.  
  1157. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1158.  
  1159. GPRINTDOWN:    prints ASCIIZ string vertically on graph screen
  1160. GPRINTUP:      prints ASCIIZ string vertically on graph screen
  1161. Source:        gprint.asm ($graph.asm, f8x14.asm, $gp00.asm, $gp02.asm,
  1162.                            $gp06.asm, $gp08.asm, $gp10.asm, others)
  1163.  
  1164. Call with:     same as GPrint
  1165.                rotates each character 90 degrees and prints from top
  1166.                downward or from bottom upward.  Character size 8x8.
  1167.  
  1168.                Returned data and registers used same as GPrint
  1169. Example:       see GPrint.
  1170.  
  1171.  
  1172. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1173.  
  1174. GPRINTX:       print string on a graphics screen, double width
  1175. GPRINT2X:      print string on a graphics screen, double size
  1176. GPRINTDOWNX:   print string vertically on graph screen, 2x width
  1177. GPRINTDOWN2X:  print string vertically on graph screen, 2x size
  1178. GPRINTUPX:     print string vertically on graph screen, 2x width
  1179. GPRINTUP2X:    print string vertically on graph screen, 2x size
  1180. Source:        gprintx.asm ($graph.asm, f8x14.asm, $gp00.asm, $gp02.asm,
  1181.                             $gp06.asm, $gp08.asm, $gp10.asm, others)
  1182.  
  1183.  
  1184.                Variations of GPrint and GPrintDOWN/GPrintUP;
  1185.                GPrintx, GPrintDOWNx and GPrintUPx print characters
  1186.                which are twice as wide as normal; 2x subroutines
  1187.                print the characters twice as wide and twice as high
  1188.                as normal.
  1189.  
  1190.                Parameters, supported modes and drawmodes are same as
  1191.                GPrint.  GPrintx and GPrint2x also work with user-defined
  1192.                fonts.  See GPrint.
  1193. Example:       see GPrint.
  1194.  
  1195.  
  1196. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1197.  
  1198. GPUTCHR:       print a single character on graphics screen
  1199. Source:        gputchr.asm (gprint.asm)
  1200.  
  1201. Call with:     EDX pointing to (x,y) coordinate data
  1202.                AL = character to print
  1203. Returns:       nothing
  1204. Uses:          ECX
  1205. Supports:      all ASM32 graphics modes
  1206. Example:
  1207.  
  1208. include codeseg.inc
  1209.  
  1210. public  mycode
  1211. extrn   gputchr:near
  1212.  
  1213. ; data
  1214. xy      dw 10,10        ; (x,y) coordinates for character
  1215.  
  1216. ; code
  1217. mycode  proc
  1218. ; program fragment assumes screen in graphics mode
  1219.         .
  1220.         .
  1221.         .
  1222.         lea     edx,xy   ; EDX points to coordinate data
  1223.         mov     al,'A'
  1224.         call    gputchr
  1225.         .
  1226.         .
  1227.         .
  1228.         ret
  1229. mycode  endp
  1230.         end
  1231.  
  1232.  
  1233.  
  1234. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1235.  
  1236. GSAVE:         saves a graphics screen as a disk file
  1237.                does not compress image
  1238. Source:        gsave.asm ($graph.asm, $gbytes.asm, $reset.asm, $plane.asm)
  1239.  
  1240. Call with:     EDX pointing to ASCIIZ filename in low memory
  1241.                disk space requirements vary depending on graphics mode:
  1242.  
  1243.                  HGraph  (mono)       32,768 bytes
  1244.                  HGraph  (InColor)   131,072 bytes
  1245.                  VGA13X(0)            64,000 bytes
  1246.                  VGA13X(1)            76,800 bytes
  1247.                  VGA13X(2)           128,000 bytes
  1248.                  VGA13X(3)           172,800 bytes
  1249.                  XMode16  varies; up to 240,000 bytes
  1250.                  VESA6Ah, SVGA16(0)  240,000 bytes
  1251.                  SVGA16(1)           393,216 bytes
  1252.                  SVGA256(0)          256,000 bytes
  1253.                  SVGA256(1)          307,200 bytes
  1254.                  SVGA256(2)          480,000 bytes
  1255.                  SVGA256(3)          786,432 bytes
  1256.                  04h/05h/06h          16,384 bytes
  1257.                  40h                  32,768 bytes
  1258.                  0Dh                  32,000 bytes
  1259.                  0Eh                  64,000 bytes
  1260.                  0Fh                  56,000 bytes
  1261.                  10h                 112,000 bytes
  1262.                  11h                  38,400 bytes
  1263.                  12h                 153,600 bytes
  1264.                  13h                  64,000 bytes
  1265.  
  1266. Returns:       if CF = 1, AX = MS-DOS error code
  1267.                if CF = 0, no error
  1268. Uses:          AX, flags
  1269. Supports:      all ASM32 graphics modes
  1270. Example:
  1271.  
  1272. include codeseg.inc
  1273.  
  1274. extrn   gsave:near
  1275.  
  1276. ; data
  1277. filename db 'graph.bin',0
  1278.  
  1279. ; code
  1280.         .
  1281.         .
  1282.         .
  1283.         lea   edx,filename        ; point to ASCIIZ filename
  1284.         call  gsave               ; save graph
  1285.         jc    oops                ; do some error control if problem
  1286.  
  1287. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1288.  
  1289. LINEPATTERN:   defines an optional pattern for DrawLine and DrawBox
  1290. Source:        lpattern.asm ($graph.asm)
  1291.  
  1292. Call with:     EBX pointing to an ASCIIZ string of up to 8 characters.
  1293.                The bit patterns in each character are used to make dashed
  1294.                or dotted lines. For drawmodes > 0, each pixel in the line
  1295.                is updated with the foreground color if the corresponding
  1296.                bit in the bit pattern is 1.  If the bit in the bit pattern
  1297.                is 0, the corresponding pixel in the line is treated as a
  1298.                background pixel.  LinePattern must be called before each
  1299.                call to a subroutine in drawline.obj if you want the line
  1300.                pattern to be used.
  1301.  
  1302.                drawmodes supported are:
  1303.                (monochrome modes)
  1304.                 2 = update foreground pixels only
  1305.                 1 = update foreground and background pixels
  1306.                 0 = XOR the foreground color with the existing image
  1307.                -1 = like drawmode 1, but foreground and background colors
  1308.                     are reversed
  1309.                -2 = like drawmode 2, but foreground and background colors
  1310.                     are reversed
  1311.                (color modes)
  1312.                same as monochrome, plus:
  1313.                 3 = OR the foreground pixels with the pre-existing screen
  1314.                -3 = OR the background pixels with the pre-existing screen
  1315.                 4 = AND the foreground pixels with the pre-existing screen
  1316.                -4 = AND the background pixels with the pre-existing screen
  1317.  
  1318. Returns:       nothing
  1319. Uses:          nothing
  1320. Supports:      all ASM32 graphics modes
  1321. Example:
  1322.  
  1323. include codeseg.inc
  1324.  
  1325. extrn   linepattern:near, drawline:near
  1326.  
  1327. ; data
  1328. x0      dw 25,10,301,97          ; line endpoints at (25,10) & (301,97)
  1329. pattern db 4 dup(32,64),0        ; 8 bytes past x0
  1330.  
  1331. ; code
  1332.         .
  1333.         .
  1334.         lea   ebx,pattern        ; EBX points to bit pattern
  1335.         call  linepattern        ; let drawline know what pattern to use
  1336.         sub   ebx,8              ; point to line endpoint data
  1337.         call  drawline           ; draw a patterned line
  1338.  
  1339. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1340.  
  1341. LOADPCX:       reads a .PCX-format file from disk and unpacks to screen
  1342. Source:        loadpcx.asm ($graph.asm, color16.asm, fopen.asm, fseek.asm,
  1343.                             fget.asm, fgetchr.asm, $plane.asm, $reset.asm)
  1344.  
  1345. Call with:     [EDX] pointing to ASCIIZ filename of .PCX file.
  1346.                LoadPCX assumes that the video system is in an appropriate
  1347.                mode for the image; see PCXInfo (GRAPHICS.DOC).
  1348.                The dimensions of the image in the .PCX file need not
  1349.                match the screen dimensions exactly; any 16-color image
  1350.                may be loaded to a 16-color screen; if the image is too
  1351.                large for the video buffer, either the upper left portion
  1352.                of the image is unpacked, or you may re-size the video buffer
  1353.                (see BufferDim) to fit the image.  Any 2-color ("monochrome")
  1354.                image may be loaded to any monochrome screen.
  1355.  
  1356.                256-color PCX files intended for the standard 320x200
  1357.                mode 13h may be loaded to the non-standard VGA13X modes.
  1358.                In VGA13X modes with 400 or 480 vertical pixel rows,
  1359.                a 320x200 image is stretched to fit screen proportions.
  1360. Returns:       if CF = 0, no error
  1361.                if CF = 1, AX = DOS error code
  1362. Uses:          AX, flags
  1363. Supports:      All ASM32 graphics modes EXCEPT:
  1364.                   InColor (palette not working right)
  1365.                   mode 04h, 05h (no palette)
  1366.                   mode 0Fh (EGA monochrome)
  1367. Example:       see PCXInfo and BufferDim         
  1368.                
  1369.  
  1370.  
  1371. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1372.  
  1373. PUTBITBLOCK:   restores bit block saved by GetBitBlock
  1374. PUTBITPLANE:   restores bit plane saved by GetBitPlane
  1375. Source:        same as GetBitBlock or GetBitPlane
  1376.  
  1377. Call with:     EBX pointing to upper left corner coordinates
  1378.                EDI pointing to buffer with stored bit block
  1379.                 PutBitPlane: AL = plane number
  1380.                 valid plane numbers for 16-color modes are 0 - 3
  1381.                                     for EGA mode 11h       0 & 2
  1382.  
  1383.                Drawmodes supported are:
  1384.                 mode 13h, VGA13x, SVGA256:
  1385.                  1 = replace existing screen area with bit block
  1386.                  2 = replace existing screen with non-zero pixels
  1387.                      in bit block
  1388.  
  1389.                 HGraph (InColor):
  1390.                  4 = AND the bit block with the existing screen
  1391.                  3 = OR the bit block with the existing screen
  1392.                  1,2 = replace existing screen area with bit block
  1393.                  0 = XOR the bit block with the existing image
  1394.                 -1,-2 = replace existing screen area with inverse bit block
  1395.  
  1396.                 16-color EGA/VGA-type modes and mode 0Fh:
  1397.                  same as InColor, plus:
  1398.                 -3 = OR the inverse bit block with the existing screen
  1399.                 -4 = AND the inverse bit block with the existing screen
  1400.  
  1401.                 mode 04h, 05h, 06h, 40h, HGraph (mono), 11h:
  1402.                  4, 1, 0, -1 same as InColor
  1403.                  2, 3 = combine non-zero pixels in the bit block with the
  1404.                         pre-existing image
  1405.                 -2 = combine non-zero pixel in the inverse bit block with
  1406.                      the pre-existing screen image
  1407.  
  1408.                Most PutBitBlock code ignores View limits (see GetView)
  1409.                but BB08.ASM, BB10.ASM and BB14.ASM (for 256-color modes)
  1410.                may be re-assembled with the /DCLIPPING command-line
  1411.                option to clip PutBitBlock operations at View boundaries.
  1412.  
  1413. Returns:       nothing
  1414. Uses:          nothing
  1415. Supports:      all ASM32 graphics modes
  1416. Example:       see GetBitBlock
  1417.  
  1418.  
  1419. bit block formats explained on following pages
  1420.  
  1421.  
  1422. ; BIT BLOCK FORMATS
  1423.  
  1424. ; mode 04h, 05h, 06h Hercules monochrome, 11h, and bit planes
  1425. ;
  1426. ; the first word in the buffer is the number of pixel rows (vertical)
  1427. ; in the bit block; the second word is the number of bytes per screen row;
  1428. ; the fifth byte is a bit mask for the last byte of each pixel row.
  1429. ; The bit mask = 0FFh for byte-aligned bit blocks.
  1430.  
  1431. bblock  dw 15,5              ; 15 rows, 5 bytes per row
  1432.         db 11111110b         ; bit mask for right end of pixel row
  1433.                              ; bit block data follows:
  1434.                              ;  15 rows, 5 bytes per row
  1435.         db 00000000b,10000000b,00000000b,10000000b,00000010b
  1436.         db 00000001b,11000000b,00000001b,11000000b,00000110b
  1437.         db 00000011b,11100000b,00000011b,11100000b,00001100b
  1438.         db 00000111b,01110000b,00000111b,01110000b,00011000b
  1439.         db 00001110b,00111000b,00001110b,00111000b,00110000b
  1440.         db 00011100b,00011100b,00011100b,00011100b,01100000b
  1441.         db 00000001b,11000000b,00000001b,11000000b,11000000b
  1442.         db 00000001b,11000000b,00000001b,11000000b,01100000b
  1443.         db 00000001b,11000000b,00000001b,11000000b,00110000b
  1444.         db 00000001b,11000000b,00000001b,11000000b,00011000b
  1445.         db 00000001b,11000000b,00000001b,11000000b,00001100b
  1446.         db 00000001b,11000000b,00000001b,11000000b,00000110b
  1447.         db 00000001b,11000000b,00000001b,11000000b,00000010b
  1448.         db 00000001b,11000000b,00000001b,11000000b,00000000b
  1449.         db 00000001b,11000000b,00000001b,11000000b,00000000b
  1450.  
  1451. ; 16-color modes: 0Dh, 0Eh, 10h, 12h, 6Ah, xmode16, InColor:
  1452. ; same as above, except there are 4 planes of bit block data
  1453. ; i. e., 4 groups of 15-row, 5-byte data; plane 3 is the first
  1454. ; block, followed by planes 2, 1, and 0.
  1455.  
  1456. ; EGA monochrome mode: 0Fh
  1457. ; similar to 16-color modes, but there are only 2 groups of bit
  1458. ; block data instead of 4
  1459.  
  1460.  
  1461. ; 256-color modes on next page
  1462.  
  1463.  
  1464. ; BIT BLOCK FORMATS
  1465.  
  1466. ; mode 13h: no bit mask in the bit block header
  1467.  
  1468. red     equ 12                    ; bright red
  1469. blue    equ 1                     ; blue
  1470.  
  1471. bblock  dw 12,5                   ; 12 rows, 5 bytes per row
  1472.         db red, red, blue,red, red
  1473.         db red, blue,red, blue,red
  1474.         db blue,red, red, red, blue
  1475.         db red, red, blue,red, red
  1476.         db red, blue,red, blue,red
  1477.         db blue,red, red, red, blue
  1478.         db red, red, blue,red, red
  1479.         db red, blue,red, blue,red
  1480.         db blue,red, red, red, blue
  1481.         db red, red, blue,red, red
  1482.         db red, blue,red, blue,red
  1483.         db blue,red, red, red, blue
  1484.  
  1485. ; vga13x: no bit mask in the bit block header, x & y
  1486. ; orienation of data is reversed for speed
  1487. ; this example is the same pattern shown for mode 13h, above
  1488.  
  1489. red     equ 12                    ; bright red
  1490. blue    equ 1                     ; blue
  1491.  
  1492. bblock  dw 12,5                   ; 12 rows, 5 bytes per row
  1493.         db red, red, blue,red, red, blue,red, red, blue,red, red, blue
  1494.         db red, blue,red, red, blue,red, red, blue,red, red, blue,red
  1495.         db blue,red, red, blue,red, red, blue,red, red, blue,red, red
  1496.         db red, blue,red, red, blue,red, red, blue,red, red, blue,red
  1497.         db red, red, blue,red, red, blue,red, red, blue,red, red, blue
  1498.  
  1499.  
  1500. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1501.  
  1502. PUTDOT:        change a pixel on a graphics screen
  1503. Source:        putdot.asm ($graph.asm, $putdot.asm, others)
  1504.  
  1505. Call with:     EBX pointing to x & y coordinates
  1506.                Drawmodes supported are:
  1507.                (monochrome)
  1508.                 1 = set pixel
  1509.                 0 = toggle pixel
  1510.                -1 = erase pixel
  1511.  
  1512.                (color modes)
  1513.                 3 = OR foreground color with pre-existing pixel
  1514.                 1, 2 = replace pixel with foreground color
  1515.                 0 = XOR foreground color with pre-existing pixel
  1516.                -1, -2 = replace pixel with background color
  1517.                -3 = OR background color with pre-existing pixel
  1518. Returns:       if CF = 0, no error
  1519.                if CF = 1, pixel coordinates outside active view area
  1520. Uses:          CF; all other registers and flags are saved
  1521. Supports:      all ASM32 graphics modes
  1522. Example:
  1523.  
  1524. include codeseg.inc
  1525.  
  1526. extrn   putdot:near
  1527.  
  1528. ; data
  1529. extrn   drawmode:byte
  1530. x       dw 100,117            ; pixel at x = 100, y = 117
  1531.  
  1532. ; code
  1533.         .
  1534.         .
  1535.         .
  1536.         mov   drawmode,1      ; use foreground color
  1537.         lea   ebx,x           ; point to pixel coordinates
  1538.         call  putdot
  1539.  
  1540.  
  1541.  
  1542. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1543.  
  1544. PCXINFO:       read vital information from .PCX-format graphics file
  1545. Source:        pcxinfo.asm
  1546.  
  1547. Call with:     [EDX] pointing to ASCIIZ name of .PCX file
  1548. Returns:       [EBX] pointing to PCX information data structure:
  1549.  
  1550.                pcx_info struc
  1551.                horiz    dw 0
  1552.                vert     dw 0
  1553.                colors   dw 0
  1554.                planes   db 0
  1555.                xpixels  dw 0
  1556.                ypixels  dw 0
  1557.                pcx_info ends
  1558.  
  1559.                horiz and vert are screen dimensions
  1560.                colors: 16 for EGA/VGA 16-color modes, 256 for 256-color modes
  1561.                planes: number of bit planes encoded
  1562.                        4 for 16-color modes, 1 for monochrome, CGA or mode 13h
  1563.                xpixels: horizontal image size
  1564.                ypixels: vertical image size
  1565.  
  1566.  
  1567.  
  1568. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1569.  
  1570. RESETVIEW:     restores default view area on active graphics page and
  1571.                returns a pointer to the view data
  1572. Source:        view.asm ($graph.asm)
  1573.  
  1574. Call with:     no parameters
  1575.                ResetView restores the default full screen view area.
  1576.                The far pointer returned points to ASM32's data area in
  1577.                $graph.obj for the active graphics page's view coordinates.
  1578. Returns:       EBX pointing to the active page's view data.
  1579. Uses:          EBX; all other registers and flags are saved
  1580. Supports:      all ASM32 graphics modes
  1581. Example:
  1582.  
  1583. include codeseg.inc
  1584.  
  1585. extrn   resetview:near
  1586.  
  1587. x0 EQU word ptr [EBX]
  1588. y0 EQU word ptr 2[EBX]
  1589. x1 EQU word ptr 4[EBX]
  1590. y1 EQU word ptr 6[EBX]
  1591.  
  1592. ; code
  1593.         .
  1594.         .
  1595.         .
  1596.         call  resetview
  1597.  
  1598.  
  1599.  
  1600. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1601.  
  1602. SCREENORIGIN:  control position of re-sized video buffer on screen
  1603.                see also BufferDim in GRAPHICS.DOC
  1604. Source:        scrnorig.asm
  1605.  
  1606. Call with:     EBX pointing to upper-left coordinates of logical
  1607.                video buffer to be displayed at upper-left corner of screen.
  1608. Returns:       nothing
  1609. Uses:          nothing
  1610. Supports:      EGA/VGA 16-color modes re-sized with BufferDim
  1611. Example:       see BufferDim
  1612.  
  1613.  
  1614. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1615.  
  1616. SHOWGPAGE:     change graphics page displayed on screen
  1617.                See also UseGPage and GPage.
  1618. Source:        gpage1.asm ($graph.asm, $herc.asm)
  1619.  
  1620. Call with:     BL = page number
  1621. Returns:       Carry Flag = error code
  1622.                if CF = 0, no error
  1623.                if CF = 1, bad page number
  1624. Uses:          CF
  1625. Supports:      HGraph (mono and InColor), modes 0Dh, 0Eh, 0Fh, 10h, VGA13X
  1626. Example:
  1627.  
  1628. include codeseg.inc
  1629.  
  1630. extrn   showgpage:near
  1631.  
  1632. ; code
  1633.         .
  1634.         .
  1635.         .
  1636.         mov   bl,1           ; show page 1
  1637.         call  showgpage
  1638.         jc    no_page_1      ; no page 1 for this mode
  1639.  
  1640. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1641.  
  1642. SHOWGPLANE:    show one or more planes of multi-plane EGA/VGA screen
  1643. Source:        gplane.asm ($graph.asm)
  1644.  
  1645. Call with:     AL = plane mask
  1646.                Bits set in the plane mask correspond to the plane displayed.
  1647.                ASM32's default mask is 00001111b, enabling all 4 planes.
  1648. Returns:       CF = error flag
  1649.                if CF = 0, no error
  1650.                if CF = 1, bad plane mask or graphics mode
  1651. Uses:          CF
  1652. Supports:      EGA & VGA 16-color modes, including VESA 6Ah, xmode16
  1653.                    and SVGA16
  1654.                EGA monochrome: planes 0 and 2
  1655.                    (mask = 00000101b for both planes)
  1656.                Hercules InColor
  1657. Example:
  1658.  
  1659. include codeseg.inc
  1660.  
  1661. extrn   showgplane:near
  1662.  
  1663. ; code
  1664.         .
  1665.         .
  1666.         .
  1667.         mov   al,00000101b      ; show planes 0 and 2
  1668.         call  showgplane
  1669.         jc    error             ; error control
  1670.  
  1671.  
  1672.  
  1673. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1674.  
  1675. SMALLTEXT:     change GPrint, GPrintX and GPrint2X default to 8x8 characters
  1676.                in Hercules and modes 10h, 11h, 12h; makes 8x8-size
  1677.                high ASCII characters available to GPrint in all modes
  1678. Source:        smalltxt.asm (f8x8.asm, $graph.asm)
  1679.  
  1680. STDTEXT:       restore GPrint default characters (see GPrint)
  1681. Source:        stdtext.asm (f8x14.asm, fontdata.asm)
  1682.  
  1683. Call with:     no parameters
  1684. Returns:       nothing
  1685. Uses:          nothing; all registers and flags are saved
  1686. Example:
  1687.  
  1688. include codeseg.inc
  1689.  
  1690. extrn   smalltext:near, stdtext:near
  1691.  
  1692. ; code
  1693.         .
  1694.         .
  1695.         .
  1696. ; make GPrint use the small 8x8 characters
  1697. ; make sure high ASCII characters are available
  1698.         call   smalltext
  1699.         .
  1700.         .
  1701.  
  1702. ; sometime later, I want to use larger 8x14 characters
  1703.         call   stdtext
  1704.  
  1705.  
  1706. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1707.  
  1708. UC2SYS:        convert user-defined coordinates to system coordinates
  1709. Source:        uc2sys.asm ($graph.asm)
  1710.  
  1711. Call with:     EBX pointing to (x0,y0,x1,y1) coordinates in
  1712.                user-defined coordinates
  1713. Returns:       EBX pointing to (x0,y0,x1,y1) coordinates in system
  1714.                coordinates
  1715.                UCINIT and UC2SYS allow the programmer to define a
  1716.                graph coordinate system to fit the data, and converts
  1717.                the system's y-orientation from top-to-bottom to the more
  1718.                familiar bottom-to-top
  1719.                US2SYS maintains a separate data area for converted
  1720.                coordinates; the input coordinates are not changed
  1721. Uses:          BX
  1722. Supports:      all ASM32 graphics modes; user-defined coordinates
  1723.                from -32767 to +32767; see also UCINIT
  1724. Example:       see UCINIT
  1725.  
  1726.  
  1727. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1728.  
  1729. UCINIT:        specify user-defined coordinates
  1730. Source:        uc2sys.asm ($graph.asm)
  1731.  
  1732. Call with:     EBX pointing to desired xmin, ymin, xmax, ymax
  1733.                coordinates (xmax-xmin < 32767, ymax-ymin < 32767)
  1734.                ASM32's default user coordinates are (0,0,1000,1000)
  1735. Returns:       nothing
  1736. Uses:          nothing
  1737. Example:
  1738.  
  1739. include codeseg.inc
  1740.  
  1741. ; I'm plotting a graph on the screen with x-axis data from 1983 to 2007
  1742. ; and y-axis data from -72 to 140
  1743. ; I'll leave some space on each side for titles, etc.
  1744.  
  1745. extrn   ucinit:near, uc2sys:near
  1746. extrn   drawbox:near
  1747.  
  1748. ; data
  1749. x0      dw 1975    ; xmin
  1750. y0      dw -80     ; ymin
  1751. x1      dw 2014    ; xmax
  1752. y1      dw 148     ; ymax
  1753.  
  1754. ; code
  1755.         .
  1756.         .
  1757.         .
  1758. ; establish coordinates
  1759.         lea     ebx,x0
  1760.         call    ucinit
  1761.  
  1762. ; draw a box around the graph
  1763.         mov     x0,1983
  1764.         mov     y0,-72
  1765.         mov     x1,2007
  1766.         mov     y1,140
  1767.         lea     ebx,x0
  1768.         call    uc2sys
  1769.         call    drawbox
  1770.  
  1771. ; SEE ALSO BARGRAPH.ASM EXAMPLE PROGRAM
  1772.  
  1773.  
  1774. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1775.  
  1776. USEGPAGE:      changes active graphics page used by ASM32
  1777.                does not change page displayed (see GPage and ShowGPage)
  1778. Source:        gpage.asm ($graph.asm, $herc.asm)
  1779.  
  1780. Call with:     BL = page number
  1781. Returns:       if CF = 0, no error
  1782.                if CF = 1, bad page number
  1783. Uses:          CF
  1784. Supports:      HGraph (mono and InColor) with Use64k
  1785.                EGA and VGA: modes with more than one page
  1786. Example:
  1787.  
  1788. include codeseg.inc
  1789.  
  1790. extrn   usegpage:near
  1791.  
  1792. ; code
  1793.         .
  1794.         .
  1795.         mov   bl,1
  1796.         call  usegpage
  1797.         jc    oops
  1798.  
  1799.  
  1800.  
  1801. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1802.  
  1803. VIEWLIMIT:     determine current mode's maximum dimensions
  1804. Source:        view.asm ($graph.asm)
  1805.  
  1806. Call with:     no parameters
  1807. Returns:       EBX pointing to xmax
  1808.                EBX+2 pointing to ymax
  1809. Uses:          EBX
  1810. Supports:      all ASM32 graphics modes
  1811. Example:
  1812.  
  1813. include codeseg.inc
  1814.  
  1815. extrn   viewlimit:near
  1816.  
  1817. ; code
  1818.         .
  1819.         .
  1820.         call  viewlimit
  1821.  
  1822.