luxos/SysBoot/stage2/getdata.inc

98 lines
2.4 KiB
PHP

gatherinfo:
pusha
push es
xor eax, eax
mov ebx, eax
mov ecx, eax
mov edx, eax
;Boot device
mov dword [multiboot_info_bootDevice], 0 ; drive 0
;Detect current video mode
mov ah, 0Fh
int 10h
mov byte [multiboot_info_video_mode], al
mov byte [multiboot_info_video_columns], ah
mov byte [multiboot_info_video_page], bh
;Get VESA information
xor eax, eax
xor ebx, ebx
xor edx, edx
mov dword [TemporaryStorage], vbeControllerInfo
mov ax, word [TemporaryStorage]
mov dx, word [TemporaryStorage+2]
shl ax, 1
mov es, ax
mov di, dx
mov ax, 0x4f00
int 10h
cmp ax, 0x004F
; not correct
je vesa_00_ok
mov dword [multiboot_info_vbe_control_info], 0x0 ; failure
jmp vesa_00_done
; correct
vesa_00_ok:
mov dword [multiboot_info_vbe_control_info], vbeControllerInfo ; success
vesa_00_done:
;Write VBE 2.0+ Interface pointers to 0
mov word [multiboot_info_vbe_interface_seg], 0
mov word [multiboot_info_vbe_interface_off], 0
mov word [multiboot_info_vbe_interface_len], 0
;Get VESA Current mode
mov ax, 4f03h
int 10h
cmp ax, 004fh
je vesa_01_ok
; not ok:
mov word [multiboot_info_vbe_mode], 0
jmp vesa_01_done
vesa_01_ok:
mov word [multiboot_info_vbe_mode], bx
vesa_01_done:
;Get some info about current VESA mode
xor eax, eax
mov ebx, eax
mov edx, eax
mov eax, vbeControllerInfo
push eax
and eax, 0fh
mov dx, ax
pop eax
shr eax, 4
mov es, ax
mov di, dx
mov ax, 4f01h
mov cx, [multiboot_info_vbe_mode]
int 10h
cmp ax, 004fh
je vesa_02_ok
; not ok:
mov word [multiboot_info_vbe_mode_info], 0
jmp vesa_02_done
vesa_02_ok:
mov word [multiboot_info_vbe_mode_info], vbeModeInfo
vesa_02_done:
pop es
popa
ret