News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Fractals

Started by Mikl__, December 02, 2015, 08:27:27 PM

Previous topic - Next topic

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
;  a     b   c    d     e    f   p
; 0.5   0.5  0    0     0   0.5 0.08*10000=800
; 0.5   0.5  0    0     0  -0.5 0.08*10000=800
; 0     0    0.5  0.5   0.5 0   0.08*10000=800
; 0     0    0.5  0.5  -0.5 0   0.08*10000=800
; 0.85 -0.15 0.15 0.85  0   0   0.68*10000=6800

mov XCC,rbx
mov YCC,rbx
mov i,390000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,800
jg @f
movr a,0.5   
movr b,0.5 
mov c,ebx
mov d,ebx
mov e,ebx
movr f,0.5
jmp fin
@@: cmp edx,1600
jg @f
movr a,0.5   
movr b,0.5 
mov c,ebx
mov d,ebx
mov e,ebx
movr f,-0.5
jmp fin
@@: cmp edx,2400
jg @f
mov a,ebx   
mov b,ebx 
movr c,0.5
movr d,0.5
movr e,0.5
mov f,ebx
jmp fin
@@: cmp edx,3200
jg @f
mov a,ebx   
mov b,ebx 
movr c,0.5
movr d,0.5
movr e,-0.5
mov f,ebx
jmp fin
@@: movr a,0.85
movr b,-0.15
movr c,0.15
movr d,0.85 
mov e,ebx
mov f,ebx

fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fimul Scale;st(0) = NewX * 360
        fiadd ShiftX ;st(0) = NewX * 360 + 320
fistp x       ;x = (int) (NewX * 360 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fimul Scale;st(0) = NewY * 300
fisubr ShiftY;st(0)  = -NewY * 360 + 185
fistp y       ; y = (int) (-NewY * 360 + 185)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],0FFFFFFh ;*(pMainDIB + y*cdXSize*4 + x*4) = white color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Stairway Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 360
ShiftX dd 320
ShiftY dd 185
end

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
;    a         b         c        d         e        f       p
; 0.424242 -0.651515 -0.484848 -0.344697  3.442830 2.889184 0.622449*10000=6225
; 0.030303 -0.439394 -0.636364 -0.022727 -1.425239 6.437284 0.377551*10000=3775

mov XCC,rbx
mov YCC,rbx
mov rdi,pMainDIB
mov ecx,cdYSize*cdXSize
mov eax,0FFFFFFh
rep stosd

mov i,45000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,6225
jg @f
movr a,0.424242
movr b,-0.651515
movr c,-0.484848
movr d,-0.344697 
movr e,3.442830
movr f,2.889184
jmp fin
@@: movr a,0.030303
movr b,-0.439394
movr c,-0.636364
movr d,-0.022727
movr e,-1.425239
movr f,6.437284

fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul Scale ;st(0) = NewX * 40
        fadd ShiftX ;st(0) = NewX * 40 + 320
fistp x       ;x = (int) (NewX * 40 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fmul Scale;st(0) = NewY * 300
fsubr ShiftY;st(0)  = -NewY * 40 + 400
fistp y       ; y = (int) (-NewY * 40 + 400)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],ebx ;*(pMainDIB + y*cdXSize*4 + x*4) = black color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Twigs Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 40.0
ShiftX dd 320.0
ShiftY dd 400.0
end

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
;a     b     c    d    e f   p
;0     0     0    0.50 0 0   0.05         500
;0.42 -0.42  0.42 0.42 0 0.2 0.4         4000
;0.42  0.42 -0.42 0.42 0 0.2 0.4         4000
;0.1   0     0    0.1  0 0.2 0.15*10000= 1500

mov XCC,rbx
mov YCC,rbx

mov i,150000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,500
jg @f
mov a,ebx
mov b,ebx 
mov c,ebx; c = 0
movr d,0.5
mov f,ebx
jmp fin
@@: cmp edx,4500
jg @f
movr a,0.42
movr b,-0.42 
movr c,0.42
movr d,0.42 
movr f,0.2     
jmp fin
@@: cmp edx,8500
jg @f
movr a,0.42 
movr b,0.42
movr c,-0.42
movr d,0.42
movr f,0.2
jmp fin
@@: movr a,0.1   
mov b,ebx
mov c,ebx     
movr d,0.1 
movr f,0.2

fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
fst NewX    ;NewX  = a * XCC + b * YCC
fmul Scale ;st(0) = NewX * 900
        fadd ShiftX ;st(0) = NewX * 900 + 320
