øAslickproductions.org/forum/index.php?PHPSESSID=o0hb2m4qfgcnuu1vjmueebhgo5&topic=1866.0;prev_next=nexte:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexc2a2.htmlslickproductions.org/forum/index.php?topic=1866.30e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexc2a2.html.zx¢Êh^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿȰ,0.XOKtext/htmlISO-8859-1gzip@øÕ.XÿÿÿÿÿÿÿÿWed, 11 Mar 2020 11:41:47 GMT0ó°° ®0®P®€§²ð®¢Êh^í.X The Pseudorandom Array

Author Topic: The Pseudorandom Array  (Read 723 times)

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
The Pseudorandom Array
« on: April 18, 2016, 05:51:14 PM »
I don't think I've ever seen it documented anywhere, but this is interesting and pretty useful for custom stuff.

At startup, the game copies 6/EE00 (in ROM w/o header, or 14/EE00 in LoROM) through 6/EEFF into 7E:1900-19FF in RAM.

These 100 bytes are the effective random number array that (I think) is used for all random number generations. There's a constantly rotating byte - 67A out of battle and 097 in battle - that gets loaded into X, then we load 1900,X into A to get our pseudorandom number.

Theoretically, the game could just load 14/EE00,X every time, but it takes one less byte each time to use the array in RAM. Still, seems like an odd way to occupy those hundred bytes of RAM...

Imzogelmo

  • Ogopogo Aficianado
  • *
  • Posts: 241
  • Gender: Male
  • Ask me about my other job.
    • View Profile
    • NEPROMR
Re: The Pseudorandom Array
« Reply #1 on: April 20, 2016, 11:44:01 AM »
That is odd. It's been a long time, but I once looked at either FF5 or FF4 to compare the pseudorandom array to FF6, and the numbers were identical. I can't remember which game it was that was identical, but I thought that was kinda telling.
5/31/16 - I have an assembly of the battle portion of C2, relocated to the F0 bank, which has both vanilla and patch code in my dropbox. I'll be updating it with additional patches as I have time. I will *not* be releasing it publicly, but ask me for the link and I'll share.