Jump to content
cd-w

Chetiry (2600)

Recommended Posts

post-6563-0-06884800-1535277431.png

It is now 6 years since Chetiry was released in the AA homebrew store, and (until now) I have not made the source or ROM available publicly. The main reason is that the ROM image is not currently playable on either the Harmony cart or Stella emulator:

  • Chetiry uses an EEPROM chip inside the Hamony/Melody to store the music and high score data. On the Harmony, this chip is used for the menu system and would be overwritten.
  • Chetiry uses a custom bankswitching format (FA2) that is not yet emulated by Stella.

The audio code in Stella has recently been rewritten, and various people have asked if the ROM for Chetiry is available for testing. As a result, I have now decided to post it publicly in the hope that this will lead to support in Stella.

The files are as follows:

  • chetiry_NOEEPROM_NTSC.bin & chetiry_NOEEPROM_PAL.bin - These ROMS will work on Harmony and Stella but with no music or hiscore table.
  • chetiry_NTSC.bin & chetiry_PAL.bin - The full ROMS (they do not work in Stella or Harmony currently).
  • chetiry_tunes_img.zip - The image file for the Chetiry tunes (stored in the EEPROM).
  • chetiry_SRC.zip - The source code for Chetiry.

 

[EDIT: 10/21/2018]

Attached chetiry_NTSC_STELLA.bin & chetiry_PAL_STELLA.bin - thse binaries contain both the game and tune data.

[/EDIT]

 

 

Chris

chetiry_NOEEPROM_NTSC.bin

chetiry_NOEEPROM_PAL.bin

chetiry_NTSC.bin

chetiry_PAL.bin

chetiry_SRC.zip

chetiry_tunes_img.zip

chetiry_NTSC_STELLA.bin

chetiry_PAL_STELLA.bin

Edited by cd-w
  • Like 21

Share this post


Link to post
Share on other sites

Thanks for the release. Note that "chetiry_NOEEPROM_NTSC" and "chetiry_NTSC" will both partially work in Stella with the 'CTY' bankswitching scheme. The hiscore stuff will work in the latter one; only the sound is missing from both. But both are completely playable otherwise.

 

So the 'full' ROMs do work, just without the music.

  • Like 1

Share this post


Link to post
Share on other sites

So the 'full' ROMs do work, just without the music.

Hi Stephen

 

Thanks for clarifying - I knew you had done work on this, but was not aware CTY bankswitching was now available in Stella.

 

Chris

Edited by cd-w

Share this post


Link to post
Share on other sites

Yep, full ROM does work in Stella, just no music. Stella also does not auto-detect the CTY bankswitching, so you have to manually set that yourself. Instructions below for those who don't know how, note that you only have to set it once as Stella will remember that you changed it.

 

Chris has sent me the specs, I'll see about adding music support for CTY. Been a while since I worked on Stella so need to get the latest source, then refresh my memory on what goes where ;)

 

 

How to manually specify CTY bankswitching:

  1. Load the ROM as normal, you'll see a spinning square in the middle of the screen that never goes away.
    post-3056-0-74163600-1535292262.png
  2. Hit TAB
    post-3056-0-99012000-1535292265.png
  3. Click on Game Properties...
    post-3056-0-32792200-1535292269.png
  4. Change Type to CTY
    post-3056-0-02294500-1535292277.png
  5. Click OK
    post-3056-0-82083600-1535292347.png
  6. Click Exit Menu
    post-3056-0-99012000-1535292265.png
  7. Hit CONTROL-R on your keyboard to reload the ROM.
    NOTE: The spinning square will still show up, but will go away after a few seconds.
    post-3056-0-98844900-1535292282.png

    post-3056-0-21771300-1535292287.png
  • Like 1

Share this post


Link to post
Share on other sites

Chris, what is missing to get these working with music on Harmony?

Share this post


Link to post
Share on other sites

Have preliminary support in Stella for Chetiry's music.

 

attachicon.gifchetiry.mov

 

Spice, feel free to send me diffs if you don't want to deal with git; I recall you had 'issues' before :)

  • Like 1

Share this post


Link to post
Share on other sites

 

