Created
February 21, 2012 02:52
-
-
Save spellancer/1873229 to your computer and use it in GitHub Desktop.
laba02 -2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Template for console application | |
.586 | |
.MODEL flat, stdcall | |
OPTION CASEMAP:NONE | |
Include kernel32.inc | |
Include masm32.inc | |
IncludeLib kernel32.lib | |
IncludeLib masm32.lib | |
.CONST | |
MsgExit DB "Press Enter to Exit",0AH,0DH,0 | |
.DATA | |
;b = (a2-b2)/2+a*(k+1) | |
a sdword 5 | |
k sdword -4 | |
b sdword 3 | |
two sdword 2 | |
.DATA? | |
inbuf DB 100 DUP (?) | |
x sdword ? | |
result sdword ? | |
.CODE | |
Start: | |
; | |
; Add you statements | |
; | |
mov ECX , k | |
inc ECX | |
mov EAX , a | |
imul ECX ; (k+1)*a | |
mov x,eax ; (k+1)*a -> x | |
mov eax,a | |
imul eax | |
mov ebx,eax | |
mov eax,b | |
imul eax | |
sub ebx,eax | |
mov edx,two | |
idiv edx ;ошибка деления на ноль, теперь ошибка переполнения | |
add eax, x | |
;mov result, eax | |
XOR EAX,EAX | |
Invoke StdOut,ADDR MsgExit | |
Invoke StdIn,ADDR inbuf,LengthOf inbuf | |
Invoke ExitProcess,0 | |
End Start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment