|
movzx ecx,cl ;zero-extend exponent add ecx,895 ;adjust exponent rol edx,1 ;move sign to LSB shld ecx,edx,21 ;align exponent shl edx,20 ;align mantissa btr edx,20 ;get sign to carry rcr ecx,1 ;insert sign
|
|
|
|
|
|
|
|
|
REM Example of using gPlotPoints to plot multiple points. REM This uses fixed-point coordinates format. REM 3000 points at 60 fps on my 1.66GHz 64-bit Intel Celeron *ESC OFF MODE 8 : OFF ON ERROR REPORT : PRINT " at line "; ERL : END INSTALL @lib$ + "GLIB2" PROCInitGLIB( @lib$ + "glib2.dll", g{} ) ON ERROR PROCCleanup : PROCerror ON CLOSE PROCCleanup : QUIT GetTickCount% = FN`s("GetTickCount") REM FN`s() is one of GLIB's internal functions, REM but nevertheless comes in handy for our purposes! clr% = FNImport("gLerpClr") plot% = FNImport("gPlotPoints") nPts% = 3000 DIM x%( nPts%-1 ), y%( nPts%-1 ) DIM dx%( nPts%-1 ), dy%( nPts%-1 ) DIM col%( nPts%-1 ) FOR I% = 0 TO nPts%-1 x%( I% ) = 640*RND(1) * 2^16 y%( I% ) = 512*RND(1) * 2^16 dx%( I% ) = 4*(RND(1)-0.5) * 2^16 dy%( I% ) = 4*(RND(1)-0.5) * 2^16 col%( I% ) = RND(&FFFFFF) NEXT I% maxX% = 640 * 2^16 maxY% = 512 * 2^16 fmt% = 2 : REM coordinates format (fixed-point) REM 0 = integer REM 1 = <reserved> REM 2 = 16:16 fixed-point REM 3 = 40-bit float (not yet supported) REM 4 = 64-bit float frames% = 0 *REFRESH OFF SYS GetTickCount% TO time0% REPEAT SYS clr%, g{}, &803020, &203040 SYS plot%, g{}, fmt%, ^x%(0), ^y%(0), ^col%(0), nPts% FOR I%=0 TO nPts%-1 x%(I%)+=dx%(I%) y%(I%)+=dy%(I%) IF x%(I%)<0 OR x%(I%)>=maxX% dx%(I%)*=-1 IF y%(I%)<0 OR y%(I%)>=maxY% dy%(I%)*=-1 NEXT PROCDisplay(TRUE) frames% += 1 SYS GetTickCount% TO time1% IF time1%-time0%>=1000 THEN SYS GetTickCount% TO time0% SYS "SetWindowText", @hwnd%, STR$nPts%+" points | " + STR$frames% + " fps" frames% = 0 ENDIF UNTIL FALSE PROCCleanup END DEF PROCerror *REFRESH ON CLS : ON : REPORT : PRINT " at line "; ERL; REPEAT UNTIL INKEY(1)=0 ENDPROC
|