home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.sberbank.sumy.ua
/
2014.11.ftp.sberbank.sumy.ua.tar
/
ftp.sberbank.sumy.ua
/
incoming
/
1
/
FPU07083.asm
< prev
next >
Wrap
Assembly Source File
|
2014-02-08
|
5KB
|
195 lines
.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
return MACRO arg
mov eax, arg
ret
ENDM
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
DrawFloatChessLoc PROTO :DWORD, :DWORD, :DWORD,:DWORD,:DWORD
FloatDivMulLoc PROTO :DWORD, :DWORD, :DWORD
.data
szClassName db "Evgeney_Victorovich_Kupin_27_April_1982",0
szDisplayName db "Float chess",0
CommandLine dd 0
hWnd dd 0
hInstance dd 0
hIcon dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax
invoke WinMain, hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst :DWORD, hPrevInst :DWORD, CmdLine :DWORD, CmdShow :DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW \
or CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground, COLOR_WINDOW
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset szClassName
push hIcon
pop wc.hIcon
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor, eax
push hIcon
pop wc.hIconSm
invoke RegisterClassEx, ADDR wc
invoke CreateWindowEx,WS_EX_LEFT,
ADDR szClassName,
ADDR szDisplayName,
WS_OVERLAPPEDWINDOW or WS_SYSMENU,
0,0,640,510,
NULL,NULL,
hInst,NULL
mov hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:
return msg.wParam
WinMain endp
WndProc proc hWin :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD
LOCAL Ps :PAINTSTRUCT
LOCAL hDC :DWORD
LOCAL strRC:RECT
.if uMsg == WM_CREATE
return 0
.elseif uMsg == WM_PAINT
invoke BeginPaint,hWin,ADDR Ps
mov hDC, eax
invoke GetClientRect, hWin, addr strRC
invoke DrawFloatChessLoc, hDC, strRC.right, strRC.bottom, 21, 18
invoke EndPaint,hWin,ADDR Ps
return 0
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
return 0
.endif
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
WndProc endp
DrawFloatChessLoc proc hDC:DWORD, tlX:DWORD, tlY:DWORD, nSecX:DWORD, nSecY:DWORD
LOCAl clDiv:DWORD
LOCAl clPosX:DWORD
LOCAl clPosY:DWORD
LOCAL clCounter:DWORD
LOCAL lcEnd:DWORD
mov eax, nSecX
mov lcEnd, eax
cmp eax, nSecY
ja DrawFloatChessLoc_X_alter
mov eax, nSecY
mov lcEnd,eax
DrawFloatChessLoc_X_alter:
mov clCounter,1
DrawFloatChessLoc_loop:
invoke FloatDivMulLoc, tlX, nSecX, clCounter
mov clPosX,eax
invoke FloatDivMulLoc, tlY, nSecY, clCounter
mov clPosY,eax
invoke MoveToEx, hDC, clPosX, 0, 0
invoke LineTo , hDC, clPosX, tlY
invoke MoveToEx, hDC, 0, clPosY, 0
invoke LineTo , hDC, tlX,clPosY
inc clCounter
mov ecx, clCounter
cmp ecx, lcEnd
jna DrawFloatChessLoc_loop
ret
DrawFloatChessLoc endp
FloatDivMulLoc proc bsVal:DWORD, nDiv:DWORD, nMul:DWORD
LOCAL FlagCr:WORD
LOCAL lcResult:DWORD
finit
fstcw FlagCr
or FlagCr, 0011000000000b
fldcw FlagCr
fild nDiv
fild bsVal
fdiv st(0),st(1)
fild nMul
fmul st(0),st(1)
fistp lcResult
mov eax, lcResult
ret
FloatDivMulLoc endp
end start