Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Tandy 1000 Soundchip revisited: ASM programming example

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
1,342
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 17, 2011

In this tool-assisted education video, I create an assembler program that plays back several favourite NES songs using only the 3-channel+noise PC speaker found in the Tandy 1000.

A month ago I demonstrated the 3½-channel PC speaker of Tandy 1000. You can see and hear it in this video: http://www.youtube.com/watch?v=e3L_Ceat4Ss
I wrote that example in GW-BASIC, but everyone was left hanging over the following problem: GW-BASIC has certain limits. You cannot reproduce fine vibrato of NES songs in it, because the PLAY statement is too coarse. You would have to do any serious music playing in the assembler language. What would a serious attempt sound like?
In this tool-assisted education video, I create, from scratch, an assembler program that plays back several favourite NES songs using only Tandy 1000 sound hardware.

Miscellania:
-- The OS that shows up in the beginning is Amiga Research Operating System, i.e. AROS for short. This is the first time that I feature an operating system that is fundamentally different from either Windows or Linux. (MS-DOS is not fundamentally different from Windows.)
-- The AROS desktop theme is the default one from the Icaros distribution. However, I used a custom 1232x700 resolution. To make that possible, I had to edit the VGA BIOS used by KVM, my virtual machine of choice. In retrospect, I made an error. I should have used 1272x720. I was aiming for an integer ratio of YouTube's 360p mode (so that it would look neat in 360p and in 720p), but somehow it changed into 350 in my head.
-- The music that plays in the movie (before the assembler program is finished) is played back through 8bitbubsy's high quality Protracker clone. Protracker was a very popular music creation tool for the Amiga, used by professionals and amateurs alike. You can find more information about that project at: https://sourceforge.net/projects/protracker/
-- The two MODs that play here on Protracker are: Capslock by Mick Rippon, and Phoenix by Groo/CNCD. Both gentlemen were very generous and happy to permit me to use their music from the 1990s in this video. Thank you!
-- This movie was a lot more work than I expected to produce. I created the assembler program (SND player) in less than a day, but creating the video for it took weeks. Let's just say, encoding a video with all the alpha-blended overlays and temporal blurring at 4240x2400 resolution takes anything from 8 to 30 hours per pass. And I had to redo it more than ten times, because of all kinds of reasons. It was quite exhausting. Oh, and I also had to write the tools that enable me to do those video tricks in the first place. I still don't own any video editing software other than those which I have made.
-- The video resolution in the source code editing is 848x480. I crafted the display mode very carefully to make pixels look sharp in YouTube's 480p mode while it being a widescreen mode. However, the actual editor ran in 416x936 (52x59) mode. I changed it into a two-column 848x480 with video editing magic. While editing the source code, I paid careful attention to how it would appear in the two-column mode. I chose the two-column mode for two reasons: To maximize the amount of onscreen context while the code was being written in order to minimize the disorientation when following the video; and to most effectively utilize the widescreen video area that I wanted to indeed use.
-- The video resolution while the SND player runs is 320x200. This is the standard CGA 40x25 text mode.
-- The video uploaded to YouTube had 4240x2400 resolution. As usual, I did all processing at this resolution. You can verify this by displaying the video in "Original" mode. At that resolution, the Protracker overlay is clearly readable at all times (assuming your display device supports that kind of resolution!), even when it's reduced into a small stamp in the corner of the editing window.
-- Intermediate stages of the videos were stored using the ZMBV codec. I found this codec wonderful for these purposes and nicely extensible. (Though I had to hack MEncoder to support encoding into that format.)
-- Please disregard the PT overlay that shows at 8:25 to 8:31. It was a postprocessing error. Considering the long time it took to encode the video each time, I was not looking forward to one more encoding pass and I let that error slip.
-- Because the code featured in this video was the longest so far of my videos, yet I had half the normal time to create it, I had to tweak my editing process to include new editing techniques that reduce the amount of typing. See if you can spot them. (Remind you, this is a tool-assisted education video. Even my editing is tool-assisted.) I also had to speed up the typing a bit, as well.

Drats, I think I hit YouTube's movie description length limit. More information (and source code) at: http://bisqwit.iki.fi/jutut/kuvat/programming_examples/tandysnd.html

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (Bisqwit)

  • Sounds good, and the code looks clean and good as always :-)

    Shame about the lack of triangle for the bass, can you somehow use a short triangle waveform based on periods, and use that? Or can't you send data that fast to the PC speaker controller?

  • @8bitbubsy All ways that would supposedly enable producing triangle wave would be the same methods that would enable any arbitrary PCM-like sound. I may cover PWM (the method that enabled playing MODs through the PCM speaker) in a later episode, but for now I won't touch it; in any case, it was CPU-intensive and out of question for Tandy 1000.

  • @Bisqwit Tandy's "PSSJ" chip, found in the later 1000-series systems, incorporates a SN76496-compatible megacell, but also includes a fourth sound channel option with selectable pulse width and waveshapes (pulse, ramp, triangle). In addition, the PSSJ allows for frequencies as low as 54.62Hz. Would be interesting to see if either feature can be incorporated into your program. Check out the 1000 TL Technical Reference guide for more information (search for "tvdog tltech.zip").

  • @Cloudschatze Thanks for the feedback! Unfortunately, DOSBox, the PC emulator in which I recorded this video, does not support the PSSJ chip, so I have no way of testing it or record its output, even if I figured out how to program that chip.

Video Responses

This video is a response to Tandy 1000 and 3-channel PC speaker
see all

All Comments (9)

Sign In or Sign Up now to post a comment!
  • @Bisqwit Actually, it wasn't out of the question -- I've personally output 4-bit PCM audio by altering the volume register at 8KHz on a Tandy 1000.

    Getting this to happen with other things going on, yes that's more difficult, but not impossible. You might have to precompile your music.

  • Awesome

  • @8bitbubsy Oh hi bubsy.. it's a small internet :P

  • Nicely done! The tunes sound like they are coming right out of the real thing.

  • Ahh I see, I read some of the comments in the asm now, mentioning the high lower limit of the sound chip. :/

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more