home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / C / GRAPH / GRAPH.DOC < prev   
Text File  |  1993-12-01  |  6KB  |  104 lines

  1.  
  2. I've received many useful things from the net over the years, so here's 
  3. something to help balance my debt.  This is (very slight) documentation and
  4. (very voluminous) assembly code that does graphics in CGA 320x200 mode with
  5. 4 colors, and in EGA 640x350 mode with 16 colors.  The routines are intended
  6. to be called from C (Microsoft 4.0 flavor), but with fairly minor modifica-
  7. tion could be callable from assembly, Pascal, Fortran, BASIC, or whatever
  8. your favorite language is.  The only things that are language specific are:
  9.  
  10.    1) the structure of the GROUPs and SEGMENTS
  11.    2) the underscore as the first char of all public/extern labels
  12.    3) the way function arguments and return values are passed on the stack
  13.  
  14. All of the functions operate the same on both CGA and EGA (given the
  15. differences in number of pixels and colors available) except for the
  16. SETCOLOR and BPLOTXY functions.  With those functions, the arguments mean
  17. slightly different things, as is mentioned in the (brief) reference card.
  18.  
  19. The code should assemble OK with almost any version of the Microsoft assembler.
  20. There's not a lot of documentation included other than the comments in the
  21. code.  sorry about that (he hangs his head with sheepish look)     _____
  22.                                                                _--/ @ @ \
  23.                                                               /   | =_= |
  24.                                                               |    \----/
  25. If you run into any major stumbling blocks understanding what
  26. a function is supposed to do, or how it works, send me mail.
  27.  
  28. Everett Kaser
  29. Hewlett-Packard Co.
  30. Corvallis, OR
  31. !hplabs!hp-pcd!everett
  32.  
  33.  
  34.  
  35. ;     pocket guide:
  36.  
  37. ;=============================================================================;
  38. ;  assembly language routines for CGA/EGA  color graphics (callable from C)   ;
  39. ;=============================================================================;
  40. ; setmode(mode);                                  ;
  41. ;    mode =    3    80x25 COLOR ALPHANUMERIC                  ;
  42. ;        4    320x200 COLOR GRAPHICS                      ;
  43. ;        10h    640x350 COLOR GRAPHICS (EGA ONLY)              ;
  44. ;-----------------------------------------------------------------------------;
  45. ; [CGA] setcolors(colorset, backgnd);                          ;
  46. ;      backgnd color (0-15)                              ;
  47. ;        0 black   4 red        8  gray        12 light red          ;
  48. ;        1 blue      5 magenta    9  light blue    13 light magenta      ;
  49. ;        2 green      6 brown    10 light green    14 yellow          ;
  50. ;        3 cyan      7 white    11 light cyan    15 bright white          ;
  51. ;      colorset (1=cyan/magenta/white 0=green/red/brown)              ;
  52. ;                                          ;
  53. ; [EGA] setcolors(palette_register, color_value);                  ;
  54. ;      palette_register ranges from 0-16    (16 sets the OVERSCAN color)  ;
  55. ;      color_value ranges from 0-63                          ;
  56. ;-----------------------------------------------------------------------------;
  57. ; plotxy(x,y,color,rule);                              ;
  58. ;    color (CGA: 0-3,  EGA: 0-15)                          ;
  59. ;    replacement rule: 0=force, 1=and, 2=or, 3=xor                  ;
  60. ;-----------------------------------------------------------------------------;
  61. ; bplotxy(x, y, height, width, picture, rule);                      ;
  62. ;    height (# of rows in picture)                          ;
  63. ;    width (# of bytes (cga) or pixels (ega) in width of picture)          ;
  64. ;        height & width are limited to less than 255 each          ;
  65. ;    picture = address of data bytes (linear char array)              ;
  66. ;          each byte contains (CGA) 4 pixels, or (EGA) 1 pixels color  ;
  67. ;    replacement rule (0=force, 8000h=xor)                      ;
  68. ;-----------------------------------------------------------------------------;
  69. ; line(x1, y1, x2, y2, color, rule);                          ;
  70. ;    replacement rule: 0=force, 1=and, 2=or, 3=xor)                  ;
  71. ;-----------------------------------------------------------------------------;
  72. ; horline(x1, y1, x2, color,rule);                          ;
  73. ;    replacement rule: 0=force, 1=and, 2=or, 3=xor)                  ;
  74. ;-----------------------------------------------------------------------------;
  75. ; verline(x1, y1, y2, color, rule);                          ;
  76. ;    replacement rule: 0=force, 1=and, 2=or, 3=xor)                  ;
  77. ;-----------------------------------------------------------------------------;
  78. ; clrscreen(color);                                  ;          ;
  79. ;-----------------------------------------------------------------------------;
  80. ; flabel(x, y, string, fore_color, back_color, rule);                  ;
  81. ;    replacement rule: 0=force, 1=and, 2=or, 3=xor)                  ;
  82. ;-----------------------------------------------------------------------------;
  83. ; setrand(seed);                                  ;
  84. ;    if seed = 0, then seed chosen based upon system timer              ;
  85. ;-----------------------------------------------------------------------------;
  86. ; rand();                                      ;
  87. ;-----------------------------------------------------------------------------;
  88. ; beepoff();                                      ;
  89. ;    turn beeper off                                  ;
  90. ;-----------------------------------------------------------------------------;
  91. ; beepon(counter);                                  ;
  92. ;     turns beeper on with timer 2 gate to value COUNTER. (NOTE: beeper     ;
  93. ;    will remain on until beepoff() is called!                  ;
  94. ;-----------------------------------------------------------------------------;
  95. ; iskey();                                      ;
  96. ;    returns 0 if no key waiting, else returns next key scan/ascii code    ;
  97. ;       but leaves the keycode in the buffer.                      ;
  98. ;-----------------------------------------------------------------------------;
  99. ; key();                                      ;
  100. ;    waits for a key and returns it's scan/ascii code.              ;
  101. ;-----------------------------------------------------------------------------;
  102.  
  103. ;    end of pocket guide
  104.