Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. ;---------------------------------------------------------------
  2. ; VIDLIB.ASM
  3. ; Video Display Library
  4. ;
  5. ; by Jeff Duntemann
  6. ; MASM/TASM
  7. ; Last update 12/27/89
  8. ;---------------------------------------------------------------
  9.  
  10. MyData SEGMENT PUBLIC
  11.  
  12. EXTRN CRLF:BYTE,LRXY:WORD
  13.  
  14. MyData ENDS
  15.  
  16.  
  17. MyCode SEGMENT PUBLIC
  18.  
  19. PUBLIC GotoXY,ClrScr,ClrWin,ScrlWin,VIDEO6
  20. PUBLIC Write,Writeln
  21.  
  22. ASSUME CS:MyCode,DS:MyData
  23.  
  24. ;---------------------------------------------------------------
  25. ; GOTOXY -- Positions the hardware cursor to X,Y
  26. ; Last update 3/5/89
  27. ;
  28. ; 1 entry point:
  29. ;
  30. ; GotoXY:
  31. ; Caller must pass:
  32. ; DL: X value These are both 0-based; i.e., they
  33. ; DH: Y value assume a screen 24 by 79, not 25 by 80
  34. ; Action: Moves the hardware cursor to the X,Y position
  35. ; loaded into DL and H.
  36. ;---------------------------------------------------------------
  37. GotoXY PROC
  38. mov AH,02H ; Select VIDEO service 2: Position cursor
  39. mov BH,0 ; Stay with display page 0
  40. int 10H ; Call VIDEO
  41. ret ; Return to the caller
  42. GotoXY ENDP
  43.  
  44. ;---------------------------------------------------------------
  45. ; CLRSCR -- Clears or scrolls screens or windows
  46. ; Last update 3/5/89
  47. ;
  48. ; 4 entry points:
  49. ;
  50. ; ClrScr:
  51. ; No values expected from caller
  52. ; Action: Clears the entire screen to blanks with 07H as
  53. ; the display attribute
  54. ;
  55. ; ClrWin:
  56. ; Caller must pass:
  57. ; CH: Y coordinate, upper left corner of window
  58. ; CL: X coordinate, upper left corner of window
  59. ; DH: Y coordinate, lower right corner of window
  60. ; DL: X coordinate, lower right corner of window
  61. ; Action: Clears the window specified by the caller to
  62. ; blanks with 07H as the display attribute
  63. ;
  64. ; ScrlWin:
  65. ; Caller must pass:
  66. ; CH: Y coordinate, upper left corner of window
  67. ; CL: X coordinate, upper left corner of window
  68. ; DH: Y coordinate, lower right corner of window
  69. ; DL: X coordinate, lower right corner of window
  70. ; AL: number of lines to scroll window by (0 clears it)
  71. ; Action: Scrolls the window specified by the caller by
  72. ; the number of lines passed in AL. The blank
  73. ; lines inserted at screen bottom are cleared
  74. ; to blanks with 07H as the display attribute
  75. ;
  76. ; VIDEO6:
  77. ; Caller must pass:
  78. ; CH: Y coordinate, upper left corner of window
  79. ; CL: X coordinate, upper left corner of window
  80. ; DH: Y coordinate, lower right corner of window
  81. ; DL: X coordinate, lower right corner of window
  82. ; AL: number of lines to scroll window by (0 clears it)
  83. ; BH: display attribute for blanked lines (07H is "normal")
  84. ; Action: Generic access to BIOS VIDEO service 6. Caller
  85. ; must pass ALL register parameters as shown above
  86. ;---------------------------------------------------------------
  87.  
  88. ClrScr PROC
  89. mov CX,0 ; Upper left corner of full screen
  90. mov DX,LRXY ; Load lower-right XY coordinates into DX
  91. ClrWin: mov AL,0 ; 0 specifies clear entire region
  92. ScrlWin: mov BH,07H ; Specify "normal" attribute for blanked line(s)
  93. VIDEO6: mov AH,06H ; Select VIDEO service 6: Initialize/Scroll
  94. int 10H ; Call VIDEO
  95. ret ; Return to the caller
  96. ClrScr ENDP
  97.  
  98.  
  99. ;---------------------------------------------------------------
  100. ; WRITE -- Displays information to the screen via DOS
  101. ; service 9: Print String
  102. ; Last update 3/5/89
  103. ;
  104. ; 1 entry point:
  105. ;
  106. ; Write:
  107. ; Caller must pass:
  108. ; DS: The segment of the string to be displayed
  109. ; DX: The offset of the string to be displayed
  110. ; String must be terminated by "$"
  111. ; Action: Displays the string at DS:DX up to the "$" marker
  112. ;---------------------------------------------------------------
  113.  
  114. Write PROC
  115. mov AH,09H ; Select DOS service 9: Print String
  116. int 21H ; Call DOS
  117. ret ; Return to the caller
  118. Write ENDP
  119.  
  120.  
  121. ;---------------------------------------------------------------
  122. ; WRITELN -- Displays information to the screen via DOS
  123. ; service 9 and issues a newline
  124. ; Last update 3/5/89
  125. ;
  126. ; 1 entry point:
  127. ;
  128. ; Writeln:
  129. ; Caller must pass:
  130. ; DS: The segment of the string to be displayed
  131. ; DX: The offset of the string to be displayed
  132. ; String must be terminated by "$"
  133. ; Action: Displays the string at DS:DX up to the "$" marker
  134. ; marker, then issues a newline. Hardware cursor
  135. ; will move to the left margin of the following
  136. ; line. If the display is to the bottom screen
  137. ; line, the screen will scroll.
  138. ; Calls: Write
  139. ;---------------------------------------------------------------
  140.  
  141. Writeln PROC
  142. call Write ; Display the string proper through Write
  143. mov DX,OFFSET CRLF ; Load address of newline string to DS:DX
  144. call Write ; Display the newline string through Write
  145. ret ; Return to the caller
  146. Writeln ENDP
  147.  
  148.  
  149. MyCode ENDS
  150.  
  151. END
  152. 
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement