News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Miscellaneous snippets

Started by jj2007, August 20, 2017, 08:02:31 AM

Previous topic - Next topic

HSE

Equations in Assembly: SmplMath

jj2007

Interesting ::)

Which OS version? Console is maximised, I suppose?

Just checked with Win XP, and that looks indeed like what you posted. Unlike Win7 & Win10, the console isn't enlarged enough by the invoke ShowWindow, rv(GetConsoleWindow), SW_MAXIMIZE. You have to enlarge it manually in the console properties, then save "for all future windows with the same name", and restart. Then it works.

On Win7, the display refreshes immediately, i.e. in milliseconds. With Win10, it seemed initially very slow, but now it has become fast. I have yet to find out if there is a pattern - mysteries of Windows 8)

HSE

In 7-32 I changed console properties and that look a lot better. Some characters are not intended ones, I think.
Equations in Assembly: SmplMath

jj2007

Weird, codepage 437 should be pretty standard. Which language is your OS?

HSE

Spanish. Selected: Español(España)

UASM v2.46, Jan  8 2018, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

*** MasmBasic version 25.12.2017 ***
** SetProcessUserModeExceptionPolicy
** read Header$()
DosSymbols.asm(69) : Error A2228: Missing right parenthesis in expression
MbFor(218)[MasmBasic.inc]: Macro called from
  DosSymbols.asm(69): Main line code
DosSymbols.asm(69) : Error A2228: Missing right parenthesis in expression
MbFor(243)[MasmBasic.inc]: Macro called from
  DosSymbols.asm(69): Main line code
DosSymbols.asm(69) : Error A2210: Syntax error: ]
MbFor(256)[MasmBasic.inc]: Macro called from
  DosSymbols.asm(69): Main line code
DosSymbols.asm: 100 lines, 1 passes, 199 ms, 0 warnings, 3 errors


There is a problem moving up and down because Quantity doesn't stop when reach limits.
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on August 20, 2018, 01:43:37 AM
Spanish. Selected: Español(España)
...
There is a problem moving up and down because Quantity doesn't stop when reach limits.

Weird. Sorry for the build errors, it seems the current MasmBasic version is not compatible with my newest one.
Re Quantity, that's by design: It is set by Rand() and does its job even if the position does not change. Just for testing...

jj2007

Quote from: HSE on August 19, 2018, 10:59:37 AM
In 7-32 I changed console properties and that look a lot better. Some characters are not intended ones, I think.

Can you check the attached version, please? I replaced codepage 437 with another one.

HSE

Worst !

Still not posible to assemble  :eusa_naughty:

Except first character, I see perfectly boxes.txt with MASM32 Unicode Editor .
Equations in Assembly: SmplMath

jj2007

Yes, it won't build, sorry. I am working on a major MasmBasic update, and that will take some time.

Still, the exe should work OK. It's now codepage UTF8, and your machine should understand that. Anybody else having such problems?

HSE

Ja!

Default font configuration here is "Fuentes de mapas de bits".

Changing that to "Lucida Console" work perfect, also previous version  :t

With third option Nidud's "Doszip Console" letters dont' look so well.
Equations in Assembly: SmplMath

jj2007

Thanks :biggrin:
One day I will find a way to set the console font programmatically ;)

jj2007

#86
Attached an archive with
- an exe compiled with FreeBasic
- that needs the second file, a DLL using Input$("prompt", "prefilled for editing")

jj2007

All three are brilliant with the FourmiLab ENT test, but only the first two have been tested with PractRand. If you need a very good hi-speed PRNG, stick with MasmBasic Rand().
Testing 32000000 numbers generated, CPU: Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz

833 ms for Pcg32  FB, last result: 817EEE81
390 ms for Pcg32 Asm, last result: 817EEE81
107 ms for MB Rand(), last result: 8E1531E8

771 ms for Pcg32  FB, last result: 15670CA0
378 ms for Pcg32 Asm, last result: 15670CA0
107 ms for MB Rand(), last result: C44145CE

764 ms for Pcg32  FB, last result: D422CFAD
398 ms for Pcg32 Asm, last result: D422CFAD
118 ms for MB Rand(), last result: 2C03A5D1

840 ms for Pcg32  FB, last result: ECD79C2B
377 ms for Pcg32 Asm, last result: ECD79C2B
107 ms for MB Rand(), last result: BFFA6298

766 ms for Pcg32  FB, last result: 5248B397
377 ms for Pcg32 Asm, last result: 5248B397
107 ms for MB Rand(), last result: 675D19A4

766 ms for Pcg32  FB, last result: 54A9248A
382 ms for Pcg32 Asm, last result: 54A9248A
110 ms for MB Rand(), last result: E59BD461
202     bytes for Pcg32
111     bytes for Pcg
26      bytes for MbRand


ENT results:
Testing 8000000 numbers generated, CPU: Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz

############ ENT results Pcg32 (FB):
Entropy = 7.999994 bits per byte.

Optimum compression would reduce the size
of this 32000000 byte file by 0 percent.

Chi square distribution for 32000000 samples is 274.62, and randomly
would exceed this value 25.00 percent of the times.

Arithmetic mean value of data bytes is 127.4936 (127.5 = random).
Monte Carlo value for Pi is 3.141756196 (error 0.01 percent).
Serial correlation coefficient is 0.000371 (totally uncorrelated = 0.0).

############ ENT results Pcg32 (MB):
Entropy = 7.999994 bits per byte.

Optimum compression would reduce the size
of this 32000000 byte file by 0 percent.

Chi square distribution for 32000000 samples is 274.62, and randomly
would exceed this value 25.00 percent of the times.

Arithmetic mean value of data bytes is 127.4936 (127.5 = random).
Monte Carlo value for Pi is 3.141756196 (error 0.01 percent).
Serial correlation coefficient is 0.000371 (totally uncorrelated = 0.0).

############ ENT results MB Rand(-1):
Entropy = 7.999995 bits per byte.

Optimum compression would reduce the size
of this 32000000 byte file by 0 percent.

Chi square distribution for 32000000 samples is 213.24, and randomly
would exceed this value 95.00 percent of the times.

Arithmetic mean value of data bytes is 127.4976 (127.5 = random).
Monte Carlo value for Pi is 3.141366946 (error 0.01 percent).
Serial correlation coefficient is -0.002006 (totally uncorrelated = 0.0).

jj2007

#88
* PCG32.zip: Comparing SIMD vs FPU-based methods for mapping a QWORD (0...-1) to a double (0.0 ... 1.0)

* GuiTableControl.zip: latest tests with a spreadsheet control

* GetGccVersion.zip: echo a short version string to your FB output window. Source:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  Let edi=MbExeFolder$+"Win32\gcc.exe --version"
  Let esi=Launch$(edi)
  .if dword ptr [esi]==Mirror$("La$?")
        PrintLine edi, Chr$(": no answer.", 13, 10, 10, "Check if GetGccVersion.exe sits above the bin\Win32 folder")
  .else
        PrintLine esi
        Let ebx=Extract$(esi, "project)", 0)
        Let ecx=Extract$(esi, "(C)", "Free Soft")
        PrintLine "gcc version", ebx, " (", Trim$(ecx), ")"
  .endif
EndOfCode


Sample output of gcc.exe --version:
gcc.exe (i686-win32-sjlj-rev2, Built by MinGW-W64 project) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Sample output of the attached batch file:
** compiling somefile.bas with -t 2000 -gen gcc -Wc -Ofast -s console **
gcc version 8.1.0 (2018)

hutch--

This is what I got running it the second time. Could not read the fonts as they were so small, copied it into my text editor first.

-8910786331291756801  0.5169453050529669    0.5169453050529669718
6730337785313497944   0.3648523424199086    0.3648523424199086505
-5974524377861002328  0.6761203844977746    0.6761203844977747243
2695508904680093984   0.1461238305204089    0.1461238305204090194
8502576381364090992   0.4609255892199442    0.4609255892199443155
-385216515766393995   0.9791173708364389    0.9791173708364389530
3034485871582637989   0.1644998087173231    0.1644998087173232765
2286379689918253082   0.1239448913468051    0.1239448913468051986
-4131041815082152639  0.7760557744729732    0.7760557744729734316
-853861575098310801   0.9537120712638256    0.9537120712638258368
7275931949313747423   0.3944290613151327    0.3944290613151328044
7844949285505684199   0.4252755529191934    0.4252755529191934295
140239247804428540    0.007602384856864708  0.007602384856864721546

timings for 100 Mio loops:
280 ms for SIMD
414 ms for FPU

197 ms for SIMD
409 ms for FPU

212 ms for SIMD
431 ms for FPU

223 ms for SIMD
378 ms for FPU

201 ms for SIMD
363 ms for FPU