fistp x       ;x = (int) (NewX * 900 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fmul Scale;st(0) = NewY * 900
fsubr ShiftY;st(0)  = -NewY * 900 + 405
fistp y       ; y = (int) (-NewY * 900 + 405)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],0FF00h ;*(pMainDIB + y*cdXSize*4 + x*4) = black color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Tree #1 Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 900.0
ShiftX dd 320.0
ShiftY dd 405.0
end

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
; a      b      c      d     e      f      p
; 0.195 -0.488  0.344  0.443 0.4431 0.2452 0.25*10000=2500
; 0.462  0.414 -0.252  0.361 0.2511 0.5692 0.25*10000=2500;5000
;-0.058 -0.07   0.423 -0.111 0.5976 0.0969 0.15*10000=1500;6500
;-0.035  0.07  -0.469  0.022 0.4884 0.5069 0.15*10000=1500;8000
;-0.637  0      0      0.501 0.8562 0.2513 0.2 *10000=2000

mov XCC,rbx
mov YCC,rbx

mov i,150000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,2500
jg @f
movr a,0.195
movr b,-0.488 
movr c,0.344 
movr d,0.443
movr e,0.4431
movr f,0.2452
mov edx,0FF00h
jmp fin
@@: cmp edx,5000
jg @f
movr a,0.462 
movr b,0.414
movr c,-0.252 
movr d,0.361
movr e,0.2511
movr f,0.5692
mov edx,0C900h
jmp fin
@@: cmp edx,6500
jg @f
movr a,-0.058
movr b,-0.07   
movr c,0.423
movr d,-0.111
movr e,0.5976
movr f,0.0969
mov edx,804000h
jmp fin
@@: cmp edx,8000
jg @f
movr a,-0.035 
movr b,0.07 
movr c,-0.469 
movr d,0.022
movr e,0.4884
movr f,0.5069
mov edx,804000h
jmp fin
@@: movr a,-0.637       
mov b,ebx
mov c,ebx     
movr d,0.501
movr e,0.8562
movr f,0.2513
mov edx,0A600h
fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul Scale ;st(0) = NewX * 450
        fadd ShiftX ;st(0) = NewX * 450 + 100
fistp x       ;x = (int) (NewX * 450 + 100)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fmul Scale;st(0) = NewY * 300
fsubr ShiftY;st(0)  = -NewY * 450 + 405
fistp y       ; y = (int) (-NewY * 450 + 405)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],edx ;*(pMainDIB + y*cdXSize*4 + x*4) = black color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Tree #2 Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 450.0
ShiftX dd 100.0
ShiftY dd 405.0
end

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
; a        b        c        d        e       f       p
; 0.28421 -0.35644  0.32632  0.44555  0.00625 0.56275 0.166*10000=1660
; 0.37895  0.38614 -0.27368  0.34653 -0.08171 0.54063 0.166*10000=1660;3320
; 0.41053  0        0        0.55446 -0.02832 0.53347 0.166*10000=1660;4980
;-0.62105  0        0        0.43564 -0.09537 0.35772 0.166*10000=1660;6640
;-0.03158 -0.07921  0.55790 -0.08911 -0.00755 0.51196 0.166*10000=1660;8300
;-0.08421  0.08911 -0.55790 -0.05941 -0.17617 0.40587 0.166*10000=1660

mov XCC,rbx
mov YCC,rbx

mov i,150000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,1660
jg @f
movr a,0.28421
movr b,-0.35644 
movr c,0.32632 
movr d,0.44555 
movr e,0.00625
movr f,0.56275
mov edx,0C900h
jmp fin
@@: cmp edx,3320
jg @f
movr a,0.37895 
movr b,0.38614
movr c,-0.27368 
movr d,0.34653
movr e,-0.08171
movr f,0.54063
mov edx,0FF00h
jmp fin
@@: cmp edx,4980
jg @f
movr a,0.41053                 
mov b,ebx   
mov c,ebx
movr d,0.55446
movr e,-0.02832
movr f,0.53347
mov edx,80FF80h
jmp fin
@@: cmp edx,6640
jg @f
movr a,-0.62105                 
mov b,ebx
mov c,ebx
movr d,0.43564
movr e,-0.09537
movr f,0.35772
mov edx,0A7FF00h
jmp fin
@@: cmp edx,8300
jg @f
movr a,-0.03158
movr b,-0.07921 
movr c,0.55790
movr d,-0.08911
movr e,-0.00755
movr f,0.51196
mov edx,808000h
jmp fin
@@: movr a,-0.08421 
movr b,0.08911
movr c,-0.55790
movr d,-0.05941
movr e,-0.17617
movr f,0.40587
mov edx,804000h
fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul Scale ;st(0) = NewX * 340
        fadd ShiftX ;st(0) = NewX * 340 + 320
