No description
  • Assembly 94.9%
  • Fortran 5.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-01-27 22:59:52 +01:00
doc/assets update screenshot + size warning fix 2026-01-27 15:17:28 +01:00
roms Delete roms/vgabios.bin 2026-01-26 21:05:29 +01:00
src WIP : Mouse Cursor 2026-01-27 22:59:52 +01:00
.gitignore testing 2026-01-19 09:50:33 +01:00
readme.md update readme 2026-01-25 21:25:23 +01:00

Custom BIOS / ROM Project


🇬🇧 English

Overview

This project aims to design and implement a PC-compatible BIOS/ROM from scratch, primarily targeted for QEMU emulation, with a strong focus on low-level PC architecture and x86 real-mode assembly programming.

Rather than booting an operating system from disk, the PC starts directly from the ROM into a minimalist graphical interface, using CGA High-Resolution Monochrome (640×200) mode.

The project is intentionally educational, experimental, and minimalist.

Screenshot of the boot + text test


Objectives

  • Write a PC-compatible BIOS from scratch

    • No reuse of existing BIOS code
    • Minimal but functional implementation
    • Compatible with QEMU
    • Target architecture: 8086 → 80486
  • Boot directly from ROM

    • No DOS, no bootloader, no disk dependency
    • Execution starts at reset vector (F000:FFF0)
    • ROM is responsible for full system initialization
  • Provide a minimalist graphical interface

    • Graphics mode: CGA High-Resolution Monochrome (640×200)
    • Direct video memory access
    • Custom cursor and basic UI primitives
  • Deep understanding of PC architecture

    • CPU reset behavior
    • Memory map (RAM, ROM, EBDA, IVT, BDA)
    • Interrupt Vector Table
    • Hardware initialization (PIC, PIT, keyboard, video)
    • Real-mode execution constraints
  • Improve mastery of x86 assembly

    • Real-mode x86 assembly (8086-compatible)
    • Performance-oriented routines
    • Hardware-near programming
    • Clear separation between hardware-specific drivers and core logic

Requirements

To build and run this project, the following tools and components are required:

  • NASM (Netwide Assembler) Used to assemble x86 real-mode assembly source files into a raw binary ROM image.

  • QEMU Used as the primary PC emulator for testing and debugging the custom BIOS.

  • QEMU VGA BIOS The standard QEMU VGA BIOS (vgabios.bin) is required to initialize the VGA hardware, allowing the custom BIOS to rely on a known and stable VGA implementation while focusing on its own core logic.


Build and Run

Compilation

From the project root:

cd src
nasm -f bin boot.asm -o ..\build\bios.bin

This produces a raw BIOS ROM image (bios.bin) suitable for direct execution by QEMU.

Execution

The QEMU VGA BIOS must be copied into a local rom/ directory.

Default locations of vgabios.bin:

Windows C:\Program Files\qemu\share\vgabios.bin

Linux /usr/share/qemu/vgabios.bin

You can use an video bios from the 86box's project:

https://github.com/86Box/roms

Copy it to: roms/vgabios.bin

Then run QEMU with:

qemu-system-i386 \
  -bios build/bios.bin \
  -device loader,file=roms/vgabios.bin,addr=0xC0000,force-raw=on \
  -device isa-debugcon,chardev=myconsole \
  -chardev stdio,id=myconsole \
  -k be \
  -display sdl

This command:

  • Loads the custom BIOS as the system ROM
  • Injects the VGA BIOS at 0xC0000
  • Redirects debug output to the console
  • Displays graphics using SDL

Non-Goals

  • Full IBM BIOS compatibility
  • Protected mode or modern CPUs
  • Advanced OS services
  • DOS or legacy OS support

This is a learning and exploration project, not a drop-in BIOS replacement.


🇫🇷 Français

Présentation

Ce projet consiste à concevoir et développer un BIOS/ROM PC compatible entièrement écrit “from scratch”, destiné principalement à lémulation QEMU, avec pour objectif principal lapprentissage approfondi de larchitecture PC et de la programmation assembleur x86 en mode réel.

Au lieu de charger un système dexploitation depuis un disque, le PC démarre directement depuis la ROM vers une interface graphique minimaliste, utilisant le mode CGA Haute Résolution Monochrome (640×200).

Le projet est volontairement éducatif, expérimental et minimaliste.

Screenshot of the boot + text test


Objectifs

  • Écrire un BIOS PC depuis zéro

    • Aucun code BIOS existant réutilisé
    • Implémentation minimale mais fonctionnelle
    • Compatible avec QEMU
    • Architecture ciblée : 8086 jusquau 486
  • Démarrer directement depuis la ROM

    • Sans DOS, sans bootloader, sans disque
    • Exécution depuis le vecteur de reset (F000:FFF0)
    • La ROM initialise entièrement la machine
  • Fournir une interface graphique minimaliste

    • Mode graphique : CGA Hi-Res Monochrome (640×200)
    • Accès direct à la mémoire vidéo
    • Curseur personnalisé et primitives graphiques simples
  • Approfondir la compréhension de larchitecture PC

    • Séquence de reset CPU
    • Cartographie mémoire (RAM, ROM, EBDA, IVT, BDA)
    • Table des vecteurs dinterruptions
    • Initialisation matérielle (PIC, PIT, clavier, vidéo)
    • Contraintes du mode réel
  • Perfectionner la maîtrise de lassembleur

    • Assembleur x86 en mode réel (compatible 8086)
    • Routines optimisées pour la performance
    • Programmation proche du matériel
    • Séparation claire entre cœur du BIOS et drivers matériels

Pré-requis

Pour compiler et exécuter ce projet, les outils suivants sont nécessaires :

  • NASM (Netwide Assembler) Utilisé pour assembler le code x86 en mode réel et générer une image ROM binaire brute.

  • QEMU Utilisé comme émulateur PC principal pour tester et déboguer le BIOS personnalisé.

  • BIOS VGA de QEMU Le BIOS VGA standard de QEMU (vgabios.bin) est utilisé pour initialiser le matériel vidéo, ce qui permet au projet de se concentrer sur le développement du BIOS sans réimplémenter la logique VGA complète.

Compilation et exécution

Compilation

Depuis la racine du projet :

cd src
nasm -f bin boot.asm -o ..\build\bios.bin

Cette commande génère une image BIOS brute (bios.bin) directement exécutable par QEMU.

Exécution

Le BIOS VGA de QEMU doit être copié dans un dossier local rom/.

Emplacements par défaut de vgabios.bin :

Windows C:\Program Files\qemu\share\vgabios.bin

Linux /usr/share/qemu/vgabios.bin

Vous pouvez aussi utiliser un bios video du projet de 86box

https://github.com/86Box/roms

À copier vers : roms/vgabios.bin

Puis lancer QEMU avec la commande suivante :

qemu-system-i386 \
  -bios build/bios.bin \
  -device loader,file=roms/vgabios.bin,addr=0xC0000,force-raw=on \
  -device isa-debugcon,chardev=myconsole \
  -chardev stdio,id=myconsole \
  -k be \
  -display sdl

Cette commande :

  • Charge le BIOS personnalisé comme ROM système
  • Injecte le BIOS VGA à ladresse 0xC0000
  • Redirige les messages de debug vers la console
  • Affiche linterface graphique via SDL

Hors périmètre

  • Compatibilité BIOS IBM complète
  • Mode protégé ou CPU modernes
  • Services système avancés
  • Support DOS ou OS legacy

Ce projet est avant tout un laboratoire dapprentissage et dexploration, et non un BIOS de production.


Status

🚧 Work in progress Designed for experimentation, learning, and documentation.