home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / CRT9.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  1KB  |  54 lines

  1.     page    66,132
  2. ;******************************** CRT9.ASM   *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     INCLUDE    COMMON.INC
  11. .list
  12. ;----------------------------------------------------------------------------
  13.     EXTRN    LIB_INFO:BYTE
  14. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  15. ;                        MISC.  display routines
  16. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  17. ; convert row/column to display offset
  18. ;  inputs: dh=row dl=column
  19. ;  output: es:di = display ptr
  20. ;
  21.     PUBLIC    POSN_TO_ADR
  22. POSN_TO_ADR    PROC    NEAR
  23.     apush   ax,dx
  24.     mov        al,dh    ;get row
  25.     mul     lib_info.crt_columns
  26.     xor     dh,dh
  27.     add     ax,dx    ;compute offset
  28.     shl     ax,1    ;adjust for word offset
  29.     mov     di,ax
  30.     mov     es,lib_info.crt_seg
  31.     apop    dx,ax
  32.     ret
  33. POSN_TO_ADR    ENDP    
  34. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  35. ; convert display offset to row/column
  36. ;  inputs: es:di = display ptr
  37. ;  output: dh=row dl=column
  38. ;
  39.     PUBLIC    ADR_TO_POSN
  40. ADR_TO_POSN    PROC    NEAR
  41.     push    ax
  42.     mov    ax,di        ;get offset
  43.     shr    ax,1
  44.     div    lib_info.crt_columns
  45.     mov    dx,ax
  46.     xchg    dh,dl
  47.     pop    ax
  48.     ret
  49. ADR_TO_POSN    ENDP
  50.  
  51.  
  52. LIBSEG    ENDS
  53.     end
  54.