Here is my effort, using the SIMD registers.
But first the algorithim is rearranged, for more direct translation:
do
zxx=zx*zx
zyy=zy*zy
if zxx+zyy>=4.0 then exit do
zy = 2 * zx * zy + cy
zx = zxx - zyy + cx
if --it<1 then exit do
end do
Then, step by step, the lines are transformed into SIMD instructions.
(if yout PC is an old banger (pre-2005), it may not have the SSE3 instruction set containing HADDPS and HSUBPS )
include "sw.inc"
include "gl.inc"
'! glFlush Lib "opengl32.dll" ()
hwnd = Window 800,600,1
Init2D (hwnd)
single x, y, zz[16]
sys im=570, z=150, it, stop
h = GetHeight
w = GetWidth
float iz=1/z
float xx,yy
indexbase 0
zz[4]=4.0
For y=0 to <h
For x=0 to <w
zz[8]= (x-400)*iz
zz[9]= (y-300)*iz
movups xmm3,zz[4] '4.0
movups xmm4,zz[8] 'cx,cy
xorps xmm0,xmm0 'zero zx,zy
mov ecx ,im 'down counter
def swap 0b11100001 'shuffle-order to swap lower 2 elements
(
movups xmm1,xmm0
mulps xmm1,xmm1 'squares
movups xmm2,xmm1 '
haddps xmm2,xmm2 'squares sum
comiss xmm2,xmm3 'compare with 4.0
jae exit 'exit if value >= 4.0
movups xmm2,xmm1 '
hsubps xmm2,xmm2 'squares difference
addss xmm2,xmm4 'singular add cx for new zx
'
movups xmm1,xmm0 'to compute new zy
shufps xmm1,xmm1,swap 'swap zx,zy position
addss xmm1,xmm1 'singular 2*zy 'zy+zy
mulss xmm1,xmm0 'singular *zx
movups xmm5,xmm4 '
shufps xmm5,xmm5,swap 'swap cx,cy position
addss xmm1,xmm5 'singular add cy
unpcklps xmm2,xmm1 'pair new zx,zy (by interleaving)
movups xmm0,xmm2 'transfer new zx,zy
dec ecx
jg repeat
)
mov it,ecx 'iter count
DrawPixel x,y, 1, it*12,it*8,it*4,255
Next
Next
SwapBuffer
While KeyDown(27)=0
DoEvents
Flush
Wend
Quit2D
CloseWindow