fistp x       ;x = (int) (NewX * 340 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fmul Scale;st(0) = NewY * 340
fsubr ShiftY;st(0)  = -NewY * 340 + 405
fistp y       ; y = (int) (-NewY * 340 + 405)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],edx ;*(pMainDIB + y*cdXSize*4 + x*4) = black color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Tree #3 Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 340.0
ShiftX dd 320.0
ShiftY dd 405.0
end

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
; a     b     c     d     e     f    p
; 0.05  0     0     0.4  -0.06 -0.47 0.0260*10000= 260
;-0.05  0     0    -0.4  -0.06 -0.47 0.0264*10000= 264; 524
; 0.03 -0.14  0     0.26 -0.16 -0.01 0.0103*10000= 103; 627
;-0.03  0.14  0    -0.26 -0.16 -0.01 0.0103*10000= 103; 730
; 0.56  0.44 -0.37  0.51  0.3   0.15 0.5919*10000=5919;6649
; 0.19  0.07 -0.01  0.15 -0.2   0.28 0.0385*10000= 385;7034
;-0.33 -0.34 -0.33  0.34 -0.54  0.39 0.2962*10000=2962

mov XCC,rbx
mov YCC,rbx

mov i,150000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,260
jg @f
movr a,0.05           
mov b,ebx 
mov c,ebx
movr d,0.4 
movr e,-0.06
movr f,-0.47
mov edx,0FF8000h
jmp fin
@@: cmp edx,524
jg @f
movr a,-0.05           
mov b,ebx
mov c,ebx
movr d,-0.4 
movr e,-0.06
movr f,-0.47
mov edx,804000h
jmp fin
@@: cmp edx,627
jg @f
movr a,0.03
movr b,-0.14       
mov c,ebx
movr d,0.26
movr e,-0.16
movr f,-0.01
mov edx,0FF00h
jmp fin
@@: cmp edx,730
jg @f
movr a,-0.03 
movr b,0.14     
mov c,ebx
movr d,-0.26
movr e,-0.16
movr f,-0.01
mov edx,0FF8000h
jmp fin
@@: cmp edx,6649
jg @f
movr a,0.56 
movr b,0.44
movr c,-0.37 
movr d,0.51 
movr e,0.3   
movr f,0.15
mov edx,0A7FF00h
jmp fin
@@: cmp edx,7034
jg @f
movr a,0.19 
movr b,0.07
movr c,-0.01 
movr d,0.15
movr e,-0.2   
movr f,0.28
mov edx,0FF0000h
jmp fin
@@: movr a,-0.33
movr b,-0.34
movr c,-0.33 
movr d,0.34
movr e,-0.54 
movr f,0.39
mov edx,0A600h
fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul Scale ;st(0) = NewX * 226
        fadd ShiftX ;st(0) = NewX * 226 + 320
fistp x       ;x = (int) (NewX * 340 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fmul Scale;st(0) = NewY * 226
fsubr ShiftY;st(0)  = -NewY * 226 + 205
fistp y       ; y = (int) (-NewY * 226 + 205)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],edx ;*(pMainDIB + y*cdXSize*4 + x*4) = black color
@@: fld NewX  ;XCC = NewX
fstp XCC
        fld NewY  ;YCC = NewY
fstp YCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Tree #4 Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 226.0
ShiftX dd 320.0
ShiftY dd 205.0
end

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
;0.935567 -0.164966 0.164966 0.935567  0     0    0.958*10000=9580
;0.1       0        0        0.1       0.75 -0.75 0.011*10000= 110
;0.1       0        0        0.1      -0.75  0.75 0.011*10000= 110
;0.1       0        0        0.1       0.75  0.75 0.011*10000= 110
;0.1       0        0        0.1      -0.75 -0.75 0.009*10000=  90

mov XCC,rbx
mov YCC,rbx

