English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 20 August 2016, 21:18   #21
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,459
Quote:
Originally Posted by Thorham View Post
Seems a little weak. It's really easy to write something simple and think it's okay, while the output is really bad. Randomness is a topic that must not be underestimated.
Quote:
Originally Posted by Mrs Beanbag View Post
true but i really don't think it needs to pass all of these rigorous statistical tests to be good enough to decide which item an enemy drops when you kill it.
Games do not really need top notch random... But a single register read is indeed a little weak.


Quote:
Originally Posted by Thorham View Post
Sounds good, but I'd test it using the full suite. Shouldn't take that long on your laptop.
Maybe one day. I tried the toughest tests i could find, from many different suites so i'm quite confident.


Quote:
Originally Posted by Thorham View Post
Indeed. Xorshift is nice for when you need something simple and reasonable that's also fast. I prefer Xorgens4096, because it's pretty fast, has a huge period and passes all of Big Crush.
TestU01 isn't necessarily the strongest, even in big crunch mode. Have you checked with the NIST randomness test suite ?


Quote:
Originally Posted by Thorham View Post
Yeah, I know. The hardware registers don't behave in the same way as on hardware.
I wish we had faster counters, they would provide better quality. CIAs are damned slow. Wouldn't solve the problem on emulators, though.
meynaf is offline  
AdSense AdSense  
Old 22 August 2016, 01:04   #22
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,972
Quote:
Originally Posted by Mrs Beanbag View Post
true but i really don't think it needs to pass all of these rigorous statistical tests to be good enough to decide which item an enemy drops when you kill it.
Quote:
Originally Posted by meynaf View Post
Games do not really need top notch random...
Why use a crappy generator when you can use a good one?

Quote:
Originally Posted by meynaf View Post
TestU01 isn't necessarily the strongest, even in big crunch mode. Have you checked with the NIST randomness test suite ?
No, I haven't, but if it passes BigGrush, then it's certainly not crap

Quote:
Originally Posted by meynaf View Post
CIAs are damned slow.
My biggest problem is the slow read speed. I think reading a byte from a CIA register takes 200+ cycles!

Quote:
Originally Posted by meynaf View Post
Wouldn't solve the problem on emulators, though.
Would be great if Tony solved that problem.
Thorham is offline  
Old 22 August 2016, 08:28   #23
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,459
Quote:
Originally Posted by Thorham View Post
Why use a crappy generator when you can use a good one?
Because crappy generators are simpler, easier to find, and not everyone is willing to run random quality tests.
That said, now that my generator has been tested ok and is inside my main includes, i don't care anymore


Quote:
Originally Posted by Thorham View Post
My biggest problem is the slow read speed. I think reading a byte from a CIA register takes 200+ cycles!
I would say it takes around 70c @50Mhz (a bit more than 1µs).
Then again, random stuff rarely has to be real fast. I'm using a big MUL (long mul routine if assembled for 68000) and never had speed issues.
meynaf is offline  
Old 22 August 2016, 10:04   #24
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,934
Quote:
Originally Posted by Thorham View Post
Would be great if Tony solved that problem.
What problem? Sounds like normal fastest possible CPU mode behavior. It won't and can't wait for chips and you can (more like will) get same result if you read same CIA timer or horizontal position register in a loop.
Toni Wilen is offline  
Old 22 August 2016, 22:36   #25
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,972
Quote:
Originally Posted by Toni Wilen View Post
What problem? Sounds like normal fastest possible CPU mode behavior. It won't and can't wait for chips and you can (more like will) get same result if you read same CIA timer or horizontal position register in a loop.
Yeah, it's the fastest CPU mode behavior. It's a pity that the behavior is different, though. Perhaps a simple detection routine can be written for it.
Thorham is offline  
Old 23 August 2016, 12:12   #26
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,934
Quote:
Originally Posted by Thorham View Post
Yeah, it's the fastest CPU mode behavior. It's a pity that the behavior is different, though. Perhaps a simple detection routine can be written for it.
In non-jit fastest possible it should be possible to emulate this more accurately but I can't make it the default because it would only mean bug reports ("when I do this and that, new version is much slower.".)
Toni Wilen is offline  
Old 23 August 2016, 12:51   #27
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,459
Quote:
Originally Posted by Toni Wilen View Post
In non-jit fastest possible it should be possible to emulate this more accurately but I can't make it the default because it would only mean bug reports ("when I do this and that, new version is much slower.".)
What about giving some kind of access to hardware counters of the host ? The routine would then detect it is running on emulation and adapt accordingly.
meynaf is offline  
Old 25 August 2016, 02:59   #28
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,972
The sulution to the WinUae problem turned out to be very simple. Just poll:
Code:
    move.b  $bfe601,d0
.loop
    cmp.b   $bfe601,d0
    beq     .loop
After this you can read the rest of the registers. Tested on hardware as well, and works great.

Try this with AsmOne or AsmPro, or something like that, under WinUae with the fastest setting, and watch it generate fabulous gibberish ready for mixing:
Code:
a
    lea b,a0

    lea $bfe001,a1
    lea $bfd000,a2
    lea $dff000,a3

    move.l  #1024,d7
.loopa
    move.b  $bfe601,d0
.loopb
    cmp.b   $bfe601,d0
    beq     .loopb

    clr.b   d1

    move.l  a1,a4
    move.l  a2,a5
    move.l  a3,a6

    moveq   #16-1,d6
.loopc
    move.b  (a4),d0
    add.w   #256,a4
    eor.b   d0,d1

    move.b  (a6)+,d0
    eor.b   d0,d1

    move.b  (a5),d0
    add.w   #256,a5
    eor.b   d0,d1

    move.b  (a6)+,d0
    eor.b   d0,d1

    dbra    d6,.loopc

    move.b  d1,(a0)+

    subq.l  #1,d7
    bne     .loopa

    rts

    section data,data_f
b
    dcb.b   100*1024

Last edited by Thorham; 25 August 2016 at 03:08.
Thorham is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Important Facts about Floating Point Numbers Mrs Beanbag Coders. General 2 13 August 2016 22:14
Floating point without FPU oRBIT Coders. Asm / Hardware 13 19 March 2015 00:11
Help needed!!Random octal numbers generator(asm) sheryn88 Coders. General 6 01 August 2010 08:19
A nice quick small random numbers routine? Photon Coders. General 2 20 December 2004 22:56
Floating menus? Mojo2000 New to Emulation or Amiga scene 6 30 January 2003 15:35

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:24.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.16262 seconds with 12 queries