7.2 KiB
7.2 KiB
Memory Map / Cartographie Mémoire
🇬🇧 English
Physical Memory Layout (Real Mode)
The processor starts in Real Mode, addressing 1 MB of memory.
| Physical Start | Physical End | Size | Description | Segment | Source/Definied |
|---|---|---|---|---|---|
0x00000 |
0x003FF |
1 KB | IVT (Interrupt Vector Table) | 0x0000 |
memory.asm |
0x00400 |
0x004FF |
256 B | BDA (BIOS Data Area) Standard | 0x0040 |
memory.asm |
0x00500 |
0x005FF |
256 B | Custom BDA (Driver Data) | 0x0050 |
memory.asm |
0x00600 |
0x00AFF |
1.25 KB | GUI RAM (Widget Allocation) | 0x0060 |
gui/lib.asm |
0x00B00 |
0x07FFF |
29 KB | Free (Low Memory) | ||
0x08000 |
0x17FFF |
64 KB | Stack (Grows downwards) | 0x0800 |
boot.asm |
0x18000 |
0x9FFFF |
544 KB | Free (Conventional RAM) | ||
0xA0000 |
0xAFFFF |
64 KB | VGA RAM (Graphics Modes) | 0xA000 |
Hardware |
0xB0000 |
0xB7FFF |
32 KB | MDA RAM (Monochrome Text) | 0xB000 |
Hardware |
0xB8000 |
0xBFFFF |
32 KB | VRAM (CGA / MCGA) | 0xB800 |
generic.asm |
0xC0000 |
0xDFFFF |
128 KB | Option ROMs (e.g., VGA BIOS) | 0xC000 |
generic.asm |
0xE0000 |
0xEFFFF |
64 KB | System Reserved (BIOS Extension) | 0xE000 |
Hardware |
0xF0000 |
0xFFFFF |
64 KB | System BIOS ROM (Code) | 0xF000 |
Hardware |
Detailed Zones
Interrupt Vector Table (IVT)
- Location:
0000:0000 - Usage: Interrupt pointer table (256 entries of 4 bytes).
- Initialization:
ivt_setupfills the table with a default handler (default_isr).ivt_setvectorinstalls specific IRQs (e.g., Timer onINT 08h).
BIOS Data Area (BDA)
The project separates the standard IBM BDA from its own variables to avoid conflicts with the VGA BIOS loaded at 0xC000.
- Standard BDA (
0040:0000): Used mainly by the VGA BIOS (loaded via QEMU) to store video modes (0x0049) and column count (0x004A). - Custom BDA (
0050:0000): Defined byBDA_DATA_SEG. Stores driver states:- Mouse: Input buffer, status, coordinates, background buffer (for cursor).
- Gfx: Text cursor position, attributes.
- GUI RAM: Segment
0x0060(Physical0x00600).- Layout: Located in low memory (
0x0060) to avoid any collision with the Stack (0x0800).
- Layout: Located in low memory (
Stack
- Stack: Grows downwards from physical address
0xFFFE(16-bit aligned) of the "Stack Segment" defined bySTACK_SEG.
Video RAM (CGA High-Res)
- Segment:
0xB800 - Mode: 640x200 Monochrome (1 bit per pixel).
- Organization: Interleaved.
- Even Lines (0, 2, 4...): Offset
0x0000-0x1F3F(Bank 0). - Odd Lines (1, 3, 5...): Offset
0x2000-0x3F3F(Bank 1).
- Even Lines (0, 2, 4...): Offset
VGA RAM & System Reserved
- VGA RAM (
0xA0000): Standard 64 KB memory window for VGA graphics modes. Although this project primarily uses the CGA memory at0xB8000, this area is physically present when the VGA hardware is emulated. - System Reserved (
0xE0000): Reserved memory area, typically used for motherboard BIOS extensions or specific hardware mapping.
ROM
- Option ROMs (
0xC0000): Scanned bysetup_load_romto initialize the VGA BIOS. - System ROM (
0xF0000): Contains the compiled binary code. The Reset Vector is at0xFFFF0.
🇫🇷 Français
Cartographie Mémoire Physique (Mode Réel)
Le processeur démarre en mode réel, adressant 1 Mo de mémoire.
| Physical Start | Physical End | Size | Description | Segment | Source/Definied |
|---|---|---|---|---|---|
0x00000 |
0x003FF |
1 KB | IVT (Interrupt Vector Table) | 0x0000 |
memory.asm |
0x00400 |
0x004FF |
256 B | BDA (BIOS Data Area) Standard | 0x0040 |
memory.asm |
0x00500 |
0x005FF |
256 B | Custom BDA (Driver Data) | 0x0050 |
memory.asm |
0x00600 |
0x00AFF |
1.25 KB | GUI RAM (Widget Allocation) | 0x0060 |
gui/lib.asm |
0x00B00 |
0x07FFF |
29 KB | Free (Low Memory) | ||
0x08000 |
0x17FFF |
64 KB | Stack (Grows downwards) | 0x0800 |
boot.asm |
0x18000 |
0x9FFFF |
544 KB | Free (Conventional RAM) | ||
0xA0000 |
0xAFFFF |
64 KB | VGA RAM (Graphics Modes) | 0xA000 |
Hardware |
0xB0000 |
0xB7FFF |
32 KB | MDA RAM (Monochrome Text) | 0xB000 |
Hardware |
0xB8000 |
0xBFFFF |
32 KB | VRAM (CGA / MCGA) | 0xB800 |
generic.asm |
0xC0000 |
0xDFFFF |
128 KB | Option ROMs (e.g., VGA BIOS) | 0xC000 |
generic.asm |
0xE0000 |
0xEFFFF |
64 KB | System Reserved (BIOS Extension) | 0xE000 |
Hardware |
0xF0000 |
0xFFFFF |
64 KB | System BIOS ROM (Code) | 0xF000 |
Hardware |
Détails des Zones
Interrupt Vector Table (IVT)
- Emplacement :
0000:0000 - Usage : Table des pointeurs d'interruption (256 entrées de 4 octets).
- Initialisation :
ivt_setupremplit la table avec un handler par défaut (default_isr).ivt_setvectorinstalle les IRQ spécifiques (ex: Timer surINT 08h).
BIOS Data Area (BDA)
Le projet sépare la BDA standard IBM de ses propres variables pour éviter les conflits avec le BIOS VGA chargé en 0xC000.
- BDA Standard (
0040:0000) : Utilisée principalement par le BIOS VGA (chargé via QEMU) pour stocker les modes vidéo (0x0049) et le nombre de colonnes (0x004A). - Custom BDA (
0050:0000) : Définie parBDA_DATA_SEG. Stocke l'état des drivers :- Souris : Buffer d'entrée, état, coordonnées, buffer de sauvegarde du fond (pour le curseur).
- Gfx : Position du curseur texte, attributs.
- GUI RAM : Segment
0x0060.- Organisation : Située en mémoire basse (
0x0060) pour éviter toute collision avec la Pile (0x0800).
- Organisation : Située en mémoire basse (
Stack
- Stack : Grandit vers le bas depuis l'adresse physique
0xFFFE(Alignement sur 16 bits) du "stack Segment" défini parSTACK_SEG.
Video RAM (CGA High-Res)
- Segment :
0xB800 - Mode : 640x200 Monochrome (1 bit par pixel).
- Organisation : Entrelacée (Interleaved).
- Lignes Paires (0, 2, 4...) : Offset
0x0000à0x1F3F(Bank 0). - Lignes Impaires (1, 3, 5...) : Offset
0x2000à0x3F3F(Bank 1).
- Lignes Paires (0, 2, 4...) : Offset
VGA RAM & Réservé Système
- VGA RAM (
0xA0000) : Fenêtre mémoire standard de 64 Ko pour les modes graphiques VGA. Bien que ce projet utilise principalement la mémoire CGA à0xB8000, cette zone est physiquement présente lorsque le matériel VGA est émulé. - Réservé Système (
0xE0000) : Zone mémoire réservée, typiquement utilisée pour les extensions du BIOS de la carte mère ou le mappage de matériel spécifique.
ROM
- Option ROMs (
0xC0000) : Espace scanné parsetup_load_rompour initialiser le BIOS VGA. - System ROM (
0xF0000) : Contient le code binaire compilé. Le Vecteur de Reset est situé à0xFFFF0.