Jump to content
iesposta

Mappy TIA Music Demo - enjoy!

Recommended Posts

Building on the "Flicker 5 colors from 3" topic: http://atariage.com/forums/topic/229091-flicker-5-colors-from-3/?p=3059920

 

I decided to do the gameplay music in TIA (stereo) to see how bad it sounds. (That, and I'm obsessed with all things Mappy. :P )

Turns out I think is very good, especially for the out-of-tune TIA sound. Only a few slightly-off notes and a few dropped notes in the entire piece. (By slightly-off I mean obvious sour notes, because almost all 2600 notes are out-of-tune to start.)

 

The music is about 1 minute 20 seconds.

Originally it took all of 4K, but through optimization I got the data down to 1,496 bytes!

 

This whole demo could be done in 4K, but I compiled it with DPC+ bank-switching, just because that it what I usually work in, and if I ever make this into a flickery-mess of a game, I'll probably use DPC+. The 2nd channel can be used for game sound because even off the tune still holds up.

 

I decided to try fading the notes with reducing the volume, and by "happy accident" got the ragtime tremolo (shaking volume)!!

 

You can look at the source code, but I optimize it this way:

Take out all the volume data and duration data. Those values can be fixed (or with volume, changed in program loops). That cuts the data in half.

Since the Control is mostly 12 (pure lower), I have both channels set to 12. When it needs changing to a 4 (or the few 1's), I do an if/then check. Since the Frequency can also be a value of 4, I replaced all the Channel 4's in the data with 42. That saves 200+ bytes. When it needs to be 0 (silent) I check for that also, just set the Control to 0 (silences everything better than setting volume to 0) and skip setting a frequency.

 

Then there are all those f'n zeros!!! More than 900 of them! More than half of the remaining data was 0's.

It is like you are always telling the sound channels to shut up over and over.

The final thing I thought up is a kind of pause check. If both channels are silent, twice, I replaced the 0,0,0,0 with 67 and set the Control to 0, the volume up (to reduce popping noise), and double the duration, and skip everything else.

 

(I guess you could reduce the data even more with finding the segments that repeat and have that data only once. It sounds like the first part repeats three times in the piece.)

Mappy_TIA_MusicTitleDemo_Stereo2015.bas.bin

Mappy_TIA_MusicTitleDemo_Stereo2015.bas

  • Like 10

Share this post


Link to post
Share on other sites

Well, two people liked my post.
No comments? That makes me think it is not so good.
I'm not whoring for praise, but if you like games with music, please reply with a comment, good or bad.

Code related, there were still too many freakin' zeros!
I found a few more double silent instances where the one measure ended with a pause and the next one stared with a pause.
Added single pause code. If both channels were to be silent I changed two bytes: 0,0 into one byte by checking for 62. That saved a further 100 or so bytes, even with the added if/then logic.
Removed some useless check code.
Fixed the noise at the end before it repeats. I'd left a 128 that was for a duration pause, but since those are now not in the data block that value was going to the sound registers.

Mappy_TIA_MusicTitleDemo_Stereo2015c.bas.bin

Mappy_TIA_MusicTitleDemo_Stereo2015c.bas

  • Like 1

Share this post


Link to post
Share on other sites

More coding tips!

Recovered a further 40-some bytes... how?

 

Review: My code now sets the sound Control to 12 with code to check the data for silence (0), check for sound Control 1, or the flag numbers I made up.

Flag numbers:

42 to change to sound Control 4

62 to silence both sound Control channels: AUDC0=0 and AUDC1=0

67 to silence both sound Control channels, twice

 

There are the same notes under sound Control 12 and sound Control 4.

To use Control 4 I use two bytes for a flag (42) and a value.

Searching and replacing those 2 bytes (flags and notes), changing them to 1 byte (the Frequency used is Control 12 because remember, the Control is set always set to 12) saved 40+\- more bytes.

 

No code attached because it sounds the same, just the data is smaller.

 

Next I may explore removing duplicated data, programming a way to play identical repeating sections of the song having the data defined only one time.

If I can't find a way to reset or point to areas using batari Basic's sdata command, I'll need to break the sdata up into just regular data statements. However, regular data statements can not be larger than 256 bytes.

The small bit of extra programming and additional data used should be offset by the huge savings of not having to duplicate large sections of song data.

Share this post


Link to post
Share on other sites

 

If I can't find a way to reset or point to areas using batari Basic's sdata command, I'll need to break the sdata up into just regular data statements. However, regular data statements can not be larger than 256 bytes.

 

 

 

Actually, regular data statements can be larger than 256 bytes but you can't reach more than the first 256 bytes in the normal

way.

Share this post


Link to post
Share on other sites

Actually, regular data statements can be larger than 256 bytes but you can't reach more than the first 256 bytes in the normal

way.

Interesting.

Do you know of any programs, scripts or websites that will find repeated patterns in data?

 

I'm just sort of manually hunting around.

Share this post


Link to post
Share on other sites

Third optimization rewrite using batari Basic's regular "data" statement (256 bytes max).

This allows splitting up the song and having data for repeated sections only once, saving ROM space.

 

Original song data in v, c, f, d: 8668 bytes

Current song data in flag c, f: 823

 

I found by searching manually the song can be broken into six sections.

The music parts are as follows: 1, 2, 1, 3, 4, 1, 5, 6

Part 1 is duplicated three times.

 

Parts 3 & 4 and 5 & 6 could not be combined into one data statement because combined they are larger than 256 bytes.

 

Same sounding song. Same demo. Just using less ROM.

 

Is this anything new? Am I just reinventing?

Yes and no. There are many ways to similar things.

 

Can the data be even smaller still?

I could save another 122 bytes of data.

Since the data is only a control and a frequency, one byte could hold a flag in its first two bits: 0, 1, 2 or 3 where you could set silence - control 0, buzz - control 1, pure high - control 4, pure low - control 12

The remaining six bits can hold a value from 0-31, which contain the values used for Frequency.

 

Audio file: https://www.dropbox.com/s/dzf75rgzcpcpdaa/Mappy2600-2016-04-16-21-48-29.m4a?dl=0

Mappy_TIA_Music_Demo_2015_data_method.bas

Mappy_TIA_Music_Demo_2015_data_method.bas.bin

  • Like 2

Share this post


Link to post
Share on other sites

My emulator is having issues, for some reason (not with your demo, just in general). Has anyone made a youtube video of this?

Share this post


Link to post
Share on other sites

I loved this game growing up. It was my favorite arcade game as a kid. Our bowling alley had it. I think I topped 200,000 once (recently on my DS version of course). Are you attempting to make an Atari 2600 version of it?

Edited by Sprybug
  • Like 1

Share this post


Link to post
Share on other sites

I loved this game growing up. It was my favorite arcade game as a kid. Our bowling alley had it. I think I topped 200,000 once (recently on my DS version of course). Are you attempting to make an Atari 2600 version of it?

I own a Mappy acade cabinet, so it is always in my head how to best make it for the 2600.

batari Basic DPC+ kernel allowed me to make the artwork.

The limitations of no horizontal scroll and my ultimate desire to use DPC+ music seem to keep me pushing it back. I'll probably only be happy after learning assembly.

I made this in December 2011 when I also began DK Arcade 2600.

med_gallery_29575_733_42190.jpg

 

The Bonus Round music also in DPC+ (press select after Frosty), although some report it doesn't play, it works fine for me.

Joystick 2 directions change waveforms. I like square waves for that arcade flavor.

00-MappyBonusMusic2600.bin

  • Like 2

Share this post


Link to post
Share on other sites

Looking (and sounding) good. One of my favorite games. I may have to break out my plug-in joystick with Mappy and 3 others on it. I would love a 2600 version, though.

Share this post


Link to post
Share on other sites

I own a Mappy acade cabinet, so it is always in my head how to best make it for the 2600.

batari Basic DPC+ kernel allowed me to make the artwork.

The limitations of no horizontal scroll and my ultimate desire to use DPC+ music seem to keep me pushing it back. I'll probably only be happy after learning assembly.

I made this in December 2011 when I also began DK Arcade 2600.

med_gallery_29575_733_42190.jpg

 

The Bonus Round music also in DPC+ (press select after Frosty), although some report it doesn't play, it works fine for me.

Joystick 2 directions change waveforms. I like square waves for that arcade flavor.

attachicon.gif00-MappyBonusMusic2600.bin

Awesome. DPC+ you so cool....Y U NO HORIZONTAL SCROLL!

I swear. It's the only thing holding me back from using it. I kinda need that in my games. There should be a way to implement it, but for some reason in development it's taken a back seat in Batari BASIC.

Share this post


Link to post
Share on other sites

Awesome. DPC+ you so cool....Y U NO HORIZONTAL SCROLL!

I swear. It's the only thing holding me back from using it. I kinda need that in my games. There should be a way to implement it, but for some reason in development it's taken a back seat in Batari BASIC.

 

Doesn't Stay Frosty 2 use DPC+? And it scrolls horizontally. I know it does it a screen at a time while Mappy IIRC keeps your player in the middle while everything scrolls around him. Would it be that hard to adjust this? If so, then the compromise would be to have the trampolines be the scrolling point between screens.

Share this post


Link to post
Share on other sites

Doesn't Stay Frosty 2 use DPC+? And it scrolls horizontally. I know it does it a screen at a time while Mappy IIRC keeps your player in the middle while everything scrolls around him. Would it be that hard to adjust this? If so, then the compromise would be to have the trampolines be the scrolling point between screens.

Yes, Stay Frosty 2 uses DPC+, but it's not DPC+ as you're understanding it.

 

DPC is the co-processor that David Crane developed for Activision. It makes some calculations significantly faster, such as updating the players (sprites), adds the ability for 3-voice music, and other things. It was used for Pitfall II. The market collapsed before they could use it for any other games.

 

The ARM chip in the Harmony/Melody cartridge emulates the DPC so it can play Pitfall II. Back in 2010 we decided to use the extra resources to expand upon DPC's abilities and came up with DPC+. The new features are even faster updating of sprites, better 3 voice music (the waveforms can be customized while the original DPC only used square waves), and even the ability to offload processing to the ARM chip in the Harmony/Melody. Games like Space Rocks and Stay Frosty 2 were written using 6507 assembly (not batari Basic) and DPC+ with ARM. If you'd like to learn more about that see my blog series DPC+ ARM Development.

 

Batari Basic has a DPC+ Kernel option. The DPC+ Kernel utilizes DPC+ to enable bB programs to do more than they can using the stock 2600 hardware. The confusion comes because people frequently shorten DPC+ Kernel in the bB forums to just DPC+.

Edited by SpiceWare
  • Like 1

Share this post


Link to post
Share on other sites

Thanks for explaining SpiceWare.

MAPPY on batari Basic using the DPC+ kernel would have too many compromises currently.

I know it could be so much better in DPC+ assembly.

I am not an assembly coder.

 

In Basic I have to give up 3 channel music from the DPC+. This game had a lot of music for an early arcade game. Although I was surprised at how good the old TIA music came out.

It would be worse without scrolling the way the arcade does.

Sime people even hate this kind of scrolling. It is also used in Jr Pac-Man.

 

Hopefully a new batari Basic kernel comes out some day that will have 3 channel music and stuff even more features in to use.

Share this post


Link to post
Share on other sites

Yes, Stay Frosty 2 uses DPC+, but it's not DPC+ as you're understanding it.

 

DPC is the co-processor that David Crane developed for Activision. It makes some calculations significantly faster, such as updating the players (sprites), adds the ability for 3-voice music, and other things. It was used for Pitfall II. The market collapsed before they could use it for any other games.

 

The ARM chip in the Harmony/Melody cartridge emulates the DPC so it can play Pitfall II. Back in 2010 we decided to use the extra resources to expand upon DPC's abilities and came up with DPC+. The new features are even faster updating of sprites, better 3 voice music (the waveforms can be customized while the original DPC only used square waves), and even the ability to offload processing to the ARM chip in the Harmony/Melody. Games like Space Rocks and Stay Frosty 2 were written using 6507 assembly (not batari Basic) and DPC+ with ARM. If you'd like to learn more about that see my blog series DPC+ ARM Development.

 

Batari Basic has a DPC+ Kernel option. The DPC+ Kernel utilizes DPC+ to enable bB programs to do more than they can using the stock 2600 hardware. The confusion comes because people frequently shorten DPC+ Kernel in the bB forums to just DPC+.

You beat me to the punch. Thanks. I was about to reply back that your game was written in Assembly. My assembly skills aren't good enough to pull off really any game which is why I use Batari BASIC, because I have almost 30 years of experience with BASIC in one form or another.

Share this post


Link to post
Share on other sites

Hopefully a new batari Basic kernel comes out some day that will have 3 channel music and stuff even more features in to use.

And more variables. :D

 

If bB DPC+ would ever get something like 48 more normal variables, I'll spend the rest of my life making DPC+ games. Of course, my games would probably suck, but at least they'd be bB DPC+.

Share this post


Link to post
Share on other sites

And more variables. :D

 

If bB DPC+ would ever get something like 48 more normal variables, I'll spend the rest of my life making DPC+ games. Of course, my games would probably suck, but at least they'd be bB DPC+.

We can only hope that batari takes it further, or someone steps up to extend it.

i was shocked to learn SpiceWare's games where the logic is done in the ARM that they use almost none of the system's 128 bytes of RAM. Am I crazy, or was it something like 8 bytes of system ram is used in Stay Frosty 2?

 

If some batari Basic features could be coded in C and run from the ARM it would free more RAM to be used for normal variables.

 

Then there must be a way to write code to use the 256 bytes of stack ram as variables, like some kind of transparent cache when you run out of actual variables it moves out variables not in use, then restores them when they come up again?

Share this post


Link to post
Share on other sites

i was shocked to learn SpiceWare's games where the logic is done in the ARM that they use almost none of the system's 128 bytes of RAM. Am I crazy, or was it something like 8 bytes of system ram is used in Stay Frosty 2?

Looks like 15 bytes:

 

EarlyHMjmp      ds 2
ElevatorHMjmp   ds 2

KernelCounter       ds 1

MMframe             ds 1
MMfireballX         ds 1
MMfireballRef       ds 1
MMcontroller        ds 1

WallTop             ds 1
AirLoopY            ds 1

Mode ds 1       ; 0 = menu, 1 = game
AAlogo ds 1     ; 0 = logo, 1 = menu

Sleep3 ds 1     ; dummy used for sleep where SLEEP 3 only slept for 2 in Stella
Sleep5 ds 1     ; dummy used for 2 byte SLEEP 5
We had an instances where a SLEEP 3 macro only slept for 2 cycles for some reason in Stella 3.9, so we did a STA Sleep3 to work around that. The RAM was only allocated with that name to make it clear why we were storing the A register. Same thing with Sleep5, which was used to give us a 5 cycle sleep in just 2 bytes by using DEC Sleep5. The SLEEP 5 macro would have used 3 bytes.

 

 

 

The release build of Space Rocks uses 7 bytes of ZP RAM.

EarlyHMjmp      ds 2
ScoreKernelCounter ds 1
Mode ds 1       ; 0 = menu, 1 = game, $80 = easter egg
EEframe ds 1;
Sleep5  ds 1    ; dec Sleep5 instead of SLEEP 5
TitlePosition:  ds 1    ; 0 = $30, $80 = $40
 
  IF DEBUG = 1
TimeLeftVB      ds 1
TimeLeftOS      ds 1
 ENDIF
It uses 2 additional bytes if compiled for debug. That's so it can display the Time Remaining for Overscan and Vertical Blank, something that's needed so you know how much ARM CPU time you're using as Stella doesn't emulate ARM cycles (it thinks any arm code runs in 0 cycles of 6507 time).
  • Like 1

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...