The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
August 26, 2019, 01:23:39 AM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  General Forums
| |-+  The Workshop
| | |-+  MasmBasic
« previous next »
Pages: 1 ... 9 10 [11] 12 13 ... 21 Print
Author Topic: MasmBasic  (Read 139648 times)
Dharam
Guest


Email
Re: MasmBasic
« Reply #150 on: September 26, 2010, 10:28:03 PM »

I still am not sure whether this file masmbasic.inc is availble for general testing or not.  It it is available, where is it?
Logged
ecube
Guest


Email
Re: MasmBasic
« Reply #151 on: September 27, 2010, 01:51:18 AM »

I wish to the source of masmbasic, THANKS  ThumbsUp
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #152 on: September 27, 2010, 06:41:25 AM »

I still am not sure whether this file masmbasic.inc is availble for general testing or not.  It it is available, where is it?

In the first post of this thread, a zip file is attached. Open it, and double-click on ReadMeMasmBasic.txt
Logged

jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #153 on: September 27, 2010, 07:50:51 AM »

I wish to [see] the source of masmbasic, THANKS  ThumbsUp

Cube,

MB as such is not open source, sorry. However,
- MasmBasic.inc is visible - and there are all the macros
- if you are really curious, insert int 3 into the macro you want to investigate, and Olly will show you the way.

In case MB does not behave as a proper BASIC should, post your code here, and we'll investigate the bug if there is one (I currently know of one, but it's fairly exotic: Dim Something As BYTE will not work together with Print Str$(Something(123)).
Logged

jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #154 on: November 12, 2010, 10:13:12 PM »

Update with three new functions: PopCount(), Percent(), Rand()
Note this is a beta, not thoroughly tested.

Quote
PopCount
   PopCount(MySource, ecx)            ; standalone: set count to ecx
   mov ebx, 88888888h
   Print Str$("In ebx, %i bits are set", PopCount(ebx))   ; for use with Str$() etc
   void PopCount(ebx)               ; returns bitcount in eax
   mov MyVar, PopCount(MySource)
Rem   runs in about 7 cycles on a Celeron M; requires Init or at least one Str$(0) before


Percent, f4Percent, f8Percent, fpuPercent
            Print Str$("f4pc(srcr10, 33.33)=\t%If\n", f4Percent(srcr10, 33.33))   ; f4: returns REAL4
            Print Str$("f8pc(srcr10, 33.33)=\t%If\n", f8Percent(srcr10, 33.33))   ; f8: returns REAL8 e.g. for use with xmm regs
            Print Str$("fpupc(srcr10, pcr10)=\t%If\n", fpuPercent(srcr10, pcr10))   ; fpu: leaves result in ST(0)
            Print Str$("fpc(12345.678, ebx)=%f\n", f8Percent(12345.678, ebx))
            Print Str$("fpc(12345.6, ebx)=%f\n", f8Percent(12345.6, ebx))
            Print Str$("pc(12345.0, ebx)=%f\n", Percent(12345.0, ebx))      ; with immediate real source and reg32 percentage
            Print Str$("pc(srcdd, ebx)=%f\n", Percent(srcdd, ebx))         ; with DWORD source and reg32 percentage
            Print Str$("pc(12345, 20)=%f\n", Percent(12345, 20))         ; with immediate integer source and percentage
            movq xmm0, f8Percent(srcr10, 33.33)
            Print Str$("xmm0=%f\n", f:xmm0)
            movd xmm0, Percent(srcr10, 33.33)
            Print Str$("xmm0=%f\n", xmm0)
Rem   source can be almost anything, same for percentage


Rand
            Rand()                     
; empty args = initialise using rdtsc
            
Rand(0, 100, xmm1)      ; 0....+100, dest can be local/global REAL8 var or xmm
            Rand(0, ebx, MyReal8)   ; 0....ebx, dest can be local/global REAL8 var or xmm
            Rand(0, 100)               ; 0....+100, left on FPU in st(0)
            
Rand(-5.5, 9.3)            ; -5.3...+9.3, left on FPU in st(0)
            
Print Str$("-5.5, 9.3: ST(0)=\t%If\n", ST(0))
            void Rand(123)            ; leaves dword in eax
            mov ecx, Rand(123)      ; range 0...123
            mov ecx, Rand(MyDword)   ; range passed as dword variable
Rem   - high-speed RNG generates pseudo random sequence with excellent randomness
   - for testing, do not initialise; for release version, use Rand() before the innermost loop
    - credits to Alex Bagayev for his AxRand algo

EDIT: Attachment removed, valid version is attached to top of thread, page 1
« Last Edit: November 23, 2010, 10:48:25 PM by jj2007 » Logged

Antariy
Member
*****
Gender: Male
Posts: 1041


Re: MasmBasic
« Reply #155 on: November 12, 2010, 10:19:40 PM »

Jochen, is PopCount with lookup table?

Edited: Yes, I see - it is.
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #156 on: November 12, 2010, 10:26:36 PM »

Yes, generated on the fly during Init.
Logged

jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #157 on: November 12, 2010, 10:29:03 PM »

Jochen which count of downloads have your archive from post above? Something interesting - I see 0, but I have downloaded it.

Alex, I have updated the archive with your correct name spelling in the MbGuide.rtf help file. That is why you see 0 downloads - it is a new archive. Note the tiny difference in the filename.
Logged

Antariy
Member
*****
Gender: Male
Posts: 1041


Re: MasmBasic
« Reply #158 on: November 12, 2010, 10:35:15 PM »

Alex, I have updated the archive with your correct name spelling in the MbGuide.rtf help file. That is why you see 0 downloads - it is a new archive. Note the tiny difference in the filename.

Maybe that is reason. Some days ago - at time when I click on the link at Frank's tesd-bed thread, he are remove archive from post at the same time - and browser thread was freezed - very funny  green2
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #159 on: November 14, 2010, 12:05:47 AM »

Alex pointed me to an omission in the documentation of Rand(): the higher end of the range is not included.

Code:
esi=-100, ebx=100; run 1=lowest, run 2=highest value
0, 100:    xmm1=        0.0
0, ebx:    xmm1=        0.0
esi, 0:    xmm1=        -100.000000000000000
esi, ebx:  xmm1=        -100.000000000000000
0, 100:    ST(0)=       0.0
-5, 9:     ST(0)=       -5.00000000000000000
-5.5, 9.3: ST(0)=       -5.50000000000000000
0, 1:      destR8=      0.0
0, -1:     destR8=      0.0
mov ecx, Rand(123):     0.0

0, 100:    xmm1=        99.9999999767170777
0, ebx:    xmm1=        99.9999999767170777
esi, 0:    xmm1=        -2.32829089411024093e-08
esi, ebx:  xmm1=        99.9999999534341697
0, 100:    ST(0)=       99.9999999767170911
-5, 9:     ST(0)=       8.99999999674039275
-5.5, 9.3: ST(0)=       9.29999999655413019
0, 1:      destR8=      0.999999999767170800
0, -1:     destR8=      -0.999999999767170911
mov ecx, Rand(123):     122.000000000000000

Generated by:
Code:
  Rand(0, 100, xmm1) ; 0...100 (exclusive), dest can be local/global REAL8 var or xmm
  Print Str$("0, 100:    xmm1=\t%If\n", f:xmm1)
  Rand(0, ebx, xmm1) ; 0...100 (exclusive), dest can be local/global REAL8 var or xmm
  Print Str$("0, ebx:    xmm1=\t%If\n", f:xmm1)
  Rand(esi, 0, xmm1) ; 0...100 (exclusive), dest can be local/global REAL8 var or xmm
  Print Str$("esi, 0:    xmm1=\t%If\n", f:xmm1)
  Rand(esi, ebx, xmm1) ; 0...100 (exclusive), dest can be local/global REAL8 var or xmm
  Print Str$("esi, ebx:  xmm1=\t%If\n", f:xmm1)
  Rand(0, 100) ; 0...100 (exclusive), left on FPU in st(0)
  Print Str$("0, 100:    ST(0)=\t%If\n", ST(0))
  fstp st ; correct FPU stack
  Rand(-5, 9) ; -5...+9, left on FPU in st(0)
  Print Str$("-5, 9:     ST(0)=\t%If\n", ST(0))
  fstp st ; correct FPU stack
  Rand(-5.5, 9.3) ; -5.3...+9.3, left on FPU in st(0)
  Print Str$("-5.5, 9.3: ST(0)=\t%If\n", ST(0))
  fstp st ; correct FPU stack
  Rand(0, 1, destR8) ; 0...1 (exclusive), dest can be local/global REAL8 var or xmm
  Print Str$("0, 1:      destR8=\t%If\n", destR8)
  Rand(0, -1, destR8) ; -1...0, dest can be local/global REAL8 var or xmm
  Print Str$("0, -1:     destR8=\t%If\n", destR8)
  void Rand(123) ; leaves dword in eax
  mov ecx, Rand(123) ; range 0...123
  Print Str$("mov ecx, Rand(123): \t%If\n\n", ecx)
Logged

hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


Re: MasmBasic
« Reply #160 on: November 14, 2010, 01:16:04 AM »

I still want a copy of the "Espresso Machine" code when it becomes available.  BigGrin
Logged

Regards,



Download site for MASM32
http://www.masm32.com
dedndave
Member
*****
Posts: 12523


Re: MasmBasic
« Reply #161 on: November 14, 2010, 02:57:41 AM »

yah, Jochen - that Rand function isn't washing our dishes over here   BigGrin

Z sends a K
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #162 on: November 14, 2010, 08:27:51 AM »

I still want a copy of the "Espresso Machine" code when it becomes available.  BigGrin

Hutch,
Please send the documentation of the interface. USB port, or is it one of those stone age machines that are addressed through the serial port?
 wink

yah, Jochen - that Rand function isn't washing our dishes over here   BigGrin

Dave,
If it was, it would be the World's fastest dish washer, of course - the macro version of AxRand runs in 13 cycles, and is 21 bytes short.

But the implementation would be a bit, ehm, challenging. My advice: Take a big hammer. After 13 minutes of hard work, your china will look sufficiently random BigGrin

Quote
Z sends a K
J sends 2 K redface  (to Z, not to you, of course)
Logged

hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


Re: MasmBasic
« Reply #163 on: November 14, 2010, 08:53:33 AM »

JJ,

I was hoping for SATA 6.
Logged

Regards,



Download site for MASM32
http://www.masm32.com
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #164 on: November 14, 2010, 09:45:39 AM »

JJ,
I was hoping for SATA 6.

Hutch,
When I watch the barmen preparing coffee here in Italy, yes they are definitely very fast, but 6 Gbits/s...????
 Roll Eyes
Logged

Pages: 1 ... 9 10 [11] 12 13 ... 21 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!