Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.28 KB | None | 0 0
  1. ;---------------------------------------------------------------
  2. ; EAT3.ASM
  3. ; Backhanded advertising program, over the full screen
  4. ;
  5. ; by Jeff Duntemann
  6. ; MASM/TASM
  7. ; Last update 12/27/89
  8. ;---------------------------------------------------------------
  9.  
  10. ;----------------------------|
  11. ; BEGIN STACK SEGMENT |
  12. ;----------------------------|
  13. MYSTACK SEGMENT STACK ; STACK word ensures loading of SS by DOS
  14.  
  15. DB 64 DUP ('STACK!!!') ; This reserves 512 bytes for the stack
  16.  
  17. MYSTACK ENDS
  18. ;----------------------------|
  19. ; END STACK SEGMENT |
  20. ;----------------------------|
  21.  
  22.  
  23. ;----------------------------|
  24. ; BEGIN DATA SEGMENT |
  25. ;----------------------------|
  26. MyData SEGMENT
  27.  
  28. ; 18H = 24D; 4FH = 79D; Combined 0-based X,Y of 80 x 25 screen LR corner:
  29. LRXY DW 184FH
  30.  
  31. TextPos DW ?
  32. Eat1 DB "Eat at Joe's...",'$'
  33. Eat2 DB "...ten million flies can't ALL be wrong!",'$'
  34. CRLF DB 0DH,0AH,'$'
  35.  
  36. MyData ENDS
  37. ;----------------------------|
  38. ; END DATA SEGMENT |
  39. ;----------------------------|
  40.  
  41. ;----------------------------|
  42. ; BEGIN CODE SEGMENT |
  43. ;----------------------------|
  44. MyProg SEGMENT
  45.  
  46. assume CS:MyProg,DS:MyData
  47. Main PROC
  48.  
  49. Start: ; This is where program execution begins:
  50. mov AX,MyData ; Set up our own data segment address in DS
  51. mov DS,AX ; Can't load segment reg. directly from memory
  52.  
  53. call ClrScr ; Clear the full display
  54.  
  55. mov TextPos, 0914H ; 0914H = X @ 20, Y @ 9
  56.  
  57. mov DX,TextPos ; TextPos contains X,Y position values
  58. call GotoXY ; Position cursor
  59. lea DX,Eat1 ; Load offset of Eat1 string into DX
  60. call Write ; and display it
  61.  
  62. mov DX,TextPos ; Re-use text position variable
  63. mov DH,10 ; Put new Y value into DH
  64. call GotoXY ; Position cursor
  65. lea DX,Eat2 ; Load offset of Ear2 string into DX
  66. call Writeln ; and display it
  67.  
  68. mov AH,4CH ; Terminate process DOS service
  69. mov AL,0 ; Pass this value back to ERRORLEVEL
  70. int 21H ; Control returns to DOS
  71.  
  72. ;----------------------------|
  73. ; PROCEDURE SECTION |
  74. ;----------------------------|
  75.  
  76. ;---------------------------------------------------------------
  77. ; GOTOXY -- Positions the hardware cursor to X,Y
  78. ; Last update 3/5/89
  79. ;
  80. ; 1 entry point:
  81. ;
  82. ; GotoXY:
  83. ; Caller must pass:
  84. ; DL: X value These are both 0-based; i.e., they
  85. ; DH: Y value assume a screen 24 by 79, not 25 by 80
  86. ; Action: Moves the hardware cursor to the X,Y position
  87. ; loaded into DL and H.
  88. ;---------------------------------------------------------------
  89.  
  90. GotoXY PROC
  91. mov AH,02H ; Select VIDEO service 2: Position cursor
  92. mov BH,0 ; Stay with display page 0
  93. int 10H ; Call VIDEO
  94. ret ; Return to the caller
  95. GotoXY ENDP
  96.  
  97. ;---------------------------------------------------------------
  98. ; CLRSCR -- Clears or scrolls screens or windows
  99. ; Last update 3/5/89
  100. ;
  101. ; 4 entry points:
  102. ;
  103. ; ClrScr:
  104. ; No values expected from caller
  105. ; Action: Clears the entire screen to blanks with 07H as
  106. ; the display attribute
  107. ;
  108. ; ClrWin:
  109. ; Caller must pass:
  110. ; CH: Y coordinate, upper left corner of window
  111. ; CL: X coordinate, upper left corner of window
  112. ; DH: Y coordinate, lower right corner of window
  113. ; DL: X coordinate, lower right corner of window
  114. ; Action: Clears the window specified by the caller to
  115. ; blanks with 07H as the display attribute
  116. ;
  117. ; ScrlWin:
  118. ; Caller must pass:
  119. ; CH: Y coordinate, upper left corner of window
  120. ; CL: X coordinate, upper left corner of window
  121. ; DH: Y coordinate, lower right corner of window
  122. ; DL: X coordinate, lower right corner of window
  123. ; AL: number of lines to scroll window by (0 clears it)
  124. ; Action: Scrolls the window specified by the caller by
  125. ; the number of lines passed in AL. The blank
  126. ; lines inserted at screen bottom are cleared
  127. ; to blanks with 07H as the display attribute
  128. ;
  129. ; VIDEO6:
  130. ; Caller must pass:
  131. ; CH: Y coordinate, upper left corner of window
  132. ; CL: X coordinate, upper left corner of window
  133. ; DH: Y coordinate, lower right corner of window
  134. ; DL: X coordinate, lower right corner of window
  135. ; AL: number of lines to scroll window by (0 clears it)
  136. ; BH: display attribute for blanked lines (07H is "normal")
  137. ; Action: Generic access to BIOS VIDEO service 6. Caller
  138. ; must pass ALL register parameters as shown above
  139. ;---------------------------------------------------------------
  140.  
  141. ClrScr PROC
  142. mov CX,0 ; Upper left corner of full screen
  143. mov DX,LRXY ; Load lower-right XY coordinates into DX
  144. ClrWin: mov AL,0 ; 0 specifies clear entire region
  145. ScrlWin: mov BH,07H ; Specify "normal" attribute for blanked line(s)
  146. VIDEO6: mov AH,06H ; Select VIDEO service 6: Initialize/Scroll
  147. int 10H ; Call VIDEO
  148. ret ; Return to the caller
  149. ClrScr ENDP
  150.  
  151.  
  152. ;---------------------------------------------------------------
  153. ; WRITE -- Displays information to the screen via DOS
  154. ; service 9: Print String
  155. ; Last update 3/5/89
  156. ;
  157. ; 1 entry point:
  158. ;
  159. ; Write:
  160. ; Caller must pass:
  161. ; DS: The segment of the string to be displayed
  162. ; DX: The offset of the string to be displayed
  163. ; String must be terminated by "$"
  164. ; Action: Displays the string at DS:DX up to the "$" marker
  165. ;---------------------------------------------------------------
  166.  
  167. Write PROC
  168. mov AH,09H ; Select DOS service 9: Print String
  169. int 21H ; Call DOS
  170. ret ; Return to the caller
  171. Write ENDP
  172.  
  173.  
  174. ;---------------------------------------------------------------
  175. ; WRITELN -- Displays information to the screen via DOS
  176. ; service 9 and issues a newline
  177. ; Last update 3/5/89
  178. ;
  179. ; 1 entry point:
  180. ;
  181. ; Writeln:
  182. ; Caller must pass:
  183. ; DS: The segment of the string to be displayed
  184. ; DX: The offset of the string to be displayed
  185. ; String must be terminated by "$"
  186. ; Action: Displays the string at DS:DX up to the "$" marker
  187. ; marker, then issues a newline. Hardware cursor
  188. ; will move to the left margin of the following
  189. ; line. If the display is to the bottom screen
  190. ; line, the screen will scroll.
  191. ; Calls: Write
  192. ;---------------------------------------------------------------
  193.  
  194. Writeln PROC
  195. call Write ; Display the string proper through Write
  196. mov DX,OFFSET CRLF ; Load address of newline string to DS:DX
  197. call Write ; Display the newline string through Write
  198. ret ; Return to the caller
  199. Writeln ENDP
  200.  
  201. ;----------------------------|
  202. ; END PROCEDURE SECTION |
  203. ;----------------------------|
  204.  
  205.  
  206. Main ENDP
  207.  
  208. MyProg ENDS
  209.  
  210. ;----------------------------|
  211. ; END CODE SEGMENT |
  212. ;----------------------------|
  213.  
  214. END Start ; The procedure named Start becomes the main program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement