There are several virtual machine emulators that can emulate an x86 processor and peripherals. Each comes with a BIOS, several of them with an open-source BIOS. You should look at QEMU, which operates completely independently of the host (it can run on any machine, though it has mechanisms to run faster if the emulated machine is the same architecture as the host). QEMU comes with PC-BIOS.
If you want to work in x86 real mode, you can also take a look at Dosbox.
Coreboot should also be of interest to you. It's an open source BIOS for x86.
Looking at a BIOS will give you some insights on how an x86 processor boots, including all the quirks inherited from 30+ years of history with significant evolution in hardware capabilities. It isn't the best thing to look at if what you want to understand is how to communicate with peripherals. For that, look at the device drivers in an operating system kernel — either Linux, or simpler ones such as MINIX 3.
I would also recommend taking a look at other CPU architectures such as ARM and MIPS, so that you get an idea of what's common in OS/hardware interactions and what's specific to the PC architecture.