fix memory map doc
This commit is contained in:
parent
4b62e01e82
commit
24a59171e5
3 changed files with 179 additions and 176 deletions
|
|
@ -11,10 +11,10 @@ The processor starts in Real Mode, addressing 1 MB of memory.
|
||||||
| **`0x00000`** | **`0x003FF`** | 1 KB | **IVT** (Interrupt Vector Table) | `0x0000` | `memory.asm` |
|
| **`0x00000`** | **`0x003FF`** | 1 KB | **IVT** (Interrupt Vector Table) | `0x0000` | `memory.asm` |
|
||||||
| **`0x00400`** | **`0x004FF`** | 256 B | **BDA** (BIOS Data Area) Standard | `0x0040` | `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` |
|
| **`0x00500`** | **`0x005FF`** | ~256 B | **Custom BDA** (Driver Data) | `0x0050` | `memory.asm` |
|
||||||
| **`0x00600`** | **`0x07FFF`** | 30.5 KB | **Free** (Low Memory) | | |
|
| **`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` | `memory.asm` |
|
| **`0x08000`** | **`0x17FFF`** | 64 KB | **Stack** (Grows downwards) | `0x0800` | `memory.asm` |
|
||||||
| **`0x18000`** | **`0x18FFF`** | ~4 KB | **GUI RAM** (Widget Allocation) | `0x0A00` | `gui/lib.asm` |
|
| **`0x18000`** | **`0x9FBFF`** | 543 KB | **Free** (Conventional RAM) | | |
|
||||||
| **`0x19000`** | **`0x9FBFF`** | 539 KB | **Free** (Conventional RAM) | | |
|
|
||||||
| **`0x9FC00`** | **`0x9FFFF`** | 1 KB | **EBDA** (Extended BIOS Data Area) | `0x9FC0` | `memory.asm` |
|
| **`0x9FC00`** | **`0x9FFFF`** | 1 KB | **EBDA** (Extended BIOS Data Area) | `0x9FC0` | `memory.asm` |
|
||||||
| **`0xA0000`** | **`0xAFFFF`** | 64 KB | **VGA RAM** (Graphics Modes) | `0xA000` | `Hardware` |
|
| **`0xA0000`** | **`0xAFFFF`** | 64 KB | **VGA RAM** (Graphics Modes) | `0xA000` | `Hardware` |
|
||||||
| **`0xB0000`** | **`0xB7FFF`** | 32 KB | **MDA RAM** (Monochrome Text) | `0xB000` | `Hardware` |
|
| **`0xB0000`** | **`0xB7FFF`** | 32 KB | **MDA RAM** (Monochrome Text) | `0xB000` | `Hardware` |
|
||||||
|
|
@ -42,8 +42,8 @@ The project separates the standard IBM BDA from its own variables to avoid confl
|
||||||
|
|
||||||
#### Stack & GUI RAM
|
#### Stack & GUI RAM
|
||||||
* **Stack**: Segment `0x0800`, SP `0xFFFE`. Grows downwards from physical address `0x17FFE`.
|
* **Stack**: Segment `0x0800`, SP `0xFFFE`. Grows downwards from physical address `0x17FFE`.
|
||||||
* **GUI RAM**: Segment `0x0A00` (Physical `0x0A000`).
|
* **GUI RAM**: Segment `0x0060` (Physical `0x00600`).
|
||||||
* **Layout**: The GUI RAM sits at the "bottom" of the stack segment's physical range, but since the stack starts at the top (`0x17FFE`) and grows down, there is approximately **56 KB** of safe space before collision.
|
* **Layout**: Located in low memory (`0x00600`) to avoid any collision with the Stack (`0x08000`).
|
||||||
|
|
||||||
#### Video RAM (CGA High-Res)
|
#### Video RAM (CGA High-Res)
|
||||||
* **Segment**: `0xB800`
|
* **Segment**: `0xB800`
|
||||||
|
|
@ -73,10 +73,10 @@ Le processeur démarre en mode réel, adressant 1 Mo de mémoire.
|
||||||
| **`0x00000`** | **`0x003FF`** | 1 Ko | **IVT** (Interrupt Vector Table) | `0x0000` | `memory.asm` |
|
| **`0x00000`** | **`0x003FF`** | 1 Ko | **IVT** (Interrupt Vector Table) | `0x0000` | `memory.asm` |
|
||||||
| **`0x00400`** | **`0x004FF`** | 256 o | **BDA** (BIOS Data Area) Standard | `0x0040` | `memory.asm` |
|
| **`0x00400`** | **`0x004FF`** | 256 o | **BDA** (BIOS Data Area) Standard | `0x0040` | `memory.asm` |
|
||||||
| **`0x00500`** | **`0x005FF`** | ~256 o | **Custom BDA** (Données Drivers) | `0x0050` | `memory.asm` |
|
| **`0x00500`** | **`0x005FF`** | ~256 o | **Custom BDA** (Données Drivers) | `0x0050` | `memory.asm` |
|
||||||
| **`0x00600`** | **`0x07FFF`** | 30.5 Ko | **Libre** (Mémoire Basse) | | |
|
| **`0x00600`** | **`0x00AFF`** | 1.25 Ko | **GUI RAM** (Allocation Widgets) | `0x0060` | `gui/lib.asm` |
|
||||||
| **`0x08000`** | **`0x17FFF`** | 64 KB | **Stack** (Grows downwards) | `0x0800` | `memory.asm` |
|
| **`0x00B00`** | **`0x07FFF`** | 29 Ko | **Libre** (Mémoire Basse) | | |
|
||||||
| **`0x18000`** | **`0x18FFF`** | ~4 KB | **GUI RAM** (Widget Allocation) | `0x0A00` | `gui/lib.asm` |
|
| **`0x08000`** | **`0x17FFF`** | 64 Ko | **Pile** (Stack) | `0x0800` | `memory.asm` |
|
||||||
| **`0x19000`** | **`0x9FBFF`** | 539 Ko | **Libre** (RAM Conventionnelle) | | |
|
| **`0x18000`** | **`0x9FBFF`** | 543 Ko | **Libre** (RAM Conventionnelle) | | |
|
||||||
| **`0x9FC00`** | **`0x9FFFF`** | 1 Ko | **EBDA** (Extended BIOS Data Area) | `0x9FC0` | `memory.asm` |
|
| **`0x9FC00`** | **`0x9FFFF`** | 1 Ko | **EBDA** (Extended BIOS Data Area) | `0x9FC0` | `memory.asm` |
|
||||||
| **`0xA0000`** | **`0xAFFFF`** | 64 Ko | **VGA RAM** (Modes Graphiques) | `0xA000` | `Matériel` |
|
| **`0xA0000`** | **`0xAFFFF`** | 64 Ko | **VGA RAM** (Modes Graphiques) | `0xA000` | `Matériel` |
|
||||||
| **`0xB0000`** | **`0xB7FFF`** | 32 Ko | **MDA RAM** (Texte Monochrome) | `0xB000` | `Matériel` |
|
| **`0xB0000`** | **`0xB7FFF`** | 32 Ko | **MDA RAM** (Texte Monochrome) | `0xB000` | `Matériel` |
|
||||||
|
|
@ -104,8 +104,8 @@ Le projet sépare la BDA standard IBM de ses propres variables pour éviter les
|
||||||
|
|
||||||
#### Stack & GUI RAM
|
#### Stack & GUI RAM
|
||||||
* **Stack** : Segment `0x0800`, SP `0xFFFE`. Grandit vers le bas depuis l'adresse physique `0x17FFE`.
|
* **Stack** : Segment `0x0800`, SP `0xFFFE`. Grandit vers le bas depuis l'adresse physique `0x17FFE`.
|
||||||
* **GUI RAM** : Segment `0x0A00` (Physique `0x0A000`).
|
* **GUI RAM** : Segment `0x0060` (Physique `0x00600`).
|
||||||
* **Organisation** : La RAM GUI se trouve "en bas" de la plage physique du segment de pile, mais comme la pile commence tout en haut (`0x17FFE`) et descend, il y a environ **56 Ko** d'espace libre avant collision.
|
* **Organisation** : Située en mémoire basse (`0x00600`) pour éviter toute collision avec la Pile (`0x08000`).
|
||||||
|
|
||||||
#### Video RAM (CGA High-Res)
|
#### Video RAM (CGA High-Res)
|
||||||
* **Segment** : `0xB800`
|
* **Segment** : `0xB800`
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,14 @@ mem_init:
|
||||||
; Stack: [BP+4] = Taille demandée (word)
|
; Stack: [BP+4] = Taille demandée (word)
|
||||||
; Output: AX = Handle (Offset du bloc de données) ou 0 si échec
|
; Output: AX = Handle (Offset du bloc de données) ou 0 si échec
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
%define .size_requested word [bp+4]
|
||||||
|
; variables
|
||||||
|
%define .curr_ptr word [bp-2]
|
||||||
mem_alloc:
|
mem_alloc:
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
sub sp, 2
|
sub sp, 2
|
||||||
|
|
||||||
%define .curr_ptr word [bp-2]
|
|
||||||
%define .size_requested word [bp+4]
|
|
||||||
|
|
||||||
push bx
|
push bx
|
||||||
push cx
|
push cx
|
||||||
push es
|
push es
|
||||||
|
|
@ -193,21 +193,22 @@ mem_alloc:
|
||||||
pop es
|
pop es
|
||||||
pop cx
|
pop cx
|
||||||
pop bx
|
pop bx
|
||||||
%undef .curr_ptr
|
|
||||||
%undef .size_requested
|
|
||||||
leave ; Restaure SP et BP
|
leave ; Restaure SP et BP
|
||||||
ret
|
ret
|
||||||
|
%undef .curr_ptr
|
||||||
|
%undef .size_requested
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; mem_free
|
; mem_free
|
||||||
; Libère un bloc mémoire.
|
; Libère un bloc mémoire.
|
||||||
; Stack: [BP+4] = Handle (word)
|
; Stack: [BP+4] = Handle (word)
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
%define .handle word [bp+4]
|
||||||
mem_free:
|
mem_free:
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
|
|
||||||
%define .handle word [bp+4]
|
|
||||||
|
|
||||||
push es
|
push es
|
||||||
push di
|
push di
|
||||||
|
|
@ -231,9 +232,9 @@ mem_free:
|
||||||
pop bx
|
pop bx
|
||||||
pop di
|
pop di
|
||||||
pop es
|
pop es
|
||||||
%undef .handle
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
%undef .handle
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; mem_get_size
|
; mem_get_size
|
||||||
|
|
@ -241,12 +242,11 @@ mem_free:
|
||||||
; Stack: [BP+4] = Handle (word)
|
; Stack: [BP+4] = Handle (word)
|
||||||
; Output: AX = Taille
|
; Output: AX = Taille
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
%define .handle word [bp+4]
|
||||||
mem_get_size:
|
mem_get_size:
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
|
|
||||||
%define .handle word [bp+4]
|
|
||||||
|
|
||||||
push es
|
push es
|
||||||
push di
|
push di
|
||||||
|
|
||||||
|
|
@ -268,9 +268,9 @@ mem_get_size:
|
||||||
.done:
|
.done:
|
||||||
pop di
|
pop di
|
||||||
pop es
|
pop es
|
||||||
%undef .handle
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
%undef .handle
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; mem_resolve
|
; mem_resolve
|
||||||
|
|
@ -279,11 +279,12 @@ mem_get_size:
|
||||||
; Output: DX:AX = Segment:Offset
|
; Output: DX:AX = Segment:Offset
|
||||||
; ES:DI = Segment:Offset (pour utilisation immédiate avec stos/movs)
|
; ES:DI = Segment:Offset (pour utilisation immédiate avec stos/movs)
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
|
%define .handle word [bp+4]
|
||||||
mem_resolve:
|
mem_resolve:
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
|
|
||||||
mov ax, [bp+4] ; Handle
|
mov ax, .handle ; Handle
|
||||||
mov dx, MEM_HEAP_SEG
|
mov dx, MEM_HEAP_SEG
|
||||||
mov es, dx
|
mov es, dx
|
||||||
mov di, ax ; L'offset est le handle lui-même
|
mov di, ax ; L'offset est le handle lui-même
|
||||||
|
|
@ -292,3 +293,4 @@ mem_resolve:
|
||||||
|
|
||||||
leave
|
leave
|
||||||
ret
|
ret
|
||||||
|
%undef .handle
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
|
|
||||||
; --- Configuration ---
|
; --- Configuration ---
|
||||||
%define GUI_RAM_SEG 0x1800 ; Segment de données UI (Safe: après Stack, avant Heap)
|
%define GUI_RAM_SEG 0x0600 ; Segment de données UI (Safe: après Stack, avant Heap)
|
||||||
%define GUI_MAX_WIDGETS 32 ; Nombre max de widgets simultanés
|
%define GUI_MAX_WIDGETS 32 ; Nombre max de widgets simultanés
|
||||||
|
|
||||||
; Dimensions
|
; Dimensions
|
||||||
|
|
@ -94,6 +94,7 @@ struc widget
|
||||||
|
|
||||||
alignb 2 ; Alignement mémoire pour performance
|
alignb 2 ; Alignement mémoire pour performance
|
||||||
endstruc
|
endstruc
|
||||||
|
; actuellement 34 octets
|
||||||
|
|
||||||
%macro GUI 1-*
|
%macro GUI 1-*
|
||||||
%rep %0 - 1
|
%rep %0 - 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue