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

  1.     page    66,132
  2. ;******************************** CRT2.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.     
  15. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  16. ;                        BLOCK display routines
  17. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  18.  
  19. ;
  20. ;$PUT_CRT_BLK:    copies a string to video memory buffer, with selected
  21. ;             color attribute
  22. ;
  23. ; inputs:     CX = maximum number of characters to print (will also stop
  24. ;                  at NUL character)
  25. ;             DS:[SI] points to first character of string
  26. ;             ES:[DI] points to video buffer
  27. ;             AH = color attribute
  28. ;             DF = 0 (clear direction flag with CLD)
  29. ;  output:    ES:[DI] points to video buffer following string
  30. ;             if AL = 0
  31. ;                DS:[SI] points to byte following string's NUL terminator
  32. ;             if AL <> 0
  33. ;                DS:[SI] points to next byte in string after the last one
  34. ;                printed on the screen
  35. ;Uses:        AL, CX, DI, SI, flags
  36. ;
  37.     PUBLIC    $PUT_CRT_BLK
  38. $PUT_CRT_BLK    PROC    NEAR
  39.     LODSB
  40.     OR      AL,AL
  41.     JZ        $PCB_EXIT
  42.     STOSW
  43.     LOOP    $PUT_CRT_BLK
  44. $PCB_EXIT:
  45.     RET
  46. $PUT_CRT_BLK    ENDP
  47.  
  48. comment 
  49. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  50. PUT_CRT_BLK - copies a string to video memory buffer, with selected
  51. ;             color attribute;
  52. ;
  53. ; inputs:         CX = maximum number of characters to print
  54. ;            DS:[SI] = pointer to first character of string
  55. ;            ES:[DI] = pointer to video buffer
  56. ;                 AH = color attribute
  57. ;                 DF = 0 (clear direction flag with CLD)
  58. ;            
  59. ; output:    ES:[DI] = pointer to next video buffer display point
  60. ;            DS:[SI] = pointer to byte following last one displayed
  61. ;
  62. ; notes:  registers changed = al,cx,di,si,flags
  63. ;
  64. ;* * * * * * * * * * * * * *
  65. 
  66.     PUBLIC    PUT_CRT_BLK
  67. PUT_CRT_BLK    PROC    FAR
  68.     LODSB
  69.     OR      AL,AL
  70.     JZ        PCB_EXIT
  71.     STOSW
  72.     LOOP    PUT_CRT_BLK
  73. PCB_EXIT:
  74.     RETF
  75. PUT_CRT_BLK    ENDP
  76.  
  77. comment 
  78. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
  79. VERTICAL_REPEAT_CHR - repeat one or more columns of a character vertically
  80. ;
  81. ; inputs: ax = char
  82. ;         dx = row/col
  83. ;         bx = increment to next repeat
  84. ;         cx = char repeat length
  85. ;         si = operation(rows) repeat count
  86. ;
  87. ; output: registers changed = bx,si,di 
  88. ;* * * * * * * * * * * * * *
  89. 
  90.     PUBLIC    VERTICAL_REPEAT_CHR
  91. VERTICAL_REPEAT_CHR    PROC    FAR    
  92.     jcxz    vrc_exit
  93.     apush   dx,es
  94.     call    posn_to_adr
  95. vrc_loop:
  96.     apush   cx,di
  97.     REPZ    STOSW
  98.     APOP    DI,CX
  99.     ADD     DI,BX
  100.     DEC     SI
  101.     JNZ     vrc_loop
  102.     apop    es,dx
  103. vrc_exit:
  104.     RETF
  105. VERTICAL_REPEAT_CHR    ENDP
  106. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  107. ; repeat one or more columns of a character vertically
  108. ;  inputs: ax = char
  109. ;       es:di = starting display location
  110. ;          bx = increment to next repeat
  111. ;          cx = char repeat length
  112. ;          si = operation(rows) repeat count
  113. ;
  114. ;  output es:di = next display location
  115. ;            si = 0
  116.     PUBLIC    $VERTICAL_REPEAT_CHR
  117. $VERTICAL_REPEAT_CHR    PROC    NEAR
  118.     jcxz    $vrc_exit
  119. $vrc_loop:
  120.     apush   cx,di
  121.     REPZ    STOSW
  122.     APOP    DI,CX
  123.     ADD     DI,BX
  124.     DEC     SI
  125.     JNZ     $vrc_loop
  126. $vrc_exit:
  127.     RET
  128. $VERTICAL_REPEAT_CHR    ENDP
  129.  
  130. LIBSEG    ENDS
  131.     end
  132.