Logo by kameelian - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. August 21, 2019, 01:48:53 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1] 2   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: writing a mb3d formula (*directly* in Assembly)  (Read 1961 times)
0 Members and 1 Guest are viewing this topic.
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« on: October 15, 2015, 10:32:31 PM »

 Nice job Luca!  That is it... except... I sort of like the version with only x pixel added in- it is way more symmetric.  <shrug>  

  

  Found it- can use the "_PartlyJulia.m3f"  to do it.  I'll see what I can do.  cheesy
« Last Edit: October 16, 2015, 12:30:35 PM by DarkBeam » Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #1 on: October 15, 2015, 11:32:27 PM »

Uhmm a ScaleC is needed wink cheesy
Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #2 on: October 15, 2015, 11:35:30 PM »

I'm going to try the PartlyJulia thing, maybe we can edit that one to just do the x component at all times....

 _PartlyJulia.m3f
Code:
[OPTIONS]
.Version = 2
.DEoption = -1
.Double X above = 999
.Double X below = -999
.Double X add = 0
.Double Y above = 999
.Double Y below = -999
.Double Y add = 0
.Double Z above = 999
.Double Z below = -999
.Double Z add = 0
[CODE]
558BEC5657508B75088B7E30DD06DC57F0DFE080E441740ADC57E8DFE080E441
7406DC47E0DD5618DD4608DC57D8DFE080E441740ADC57D0DFE080E4417406DC
47C8DD5620DD4610DC57C0DFE080E441740ADC57B8DFE080E4417406DC47B0DD
5628DED9DDD8585F5E5DC20800
[END]

A pretransform to disable partly the julia mode.

if (Px > X_above) or (Px < X_below) then Cx := Px + X_add
if (Py > Y_above) or (Py < Y_below) then Cy := Py + Y_add
if (Pz > Z_above) or (Pz < Z_below) then Cz := Pz + Z_add

P is the actual position and C the adding constant.

For example if you want to change the julia mode into the non-julia mode at x=5
towards lower values, set X_below to 5 and X_add to -5 if julia X is zero.
If X_add is the difference between the Julia value and X_below (or X_above if you use this),
then you get a smooth change towards the non-julia mode.
Same for the Y and Z dimensions.
[/code]
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #3 on: October 15, 2015, 11:47:55 PM »

To do this you should
1 load (FLD) Cx component.
2 multiply (FMUL) by an user defined double (EDI-10 usually... but check...)
3 save (FSTP) into Cx
copy and paste the code for Cy and Cz (just modify the addresses)... et voilá wink
Just be careful with open and closing sequences!!! Never alter them or you get into trouble hurt Copy them as they are (all before 1st fld and after last fstp is a fixed sequence)
And never try to paste a sequence from another formula it may not fit sad
Yes it is picky cheesy
« Last Edit: October 16, 2015, 12:14:08 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #4 on: October 15, 2015, 11:54:29 PM »

  I will eat lunch, and hopefully feel inspired.  Need to learn M3D too...
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #5 on: October 16, 2015, 12:17:14 AM »

... if I succeded everyone can wink ... added more details in prev post plus splitted topic police
Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #6 on: October 16, 2015, 01:11:10 AM »

haha... I was thinking "wut happened??"  Here it is. 
Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #7 on: October 16, 2015, 01:37:08 AM »

[options]

Passes variables to the code portion, I assume. 

If I want to name variables ScaleCx, ScaleCy, and ScaleCz:

[option]
.Double ScaleCx
.Double ScaleCy
.Double ScaleCz

Where are these variables located in the stack?? 

Where are Cx, Cy, and Cz variables (pixel components) located in the stack??

Can I directly write to Cx, Cy, and Cz?

Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #8 on: October 16, 2015, 09:06:32 AM »

