update doc
This commit is contained in:
parent
0a5d791808
commit
2cf3a817dd
6 changed files with 71 additions and 9 deletions
19
doc/API.md
Normal file
19
doc/API.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# BDA (Bios Data Area) Custom
|
||||
|
||||
Le projet utilise une extension de la BDA standard IBM PC.
|
||||
|
||||
Segment BDA Standard : 0x0040
|
||||
|
||||
Segment Données Custom : 0x0050 (Défini par BDA_DATA_SEG).
|
||||
|
||||
## Mapping Mémoire Global :
|
||||
|
||||
0000:0000 : IVT (Interrupt Vector Table)
|
||||
|
||||
0040:0000 : BDA Standard
|
||||
|
||||
0050:0000 : Variables Drivers (Souris, Gfx)
|
||||
|
||||
0800:0000 : Stack (0x8000 - 0x18000 approx) ou Code (selon boot.asm).
|
||||
|
||||
B800:0000 : VRAM CGA.
|
||||
25
doc/CGA.md
Normal file
25
doc/CGA.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# API Graphique (CGA Monochrome 640x200)
|
||||
|
||||
L'accès se fait via la macro
|
||||
|
||||
|
||||
```assember
|
||||
GFX [COMMANDE], [ARGS...]
|
||||
```
|
||||
ou via
|
||||
```assembler
|
||||
call [graph_driver + ID*2].
|
||||
```
|
||||
|
||||
Les arguments sont empilés selon la convention C (dernier argument poussé en premier).
|
||||
|
||||
| ID | Macro / Constante | Arguments (pile) | Description |
|
||||
| - | - | - | - |
|
||||
| 0 | INIT | Aucun | Initialise le mode vidéo 0x06, efface l'écran (damier) et initialise la souris. |
|
||||
| 1 | PUTPIXEL | WORD x, WORD y, BYTE couleur | Dessine un pixel. 0 (Noir), !=0 (Blanc). |
|
||||
2 | GETPIXEL | WORD x, WORD y | Retourne la couleur du pixel dans AL (0 ou 1). |
|
||||
| 3 | GOTOXY |WORD x, WORD y | Positionne le curseur de texte graphique aux coordonnées pixels données.|
|
||||
| 4 | TXT_MODE | Mode | Définit le mode d'écriture du texte (voir Modes Texte ci-dessous). |
|
||||
| 5 | PUTCH | char | Affiche un caractère à la position courante et avance le curseur.
|
||||
| 6 | WRITE | segment, offset | Affiche une chaîne de caractères terminée par 0 (ASCIIZ). |
|
||||
| 7 | GFX_CRS_UPDATE | Aucun | Force la mise à jour visuelle du curseur souris (copie background -> draw).|
|
||||
|
|
@ -251,4 +251,6 @@ Ce projet est avant tout un **laboratoire d’apprentissage et d’exploration**
|
|||
🚧 **Work in progress**
|
||||
Designed for experimentation, learning, and documentation.
|
||||
|
||||
parcourez l'[API ](/doc/API.md) pour plus d'informations
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -78,11 +78,9 @@ struc mouse
|
|||
.cur_addr_start resw 1 ; adresse de départ de la sauvegarde
|
||||
|
||||
.cur_drawing resb 1 ;
|
||||
.cur_visible resb 1 ;
|
||||
.cur_counter resb 1 ; compteur de fois que le curseur a été caché (0 = visible, <0 = invisible)
|
||||
.cur_seg resw 1 ; segment / offset of the pointer
|
||||
.cur_ofs resw 1 ;
|
||||
.cur_mask resb 1 ; pixels mask (bit per pixel)
|
||||
.bkg_saved resb 1 ; background saved
|
||||
alignb 4 ; alignement 4 bytes
|
||||
.bkg_buffer resd 16 ; buffer for saved background
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@
|
|||
; accessible par la GUI à des offsets fixes.
|
||||
; ------------------------------------------------------------
|
||||
%define INIT 0
|
||||
%define GFX_PUTPIXEL 1
|
||||
%define GFX_GETPIXEL 2
|
||||
%define PUTPIXEL 1
|
||||
%define GETPIXEL 2
|
||||
%define GOTOXY 3
|
||||
%define TXT_MODE 4
|
||||
%define PUTCH 5
|
||||
|
|
@ -174,16 +174,30 @@ cga_calc_addr:
|
|||
pop cx
|
||||
ret
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; gfx_set_writemode (mode)
|
||||
; Défini le mode d'écriture :
|
||||
;
|
||||
; bit : descr
|
||||
; 0 : text color : 0=black, 1=white
|
||||
; 1 : transparent : 1=apply background attribut
|
||||
;
|
||||
; si le mode n'est pas transparent, la couleur de fond
|
||||
; est l'inverse de la couleur du texte
|
||||
; ---------------------------------------------------------------------------
|
||||
cga_set_writemode:
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
; --- Définition des arguments ---
|
||||
%define .mode word [bp+4]
|
||||
|
||||
push fs
|
||||
push ax
|
||||
mov ax, BDA_DATA_SEG
|
||||
mov fs,ax
|
||||
|
||||
mov ax, word arg1
|
||||
mov ax, .mode
|
||||
|
||||
mov byte [fs:BDA_GFX + gfx.cur_mode], al
|
||||
|
||||
|
|
@ -193,7 +207,7 @@ cga_set_writemode:
|
|||
ret
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; gfx_set_charpos
|
||||
; gfx_set_charpos (x,y)
|
||||
; In : CX = x (pixels), DX = y (pixels)
|
||||
; Out: variables DS:GFX_CUR_*
|
||||
; Notes:
|
||||
|
|
@ -204,6 +218,10 @@ cga_set_charpos:
|
|||
push bp
|
||||
mov bp, sp
|
||||
|
||||
; --- Définition des arguments ---
|
||||
%define .x word [bp+4]
|
||||
%define .y word [bp+6]
|
||||
|
||||
pusha
|
||||
push fs
|
||||
|
||||
|
|
@ -211,8 +229,8 @@ cga_set_charpos:
|
|||
mov fs,ax
|
||||
|
||||
; store x,y en pixel
|
||||
mov cx, word arg1
|
||||
mov dx, word arg2
|
||||
mov cx, .x
|
||||
mov dx, .y
|
||||
|
||||
mov [fs:BDA_GFX + gfx.cur_x], cx
|
||||
mov [fs:BDA_GFX + gfx.cur_y], dx
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ mouse_reset:
|
|||
mov word [fs:BDA_MOUSE + mouse.x],497 ; vous pouvez aussi préciser le centre
|
||||
mov word [fs:BDA_MOUSE + mouse.y],5 ; vous pouvez aussi préciser le centre
|
||||
|
||||
mov byte [fs:BDA_MOUSE + mouse.cur_visible], 1
|
||||
mov byte [fs:BDA_MOUSE + mouse.cur_counter], 0
|
||||
mov word [fs:BDA_MOUSE + mouse.cur_x], 0
|
||||
mov word [fs:BDA_MOUSE + mouse.cur_y], 0
|
||||
mov byte [fs:BDA_MOUSE + mouse.cur_drawing], 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue