>>316263The hardware itself can only be controlled in one way, but the difference happens with the drivers, since it is software.
function processArray(arrayIn){
turn led1 on
move arrayIn to component memory
execute instruction 1
execute instruction 3
move result into output stream
turn led1 off
}
Anything that wants to use this driver to process arrays with that hardware component will need to know of this driver and its processArray function. Another OS will have its own drivers to do the same thing, but since the drivers were written by someone else the function names will be completely different. A program compiled for an OS that relies on the first drivers and that the corresponding will not be able to work with the drivers on the second OS. Yes, ultimately the same instructions are sent to the hardware but the program will have no idea how to navigate the stack to send those instructions.
The thing is that things dont need to be this way. You can design a OS that gives programs direct access to the hardware. MS-DOS and other early operating systems were like that, but that was found to be a terrible idea for security and stability reasons. I wouldn't be surprised if programs were easily transferable between OSes in the early days because of how simple things were.