mov i,390000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,90
jg @f
movr a,0.1                       
mov b,ebx 
mov c,ebx
movr d,0.1     
movr e,-0.75
movr f,-0.75
jmp fin
@@: cmp edx,200
jg @f
movr a,0.1                       
mov b,ebx 
mov c,ebx
movr d,0.1       
movr e,0.75 
movr f,0.75
jmp fin
@@: cmp edx,310
jg @f
movr a,0.1                       
mov b,ebx 
mov c,ebx
movr d,0.1     
movr e,-0.75 
movr f,0.75
jmp fin
@@: cmp edx,420
jg @f
movr a,0.1                       
mov b,ebx 
mov c,ebx
movr d,0.1       
movr e,0.75
movr f,-0.75
jmp fin
@@: movr a,0.935567
movr b,-0.164966
movr c,0.164966
movr d,0.935567       
mov e,ebx
mov f,ebx

fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul Scale ;st(0) = NewX * 190
        fadd ShiftX ;st(0) = NewX * 190 + 320
fistp x       ;x = (int) (NewX * 190 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fmul Scale;st(0) = NewY * 190
fsubr ShiftY;st(0)  = -NewY * 190 + 185
fistp y       ; y = (int) (-NewY * 190 + 185)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],0FFFFFFh; white color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Spiral Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 190.0
ShiftX dd 320.0
ShiftY dd 185.0
end

avcaballero

How many fractals  :P. My swirls look like this

Magnum

I have some 16 bit code for fractals.

Could you post some 32 bit fractal code ?

Linux folks said it could not be done. :-)

Just kidding.

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

Mikl__

Quote from: MagnumI have some 16 bit code for fractals.
Hi, Magnum!
let's show the text of the 16-bit programs, I think that it will not be very difficult to translate into a 32/64-bit programs

Magnum

Quote from: Mikl__ on December 10, 2015, 04:59:37 PM
Quote from: MagnumI have some 16 bit code for fractals.
Hi, Magnum!
let's show the text of the 16-bit programs, I think that it will not be very difficult to translate into a 32/64-bit programs

Thanks Mikl.

I am a little old at 60 years old.

;*****************************************************************************
;*
;*  ASMANDEL by (c) Taslehof / Null Pointer Assignment 1995   v1.0
;*
;*   This code is freeware. Only one thing: if you use it please remember me.
;*   ASMANDEL is the Mandelbrot's fractal in assembler, I use the iterated
;*   mode,the default number is 150 iterations
;*   The metod I used: we have the left upper corner point, and the size of
;*   the side. This is the zone will be zoom up to the screen's resolution.

.MODEL TINY
.DATA

;Datos    LABEL    BYTE

         MandelX  DD   -2.50           ;left y point of mandel
         Mandely  DD   -1.50           ;left x point of mandel
         Resx     =     320            ;resolution X
         Resy     =     200            ;resolution y
         Lado     DW    5              ;size of
         Iteration DW   200            ;number of iterations
         A        DD    0.0            ;general var
         B        DD    0.0
         X        DD    0.0
         Y        DD    0.0
         Xaux     DD    0.0
         Yaux     DD    0.0
         VGA      =     0A000h         ;my VGA and you
         ESCALA   DD    0.015625       ;scale= lado /resx
         KK       DD    ?              ;kk???
         Color    DB    ?
         Estado   DW    ?
         DOS      DD    2
         Caracter DB    0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0
         TEXTO    DB    ' (c) TASLEHOF / Null Pointer Assignment 1995',10,13
                  DB    '        Saludos a la gente de la U.G.R Informatica',10,13
                  DB    '        If you have some request or some comment my email address:',10,13
                  DB    '                       jagarcia@verne.ugr.es                    ',10,13
                  DB    '$'

