Import backup from 2003-08-16
This commit is contained in:
parent
588b3f06ba
commit
149541fbf1
@ -15,7 +15,7 @@
|
|||||||
%define BOOT_VESA 0x0002 ;2 - 0 for console, otherwise VESA mode
|
%define BOOT_VESA 0x0002 ;2 - 0 for console, otherwise VESA mode
|
||||||
%define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string
|
%define BOOT_VESA_OEM 0x0004 ;258 - null-terminated OEM identification string
|
||||||
%define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock
|
%define BOOT_VESA_VBE 0x0106 ;512 - copy of VESA VBEInfoBlock
|
||||||
%define BOOT_ 0x0306
|
;%define BOOT_ 0x0306
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
idt.inc
2
idt.inc
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
idtr:
|
idtr:
|
||||||
dw 49*8-1 ;size of idt
|
dw 50*8-1 ;size of idt
|
||||||
dd IDT ;address of idt
|
dd IDT ;address of idt
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ copy_gdt:
|
|||||||
mov edi, IDT ;destination
|
mov edi, IDT ;destination
|
||||||
mov esi, isr_0 ;address of isr0
|
mov esi, isr_0 ;address of isr0
|
||||||
mov edx, isr_1-isr_0 ;distance between isr labels
|
mov edx, isr_1-isr_0 ;distance between isr labels
|
||||||
mov ecx, 49 ;number of isrlabels
|
mov ecx, 50 ;number of isrlabels
|
||||||
fill_idt:
|
fill_idt:
|
||||||
mov ebx, esi
|
mov ebx, esi
|
||||||
mov ax, si
|
mov ax, si
|
||||||
|
2
kernel.c
2
kernel.c
@ -27,7 +27,7 @@ void isr(int num)
|
|||||||
{
|
{
|
||||||
(*(char*)0xB8000)++;
|
(*(char*)0xB8000)++;
|
||||||
*(char*)0xB8001 = 7;
|
*(char*)0xB8001 = 7;
|
||||||
|
eoi();
|
||||||
}
|
}
|
||||||
eoi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
97
stage2.asm
97
stage2.asm
@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
%include "bootdef.inc"
|
%include "bootdef.inc"
|
||||||
|
|
||||||
|
%define VESA_MODEINFO_SEG 0x0120
|
||||||
|
%define VESA_MODELIST_SEG 0x0140
|
||||||
|
%define GOOD_MODELIST_SEG 0x0160
|
||||||
|
|
||||||
[bits 16]
|
[bits 16]
|
||||||
|
|
||||||
org BOOT_STAGE2_ADD
|
org BOOT_STAGE2_ADD
|
||||||
@ -286,6 +290,98 @@ vesa_copyvbe:
|
|||||||
mov si, dx
|
mov si, dx
|
||||||
shr edx, 16
|
shr edx, 16
|
||||||
mov ds, dx ;ds:si points to video mode list
|
mov ds, dx ;ds:si points to video mode list
|
||||||
|
mov ax, GOOD_MODELIST_SEG
|
||||||
|
mov es, ax
|
||||||
|
xor di, di
|
||||||
|
vesa_copymodes:
|
||||||
|
lodsw
|
||||||
|
stosw
|
||||||
|
cmp ax, 0xffff
|
||||||
|
jnz vesa_copymodes
|
||||||
|
|
||||||
|
mov ax, GOOD_MODELIST_SEG
|
||||||
|
mov es, ax
|
||||||
|
xor di, di
|
||||||
|
mov cx, 256
|
||||||
|
mov ax, 0xffff
|
||||||
|
clear_good_mode_list_loop:
|
||||||
|
stosw
|
||||||
|
loop clear_good_mode_list_loop
|
||||||
|
|
||||||
|
mov ax, VESA_MODELIST_SEG
|
||||||
|
mov ds, ax
|
||||||
|
xor si, si ;ds:si points to video mode list where we can edit it :)
|
||||||
|
xor dx, dx ;dx=what good mode # we are on
|
||||||
|
vesa_readmodeinfo_loop:
|
||||||
|
mov ax, VESA_MODEINFO_SEG
|
||||||
|
mov es, ax
|
||||||
|
xor di, di
|
||||||
|
lodsw
|
||||||
|
cmp ax, 0xffff
|
||||||
|
jnz vesa_notendofmodes
|
||||||
|
jmp vesa_endofmodes
|
||||||
|
vesa_notendofmodes:
|
||||||
|
mov cx, ax
|
||||||
|
mov ax, 0x4F01
|
||||||
|
int 0x10
|
||||||
|
call checkvesa
|
||||||
|
xor di, di ;es:di -> ModeInfoBlock struc, ds:si -> video mode list
|
||||||
|
mov ax, [es:di] ;ModeAttributes
|
||||||
|
test al, 1 ;mode supported
|
||||||
|
jz vesa_modenogood
|
||||||
|
test al, 8 ;color mode
|
||||||
|
jz vesa_modenogood
|
||||||
|
test al, 0x10 ;graphics mode
|
||||||
|
jz vesa_modenogood
|
||||||
|
mov ax, [es:di+18] ;XResolution
|
||||||
|
mov bx, [es:di+20] ;YResolution
|
||||||
|
cmp ax, 640 ;640x480
|
||||||
|
jnz res_goon1
|
||||||
|
cmp bx, 480
|
||||||
|
jnz vesa_modenogood
|
||||||
|
jmp vesa_modegood
|
||||||
|
res_goon1:
|
||||||
|
cmp ax, 800
|
||||||
|
jnz res_goon2
|
||||||
|
cmp bx, 600
|
||||||
|
jnz vesa_modenogood
|
||||||
|
jmp vesa_modegood
|
||||||
|
res_goon2:
|
||||||
|
cmp ax, 1024
|
||||||
|
jnz res_goon3
|
||||||
|
cmp bx, 768
|
||||||
|
jnz vesa_modenogood
|
||||||
|
jmp vesa_modegood
|
||||||
|
res_goon3:
|
||||||
|
cmp ax, 1280
|
||||||
|
jnz res_goon4
|
||||||
|
cmp bx, 1024
|
||||||
|
jz vesa_modegood
|
||||||
|
cmp bx, 960
|
||||||
|
jz vesa_modegood
|
||||||
|
jmp vesa_modenogood
|
||||||
|
res_goon4:
|
||||||
|
cmp ax, 1600
|
||||||
|
jnz vesa_modenogood
|
||||||
|
cmp bx, 1200
|
||||||
|
jnz vesa_modenogood
|
||||||
|
vesa_modegood:
|
||||||
|
mov ax, 0xb800
|
||||||
|
mov es, ax
|
||||||
|
mov ax, 160
|
||||||
|
push dx
|
||||||
|
mul dx ;ax=160*#ofgoodmode
|
||||||
|
pop dx
|
||||||
|
add ax, 160*2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jmp vesa_readmodeinfo_loop
|
||||||
|
vesa_modenogood:
|
||||||
|
mov word [ds:si], 0
|
||||||
|
jmp vesa_readmodeinfo_loop
|
||||||
|
|
||||||
|
vesa_endofmodes:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -358,6 +454,7 @@ puthex_goon2:
|
|||||||
pop ax
|
pop ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;------------------------------------------------------
|
||||||
puthex2:
|
puthex2:
|
||||||
;es:di points to video memory, always displays 2 characters!
|
;es:di points to video memory, always displays 2 characters!
|
||||||
;al holds hex value
|
;al holds hex value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user