vga Drivers +Mouse
This commit is contained in:
parent
0775fe6193
commit
7c9ad48b19
10 changed files with 730 additions and 404 deletions
|
|
@ -28,6 +28,9 @@
|
|||
%define BDA_CUSTOM_SEG 0x0050 ; custom data (mouse, gfx cursor, etc..)
|
||||
%define BDA_GUI_WIDGET 0x0070 ; Segment de données UI (Safe: après Stack, avant Heap)
|
||||
|
||||
%define PTR_MOUSE 0x0000
|
||||
%define PTR_GFX (PTR_MOUSE + mouse_size)
|
||||
|
||||
; video related information (compatible with VGA bios)
|
||||
%define BDA_VIDEO_CURR_MODE 0x0049
|
||||
%define BDA_VIDEO_COLUMNS 0x004A
|
||||
|
|
@ -37,7 +40,7 @@
|
|||
; information relative à la souris
|
||||
;
|
||||
|
||||
%define BDA_BitPP 4
|
||||
%define BDA_BitPPixel 4
|
||||
|
||||
%define BKG_DWORDS_PER_LINE 1 ; 1 dword stocké par ligne
|
||||
%define BKG_LINES 16
|
||||
|
|
@ -45,55 +48,52 @@
|
|||
%define BKG_TOTAL_BYTES (BKG_TOTAL_DWORDS * 4) ; 64
|
||||
|
||||
struc mouse
|
||||
.buffer resb 4 ; i8042 input buffer
|
||||
.idx resb 1 ; index in the buffer
|
||||
.packetlen resb 1 ; max buffer len (3 ou 4)
|
||||
.status resb 1 ; mouse status (button etc)
|
||||
.wheel resb 1 ; if a packet size is 4; experimental
|
||||
.x resw 1 ;
|
||||
.y resw 1 ;
|
||||
; cursor management
|
||||
.cur_x resw 1 ; preservation des x,y du background
|
||||
.cur_y resw 1 ;
|
||||
.cur_addr_start resw 1 ; adresse de départ de la sauvegarde
|
||||
.cur_drawing 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 ;
|
||||
.bkg_saved resb 1 ; background saved
|
||||
alignb 4 ; alignement 4 bytes
|
||||
; buffer for saved background
|
||||
.bkg_buffer resd 16*BDA_BitPP
|
||||
.buffer resb 4 ; i8042 input buffer
|
||||
.idx resb 1 ; index in the buffer
|
||||
.packetlen resb 1 ; max buffer len (3 ou 4)
|
||||
.status resb 1 ; mouse status (button etc)
|
||||
.wheel resb 1 ; if a packet size is 4; experimental
|
||||
.x resw 1 ;
|
||||
.y resw 1 ;
|
||||
; cursor management
|
||||
.cur_x resw 1 ; preservation des x,y du background
|
||||
.cur_y resw 1 ;
|
||||
.cur_addr_start resw 1 ; adresse de départ de la sauvegarde
|
||||
.cur_drawing 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 ;
|
||||
.bkg_saved resb 1 ; background saved
|
||||
alignb 4 ; alignement 4 bytes
|
||||
; buffer for saved background
|
||||
.bkg_buffer resd 16*BDA_BitPPixel
|
||||
endstruc
|
||||
|
||||
struc gfx
|
||||
.cur_x resw 1 ; x,y en pixel
|
||||
.cur_y resw 1
|
||||
.cur_offset resw 1 ; offset calculé pour le prochain caractère
|
||||
.cur_line_ofs resw 1 ; "interligne" +2000h ou -2000h
|
||||
.cur_shift resb 1 ; x&7 (0..7)
|
||||
.cur_mode resb 1 ;
|
||||
.cur_x resw 1 ; x,y en pixel
|
||||
.cur_y resw 1
|
||||
.cur_offset resw 1 ; offset calculé pour le prochain caractère
|
||||
.cur_line_ofs resw 1 ; "interligne" +2000h ou -2000h
|
||||
.cur_shift resb 1 ; x&7 (0..7)
|
||||
.cur_mode resb 1 ;
|
||||
endstruc
|
||||
|
||||
%define BDA_MOUSE 0x0000
|
||||
%define BDA_GFX (BDA_MOUSE + mouse_size)
|
||||
|
||||
; -----------------------------------------------------------------------------------
|
||||
; bda_setup
|
||||
; Initialise la BDA à zéro
|
||||
; -----------------------------------------------------------------------------------
|
||||
bda_setup:
|
||||
pusha
|
||||
push ds
|
||||
pusha
|
||||
push ds
|
||||
|
||||
mov ax, BDA_CUSTOM_SEG
|
||||
mov es, ax
|
||||
mov ax, BDA_CUSTOM_SEG
|
||||
mov es, ax
|
||||
|
||||
mov ax, 0x5F
|
||||
mov cx,0xFF
|
||||
xor di, di
|
||||
rep stosb ; clear BDA area
|
||||
mov ax, 0x5F
|
||||
mov cx,0xFF
|
||||
xor di, di
|
||||
rep stosb ; clear BDA area
|
||||
|
||||
pop ds
|
||||
popa
|
||||
ret
|
||||
pop ds
|
||||
popa
|
||||
ret
|
||||
|
|
@ -21,6 +21,7 @@ mouse_arrow:
|
|||
dw 1111110000111111b ; 0xFC3F
|
||||
dw 1111111000111111b ; 0xFE3F
|
||||
dw 0000000000000000b ; 0x0000
|
||||
|
||||
dw 0010000000000000b ; 0x2000
|
||||
dw 0011000000000000b ; 0x3000
|
||||
dw 0011100000000000b ; 0x3800
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
%define DEBUG_PORT 0xe9 ; 0x402 ou 0xe9
|
||||
|
||||
debug_puts:
|
||||
.next:
|
||||
.next:
|
||||
push dx
|
||||
mov dx, DEBUG_PORT
|
||||
lodsb ; AL = *SI++
|
||||
|
|
@ -31,7 +31,7 @@ debug_puts:
|
|||
jz .done
|
||||
out dx, al
|
||||
jmp .next
|
||||
.done:
|
||||
.done:
|
||||
pop dx
|
||||
ret
|
||||
|
||||
|
|
@ -49,9 +49,9 @@ debug_puthex4:
|
|||
jbe .num
|
||||
add al, 'A' - 10
|
||||
jmp .pout
|
||||
.num:
|
||||
.num:
|
||||
add al, '0'
|
||||
.pout:
|
||||
.pout:
|
||||
call debug_putc
|
||||
ret
|
||||
|
||||
|
|
@ -88,6 +88,8 @@ scr_gotoxy:
|
|||
|
||||
scr_putc:
|
||||
mov ah, 0x0E
|
||||
mov bh, 0x00
|
||||
mov bl, 0x0f
|
||||
int 10h
|
||||
ret
|
||||
|
||||
|
|
@ -98,12 +100,14 @@ scr_puthex4:
|
|||
jbe .num ; yes
|
||||
add al, 'A' - 10 ; convert to 'A'..'F'
|
||||
jmp .pout
|
||||
.num:
|
||||
add al, '0' ; convert to '0'..'9'
|
||||
.pout:
|
||||
mov ah, 0x0E
|
||||
.num:
|
||||
add al, '0' ; convert to '0'..'9'
|
||||
.pout:
|
||||
mov ah, 0x0e
|
||||
mov bh, 0x00
|
||||
mov bl, 0x0f
|
||||
int 10h
|
||||
ret
|
||||
ret
|
||||
|
||||
; AL = byte -> print 2 hex digits
|
||||
scr_puthex8:
|
||||
|
|
|
|||
Loading…
Reference in a new issue