Hi,
For ancient CPUs (80386 and older) the firmware's ROM actually was at 0x000F0000 and when the CPU started it started executing at 0x000FFFF0 (or "0xF000:0xFFF0" in real mode addressing). 64 KiB is not a lot of space, so when people started expecting the BIOS to handle things like PCI, USB, etc it wasn't enough. To fix this, the firmware's ROM was shifted to just below 0xFFFFFFFF so that it could be much larger (and the CPU started executing code at 0xFFFFFFF0 instead, which ends up as a strange "0xFFFFF000:0xFFF0" real mode address created from playing non-standard tricks with CS segment's base). This created a minor backward compatibility problem (software expected the BIOS to be 0x000F0000) that was solved by copying the "run-time" part of the BIOS into that area of RAM and then telling the memory controller to pretend that area of RAM is "read only".
If you're creating your own BIOS ROM (for modern-ish CPUs) then you'd need to do the same - have the firmware's initialisation code, etc just below 0xFFFFFFFF, and copy a "run-time part" (possibly including decompression, and likely excluding initialisation code that isn't needed after POST) into the legacy area.
Of course it's much simpler (and faster) to forget about the BIOS and write a special bootloader for your OS, so that the OS can be installed in ROM and will boot from ROM with no BIOS (and no disk IO, etc) at all.
Also note that for a real computer there's a lot of tricky stuff that needs to happen (e.g. starting with detecting RAM chip sizes and initialising the memory controller, before you can even use any RAM for stack, etc). For emulators (Bochs, Qemu) it's much much easier, as (unlike real hardware) RAM (and a bunch of other things that the firmware is supposed to initialise) are setup/working before the firmware is started.
ignus wrote:But still I don't know where to start
The best place to start would be the same place the CPU starts - the code at 0xFFFFFFF0 (or "0xFFFFF000:0xFFF0"). This mostly has to be a JMP instruction to some code that should switch to protected mode (without using any RAM), followed by code to detect and initialise RAM chips (which can be a "do nothing" stub for Qemu or Bochs), followed by code to setup other parts of the chipset (if/where necessary for the specific chipset), followed by code to decompress/copy the "run-time" part into the legacy BIOS area.
Once that's all done you'd add code to create the IVT; then start working on code to scan PCI buses, find "option ROMs" (e.g. video card's ROM) and initialise them; plus code for the BIOS's own interrupt handlers.
Cheers,
Brendan