For bare-metal coding it is best to get started with Embedded Programming using MCUs (ARM, AVR, 8051 etc.).
For x86 you may find the following useful;
1) Computer systems: A programmer's perspective by Bryant and O'Hallaron.
2) Low-Level Programming: C, Assembly, and Program Execution on Intel® 64 Architecture by Igor Zhirkov.
3) Modern X86 Assembly Language Programming by Daniel Kusswurm.
4) Agner Fog's writings.
5) Ciro Santilli's x86 examples - https://github.com/cirosantilli/x86-bare-metal-examples