Playing Atari ST Music on the Amiga with Zero CPU

(arnaud-carre.github.io)

110 points | by z303 1 day ago

7 comments

  • anonzzzies 1 day ago
    I was in a Dutch demo group first for msx and then amiga, then dropped out of low level dev; the amiga coprocessors I still miss. I went to PC as everyone did and definitely at the beginning thought: what is this garbage??? We lived in the future and then it was taken from us for a while.
    • pjmlp 1 day ago
      Yeah, the closest you can get to those days is doing homebrew in something like PS3 cell units, or shader coding, which is kind of why shader competitions are so beloved in demoscene parties.
    • poulpy123 1 day ago
      I had an Atari ste and when I passed from the GUI os to msdos + windows 3.11, Inhaz the same reaction
    • weinzierl 1 day ago
      Same feeling. I often think of the 16-bit PC era as kind of the dark ages. Everything was weird, nothing made sense, elegance nowhere to be found. Things got a lot better again when 32-bit PCs came around and continued to improve with 64-bit.
    • ndsipa_pomu 1 day ago
      I don't know if the Amiga was ahead of its time or the PC was behind its time. AmigaOS was a pre-emptive multitasking OS whilst PCs had to wait for Windows NT/95.
      • abanana 1 day ago
        The release of Windows 95 was weird. There were PC users talking about how amazing Microsoft were, to have come up with all the things their marketing people were shouting about, such as pre-emptive multitasking and plug-and-play. Then all the Amiga (and Mac) users, completely underwhelmed, pointing out "we've had all these things for years, how has it taken so long?".
        • Keyframe 1 day ago
          Yeah. one thing is not like the other. While AmigaOS was pre-emptive, Mac System - 6-8 weren't. It was co-op. Everyone who used 6 and 7 can remember copying file meant you couldn't do anything else, and 8 got multithreaded support in Finder finally, but it was still co-op. At the time I used various platforms daily. Namely, AmigaOS, Mac System 6-8, IRIX.. the difference was obvious. IRIX and hardware of course being from the future, but at at least 10x the price.
        • gblargg 1 day ago
          Even Mac OS classic was just cooperative multitasking. Near the end it got some very limited pre-emptive capability, but most only usable to do calculations.
          • Findecanor 1 day ago
            As a Amiga and then Linux and Windows 95 user I remember being flabbergasted over a Mac in 1997 being completely unusable while it was formatting a floppy.
      • lproven 1 day ago
        Sort of both.

        > AmigaOS was a pre-emptive multitasking OS

        Yes, but without memory protection.

        > whilst PCs had to wait for Windows NT/95.

        While Windows 2 on an 8086 could pre-emptively multitask DOS apps, so long as they all fit into 640 kB at once. Windows/386 could do it in extended memory.

        The innovative thing in W95 was doing it to Win32 apps as well.

        OS/2 in 1987 or so could multitask OS/2 code on a 286.

        • bhaak 1 day ago
          >> AmigaOS was a pre-emptive multitasking OS

          > Yes, but without memory protection.

          That’s why it was so fast. :) Also surprisingly stable all things considered.

          • makapuf 15 hours ago
            I havent seen many desktop like workflows on it with several "big" apps open (and running cpu) at the same time, most ive seen was one software at a time or games. Cooperating with yourself is relatively easier, no ?
            • amiga386 5 hours ago
              Having used AmigaOS, Mac OS, RISC OS, MS-DOS and Windows in the 1980s, I can say that Amiga definitely had the smoothest experience. Even the most basic things like reading/writing a floppy disk could make all but AmigaOS unusable. I remember thinking about Windows 95 "why is the mouse pointer juddery? It should never be juddery!" when trying to run several things at once.

              The reason you don't see lots of "big" apps at once is because memory! RAM was expensive.

              If you run a CPU-bound task on AmigaOS, you can use ChangeTaskPri on it, and you can easily see the difference. At its default priority of 0, the mouse pointer is still smooth but other applications start to clam up and starting new things is slow. Reduce the priority to -1 and everything's full speed again. Raise the priority to 5 and you'll have trouble moving the mouse pointer. Raise the priority to 20 and the system hangs...

              I don't think you've truly experienced "cooperative" multitasking. Try RISC OS, which literally passes control around between applications and has to wait for them to give it back, unlike AmigaOS which will take it back from them. Any kind of error is an immediate modal window that stops the world. Accessing a disk stops the world. Pressing F12 on the desktop drops to a command prompt and stops the world. You can open a command prompt in a window but it runs at a fraction of the speed of the global command prompt.

            • bhaak 5 hours ago
              Remember that without memory protection everybody shares the same memory and everything is visible to every process. If a process doesn't release all their memory that memory leak will stay even if the process ended.

              Shared libraries were typically loaded only once into the system's single shared address space. Any process could potentially overwrite another task's memory or shared library state.

              I don't have my old setup ready but if I boot into Pimiga, I get about 60 task and processes running.

              If you literally mean "seeing" workflows, because of the small monitors back then, you usually didn't have open programs side by side. The Amiga allowed to have multiple screens that were basically a better version of virtual screens combined with fullscreen mode.

              Here is an example of somebody having Deluxe Paint open and the Workbench.

              https://retrocomputing.stackexchange.com/questions/24842/ami...

              The pinnacle of workflow design on the Amiga was of course ARexx which allowed applications to communicate through message ports and automation scripts.

      • smokel 1 day ago
        There were early multitasking operating systems starting with the 286, but for demos you'd typically use the entire CPU. Part of the magic was that video routines would run at an extremely constant 50 (or 60) Hz, perfectly in sync with the hardware. This, and color bleeding, resulted in a buttery smooth experience, that I still miss.

        One particular example of this experience was that you'd use "raster bars" to time the performance of your routines. If your main loop is synchronized with the vertical retrace, then switching the background color after a piece of code would show up in the margins of your screen.

        Animations were tuned to move in constant pixel offsets. All the anti-aliasing in the world cannot bring back the true demoscene spirit :)

  • rigonkulous 1 day ago
    This is such a delicious article for those of us who are 'retro-' computing enthusiasts. Made my Sunday cuppa shine!

    "In a way, this feature is similar to the YM2149 ADSR envelope. Not technically, but because both features are mostly ignored by Atari and Amiga programmers! :)"

    As an Oric-1/Atmos programmer, this line was especially juicy.

    Using PAULA's attached mode is so brilliant, btw. I love it when things of this nature are discovered, decades after the fact. We've had a few such revelations in the Oric world too, none as powerful of course at Orics' 1MHZ, but nevertheless, the shoulders of the Atari/Amiga giants are perilously within reach for the climb ..

    EDIT: Oh, COPPER and PAULA, paired at the bits. Such a great hack, this one ..

  • amiga386 13 hours ago
    Awesome!

    As an aside, the only code I know that uses Paula's attached mode (where one channel can modulate the volume or pitch of another) is the sound effect used in X-Copy.

    It sounds like this: https://youtu.be/2OG2tPx5gnU?t=22

    and the code that generates that sound is this:

        PLAY_SAMPLE ; a6=_custom, d0=zero for high-pitch sound, nonzero for low-pitch sound
                move.w  #$F00,d1        ; high pitch: period=$d00-$f00 if d0 == 0
                tst.b   d0
                beq.s   .high
                move.w  #$7700,d1       ; low pitch: period=$7500-$7700 if d0 != 0
        .high   lea     MODULO,a0
                move.w  #$200-1,d0
        .down   move.w  d1,(a0)+
                subq.w  #1,d1
                dbra    d0,.down
                move.w  #$200-1,d0
        .up     addq.w  #1,d1
                move.w  d1,(a0)+
                dbra    d0,.up
                ; set up channel 2; whatever words this plays will
                ; be written to the period register of channel 3
                move.w  adkconr(a6),-(sp)       ; save ADKCON state for later
                move.w  #ADKF_SETCLR!ADKF_USE2P3,adkcon(a6)
                move.l  #MODULO,aud2+ac_ptr(a6)
                move.w  #$400,aud2+ac_len(a6)
                move.w  #0,aud2+ac_vol(a6)      ; no volume (no actual sound wanted!)
                move.w  #$90,aud2+ac_per(a6)    ; change period every $90 ticks
                lea     SAMPLE,a0               ; set up channel 3 to play a simple square wave
                move.l  #$7f7f8080,(a0)         ; square wave: 127 127 -128 -128 ...
                move.l  a0,aud3+ac_ptr(a6)
                move.w  #2,aud3+ac_len(a6)
                move.w  #DMAF_SETCLR!DMAF_AUD2|DMAF_AUD3,dmacon(a6) ; turn on sound DMA
                moveq   #$40,d2                 ; start with volume = 64
        .vol    move.w  d2,aud3+ac_vol(a6)      ; write channel 3 volume
                move.w  #$600-1,d1              ; wait a bit
        1$      move.b  vhposr(a6),d0
        2$      cmp.b   vhposr(a6),d0
                beq.s   2$
                dbra    d1,1$
                subq    #8,d2                   ; repeat to fade
                bpl.s   .vol
                moveq   #0,d0                   ; stop sound
                move.w  d0,aud2+ac_len(a6)
                move.w  d0,aud3+ac_vol(a6)
                move.w  d0,aud3+ac_len(a6)
                move.w  #DMAF_AUD2!DMAF_AUD3,dmacon(a6)
                move.w  (sp)+,d0                ; restore ADKCON
                btst    #ADKB_USE2P3,d0
                bne.s   .keepon
                move.w  #ADKF_USE2P3,adkcon(a6)
        .keepon rts
                section 2,bss,chip
        SAMPLE  ds.w    2
        MODULO  ds.w    $400
  • bartread 1 day ago
    I never had an Atari ST so wasn't familiar with the details of how its sound chip worked. I did know it was a variant of the AY chip found in the ZX Spectrum +2A, which I did own for a brief period after several years of 48K+ ownership.

    However, it's only as a result of reading this article that I realised the chip is only capable of generating square waves and noise, whereas I'd been under the impression it had some slightly more advanced FM synthesis capabilities. That impression must have come from, decades later, listening to what people could squeeze out of the chip on various Spectrum demos on YouTube. Well, that and the fact that after the 48K beeper the 128K was never going to sound less than incredible. I might not even have had it for a year before switching to the (much less prone to go wrong) C64[0].

    Anyway, all of this to say: very interesting project, and I enjoyed the neat reversal trick with the attached voice to get the higher quality output out of Paula.

    [0] Actually the Spectrum -> C64 switch was more of a mixed bag than you might think - it wasn't, for example, like games on the C64 were all universally better. On the sound front, the C64's SID chip was a significant upgrade over the AY though, and certainly the most capable sound chip amongst 8-bit computers that I'm aware of. I really wish they'd crammed a SID chip into the Amiga alongside Paula. Or maybe even a dual SID with 6 channels for stereo output + Paula, but, alas... I'm sure it would have been cost prohibitive even if Commodore engineers had the idea at the time.

    • rbanffy 1 day ago
      > I really wish they'd crammed a SID chip into the Amiga alongside Paula

      This is something the Apple IIgs had. It had an extremely capable synthesiser with good graphics and performance capped so not to compete with Macs. It was a weird machine, a sharp contrast with the minimalistic Apple IIs that preceded, over complicated and trying to be too many things at once.

      For the same reason I prefer the design of the ST over the Amiga’s. Amiga made lots of assumptions about the use that ended up tuning it well to platform games and NTSC video editing, but nothing else.

      • bartread 1 day ago
        > Amiga made lots of assumptions about the use that ended up tuning it well to platform games and NTSC video editing, but nothing else.

        I think certainly it was used mostly as a games machine by most owners, but then again so was the Atari ST (at least amongst my cohort at school).

        As for tuning it well to games and video editing but nothing else... I don't agree.

        For a long time an Amiga 500 with 1MB RAM expansion and a 24 pin dot matrix printer was my main and only computer, and I did everything on it: word processing, CAD, music, graphics. It got me through both GCSEs and A-levels: all my coursework was written on it, all my compositions were done with MED and OctaMED, all the code for my maths courseworks was written on it, all the design work for my technology project, every essay, etc., and so it goes on. I was even still using it somewhat at university into the late 1990s as I didn't have the cash for a PC.

        You could do a lot with an Amiga, and there was a lot of software available to do all of it, along with plenty of hardware peripherials. The software side of things, well a huge library of applications in every category came within reach for cash strapped users later on when loads of formerly expensive software was being given away on magazine coverdisks. Sadly that also coincided with the decline[0] of the platform.

        Of course, I played games as well: who wouldn't?

        All of this you could also do on an Atari ST, although I'd argue that the Amiga had the better operating system. Regardless, it was all also basically unthinkable in any really serious sense on (most of) the previous generation of 8-bit machines.

        I think people are too quick to write off the 16-bit home machines of the late 80s and early 90s as toys when, in fact, by the standards of the time they were both powerful and affordable general purpose computers.

        [0] I won't say death because there's still a hardcore of dedicated users keeping the platform alive, as also for the ST.

        • rbanffy 21 hours ago
          The Amiga’s heavy focus on TV-friendly timings went deep into the specialised chips to a point it was difficult to upgrade without losing compatibility. Because of that lack of modularity Commodore had to spend more resources to develop improved machines than its competitors. It was not an obvious mistake then, and it’s not clear now what they could have done to better compete with PCs and Macs.

          They could have made much simpler “productivity Amigas” with plain VGA-like graphics to leverage its non gaming software market, at the expense of only having minimal graphics and sound support. There was, IIRC, one, made by a third party that lacked the Amiga chipset, but running the Amiga OS. If they could push something as cheap to make as a Mac LC, they’d have a much more attractive offering for businesses.

          • amiga386 4 hours ago
            I think you're missing the elephant in the room. The IBM PC existed. That was it, that's all that mattered. Nobody got fired for buying IBM. Every computer for "business" collapsed because the IBM PC was here.

            Macs only survived to the 1990s by hiding from the PC in a desktop publishing niche. Amigas and Ataris survived as games machines with multimedia capabilities. An Amiga that could not run Amiga games would basically be a Sun workstation. Businesses wanted IBM PCs.

            Also, the "compatibility" was a two-way street. Amiga games banged the hardware directly and did amazing things on hardware of the time because of it, but that meant hardware-level compatibility for anything which came next otherwise it'd be the Amiga that couldn't run Amiga games. MacOS software was told not to touch hardware directly but go through the OS, and they did that, and thus all MacOS software was slow and ugly, and Apple still jettisoned compatibility anyway once they moved into the 1990s and started changing underlying hardware to PowerPC.

            There's always the hypothetical that Commodore could have continued, but what really got them was that the nature of games changed. 3D was in, and they were still pushing 1980s arcade machine tricks. They weren't even thinking in that direction when along game Wolfenstein and DOOM pushing chunky pixels to VGA mode X, and the Playstation was just around the corner. I don't think just having a faster CPU, "VGA" and trying to appeal to business would have cut the mustard.

          • abanana 20 hours ago
            True, but "Amiga made lots of assumptions about the use that ended up..." seemed an odd way to phrase it, given that it was originally designed as a games machine, although the plans were expanded later in development.

            As I understand it, its custom chips were a brilliantly clever solution to a problem that existed at the time. It couldn't be called a mistake, because they couldn't see into the future. As a games machine, the Amiga ended up hamstrung by those same custom chips because they weren't the right architecture for Doom and all the 3D games that followed it. That made no difference to its productivity software though, did it?

            • rbanffy 6 hours ago
              > That made no difference to its productivity software though, did it?

              If you build productivity software you’ll prioritise platforms sold for businesses. If most of the units are sold to be used mostly for gaming, your target market gets very small.

        • TacticalCoder 14 hours ago
          > For a long time an Amiga 500 with 1MB RAM expansion and a 24 pin dot matrix printer was my main and only computer ...

          Same, with the dot-matrix printer too. I'd update and print my D&D character page on it. Kickstart 1.2 and 1.3 ROM switch mod. I also had a not-so-common 5"1/4 drive (but not the ultra-rare official Commodore one): just a a 5"1/4 drive used instead of the 3"1/2 stock one. The reasons being: 5"1/4 floppies were so much cheaper than 3"1/2 ones that after something silly like 40 floppies, the drive had paid for itself. And we had many games (sorry, backups). So many backups.

          > All of this you could also do on an Atari ST, although I'd argue that the Amiga had the better operating system.

          The better OS and the much better co-processors. The ST however had the MIDI port so the cool dudes back then would hook up their MOOG synths to Atari STs, not Amigas.

          Also the ST had the game "Sundog: The Frozen Legacy", from FTL (the company that'd then go on and make Dungeon Master). Legends. For whatever reason the Amiga didn't have Sundog: The Frozen Legacy.

          I'd do everything on my Amiga except play Sundog (I'd go the neighbors' house for that) and play Ultima IV and Ultima V (the C64 version was much better than the Amiga version, so I had an old C128D to play the Ultimas).

      • Braini 1 day ago
        Important fun fact, this synthesizer was an Ensoniq chip (ES5503 DOC), designed by Bob Yannes, the inventor of the SID chip. The IIGS was actually a cool machine, not very successful unfortunately.
        • rbanffy 1 day ago
          I wish it expanded on the //e hardware rather than becoming something else. I get the II video hardware was pushed to its limits and something better was needed, but the new video processor with an entirely different approach didn’t feel like a II. Fill-mode was cool, but I don’t remember it being used for anything other than demos. A blitter and sprites would have made more sense, as would colored text modes, redefinable character sets…

          The sound chip was so capable it contrasted with the rest of the machine.

      • rigonkulous 1 day ago
        I'd love to have a IIgs in my collection these days, its truly the pinnacle computer of its type and era.
        • rbanffy 1 day ago
          It’s not really an 8-bit computer, stuck in a weird place between the //e and the Macs. It kind of is a II, but only in a half hearted way, kind of a new Apple ///, but designed for graphics and sound, and nicer at pretending to be a //e. It’s not even the fastest II - that would be the //c+ - nor the last to be discontinued, which was the Platinum//e.

          It’s a nice machine, but I find it uninspired, a bit like the C128, which instead of improving the VIC II, added a VDP with garish RGBi colors. Both look like they tried to check all boxes and, in the end, made computers unable to follow on their immediate ancestors legacy. Both disappointed me because they could be so much more.

          • EvanAnderson 1 day ago
            I like the comparison to the C128-- I think I'll use that.

            I like both my IIgs and C128D. They largely serve the function of running everything the earlier machines in their line run, but neither is very exciting for bringing new capabilities to the line. Both suffered from developers being hamstrung by supporting the older machines because the new machines didn't have major adoption. The new features felt to be mostly unused.

          • Braini 1 day ago
            I actually never understood this, the C128 was a strange device (as you say like the IIGS). Was it really because Albert Charpentier left and then nobody was able to do a VicIII until much later (C65)?
            • rbanffy 21 hours ago
              Making a VIC III didn’t have to be magic. All it’d need would be a doubled clock and faster memory to keep up with a 2MHz or more 6502. Doubling the clock and memory speed would allow for an 80 column mode and higher resolution without requiring a separate VDP. Also, a couple separate palettes and a palette selector per character line wouldn’t be hard to implement.

              At the very least, the two video chips could support overlaying on composite and analog RGB output (because nice colours). The way it ended up was just silly.

          • rigonkulous 19 hours ago
            Oh darn, actually, I mixed up the IIgs with the //c+, which is the one I really want .. ;)
            • rbanffy 6 hours ago
              Same here. Neat, small, and ludicrously fast for an Apple II.
    • JetSetIlly 1 day ago
      > Well, that and the fact that after the 48K beeper the 128K was never going to sound less than incredible

      Some of the stuff people do with the 48k beeper is incredible though. Tim Follin's tunes for example are basically treating the beeper like a 1-bit DAC, with amazing results. https://www.youtube.com/watch?v=T42WuUpBuHE

      • bartread 1 day ago
        Yeah, when I had the 48K Speccy I bought this and a shoot em up called Chronos, which wasn't by any means an amazing game (not bad for the £1.99 or £2.99 I paid for it, mind), but it was blessed with incredible intro music, which I think might have been another Tim Follin special.

        It's not to say amazing results from the 48K beeper were impossible, but you had to work pretty hard for them, and you were definitely into wizardry territory.

        But, it's also true that the sound capabilities of the 128K machine were a big step up (also worth bearing in mind you had the beeper and the AY chip - you weren't losing the beeper).

      • selcuka 1 day ago
        Follin also experimented with using both the beeper and the AY chip at the same time:

        https://www.youtube.com/watch?v=F1e2MOeo5eU

        • bartread 1 day ago
          Aha - and as if by magic... yeah, I just mentioned that the 128K machine had both the beeper and the AY chip, and this is a great example of them in use together.
      • vasac 1 day ago
        And there was Wham! The Music Box if you wanted to compose music :).

        Here’s how it sounded on the original ZX Spectrum, equipped with only the beeper: https://www.youtube.com/watch?v=oNDVJLma-W4

        • bartread 1 day ago
          As rudimentary as it is that actually sounds a lot better than I was expecting, and I think as a kid in the 80s I'd probably have been happy with it.
  • indigodaddy 23 hours ago
    The demo linked at the bottom of the article:

    https://www.pouet.net/prod.php?which=104190

    .. could it be run on something like PiMiga?

    • snvzz 11 hours ago
      Should work. Amiga emulators have been decent for a while, accuracy-wise.
  • christkv 23 hours ago
    The no CPU Amiga demos was fantastic
  • Rpu-Micro 23 hours ago
    [dead]