Spice, feel free to send me diffs if you don't want to deal with git; I recall you had 'issues' before :)

 

 

Will do. My initial pass was to copy over the music routines from CartDPC (the Activision one, not DPC+). Notes and such were different (one used ascending consecutive values, the other descending disjoint values), so I used a conversion table to get it working.

 

Since then I've been reviewing the CTY driver itself and can see the actual implementation is a bit different than how DPC was implemented, more like how DPC+ was done (but with only square waves). Also found the actual frequency values, so I'll be re-implementing it with that info.

 

Still to do is figure out how it transitions to a new tune, my guess at how it was done isn't quite right.

Share this post


Link to post
Share on other sites

Wow - I didn't know that there was a Tetris version for the 2600 that was this good! Thanks for releasing the ROM. :)

Share this post


Link to post
Share on other sites

I believe I have it finished, would like some Mac users try this and let me know if it sounds correct. If feedback is affirmative I'll send the changes to stephena.

Stella.6.0pre1_chetiry.zip

 

I modified the window's titlebar to include "Chetiry Music Test"

 

post-3056-0-12561800-1535511695_thumb.png

Share this post


Link to post
Share on other sites

It should sound better - the existing videos on YouTube were made with an earlier version of Stella. The sound has been improved considerably since then.

Share this post


Link to post
Share on other sites

In the main title screen music, the percussion is out-of sync. In the "chetiry-tunes" binaries Chris posted, it's correct.

Edited by Nathan Strum
  • Like 1

Share this post


Link to post
Share on other sites

Will the Chetiry ROM brick my Harmony Encore? I have the software to reflash it if necessary, but I'd rather not if I don't have to.

 

Thanks again for this release. I have played the GB ROM on my Harmony many times, as well as the full physical homebrew.

 

Cheers...

Share this post


Link to post
Share on other sites

Will the Chetiry ROM brick my Harmony Encore? I have the software to reflash it if necessary, but I'd rather not if I don't have to.

 

Thanks again for this release. I have played the GB ROM on my Harmony many times, as well as the full physical homebrew.

 

Cheers...

The first post says it is not currently playable on Harmony!

Why then would you even ask?

 

Mine stop working a lot, and I'm not even doing things I'm told won't work.

Reflashing makes Harmony work again.

 

You should be asking if you can flash the game to a Harmony or Harmony Encore and if will that work the same as the store cart.

You still need to reflash to turn a single game flashed Harmony back into an SD Harmony with menu.

Share this post


Link to post
Share on other sites

Will the Chetiry ROM brick my Harmony Encore? I have the software to reflash it if necessary, but I'd rather not if I don't have to.

 

Thanks again for this release. I have played the GB ROM on my Harmony many times, as well as the full physical homebrew.

 

Cheers...

The first post says it is not currently playable on Harmony!

Why then would you even ask?

 

Mine stop working a lot, and I'm not even doing things I'm told won't work.

Reflashing makes Harmony work again.

 

You should be asking if you can flash the game to a Harmony or Harmony Encore and if will that work the same as the store cart.

You still need to reflash to turn a single game flashed Harmony back into an SD Harmony with menu.

Share this post


Link to post
Share on other sites

In the main title screen music, the percussion is out-of sync. In the "chetiry-tunes" binaries Chris posted, it's correct.

I compared it with my cartridge version and didn't notice it, though it wasn't a side-by-side comparison. Is it off a lot? Percussion leading or trailing?

 

My suspicion would be the return tune position is off by 1. I took a quick look and see I forgot the & 0xFF, like was done for the random number, but that shouldn't matter as it occurs automatically when returning a short int value in an unsigned char function. Arrows point at the lines I'm talking about

      case 0x01:  // Get next Random Number (8-bit LFSR)
        myRandomNumber = ((myRandomNumber & (1<<10)) ? 0x10adab1e: 0x00) ^
                         ((myRandomNumber >> 11) | (myRandomNumber << 21));
-->        return myRandomNumber & 0xFF;
      case 0x02:  // Get Tune position (low byte)
-->        return myTunePosition;
      case 0x03:  // Get Tune position (high byte)
