64 bit assembler > Mikl__'s ml64 examples

Uncle Remus Tales

(1/30) > >>

Uncle Remus Tales
Consider this cycle a parody that Joel Chandler Harris wrote on the "Iczelion Lessons" rewritten under Win x64
Drawings from the movie "Song of the South" (1946) are kindly provided
Uncle Remus tales:#37i gif-animation
--- Code: ---; GUI #
include win64a.inc
include gdiplus.inc
includelib gdiplus.lib

PropertyTagFrameDelay  equ 5100h
cdXPos          equ 127
cdYPos          equ 127
cdXSize         equ 200
cdYSize         equ 100
cdVBarTipo      equ 0
cdMainIcon      equ 100
cdIdTimer       equ 1
WinMain proc
local msg:MSG
local ptDiff:POINT
local rctWnd:RECT
local rctClient:RECT
local nSize:qword
local pDimensionIDs:qword
local count:qword

;инициализация библиотеки GDIPLUS
mov ecx,offset gdiplusToken
mov edx,offset gsi
invoke GdiplusStartup,,,0

xor ebx,ebx
mov edi,offset ClassName
mov ecx,offset FileName
invoke LoadCursorFromFile

push rax ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT ;hbrBackground
push 10003h ;hCursor
push rax ;hIcon
push IMAGE_BASE ;hInstance
push rbx ;cbClsExtra & cbWndExtra
pushaddr WndProc  ;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX

        mov ecx,offset szfilename
mov edx,offset g_image
invoke GdipLoadImageFromFile
lea edx,count
mov [rdx],ebx;count=0
mov ecx,g_image
invoke GdipImageGetFrameDimensionsCount
mov ecx,dword ptr count
test ecx,ecx
jz @f
shl ecx,4
invoke GdipAlloc

mov dword ptr pDimensionIDs,eax
mov ecx,g_image
invoke GdipImageGetFrameDimensionsList,,eax,count
or eax,eax
jnz @f
mov r8d,offset nFrameCount
mov ecx,g_image
invoke GdipImageGetFrameCount,,pDimensionIDs
or eax,eax
jnz @f
lea r8d,nSize
mov ecx,g_image
invoke GdipGetPropertyItemSize,,PropertyTagFrameDelay
or eax,eax
jnz @f
mov ecx,dword ptr nSize
shl ecx,2
invoke GdipAlloc
mov pPropertyItem,eax
mov ecx,g_image
invoke GdipGetPropertyItem,,PropertyTagFrameDelay,nSize,eax
or eax,eax
jnz @f
mov ecx,dword ptr pDimensionIDs
        invoke GdipFree
mov edx,offset nWidth
mov ecx,g_image
call GdipGetImageWidth
mov edx,offset nHeight
mov ecx,g_image
call GdipGetImageHeight

push rbx
push rbx
  push rbx
push cdYSize ; nHeight
push cdXSize ; nWidth
push cdYPos ; Y
push cdXPos ; X
sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
        mov hMainWnd,eax
        lea edx,rctClient ;lpRect
invoke GetClientRect,eax
lea edx,rctWnd ;lpRect
mov ecx,hMainWnd
invoke GetWindowRect
mov eax,rctWnd.right
sub eax,rctWnd.left
sub eax,rctClient.right
mov ptDiff.x,eax
mov eax,rctWnd.bottom
sub eax,rctWnd.top
sub eax,rctClient.bottom
mov ptDiff.y,eax
mov qword ptr [rsp+28h],TRUE ; bRepaint
        mov ecx,nHeight
add ecx,ptDiff.y
mov [rsp+20h],rcx ;nHeight
mov eax,nWidth
add eax,ptDiff.x
mov ecx,hMainWnd
invoke MoveWindow,,cdXPos,cdYPos,rax
lea edi,msg
@@: invoke GetMessage,edi,NULL,0,0
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
invoke DispatchMessage,edi
jmp @b
WinMain endp
WndProc proc hWnd:qword,umsg:qword,wParam:qword,lParam:qword
local graphics:qword

mov hWnd,rcx
mov wParam,r8
mov lParam,r9

cmp edx,WM_DESTROY
cmp edx,WM_CREATE
cmp edx,WM_SIZE
je wmSIZE
cmp edx,WM_PAINT
je wmPAINT
cmp edx,WM_TIMER
je wmTIMER
        jmp DefWindowProc
wmDESTROY::invoke KillTimer,,cdIdTimer
cmp g_image,0
jz @f
mov ecx,g_image
invoke GdipDisposeImage
@@: cmp pPropertyItem,0
jz @f
mov ecx,pPropertyItem
invoke GdipFree
@@: invoke ExitProcess,NULL
wmPAINT:lea edx,ps
invoke BeginPaint
mov edx,offset nWidth
mov ecx,g_image
invoke GdipGetImageWidth
or eax,eax
jnz @f
mov edx,offset nHeight
mov ecx,g_image
invoke GdipGetImageHeight
or eax,eax
jnz @f
lea edx,graphics
invoke GdipCreateFromHDC,ps.hdc
mov eax,dword ptr vdyClient
mov [rsp+28h],rax
mov eax,dword ptr vdxClient
mov [rsp+20h],rax
mov edx,g_image
invoke GdipDrawImageRectI,graphics,,0,0
invoke GdipDeleteGraphics,graphics
mov r8d,nFramePosition
inc nFramePosition
mov edx,offset pageGuid
mov ecx,g_image
invoke GdipImageSelectActiveFrame
mov eax,nFramePosition
sub eax,nFrameCount
jnz @f
mov nFramePosition,eax
@@: lea edx,ps
invoke EndPaint,hWnd
jmp wmBYE
wmTIMER:invoke InvalidateRect,,0,0
jmp wmBYE
wmCREATE:invoke SetTimer,,cdIdTimer,100,0
jmp wmBYE
wmSIZE: mov rax,r9;lParam
mov vdxClient,ax
shr eax,10h
mov vdyClient,ax
jmp wmBYE
wmBYE: leave
WndProc endp
ClassName db "Uncle Remus tales:#37i gif animation",0
FileName db "br_Rabbit3.cur",0
gsi GdiplusStartupInput <1,0,0,0,0>
pageGuid GUID <6AEDBD6Dh,3FB5h,418Ah,<83h,0A6h,7Fh,45h,22h,9Dh,0C8h,72h>>
szfilename: du <movie.gif>
gdiplusToken dd ?
nWidth dd ?
nHeight dd ?
vdxClient dw 0,0
vdyClient dw 0,0
nFrameCount dd ?
nFramePosition dd 0
pPropertyItem dd ?
g_image dd ?
hMainWnd dd ?
--- End code ---

rename files movie.01.zip, movie.02.zip, movie.03.zip, movie.04.zip to movie.zip.001, movie.zip.002, movie.zip.003, movie.zip.004 and unzip they
to be continued

to be continued




[0] Message Index

[#] Next page

Go to full version