I anticipated it in the other thread wink
Cx is QWORD PTR DS:[ESI+18] and the other ones have an offset of 8h so +20 and +28 smiley
They are writeable freely.
The user vars are in EDI-10 (the first double) then each double has an offset of 8h so -18 -20.
Don't remember the exact pointer syntax.
 But if you disassemble the old formula and confront you find out smiley
To do so "binary paste" the code in OllyDbg smiley
Do not remove .version and .deoption tags in the m3f or it won't load shocked
« Last Edit: October 16, 2015, 09:15:10 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #9 on: October 16, 2015, 12:20:04 PM »

I have opened an old transform I made that was even wrong huh? - finally found the error. Btw here it is commented (ignore the labels);

(FLIPS X,Y,Z with CX CY CZ)
 (Warning!!! here x is EAX while normally it is EBX... it is possible if you write very very simple formulas this way but not reccomended in general!)

Because a floating point compare alters EAX so if you use it to recall "X" you are pointing to a garbage address sad
Code:
00787091     55             PUSH EBP ; everything before 1st FLD = DON'T CHANGE!
00787092     8BEC           MOV EBP,ESP ; everything before 1st FLD = DON'T CHANGE!
00787094     56             PUSH ESI ; everything before 1st FLD = DON'T CHANGE!
00787095     57             PUSH EDI ; everything before 1st FLD = DON'T CHANGE!
00787096     8B75 08        MOV ESI,DWORD PTR SS:[EBP+8] ; everything before 1st FLD = DON'T CHANGE!
00787099     8B7E 30        MOV EDI,DWORD PTR DS:[ESI+30] ; everything before 1st FLD = DON'T CHANGE!
0078709C     D9D0           FNOP ; everything before 1st FLD = DON'T CHANGE!
0078709E     DD00           FLD QWORD PTR DS:[EAX] ; OK... load X pushing it into the stack (be careful the floating point stack is very small. Don't stack more than 8 variables or it will kill ya )
007870A0     DD02           FLD QWORD PTR DS:[EDX] ; load Y
007870A2     DD01           FLD QWORD PTR DS:[ECX] ; load Z
007870A4     DD46 18        FLD QWORD PTR DS:[ESI+18] ; load CX
007870A7     DD46 20        FLD QWORD PTR DS:[ESI+20] ; load CY
007870AA     DD46 28        FLD QWORD PTR DS:[ESI+28] ; load CZ
007870AD     DD19           FSTP QWORD PTR DS:[ECX] ; save last stack entry to Z (CZ)
007870AF     DD1A           FSTP QWORD PTR DS:[EDX] ; save last stack entry to Y (CY)
007870B1     DD18           FSTP QWORD PTR DS:[EAX] ; save last stack entry to X (CX)
007870B3     DD5E 28        FSTP QWORD PTR DS:[ESI+28] ; save last stack entry to CZ (Z)
007870B6     DD5E 20        FSTP QWORD PTR DS:[ESI+20] ; save last stack entry to CY (Y)
007870B9     DD5E 18        FSTP QWORD PTR DS:[ESI+18] ; save last stack entry to CX (X)
007870BC     5F             POP EDI ; everything after last FSTP = DON'T CHANGE!
007870BD     5E             POP ESI ; everything after last FSTP = DON'T CHANGE!
007870BE     5D             POP EBP ; everything after last FSTP = DON'T CHANGE!
007870BF     C2 0800        RETN 8 ; everything after last FSTP = DON'T CHANGE!
also leaving even a single thing into the fp stack not fstp-ed will kill you wink
... and finally _scaleC is here! cheesy cheesy cheesy
(Warning!!! here x is EAX while normally it is EBX... it is possible if you write very very simple formulas this way but not reccomended in general!)
Code:
00F87145     55             PUSH EBP
00F87146     8BEC           MOV EBP,ESP
00F87148     56             PUSH ESI
00F87149     57             PUSH EDI
00F8714A     8B75 08        MOV ESI,DWORD PTR SS:[EBP+8]
00F8714D     8B7E 30        MOV EDI,DWORD PTR DS:[ESI+30]
00F87150     DD46 18        FLD QWORD PTR DS:[ESI+18] ; Cx
00F87153     DC4F F0        FMUL QWORD PTR DS:[EDI-10] ; scale Cx
00F87156     DD5E 18        FSTP QWORD PTR DS:[ESI+18] ; save to Cx
00F87159     DD46 20        FLD QWORD PTR DS:[ESI+20] ; guess ;)
00F8715C     DC4F E8        FMUL QWORD PTR DS:[EDI-18]
00F8715F     DD5E 20        FSTP QWORD PTR DS:[ESI+20]
00F87162     DD46 28        FLD QWORD PTR DS:[ESI+28]
00F87165     DC4F E0        FMUL QWORD PTR DS:[EDI-20]
00F87168     DD5E 28        FSTP QWORD PTR DS:[ESI+28] ; end
00F8716B     5F             POP EDI
00F8716C     5E             POP ESI
00F8716D     5D             POP EBP
00F8716E     C2 0800        RETN 8

