Programming Fractals with FASM

This is a fractal analysis program developed by me a few years ago using the low level programming language FASM (flat assembler). Somehow I enjoyed making this (unnecessary) acrobatic coding as a final project in the course of low level programming for electronics engineering bachelor degree.

madelbrot-julia.png

Fractals evaluated are Mandelbrot and Julia, this is the part of the equations:

;----------------------------------------
; Calcula Zm = Z(n+1) = Zn^2 + C + D*(Zn-1)
;----------------------------------------

; Calcula el valor siguiente de Zn, almacendando
; el resultado en el par Zm = (xm, ym).
; xm = xc + xn*xn - yn*yn
; ym = yc + 2*xn*yn

proc Calcula_Zm xc, yc, xn, yn

 ; Calculo de xm

 finit
 fld dword [xc] ;load value into st0

 fld dword [yn]
 fmul [yn]

 fld dword [xn]
 fmul [xn] ;st0=xn*xn, st1=yn*yn, st2=xc

 fsub st0, st1
 fadd st0, st2

 fst dword [xm] ;save st0 in [xm]

 ; Calculo de ym

 finit
 fld dword [yc] ;load value into st0

 fld dword [yn]
 fmul [xn]
 fmul [dos]

 fadd st0, st1

 fst dword [ym] ;save st0 in [xm]

 fwait

ret
endp
 You can view all the code on my Github repository.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s