BEEP VAL

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
1024MAK
Manic Miner
Posts: 533
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: BEEP VAL

Post by 1024MAK » Tue Jul 16, 2019 10:09 pm

You’re forgetting that Sinclair wanted cheap and simple...

Why provide extra hardware when the CPU can bit-bash a single bit (pin) controlled by software?

At the time, software solutions were cheap compared to hardware. The RS232 serial port on the Interface 1 is the same. As are the network ports. Even the RS232 serial port on the 128K toastrack uses the Z80 bit bashing the I/O pins.

Back to the sound generation. Of course, given more silicon “real estate”, an auto presetable counter could have been used.

Mark
1 x

AndyC
Manic Miner
Posts: 251
Joined: Mon Nov 13, 2017 5:12 am

Re: BEEP VAL

Post by AndyC » Wed Jul 17, 2019 7:49 am

1bvl109 wrote:
Tue Jul 16, 2019 4:39 pm
1024MAK wrote:
Mon Jul 15, 2019 5:29 pm
BEEP uses the ULA / gate array and is available on all ZX Spectrum models.
I wondered, why, if the Z80 has to produce the sound anyway and execution of BASIC had to been stopped for that purpose, the didn't they use pwm. Maybe this would not have worked to well for higher frequencies, but still.
If audio quality had been seen as important, they would have stuck an actual sound chip in it. The simple ability to make some noise at low a cost as possible met their own low bar.
1 x

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: BEEP VAL

Post by 1bvl109 » Thu Jul 18, 2019 12:07 pm

1024MAK wrote:
Tue Jul 16, 2019 10:09 pm
You’re forgetting that Sinclair wanted cheap and simple...
Well I don't know, how much space the ULA actually offered, but some things seem to be caused more by rushed-to-the-market then by we-can-t'afford-the-hardware.
1024MAK wrote:
Tue Jul 16, 2019 10:09 pm
Why provide extra hardware when the CPU can bit-bash a single bit (pin) controlled by software?
All you would need is a latch for 3 to 4 bits more. Now I'm no expert in chip design, but a gated SR-latch https://en.wikipedia.org/wiki/Flip-flop ... d_SR_latch uses 4 NAND-gates, each using 2 transistors and 1 resistor https://en.wikipedia.org/wiki/NAND_gate
A n-R-2R ladder uses 2*n resistors. There they really not able to afford that? I tend to rather disbelieve this, because it fits to well. Maybe they really could not afford the hardware for 3 to 4 more bits, but every bit would have helped.

I remember games with speech synthesizing, Ghostbusters anyone? It was not that great. By combining pwm with a DAC, i.e. doing sounddithering you should be able to achieve a much better quality for lower frequencies. For higher you can't hear the harmonics anyway. Possibly because the human ear was also developed by thrifty Sinclair. Evolution should have invested in the Apple version.
1024MAK wrote:
Tue Jul 16, 2019 10:09 pm
At the time, software solutions were cheap compared to hardware.
I'm trying to follow that spirit as close as possible. The workload here is still on the Z80, especially if you want to do dithering. It might not even be possible for that reason.
1024MAK wrote:
Tue Jul 16, 2019 10:09 pm
Back to the sound generation. Of course, given more silicon “real estate”, an auto presetable counter could have been used.
Sure. Trying to save CPU-power would be the other way to go.
0 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: BEEP VAL

Post by 1bvl109 » Thu Jul 18, 2019 12:20 pm

AndyC wrote:
Wed Jul 17, 2019 7:49 am
If audio quality had been seen as important, they would have stuck an actual sound chip in it. The simple ability to make some noise at low a cost as possible met their own low bar.
But concerning pwm the investment would be only in software. What I'm saying is, they are not squeezing the max out of the lemon of cheapness.
0 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: BEEP VAL

Post by 1bvl109 » Thu Jul 18, 2019 12:23 pm

1bvl109 wrote:
Tue Jul 16, 2019 4:39 pm
I wondered, why, if the Z80 has to produce the sound anyway and execution of BASIC had to been stopped for that purpose, the didn't they use pwm.
Umm sorry. This should of course read ... why didn't they use pwm.
0 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

User avatar
ZXDunny
Manic Miner
Posts: 250
Joined: Tue Nov 14, 2017 3:45 pm

Re: BEEP VAL

Post by ZXDunny » Thu Jul 18, 2019 1:20 pm

1bvl109 wrote:
Thu Jul 18, 2019 12:07 pm
Well I don't know, how much space the ULA actually offered, but some things seem to be caused more by rushed-to-the-market then by we-can-t'afford-the-hardware.
I don't think you quite "get" what Sinclair did, and how they operated back then. It wasn't a case of "rush to market" at all. It was "can we do this cheaper? And what level of capability can we get away with?" which explains how the beeper came to be. After the ZX81, any sound at all was a welcome addition.

It was the same for colour. Adding 16 colours, but as cheap as possible, corners cut with BRIGHT and FLASH to save costs and reduce memory footprint.
1 x

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: BEEP VAL

Post by 1bvl109 » Thu Jul 18, 2019 5:11 pm

ZXDunny wrote:
Thu Jul 18, 2019 1:20 pm
It was "can we do this cheaper? And what level of capability can we get away with?" which explains how the beeper came to be.
"... what level of capability can we get away with?" is exactly what I'm talking about. You could have impressive sound for cheap. No external alteration, only some more gates in the ULA needed. This could increase the number of costumers we appeal to. Why not take it?

Leaving the ULA alone, you could have not so impressive, but still more flexible sound for a ROM routine and a system variable using pwm.

On the other hand, the speaker was surely nice to have but required more hardware and seemed superfluous if you had some recorder or radio, those amplifier you could use.
ZXDunny wrote:
Thu Jul 18, 2019 1:20 pm
After the ZX81, any sound at all was a welcome addition.
Sure. I bought an AY-3-8912 board. It had the additional advantage of providing a Kempston Joystick on the spectrum, if you knew how to solder the 9-Pin D-Sub. However personally I found it to be inferior to an 8255 PIO WITH R-2R even if using only one of the three bytes. Of course you needed quite some help from the CPU, but it was great for things like a drum machine.

100 CLEAR 32767
110 FOR I=0 TO 1023
120 POKE 32768+I,127+127*RND*EXP(-I/300)*SGN(RND()-0.5)
130 NEXT I

IIRC writing this 1k to the DAC produced some nice "hammering-on-metal plates"-sound.

First I used a commercial 8bit DAC by Ferranti, but it was precise only up to 4 bits. Never knew what I did wrong. R-2R worked like cake. I didn't even need 1% precision resistors, because higher tolerance actually were better than described on the can.

I was told 8255 were already discontinued for more intelligent PIOs, but got back into production with the rise of the PC. Anyway they were dirt cheap already when the ZX81 came out.
ZXDunny wrote:
Thu Jul 18, 2019 1:20 pm
It was the same for colour. Adding 16 colours, but as cheap as possible, corners cut with BRIGHT and FLASH to save costs and reduce memory footprint.
I suspect that FLASH was there to transfer cursor-flashing to hardware. I would have prefered a second bright bit. One for foreground, one for background. And gray instead of bright black, which sounds like positive zero.
Ok, it enabled the nice Manic Miner intro screen trick, but how many programmers would actually miss it?

Also: https://en.wikipedia.org/wiki/Timex_Sinclair_2068 managed 2 colours per 1 byte instead of 2 per 8. In 1983. The memory footprint of the screen was 12K, so it even could have been done with a 16K. I never understood, why the 128k didn't make us of this. The ULA was already there. Couldn't they reach an agreement with Timex?

And I would have preferred a second Z80A instead of an AY-3-8910, making it the first dual core home-computer in history. I would have been mesmerized. Anyone else? Count of hands please.
0 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