Code:
[OPTIONS]
.Version = 2
.DEoption = -1
.Double ScaleCx = 1
.Double ScaleCy = 1
.Double ScaleCz = 1
[CODE]
558BEC56578B75088B7E30DD4618DC4FF0DD5E18DD4620DC4FE8DD5E20DD4628
DC4FE0DD5E285F5E5DC20800
[END]
A pretransform to scale C components.
[/code]

Even the parameter! tease

Code:
Mandelbulb3Dv18{
g.....S....O/...w....2....Ebm3VsULD1.9163hEuga2EvA5n.1oaHzf8GWNWzoclzwfd5cCD3fwj
................................H7wilUUlmz1........A./..................y.2...wD
...Uz6....k0..../M.0/......d....m.....E3.....Uk3YZH.AwqD/..........m/dkpXm1....U
z.....kD12../..........wz.................................U0.....y1...sD...../..
.z1...sDSnJmq2.1jx1..........OTJUXK.jZdj4vsh/3cMEu1Mkh/8svvNz2MCOSgD.EqD1nfz3FyQ
HuHvxSImy..Nz8sTRM0yySqDU.....Y5..............sD.6....sD..G.....................
.............oAnAt1...sD....z...........................................6....k1.
.....Ksulz1.......kz.wzzz1.U..6.P....U5...EB....m....c3....F....6/...I1.....SF52
...U.qFG9yzb2zzzRYoWzz7lz16.pc..zXCc..kvrEtMc7xD6ocyFE0ujz1..........2.28.kFrA0.
.Ub96aAIVz9.1se7Umvxz0........../EU0.wzzz1...........s/...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1...................................2CcN/UvNPcveeWCNq0.yRiibHJJUk1f..XR
SvBmx3CcN/UvNPcvQsLsUa3.ibhVi1bTV1OK.sSq4uCly3CcN/UvNPcvMwLsUa3.ibhVinqTV1OK.sSq
4uCkz3CcN/UvNPcv..EsUa3feeWCNqGQIJ36wk8EwyLsUa3f................................
E....6E2F2E.....I....A....kLnBKMgJqE............................................
...................wz...........................................................
................................................................................
.....................2.....3....0....6INiJqQd/JOiJKA.65.........................
...............................E..........2.....................................
................................................................................
................................}
{Titel: main paras~}
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #10 on: October 16, 2015, 12:23:40 PM »

A suitable layout for a normal formula is this. Also it prepares the stack for temporary variables.
The simpler layout used above is faster to execute (in theory) but very very limited! No temporary vars... and impossible to do a comparation between floats without breaking the registers! sad

