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__

asm-fileinclude 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 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.1000  0.0000  0.0000  0.1600 0.0 0.0 0.01*10000= 100
; 0.8500  0.0000  0.0000  0.8500 0.0 1.6 0.85*10000=8500
;-0.1667 -0.2887  0.2887 -0.1667 0.0 1.6 0.07*10000= 700
;-0.1667  0.2887 -0.2887 -0.1667 0.0 1.6 0.07*10000= 700
mov XCC,rbx
mov YCC,rbx
mov i,60000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx, 100  ;p1
ja @f
movr a,0.1;a = 0.1
mov b,ebx; b = 0
        mov c,ebx; c = 0
movr d,0.16
mov f,ebx; f = 0
jmp fin
@@: cmp edx, 800  ;p1+p4=100+700=800
ja @f
movr a,-0.1667 
movr b, 0.2887
movr c,-0.2887
movr d,-0.1667
movr f, 1.6
jmp fin
@@: cmp edx,1500  ;p1+p4+p3=800+700=1500
ja @f
movr a,-0.1667
movr b,-0.2887 
movr c,0.2887
movr d,-0.1667
movr f,1.6
jmp fin
@@: movr a,0.8500 
mov b,ebx
mov c,ebx
movr d, 0.85
movr f, 1.60 ; f = 1.60
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 const40 ;st(0) = NewX * 40
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
fstp YCC     ;YCC = NewY
fadd const320;st(0) = NewX * 40 + cdXSize/2
fistp x       ;x = (int) (NewX*40+cdXSize/2)
mov ecx, x
cmp ecx,cdXSize
jae @f
fld1         ;st(0) = 1
fsub NewY    ;st(0) = 1 - NewY
fmul const40 ;st(0) = (1 - NewY)*40
fadd const365;st(0) = (1 - NewY)*40 + cdYSize - 35
fistp y       ; y = (int) ((1-NewY)*40+cdYSize-35)
cmp y,cdYSize
jae @f
imul eax,y,2560
add rax,pMainDIB
mov dword ptr [rax+rcx*4],0FF00h ;*(pMainDIB + (y<<9)+(y<<7)+x) = 0xFF00;
@@: 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 'Fir Tree Fractal',0
bi BITMAPINFO <<28h,640,-430,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const40 dq 40.0
const320 dq 320.0
const365 dq 365.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.49 -0.01  0   0.62 0.25  0.02 0.316*10000=3160;
; 0.27 -0.52  0.4 0.36 0    -0.56 0.316*10000=3160;6320
; 0.18  0.73 -0.5 0.26 0.88 -0.08 0.316*10000=3160;9480
; 0.04  0.01 -0.5 0    0.52 -0.32 0.052*10000= 520
mov XCC,rbx
mov YCC,rbx
mov i,48000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,3160
jg @f
movr a,0.49
movr b,-0.01     
mov c,ebx
movr d,0.62
movr e,0.25 
movr f,0.02
jmp fin
@@: cmp edx,6320
jg @f
movr a,0.27
movr b,-0.52 
movr c,0.4
movr d,0.36     
mov e,ebx
movr f,-0.56
jmp fin
@@: cmp edx,9480
jg @f
movr a,0.18 
movr b,0.73
movr c,-0.5
movr d,0.26
movr e,0.88
movr f,-0.08
jmp fin
@@: movr a,0.04 
movr b,0.01
movr c,-0.5     
mov d,ebx
movr e,0.52
movr f,-0.32

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 const470;st(0) = NewX * 470
        fadd const82 ;st(0) = NewX * 470 + 82
fistp x       ;x = (int) (NewX * 470 + 82)
        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
fchs            ;st(0)  = -NewY
fmul const470;st(0) = -NewY * 470
fadd const42;st(0)  = -NewY * 470 + 42
fistp y       ; y = (int) (-NewY * 470 + 42)
mov ecx, y
cmp ecx,cdYSize
jae @f
imul ecx,y,cdXSize*4
add rcx,pMainDIB
mov dword ptr [rcx+rax*4],0FF8000h ;*(pMainDIB + y*cdXSize*4 + x*4) = orange 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 'Maple Fractal',0
bi BITMAPINFO <<28h,640,-430,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const470 dd 470.0
const82 dd 82.0
const42 dd 42.0
end

jj2007

Fantastic, thanks for sharing this :t

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.7  0.2 -0.2 0.7 0.0  0.0 0.5
; 0.0 -0.6  0.6 0.0 1.0 -0.6 0.5
mov XCC,rbx
mov YCC,rbx
mov i,60000
bucle:  call rand
mov ecx,1000
xor edx,edx
div ecx
cmp edx,499
jg @f
movr a,0.7 
movr b,0.2
movr c,-0.2
movr d,0.7
mov e,ebx
mov f,ebx
jmp fin
@@: mov a,ebx
movr b,-0.6 
movr c,0.6
mov d,ebx
movr e,1.0
movr f,-0.6
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 const340;st(0) = NewX * 340
        fadd const120;st(0) = NewX * 340 + 120
fistp x       ;x = (int) (NewX * 470 + 120)
        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
