rem Blobs (Assembly Version)...... Rev 2.0 rem A J Tooth // 20th December 2003 rem Set up full screen proc_fullscreen(22) *FLOAT 64 dim b% 3,a% 3,rd% 3,Lm% 3,fac% 7,Pts% 3 dim Red% 3,Blu% 3,Gre% 3,p% 3,q% 3,fR% 3,fG% 3,fB% 3 xmax%=2048 : ymax%=1536 : !Pts%=600 dim blobs% 2000, precal% 1000, cols% 500 rem Dual-pass assembly, in case of labels for pass%=0 to 2 step 2 proc_precal(pass%) proc_cols(pass%) proc_blobs(pass%) next pass% cls : clg repeat Lim%=100+rnd(300) : rem Number of blobs until screen refreshes Cnt%=0 colour 136 : cls repeat rem Pick randam base colour from 16.7 million !Red%=100+rnd(155) : !Blu%=100+rnd(155) : !Gre%=100+rnd(155) rem Locate centre of next blob x%=rnd(xmax%) : y%=rnd(ymax%) origin x%,y% !rd%=50+2*rnd(75) rem Draw the blob sys "GetCurrentProcess" to hprocess% sys "SetPriorityClass", hprocess%, &100 for !a%=!rd% to 0 step -2 call precal% : rem Various parameters call cols% : rem Changes colour call blobs% : rem Draws the next ring next sys "GetCurrentProcess" to hprocess% sys "SetPriorityClass", hprocess%, &20 Cnt%+=1 rem Continue until the spacebar is pressed a$=inkey$(1) until (a$=" ") or (Cnt%=Lim%) until a$=" " a$=get$ quit end rem End of Program ============================ rem Set up use of Full Screen def proc_fullscreen(N%) sys "GetSystemMetrics", 0 to xscreen% sys "GetSystemMetrics", 1 to yscreen% sys "SetWindowLong",@hwnd%,-16,&16000000 sys "SetWindowPos",@hwnd%,-1,0,0,xscreen%,yscreen%,0 mode N% mouse off : off : rem Turns off the Mouse Pointer and the Cursor endproc rem Assembly Language Routine 1 rem for PreCalculations def proc_precal(opt%) P%=precal% [opt opt% finit fild dword [a%] fild dword [rd%] fsubr st1,st0 fdivp st1,st0 fst qword [fac%] fld st0 fld st0 fild dword [Red%] fmulp st1,st0 fistp dword [fR%] fild dword [Gre%] fmulp st1,st0 fistp dword [fG%] fild dword [Blu%] fmulp st1,st0 fistp dword [fB%] fild dword [a%] fild dword [ten%] faddp st1,st0 fild dword [Pts%] fmulp st1,st0 fild dword [rd%] fdivp st1,st0 fistp dword [Lm%] jmp over .ten% dd 10 .over ret ] endproc rem Formulae worked out by above Assembly Routine def proc_dump2 |fac%=(!rd%-!a%)/!rd% ?fR%=int(|fac%*?Red%) ?fG%=int(|fac%*?Gre%) ?fB%=int(|fac%*?Blu%) !Lm%=int(!Pts%*(!a%+10)/!rd%) endproc rem Assembly Language Routine 2 rem for Blobs Calculations def proc_blobs(opt%) P%=blobs% [opt opt% mov eax,0 mov [b%],eax .rep finit fild dword [b%] fldpi fldpi faddp st1,st0 fmulp st1,st0 fild dword [Lm%] fdivp st1,st0 fld st0 fcos fild dword [a%] fmulp st1,st0 fistp dword [p%] fsin fild dword [a%] fmulp st1,st0 fistp dword [q%] mov al,[vdcode%] \Calls pl0t routine call "oswrch" mov al,[pltcode%] call "oswrch" mov bx,[p%] mov al,bl call "oswrch" mov al,bh call "oswrch" mov bx,[q%] mov al,bl call "oswrch" mov al,bh call "oswrch" mov eax,[b%] inc eax mov [b%],eax cmp eax,[Lm%] jng near rep jmp past \Constants .vdcode% db 25 .pltcode% db 69 .past ret ] endproc rem Formulae for plot points worked out in above routine def proc_dump |p%=!a%*cos(2*pi*!b%/!Lm%) |q%=!a%*sin(2*pi*!b%/!Lm%) endproc rem Assembly Language Routine 3 rem for Colours def proc_cols(opt%) P%=cols% [opt opt% mov al,[vdsetcol%] \Changes the rgb vlue f0r colr 10 call "oswrch" mov al,[cl%] call "oswrch" mov al,[paltyp%] call "oswrch" mov al,[fR%] call "oswrch" mov al,[fG%] call "oswrch" mov al,[fB%] call "oswrch" mov al,[vdgcol%] \Calls gc0l routine call "oswrch" mov al,[md%] call "oswrch" mov al,[cl%] call "oswrch" jmp round \Various constants .vdsetcol% db 19 .paltyp% db 16 .vdgcol% db 18 .md% db 0 .cl% db 10 .round ret ] endproc