Code:
00F87097     55             PUSH EBP
00F87098     8BEC           MOV EBP,ESP
00F8709A     81EC 30000000  SUB ESP,30 ; change 30 to a larger number to get more stack space - but NOT alter the rest!
00F870A0     53             PUSH EBX
00F870A1     56             PUSH ESI
00F870A2     57             PUSH EDI
00F870A3     8B75 08        MOV ESI,DWORD PTR SS:[EBP+8]
00F870A6     8B7E 30        MOV EDI,DWORD PTR DS:[ESI+30]
00F870A9     8BD8           MOV EBX,EAX
00F870AB     D9D0           FNOP
; write the actual formula here. x is FLD QWORD PTR DS:[EBX] and EAX is free to use (example store an integer or use for f.p. compares)
; a temporary variable is example QWORD PTR SS:[EBP-10]. The 2nd is located at EBP-18 etc.
00F871B6     8BC3           MOV EAX,EBX
00F871B8     5F             POP EDI
00F871B9     5E             POP ESI
00F871BA     5B             POP EBX
00F871BB     89EC           MOV ESP,EBP
00F871BD     5D             POP EBP
00F871BE     C2 0800        RETN 8

« Last Edit: October 16, 2015, 12:33:10 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #11 on: October 17, 2015, 11:17:18 PM »

Thanks Luca! 
Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #12 on: October 18, 2015, 12:04:07 AM »

I hope you will try to code one day it is fun! smiley
Logged

No sweat, guardian of wisdom!
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #13 on: October 21, 2015, 06:13:37 AM »

   K... I found where the variables are located in the register for the one of the new pine tree one's you coded.  We should make a list of where various variables are stored (cx,cy,cz, incoming x,y,and z.. etc.) so people don't have to figure it out.   Unless there is one (other than your comments above), and I don't know about it? cheesy

 
  Scroll down for commented assembly language.   The pine tree portion should be split off of both the formulas... I'll do a write up and post it here after I'm done.  

  I'm going to make a pine tree with only x pixel, for combining with the transforms, and one with all 3 pixel components for when there is no transform for an iteration (it should allow some interesting combos).    


Code:

[OPTIONS]
.Version = 2
.DEscale = 1              //
.SIpower = 2            // Shouldn't this be EDI-18????
.Double Scale = 2.0    // this one is EDI-18 in the code... shouldn't it be EDI-10??
.Double xOff = 2.0      // Why is this EDI-10 instead of EDI-8???
[CONSTANTS]
Double = 0.816496580927726        This ends up being EDI
Double = 0.5773502691896258     EDI+8
Double = 0.7071067811865475    EDI+10
[C0000000000000DE]
558BEC81EC300000005356578B75088B7E308BD8D9D0DD03DC0FDD01DC4F08D9
E0DEC1DC4F10DD5DF8DD03DC4F08DD01DC0FDEC1D9E190DD45F8DD02DC4F10D9
E0DEC1D9E190DD45F8DD02DC4F10DEC1D9E190DD1ADD1BDD1990DD03DC02DC4F
10DD5DF890DD03D9E0DC02DC4F1090DD45F8DC0FDD01DC4F08DEC190DD45F8DC
4F08D9E0DD01DC0FDEC190DD19DD1BDD1A90DD03DC4FF0DC67E8DD1BDD02DC4F
F0DD1ADD01DC4FF0DD1990DD03D8C8DD5DF8DD02D8C8DD5DF0DD01D8C8DD5DE8
DD03D8C0DD45F0DC45E8D9FADEF9DD5DE090DD45F8DC65F0DC65E890DD45E0DD
45F0DC65E8DEC990DD45E0D8C0DC09DC0A90DC4620DD1A90DC4628DD1990DC46
18DD1BD9D08BC35F5E5B89EC5DC20800
[END]


Description:

The cool Benesi pinetree formula;

// STEP1: "Benesi fold 1"
tx=(x*sqrt(2/3)-z*sqrt(1/3))*sqrt(1/2);
z=abs(x*sqrt(1/3) + z*sqrt(2/3));  
x=abs(tx-y*sqrt(1/2));          
y=abs(tx+y*sqrt(1/2));

