;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;FangKuai struct lpAA dd ? lpBB dd ? lpCC dd ? lpDD dd ?FangKuai ends;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Type_FangKuai struct lp_1 dd ? lp_2 dd ? lp_3 dd ? lp_4 dd ? lp_end dd ?Type_FangKuai ends;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Global_Type struct lp_Type1 dd ? lp_Type2 dd ? lp_Type3 dd ? lp_Type4 dd ? lp_Type5 dd ? lp_Type6 dd ? lp_Type7 dd ?Global_Type ends;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NowFangKuai struct Now1 POINT <> Now2 POINT <> Now3 POINT <> Now4 POINT <>NowFangKuai ends
.const;############################################################;==================================POINT11 POINT <100,0>POINT12 POINT <125,0>POINT13 POINT <150,0>POINT14 POINT <175,0>POINT21 POINT <100,25>POINT22 POINT <125,25>POINT23 POINT <150,25>POINT24 POINT <175,25>POINT31 POINT <100,50>POINT32 POINT <125,50>POINT33 POINT <150,50>POINT34 POINT <175,50>POINT41 POINT <100,75>POINT42 POINT <125,75>POINT43 POINT <150,75>POINT44 POINT <175,75>;==================================;############################################################;############################################################;==================================L1 FangKuai <offset POINT12,offset POINT22,offset POINT32,offset POINT33>L2 FangKuai <offset POINT32,offset POINT33,offset POINT34,offset POINT24>L3 FangKuai <offset POINT22,offset POINT23,offset POINT33,offset POINT43>L4 FangKuai <offset POINT22,offset POINT23,offset POINT24,offset POINT32>;==================================;==================================RL1 FangKuai <offset POINT13,offset POINT23,offset POINT33,offset POINT32>RL2 FangKuai <offset POINT22,offset POINT23,offset POINT24,offset POINT34>RL3 FangKuai <offset POINT22,offset POINT23,offset POINT32,offset POINT42>RL4 FangKuai <offset POINT22,offset POINT32,offset POINT33,offset POINT34>;==================================;==================================T1 FangKuai <offset POINT31,offset POINT32,offset POINT33,offset POINT22>T2 FangKuai <offset POINT22,offset POINT32,offset POINT42,offset POINT33>T3 FangKuai <offset POINT31,offset POINT32,offset POINT33,offset POINT42>T4 FangKuai <offset POINT22,offset POINT31,offset POINT32,offset POINT42>;==================================;==================================I1 FangKuai <offset POINT12,offset POINT22,offset POINT32,offset POINT42>I2 FangKuai <offset POINT31,offset POINT32,offset POINT33,offset POINT34>;==================================;==================================O FangKuai <offset POINT22,offset POINT23,offset POINT32,offset POINT33>;==================================;==================================Z1 FangKuai <offset POINT22,offset POINT32,offset POINT33,offset POINT43>Z2 FangKuai <offset POINT23,offset POINT24,offset POINT32,offset POINT33>;==================================;==================================RZ1 FangKuai <offset POINT13,offset POINT22,offset POINT23,offset POINT32>RZ2 FangKuai <offset POINT22,offset POINT23,offset POINT33,offset POINT34>;==================================;############################################################;############################################################;==================================LL Type_FangKuai <offset L1,offset L2,offset L3,offset L4,0>;==================================;==================================RLRL Type_FangKuai <offset RL1,offset RL2,offset RL3,offset RL4,0>;==================================;==================================TT Type_FangKuai <offset T1,offset T2,offset T3,offset T4,0>;==================================;==================================II Type_FangKuai <offset I1,offset I2,0,0,0>;==================================;==================================OO Type_FangKuai <offset O,0,0,0,0>;==================================;==================================ZZ Type_FangKuai <offset Z1,offset Z2,0,0,0>;==================================;==================================RZRZ Type_FangKuai <offset RZ1,offset RZ2,0,0,0>;==================================;############################################################;############################################################MyType Global_Type <offset LL,offset RLRL,offset TT,offset II,offset OO,offset ZZ,offset RZRZ>;############################################################
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 俄罗斯方块-主程序; ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 2005.10.15;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; Write By -------- ydy;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .386 .model flat,stdcall option casemap:none;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; Include 文件定义;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>include windows.incinclude gdi32.incincludelib gdi32.libinclude user32.incincludelib user32.libinclude kernel32.incincludelib kernel32.libinclude myINC.incinclude myCONST.asm;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ID_B1 equ 101ID_B2 equ 102ID_B3 equ 103ID_ER equ 104ID_ES equ 105DIALOG_1 equ 1111;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 数据段;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .data?hInstance dd ?hWinMain dd ?hDcSrc dd ?hPen dd ?hBitmap dd ?hb1 dd ?hb2 dd ?hb3 dd ?her dd ?hes dd ?NowFK NowFangKuai <> ;当前方快的四点坐标NowLP1 dd ?NowLP2 dd ?FK_Step dd ?Step_L dd ?Step_R dd ?MyColor dd ?yy dd 4 dup(?) .constszCaptionMain db '俄罗斯方快',0szClassName db 'MyClass',0szButton db 'button',0szLtext db 'static',0szEdit db 'edit',0szStart db '开始',0szSetup db '设置',0szSend db '发送',0;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 代码段;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .code;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;初始化控件;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_InitCom proc hWnd pushad invoke CreateWindowEx,NULL,\ offset szButton,offset szStart,\ WS_CHILD or WS_VISIBLE or \ BS_PUSHBUTTON or WS_TABSTOP,\ 220,200,60,30,\ hWnd,ID_B1,hInstance,NULL mov hb1,eax invoke CreateWindowEx,NULL,\ offset szButton,offset szSetup,\ WS_CHILD or WS_VISIBLE or \ BS_PUSHBUTTON or WS_TABSTOP,\ 220,260,60,30,\ hWnd,ID_B2,hInstance,NULL mov hb2,eax invoke CreateWindowEx,NULL,\ offset szButton,offset szSend,\ WS_CHILD or WS_VISIBLE or\ BS_PUSHBUTTON or WS_TABSTOP,\ 215,470,75,25,\ hWnd,ID_B3,hInstance,NULL mov hb3,eax invoke CreateWindowEx,NULL,\ offset szEdit,NULL,\ WS_CHILD or WS_VISIBLE or ES_MULTILINE \ or ES_AUTOVSCROLL or \ ES_AUTOHSCROLL or ES_READONLY \ or WS_BORDER or WS_VSCROLL or WS_TABSTOP,\ 5,310,290,150,\ hWnd,ID_ER,hInstance,NULL mov her,eax invoke CreateWindowEx,NULL,\ offset szEdit,NULL,\ WS_CHILD or WS_VISIBLE or \ ES_AUTOHSCROLL \ or WS_BORDER or WS_TABSTOP,\ 5,470,200,25,\ hWnd,ID_ES,hInstance,NULL mov hes,eax popad ret_InitCom endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;测试是否有要消的行;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_CheakEraser proc local @y[4] local @xx local @lop1,@lop2 local @m,@n local @yyy,@nnn pushad lea esi,@y mov eax,NowFK.Now1.y add eax,15 mov [esi],eax mov eax,NowFK.Now2.y add eax,15 mov [esi+4],eax mov eax,NowFK.Now3.y add eax,15 mov [esi+8],eax mov eax,NowFK.Now4.y add eax,15 mov [esi+12],eax mov eax,4 mov @lop1,eax lea esi,@y .while @lop1 mov eax,15 mov @xx,15 mov eax,12 mov @lop2,eax .while @lop2 invoke GetPixel,hDcSrc,@xx,[esi] .if eax==Black .break .endif mov eax,@xx add eax,25 mov @xx,eax mov eax,@lop2 dec eax mov @lop2,eax .endw .if !@lop2 mov eax,[esi] sub eax,15 mov @yyy,eax add eax,25 mov @nnn,eax invoke GetStockObject,BLACK_PEN push eax invoke SelectObject,hDcSrc,eax invoke CreateSolidBrush,Black invoke SelectObject,hDcSrc,eax invoke DeleteObject,eax invoke Rectangle,hDcSrc,0,@yyy,300,@nnn pop eax invoke DeleteObject,eax invoke BitBlt,hDcSrc,0,25,300,@yyy,hDcSrc,0,0,SRCCOPY .endif add esi,4 mov eax,@lop1 dec eax mov @lop1,eax .endw popad mov eax,1 ret_CheakEraser endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;判断有没到底边或左右两边;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_CheakP_Down proc pushad ;down .if NowFK.Now1.y==475||NowFK.Now2.y==475||NowFK.Now3.y==475||NowFK.Now4.y==475 popad xor eax,eax jmp lopret .endif popad xor eax,eax inc eax lopret: ret_CheakP_Down endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_CheakP_Left proc pushad ;left .if NowFK.Now1.x==0||NowFK.Now2.x==0||NowFK.Now3.x==0||NowFK.Now4.x==0 popad xor eax,eax jmp lopret .endif popad xor eax,eax inc eax lopret: ret_CheakP_Left endp ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_CheakP_Right proc pushad ;right .if NowFK.Now1.x==275||NowFK.Now2.x==275||NowFK.Now3.x==275||NowFK.Now4.x==275 popad xor eax,eax jmp lopret .endif popad xor eax,eax inc eax lopret: ret_CheakP_Right endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;判断颜色;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_CheakColor proc dric:dword local @x,@y pushad ;invoke GetPixel,hDcSrc,@x,@y mov eax,dric .if eax==1 mov eax,NowFK.Now1.x sub eax,15 mov @x,eax mov eax,NowFK.Now1.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now2.x sub eax,15 mov @x,eax mov eax,NowFK.Now2.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now3.x sub eax,15 mov @x,eax mov eax,NowFK.Now3.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now4.x sub eax,15 mov @x,eax mov eax,NowFK.Now4.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif .elseif eax==2 mov eax,NowFK.Now1.x add eax,40 mov @x,eax mov eax,NowFK.Now1.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now2.x add eax,40 mov @x,eax mov eax,NowFK.Now2.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now3.x add eax,40 mov @x,eax mov eax,NowFK.Now3.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now4.x add eax,40 mov @x,eax mov eax,NowFK.Now4.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif .elseif eax==3 mov eax,NowFK.Now1.x add eax,15 mov @x,eax mov eax,NowFK.Now1.y add eax,40 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax jmp @f .endif mov eax,NowFK.Now2.x add eax,15 mov @x,eax mov eax,NowFK.Now2.y add eax,40 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax jmp @f .endif mov eax,NowFK.Now3.x add eax,15 mov @x,eax mov eax,NowFK.Now3.y add eax,40 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax jmp @f .endif mov eax,NowFK.Now4.x add eax,15 mov @x,eax mov eax,NowFK.Now4.y add eax,40 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax jmp @f .endif .elseif eax==4 mov eax,NowFK.Now1.x add eax,15 mov @x,eax mov eax,NowFK.Now1.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now2.x add eax,15 mov @x,eax mov eax,NowFK.Now2.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now3.x add eax,15 mov @x,eax mov eax,NowFK.Now3.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif mov eax,NowFK.Now4.x add eax,15 mov @x,eax mov eax,NowFK.Now4.y add eax,15 mov @y,eax invoke GetPixel,hDcSrc,@x,@y .if eax!=Black popad xor eax,eax ret .endif .endif popad xor eax,eax inc eax @@: ret_CheakColor endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_Down proc pushad mov eax,NowFK.Now1.y add eax,25 mov NowFK.Now1.y,eax mov eax,NowFK.Now2.y add eax,25 mov NowFK.Now2.y,eax mov eax,NowFK.Now3.y add eax,25 mov NowFK.Now3.y,eax mov eax,NowFK.Now4.y add eax,25 mov NowFK.Now4.y,eax popad ret_Down endp_Left proc pushad mov eax,NowFK.Now1.x sub eax,25 mov NowFK.Now1.x,eax mov eax,NowFK.Now2.x sub eax,25 mov NowFK.Now2.x,eax mov eax,NowFK.Now3.x sub eax,25 mov NowFK.Now3.x,eax mov eax,NowFK.Now4.x sub eax,25 mov NowFK.Now4.x,eax popad ret_Left endp_Right proc pushad mov eax,NowFK.Now1.x add eax,25 mov NowFK.Now1.x,eax mov eax,NowFK.Now2.x add eax,25 mov NowFK.Now2.x,eax mov eax,NowFK.Now3.x add eax,25 mov NowFK.Now3.x,eax mov eax,NowFK.Now4.x add eax,25 mov NowFK.Now4.x,eax popad ret_Right endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;随机数产生;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_Rand proc uses ecx edx first1:DWORD, second1:DWORD invoke GetTickCount ; 取得随机数种子,当然,可用别的方法代替 mov ecx, 23 ; X = ecx = 23 mul ecx ; eax = eax * X add eax, 7 ; eax = eax + Y (Y = 7) mov ecx, second1 ; ecx = 上限 sub ecx, first1 ; ecx = 上限 - 下限 inc ecx ; Z = ecx + 1 (得到了范围) xor edx, edx ; edx = 0 div ecx ; eax = eax mod Z (余数在edx里面) add edx, first1 ; 修正产生的随机数的范围 mov eax, edx ; eax = Rand_Number ret_Rand endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;在内存中建立一个DC,以白色背景覆盖;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_Init proc local @hDc pushad invoke GetDC,0 mov @hDc,eax invoke CreateCompatibleDC,@hDc mov hDcSrc,eax invoke CreateCompatibleBitmap,@hDc,300,500 mov hBitmap,eax invoke SelectObject,hDcSrc,eax invoke GetStockObject,BLACK_PEN;设置当前画笔色 mov hPen,eax invoke SelectObject,hDcSrc,eax invoke CreateSolidBrush,Black push eax invoke SelectObject,hDcSrc,eax invoke Rectangle,hDcSrc,0,0,300,500 pop eax invoke DeleteObject,eax invoke ReleaseDC,hWinMain,@hDc popad ret_Init endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;COPY;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_copy proc src_:dword,dec_:dword,len_:dword local @lop pushad mov eax,len_ shr eax,2 mov @lop,eax mov esi,src_ mov edi,dec_ .while @lop mov eax,dword ptr [esi] mov dword ptr [edi],eax add edi,4 add esi,4 mov eax,@lop dec eax mov @lop,eax .endw popad ret_copy endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;结构COPY;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_StrCopy proc lpdd pushad mov esi,lpdd mov eax,[esi+FangKuai.lpAA] mov eax,[eax+POINT.x] mov NowFK.Now1.x,eax mov eax,[esi+FangKuai.lpAA] mov eax,[eax+POINT.y] mov NowFK.Now1.y,eax mov eax,[esi+FangKuai.lpBB] mov eax,[eax+POINT.x] mov NowFK.Now2.x,eax mov eax,[esi+FangKuai.lpBB] mov eax,[eax+POINT.y] mov NowFK.Now2.y,eax mov eax,[esi+FangKuai.lpCC] mov eax,[eax+POINT.x] mov NowFK.Now3.x,eax mov eax,[esi+FangKuai.lpCC] mov eax,[eax+POINT.y] mov NowFK.Now3.y,eax mov eax,[esi+FangKuai.lpDD] mov eax,[eax+POINT.x] mov NowFK.Now4.x,eax mov eax,[esi+FangKuai.lpDD] mov eax,[eax+POINT.y] mov NowFK.Now4.y,eax popad ret_StrCopy endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;画一个方快;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_DrawF_lp proc lpFang local @x,@y local @m,@n,@loop pushad mov @loop,4 mov esi,lpFang .while @loop>0 mov ebx,[esi] mov eax,[ebx+POINT.x] mov @x,eax add eax,25 mov @m,eax mov eax,[ebx+POINT.y] mov @y,eax add eax,25 mov @n,eax invoke GetStockObject,WHITE_PEN push eax invoke SelectObject,hDcSrc,eax invoke CreateSolidBrush,Green invoke SelectObject,hDcSrc,eax invoke DeleteObject,eax invoke Rectangle,hDcSrc,@x,@y,@m,@n pop eax invoke DeleteObject,eax add esi,4 mov eax,@loop dec eax mov @loop,eax .endw popad xor eax,eax ret_DrawF_lp endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_DrawF proc Fang:NowFangKuai local @x,@y local @m,@n,@loop pushad mov @loop,4 lea esi,Fang .while @loop>0 mov eax,[esi+POINT.x] mov @x,eax add eax,25 mov @m,eax mov eax,[esi+POINT.y] mov @y,eax add eax,25 mov @n,eax invoke GetStockObject,WHITE_PEN push eax invoke SelectObject,hDcSrc,eax invoke CreateSolidBrush,MyColor invoke SelectObject,hDcSrc,eax invoke DeleteObject,eax invoke Rectangle,hDcSrc,@x,@y,@m,@n pop eax invoke DeleteObject,eax add esi,8 mov eax,@loop dec eax mov @loop,eax .endw popad xor eax,eax ret_DrawF endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_ClearF proc Fang:NowFangKuai local @x,@y local @m,@n,@loop pushad mov @loop,4 lea esi,Fang .while @loop>0 mov eax,[esi+POINT.x] mov @x,eax add eax,25 mov @m,eax mov eax,[esi+POINT.y] mov @y,eax add eax,25 mov @n,eax invoke GetStockObject,BLACK_PEN push eax invoke SelectObject,hDcSrc,eax invoke CreateSolidBrush,Black invoke SelectObject,hDcSrc,eax invoke DeleteObject,eax invoke Rectangle,hDcSrc,@x,@y,@m,@n pop eax invoke DeleteObject,eax add esi,8 mov eax,@loop dec eax mov @loop,eax .endw popad xor eax,eax ret_ClearF endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;随机产生一个方快,并将方快的坐标数据拷到NowFK;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_RandFK proc pushad invoke KillTimer,hWinMain,1 invoke SetTimer,hWinMain,1,500,NULL invoke _CheakEraser xor eax,eax mov FK_Step,eax mov Step_L,eax mov Step_R,eax invoke _Rand,0,6 .if eax==0 mov ebx,Green mov MyColor,ebx .elseif eax==1 mov ebx,Blue mov MyColor,ebx .elseif eax==2 mov ebx,Red mov MyColor,ebx .elseif eax==3 mov ebx,Yellow mov MyColor,ebx .elseif eax==4 mov ebx,Yellow mov MyColor,ebx .elseif eax==5 mov ebx,Blue mov MyColor,ebx .elseif eax==6 mov ebx,Red mov MyColor,ebx .endif shl eax,2 mov esi,offset MyType mov esi,[esi+eax] mov NowLP1,esi mov NowLP2,esi mov esi,[esi] invoke _StrCopy,esi invoke _CheakColor,4 .if !eax invoke KillTimer,hWinMain,1 .endif popad ret_RandFK endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>; 窗口过程;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_ProcWinMain proc uses ebx edi esi ,hWnd,uMsg,wParam,lParam local @hDc,@step local @stPS:PAINTSTRUCT local @fk:NowFangKuai mov eax,uMsg;******************************************************************** .if eax == WM_PAINT invoke BeginPaint,hWnd,addr @stPS mov @hDc,eax invoke BitBlt,@hDc,301,0,400,500,hDcSrc,0,0,SRCCOPY invoke EndPaint,hWnd,addr @stPS;******************************************************************** .elseif eax == WM_COMMAND mov eax,wParam .if ax == ID_B1 invoke _Init invoke _RandFK invoke _DrawF,NowFK invoke SetTimer,hWnd,1,500,NULL .elseif ax == ID_B2 .elseif ax == ID_B3 .endif;******************************************************************** .elseif eax == WM_CLOSE invoke KillTimer,hWnd,1 invoke DestroyWindow,hWinMain invoke PostQuitMessage,NULL;******************************************************************** .elseif eax == WM_CREATE invoke _Init invoke _InitCom,hWnd ;******************************************************************** .elseif eax == WM_LBUTTONDOWN invoke SetFocus,hWnd;******************************************************************** .elseif eax == WM_TIMER invoke _ClearF,NowFK invoke _CheakP_Down .if eax invoke _CheakColor,3 .if eax invoke _Down mov eax,FK_Step inc eax mov FK_Step,eax .else invoke _DrawF,NowFK invoke _RandFK .endif .else invoke _DrawF,NowFK invoke _RandFK .endif invoke _DrawF,NowFK invoke InvalidateRect,hWnd,NULL,FALSE;******************************************************************** .elseif eax == WM_KEYDOWN mov eax,wParam .if eax == VK_LEFT invoke _ClearF,NowFK invoke _CheakP_Left .if eax invoke _CheakColor,1 .if eax mov eax,Step_L add eax,25 mov Step_L,eax invoke _Left .endif .endif invoke _DrawF,NowFK invoke InvalidateRect,hWnd,NULL,FALSE .elseif eax == VK_RIGHT invoke _ClearF,NowFK invoke _CheakP_Right .if eax invoke _CheakColor,2 .if eax mov eax,Step_R add eax,25 mov Step_R,eax invoke _Right .endif .endif invoke _DrawF,NowFK invoke InvalidateRect,hWnd,NULL,FALSE .elseif eax == VK_UP invoke _ClearF,NowFK invoke _copy,offset NowFK,addr @fk,32 mov eax,25 mov ebx,FK_Step mul ebx mov @step,eax mov esi,NowLP2 add esi,4 mov NowLP2,esi mov esi,[esi] @@: .if esi invoke _StrCopy,esi mov ebx,@step mov eax,NowFK.Now1.y add eax,ebx mov NowFK.Now1.y,eax mov eax,NowFK.Now2.y add eax,ebx mov NowFK.Now2.y,eax mov eax,NowFK.Now3.y add eax,ebx mov NowFK.Now3.y,eax mov eax,NowFK.Now4.y add eax,ebx mov NowFK.Now4.y,eax ;/////////////////////////// mov ebx,Step_R mov eax,NowFK.Now1.x add eax,ebx mov NowFK.Now1.x,eax mov eax,NowFK.Now2.x add eax,ebx mov NowFK.Now2.x,eax mov eax,NowFK.Now3.x add eax,ebx mov NowFK.Now3.x,eax mov eax,NowFK.Now4.x add eax,ebx mov NowFK.Now4.x,eax ;/////////// mov ebx,Step_L mov eax,NowFK.Now1.x sub eax,ebx mov NowFK.Now1.x,eax mov eax,NowFK.Now2.x sub eax,ebx mov NowFK.Now2.x,eax mov eax,NowFK.Now3.x sub eax,ebx mov NowFK.Now3.x,eax mov eax,NowFK.Now4.x sub eax,ebx mov NowFK.Now4.x,eax jmp @f .else mov eax,NowLP1 mov NowLP2,eax mov esi,NowLP2 mov esi,[esi] jmp @b .endif @@: invoke _CheakColor,4 .if !eax invoke _copy,addr @fk,offset NowFK,32 .endif invoke _DrawF,NowFK invoke InvalidateRect,hWnd,NULL,FALSE .elseif eax == VK_DOWN invoke _ClearF,NowFK invoke _CheakP_Down .if eax invoke _CheakColor,3 .if eax invoke _Down mov eax,FK_Step inc eax mov FK_Step,eax .else invoke _DrawF,NowFK invoke _RandFK .endif .else invoke _DrawF,NowFK invoke _RandFK .endif invoke _DrawF,NowFK invoke InvalidateRect,hWnd,NULL,FALSE .elseif eax == VK_C invoke KillTimer,hWnd,1 invoke SetTimer,hWnd,1,1,NULL .endif;******************************************************************** .else invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .endif;******************************************************************** xor eax,eax ret_ProcWinMain endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_WinMain proc local @stWndClass:WNDCLASSEX local @stMsg:MSG invoke GetModuleHandle,NULL mov hInstance,eax invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass;********************************************************************; 注册窗口类;******************************************************************** invoke LoadCursor,0,IDC_ARROW mov @stWndClass.hCursor,eax push hInstance pop @stWndClass.hInstance mov @stWndClass.cbSize,sizeof WNDCLASSEX mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW mov @stWndClass.lpfnWndProc,offset _ProcWinMain mov @stWndClass.hbrBackground,COLOR_WINDOW + 1 mov @stWndClass.lpszClassName,offset szClassName invoke RegisterClassEx,addr @stWndClass;********************************************************************; 建立并显示窗口;******************************************************************** invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaptionMain,\ WS_SYSMENU,\ 100,20,612,532,\ NULL,NULL,hInstance,NULL mov hWinMain,eax invoke ShowWindow,hWinMain,SW_SHOWNORMAL invoke UpdateWindow,hWinMain;********************************************************************; 消息循环;******************************************************************** .while TRUE invoke GetMessage,addr @stMsg,NULL,0,0 .break .if eax == 0 invoke TranslateMessage,addr @stMsg invoke DispatchMessage,addr @stMsg .endw ret_WinMain endp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>start: call _WinMain invoke ExitProcess,NULL;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> end start