home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. CD ROM (Annual Premium Edition)
/
premium.zip
/
premium
/
DOSGRAPH
/
MASWED.ZIP
/
MANDEL.ASM
< prev
next >
Wrap
Assembly Source File
|
1992-07-15
|
3KB
|
92 lines
;MANDEL.ASM
;Assemblerrutin för max It% iterationer i mandelbrotprogrammet
;lim är gränsen (lim=4) där iterationen skall avbrytas
;call mandel (lim,It%,Recon,Imcon)
.387
lim equ 18
It% equ 14
Recon equ 10
Imcon equ 6
code segment
assume cs:code
push bp ;spara stackpekaren
mov bp,sp ;stackpekaren till bp
push es
les di,[bp+It%] ;max iterationer It% till cx,
mov cx,es:[di] ;som räknas ned med "loop"
mov bx,cx ;kopiera It% till dx
finit ;initialisera coprocessorn!
les di,[bp+lim]
fld qword ptr es:[di] ;lim till tos, push
les di,[bp+Recon]
fld qword ptr es:[di] ;Recon till tos, push
les di,[bp+Imcon]
fld qword ptr es:[di] ;Imcon till tos, push
fld st(1) ;Rez=Recon till tos, push
fld st(1) ;Imz=Imcon till tos, push
next: fst st(5) ;Imz till reg 5
;1
fadd st,st ;2*Imz
fmul st,st(1) ;2*Imz*Rez
fadd st,st(2) ;Imz'=2*Imz*Rez+Imcon
fxch st(5) ;Imz' till reg 5,Imz till tos
fmul st,st ;II=Imz*Imz
fxch st(1) ;II till reg 1, Rez till tos
fmul st,st ;RR=Rez*Rez
fsubrp st(1),st ;RR-II
fadd st,st(2) ;Rez'=RR-II+Recon
fld st(4) ;Imz' till tos
;2
fadd st,st ;2*Imz
fmul st,st(1) ;2*Imz*Rez
fadd st,st(2) ;Imz'=2*Imz*Rez+Imcon
fxch st(5) ;Imz' till reg 5,Imz till tos
fmul st,st ;II=Imz*Imz
fxch st(1) ;II till reg 1, Rez till tos
fmul st,st ;RR=Rez*Rez
fsubrp st(1),st ;RR-II
fadd st,st(2) ;Rez'=RR-II+Recon
fld st(4) ;Imz' till tos
;3
fadd st,st ;2*Imz
fmul st,st(1) ;2*Imz*Rez
fadd st,st(2) ;Imz'=2*Imz*Rez+Imcon
fxch st(5) ;Imz' till reg 5,Imz till tos
fmul st,st ;II=Imz*Imz
fxch st(1) ;II till reg 1, Rez till tos
fmul st,st ;RR=Rez*Rez
fsubrp st(1),st ;RR-II
fadd st,st(2) ;Rez'=RR-II+Recon
fld st(4) ;Imz' till tos
;4
fadd st,st ;2*Imz
fmul st,st(1) ;2*Imz*Rez
fadd st,st(2) ;Imz'=2*Imz*Rez+Imcon
fxch st(5) ;Imz' till reg 5,Imz till tos
fmul st,st ;II=Imz*Imz
fld st(1) ;Rez till tos, push
fmul st,st ;RR=Rez*Rez
fst st(2) ;RR till reg 2
fsub st,st(1) ;RR-II
fadd st,st(4) ;Rez'=RR-II+Recon
fxch st(2) ;Rez' till st(4), RR till tos
faddp st(1),st ;sum=II+RR, pop
fld st(4) ;lim till tos
fcompp ;lim-sum<0, sign flag=1,pop,pop
fstsw ax ;sw till ax
sahf ;ah till flaggregistern
jb exit ;jump if < 0
fld st(4) ;Imz' till tos, stacken återst.
loop next
exit: mov ax,bx ;It% till ax
sub ax,cx ;antal iterationer som gjorts
les di,[bp+It%]
mov es:[di],ax ;It% innehåller nu antal iter.
pop es
finit ;Initialisera coprocessorn!!
pop bp
code ends
end