tx=x*sqrt(1/2)+y*sqrt(1/2);
y=-x*sqrt(1/2)+y*sqrt(1/2);
x=tx*sqrt(2/3)+z*sqrt(1/3);
z=-tx*sqrt(1/3)+z*sqrt(2/3);

x=scale*x-offset;  //scale =2    offset=2      
y=scale*y;
z=scale*z;

// STEP2: "Benesi pinetree"
xt = x*x; yt = y*y; zt = z*z;
t = 2*x/sqrt(yt+zt);
x = xt-yt-zt+Cx;
z = t*(yt-zt)+Cy;
y = 2*t*y*z+Cz;


01007010   55               PUSH EBP // save old base pointer value
01007011   8BEC             MOV EBP,ESP // set new base pointer value
01007013   81EC 30000000    SUB ESP,30 // make room for 30 bytes... how large of a stack pointer do you need?
01007019   53               PUSH EBX // save the values of the EBX, ESI, and EDI registers
0100701A   56               PUSH ESI // to load later
0100701B   57               PUSH EDI
0100701C   8B75 08          MOV ESI,DWORD PTR SS:[EBP+8] //copy value from EBP+8 to ESI
0100701F   8B7E 30          MOV EDI,DWORD PTR DS:[ESI+30] //copy value from ESI+30 to EDI
01007022   8BD8             MOV EBX,EAX //copy value from EAX to EBX
01007024   D9D0             FNOP

01007026   DD03             FLD QWORD PTR DS:[EBX] // load value at EBX to top of stack   EBX=x
01007028   DC0F             FMUL QWORD PTR DS:[EDI] //  EBX*EDI    x*sqrt(2/3)   EDI= sqrt(2/3)

0100702A   DD01             FLD QWORD PTR DS:[ECX] // load ECX to top   ECX = z
0100702C   DC4F 08          FMUL QWORD PTR DS:[EDI+8] //  ECX * EDI+8     z*sqrt(1/3) EDI+8= sqrt(1/3)
0100702F   D9E0             FCHS // -  ECX *EDI+8
01007031   DEC1             FADDP ST(1),ST //  -ECX*EDI+8 + EBX*EDI     pop s(1)
01007033   DC4F 10          FMUL QWORD PTR DS:[EDI+10] //   tx = EDI+10 * (-ECX*EDI+8 + EBX*EDI )  EDI+10 = sqrt(1/2)
01007036   DD5D F8          FSTP QWORD PTR SS:[EBP-8] //   EPB-8 = tx

01007039   DD03             FLD QWORD PTR DS:[EBX] //  loads EBX    (x)
0100703B   DC4F 08          FMUL QWORD PTR DS:[EDI+8] //  EBX * EDI+8     =  x*sqrt(1/3)
0100703E   DD01             FLD QWORD PTR DS:[ECX] //  loads ECX to top of stack    z
01007040   DC0F             FMUL QWORD PTR DS:[EDI] //  ECX* EDI   = z*sqrt(2/3)
01007042   DEC1             FADDP ST(1),ST //  EBX*EDI+8 + ECX*EDI   pop s(1)
01007044   D9E1             FABS //  z= abs (EBX*EDI+8 + ECX*EDI)     ZZZZ
01007046   90               NOP
01007047   DD45 F8          FLD QWORD PTR SS:[EBP-8] // load EBP-8 to top of stack    TX
0100704A   DD02             FLD QWORD PTR DS:[EDX] // load EDX to top    EDX=y
0100704C   DC4F 10          FMUL QWORD PTR DS:[EDI+10] // EDX * EDI+10  = y*sqrt(1/2)
0100704F   D9E0             FCHS //  -EDX * EDI+10
01007051   DEC1             FADDP ST(1),ST //   EPB-8 - EDX*EDI+10    pop s(1)
01007053   D9E1             FABS //  abs(EPB-8 -EDX*EDI+10)  ==  XXXX
01007055   90               NOP
01007056   DD45 F8          FLD QWORD PTR SS:[EBP-8] // load TX
01007059   DD02             FLD QWORD PTR DS:[EDX] // load EDX to top
0100705B   DC4F 10          FMUL QWORD PTR DS:[EDI+10]  // EDX * EDI+10
0100705E   DEC1             FADDP ST(1),ST // EPB-8  + EDX *EDI+10     pop s(1)
01007060   D9E1             FABS // abs(EPB-8  + EDX *EDI+10)   ===  YYYYYYY
01007062   90               NOP
01007063   DD1A             FSTP QWORD PTR DS:[EDX] //copy YYYY to EDX and pop
01007065   DD1B             FSTP QWORD PTR DS:[EBX] //copy XXXX to EBX and pop
01007067   DD19             FSTP QWORD PTR DS:[ECX] //copy ZZZZ to ECX and pop
01007069   90               NOP



0100706A   DD03             FLD QWORD PTR DS:[EBX] //load EBX to top  
0100706C   DC02             FADD QWORD PTR DS:[EDX] // EBX+EDX
0100706E   DC4F 10          FMUL QWORD PTR DS:[EDI+10] // (EBX+EDX) * EDI+10    tx = (x+y)*sqrt(1/2)
01007071   DD5D F8          FSTP QWORD PTR SS:[EBP-8]   // copy TX to EPB-8 and pop       tx
01007074   90               NOP
01007075   DD03             FLD QWORD PTR DS:[EBX] //  load EBX to top    x
01007077   D9E0             FCHS //  -EBX  
01007079   DC02             FADD QWORD PTR DS:[EDX] //  EDX - EBX    y-x
0100707B   DC4F 10          FMUL QWORD PTR DS:[EDI+10] //  (EDX-EBX) * EDI+10 y= (y-x) *sqrt(1/2)
0100707E   90               NOP
0100707F   DD45 F8          FLD QWORD PTR SS:[EBP-8] // load EPB-8 to top   tx
01007082   DC0F             FMUL QWORD PTR DS:[EDI] // EBP-8 * EDI     tx*sqrt(2/3)
01007084   DD01             FLD QWORD PTR DS:[ECX] // load ECX to top    
01007086   DC4F 08          FMUL QWORD PTR DS:[EDI+8] //  ECX * EDI+8     z*sqrt(1/3)
01007089   DEC1             FADDP ST(1),ST //  EPB-8 * EDI + ECX * EDI+8      x=tx*sqrt(2/3)+z*sqrt(1/3)
0100708B   90               NOP
0100708C   DD45 F8          FLD QWORD PTR SS:[EBP-8] // load EPB-8 to top    tx
0100708F   DC4F 08          FMUL QWORD PTR DS:[EDI+8] // EBP-8 * EDI+8   tx*sqrt(1/3)
01007092   D9E0             FCHS // -EBP-8 * EDI+8   -tx*sqrt(1/3)
01007094   DD01             FLD QWORD PTR DS:[ECX] // load ECX to top   z
01007096   DC0F             FMUL QWORD PTR DS:[EDI] //  ECX * EDI     z*sqrt(2/3)
01007098   DEC1             FADDP ST(1),ST //  - (EPB-8 * EDI+8) + ECX *EDI    z=-tx*sqrt(1/3)+z*sqrt(2/3)
0100709A   90               NOP
0100709B   DD19             FSTP QWORD PTR DS:[ECX] // z to ECX and pop
0100709D   DD1B             FSTP QWORD PTR DS:[EBX] // x to EBX and pop
0100709F   DD1A             FSTP QWORD PTR DS:[EDX] // y to EDX and pop
010070A1   90               NOP
010070A2   DD03             FLD QWORD PTR DS:[EBX] //  EBX to top   x
010070A4   DC4F F0          FMUL QWORD PTR DS:[EDI-10] //  EBX * EDI-10   x * scale      scale= EDI-10
010070A7   DC67 E8          FSUB QWORD PTR DS:[EDI-18] //  - EDI-18      x*scale + offset   offset = EDI-18
010070AA   DD1B             FSTP QWORD PTR DS:[EBX] //  EBX: EBX *EDI-10 - EDI -18   popped
010070AC   DD02             FLD QWORD PTR DS:[EDX] //  EDX to top    y
010070AE   DC4F F0          FMUL QWORD PTR DS:[EDI-10] //  EDX * EDI-10   y*scale
010070B1   DD1A             FSTP QWORD PTR DS:[EDX] //  EDX: EDX *EDI-10     popped
010070B3   DD01             FLD QWORD PTR DS:[ECX] //  ECX to top    z
010070B5   DC4F F0          FMUL QWORD PTR DS:[EDI-10] //  ECX *EDI-10   z*scale
010070B8   DD19             FSTP QWORD PTR DS:[ECX] //  ECX: ECX*EDI-10   popped
010070BA   90               NOP



