home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ibm8514 / brcLine.c < prev    next >
C/C++ Source or Header  |  1991-09-20  |  4KB  |  171 lines

  1. /*
  2.  * $Id: brcLine.c,v 1.1 1991/09/20 19:10:24 mtranle Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1990
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that 
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  18.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22.  * SOFTWARE.
  23.  *
  24. */
  25. /*
  26.  * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
  27.  * LICENSED MATERIALS - PROPERTY OF IBM
  28.  * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
  29.  */
  30. /*
  31.  *  Hardware interface routines for IBM 8514/A adapter for
  32.  *  X.11 server(s) on IBM equipment.
  33.  *
  34.  */
  35.  
  36. #include "X.h"
  37. #include "misc.h"
  38. #include "colormapst.h"
  39. #include "pixmapstr.h"
  40.  
  41. #include "ppc.h"
  42.  
  43. #include "x8514.h"
  44.  
  45. #include "ibmTrace.h"
  46.  
  47. #define X_AXIS 0
  48.  
  49. extern int mergexlate[] ;
  50. extern int ibm8514cursorSemaphore ;
  51.  
  52. void
  53. ibm8514HorzLine( color, alu, mask,x,y,w)
  54.      unsigned long int color ;
  55.      int alu ;
  56.      unsigned long int mask ;
  57.      int x,y,w ;
  58. {
  59.     int saved ;
  60.  
  61.     if (w<=0)
  62.     return ;
  63.     saved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y, w, 1) ;
  64.  
  65.     ibm8514ClearQueue(7) ;
  66.     PLNWENBL(mask) ;
  67.     SETCOL1(color) ;
  68.     SETFN1(FNCOLOR1,mergexlate[alu]) ;
  69.     SETLX(w) ;
  70.     SETX0(x) ;
  71.     SETY0(y) ;
  72.     COMMAND(0x201f) ;
  73.  
  74.  
  75.     ibm8514CheckQueue(2) ;
  76.     SETFN1(FNCOLOR1,FNREPLACE) ;
  77.     PLNWENBL( ibm8514ALLPLANES ) ;
  78.  
  79.     if (saved)
  80.     ibm8514ReplaceCursor() ;
  81.     return ;
  82. }
  83.  
  84. void
  85. ibm8514VertLine( color, alu, mask,x,y,h)
  86.      unsigned long int color ;
  87.      int alu ;
  88.      unsigned long int mask ;
  89.      int x,y,h ;
  90. {
  91.     int saved ;
  92.  
  93.     if ( h <= 0 )
  94.     return ;
  95.     saved = !ibm8514cursorSemaphore && ibm8514CheckCursor(x, y, 1, h) ;
  96.  
  97.     ibm8514ClearQueue(7) ;
  98.     PLNWENBL(mask) ;
  99.     SETCOL1(color) ;
  100.     SETFN1(FNCOLOR1,mergexlate[alu]) ;
  101.     SETLX(h) ;
  102.     SETX0(x) ;
  103.     SETY0(y) ;
  104.     COMMAND(0x20df) ;
  105.  
  106.     ibm8514ClearQueue(2) ;
  107.     SETFN1(FNCOLOR1,FNREPLACE) ;
  108.     PLNWENBL( ibm8514ALLPLANES ) ;
  109.  
  110.     if (saved)
  111.     ibm8514ReplaceCursor() ;
  112.     return ;
  113. }
  114.  
  115. void
  116. ibm8514BresLine( color, alu, mask, signdx, signdy, axis, x, y, et, e1, e2, len)
  117.      unsigned long int color ;
  118.      int alu ;
  119.      unsigned long int mask ;
  120.      int signdx, signdy, axis, x, y, et, e1, e2, len ;
  121. {
  122.     unsigned short command ;
  123.     int saved ;
  124.     int cx, cy ;
  125.  
  126.     if ( len <= 0 )
  127.     return ;
  128.     if (signdx == -1)
  129.     cx = x - len ;
  130.     else
  131.     cx = x ;
  132.     if (signdy == -1)
  133.     cy = y - len ;
  134.     else
  135.     cy = y ;
  136.     saved = !ibm8514cursorSemaphore && ibm8514CheckCursor( cx,cy,len,len ) ;
  137.  
  138.     if (axis==X_AXIS)
  139.     command = 0x2017 ;    /* draw bres. line on X, W, LPN, */
  140.     else
  141.     command = 0x2057 ;    /* same, on Y */
  142.     if (signdx > 0)
  143.     command |= 0x0020 ;
  144.     if (signdy > 0)
  145.     command |= 0x0080 ;
  146.  
  147.     ibm8514ATRNotBusy ;
  148.     ibm8514CheckQueue( 5 ) ;
  149.     PLNWENBL(mask) ;
  150.     SETET(et) ; 
  151.     SETK1(e1) ; 
  152.     SETK2(e2) ; 
  153.     SETFN1(FNCOLOR1,mergexlate[alu]) ;
  154.  
  155.     ibm8514CheckQueue( 5 ) ;
  156.     SETCOL1(color) ;
  157.     SETLX(len) ;        /* going to use LAST PEL NULL in Line
  158.                    command to brecon */
  159.     SETX0(x) ;
  160.     SETY0(y) ;
  161.     COMMAND(command) ;
  162.  
  163.     ibm8514ClearQueue(2) ;
  164.     SETFN1( FNCOLOR1, FNREPLACE ) ;
  165.     PLNWENBL( ibm8514ALLPLANES ) ;
  166.  
  167.     if (saved)
  168.     ibm8514ReplaceCursor() ;
  169.     return ;
  170. }
  171.