extern printf,atof,scanf,sscanf,strcmp %define LAYRS %define ACCL1 %define ACCL2 %ifdef ACCL1 %define ACCL0 %endif %ifdef ACCL2 %define ACCL0 %endif section .data data class=data progbits alloc noexec write align=16 %include "dat.asm" %include "ini.asm" %include "pro.asm" %include "rot.asm" global main main: mov ebx,[esp+4] ; MAIN ENTRY POINT mov ebp,[esp+8] cmp ebx,2 jz mn1 cmp ebx,5 jz mn4 push dword [ebp] push dword [ebp] push dword [wnum] push dword lnum mov eax,lgeo shr eax,4 push dword eax push dword diag call printf add esp,24 jmp end mn1: push dword [ebp+4] call atof add esp,4 fistp dword [sca] ; random number seed call init call pf2k jmp end mn4: push dword [ebp+4] call atof add esp,4 fistp dword [sca] mov eax,[sca] mov [fstr],al ; string number push dword [ebp+8] call atof add esp,4 fistp dword [sca] mov eax,[sca] mov [fdom],al ; om number push dword [ebp+12] call atof add esp,4 fistp dword [fnum] ; number of iterations push dword [ebp+16] call atof add esp,4 fistp dword [sca] ; random number seed call init call flsh end: ret ; <-- main -- pf2k: ; -- process f2k --> pf1: push line ; buffer one line push linf call scanf add esp,8 cmp eax,-1 jz near pff pf2: push line ; print the line push outf call printf add esp,8 push rti ; parse the line push engy push type push xsin push xcos push rzi push ryi push rxi push name push zsin push zcos push inpt push line call sscanf add esp,52 cmp eax,11 ; is this the TR line? jnz pf1 fld dword [xcos] ; convert angles to direction fmul dword [cfpi] fsincos fld dword [xsin] fmul dword [cfpi] fsincos fmul st3 fchs fstp dword [nxi] fmulp st2 fchs fstp dword [nzi] fchs fstp dword [nyi] push name ; mu+ push amup call strcmp add esp,8 cmp eax,0 jz muon push name ; mu- push amum call strcmp add esp,8 cmp eax,0 jz muon push name ; mu push amun call strcmp add esp,8 cmp eax,0 jz muon jmp pf3 muon: fldz ; bare muon fld dword [type] fcomip st1 fstp st0 jbe pf1 call track jmp pf1 pf3: push name ; delta push delta call strcmp add esp,8 cmp eax,0 jz ecas push name ; brems push brems call strcmp add esp,8 cmp eax,0 jz ecas push name ; epair push epair call strcmp add esp,8 cmp eax,0 jz ecas jmp pf4 ecas: fldz ; EM cascade fstp dword [type] call track jmp pf1 pf4: push name ; e+ push ep call strcmp add esp,8 cmp eax,0 jz ecas push name ; e- push em call strcmp add esp,8 cmp eax,0 jz ecas push name ; e push en call strcmp add esp,8 cmp eax,0 jz ecas push name ; munu push munu call strcmp add esp,8 cmp eax,0 jz hcas push name ; hadr push hadr call strcmp add esp,8 cmp eax,0 jz hcas jmp pf1 hcas: fld1 ; hadron cascade fchs fstp dword [type] call track jmp pf1 pff: ret ; <-- process f2k --