fixing mouse struc + gfx
This commit is contained in:
parent
0eb0638b8b
commit
36cf876338
2 changed files with 59 additions and 8 deletions
|
|
@ -32,6 +32,34 @@
|
||||||
%define CGA_STRIDE 80
|
%define CGA_STRIDE 80
|
||||||
%define CGA_ODD_BANK 0x2000
|
%define CGA_ODD_BANK 0x2000
|
||||||
|
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
; TABLE DE SAUT (VECTEURS API)
|
||||||
|
; Cette table doit être située au début du driver pour être
|
||||||
|
; accessible par la GUI à des offsets fixes.
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
gfx_api_table:
|
||||||
|
jmp gfx_init ; Offset +0: Initialisation
|
||||||
|
jmp gfx_putpixel ; Offset +3: Dessin pixel
|
||||||
|
jmp gfx_getpixel ; Offset +6: Lecture pixel
|
||||||
|
jmp gfx_fill_rect ; Offset +9: Remplissage rectangle (Nouveau)
|
||||||
|
jmp gfx_invert_rect ; Offset +12: Inversion (Nouveau pour Menus)
|
||||||
|
jmp gfx_draw_hline ; Offset +15: Ligne horizontale rapide (Nouveau)
|
||||||
|
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
; COMMENTAIRE SUR LA MÉTHODE D'APPEL
|
||||||
|
;
|
||||||
|
; Pour appeler une fonction du driver depuis votre GUI :
|
||||||
|
; 1. Définissez l'adresse de base du driver (ex: GFX_DRIVER_BASE)
|
||||||
|
; 2. Utilisez un call indirect via l'offset de la table.
|
||||||
|
;
|
||||||
|
; Exemple en ASM pour remplir un rectangle :
|
||||||
|
; call [GFX_DRIVER_BASE + 9] ; Appelle gfx_fill_rect
|
||||||
|
;
|
||||||
|
; Cette méthode isole totalement votre bibliothèque GUI du driver.
|
||||||
|
; Si vous changez le code du driver, tant que la table au début
|
||||||
|
; ne change pas d'ordre, la GUI n'a pas besoin d'être recompilée.
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
; initialise le mode graphique (via l'int 10h)
|
; initialise le mode graphique (via l'int 10h)
|
||||||
;
|
;
|
||||||
|
|
@ -83,6 +111,31 @@ gfx_calc_addr:
|
||||||
pop cx
|
pop cx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
; Dessine un pixel, accès VRAM direct.
|
||||||
|
;
|
||||||
|
; CX = x (0..639)
|
||||||
|
; DX = y (0..199)
|
||||||
|
; ES = Target Segment (usually VIDEO_SEG)
|
||||||
|
; BL = color (0=black, !=0=white)
|
||||||
|
; ------------------------------------------------------------
|
||||||
|
gfx_local_putpixel:
|
||||||
|
call gfx_calc_addr
|
||||||
|
|
||||||
|
; write
|
||||||
|
cmp bl, 0
|
||||||
|
je .clear
|
||||||
|
.set:
|
||||||
|
or byte [es:di], ah
|
||||||
|
jmp .done
|
||||||
|
|
||||||
|
.clear:
|
||||||
|
not ah
|
||||||
|
and byte [es:di], ah
|
||||||
|
|
||||||
|
.done:
|
||||||
|
ret
|
||||||
|
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
; Dessine un pixel, accès VRAM direct.
|
; Dessine un pixel, accès VRAM direct.
|
||||||
;
|
;
|
||||||
|
|
@ -91,7 +144,7 @@ gfx_calc_addr:
|
||||||
; BL = color (0=black, !=0=white)
|
; BL = color (0=black, !=0=white)
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
gfx_putpixel:
|
gfx_putpixel:
|
||||||
pusha
|
push ax
|
||||||
push di
|
push di
|
||||||
push es
|
push es
|
||||||
|
|
||||||
|
|
@ -113,7 +166,7 @@ gfx_putpixel:
|
||||||
.done:
|
.done:
|
||||||
pop es
|
pop es
|
||||||
pop di
|
pop di
|
||||||
popa
|
pop ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
|
|
@ -121,7 +174,6 @@ gfx_putpixel:
|
||||||
; Out: AL=0/1
|
; Out: AL=0/1
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
gfx_getpixel:
|
gfx_getpixel:
|
||||||
push ax
|
|
||||||
push di
|
push di
|
||||||
push es
|
push es
|
||||||
|
|
||||||
|
|
@ -132,7 +184,6 @@ gfx_getpixel:
|
||||||
|
|
||||||
pop es
|
pop es
|
||||||
pop di
|
pop di
|
||||||
pop ax
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; ------------------------------------------------------------
|
; ------------------------------------------------------------
|
||||||
|
|
@ -510,7 +561,7 @@ gfx_cursor_restorebg:
|
||||||
jl .no_odd_bank
|
jl .no_odd_bank
|
||||||
neg dx ; Y est déja une ligne impaire, on retire l'offset
|
neg dx ; Y est déja une ligne impaire, on retire l'offset
|
||||||
.no_odd_bank:
|
.no_odd_bank:
|
||||||
|
|
||||||
mov ax, BDA_MOUSE + mouse.bkg_buffer
|
mov ax, BDA_MOUSE + mouse.bkg_buffer
|
||||||
mov si, ax ; DS:SI = buffer de sauvegarde
|
mov si, ax ; DS:SI = buffer de sauvegarde
|
||||||
mov bx, 8
|
mov bx, 8
|
||||||
|
|
|
||||||
|
|
@ -384,12 +384,12 @@ isr_mouse_handler:
|
||||||
mov word [BDA_MOUSE + mouse.y], 199
|
mov word [BDA_MOUSE + mouse.y], 199
|
||||||
.y_ok_high:
|
.y_ok_high:
|
||||||
; restaurer l'ancien arrière plan du curseur
|
; restaurer l'ancien arrière plan du curseur
|
||||||
;call gfx_cursor_restorebg
|
call gfx_cursor_restorebg
|
||||||
|
|
||||||
; sauvegarder le nouvel arrière plan du curseur
|
; sauvegarder le nouvel arrière plan du curseur
|
||||||
;call gfx_cursor_savebg
|
call gfx_cursor_savebg
|
||||||
|
|
||||||
;call gfx_cursor_draw
|
call gfx_cursor_draw
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
mov al, 0x20
|
mov al, 0x20
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue