
What’s up with the Beep driver in Windows 7? (2010) - gus_massa
https://blogs.msdn.microsoft.com/larryosterman/2010/01/04/whats-up-with-the-beep-driver-in-windows-7/
======
ChuckMcM
That is a pretty awesome tour de force. Somewhere deep inside your computer is
an (emulated) PC/AT trying to get out :-).

An interesting lesson about the use of 'beep' for the assistive technologies.
I see those sorts of things in architectures which have grown up over time and
I wonder whether or not you could know at the time "Hey we're using this weird
thing, please deprecated at your earliest convenience" or if it was more
"there I fixed it."

Compatibility at the GPIO level was so ingrained in the PC community early on
(there was even a code name for it, "Is it FlightSim compatible?" which
referred to Microsoft Flightsim, a game that tested the compatibility limits
of clones.) So as a tenet to the community all sorts of hacks could be
committed in its name. Something like "Well we can depend on this, if they
changed it then it would break compatibility and they can't do that."

Also an interesting take on how much Microsoft has had to unwind in a
compatible way over the years.

Finally, the Linux console used to beep the speaker this way (I have no idea
if it still does) and sometimes when I lay there sleeping I would hear my
server softly feeping, yes feeping on its console bell. Sadly it wouldn't stop
until I got up and logged in and figured out what was complaining.

~~~
vanderZwan
> Also an interesting take on how much Microsoft has had to unwind in a
> compatible way over the years.

It's very much self-inflicted technical debt. From a Spolsky on Software
article from 2004:

> _Raymond Chen is a developer on the Windows team at Microsoft. He 's been
> there since 1992, and his weblog The Old New Thing is chock-full of detailed
> technical stories about why certain things are the way they are in Windows,
> even silly things, which turn out to have very good reasons._

> _The most impressive things to read on Raymond 's weblog are the stories of
> the incredible efforts the Windows team has made over the years to support
> backwards compatibility:_
    
    
        Look at the scenario from the customer's standpoint. You bought programs X,
        Y and Z. You then upgraded to Windows XP. Your computer now crashes
        randomly, and program Z doesn't work at all. You're going to tell your 
        friends, "Don't upgrade to Windows XP. It crashes randomly, and it's not 
        compatible with program Z." Are you going to debug your system to determine 
        that program X is causing the crashes, and that program Z doesn't work 
        because it is using undocumented window messages? Of course not. You're 
        going to return the Windows XP box for a refund. (You bought programs X, Y, 
        and Z some months ago. The 30-day return policy no longer applies to them. 
        The only thing you can return is Windows XP.)
    

> _I first heard about this from one of the developers of the hit game
> SimCity, who told me that there was a critical bug in his application: it
> used memory right after freeing it, a major no-no that happened to work OK
> on DOS but would not work under Windows where memory that is freed is likely
> to be snatched up by another running application right away. The testers on
> the Windows team were going through various popular applications, testing
> them to make sure they worked OK, but SimCity kept crashing. They reported
> this to the Windows developers, who disassembled SimCity, stepped through it
> in a debugger, found the bug, and_ added special code _that checked if
> SimCity was running, and if it did,_ ran the memory allocator in a special
> mode in which you could still use memory after freeing it.

> _This was not an unusual case. The Windows testing team is huge and one of
> their most important responsibilities is guaranteeing that everyone can
> safely upgrade their operating system, no matter what applications they have
> installed, and those applications will continue to run, even if those
> applications do bad things or use undocumented functions or rely on buggy
> behavior that happens to be buggy in Windows n but is no longer buggy in
> Windows n+1._

