don't click here

Early Mega Drive software research

Discussion in 'General Sega Discussion' started by Chimes, Jun 24, 2022.

  1. Chimes

    Chimes

    The One SSG-EG Maniac Member
    624
    482
    63
    This is my first thread on this forum, but it's mainly because I literally don't know anyone else who knows what I'm talking about (and to this extent)!

    So Altered Beast is a game that, despite being included in almost every Genesis and Genesis compilation known to man is somewhat unexplored. Over the years some codes for the game have been discovered (one is smackdab in the manual), but no one has ever really taken a dive into it like many have for other Genesis games.

    Well, after a few months of some madness and my sleep-deprived cries for help going unheard, I think I found... something. Not sure what it is. You'll see why later. Normally this is where I'd post the backstory of how I got here, but I actually already wrote about it in another forum for posterity. Here's a excerpt from the slightly incoherent 1 AM post:
    so a little while ago i was grinding on altered beast on my genesis mini. i could go on about how i think the game's interesting and how with a little tweaking it could be fun but that's not what i'm gonna get into here. but this game i feel is a lil unexplored and it's what makes the following text rather bewildering since i can't find much of this online.

    so i went to go and play the arcade version and it's... a experience, but anyways i went back to the genesis mini for grinding and after beating the game many times and working my way through the game's jank i decided to poke around at the tcrf page and find out altered beast has a sound test. so inbetween sessions i would go and use the sound test to listen to the music. it's pretty good, but i noticed that a lot of the songs lasted a LOT longer than i expected and several of them have instruments i couldn't really hear ingame since anything i'd do would interrupt the drums or melody.

    during one of those sessions i was poking around with the sound effects when i noticed that a LOT of them don't seem to play in-game. i put it in the back of my mind to "marinate" as most of my observations do, but the more i was playing the game the more i began to realize "wow many of these sounds don't even play... but when they do they're cut off".

    after talking to a friend about it i decided to do a bit more exploring and i find that a LOT of the sounds i just could not pinpoint where they were played.
    In short, Altered Beast's sound is a jungle. There's a whole lot of sounds and music that just aren't fully heard unless you go out of your way to DELIBERATELY make the werewolf not do anything for a solid minute or so (the music's drumline for example gets interrupted a ton), and some sounds either cut off or just aren't fully heard.

    What I want to focus on is the unused sounds. Inside the sound test, there is a whole swathe of seemingly unused sounds. There's a duplicate of the first level theme, and there is what seems to be a unused series of sound sequences meant for the end=of=level Neff cutscene. For context, in the Arcade original there's a lot more sounds when Neff takes away your energy orbs. But in the Genesis version, there's suspiciously... not much. As it turns out, these sounds are actually still in the game. They just... don't play? Here's the entries:

    AA - Neff's portal (used)

    A4 - Neff's head drone (unused)
    B9 - Neff taking away the energy orbs (unused)
    EA - PCM sample of Neff laughing (used)

    I've tried various ways to get these sounds to play in-game, assuming they were just interrupted somehow, but I just couldn't. These two sounds in the sequence are straight up unused.

    One sound of note is this "sproing" sound. I have never heard this sound in-game before. Either in the Arcade or Genesis version, I can't figure out where these might've been used. At first I thought it might've somehow been a Little Osomatsu leftover (another 1988 Sega title), but having played that game there's no sign of that sound in that game too.

    There's a lot of harsh, sustained sounds in the sound test, but only the sound of Neff transforming and exploding come to mind that are actually used.

    E0 seems to not be a sound, but a "fade out" command that seems to break with certain sounds (I have a theory this might involve the YM2612 not knowing what to do with suddenly stopping sounds like this). PCM samples can't play at the same time with music/sounds, as it causes the FM sounds to briefly sustain or stop.

    Now, I believe there may or may not be more sequences in the ROM. But I don't have much experience with 68k assembly (I only know how to do mspaint graphics and move single bytes using the move and add commands), and I only know how to play games. I've made a long list of all the sounds in the accessible sound test, and I have no real way of knowing what sounds are actually unused or if some of them are simply interrupted or have a highly specific edge case use without lots upon lots of playing. I've only played the game with one player, so maaaaaybe there's additional sounds when playing with two? But I checked videos of two player sessions and I couldn't find anything out of the ordinary.

    I don't know how to ROM hack the game, and from what I've seen while googling not many have either. So I've come here to present my findings, and I'm hoping someone more seasoned and experienced can find and pinpoint more on this game's sound. I also don't know if there's unused graphics but that's because i havent actually looked into the games graphics as i know nothing on that front.

    So those are some of my findings. Hopefully some of this weird swamp of sounds can be cleared up.
     
    • Informative Informative x 4
    • Like Like x 3
    • List
  2. Bobblen

    Bobblen

    Member
    377
    192
    43
    I guess the way to do it would be to reverse engineer the sound engine and figure out where it's calling the various track IDs, if you could find the address in the RAM where it's putting them, you could use a debugger to track what's being called when. Interesting that the sound team were clearly expecting a more complete port than what we got, they must have ran out of time or space on the ROM before they could implement it all. If you're lucky, sometimes the guys that make vgm packs will have notes about how songs are played by the sound engine. Given that altered beast has a nice easy sound test to use, maybe not though. Good luck!
     
  3. BinBowie

    BinBowie

    Na Zdrowie! Member
    73
    24
    8
    USA
    I was messing around with Altered Beast using Bizhawk's RAM editing features about a month or two ago and found that there are songs in the game that go completely unused in the sound test.

    You can poke Z80 address $1D02 to manually play whatever sound value you want (preferably within the sound test so no in-game sounds overlap what you're listening to). I found that the value $82, which is available in the Sound Test, isn't the version of the beast theme used in-game as it has a little intro that isn't heard under normal circumstances. $8B is the version that actually plays, which lacks that little intro. You might want to check that out.

    Edit: It's actually Z80 address $1D03 that needs to be poked. I was using a version of Bizhawk with a byte-swap bug when I first wrote this post.
     
    Last edited: Nov 7, 2022
    • Informative Informative x 2
    • Useful Useful x 1
    • List
  4. Bobblen

    Bobblen

    Member
    377
    192
    43
    For what it's worth, I had to poke $1D03 to get it to play (I used Regen, really wish there was an easier to use MD emulator for debugging, I love MEKA for master system for that very reason). That's a cool find! Sound tests often aren't the whole story, so it'll be interesting to see what else is hiding in there.
     
  5. Chimes

    Chimes

    The One SSG-EG Maniac Member
    624
    482
    63
    I've been poking around with this. I can confirm that 82 just isn't really used? It straight up goes for 8B. The intro for the first level theme also doesn't play all the way through thanks to Zeus' little "Rise from your grave!" speech interrupting it. You can hear a very tiny bit of it before it cuts off. The only place it fully plays (and even then half of the sound channels get interrupted by sound effects) is in the game demo.

    Apparently E0 does fade out the music... but any sounds after that keep going. Maybe it was meant to fade out the music when Neff was about to say "Welcome to your doooouhm!", like how the Arcade game does it? Idk im spitballing

    Also i tried forcing the Neff sounds to play with that address... and I figured out why it's never used: Neff's laugh plays too early! Since PCM and FM doesn't mix well with Altered Beast's sound engine, the YM2612 goes "Oopsie whoopsie, we did a fucky wucky!" and doesn't play the sounds. If it was played later, then there would be room for the sounds to play. Interesting...

    Also TIL $C4 crashes Regen. How fitting.

    But yeah, this is just one step. Someone more hellbent than me should go for this because there's no way I'm not doing this alone LOL
     
  6. BinBowie

    BinBowie

    Na Zdrowie! Member
    73
    24
    8
    USA
    That's strange. I loaded up every revision (JPv1.0, JPv1.1, US/EU) of Altered Beast/Juuouki and found that the address $1D02 is what definitely triggers what sounds play in the game. $1D03 seems to effect the song tempo on my end. Maybe it's a Bizhawk thing. It seems one emulator or the other may be inaccurate.
     
    • Informative Informative x 2
    • List
  7. Chimes

    Chimes

    The One SSG-EG Maniac Member
    624
    482
    63
    Regen definitely is weird: it wouldn't affect the music with 1D02. Only 1D03 worked.
     
  8. Bobblen

    Bobblen

    Member
    377
    192
    43
    Given that Bizhawk is the more accurate emulator, and continues to be actively developed I'm gonna assume it's a Regen problem, I'll keep that in mind when I use it in the future.
     
  9. BinBowie

    BinBowie

    Na Zdrowie! Member
    73
    24
    8
    USA
    I apologize about going off-topic in this thread but after testing a little something in Fatal Labyrinth I'm not 100% sure what emulator is accurate when it comes to Z80 addresses.

    On the Fatal Labyrinth TCRF page Valleybell states that Z80 address $1C08 triggers a music transition function when song $82 is playing. But when I load the ROM up in Bizhhawk and look at that same address it's the one that controls what sound is playing and $1C09 is what's triggering the music transition. It could possibly be an endian issue but I'm not completely sure. I'm hoping this can be addressed by whomever knows more about this sort of thing.
     
  10. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    Doesn't BizHawk display the RAM editor in little endian by default? It groups the RAM into 16-bit words, and I remember having to deal with the endianess being off. There should be an option to switch to big endian, though.

    Also keep in mind that BizHawk is not the emulator itself, but rather a shell for different cores and debuggers. BizHawk uses Genesis Plus GX for the Genesis/CD core.

    EDIT: Yeah, make sure that this is enabled for the proper viewing of RAM
    [​IMG]
     
  11. BinBowie

    BinBowie

    Na Zdrowie! Member
    73
    24
    8
    USA
    That only works when the RAM editor is in 2 byte data size mode for some reason. I typically have it running in 1 byte data size mode as it makes it easier to change individual values. It's strange I can't use big endian in that mode but I guess it is what it is for the time being.
     
  12. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    It displays the RAM values in the right order for me in 1 byte mode.
    I just checked a disassembly of the driver, and indeed this is incorrect, 1D03 is where the sound queue starts and 1D02 is for the tempo.
    Code (Text):
    1. DoTempo:                ; CODE XREF: UpdateAll+6p
    2.         ld    hl, byte_1D01    ; 1D01 = Tempo Timeout
    3.         ld    a, (hl)
    4.         or    a
    5.         ret    z        ; Tempo    00 = never delayed
    6.         dec    (hl)        ; subtract 1
    7.         ret    nz        ; reached 00 - continue    and delay all tracks
    8.         ld    a, (byte_1D02)    ; load initial Tempo (1D02)
    Code (Text):
    1. DoOneSndQueue:                ; CODE XREF: DoSoundQueue+3p
    2.                     ; DoSoundQueue+9p
    3.         ld    a, (de)
    4.         bit    7, a
    5.         ret    z
    6.         and    7Fh
    7.         ld    hl, SndPriorities
    8.         dec    a
    9.         ld    b, 0
    10.         ld    c, a
    11.         add    hl, bc
    12.         bit    7, (hl)
    13.         jr    z, loc_251
    14.         ld    a, (de)
    15.         ld    (byte_1D03), a
    16.         xor    a
    17.         ld    hl, unk_1D04
    18.         ld    (hl), a
    19.         inc    hl
    20.         ld    (hl), a
    21.         inc    hl
    22.         ld    (hl), a
    23.         ret

    EDIT: Peeked at BizHawk's source code and found this tidbit:
    Code (Text):
    1. // TODO: are the Z80 domains really Swap16 in the core?  Check this
    2. mm.Add(new MemoryDomainIntPtrSwap16Monitor(name, endian, area, size, true, _elf));

    I also checked Genesis Plus GX, and no, it does not byteswap Z80 RAM. It does it for 68000 memory to optimize accesses for host systems with little endian CPUs, but not for Z80, since that's only really accessed in bytes only, and thus is pretty much unnecessary. BizHawk just applies the swap to both 68000 and Z80, as that comment suggests. Just opened an issue and hopefully it gets fixed.
     
    Last edited: Jun 24, 2022
  13. BinBowie

    BinBowie

    Na Zdrowie! Member
    73
    24
    8
    USA
    [​IMG][​IMG]
    For some reason it isn't re-arranging the values for me. I'm using the latest version of the emulator as well.

    I can't wait until they fix this issue in it's entirety though. Thank you very much for putting in that request.
     
  14. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    Should clarify that I meant to edit this out, because I was mistaken. I was looking at 68000 memory, not Z80 memory :P
     
  15. Bobblen

    Bobblen

    Member
    377
    192
    43
    Ah, so bizhawk was in fact to blame (sorry Regen author!). Next time I have a free chunk of time, I'll try and match up some sound effects. There aren't that many, it's a fairly short game.
     
  16. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    Just to update, the BizHawk Z80 byte swap issue has been fixed and can be downloaded from here until the next stable release.
     
  17. Chimes

    Chimes

    The One SSG-EG Maniac Member
    624
    482
    63
    mfw a bug is randomly found by sheer happenstance um.jpg
     
  18. Chimes

    Chimes

    The One SSG-EG Maniac Member
    624
    482
    63
    Alright, I came back to this and I'm fairly confident that the entirety of the 1988 games are this under-investigated bubble of weird sound nonsense. I'm tempted to just change this topic to be a general for looking at the 1988 games from a technical lens, including Altered Beast.

    Osomatsu-kun is a... very odd game. Alongside several drafts of the game over theme still residing in the ROM and the game ostensibly crashing on launch models of the Mega Drive, the sound design is overall abrasive. It's hard to describe just how it sounds, but it's almost as if the soundfont in a MIDI was replaced with sounds of falling cutlery.
    I'd love to take a peek on what the HELL is going on this game's music, because it really sounds like there's something maladjusted. The loudness doesn't seem intentional.
     
  19. BinBowie

    BinBowie

    Na Zdrowie! Member
    73
    24
    8
    USA
    That game is infamous for being extremely rushed through production. Nearly half of the game had to be be scrapped due to Sega reducing the ROM size mid-development. I've also heard Sega R&D 2 referred to as a sweatshop before so It's no wonder the sound design is straight up cacophonous.

    For the game being straight up kusoge I've personally had fun playing it years ago on my Everdrive. It introduced me to the Osomtsu-Kun franchise which is worth checking out on it's own as it's very iconic in Japan.
     
    • Informative Informative x 2
    • List
  20. Chimes

    Chimes

    The One SSG-EG Maniac Member
    624
    482
    63
    Oh, I'm very aware of just how slash and dash the production was, haha. I highly suspect the reason there's no staff roll of any kind is because the second half got dropped with some hasty repatching.