Advertisement
atm959

Parts of main.asm

Aug 14th, 2020
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. extern clearScreen
  2. extern placeText
  3.  
  4. zeroDivideText:
  5. db "DIVIDE-BY-ZERO EXCEPTION", 0
  6.  
  7. zeroDivide:
  8. call copyState
  9. call clearScreen
  10. call dumpState
  11. push DWORD 0Ch
  12. push DWORD 0
  13. push DWORD 0
  14. mov eax, zeroDivideText
  15. push eax
  16. call placeText
  17. pop eax
  18. pop eax
  19. pop eax
  20. pop eax
  21. jmp halt
  22.  
  23. halt:
  24. cli
  25. hlt
  26.  
  27. eaxRAM: dd 0
  28. ebxRAM: dd 0
  29. ecxRAM: dd 0
  30. edxRAM: dd 0
  31. espRAM: dd 0
  32.  
  33. copyState:
  34. mov [eaxRAM], eax
  35. mov [ebxRAM], ebx
  36. mov [ecxRAM], ecx
  37. mov [edxRAM], edx
  38. mov [espRAM], esp
  39. ret
  40.  
  41. eaxText: db "EAX: ", 0
  42. ebxText: db "EBX: ", 0
  43. ecxText: db "ECX: ", 0
  44. edxText: db "EDX: ", 0
  45. espText: db "ESP: ", 0
  46. instructionAddressText: db "INSTRUCTION ADDRESS: ", 0
  47. stackTraceText: db "STACK TRACE: ", 0
  48.  
  49. extern print32Bit
  50.  
  51. dumpState:
  52. push DWORD 0Fh
  53. push DWORD 1
  54. push DWORD 0
  55. mov eax, eaxText
  56. push eax
  57. call placeText
  58. pop eax
  59. pop eax
  60. pop eax
  61. pop eax
  62. push DWORD 1
  63. push DWORD 5
  64. mov eax, [eaxRAM]
  65. push eax
  66. call print32Bit
  67. pop eax
  68. pop eax
  69. pop eax
  70.  
  71. push DWORD 0Fh
  72. push DWORD 2
  73. push DWORD 0
  74. mov eax, ebxText
  75. push eax
  76. call placeText
  77. pop eax
  78. pop eax
  79. pop eax
  80. pop eax
  81. push DWORD 2
  82. push DWORD 5
  83. mov eax, [ebxRAM]
  84. push eax
  85. call print32Bit
  86. pop eax
  87. pop eax
  88. pop eax
  89.  
  90. push DWORD 0Fh
  91. push DWORD 3
  92. push DWORD 0
  93. mov eax, ecxText
  94. push eax
  95. call placeText
  96. pop eax
  97. pop eax
  98. pop eax
  99. pop eax
  100. push DWORD 3
  101. push DWORD 5
  102. mov eax, [ecxRAM]
  103. push eax
  104. call print32Bit
  105. pop eax
  106. pop eax
  107. pop eax
  108.  
  109. push DWORD 0Fh
  110. push DWORD 4
  111. push DWORD 0
  112. mov eax, edxText
  113. push eax
  114. call placeText
  115. pop eax
  116. pop eax
  117. pop eax
  118. pop eax
  119. push DWORD 4
  120. push DWORD 5
  121. mov eax, [edxRAM]
  122. push eax
  123. call print32Bit
  124. pop eax
  125. pop eax
  126. pop eax
  127.  
  128. push DWORD 0Fh
  129. push DWORD 5
  130. push DWORD 0
  131. mov eax, espText
  132. push eax
  133. call placeText
  134. pop eax
  135. pop eax
  136. pop eax
  137. pop eax
  138. push DWORD 5
  139. push DWORD 5
  140. mov eax, [espRAM]
  141. push eax
  142. call print32Bit
  143. pop eax
  144. pop eax
  145. pop eax
  146.  
  147. push DWORD 0Fh
  148. push DWORD 6
  149. push DWORD 0
  150. mov eax, instructionAddressText
  151. push eax
  152. call placeText
  153. pop eax
  154. pop eax
  155. pop eax
  156. pop eax
  157.  
  158. push DWORD 0Fh
  159. push DWORD 8
  160. push DWORD 0
  161. mov eax, stackTraceText
  162. push eax
  163. call placeText
  164. pop eax
  165. pop eax
  166. pop eax
  167. pop eax
  168. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement