home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / asm / RTGRAF.ZIP / SOURCE.ZIP / EMAPXY.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-06-30  |  779 b   |  28 lines

  1. ;====================================================================
  2. ;      input   cx= x position
  3. ;              bx= y position
  4. ;      width of screen in bytes is in cs:_bytes_per_line
  5. ;      output  di= ((y*bytes_per_line)+x/8) = byte position
  6.  
  7.  
  8. emapxy proc                ;
  9.        push    ax          ;
  10.        push    cx
  11.        push    dx
  12.        push    ds
  13.        mov     ax,dgroup
  14.        mov     ds,ax
  15.        mov     ax,bx       ;ax = y
  16.        mul     _bytes_per_line ; usually 80
  17.        shr     cx,1
  18.        shr     cx,1
  19.        shr     cx,1
  20.        add     cx,ax       ;cx= (y*80)+x
  21.        mov     di,cx       ;di= (y*80)+x
  22.        pop     ds
  23.        pop     dx
  24.        pop     cx
  25.        pop     ax          ;
  26.        ret                 ;
  27. emapxy endp
  28.