Random numbers generation

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

dr. apocalipsis
Interested
Posts: 17
Joined: Fri Oct 19, 2007 10:56 pm

Post by dr. apocalipsis »

Hi guys. I found this forum and love it.
A lot of technical resources for MD that nobody covered before ^^

About soft resets. In xmen you need to do a soft resets in a certain spot in the game to continue. I haven't found any emulator that can run this feature.

Also, when you soft reset Super Street Fighter II, high scores remains until power off.

Do you think this feature will be added in a next installement of such emulators like gens o Fusion?

Sorry about my english ^^
Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru »

dr. apocalipsis wrote:Also, when you soft reset Super Street Fighter II, high scores remains until power off.
Same happens in other games, it's because RAM doesn't clears or corrupts after reset (on all systems, not only on SMD).
Lordus
Newbie
Posts: 1
Joined: Sat Oct 20, 2007 12:08 am

Post by Lordus »

Hi everyone. I've been reading this forum for a while now, and its really a great resource.

Just wanted to mention here, that my emulator implements both, random start up values in HV counter and soft reset.
It also has a debugger.

Too bad its in Java, so nobody would probably want to use it ;)
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

My random number code :

Code: Select all

GiveGarbage:            ; Return garbage
 MOVE.W (GARBAGE), D0
 MOVE.W D0, D1
 NOT.W  D1
 ROR.W  #3, D0
 EOR.W  D1, D2
 ADD.W  D1, D0
 ROL.W  #7, D1
 ADD.W  D1, D0
 EOR.W  D2, D0
 ADD.W  (HTIMER), D0
 MOVE.W D0, (GARBAGE)
 RTS
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke »

I think that the issue with soft-reset comes from the fact that, on emulators, "soft reset key" input is handled like any other inputs, i.e at the end (or start) of each frame... so the cpu reset can never occur in a middle of a frame and HV counters are always the same since they are reseted at the start of the frame

(a simple but maybe unoptimised solution is to check the "soft reset key" on each scanline, I was able to reproduce the character randomization this way)

On hard-reset, as both CPU and VDP are reseted (and HV counters also), you should logically always get the same value for a given HVC read instruction... but maybe there is still some random timings differences between 68000 and VDP /RESET hold
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

easiest way would be to throw in a random value into HV counter after each reset, and start the VDP code somewhere in a frame after reset...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Post Reply