-->        return myTunePosition >> 8;


The tunes image doesn't do anything in Stella, looks to be the 28K file that gets put on the EEPROM.

Share this post


Link to post
Share on other sites

This 'tunes' data is what I was given many years ago. Perhaps it has changed in a subsequent release? Or perhaps I made a mistake in converting it to a C++ header file??

 

Or am I misunderstanding you, and that the tunes data isn't being used at all? Because if that's the case, we can remove it from the codebase entirely.

Share this post


Link to post
Share on other sites

I was originally going to create a new ROM with the game merged with the tune data, but then I noticed CartCTYTunes.hxx. I did a hex dump of the tunes.bin and compared it with the header file. The header appeared to match so I'm using it, though I didn't compare the entire file.

 

While the music is handled in the ARM code, the percussion's done by 6507 code updating TIA as normal (in bank5.asm). The ARM keeps track of music position, which the drum routine retrieves via TUNELO_R and TUNEHI_R (case 2 and 3 in my code snippet above). So if my routines in CartCTY.cpp don't return the same position values as the ARM code, the drums will be off.

 

  ; Drum Position
  lda TUNEHI_R            ; [10] + 4          <--- retrieve music position
  cmp #$FF                ; [14] + 2      Wrap Marker
  beq SkipDrums           ; [16] + 2/3
  lsr                     ; [18] + 2
  sta TEMP                ; [20] + 3
  lda TUNELO_R            ; [23] + 3          <--- retrieve music position
  tax                     ; [26] + 2
  and #%00000011          ; [28] + 2
  tay                     ; [30] + 2
  txa                     ; [32] + 2
  ror                     ; [34] + 2
  lsr TEMP                ; [36] + 5
  ror                     ; [41] + 2
  tax                     ; [43] + 2
  lda DrumTable,X         ; [45] + 4
  sta DPTR                ; [49] + 3

  sta WSYNC               ; [0]
  PLAY_MUSIC              ; [0] + 5

  ; Play Drums
  lda (DPTR),Y            ; [5] + 5
  beq SkipDrums           ; [10] + 2/3
  cmp #SLOW               ; [12] + 2
  beq SlowTempo           ; [14] + 2/3
  cmp #FAST               ; [16] + 2
  beq FastTempo           ; [18] + 2/3
  sta AUDF1               ; [20] + 3
  lda #8                  ; [23] + 2
  sta AUDC1               ; [25] + 3
  lsr                     ; [28] + 2
  sta AUDV1               ; [30] + 3
  jmp SkipDrums           ; [33] + 3
SlowTempo
  ldx #SLOWTEMPO          ; [17] + 2
  stx TEMPO               ; [19] + 3
  jmp SkipDrums           ; [22] + 3
FastTempo
  ldx #TITLETEMPO         ; [21] + 2
  stx TEMPO               ; [23] + 3
SkipDrums

  jmp EndTitleMusic       ; [36] + 3

Share this post


Link to post
Share on other sites

I have no issue with removing the tunes from Stella completely, and including it only with the ROM. This is likely the only ROM that will need the data, so it really belongs there. And as a side effect, it will allow to easily autodetect the bankswitch type.

 

Since the ROM currently isn't compatible with any other emulator or the Harmony, etc, we don't have to worry about breaking compatibility.

  • Like 1

Share this post


Link to post
Share on other sites

Sorry. I was too vague. I should've said that it was the youtube video on the Chetiry store page.

That's what I was referring to. I made that one (and one or two others) using an older version of Stella, recording the gameplay and music separately. Up until now, the only other videos of Chetiry would have been made by recording from real hardware, since the binaries weren't even available.

Share this post


Link to post
Share on other sites

I compared it with my cartridge version and didn't notice it, though it wasn't a side-by-side comparison. Is it off a lot? Percussion leading or trailing?

Not sure - I'll have to check again tonight. Seems to me it was trailing.

 

The tunes image doesn't do anything in Stella, looks to be the 28K file that gets put on the EEPROM.

Ah... I didn't actually check the tunes posted here. I assumed they were the same binaries that Chris sent me to make the video. That's what I was checking against.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...