AndyC
Manic Miner
Posts: 251
Joined: Mon Nov 13, 2017 5:12 am

Re: BEEP VAL

Post by AndyC » Thu Jul 18, 2019 5:29 pm

1bvl109 wrote:
Thu Jul 18, 2019 5:11 pm
ZXDunny wrote:
Thu Jul 18, 2019 1:20 pm
It was "can we do this cheaper? And what level of capability can we get away with?" which explains how the beeper came to be.
"... what level of capability can we get away with?" is exactly what I'm talking about. You could have impressive sound for cheap. No external alteration, only some more gates in the ULA needed. This could increase the number of costumers we appeal to. Why not take it?

Leaving the ULA alone, you could have not so impressive, but still more flexible sound for a ROM routine and a system variable using pwm.
Even a software solution costs in terms of programmer time and, potentially, ROM space. Sinclair were so cheap and on such a tight schedule they didn't even get all the Interface 1 code into the ROM as they had originally planned. The Spectrum didn't need impressive graphics or sound, it just needed to be a viable step up from the ZX81. They had been producing a new model on a yearly basis, they could always do things better in the "ZX83" - the Speccy was never envisioned as staying around even half as long as it did.
2 x

User avatar
ZXDunny
Manic Miner
Posts: 250
Joined: Tue Nov 14, 2017 3:45 pm

Re: BEEP VAL

Post by ZXDunny » Thu Jul 18, 2019 5:37 pm

1bvl109 wrote:
Thu Jul 18, 2019 5:11 pm
I was told 8255 were already discontinued for more intelligent PIOs, but got back into production with the rise of the PC. Anyway they were dirt cheap already when the ZX81 came out.
But it would have pushed up costs. Adding any extra hardware would have pushed up manufacturing costs. So it was never going to happen. This was a computer done as cheap as possible but still, as has been pointed out, a recognisably better ZX81.

And besides, Sinclair didn't add anything. We can't go back and change it so there's no real point to this.
1 x

User avatar
1bvl109
Dizzy
Posts: 52
Joined: Tue Jun 04, 2019 8:00 pm

Re: BEEP VAL

Post by 1bvl109 » Thu Jul 18, 2019 5:55 pm

AndyC wrote:
Thu Jul 18, 2019 5:29 pm
Even a software solution costs in terms of programmer time and, potentially, ROM space.
Of course.
Same for the ULA modification. Even if there is space, you have to do the work, to fill it.
AndyC wrote:
Thu Jul 18, 2019 5:29 pm
Sinclair were so cheap and on such a tight schedule ...
"Tight schedule" elsewhere known as "rushing to the market". I don't criticise that as such, it isn't necessary a bad thing. Of course there are limits. Companies have failed, because the market was sucked dry by an inferior product which was readily available. I'm only referring to what an improvement would cost compared to the benefits, from a purely technical perspective without regard for the success of the whole project.
AndyC wrote:
Thu Jul 18, 2019 5:29 pm
... they didn't even get all the Interface 1 code into the ROM as they had originally planned.
Interesting. I never header about this. What ROM are we refering here to?
AndyC wrote:
Thu Jul 18, 2019 5:29 pm
The Spectrum didn't need impressive graphics or sound, it just needed to be a viable step up from the ZX81.
Sure, I somewhat greater step wouldn't have hurt though.
AndyC wrote:
Thu Jul 18, 2019 5:29 pm
They had been producing a new model on a yearly basis, they could always do things better in the "ZX83" - the Speccy was never envisioned as staying around even half as long as it did.
Fair enough. However I'm not satisfied with the 128k either.

My theory is that the ZXs should appeal to hackers. And to gamers, i.e hackers who do games. So hackers it is. They like things which are transparent, pushed to the limit and extendable.
0 x
"Truth would quickly cease to be stranger than fiction, once we got used to it." - H.L. Mencken

Post Reply