fchs            ;st(0)  = -NewY
fmul const340;st(0) = -NewY * 340
fadd const160;st(0)  = -NewY * 340 + 160
fistp y       ; y = (int) (-NewY * 340 + 160)
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_APPWORKSPACE ;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 'Talon Fractal',0
bi BITMAPINFO <<28h,640,-430,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const340 dd 340.0
const120 dd 120.0
const160 dd 160.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.45881 -0.22565  0.07268 0.60187 -0.00177  0.31948 0.31*10000=3100
; 0.34268  0.37561 -0.20337 0.54642 -0.02210  0.32976 0.20*10000=2000;5100
; 0.13582  0.50273 -0.31347 0.13846 -0.02004  0.21706 0.16*10000=1600;6700
; 0.25326 -0.48975  0.30798 0.34989 -0.00740  0.19810 0.23*10000=2300;9000
; 0.06641  0        0       0.47942 -0.01492 -0.02422 0.10*10000=1000;
mov XCC,rbx
mov YCC,rbx
mov i,45000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,3160
jg @f
cmp edx,3100
jg @f
movr a,0.45881
movr b,-0.22565 
movr c,0.07268
movr d,0.60187     
movr e,-0.00177   
movr f,0.31948
jmp fin
@@: cmp edx,5100
jg @f
movr a,0.34268 
movr b,0.37561
movr c,-0.20337
movr d,0.54642
movr e,-0.02210 
movr f,0.32976
jmp fin
@@: cmp edx,6700
jg @f
movr a,0.13582 
movr b,0.50273
movr c,-0.31347
movr d,0.13846
movr e,-0.02004 
movr f,0.21706
jmp fin
@@: cmp edx,9000
jg @f
movr a,0.25326
movr b,-0.48975 
movr c,0.30798
movr d,0.34989
movr e,-0.00740 
movr f,0.19810
jmp fin
@@: movr a,0.06641                 
mov b,ebx
mov c,ebx
movr d,0.47942
movr e,-0.01492
movr f,-0.02422

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 const470;st(0) = NewX * 470
        fadd const320 ;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 const470;st(0) = NewY * 470
fsubr const420;st(0)  = -NewY * 470 + 420
fistp y       ; y = (int) (-NewY * 470 + 420)
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) = orange 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 #5 Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const470 dd 470.0
const320 dd 320.0
const420 dd 420.0
end

Magnum

I got empty zips for for all the attachments. ??
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

Mikl__

QuoteI got empty zips for for all the attachments. ??
Hi, Magnum!
I checked again, attached files are in perfect order. There are attached files in Tree5x64.zip. The picture "Tree5.png" renamed in "Tree5.zip". Pay attention to the end of the file name is "x64" or is not
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.358591 0.329160 -0.334007 0.580720 -5.889050 1.924278 0.361396*10000=3614
; 0.796218 0.136942  0.075187 0.719074  1.086998 0.408452 0.638604*10000=6386
mov rdi,pMainDIB
mov ecx,cdYSize*cdXSize
mov eax,0FFFFFFh
rep stosd

mov XCC,rbx
mov YCC,rbx
mov i,35000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,3160
jg @f
cmp edx,3614
jg @f
movr a,0.358591
movr b,0.329160
movr c,-0.334007
movr d,0.580720
movr e,-5.889050
movr f,1.924278
jmp fin
@@: movr a,0.796218
movr b,0.136942 
movr c,0.075187
movr d,0.719074 
movr e,1.086998
movr f,0.408452

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  pop
        fadd e       ;st(0) = a * XCC + b * YCC + e
fst NewX    ;NewX  = a * XCC + b * YCC + e
fmul const45;st(0) = NewX * 45
        fadd const312;st(0) = NewX * 45 + 312
fistp x       ;x = (int) (NewX * 45 + 312)
        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 const45 ;st(0) = NewY * 45
fsubr const410;st(0)  = -NewY * 45 + 410
fistp y       ; y = (int) (-NewY * 45 + 410)
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 'Windy Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const45 dd 45.0
const312 dd 312.0
const410 dd 410.0
end

Magnum

Thanks
I though the xxx64 files were for 64 bit systems - I have a 32 bit system.

Just saw that the code is 64 bit. bummer :-)
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

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.92 -0.09  0.09 -0.92 0.00 0.00 0.1*10000=1000
;  0.79  0.26 -0.26  0.79 0.21 0.26 0.9*10000=9000
mov XCC,rbx
mov YCC,rbx
mov i,45000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,9000
jg @f
movr a,-0.92
movr b,-0.09 
movr c,0.09
movr d,-0.92
mov e,ebx
mov f,ebx
jmp fin
@@: movr a,0.79 
movr b,0.26
movr c,-0.26 
movr d,0.79
movr e,0.21
movr f,0.26

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 const300;st(0) = NewX * 300
        fadd const320 ;st(0) = NewX * 300 + 320
