PK :>1 Swirl_2.asm; Swirl_2.asm Help from Spook, ; Thursday, July 16, 2009 4:07:28 PM ; ; Modifications made to original ; 1. SetThreadPriority has been lowered to run on a .386 Processor ; 2. Assembled using Masm 8.0.50727.104 ; 3. Several movd instructions changed ; ; blur'n'swirl - 24bit color version ; done by ronybc [www.ronybc.8k.com] .686 .MMX .model flat,stdcall option casemap:none 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 SWIRLPIX STRUCT x dd ? y dd ? angle dd ? radius dd ? color dd ? SWIRLPIX ENDS .data ClassName db "apocalypse",0 AppName db "blur'n'swirl... mmx",0 website db "http://www.ronybc.8k.com",0 info db "Hit SPACE to pause.",13,10 db 13,10 db "This isn't the Final Version",13,10 db "visit www.ronybc.8k.com for updates",0 wwidth dd 200 wheight dd 240 maxx dd 10 maxy dd 10 temp dd 0 radius dd 0 flength dd 1 freerun dd 1 cmode dd 10 swan dd 0.0 speed dd 1.124 accel dd 0.000002 flevel1 dq 0001000100010001h flevel2 dq 0002000200020002h flevel3 dq 0003000300030003h pix1 SWIRLPIX <0,0,0.00,00,00ffa060h> pix2 SWIRLPIX <0,0,0.30,10,0040a0ffh> pix3 SWIRLPIX <0,0,0.60,20,00a0ff40h> pix4 SWIRLPIX <0,0,3.14,30,0000ffffh> bminf BITMAPINFO <<40,0,0,1,24,0,0,0,0,0,0>> .data? hInstance HINSTANCE ? idThread DWORD ? hwnd HWND ? disp HDC ? mbuf1 HDC ? mbuf2 HDC ? hHeap HDC ? msg MSG <> wc WNDCLASSEX <> .code BlurThread: invoke SetThreadPriority,idThread,THREAD_PRIORITY_BELOW_NORMAL invoke GetDC,hwnd mov disp,eax invoke GetProcessHeap mov hHeap,eax invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,2359296 add eax,4096 ; blur: -1'th line problem mov mbuf1,eax invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,2359296 add eax,4096 mov mbuf2,eax xf: lea esi,pix1 call swirl lea esi,pix2 call swirl lea esi,pix3 call swirl lea esi,pix4 call swirl ror dword ptr[esi+16],1 fld speed fld swan fadd st,st(1) fstp swan fld accel fimul freerun fadd fstp speed dec flength jz display jmp xf swirl: fild dword ptr [esi+12] fld swan fadd dword ptr [esi+8] fsincos fmul st,st(2) fistp dword ptr [esi] mov eax,radius add [esi],eax fmul fistp dword ptr [esi+4] mov eax,radius add [esi+4],eax mov edi,mbuf1 mov eax,[esi+4] mul maxx ;position=((y*maxx)+x)*3 add eax,[esi] mov edx,[esi+16] lea eax,[eax+eax*2] mov [edi+eax],dx shr edx,16 mov [edi+eax+2],dl mov eax,[esi+12] inc eax xor ecx,ecx cmp eax,radius cmova eax,ecx mov [esi+12],eax ret display: mov eax,cmode mov flength,eax blurmmx: mov esi,mbuf2 mov edi,mbuf1 mov mbuf1,esi mov mbuf2,edi mov eax,maxx lea eax,[eax+eax*2] push eax ; maxx*3 mul maxy ; maxy*maxx*3 add edi,eax mov ecx,eax pop edx add edx,3 lea ebx,[edx-6] neg ebx pxor MM7,MM7 @@: movq MM2,MM1 movq MM1,MM0 ; ; ; movd MM0,[edi] ; original insruction loop moves backward ; ; movq mm0, qword ptr [edi] ; punpcklbw MM0,MM7 paddw MM2,MM0 movq MM4,qword ptr[edi+edx] punpcklbw MM4,MM7 paddw MM2,MM4 movq MM4,qword ptr[edi+ebx] punpcklbw MM4,MM7 paddw MM2,MM4 psrlw MM2,2 movq MM4,MM2 pcmpgtw MM4,MM1 ; compares signed data pand MM2,MM4 pandn MM4,MM1 por MM2,MM4 psubusw MM2,flevel1 packuswb MM2,MM7 movd eax,MM2 mov [esi+ecx+3],ax shr eax,16 mov [esi+ecx+5],al sub edi,3 sub ecx,3 jnc @B emms ; free for following floating-point functions invoke SetDIBitsToDevice,disp,0,0,maxx,maxy,\ 0,0,0,maxy,mbuf1,ADDR bminf,DIB_RGB_COLORS jmp xf WndProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .IF uMsg==WM_DESTROY invoke PostQuitMessage,NULL invoke ReleaseDC,hwnd,disp invoke HeapFree,hHeap,0,mbuf1 invoke HeapFree,hHeap,0,mbuf2 .ELSEIF uMsg==WM_KEYDOWN xor eax,eax lea edx,freerun or al,byte ptr [edx] setz byte ptr [edx] .ELSEIF uMsg==WM_CREATE invoke CreateThread,0,8196,ADDR BlurThread,0,0,ADDR idThread .ELSEIF uMsg==WM_SIZE xor edx,edx mov eax,lParam mov dx,ax shr eax,16 shr edx,2 shl edx,2 mov maxx,edx mov maxy,eax mov bminf.bmiHeader.biWidth,edx neg eax ; -maxy mov bminf.bmiHeader.biHeight,eax neg eax cmp eax,edx cmova eax,edx shr eax,1 mov radius,eax .ELSEIF uMsg == WM_COMMAND .IF wParam==1100 mov cmode,10 .ELSEIF wParam==1200 mov cmode,20 .ELSEIF wParam==1300 mov cmode,30 .ELSEIF wParam==1000 invoke SendMessage,hwnd,WM_SYSCOMMAND,SC_CLOSE,NULL .ELSEIF wParam==1400 invoke MessageBox,hwnd,ADDR info,ADDR website,MB_OK or MB_ICONASTERISK .ENDIF .ELSE invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .ENDIF xor eax,eax ret WndProc ENDP start: invoke GetModuleHandle,NULL mov hInstance,eax mov wc.hInstance,eax mov wc.cbSize,SIZEOF WNDCLASSEX mov wc.style,CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNCLIENT mov wc.lpfnWndProc,OFFSET WndProc mov wc.hbrBackground,COLOR_WINDOW mov wc.lpszClassName,OFFSET ClassName mov wc.cbClsExtra,NULL mov wc.cbWndExtra,NULL mov wc.lpszMenuName,NULL invoke LoadIcon,hInstance,500 mov wc.hIcon,eax mov wc.hIconSm,eax invoke LoadCursor,NULL,IDC_ARROW mov wc.hCursor,eax invoke RegisterClassEx, ADDR wc invoke CreateWindowEx,WS_EX_OVERLAPPEDWINDOW,ADDR ClassName,ADDR AppName,\ WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\ CW_USEDEFAULT,wwidth,wheight,NULL,NULL,\ hInstance,NULL mov hwnd,eax invoke LoadMenu,hInstance,600 invoke SetMenu,hwnd,eax invoke ShowWindow,hwnd,SW_SHOWNORMAL invoke UpdateWindow,hwnd MsgLoop: invoke GetMessage,ADDR msg,0,0,0 test eax,eax jz EndLoop invoke TranslateMessage,ADDR msg invoke DispatchMessage,ADDR msg jmp MsgLoop EndLoop: invoke ExitProcess,msg.wParam end startPK ̀:D Swirl_2.exeMZ@ !L!This program cannot be run in DOS mode. $3]]]sN] ]Rich]PELQ_J  j @@p P p.text@ `.rdata  @@.data0@j5d1@'5h1@l1@x1@h$j5x1@p1@h$j5x1@t1@50@V50@K51@@51@5N0@0@0@0@ 0@0@ 0@t]F 0@F0@^0@F=p1@F%0@V@f8T8F @3;0@GF á0@0@5t1@=p1@5p1@=t1@0@@P%0@ZZo`o$:`o$;`qe0@g~fD1D1swjh)1@5p1@50@jjj50@50@jj5l1@QqU} uCj5l1@5h1@5p1@j5x1@ 5t1@j5x1@*} u30@ } uhd1@jjh@h j} u<3ҋEf0@0@-1@أ11@;G裥0@} }Lu0@ }u 0@n}u 0@Y}ujh`h5h1@7}xu.j@h0@h80@5h1@uuu uP3j`1@1@1@01@1@@1@1@0@1@1@1@h5`1@1@1@hj1@h1@j5`1@jj50@50@hhhh 0@h0@hoh1@hX5`1@P5h1@j5h1@5h1@jjjh|1@>th|1@rh|1@51@m%h @%\ @%` @%X @%T @%P @%L @%H @%D @%4 @%( @%, @%0 @%d @%8 @%< @%@ @% @% @% @% @% @% @% @% @"""n"Z"L"<""!!!!! " "!!!~!p!h!B!T!!0! 0"( " " """n"Z"L"<""!!!!! " "!!!~!p!h!B!T!!0!VCreateWindowExADefWindowProcADispatchMessageAGetDC"GetMessageALoadCursorALoadIconALoadMenuAMessageBoxAPostQuitMessageRegisterClassExAReleaseDCSendMessageASetMenuHShowWindow^TranslateMessagejUpdateWindowuser32.dllVCreateThreadExitProcess4GetModuleHandleAVGetProcessHeapHeapAllocHeapFreeSetThreadPrioritykernel32.dll>SetDIBitsToDevicegdi32.dllapocalypseblur'n'swirl... mmxhttp://www.ronybc.8k.comHit SPACE to pause. This isn't the Final Version visit www.ronybc.8k.com for updates  ;ߏ?76`> @?@H@(PK :>1  Swirl_2.asmPK ̀:D Swirl_2.exePKr+