Reputation: 779
BIOS is written in Assembly language and a machine can only understand Binaries. BIOS is the first program which is loaded into memory when the system starts. What compiles BIOS to generate a binary file?
Upvotes: 4
Views: 4448
Reputation: 1
The BIOS is divided in blocks. Each block is LZH compressed. Only the boot block and decompression block are pure machine code blocks. Executable code inside a block can be compiled from C and/or assembled from ASM languages.
Upvotes: -1
Reputation: 6425
A BIOS engineer writes the BIOS in x86 assembly language, and then "compiles" it with a program like MASM or NASM.
The resulting binary file is then burned into the Flash ROM chip (using a tool like this), which is then installed on the motherboard.
When the PC is turned on, it begins executing the code from this flash chip, which initializes the hardware of the PC and then turns control over to the Operating System.
Some comments on the above:
Upvotes: 8
Reputation: 2800
Edit: this answer is incorrect, as pointed out in the comments.
I think you misunderstand compilers.
When you compile a program, you're taking a high-level language (like C) and turning it into assembly. An assembly program = a binary program. They are one and the same.
So, nothing compiles the BIOS. It just runs.
Upvotes: -1
Reputation: 3454
Theoretically a BIOS could be written with any language that produces executable binaries, but having to handle low level hardware, the most appropriate and most used are assembly and C.
When a PC is turned on there's nothing to compile, it is already an assembled/compiled binary ready in memory (ROM, eprom, flash) where the CPU expects it.
You can take a look too Bochs emulator's bios sources (I think also Qemu and Virtualbox have their own but not sure if sources are available).
There are also open source projects aimed at replacing the PC BIOS, for example coreboot.
Upvotes: 7
Reputation:
I think the motherboard manufacturer converts it and write it on the ROM ?
Upvotes: -1