fistp x       ;x = (int) (NewX * 300 + 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 const300;st(0) = NewY * 300
fsubr const240;st(0)  = -NewY * 300 + 240
fistp y       ; y = (int) (-NewY * 300 + 240)
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 'Galaxy Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const300 dd 300.0
const320 dd 320.0
const240 dd 240.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.92 -0.09  0.09 -0.92 0.00 0.00 0.1*10000=1000
;  0.79  0.26 -0.26  0.79 0.21 0.26 0.9*10000=9000
mov XCC,rbx
mov YCC,rbx
mov i,45000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,1000
jg @f
movr a,-0.92
movr b,-0.09 
movr c,0.09
movr d,-0.92
mov e,ebx
mov f,ebx
jmp fin
@@: movr a,0.79 
movr b,0.26
movr c,-0.26 
movr d,0.79
movr e,0.21
movr f,0.26

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 const150;st(0) = NewX * 150
        fadd const320 ;st(0) = NewX * 150 + 320
fistp x       ;x = (int) (NewX * 150 + 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 const150;st(0) = NewY * 150
fsubr const240;st(0)  = -NewY * 150 + 240
fistp y       ; y = (int) (-NewY * 150 + 240)
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 'Seashell Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const150 dd 150.0
const320 dd 320.0
const240 dd 240.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.860671  0.401487 -0.402177 0.860992  0.108537  0.075138 0.956972*10000=9570
; 0.094957 -0.000995  0.237023 0.002036 -0.746911  0.047343 0.009813*10000=  98
; 0.150288  0.000000  0.000000 0.146854 -0.563199  0.032007 0.023402*10000= 234
; 0.324279 -0.002163  0.005846 0.001348 -0.557936 -0.139735 0.009813*10000=  98

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

mov XCC,rbx
mov YCC,rbx
mov i,200000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,9570
jg @f
movr a,0.860671 
movr b,0.401487
movr c,-0.402177
movr d,0.860992 
movr e,0.108537 
movr f,0.075138
jmp fin
@@: cmp edx,9570+98
jg @f
movr a,0.094957
movr b,-0.000995 
movr c,0.237023
movr d,0.002036
movr e,-0.746911 
movr f,0.047343
jmp fin
@@: cmp edx,9570+98+234
jg @f
movr a,0.150288 
mov b,ebx 
mov c,ebx
movr d,0.146854
movr e,-0.563199 
movr f,0.032007
jmp fin
@@: movr a,0.324279
movr b,-0.002163 
movr c,0.005846
movr d,0.001348
movr e,-0.557936
movr f,-0.139735

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 const250;st(0) = NewX * 250
        fadd const300 ;st(0) = NewX * 250 + 300
fistp x       ;x = (int) (NewX * 250 + 300)
        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 const250;st(0) = NewY * 250
fsubr const180;st(0)  = -NewY * 250 + 180
fistp y       ; y = (int) (-NewY * 250 + 180)
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 'Nautilus Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
const250 dd 250.0
const300 dd 300.0
const180 dd 180.0
end

Mikl__

I wonder whether it is possible by fractal to paint  of a deck of cards, where on each card is King of spades with a deck of cards in his hand  on each card is King of spades with a deck of cards in his hand etc.?

dedndave

fractal image compression looks like it might be kind of fun to play with  :P

https://karczmarczuk.users.greyc.fr/matrs/Dess/RADI/Refs/monroWake.pdf

i haven't done anything with it, myself - but i find the idea interesting

Siekmanski

Nice set of fractals.  8)

Why not copy the picture with a smaller resolution into the hands of kings of spades etc...
You could make an animated infinite zoomer that way.

Audio Fractals maybe fun too.
http://sessionville.com/articles/exploring-audio-fractals

Creative coders use backward thinking techniques as a strategy.

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.312500 -0.831731  0.812500 -0.283654 2.194113 6.130637 0.845745*10000=8457
;  0.125     0.317308 -0.187500  0.177885 1.075775 5.177031 0.090426*10000= 904
; -0.25      0.134615  0.187500  0.129808 3.498840 2.560557 0.063830*10000= 638

mov XCC,rbx
mov YCC,rbx
mov i,45000
bucle:  call rand
mov ecx,10000
xor edx,edx
div ecx
cmp edx,8457
jg @f
movr a,-0.312500
movr b,-0.831731 
movr c,0.812500
movr d,-0.283654
movr e,2.194113
movr f,6.130637
jmp fin
@@: cmp edx,8457+904
jg @f
movr a,0.125     
movr b,0.317308
movr c,-0.187500 
movr d,0.177885
movr e,1.075775
movr f,5.177031
jmp fin
@@: movr a,-0.25     
movr b,0.134615 
movr c,0.187500 
movr d,0.129808
movr e,3.498840
movr f,2.560557

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 * 34
        fiadd ShiftX ;st(0) = NewX * 34 + 320
fistp x       ;x = (int) (NewX * 34 + 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 * 34 + 350
fistp y       ; y = (int) (-NewY * 34 + 350)
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 'Sparkle Fractal',0
bi BITMAPINFO <<28h,cdXSize,-cdXSize,1,32,0,0,0,0,0,0>>
bufDIBDC dq ?
pMainDIB dq ?
Scale dd 34
ShiftX dd 320
ShiftY dd 350
end