Guest User

Untitled

a guest
Oct 9th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  2.  
  3.       .486                                      ; create 32 bit code
  4.       .model flat, stdcall                      ; 32 bit memory model
  5.       option casemap :none                      ; case sensitive
  6.  
  7. ;     include files
  8. ;     ~~~~~~~~~~~~~
  9.       include \masm32\include\windows.inc       ; main windows include file
  10.       include \masm32\include\masm32.inc        ; masm32 library include
  11.  
  12.     ; -------------------------
  13.     ; Windows API include files
  14.     ; -------------------------
  15.       include \masm32\include\gdi32.inc
  16.       include \masm32\include\user32.inc
  17.       include \masm32\include\kernel32.inc
  18.       include \masm32\include\Comctl32.inc
  19.       include \masm32\include\comdlg32.inc
  20.       include \masm32\include\shell32.inc
  21.       include \masm32\include\oleaut32.inc
  22.       include \masm32\include\ole32.inc
  23.       include \masm32\include\msvcrt.inc
  24.  
  25.       include \masm32\include\dialogs.inc       ; macro file for dialogs
  26.       include \masm32\macros\macros.asm         ; masm32 macro file
  27.  
  28. ;     libraries
  29. ;     ~~~~~~~~~
  30.       includelib \masm32\lib\masm32.lib         ; masm32 static library
  31.  
  32.     ; ------------------------------------------
  33.     ; import libraries for Windows API functions
  34.     ; ------------------------------------------
  35.       includelib \masm32\lib\gdi32.lib
  36.       includelib \masm32\lib\user32.lib
  37.       includelib \masm32\lib\kernel32.lib
  38.       includelib \masm32\lib\Comctl32.lib
  39.       includelib \masm32\lib\comdlg32.lib
  40.       includelib \masm32\lib\shell32.lib
  41.       includelib \masm32\lib\oleaut32.lib
  42.       includelib \masm32\lib\ole32.lib
  43.       includelib \masm32\lib\msvcrt.lib
  44.  
  45. ; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  46.  
  47. ; ************************************************************************
  48. ;    include \masm32\include\masm32rt.inc
  49. ; ************************************************************************
  50.  
  51. .data?
  52.  
  53. ;Result dd  ?
  54. ;lpBuf1 db  1024 dup(?) ; temp Buffers  
  55.  
  56. .data
  57. buffer_for_string db 10 dup(0)
  58. title_string db "Ðåçóëüòàò:  ",0
  59. ;   szformat db "%u",0Dh,0Ah,0      ; èçìåíÿåì ôîðìàò âûâîäà íà dec
  60.     szformat db "%d",0Dh,0Ah,0      ; èçìåíÿåì ôîðìàò âûâîäà íà hex
  61.  
  62. a_ dd 100
  63. b_ dd 100
  64. c_ dd 100
  65.  
  66. .code
  67. start:
  68. ; ************************************************************************
  69. main proc
  70.     LOCAL Result        :DWORD
  71. ;   LOCAL var_00        :DWORD
  72. ;   LOCAL var_01        :BYTE
  73.    
  74.  
  75. ; Çàòåì çäåñü(íèæå) çàïèøèòå ðåøåíèå.
  76. ; Çàïèñè âîçìîæíû òîëüêî äî íà÷àëà ñëåäóþùåé ëèíèè ðåøåòêè ...
  77. ; ###########################################################################    
  78.  
  79.  
  80. ;16.    (2*b – a + b * c) / (c / 4 - 1);
  81. mov eax,c_
  82. shl eax,2
  83. dec eax
  84. mov ecx,eax+
  85.  
  86. mov eax,b_
  87. shl eax,1
  88. sub eax,a_
  89. mov edx,b_
  90. mov ebx,c_
  91. imul edx,ebx ; edx=1600,ebx=40
  92. add eax,edx
  93. cdq
  94. idiv ecx ; all(eax) / edx
  95.  
  96.  
  97.  
  98.  
  99.  
  100. ; Ìåíÿåì èìÿ ðåãèñòðà íà èìÿ â êîòîðîì íàõîäèòñÿ âàø ðåçóëüòàò
  101.     mov Result,eax
  102.  
  103. ; ###########################################################################
  104.     push Result
  105.     push offset szformat
  106.     push offset buffer_for_string
  107.     call wsprintf
  108.  
  109.     push MB_OK
  110.     push offset title_string
  111.     push offset buffer_for_string
  112.     push 0
  113.     call MessageBox
  114.  
  115.     push 0
  116.     call ExitProcess
  117.    
  118. main endp
  119. ; ************************************************************************
  120. end start
  121.  
  122.  
  123. Comment ^
  124. Êàðêàñ ïðîãðàììû
  125.  
  126. .386
  127. .MODEL Flat, STDCALL
  128. .DATA
  129. <Âàøà èíèöèàëèçèpóåìûå äàííûå>
  130. ......
  131. .DATA?
  132. <Âàøè íå èíèöèàëèçèpóåìûå äàííûå>
  133. ......
  134. .CONST
  135. <Âàøè êîíñòàíòû>
  136. ......
  137. .CODE
  138. <ìåòêà>
  139. <Âàø êîä>
  140.  
  141. .....
  142.  
  143. end <ìåòêà>
  144. ^
Advertisement
Add Comment
Please, Sign In to add comment