How is Windows able to run on different hardware?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
DementedPurple
Posts: 318
Joined: Mon Jan 30, 2017 5:20 pm
Location: Colorado USA

How is Windows able to run on different hardware?

Post by DementedPurple »

I’ve started to get a strange fascination towards PCs. And I wonder how the same version of Windows is able to run on all sorts of PC clones with different CPUs, different graphics cards, etc. And still know how to run. What I mean is how does it know what graphics cards are in the system, where in memory they are, and how to use them right out of the box? Do the PCI cards have their own software on them? How does the BiOS know what CPU is on the board? The NES is completely unaware that it isn’t based off of a 2a03, so wouldn’t a PC be the same? I doubt that all graphics cards now days are all just clones of each other, they probably all work differently, so Windows would not be able to target one GPU in general.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How is Windows able to run on different hardware?

Post by Pokun »

Within the IBM PC clone standard all graphics cards should at least have VGA in common so Windows can always fall back to that for basic display. Other than that I'm guessing hardware like graphics cards have some way to be detected by software so that operating systems can find matching drivers. Some parts may have their own firmware and such I think.

The NES doesn't have a BIOS (with the exception of FDS games) or OS, everything is provided by the game, and the developer knows what hardware is in the NES already as all Famicoms and NES systems are the same (well mostly).

A multitask OS is much more complicated than a game though, I don't know how it works in detail.

The IBM PC standard is changing all the time. Recently Windows 7 x64 removed support for the internal system speaker, and motherboards ships without it (although they still support it). Talk about being cheap! This irritated me so I ordered a 10 pack of "PC speakers" from some Chinese ebayer, and found a patch that fixes it in Windows 7 x64.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How is Windows able to run on different hardware?

Post by rainwarrior »

1. The CPU itself is standardized. There are various "extra" features, like 64-bit, versions of SSE, etc. but for the most part it's backwards compatible quite a ways.

2. A basic set of hardware is also standardized, like VGA graphics, USB keyboard interace, etc. which allows a fallback to get everything started.

3. The word for the rest is: driver.

There's a standard Windows interface for, e.g. what a printer driver needs to do. You install driver software for your specific printer that translates from that interface and communicates directly with the hardware. In a lot of cases these days the hardware can be identified automatically by some standard communication (e.g. USB protocols) and then Windows might look up and download the driver automatically from the internet.

Usually an installation CD comes with a lot of common drivers too. You won't need most of them but there are good odds it will find a (possibly old) driver for most of your hardware. For the rest it will hope you have your own on a disk somewhere, or if not might just use one of those simpler fallbacks until you can get things going.

Windows talks to the driver. The driver talks to the device. Because the drivers all use the same standard interface to Windows, they are easily replaced as the hardware changes.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How is Windows able to run on different hardware?

Post by tepples »

Incidentally, the reason you can't upgrade or replace the operating system on a phone as easily as on the PC is that a phone lacks "A basic set of hardware is also standardized".
LocalH
Posts: 186
Joined: Thu Mar 02, 2006 12:30 pm

Re: How is Windows able to run on different hardware?

Post by LocalH »

Going a bit off topic, but that's not entirely true, tepples. Perhaps in the Android world, where there is more fragmentation, but in the Apple world, it's solely about control (as such, you can easily reinstall iOS, but only to versions that Apple allows, and from a software perspective, all of a given model of iOS device *are* basically the same, other than storage capacity - there was a performance issue with lower capacity iPhone 7 devices versus higher capacity ones, but the programming interface was the same).
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How is Windows able to run on different hardware?

Post by rainwarrior »

I was specifically referring to VGA and USB keyboards being an I/O fallback so the OS can do something before it's able to load the hardware specific drivers. ...and actually I think Android does have that to some extent? I don't think that's really the problem.

The real problem is that the hardware vendors aren't interested in writing new drivers for old hardware. On a PC, every part is made by someone else with their own individual stake in things. All of those drivers are modular, each one a separate problem managed by someone else. You don't really get to "build your own" Android or iPhone from separate components, and companies like Apple and Samsung want you to buy a new phone, not maintain your old one, so they're not going to help you do that.

There's a bunch of things going on, not limited to:
  • PCs are "supposed" to have a longer operating life than phones, especially now that typical computing power needs have reached a bit of a plateau.
  • Drivers are individually written by manufacturers of various parts: GPU, motherboard, sound, etc.
  • Parts of the PC are supposed to be replaceable over time, so the user has to be given the ability to replace the individual drivers as needed. On phones, maintenance like that is generally hidden from the user, and there are no replaceable parts anyway.
  • The OS interface for Android has not been as stable as Windows', partly due to how young it is but backward compatibility also hasn't been as important in its ongoing development, so old drivers just don't last as long. (...and for Apple it's not really even a driver issue, fundamentally, it's literally just planned artificial obsolescence.)
Post Reply