;-----------------------------------------------------------------------------
;Fichero creado  en MK_PAN .
;(c) Taslehof.
Paleta LABEL BYTE
   DB 0,0,0, 0,0,6, 0,0,6, 0,0,7, 0,0,8, 0,0,8, 0,0,9, 0,0,10, 2,0,10
   DB 4,0,9, 6,0,9, 8,0,8, 10,0,7, 12,0,7, 14,0,6, 16,0,5, 18,0,5
   DB 20,0,4, 22,0,4, 24,0,3, 26,0,2, 28,0,2, 30,0,1, 32,0,0, 32,0,0
   DB 33,0,0, 34,0,0, 35,0,0, 36,0,0, 36,0,0, 37,0,0, 38,0,0, 39,0,0
   DB 40,0,0, 40,0,0, 41,0,0, 42,0,0, 43,0,0, 44,0,0, 45,0,0, 46,1,0
   DB 47,1,0, 48,2,0, 49,2,0, 50,3,0, 51,3,0, 52,4,0, 53,4,0, 54,5,0
   DB 55,5,0, 56,6,0, 57,6,0, 58,7,0, 59,7,0, 60,8,0, 61,8,0, 63,9,0
   DB 63,9,0, 63,10,0, 63,10,0, 63,11,0, 63,11,0, 63,12,0, 63,12,0, 63,13,0
   DB 63,13,0, 63,14,0, 63,14,0, 63,15,0, 63,15,0, 63,16,0, 63,16,0, 63,17,0
   DB 63,17,0, 63,18,0, 63,18,0, 63,19,0, 63,19,0, 63,20,0, 63,20,0, 63,21,0
   DB 63,21,0, 63,22,0, 63,22,0, 63,23,0, 63,24,0, 63,24,0, 63,25,0, 63,25,0
   DB 63,26,0, 63,26,0, 63,27,0, 63,27,0, 63,28,0, 63,28,0, 63,29,0, 63,29,0
   DB 63,30,0, 63,30,0, 63,31,0, 63,31,0, 63,32,0, 63,32,0, 63,33,0, 63,33,0
   DB 63,34,0, 63,34,0, 63,35,0, 63,35,0, 63,36,0, 63,36,0, 63,37,0, 63,38,0
   DB 63,38,0, 63,39,0, 63,39,0, 63,40,0, 63,40,0, 63,41,0, 63,41,0, 63,42,0
   DB 63,42,0, 63,43,0, 63,43,0, 63,44,0, 63,44,0, 63,45,0, 63,45,0, 63,46,0
   DB 63,46,0, 63,47,0, 63,47,0, 63,48,0, 63,48,0, 63,49,0, 63,49,0, 63,50,0
   DB 63,50,0, 63,51,0, 63,52,0, 63,52,0, 63,52,0, 63,52,0, 63,52,0, 63,53,0
   DB 63,53,0, 63,53,0, 63,53,0, 63,54,0, 63,54,0, 63,54,0, 63,54,0, 63,54,0
   DB 63,55,0, 63,55,0, 63,55,0, 63,55,0, 63,56,0, 63,56,0, 63,56,0, 63,56,0
   DB 63,57,0, 63,57,0, 63,57,0, 63,57,0, 63,57,0, 63,58,0, 63,58,0, 63,58,0
   DB 63,58,0, 63,59,0, 63,59,0, 63,59,0, 63,59,0, 63,60,0, 63,60,0, 63,60,0
   DB 63,60,0, 63,60,0, 63,61,0, 63,61,0, 63,61,0, 63,61,0, 63,62,0, 63,62,0
   DB 63,62,0, 63,62,0, 63,63,0, 63,63,1, 63,63,2, 63,63,3, 63,63,4, 63,63,5
   DB 63,63,6, 63,63,7, 63,63,8, 63,63,9, 63,63,10, 63,63,10, 63,63,11, 63,63,12
   DB 63,63,13, 63,63,14, 63,63,15, 63,63,16, 63,63,17, 63,63,18, 63,63,19, 63,63,20
   DB 63,63,21, 63,63,21, 63,63,22, 63,63,23, 63,63,24, 63,63,25, 63,63,26, 63,63,27
   DB 63,63,28, 63,63,29, 63,63,30, 63,63,31, 63,63,31, 63,63,32, 63,63,33, 63,63,34
   DB 63,63,35, 63,63,36, 63,63,37, 63,63,38, 63,63,39, 63,63,40, 63,63,41, 63,63,42
   DB 63,63,42, 63,63,43, 63,63,44, 63,63,45, 63,63,46, 63,63,47, 63,63,48, 63,63,49
   DB 63,63,50, 63,63,51, 63,63,52, 63,63,52, 63,63,53, 63,63,54, 63,63,55, 63,63,56
   DB 63,63,57, 63,63,58, 63,63,59, 63,63,60, 63,63,61, 63,63,62, 0,0,0

.CODE
ORG 100H

Main:
         MOV     AX,VGA                ;es = vga
         MOV     ES,AX                 ;lets go to 13h
         MOV     AX,13h
         INT     10h
         CALL    PAL

         MOV     CX,319                ;For x=0 to 320 do begin
Loopx:   MOV     SI,CX                 ;si=cx to acces it easier.
         MOV     WORD PTR KK,CX
         MOV     WORD PTR KK+2,0
         FINIT                         ;
         FILD    KK                    ;A=x*escala+mandelx, this is necesari for calculate
         FMUL    Escala                ;the color of point (si,di)
         FADD    Mandelx               ;
         FSTP    A                     ;is necesari for whatcolor
                                       ;the parameters is pases by memori

         PUSH    CX                    ;
                                       ;loop whith the y
         MOV     CX,199
Loopy:   MOV     DI,CX                 ;
         MOV     WORD PTR KK,CX        ;B=y*escala+mandely
         MOV     WORD PTR KK+2,0
         FINIT
         FILD    KK
         FMUL    Escala
         FADD    MandelY
         FSTP    B                     ;

         CALL    WHATCOLOR             ;this calculate the color whith A ,B
         WAIT

         MOV     AX,DI                 ;Draw the color  the pos (si,di):=color
         MOV     BX,AX
         SHL     AX,8
         SHL     BX,6
         ADD     BX,AX
         ADD     BX,SI
         MOV     Al,BYTE PTR Color
         MOV     ES:[BX],Al            ;

         LOOP    Loopy
         POP     CX
         LOOP    Loopx                 ;end of a line

ReadK:  MOV     AH,1
         INT     16h
         JZ      ReadK
         MOV     AX,03h                ;go to test mode
         INT     10h
         CALL    THEEND
         MOV     AX,4C00h
         INT     21h

WHATCOLOR        PROC
                  PUSH    CX           ;keep register in use
                  PUSH    DI
                  PUSH    SI
                  FINIT
                  FLD     X            ;PUSH ,ST=X
                  FSUB    X            ;ST=X-X
                  FSTP    X            ;X=X-X=0 , POP
                  FLD     Y            ;PUSH , ST=Y
                  FSUB    Y            ;ST = ST-Y
                  FSTP    Y            ;Y=ST=0  , POP
                  MOV     CX,iteration ;iterations

                                       ;keep the registers
          @bucle: PUSH    ES
                  PUSH    CX
                  MOV     AX,DS        ;ES=DS
                  MOV     ES,AX
                                       ;lets to copy xaux=x
                  MOV     CX,4
                  MOV     SI,OFFSET X
                  MOV     DI,OFFSET Xaux
                  REP     MOVSB
                                       ;same yaux=y
                  MOV     CX,4
                  MOV     SI,OFFSET Y
                  MOV     DI,OFFSET Yaux
                  REP     MOVSB

                  POP     CX           ;well
                  POP     ES           ;

                  FINIT
                  FLD     Xaux         ;st = xaux
                  FMUL    Xaux         ;st = st* Xaux
                  FLD     Yaux         ;push st ,st(1)=xaux^2 , st=yaux
                  FMUL    Yaux         ;st = yaux^2
                  FSUBR   ST,ST(1)     ;st = st-st(1) +- st =xaux^2-yaux^2
                  FADD    A            ;st = st+ a
                  FSTP    X            ;X  = xaux^2 + yaux^2 + a ,pop
                  FFREE   ST(0)        ;set st=0

                  FLD     Xaux         ;st = xaux
                  FMUL    Yaux         ;st = xaux * yaux
                  FIMUL   DOS          ;st = xaux * yaux *2
                  FADD    B            ;st = xaux * yaux *2 +b
                  FSTP    Y            ;y  = st

                  FLD     X            ;st = x
                  FMUL    X            ;st = st* x
                  FSTP    KK           ;KK = x^2
                  FLD     Y            ;st = y ,st(1)= x^2
                  FMUL    Y            ;st = st * y = y^2
                  FADD    kk           ;st = x^2+y^2
                  FSQRT                ;st = st^1/2

                  FICOM   DOS          ;st = st-2
                  FSTSW   ESTADO       ;estado = word of state of the copro
                  FWAIT                ; no comment
                  MOV     AH,BYTE PTR ESTADO+1
                  SAHF                 ;set flag

                  JA      @FIN         ;

                  DEC     CX
                  CMP     CX,0
                  JE      @FIN         ;this jump is so far
                  JMP     @BUCLE       ;lets use JMP
            @FIN:
                  CMP     CX,0         ;and calc the color with the number of iterations
                  JNE     NOFINITO
                  MOV     BYTE PTR COLOR,254
                  JMP     EXIT
        NOFINITO:
                  ADD     CX,40
                  MOV     BYTE PTR COLOR,CL    ;!!!!! CH !!!!!!! ja

        EXIT:     POP     SI
                  POP     DI
                  POP     CX
                  RET

                ENDP

PAL       PROC
           mov  cx,255
           mov  bx,offset paleta
      @@1: mov  dx,3C8h
           mov  al,cl
           out  dx,al
           inc  dx
           mov  al,[bx]
           out  dx,al
           mov  al,[bx+1]
           out  dx,al
           mov  al,[bx+2]
           out  dx,al
           add  bx,3
           loop @@1
           ret
          endp

THEEND     PROC
            MOV     AX,CS
            MOV     ES,AX
            MOV     BP,OFFSET (caracter)    ;lets change the 219 for my flag char
            MOV     AX,1100h
            MOV     BH,16
            MOV     BL,0
            MOV     CX,1
            MOV     DX,219
            INT     10h
            MOV     AH,09h                  ;Write 3 char #219
            MOV     AL,219
            MOV     BH,0
            MOV     BL,78
            MOV     CX,3
            INT     10h
                                            ;¨what is the cursor position?
            MOV     AH,03h
            MOV     BX,0                    ;RETURN DH=column ,DL=row
            INT     10h

            ADD     DL,3                    ;
            MOV     AH,02h
            MOV     BH,0                    ; set the cursor in 3 pos right
            INT     10h

            MOV     DX,OFFSET Texto         ; set credits
            MOV     AH,9
            INT     21h
            RET
           ENDP

         END     Main


Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

avcaballero

This is basically the same as the program that Mikl__ has kindly ripped it out for you here

Do you have any other new interesting fractal example?  :bgrin:

By the way, the code is from a guy from UGR (University of Granada, Spain, where original Sierra Nevada is :P), saludos por ahí. Some years ago I read a tuto from "legión", also from UGR, and he talked about an interesting subject: core wars  (Saludos, legión  ;)). It consists in a tournament on making a program that prevaleced over any other. Just came to my mind this subject when reading UGR.

Mikl__

include win64a.inc
include msvcrt.inc
includelib gdi32.lib
includelib msvcrt.lib
IMAGE_BASE equ 400000h
cdXPos          equ 131
cdYPos          equ 217
cdYSize         equ 430
cdXSize         equ 640

movr macro x,y
mov x,0
org $-4
dd y
endm

.code


WndProc proc hWnd:QWORD,Msg:QWORD,wParam:QWORD,lParam:QWORD

local ps:PAINTSTRUCT
local hdc:qword
local hOldBmp:qword
local hGDITmp:qword
local hOldDIB:qword
local hBackDC:qword
local hMainDIB:qword
local bufBMP:qword
local i:dword
local x:dword
local y:dword
local a:dword
local b:dword
local c:dword
local d:dword
local e:dword
local f:dword
local NewX:qword
local NewY:qword
local XCC:qword
local YCC:qword

push rbp
mov ebp, esp
sub esp,(50h+sizeof PAINTSTRUCT+11*8+9*4+15)and(-16)

mov hWnd,rcx
cmp edx, WM_DESTROY
jz wmDESTROY
        cmp edx, WM_PAINT
jz wmPAINT
        cmp edx, WM_CREATE
jz wmCREATE
leave
        jmp DefWindowProc
; ---------------------------------------------------------------------------
wmDESTROY::mov rdx,hOldBmp
mov rcx,hBackDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufBMP
call DeleteObject
mov rcx,hBackDC
call DeleteDC
mov rdx,hOldDIB
mov rcx,bufDIBDC
call SelectObject
mov hGDITmp,rax
mov rcx,bufDIBDC
call DeleteDC
mov rcx,hMainDIB
call DeleteObject
mov rcx,hWnd
call DestroyWindow
xor ecx,ecx ; nExitCode
call ExitProcess
; ---------------------------------------------------------------------------
wmPAINT:lea edx,ps
call BeginPaint
mov hdc,rax
mov qword ptr [rsp+40h],SRCCOPY; rop
        xor edx,edx ; x
mov [rsp+38h],rdx ; y1
mov [rsp+30h],rdx ; x1
mov rax,bufDIBDC ; hdcSrc
        mov [rsp+28h],rax
mov rax,cdYSize
mov [rsp+20h],rax
mov r9,cdXSize ; cx
xor r8d,r8d ; cy
mov rcx,hdc ; hdc
call BitBlt
lea edx,ps
mov rcx,hWnd
call EndPaint
jmp wmBYE
; ---------------------------------------------------------------------------
wmCREATE:mov rcx,hWnd
call GetDC
mov hdc,rax
        mov rcx,rax ; HDC
call CreateCompatibleDC
mov bufDIBDC,rax

