home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB140 / grlib03a.arj / CXY2CP.ASM < prev    next >
Assembly Source File  |  1988-12-08  |  3KB  |  87 lines

  1. PAGE ,132
  2. title CXY2CP.ASM
  3. ;UPDATE HISTORY
  4. ;==============
  5. ;14 nov 84    Convert to CI86 V2.2
  6. ;29 nov 84    adjust list format to 132 width
  7. ;27 dec 84    clear DX for big maths
  8.     include    asmc.h
  9.  
  10.     SEGEND    CODE
  11.  
  12.     SEGDEF    DATA
  13. include asmd.h
  14.     SEGEND    DATA
  15.  
  16.     SEGDEF    CODE
  17.  
  18. PUBLIC    cxy2cp, a_cur
  19.  
  20.     IF    @bigmodel
  21. EXTRN    fifo_mt:FAR
  22.     ELSE
  23. EXTRN    fifo_mt:NEAR
  24.     ENDIF
  25.  
  26. ;********************************************************************
  27. ;*                                                                  *
  28. ;*      f u n c t i o n s    cxy2cp()  a_cur()                      *
  29. ;*                                                                  *
  30. ;*      CXY2CP takes the x_start and y_start values and converts    *
  31. ;*      them to a GDC cursor position and sends it to the GDC.      *
  32. ;*      The computed values are stored at curl0 to curl2.           *
  33. ;*                                                                  *
  34. ;*      A_CUR takes the values at curl0 to curl2 and sends them     *
  35. ;*      to the GDC.                                                 *
  36. ;*                                                                  *
  37. ;*      entry:          x_start = x pixel location                  *
  38. ;*                      y_start = y pixel location                  *
  39. ;*      exit:           curl0 to curl2 set to GDC cursor values     *
  40. ;*                                                                  *
  41. ;********************************************************************
  42.  
  43.  
  44.     PROCDEF    cxy2cp
  45.         push    bx
  46.         push    cx
  47.         push    dx
  48.  
  49.         mov    cl, BYTE PTR sh_p_lin
  50.         mov     bx, WORD PTR y_start    ;get line number
  51.         shl     bx, cl                   ;and convert to a start of line offset
  52.     xor    dx,dx                    ;clear DX for 16/32 bit maths
  53.         mov     ax, WORD PTR x_start
  54.         mov     cl,4
  55.         sar     ax, cl                  ;convert x_start to a WORD offset in ax
  56.         add     ax, bx                  ;and leave pixel position in dl.
  57.         mov     WORD PTR curl0, ax
  58.         mov     ax, WORD PTR x_start
  59.         and     ax, 0FH
  60.         mov     cl,4
  61.         shl     al, cl                  ;move pixel value to high nibble.
  62.         mov     BYTE PTR curl2, al
  63.         call    a_cur
  64.  
  65.         pop     dx
  66.         pop     cx
  67.         pop     bx
  68.         ret
  69.     PROCEND    cxy2cp
  70.  
  71.     PROCDEF    a_cur
  72.         call    fifo_mt
  73.         mov    al,49H               ;set cursor location to that in curl0,1,2
  74.         out    57H,al               ;issue the GDC cursor location command
  75.         mov     ax,WORD PTR curl0   ;fetch WORD low address
  76.         out    56H,al
  77.         mov    al,ah                ;middle address
  78.         out    56H,al
  79.         mov    al,BYTE PTR curl2   ;dot address [top 4 bits] and highDW addr
  80.         out    56H,al
  81.         ret
  82.     PROCEND    a_cur
  83.  
  84.     include    epilogue.h
  85.     END
  86. 
  87.