Topic: Ideas for a ZX Beeper Sound Card

(discussion split off from the Sleizsa Trio thread)

About a beeper card, would it perhaps make sense to make it Atmega based? I think it might help the popularity of such a device if it could be build from "standard household appliances", eg. Arduino. On the other hand, a Z80-based card could be made in a way that it would run Spectrum beeper engines without adaptation, which would be a big bonus, too. Not sure what's the better approach.

Re: Ideas for a ZX Beeper Sound Card

(we probably should cut this into another thread)

For a beeper card, either way it needs a CPU/MCU, SRAM (32-64K), and some interface to the Spectrum bus. AVR is way more powerful than Z80, but totally different too, so all existing engines and trackers wouldn't be much of use. I personally would like to have a card that allows to put our existing achievements into use.

It is possible to actually emulate Z80 on AVR, but not sure if such approach provides an advantage. There are AVR-based AY-3-8910 emulators around, with AVR being able to also handle interfacing without external components (besides the normal AY decoding logic), so maybe that's the advantage. Basically it should be just two big chips, AVR and SRAM, and a little bit of 74xx logic, with the difficult part being the Z80 emulation code. But it has been done too, with sources. So maybe that's time to actually try to do such thing, as now there are things that can make it possible without putting too much effort.

Going to be a lot of wiring, though, and an AVR with tons of pins is needed. Like, 15+8+8+3+1=35 pins (32K SRAM address, SRAM data, Spectrum data bus, Spectrum bus control signals, output). So smaller Arduinos is out of question, only large ones, such as Mega2560. have enough pins.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

3 (edited by garvalf 2017-02-01 22:52:24)

Re: Ideas for a ZX Beeper Sound Card

a z80 chip driven by an arduino? (it that's possible)
Isn't it possible to use a shift register to reduce the number of needed pins?
Just out of topic, about an ay-3-8910 emulator + arduino, I've built one from http://www.avray.ru/ and it's really cool, you can stream music from an sd card and it sounds great so far. (The emulator itself is on an atmega8 chip, and this chip is driven by a regular arduino)

This Sleizsa trio is sharp as a metal blade wink

I've converted my Sleizsa Duo tune to this one: https://soundcloud.com/garvalf/danse-dhiver (I'll record the Duo version as well in the future)

Re: Ideas for a ZX Beeper Sound Card

Ok Shiru, you've convinced me of the benefits of a card that run standard beeper engines. Well, maybe Arduino is not such a good idea, after all - using a large Ardunio as the base of this might drive up the costs too much. I mean how much would people be willing to spend on this? 30€? Maybe 50 if it includes a joystick interface?

Either way I know very little about these things, so I'm afraid I can't be of much help.

5 (edited by Shiru 2017-02-06 17:48:59)

Re: Ideas for a ZX Beeper Sound Card

The issues with Arduino: either a large one needed, like Mega2560 ($10-15), or the normal one with more glue logic (extra latch chip, more wiring). Either way, an SRAM chip is needed, plus some 74xx glue logic. Another issue is that such a thing has to be written in AVR assembly code, to gain enough speed (Arduino normally running at 16 MHz, so just ~4 AVR instructions per Z80 cycle), while the Arduino IDE simply not designed to write assembly code. It is possible, but the syntax is horrible. Can be worked around with a tool that would translate normal AVR assembly to the Arduino syntax, but this kind of defies the main idea behind Arduino's popularity that you can easily read and modify the sketch code.

Emulating Z80 with an MCU, such as AVR, still does provide some benefits. For one, real Z80-based system would also need a boot ROM with communication routines, and communication process would take Z80 time, i.e. communication run on Z80. Emulated system can do communication process fully transparent, keeping engine code very simple and allowing to modify its parameters (any RAM value) at any time from the outside.

I think a good start would be writing a Z80 emulator that would emulate AY files off the internal ROM (to avoid hooking up the external RAM yet). Then it can be developed into actual device. I'll think about it.


On an not very related note, utz, i'm sure that after you managed to do so many amazing engines, and figure out the TI calcs stuff, you'll be able to figure out the Arduino stuff in no time. It is very simple, actually, All you need is to get Uno or something, and connect a speaker. Maybe you'll think up something cool to do with it. I haven't, because the thing is too powerful to just write conventional beeper engines - it has enough oomph to generate high resolution video signal purely in software, not to mention good fidelity multichannel audio.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: Ideas for a ZX Beeper Sound Card

I've actually done some AVR code before, it is indeed a very easy chip to code on. I also have a SeinSmart Uno (Chinese Arduino knock-off) laying around somewhere, and I have an asm programming toolchain installed (Arduino IDE is indeed useless for that), though I can't remember what the actual commands for it were.

In any case, I think Z80 emulation on a 16MHz AVR would be tricky, but possible, albeit not without cutting some corners. I think main challenges will be instruction decoding, and dealing with the AVR's big-endianness. I would suggest:

- Emulation of 4 MHz clock speed instead of 3.5, easier to emulate the correct cycle count like that
- Cut all interrupt-related stuff. This would break SpecialFX and Savage, but I think the benefits far outweigh this. Actual interrupts should be handled outside of the Z80 emulation.
- No R register auto-update.
- No emulation of 5,H,3,N flags and MEMPTR.
- DAA replaced with NOP (would break wtbeep, but oh well)

In any case, I would be willing to work on an AVR Z80 emulation. However, I currently have several other ongoing projects that I want to finish first (MDAL, mainly - made some good progress last month but there's still a few major features missing, such as multi-track sequences, "virtual" sequences, and sample support).

Re: Ideas for a ZX Beeper Sound Card

The thread to end all threads. Reading with utmost interest.

Re: Ideas for a ZX Beeper Sound Card

Not sure if Shiru has developed this idea any further yet. He's done a few ports of ZX beeper engines though, as you've probably seen. I've mostly been busy working on MDAL myself, though I've also done a Z80 emulation core in the meantime (not for AVR though, just a C++ experiment to see if I could pull it off in general). I'm sure we'll come back to this at a later point though.

Re: Ideas for a ZX Beeper Sound Card

Cool. I'll keep an eye out on this thread.

Looking at MDAL now...

Re: Ideas for a ZX Beeper Sound Card

I didn't have enough time yet to devote it to this idea, but I'm definitely want to work on it sometime.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

11 (edited by mark_lyken 2017-05-24 07:58:31)

Re: Ideas for a ZX Beeper Sound Card

Ace!

You guys probably know of this but Victor Trucco mentioned OSH (community printed circuit boards) for low costs boards.

Could be useful futher down the line.

https://oshpark.com