I would recommend this website. You will find there (especially in the "Introduction" category) everything you need to know.
If you do not go into protected mode, you can use BIOS interrupts to print on the screen, read from the keyboard, etc. For example, interrupt 0x10, function 0x0e . If you want to use a program other than the bootloader, you will need to manually load it into memory. There are BIOS functions for reading from a hard disk (or a pendulum that emulates a hard disk), but you will have to process the file system yourself. Probably, in your case, the best solution would be to not use any and just an additional program written at a fixed address and force the bootloader to load it from this hard-coded position.
In addition, if you want to execute code compiled with gcc in real mode, you need to use the .code16gcc directive. This will make the gas genereate code executed in 16-bit real mode on 32-bit machines.
source share