[http://www.joelonsoftware.com/articles/APIWar.html](http://www.joelonsoftware.com/articles/APIWar.html)

~~~
temac
Well, an update is needed: the Windows testing team _was_ huge. Now, if they
remark at all a program has a problem, it will just be silently uninstalled
during the next major Windows upgrade.

~~~
ntauthority
The answer to that question is a lot less obvious than one would expect.

Windows installation upgrades (hereafter "migration") have been blocking setup
if a known-incompatible program[1] is detected during installation, telling
the user to uninstall it prior to allowing the upgrade to continue.

For Windows 10, the goal was to make the migration process (which would take
~40 hours to gather/apply on a typical system from Vista -> 7, the same
process takes 20 minutes to an hour on upgrades to modern 10 nowadays) a lot
faster, and a lot more seamless, as to get as many users as possible on the
latest OS release to reduce effort supporting other software versions[2] and
such.

Of course, blocking the installation with a known-incompatible program would
result in popping up to the user, say, 'hi, this update can't install until
you uninstall this program. please do so!', and they of course will respond
'what update? I don't want to uninstall my program so you can install an
update! [I don't trust this at all/I'll forget/...]', and therefore said
update (which wouldn't just be from 7/8 -> 10, but also cross-build on 10
itself) would never get installed.

There is no sane way to ask the user, since this will reduce adoption of new
builds further than what people not understanding/accepting Microsoft's POV on
this will attempt by 'not upgrading'.

[1] A common case to cite is the deinstallation of the product 'Speccy',
which, funnily, will cause a system crash in a kernel driver shipped with the
product if said older version is later installed on the new OS version and
run. Given the chance people will have odd ways to automatically start this,
and that people's systems will instantly crash if run, it makes sense to block
the installation on this product. [2] I maintained a hobby product that worked
with fringe cases in the OS for a long period of time, and over time as I
moved to newer OS versions myself, I'd end up having a large amount of
features break on downlevel systems due to depending on new
implementations/refactors done in 8, 8.1 or 10 with regards to those
components of the OS.

~~~
temac
That's an "interesting" approach. Unfortunately, it is made worst by the fact
MS laid off tons of testing engineers a few years ago, and now release clearly
buggy versions of Windows. To add insult to the injury, it now does so (adding
new bugs and new incompatibilities with perfectly fine programs) every few
months...

------
jordache
Anyone else remember that driver that allowed the internal speaker to output
wave sound?

I remember days of playing SimCity 2000 and Doom without a sound card, so it
was just beeps and buzzes. Then one day I discovered that driver and started
to enjoy small sounding wave sound

~~~
Yhippa
Not exactly that but a similar story for you. I was a huge dork in high school
and figured out the sound API on my HP-48G which was just really a way to play
a sound from the internal speaker at a frequency and duration. I programmed
the first parts of Holst's Jupiter using my calculator and a friend's
calculator. Man that was real fun to do. Created an API on top of that to
simplify it to play notes at a certain length.

That calculator was amazing. Real nice programming environment there for a
high school kid that didn't have programming everywhere like we do today.

~~~
qwertyuiop924
I did something similar with an Arduino. I managed to get an okay Star Wars
out of it.

As for calculators, my school unfortunately standardized in TI: You guys had
RPL, we have TI-Basic, which is worse than actual BASIC. And our calculators
cost more! (Second-hand, anyways, because let's face it, nobody buys their
calculators new)

~~~
godzillabrennus
I like to think my TI-83+ from 15 years ago is still being used by some kid
who bought it off some kid who bought it off some kid who's the guy that
bought it off me when I finished college.

------
axelfontaine
This 8254 mention made me curious. Does anyone know which other parts of the
original PC hardware are still present in modern machines for compatibility?
(Real mode in CPUs, A20, ...)

~~~
Sanddancer
Intel finally got rid of hardware A20 gating in Haskell. Real mode still
exists, and iirc, the processor still defaults to it. You just can't jump into
real mode from x64 mode, you need a virtualized environment in 32 bit mode to
do that.

~~~
dragonwriter
> Intel finally got rid of hardware A20 gating in Haskell.

Has _w_ ell?

~~~
Sanddancer
Haswell. Curse you, autocorrect.

------
david-given
...way back when, a lot of sound cards had a connector on the top which could
be hooked up to your CD drive, so that the drive could play Red Book audio
which would be sent (as analogue) to your speakers.

Clever me noticed that the pinout of the CD drive matched the pinout of the
PC's internal speaker. Aha, I thought; I can connect it up so that the
internal speaker noises come out through my sound system.

Turns out that full-voltage square-wave 5V, amplified and pushed through a set
of decent speakers, is... slightly loud.

(I was actually lucky not to damage the speakers. Or have a heart attack.)

------
pdw
Vaguely related, can anybody explain why the Linux pcspkr driver lives under
drivers/input?

~~~
honkhonkpants
Because the speaker output is on an integrated circuit with the keyboard
controller in many machines.

------
networked
The big problem with Beep(), or so did thirteen-year-old me think, was that
unless you were on Windows NT it ignored the arguments, always producing a
sound with the same frequency and duration. It meant that, despite it seeming
like a straightforward replacement, you couldn't really use Beep() to port MS-
DOS code that relied on Borland Pascal's CRT unit [1] to produce sound effects
with the PC speaker.

[1]
[http://putka.upm.si/langref/turboPascal/0698.html](http://putka.upm.si/langref/turboPascal/0698.html)

------
yyhhsj0521
Another problem of using hardware beeper is that when you are using a
terminal, you may not hear the beep from the motherboard (which may be located
in the next room or even miles away)

------
digi_owl
Simpler times (after a fashion).

------
tener
From 2010.

------
wyager
>It turns out that they couldn’t. And the answer to why they couldn’t came
from a totally unexpected place. The American’s with Disabilities Act.

I wonder how much this act has cost society. Just in this particular instance,
let's say keeping this chip on PC motherboards adds 5¢ to the cost of each
motherboard. Multiply by a billion PCs sold in the last 10 years (The actual
number is higher, but maybe some don't have the chip. Macs and stuff.). Did
having the PC beep provide $50M worth of utility to society over the last ten
years? I doubt it. $50M of research into e.g. sight restoration technology
would also likely have been more useful to blind people in general.

~~~
huskyr
You're making lots of wrong assumptions and insulting remarks here.

This act is not just about 'blind people', but people with all kinds of
disabilities. If you read the article, you'll see that Beep() API is used for
assistive technologies, which can be anything, from devices for motor
impairment to deafness. Not everyone who is disabled is blind.

If this API would have suddenly disappeared the 'cost to society' would have
been much higher than the assumed figure of $50M that you're stating here.
Imagine if you'd wake up one day and your mouse doesn't work anymore because
it's no longer compatible. That's how important assistive technologies can be
to disabled people.

Furthermore, the suggestion that blindness can be 'fixed' by donating $50M to
'sight restoration technology' (whatever that is) grossly underestimates the
complexities and variety of sight related disabilities. Vision is not a switch
you can turn on again with an operation.

~~~
wyager
I'm well aware of the ADA and its effects. There was recently a good report
about legal trolls suing small businesses for minor parking space violations
under the ADA, so I took the chance to refresh my memory on the act.

>Imagine if you'd wake up one day and your mouse doesn't work anymore because
it's no longer compatible.

Huh? This analogy doesn't make any sense. Things aren't compatible because of
the ADA; they're compatible thanks to standards bodies and market pressure.

> That's how important assistive technologies can be to disabled people.

Only a small fraction of people need the beeper, and from what I understand
based on a presentation from a deaf coworker a few years back, the best
assistive technologies are those that emerged naturally, not from archaic ADA-
imposed requirements. She cited OS X's accessibility features.

>Vision is not a switch you can turn on again with an operation.

I'm aware. I never said $50M in research would cure blindness; I said it would
do more for blind people than a little beeper in the PC chassis. $50M is also
quite a conservative estimate.

