Advertisement
Guest User

asm

a guest
Dec 9th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. .686
  2. .model flat, c
  3. includelib libcmt.lib
  4. includelib libvcruntime.lib
  5. includelib libucrt.lib
  6. includelib legacy_stdio_definitions.lib
  7.  
  8. extern Sleep@4: proc, system: proc, printf_s: proc, putchar: proc
  9.  
  10. .data
  11. clsString byte "cls", 0
  12. crlf byte 13, 10, 13, 10, 0
  13. element_final_x dword 0
  14. x word 1 ; x coordinate
  15. message byte "SAUDI ARABIA", 0
  16. messageLength equ $ - message
  17. .data?
  18. index dword ?
  19. y word ? ; y coordinate
  20.  
  21. .code
  22. main proc
  23. call hidecursor32
  24. mov element_final_x, 0
  25. push 233
  26. call SetColor32 ;
  27. add esp, 4
  28.  
  29. push offset clsString
  30. call system ;
  31. add esp, 4
  32.  
  33. mov x, 1
  34. mov index, 0
  35. L0:
  36. cmp index, messageLength - 1
  37. jae L6
  38.  
  39. mov esi, index
  40. cmp message[esi], ' ' ; don't animate blank character
  41. je L4 ;
  42. mov y, 0
  43. L1:
  44. cmp y, 10 ; max_y = 10
  45. jae L4
  46.  
  47. movzx ecx, y
  48. push ecx
  49. movzx ecx, x
  50. push ecx
  51. call gotoxy32
  52. add esp, 8
  53. push 233 ; SetColor(233);
  54. call SetColor32 ;
  55. add esp, 4
  56.  
  57. movzx eax, byte ptr message[esi]
  58. push eax
  59. call putchar
  60. add esp, 4
  61.  
  62. push 300 ; Sleep(300);
  63. call Sleep@4 ;
  64. add esp, 4
  65.  
  66. movzx ecx, y
  67. push ecx
  68. movzx ecx, x
  69. push ecx
  70. call gotoxy32
  71. add esp, 8
  72.  
  73. push 238
  74. call SetColor32 ;
  75. add esp, 4
  76.  
  77. movzx eax, byte ptr message[esi]
  78. push eax
  79. call putchar
  80. add esp, 4
  81. inc y ; increment the y coordinate
  82. jmp L1
  83. L4:
  84. movzx ecx, y
  85. push ecx
  86. movzx ecx, x
  87. push ecx
  88. call gotoxy32
  89. add esp, 8
  90.  
  91. push 233 ; SetColor(233);
  92. call SetColor32 ;
  93. add esp, 4
  94.  
  95. mov edi, element_final_x
  96. movzx eax, byte ptr message[edi]
  97. push eax
  98. call putchar
  99. add esp, 4
  100.  
  101. inc element_final_x
  102. inc x
  103. inc index
  104. jmp L0
  105. L6:
  106. push offset crlf
  107. call printf_s
  108.  
  109. xor eax, eax
  110. ret
  111. main endp
  112. setColor32 proc colorValue: dword
  113. extern GetStdHandle@4: proc, SetConsoleTextAttribute@8: proc
  114. push eax
  115. push 0FFFFFFF5h ; HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  116. call GetStdHandle@4 ;
  117. push colorValue ; SetConsoleTextAttribute(hStdOut, colorValue);
  118. push eax ;
  119. call SetConsoleTextAttribute@8 ;
  120. pop eax
  121. ret
  122. setColor32 endp
  123.  
  124. gotoxy32 proc
  125. extern GetStdHandle@4: proc, SetConsoleCursorPosition@8: proc
  126. .data?
  127. coord2 dword ?
  128. .code
  129. push ebp
  130. mov ebp, esp
  131. sub esp, 32
  132. mov ax, [ebp + 8] ; x
  133. mov word ptr [coord2],ax
  134. mov bx, [ebp + 12] ; y
  135. mov word ptr [coord2 + 2], bx
  136. mov eax,dword ptr [coord2]
  137. push eax
  138.  
  139. push 0FFFFFFF5h ; GetStdHandle(STD_OUTPUT_HANDLE);
  140. call GetStdHandle@4 ;
  141. push eax ; SetConsoleCursorPosition(handle, coord);
  142. call SetConsoleCursorPosition@8 ;
  143.  
  144. add esp, 32
  145. pop ebp
  146. ret
  147. gotoxy32 endp
  148.  
  149. hidecursor32 proc
  150. extern GetStdHandle@4 : proc, SetConsoleCursorInfo@8 : proc
  151. .data
  152. consoleHandle dword 0
  153. info dword 0
  154. .code
  155. push 0FFFFFFF5h
  156. call GetStdHandle@4
  157.  
  158. mov consoleHandle, eax
  159. mov info, 100
  160. mov dword ptr [ebp - 24], 0
  161.  
  162. lea eax, info
  163. push eax
  164. mov ecx, consoleHandle
  165. push ecx
  166. call SetConsoleCursorInfo@8
  167. ret
  168. hidecursor32 endp
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement