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

  1.     page    66,132
  2. ;******************************** CRT1.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    POSN_TO_ADR:NEAR
  14.     EXTRN    LIB_INFO:BYTE
  15. comment 
  16. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  17. PUT_CRT_CHR - display single character
  18. ;             write character (ax) to display at row/column (dx)
  19. ;
  20. ; inputs: ax = char & color
  21. ;         dx = address
  22. ;
  23. ; outputs:es = display segment
  24. ;* * * * * * * * * * * * * *
  25. 
  26.     PUBLIC    PUT_CRT_CHR
  27. PUT_CRT_CHR        PROC    FAR
  28.     apush   dx,di,ax
  29.     mov        al,dh    ;get row
  30.     mul     lib_info.crt_columns
  31.     xor     dh,dh
  32.     add     ax,dx    ;compute offset
  33.     shl     ax,1    ;adjust for word offset
  34.     mov     di,ax
  35.     mov     es,lib_info.crt_seg
  36.     pop     ax        ;restore print char
  37.     cld
  38.     STOSW
  39.     apop    di,dx
  40.     RETF
  41. PUT_CRT_CHR    ENDP
  42. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  43. ;local version of put_crt_chr.  This version uses the display offset
  44. ;rather than the row/column to place char.
  45. ;
  46. ;  inputs:  es:di = display address
  47. ;              ax = display char & color
  48.  
  49. ;  output:     di = next display location
  50. ;
  51.     PUBLIC    $PUT_CRT_CHR
  52. $PUT_CRT_CHR:
  53.     cld
  54.     stosw
  55.     ret
  56. comment 
  57. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  58. GET_CRT_CHR -  read character and attribute from text screen
  59. ;
  60. ; inputs:    DH = screen row
  61. ;            DL = screen column
  62. ;
  63. ; output:    AH = color atttribute
  64. ;            AL = ASCII character code
  65. ;
  66. ;* * * * * * * * * * * * * *
  67. 
  68.     PUBLIC    GET_CRT_CHR
  69. GET_CRT_CHR        PROC    FAR
  70.     apush       dx,di,es
  71.     call    posn_to_adr
  72.     mov         ax,word ptr es:[di]
  73.     apop    es,di,dx
  74.     retf
  75. GET_CRT_CHR ENDP
  76. comment 
  77. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  78. REPEAT_PUT_CRT - displays a single char CX times.
  79. ;
  80. ; inputs:  ax = char (ah=color attribute, al=ascii character)
  81. ;          dx = display location (dh=row, dl=column)
  82. ;          cx = count
  83. ;
  84. ;output:  none
  85. ;
  86. ;notes:  The character and color (ax) are displayed starting at
  87. ;        location (dx) until count (cx) is counted down to zero.
  88. ;* * * * * * * * * * * * * *
  89. 
  90.     PUBLIC    REPEAT_PUT_CRT
  91. REPEAT_PUT_CRT    PROC    FAR
  92.     jcxz    rpc_done
  93.     cld
  94.     apush   es,dx,di
  95.     call    posn_to_adr
  96.     REP    STOSW
  97.     apop    di,dx,es
  98. rpc_done:
  99.     RETF
  100. REPEAT_PUT_CRT    ENDP
  101. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  102. ; $REPEAT_PUT_CRT displays a single char CX times.
  103. ;  inputs:  ax = char
  104. ;        es:di = display offset
  105. ;           cx = count
  106. ; output:  di - updated to point at next char.
  107. ;          cx = 0
  108. ;
  109.     PUBLIC    $REPEAT_PUT_CRT
  110. $REPEAT_PUT_CRT:
  111.     jcxz    $rpc_done
  112.     cld
  113.     REP        STOSW
  114. $rpc_done:    
  115.     RET
  116.  
  117.  
  118. LIBSEG    ENDS
  119.     end
  120.