//  I'd like to split the pinetree formula out, so that it is stand alone.... The above section should be stand alone
//   I'll figure out the second formula as well, so the one section can be split off of the Pine tree section
// STEP2: "Benesi pinetree"
//xt = x*x; yt = y*y; zt = z*z;
//t = 2*x/sqrt(yt+zt);
//x = xt-yt-zt+Cx;
//z = t*(yt-zt)+Cy;
//y = 2*t*y*z+Cz;


010070BB   DD03             FLD QWORD PTR DS:[EBX] //  EBX to top EBX is x here
010070BD   D8C8             FMUL ST,ST //  EBX *EBX      
010070BF   DD5D F8          FSTP QWORD PTR SS:[EBP-8] //  EBP-8 = EBX*EBX      popped    xt= x*x
010070C2   DD02             FLD QWORD PTR DS:[EDX] //  EDX
010070C4   D8C8             FMUL ST,ST //  EDX*EDX
010070C6   DD5D F0          FSTP QWORD PTR SS:[EBP-10] //  EBP-10= EDX*EDX popped   yt=y*y
010070C9   DD01             FLD QWORD PTR DS:[ECX] //  ECX to top
010070CB   D8C8             FMUL ST,ST //  ECX*ECX
010070CD   DD5D E8          FSTP QWORD PTR SS:[EBP-18] //  EPB-18=ECX*ECX popped z*z= zt

010070D0   DD03             FLD QWORD PTR DS:[EBX] //  EBX to top   x    push
010070D2   D8C0             FADD ST,ST //  EBX*2    2*x
010070D4   DD45 F0          FLD QWORD PTR SS:[EBP-10] //  EBP-10 to top      y*y   push
010070D7   DC45 E8          FADD QWORD PTR SS:[EBP-18] //  EBP-10 + EPB-18    y*y+z*z
010070DA   D9FA             FSQRT // sqrt(EPB-10 + EPB-18)  sqrt( y*y+z*z)
010070DC   DEF9             FDIVP ST(1),ST //  EBX*2/ sqrt(EPB-10 + EPB-18)   x/sqrt(...)  autopopped
010070DE   DD5D E0          FSTP QWORD PTR SS:[EBP-20] //  EBP-20=EBX*2/ sqrt(EPB-10 + EPB-18)   popped   T=t=t=t
010070E1   90               NOP
010070E2   DD45 F8          FLD QWORD PTR SS:[EBP-8] //  EPB-8 to top    x*x   push
010070E5   DC65 F0          FSUB QWORD PTR SS:[EBP-10] //  EPB-8 -  EPB-10   x*x -y*y
010070E8   DC65 E8          FSUB QWORD PTR SS:[EBP-18] //  EPB-8 -  EPB-10  - EPX-18    x*x-y*y-z*z = x
010070EB   90               NOP
010070EC   DD45 E0          FLD QWORD PTR SS:[EBP-20] // EPB-20 to top   t    push
010070EF   DD45 F0          FLD QWORD PTR SS:[EBP-10] //  EBP-10 to top    y*y   push
010070F2   DC65 E8          FSUB QWORD PTR SS:[EBP-18] //  EBP-10 - EBP-18  y*y-z*z
010070F5   DEC9             FMULP ST(1),ST //  EBP-20 * (EBP-10 - EBP-18)  t*(y*y+z*z) = z   pop
010070F7   90               NOP
010070F8   DD45 E0          FLD QWORD PTR SS:[EBP-20] //  EBP-20 to top     t  push
010070FB   D8C0             FADD ST,ST //  EBP-20 * 2   2*t
010070FD   DC09             FMUL QWORD PTR DS:[ECX] //  EBP-20 * 2 * ECX   2*t* z
010070FF   DC0A             FMUL QWORD PTR DS:[EDX] //  EBP-20 * 2 * ECX * EDX   2*t*z*y=y  
01007101   90               NOP

