RTC as a sound chip / tone generator ?

Announcements, advice, random banter, unrelated discussion, et cetera.

RTC as a sound chip / tone generator ?

Postby Jo22 » 2018-7-06 @ 23:21

Hi, just stumbled over a datasheet of the Motorola MC146818.
That chip was used in the IBM AT -and- some PC/XT clones a long time ago.
(Source: http://www.lpjjl.net/pgm/fichiers/docasm/RTC.txt)

Originally, the PC/XT had no RTC, but could be upgraded with third-party RTCs (like the DS1216E),
in which case it required a little utility to sync the DOS clock with one of them.


What took my attention was the Programmable Square-Wave Output Signal.

Now I wonder - In the PC/AT, is that output connected to the PC Speaker, too ?
And if so, could it be used as a tone generator ?

If not, how was the alarm feature beeing used or implemented back then ?

Was this task up to the BIOS, DOS (ie, display alarm message, cause an interrupt, make beeps, etc.) ?


What do you think ?

Any thoughts welcome.
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 3035
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: RTC as a sound chip / tone generator ?

Postby Jo22 » 2018-7-12 @ 21:26

No ideas ? Come on, don't be shy! ;)
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 3035
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: RTC as a sound chip / tone generator ?

Postby vladstamate » 2018-7-13 @ 17:24

Jo22 wrote:Hi, just stumbled over a datasheet of the Motorola MC146818.
That chip was used in the IBM AT -and- some PC/XT clones a long time ago.
(Source: http://www.lpjjl.net/pgm/fichiers/docasm/RTC.txt)

Originally, the PC/XT had no RTC, but could be upgraded with third-party RTCs (like the DS1216E),
in which case it required a little utility to sync the DOS clock with one of them.


What took my attention was the Programmable Square-Wave Output Signal.

Now I wonder - In the PC/AT, is that output connected to the PC Speaker, too ?

No, it is not connected to the speaker.
Jo22 wrote:And if so, could it be used as a tone generator ?

I do not believe the frequency is high enough to do anything. Plus the timer chip in the XT and AT already do that. They are connected to the speaker and generate proper frequencies. What do you think the RTC can do more?

Jo22 wrote:If not, how was the alarm feature beeing used or implemented back then ?

Was this task up to the BIOS, DOS (ie, display alarm message, cause an interrupt, make beeps, etc.) ?

Correct, it was implemented via an interrupt. You program it with port 0x70 and 0x71 and you get an interrupt for when an alarm is happening. It was up to the BIOS or the OS (which could hijack that interrupt) to do everything else (messages, sounds, etc).
User avatar
vladstamate
Oldbie
 
Posts: 871
Joined: 2015-8-23 @ 01:43

Re: RTC as a sound chip / tone generator ?

Postby Jo22 » 2018-7-17 @ 11:42

Thanks a lot for your reply! :)
vladstamate wrote:[
Jo22 wrote:And if so, could it be used as a tone generator ?

I do not believe the frequency is high enough to do anything. Plus the timer chip in the XT and AT already do that. They are connected to the speaker and generate proper frequencies. What do you think the RTC can do more?

Well, I thought that RTC chip was a general-purpose clock module. Something that was used to build alarm clocks, too.
So I hoped that module was able to produce audible tones, just like an ordinary alarm clock or wristwatch would be able to.
All in all, this would have been interesting to experiment with. Even though if the PC speaker had been on par with that
tone generator or if it had been better, it would have had provided another audio channel. That's why I asked.

By the way, speaking of the PC speaker or more precisely, the i8253 PIT:
Do you know of other computer platforms that used it as a tone generator ? :confused:
I mean, platforms that made full use of it as a tone generator ?
From what I read, the PC speaker gets only one counter (counter 2 ?) for producing sounds.

The reason I ask, is, because I love chip tunes of all sorts, including simple tone generators (incl. 555 based ones)
and because I grew up with the Sharp MZ series, which included an i8253 "PC speaker", too. :blush:
Speaking of the Sharp MZ line, it seemed to have had more channels/counters dedicated to the speaker.
Please excuse my imprecise wording.. What I mean is the type of sound effect like used in DEFENDER.
I made a recording (bad, since the emulator is DOS based and uses speaker-passthrough) here.
The sound effects of the "attack wave completed" screen sounds not like a typical IBM PC-Speaker SFX.

Edit: Just made a new video. It shows the game running on a good MZ-800 emulator, with better sound support.
It's available here: https://youtu.be/ZrNZ7-jV8p4?t=100
Last edited by Jo22 on 2018-7-17 @ 12:11, edited 1 time in total.
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 3035
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: RTC as a sound chip / tone generator ?

Postby Scali » 2018-7-17 @ 12:09

Jo22 wrote:From what I read, the PC speaker gets only one counter (counter 2 ?) for producing sounds.


Yes, the PC speaker is connected to the 8255 PPI chip.
The 8255 can either control the PC speaker directly (you can toggle a bit to make the cone go 'in' or 'out'), or it can connect the PC speaker to channel 2 of the 8253 timer.
The timer then has two useful modes to generate sound: square wave and one-shot countdown.
Square-wave will obviously generate a square wave signal. The one-shot countdown allows you to create any waveform via PWM, so you can use it for sample playback.
Scali
l33t
 
Posts: 3618
Joined: 2014-12-13 @ 14:24

Re: RTC as a sound chip / tone generator ?

Postby Jo22 » 2018-7-18 @ 09:55

Thank you very much for the quick and precise explanation, Scali! ^^
I've always wondered about these details. For some reasons, other platforms sounded more melodic
to me when using the 8255/8253 speaker.

Even Windows 3.x platform. To name an example, one game that took my attention was
"Jiji and the mysterious forest" (not listed at Mobygames) when I was a kid at age 7 or so.
It's a naive little J-RPG. :blush:

Do you have any clue, perhaps, which technique is uses to produce such melodies ?
Any special combination of 8255 and 8253, or by using the WIndows timer, perhaps ?
- It doesn't sound like the typical BASICA game, Sierra AGI game or DOS game I know of.

I have recorded a video about it, since the other people on YT seemed to oversee
the fact that it used the speaker for background music (BGM).
https://youtu.be/LM8gPlANYCg
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//
User avatar
Jo22
l33t
 
Posts: 3035
Joined: 2009-12-13 @ 07:06
Location: Europe

Re: RTC as a sound chip / tone generator ?

Postby Scali » 2018-7-19 @ 09:56

Jo22 wrote:Do you have any clue, perhaps, which technique is uses to produce such melodies ?


Well, unless I missed something, it sounds like pretty standard 'beep' stuff to me?
So 8253 generating square wave, and using the PPI to turn the speaker on and off for each note.
Windows has the beep() API for that, perhaps that is what they use: https://msdn.microsoft.com/en-us/librar ... 77(v=vs.85).aspx
Then again, in Win16 they could program the hardware directly.
Scali
l33t
 
Posts: 3618
Joined: 2014-12-13 @ 14:24

Re: RTC as a sound chip / tone generator ?

Postby yawetaG » 2018-7-19 @ 18:16

Scali wrote:The timer then has two useful modes to generate sound: square wave and one-shot countdown.
Square-wave will obviously generate a square wave signal. The one-shot countdown allows you to create any waveform via PWM, so you can use it for sample playback.


If the two sound modes can be used at the same time, then you could use one mode's output to modulate the other one's output (like on many synthesizers).
yawetaG
Oldbie
 
Posts: 1125
Joined: 2016-6-14 @ 14:36
Location: Netherlands


Return to Milliways

Who is online

Users browsing this forum: Google [Bot], Scali and 3 guests