mov [rsp+28h],rbx
mov [rsp+20h],rbx
mov r9d,offset pMainDIB
mov r8d,DIB_RGB_COLORS
mov edx,offset bi
mov rcx,hdc
        call CreateDIBSection
mov hMainDIB,rax
mov rdx,rax; hMainDIB
mov rcx,bufDIBDC
call SelectObject
        mov rax,hOldDIB
mov rdx,hdc
mov rcx,hWnd         
        call ReleaseDC;   // Libera device context         
;Init--------------------------------------------------------
;  a     b     c     d     e     f    p
;-0.04  0.0   0.23 -0.65 -0.08  0.26 0.25*10000=2500
; 0.61  0.0   0.0   0.31  0.07  2.5  0.25*10000=2500; 5000
; 0.65  0.29 -0.3   0.48  0.54  0.39 0.25*10000=2500; 7500
; 0.64 -0.3   0.16  0.56 -0.56  0.40 0.25*10000=2500;10000
mov XCC,rbx
mov YCC,rbx
mov i,45000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,2500
jg @f
movr a,-0.04     
mov b,ebx
movr c,0.23
movr d,-0.65
movr e,-0.08 
movr f,0.26
jmp fin
@@: cmp edx,5000
jg @f
movr a,0.61 
mov b,ebx
mov c,ebx
movr d,0.31 
movr e,0.07 
movr f,2.5
jmp fin
@@: cmp edx,7500
ja @f
movr a,0.65 
movr b,0.29
movr c,-0.3   
movr d,0.48 
movr e,0.54 
movr f,0.39
jmp fin
@@: movr a,0.64
movr b,-0.3   
movr c,0.16 
movr d,0.56
movr e,-0.56 
movr f,0.40

fin: fld a       ;st(0) = a
fmul XCC     ;st(0) = a * XCC
fld b       ;st(0) = b
fmul YCC     ;st(0) = b * YCC
faddp         ;st(0) = a * XCC + b * YCC
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul Scale;st(0) = NewX * 57
        fadd ShiftX ;st(0) = NewX * 470 + 320
fistp x       ;x = (int) (NewX * 470 + 320)
        mov eax,x
cmp eax,cdXSize
jae @f
fld c       ;st(0) = c
fmul XCC     ;st(0) = c * XCC
fld d       ;st(0) = d
fmul YCC     ;st(0) = d * YCC
faddp         ;st(0) = c * XCC + d * YCC
fadd f       ;st(0) = c * XCC + d * YCC + f
fst NewY    ;NewY  = c * XCC + d * YCC + f
fst YCC     ;YCC = NewY
fmul Scale;st(0) = NewY * 57
fsubr ShiftY;st(0)  = -NewY * 57 + 220
fistp y       ; y = (int) (-NewY * 57 + 220)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],0FFFFFFh ;*(pMainDIB + y*cdXSize*4 + x*4) = white color
@@: fld NewX  ;XCC = NewX
fstp XCC
dec i
jnz  bucle
wmBYE: leave
retn
WndProc endp

WinMain proc
local msg:MSG

push rbp
mov ebp,esp
sub esp,sizeof MSG

xor ebx,ebx
mov esi,IMAGE_BASE
mov edi,offset ClassName
push rbx ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT; hbrBackground
push rbx ;hCursor
push rbx        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
db 68h
dd WndProc      ;lpfnWndProc
push sizeof WNDCLASSEX ;cbSize & style
mov ecx,esp ;addr WNDCLASSEX
call RegisterClassEx
push rbx
push rsi ;rsi=400000h
push rbx
push rbx
push cdYSize
push cdXSize
push cdYPos
push cdXPos
mov r9d,WS_VISIBLE
mov r8,rdi ;offset ClassName
mov edx,edi ;offset ClassName
xor ecx,ecx
sub esp,20h ; dwExStyle
call CreateWindowEx
@@:     lea ecx,msg
xor edx,edx
xor r8d,r8d
xor r9d,r9d
call GetMessage
cmp msg.wParam,VK_ESCAPE;user press 'Esc'?
je wmDESTROY
lea ecx,msg
call DispatchMessage
jmp @b
WinMain endp

.data
ClassName db 'Tree #6 Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 57.0
ShiftX dd 320.0
ShiftY dd 220.0
end

avcaballero

How can I attach an image in a zip file to achieve a preview of it?

Mikl__

¡Hola, Alfonso!
Tu debe cambiar el nombre del file por ejemplo image.bmp o image.gif en image.zip