//  I might just take the y and z pixel portions out of the mix???  No need to add them in...
//   but you said you made something to scale them.....  :D
//  better yet, have one pine tree with x,y,and z for when you skip an iteration of the transforms
//  and one with no y or z added in for when you don't skip iterations of the transforms!!!  
//  that will work... will be way better.  I don't know how to move around in M3D though...

01007102   DC46 20          FADD QWORD PTR DS:[ESI+20] //  y + z  pixel   (at ESI+20)  
01007105   DD1A             FSTP QWORD PTR DS:[EDX] //  EDX= new y, popped
01007107   90               NOP
01007108   DC46 28          FADD QWORD PTR DS:[ESI+28] //  z+ y pixel     (at ESI+28)
0100710B   DD19             FSTP QWORD PTR DS:[ECX] //  ECX= new z  popped
0100710D   90               NOP
0100710E   DC46 18          FADD QWORD PTR DS:[ESI+18]  //  z+ x pixel     (at ESI+18)
01007111   DD1B             FSTP QWORD PTR DS:[EBX] //  EBX= new x pop it
01007113   D9D0             FNOP



01007115   8BC3             MOV EAX,EBX //  huh???  x gets moved to EAX for some reason???
01007117   5F               POP EDI //  return EDI, ESI, and EBX to values before function
01007118   5E               POP ESI
01007119   5B               POP EBX
0100711A   89EC             MOV ESP,EBP
0100711C   5D               POP EBP
0100711D   C2 0800          RETN 8

« Last Edit: October 21, 2015, 06:32:12 AM by M Benesi » Logged

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #14 on: October 21, 2015, 08:08:11 AM »

Hmm... ok smiley but in the meantime I tell you that a formula compiler can be added to mb soonish but this is still under development by some developers wink ....
Logged

No sweat, guardian of wisdom!
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Inner Writing I FractalForums.com Banner Logos Pauldelbrot 0 773 Last post January 02, 2012, 04:57:34 AM
by Pauldelbrot
Writing formula using gcc (Re: Blobby) Tutorials « 1 2 3 » knighty 36 5579 Last post December 10, 2016, 11:22:22 PM
by DarkBeam
directly to the point(s) Images Showcase (Rate My Fractal) thom 4 389 Last post July 23, 2015, 01:07:04 PM
by thom
Experimental MB3D-version with integrated formula-compiler (JIT) beta testing « 1 2 3 » thargor6 40 4528 Last post January 22, 2016, 12:18:40 PM
by thargor6
3d printing directly from 2d slices or voxel objects 3D Fractal Generation ansr23 7 3029 Last post December 31, 2015, 06:11:20 AM
by ansr23

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.139 seconds with 29 queries. (Pretty URLs adds 0.015s, 2q)