CPCWiki forum

General Category => Other retro => Topic started by: carlc27843 on 11:01, 06 June 21

Title: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: carlc27843 on 11:01, 06 June 21
Here's a PICO-8 cart that uses the undocumented 5512Hz 8-bit mono PCM channel to emulate the AY-3-8910 sound chip from the Amstrad CPC.


https://carlc27843.itch.io/amstrad-chiptunes-1 (https://carlc27843.itch.io/amstrad-chiptunes-1)


It contains classic chiptunes that were either composed or converted to CPC by Dave Rogers:

As a long-time fan of many of these songs I thought the waveform visualization was a neat way to experience them with a new perspective.


(https://img.itch.zone/aW1hZ2UvMTAwNDA2NC81NzE2OTIyLnBuZw==/347x500/onhJpf.png)


The cart implements a superset of the sound drivers used in the games, each one disassembled to Z80 and reverse engineered and generalized to a common lua driver. The music data was converted to a common bytecode format.


Although of course these sound much better on a real CPC, the PICO-8 conversion did get Dave's seal of approval.  ;)  Hope you enjoy!



Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: TotO on 11:36, 06 June 21
Really nice work and design around this audio player tribute! :)

Now, I do not really understand what is an "undocumented feature" into a virtual machine.
Does the PCM is the result of the 4-CH mixer to produce the final mono analog sound (DAC) of the Pico-8?
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: Targhan on 16:25, 06 June 21
Really cool stuff :). Sound dirty but I like it! The EQ is really cool. Ohh, Ingame-marauder is missing! It cannot be, it's one of his best song!! :).
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: m_dr_m on 17:20, 06 June 21
@Targhan (https://www.cpcwiki.eu/forum/index.php?action=profile;u=110) No exactly 'his' song :)  https://www.youtube.com/watch?v=bq7Yu5WIKao
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: Targhan on 17:43, 06 June 21
Very true. I still prefer the CPC song :).
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: carlc27843 on 19:47, 06 June 21
Really nice work and design around this audio player tribute! :)

Now, I do not really understand what is an "undocumented feature" into a virtual machine.
Does the PCM is the result of the 4-CH mixer to produce the final mono analog sound (DAC) of the Pico-8?


Hi TotO, PICO-8 has a publicly published API (https://www.lexaloffle.com/pico-8.php?page=manual), but the author also snuck in several features without telling anyone. One feature was this extra channel that allows limited PCM-sample-based output (in addition to the documented 4 tone-based music/sfx channels). To find these secret features the community has to reverse engineer the PICO-8 binary itself. It's a fun way to recreate that feeling from the 80's where games got more sophisticated as the programmers learned more about the limits of the hardware.


It turns out that PICO-8's virtual CPU was also just powerful enough to emulate the Amstrad's PSG, drive the PSG registers with this higher level music driver and show the waveform visualization.


Interestingly PICO-8 also has an undocumented 128x256x32 color 2:1 widepixel graphics mode (only the 128x128x16 color square pixel mode is documented) which is similar enough to the CPC's mode 0 to allow some nostalgic game ports! There's also an undocumented 256x256x16 color mode so those mode 1 games don't feel left out.  :)

Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: TotO on 14:13, 07 June 21
OK, thank you for the explanation. But... What about the PICO-8 handled devices released around 5 years ago?
Does they support the undocumented features or only the PC virtual machine is compatible?


I have always loved the PICO-8 concept.
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: carlc27843 on 22:51, 07 June 21
That's a great question. I don't know the earliest PICO-8 version that this undocumented PCM channel was added to. However it's definitely in the latest version and binaries are supplied for Windows, Linux, OSX and Raspberry Pi. I've never run PICO-8 on a handheld but it looks like there are  (https://www.lexaloffle.com/bbs/?tid=41308)lots (https://www.lexaloffle.com/bbs/?tid=41736) of  (https://www.lexaloffle.com/bbs/?tid=31603)options (https://www.lexaloffle.com/bbs/?tid=38949). Some of them run on Raspberry Pi's - those would be the best bet for compatibility with all the latest features.


(There was an ARM version released many many years ago. I think the PocketCHIP (https://shop.pocketchip.co/collections/frontpage/products/pocket-c-h-i-p-new) uses it. I would not count on that one supporting the channel)
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: norecess on 22:56, 07 June 21
All songs in the compilation are amazing. :thumbup:

Interesting proposed variations of the AY ;-)
I like the sound it generates, even if it sounds different from the real machine.

Stormlord with the "broken sound" near the end of the song just before looping back to the main theme is a great sound experience  :)
Title: Re: Dave Rogers' Amstrad Chiptunes emulated on PICO-8
Post by: TotO on 23:02, 07 June 21
I don't know the earliest PICO-8 version that this undocumented PCM channel was added to. However it's definitely in the latest version and binaries are supplied for Windows, Linux, OSX and Raspberry Pi.
I'm asking that because I was thinking if it is more hidden improvements (like the second palette, ...) than hidden features from the begin.

Anyway, nice done!  :)