summaryrefslogtreecommitdiff
path: root/boot/vesa_setup_16.asm
blob: 40ca0c184b2621e99d6cca25454506af9b7ae31d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
VESA_CHECK1:
    db "VESA: get modes!",0
VESA_CHECK2:
    db "VESA: get info on target mode!",0
VESA_CHECK3:
    db "VESA: switching to target mode!",0

VesaSetup:
    
    pusha

    ;VESA: get all available vesa modes!
    mov ax,0	; set target address in es:di (0:offset)
    mov es,ax
    mov di,VESA_MODES
    mov ax,0x4f00   ;vesa function: Get Controller Info
    int 0x10	; call the interrupt to get the data from the bios!
    vesa_err:
    mov bx, VESA_CHECK1
    call print_string
    call print_nextline
    cmp ax,0x004f
    je vesa_ok
    jmp vesa_err
    vesa_ok:
    ;


    ;VESA: get vesa info on mode of interest
    mov ax,0	; set target address in es:di (0:offset)
    mov es,ax
    mov di,VESA_MODE_INFO
    mov ax,0x4f01   ;vesa function: Get Mode Info
    mov cx,VESA_MODE_SELECT   
    int 0x10	; call the interrupt to get the data from the bios!
    vesa_err2:
    mov bx, VESA_CHECK2
    call print_string
    call print_nextline
    cmp ax,0x004f
    je vesa_ok2
    jmp vesa_err2
    vesa_ok2:


    ;VESA: finally switch to the mode of choice!
    mov ax,0x4f02   ;vesa function: Set Mode
    mov bx,VESA_MODE_SELECT 
    int 0x10
    cmp ax,0x004f
    je vesa_ok3
    vesa_err3:
    mov bx, VESA_CHECK3
    call print_string
    call print_nextline
    jmp vesa_err3
    vesa_ok3:
    popa
    ret