WHDLoad MantisBT - GemX
View Issue Details
0003962GemX[All Projects] Generalpublic2018-09-20 23:152018-09-22 21:23
ReporterHarry 
Assigned ToStingRay 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
MachineUAE
CPU68020
CPUSpeed14
ChipSetAGA
GFXCardNone
ChipMem2 MB
FastMem16 MB
WorkbenchOS 3.1
KickROM40 - Kick 3.1
KickSoftNone
WHDLoad18.3
importedyes
Summary0003962: Hello Stingray, the latest WinUAE and FS-UAE have the problem that getting the
DescriptionGameVersion: english,1 disk, original release
SlaveVersion: all

Hello Stingray,
the latest WinUAE and FS-UAE have the problem that getting the HPOS ($dff007) is not random enough to serve as random generator, resulting in mostly the same mine sequence played in WHDLoad.
The next mine is determined at $5ade, the location
$5aea MOVE.W (A5, $6),D0 ;4 Bytes long, A5 is $dff000
would be a good place to patch to return a random value.
A random generator of a variant I used in Fourmaze is:
***
GETBYTERANDOM
        bsr.s random
        LSR.L #3,D0
        AND.B #$FF,D0
        rts
random MOVE.L RANDOM1(PC),D0
        ADD.L RANDOM2(PC),D0
        MOVE.L D0,RANDOM1
        ROR.L #$04,D0
        SUB.W RANDOM2(PC),D0
        EOR.L D0,RANDOM2
        ADD.L #$56565311,RANDOM1
        RTS
RANDOM1 DC.L $3F3F751F
RANDOM2 DC.L $17179834
***
For best results, call it also every VBI for the internal side effects so playing time is incorporated and the results are not in a certain sequence.
A good place to insert in the VBI is
$7594 LEA.L $DFF000,A5 ;6 Bytes long
Thanks,
Harry.
TagsNo tags attached.
Attached Files

Notes
(0006377)
StingRay   
2018-09-21 14:47   
That's one excellent bug report, thanks Harry! It never was a good idea to rely on the raster beam for random numbers so this is not an UAE problem but rather a problem with faster CPU's. I'll fix this in an update.
(0006379)
StingRay   
2018-09-21 15:44   
Patch updated, random generator recoded not to rely on the raster beam and in-game timing fixed as well.
(0006383)
Denis   
2018-09-22 21:23   
Hello Sting, I encounter a big problem about this new slave.

I have upgraded to Whdload 18.4, and GemX simply locks up my A1200 on the highscore screen. The only way for me to exit is to do CTRL+A+A.

Can you check what happens or better indicate me how can i help you ?

Thanks :)

Issue History
2018-09-20 23:15administratorNew Issue
2018-09-20 23:15administratorStatusnew => assigned
2018-09-20 23:15administratorAssigned To => StingRay
2018-09-21 14:47StingRayNote Added: 0006377
2018-09-21 15:44StingRayNote Added: 0006379
2018-09-21 15:44StingRayStatusassigned => resolved
2018-09-21 15:44StingRayResolutionopen => fixed
2018-09-22 21:23DenisNote Added: 0006383