Some areas of IBM personal computer architecture have remained remarkably stable from the original IBM PC, based on a 4.77 MHz 8088, to today's PS/2 Model 80, based on a 20 MHz 80386. IBM's track record for upward compatibility in its video and serial communications controllers has been excellent; in many cases, the same hardware-dependent code that was written for the original IBM PC runs perfectly well on an IBM PS/2 Model 80. Other areas of relative hardware stability are:
Sound control via port 61H
The 8253 timer chip's channels 0 and 2 (ports 40H, 42H, and 43H)
The game adapter at port 201H
Control of the interrupt system via the 8259 PIC's mask register at port 21H
However, direct sound generation and manipulation of the 8253 timer or 8259 PIC are quite likely to cause problems if your program is run under a multitasking program manager such as Microsoft Windows or DesqView.
Keyboard mapping, the keyboard controller, and the floppy and fixed disk controllers are areas of relative hardware instability. Programs that bypass MS-DOS for keyboard or disk access are much less likely to function properly across the different PC models and are also prone to interfere with each other and with well-behaved applications.