add new choose of video mode

git-svn-id: svn://kolibrios.org@713 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2008-02-07 12:07:20 +00:00
parent 723d4d3618
commit fde6b79dcc
4 changed files with 151 additions and 297 deletions

View File

@ -105,6 +105,7 @@ sayerr_plain:
;
;=========================================================================
include 'bootvesa.inc' ;Include source for boot vesa
start_of_code:
cld
@ -285,6 +286,23 @@ wait_loop: ; variant 2
; wait until 8042 controller is ready
loopnz wait_loop
;;;/diamond today 5.02.2008
; set keyboard typematic rate & delay
mov al, 0xf3
out 0x60, al
xor cx, cx
@@:
in al, 64h
test al, 2
loopnz @b
mov al, 0
out 0x60, al
xor cx, cx
@@:
in al, 64h
test al, 2
loopnz @b
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; --------------- APM ---------------------
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
mov ax, 0x5300
@ -321,78 +339,46 @@ wait_loop: ; variant 2
apm_end:
_setcursor d80x25_top_num, 0
; DISPLAY VESA INFORMATION
;CHECK current of code
cmp [cfgmanager.loader_block], -1
jz noloaderblock
les bx, [cfgmanager.loader_block]
cmp byte [es:bx], 1
mov si, loader_block_error
jnz sayerr
noloaderblock:
; DISPLAY VESA INFORMATION
call print_vesa_info
call calc_vmodes_table
call check_first_parm ;check and enable cursor_pos
mov ax, 0x4f00
mov di, 0xa000
int 0x10
cmp ax, 0x004f
mov si, novesa
jnz @f
mov ax, [es:di+4]
add ax, '0'*256+'0'
mov si, vervesa
mov [si+vervesa_off], ah
mov [si+vervesa_off+2], al
@@: call print
; \begin{diamond}[30.11.2005]
cfgmanager:
; settings:
; a) preboot_graph = graphical mode
; preboot_gprobe = probe this mode?
; b) preboot_biosdisk = use BIOS disks through V86 emulation?
; b) preboot_dma = use DMA access?
; c) preboot_vrrm = use VRR?
; d) preboot_device = from what boot?
mov di, preboot_graph
; check bootloader block
cmp [.loader_block], -1
jz .noloaderblock
les bx, [.loader_block]
cmp byte [es:bx], 1
mov si, loader_block_error
jnz sayerr
test byte [es:bx+1], 1
jz @f
; image in memory present
cmp [di+preboot_device-preboot_graph], 0
jnz @f
mov [di+preboot_device-preboot_graph], 3
@@:
.noloaderblock:
; determine default settings
mov [.bSettingsChanged], 0
cmp byte [di], 0
jnz .preboot_gr_end
mov [di+preboot_gprobe-preboot_graph], 0
mov al, [vervesa+vervesa_off]
cmp al, 'x'
jz .novesa
cmp al, '1'
jz .vesa12
mov [di+preboot_gprobe-preboot_graph], 2
mov al, 3
jmp @f
.vesa12:
mov al, 7
jmp @f
.novesa:
mov al, 10
@@:
mov [di], al
.preboot_gr_end:
; following 8 lines set variables to 1 if its current value is 0
cmp [di+preboot_dma-preboot_graph], 1
adc [di+preboot_dma-preboot_graph], 0
cmp [di+preboot_biosdisk-preboot_graph], 1
adc [di+preboot_biosdisk-preboot_graph], 0
cmp [di+preboot_vrrm-preboot_graph], 1
adc [di+preboot_vrrm-preboot_graph], 0
cmp [di+preboot_device-preboot_graph], 1
adc [di+preboot_device-preboot_graph], 0
;.preboot_gr_end:
; following 6 lines set variables to 1 if its current value is 0
cmp byte[preboot_dma], 1
adc byte[preboot_dma], 0
cmp byte[preboot_vrrm], 1
adc byte[preboot_vrrm], 0
cmp byte[preboot_device], 1
adc byte[preboot_device], 0
; notify user
_setcursor 5,2
mov si, linef
call print
call printplain
mov si, start_msg
call print
mov si, time_msg
@ -408,48 +394,9 @@ cfgmanager:
call print
mov si, curvideo_msg
call print
mov al, [preboot_graph]
cmp al, 8
ja .pnovesa
mov dl, al
and eax, 3
mov si, [modes_msg+eax*2]
call printplain
mov si, modevesa20
cmp dl, 4
jbe @f
mov si, modevesa12
@@:
call printplain
cmp dl, 4
ja .x
mov si, probeno_msg
cmp [preboot_gprobe], 2
jnz @f
mov si, probeok_msg
@@:
call printplain
.x:
jmp .c
.pnovesa:
cmp al, 9
mov si, mode9
jz @b
mov si, mode10
jmp @b
.c:
mov si, linef
call printplain
; mov si, dma_msg
; call print
; cmp [preboot_dma], 2
; mov si, on_msg
; jb @f
; mov si, off_msg
; ja @f
; mov si, readonly_msg
;@@:
; call printplain
call draw_current_vmode
mov si, usebd_msg
cmp [preboot_biosdisk], 1
call .say_on_off
@ -468,18 +415,22 @@ cfgmanager:
cli
push 0
pop es
mov eax, [es:8*4]
mov [.oldtimer], eax
mov eax, [.timer]
mov [es:8*4], eax
push dword [es:8*4]
pop dword [.oldtimer]
push dword [.timer]
pop dword [es:8*4]
; mov eax, [es:8*4]
; mov [.oldtimer], eax
; mov eax, [.timer]
; mov [es:8*4], eax
sti
; wait for keypressed
mov ah, 0
xor ax,ax
int 16h
push ax
; restore timer interrupt
push 0
pop es
; push 0
; pop es
mov eax, [.oldtimer]
mov [es:8*4], eax
mov [.timer], eax
@ -508,31 +459,38 @@ cfgmanager:
_setcursor 13,0
.d:
mov [.bSettingsChanged], 1
mov si, space_msg
call printplain
_setcursor 15,0
mov cx, 6
@@:
call printplain
loop @b
call clear_vmodes_table ;clear vmodes_table
jmp .printcfg
.change_a:
_setcursor 15,0
mov si, gr_mode
call printplain
mov bx, '09'
call getkey
mov [preboot_graph], al
cmp al, 4
ja @f
mov si, probetext
call printplain
mov bx, '12'
call getkey
mov [preboot_gprobe], al
@@:
_setcursor 10,0
.loops:
call draw_vmodes_table
xor ax,ax
int 0x16
; call clear_table_cursor ;clear current position of cursor
mov si,word [cursor_pos]
cmp ah,0x48;x,0x48E0 ; up
jne .down
cmp si,modes_table
jbe .loops
sub word [cursor_pos],size_of_step
jmp .loops
.down: cmp ah,0x50;x,0x50E0 ; down
jne .enter
cmp word[es:si+10],-1
je .loops
add word [cursor_pos],size_of_step
jmp .loops
.enter: cmp al,0x0D;x,0x1C0D ; enter
jne .loops
push word [cursor_pos]
pop word [preboot_graph] ;save choose
jmp .d
.change_b:
_setcursor 15,0
; mov si, ask_dma
@ -556,6 +514,7 @@ cfgmanager:
mov [preboot_vrrm], al
_setcursor 12,0
jmp .d
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.say_on_off:
pushf
call print
@ -687,115 +646,7 @@ end if
; ASK GRAPHICS MODE
movzx ax, [preboot_graph]
push 0
pop es
; address is gr_table+6*(ax-1)
add ax, ax
lea si, [gr_table + eax + eax*2 - 6]
mov bx, [si+0]
mov cx, [si+2]
mov dx, [si+4]
cmp al, 9*2
mov al, 32 ; BPP
jb @f
mov [es:0x9000], al
or dword [es:0x9018], 0xFFFFFFFF; 0x800000
@@:
mov [es:0x9008], bx
mov [es:0x900A], cx
mov [es:0x900C], dx
test bh, bh
jz nov
; USE DEFAULTS OR PROBE
; bx - mode : cx - x size : dx - y size
cmp [preboot_gprobe], 1
jz noprobe
mov bx, 0x100
newprobe:
inc bx
cmp bx, 0x17f
mov si, prnotfnd
jz invalid_video_mode
probemore:
push cx
mov ax, 0x4f01
mov cx, bx
mov di, 0xa000
int 0x10
pop cx
test byte [es:di], 80h ; lfb?
jz newprobe
cmp [es:di+0x12], cx ; x size?
jnz newprobe
cmp [es:di+0x14], dx ; y size?
jnz newprobe
cmp byte [es:di+0x19], 32 ;24
jb newprobe
; add bx, 0100000000000000b
or bh, 40h
mov [es:0x9008], bx
noprobe:
; FIND VESA 2.0 LFB & BPP
mov ax, 0x4f01
mov cx, bx
and cx, 0xfff
mov di, 0xa000
int 0x10
; LFB
mov eax, [es:di+0x28]
mov [es:0x9018], eax
; ---- vbe voodoo
BytesPerLine equ 0x10
mov ax, [es:di+BytesPerLine]
mov [es:0x9001], ax
; BPP
mov al, byte [es:di+0x19]
mov [es:0x9000], al
nov:
cmp al, 24
mov si, bt24
jz bppl
cmp al, 32
mov si, bt32
jz bppl
mov si, btns
invalid_video_mode:
call print
_setcursor (d80x25_top_num+2), 0
mov si, start_msg
call print
jmp cfgmanager.printcfg
bppl:
call print
; FIND VESA 1.2 PM BANK SWITCH ADDRESS
push es
mov ax, 0x4f0A
xor bx, bx
int 0x10
xor eax, eax
mov ax, es
shl eax, 4
movzx ebx, di
add eax, ebx
mov bx, [es:di]
add eax, ebx
pop es
mov [es:0x9014], eax
call set_vmode
; GRAPHICS ACCELERATION
; force yes
@ -1109,7 +960,7 @@ setgr:
int 0x10
test ah, ah
mov si, fatalsel
jnz sayerr
jnz v_mode_error
; set mode 0x12 graphics registers:
cmp bx, 0x12
jne gmok2

View File

@ -18,7 +18,7 @@ d80x25_bottom_num = 3
novesa db "Display: EGA/CGA",13,10,0
vervesa db "Version of Vesa: Vesa x.x",13,10,0
vervesa_off=22
msg_apm db " APM x.x ", 0
msg_apm db " APM x.x ", 0
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
db "[3] 1024x768, [4] 1280x1024",13,10
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
@ -100,3 +100,9 @@ pdm4 db "create blank image",13,10,0
loading_msg db "Loading KolibriOS...",0
save_quest db "Remember current settings? [y/n]: ",0
loader_block_error db "Bootloader data invalid, I cannot continue. Stopped.",0
_st db 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿',13,10,0
_r1 db 186,' ³ 320x200 EGA/CGA 256 colors ³Û³',13,10,0
_r2 db 186,' ³ 640x480 VGA 16 colors ³Û³',13,10,0
_rs db 186,' ³ ????x????@?? SVGA VESA ³Û³',13,10,0
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0

View File

@ -15,55 +15,39 @@ d80x25_bottom:
line_full_bottom
d80x25_bottom_num = 3
msg_apm db " APM x.x ", 0
novesa db "‚¨¤¥®ª àâ : EGA/CGA",13,10,0
vervesa db "‚¥àá¨ï VESA: Vesa x.x",13,10,0
vervesa_off=19
msg_apm db " APM x.x ", 0
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
db "[3] 1024x768, [4] 1280x1024",13,10
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
db "[7] 1024x768, [8] 1280x1024",13,10
db 186," EGA/CGA 256 –¢¥â®¢: [9] 320x200, "
db "VGA 16 –¢¥â®¢: [0] 640x480",13,10
db 186," ‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",0
bt24 db "ƒ«ã¡¨­  梥â : 24",13,10,0
bt32 db "ƒ«ã¡¨­  梥â : 32",13,10,0
s_vesa db "‚¥àá¨ï VESA: "
.ver db "?.?",13,10,0
;vervesa db "‚¥àá¨ï VESA: Vesa x.x",13,10,0
;vervesa_off=19
gr_mode db "‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",13,10,0
s_bpp db 13,10,186," ƒ«ã¡¨­  梥â : "
.bpp dw "??"
db 13,10,0
vrrmprint db "ˆá¯®«ì§®¢ âì VRR? (ç áâ®â  ª ¤à®¢ ¢ëè¥ 60 ƒæ"
db " ⮫쪮 ¤«ï ¯¥à¥å®¤®¢:",13,10
db 186," 1024*768>800*600 ¨ 800*600>640*480) [1-¤ , 2-­¥â]: ",0
;askmouse db "Œëèì:" ; 186, " "
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
; db " ‚ë¡¥à¨â¥ ¯®àâ [1-3]: ",0
;no_com1 db 13,10,186," No COM1 mouse",0
;no_com2 db 13,10,186," No COM2 mouse",0
;ask_dma db "ˆá¯®«ì§®¢ âì DMA ¤«ï ¤®áâ㯠 ª HDD? [1-¤ , 2-⮫쪮 ç⥭¨¥, 3-­¥â]: ",0
ask_bd db "„®¡ ¢¨âì ¤¨áª¨, ¢¨¤¨¬ë¥ ç¥à¥§ BIOS ¢ ०¨¬¥ V86? [1-¤ , 2-­¥â]: ",0
;gr_direct db 186," ˆá¯®«ì§®¢ âì «¨­¥©­ë© ¢¨¤¥®¡ãä¥à? "
; db "[1-¤ /2-­¥â]: ",0
;mem_model db 13,10,186," Ž¡ê+¬ ¯ ¬ï⨠[1-16 Mb / 2-32 Mb / "
; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0
;bootlog db 13,10,186," <20>à®á¬®âà¥âì ¦ãà­ « § £à㧪¨? [1-­¥â/2-¤ ]: ",0
bdev db "‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §;"
db 13,10,186," "
db "4-ᮧ¤ âì ç¨áâë© ®¡à §]: ",0
probetext db 13,10,13,10,186," ‘â ­¤ àâ­ë© ¢¨¤¥®à¥¦¨¬? [1-¤ , "
db "2-¯à®¢¥à¨âì ¤à㣨¥ (Vesa 3.0)]: ",0
;memokz256 db 13,10,186," RAM 256 Mb",0
;memokz128 db 13,10,186," RAM 128 Mb",0
;memokz64 db 13,10,186," RAM 64 Mb",0
;memokz32 db 13,10,186," RAM 32 Mb",0
;memokz16 db 13,10,186," RAM 16 Mb",0
;probetext db 13,10,13,10,186," ‘â ­¤ àâ­ë© ¢¨¤¥®à¥¦¨¬? [1-¤ , "
; db "2-¯à®¢¥à¨âì ¤à㣨¥ (Vesa 3.0)]: ",0
prnotfnd db "Žè¨¡ª  - ‚¨¤¥®à¥¦¨¬ ­¥ ­ ©¤¥­.",0
;modena db "Žè¨¡ª  - ’ॡã¥âáï ¯®¤¤¥à¦ª  VBE 0x112+.",0
not386 db "Žè¨¡ª  - ’ॡã¥âáï ¯à®æ¥áá®à 386+.",0
btns db "Žè¨¡ª  - <20>¥ ¬®£ã ®¯à¥¤¥«¨âì £«ã¡¨­ã 梥â .",0
;not_PENT_PRO db "Žè¨¡ª  - ’ॡã¥âáï ¯à®æ¥áá®à Pentium PRO ¨«¨ ¢ëè¥.",0
;btns db "Žè¨¡ª  - <20>¥ ¬®£ã ®¯à¥¤¥«¨âì £«ã¡¨­ã 梥â .",0
fatalsel db "Žè¨¡ª  - ‚ë¡à ­­ë© ¢¨¤¥®à¥¦¨¬ ­¥ ¯®¤¤¥à¦¨¢ ¥âáï.",0
pres_key db "<EFBFBD> ¦¨¬¨â¥ «î¡ãî ª« ¢¨èã, ¤«ï ¯¥à¥å®¤  ¢ ¢ë¡®à ०¨¬®¢.",0
badsect db 13,10,186," Žè¨¡ª  - „¨áª¥â  ¯®¢à¥¦¤¥­ . <20>®¯à®¡ã©â¥ ¤àã£ãî.",0
memmovefailed db 13,10,186," Žè¨¡ª  - Int 0x15 move failed.",0
okt db " ... OK"
linef db 13,10,0
linef db 13,10,0
diskload db "‡ £à㧪  ¤¨áª¥âë: 00 %",8,8,8,8,0
pros db "00"
backspace2 db 8,8,0
@ -74,22 +58,18 @@ time_str db " 5 ᥪ㭤 "
db " ¤®  ¢â®¬ â¨ç¥áª®£® ¯à®¤®«¦¥­¨ï",13,10,0
current_cfg_msg db "’¥ªã騥 ­ áâனª¨:",13,10,0
curvideo_msg db " [a] ‚¨¤¥®à¥¦¨¬: ",0
mode1 db "640x480",0
mode2 db "800x600",0
mode3 db "1024x768",0
mode4 db "1280x1024",0
modes_msg dw mode4,mode1,mode2,mode3
modevesa20 db " á LFB",0
modevesa12 db ", VESA 1.2 Bnk",0
mode9 db "320x200, EGA/CGA 256 梥⮢",0
mode10 db "640x480, VGA 16 梥⮢",0
probeno_msg db " (áâ ­¤ àâ­ë© ¢¨¤¥®à¥¦¨¬)",0
probeok_msg db " (¯à®¢¥à¨âì ­¥áâ ­¤ àâ­ë¥ ०¨¬ë)",0
mode0 db "320x200, EGA/CGA 256 梥⮢",13,10,0
mode9 db "640x480, VGA 16 梥⮢",13,10,0
;probeno_msg db " (áâ ­¤ àâ­ë© ¢¨¤¥®à¥¦¨¬)",0
;probeok_msg db " (¯à®¢¥à¨âì ­¥áâ ­¤ àâ­ë¥ ०¨¬ë)",0
;dma_msg db " [b] ˆá¯®«ì§®¢ ­¨¥ DMA ¤«ï ¤®áâ㯠 ª HDD:",0
usebd_msg db " [b] „®¡ ¢¨âì ¤¨áª¨, ¢¨¤¨¬ë¥ ç¥à¥§ BIOS:",0
on_msg db " ¢ª«",13,10,0
off_msg db " ¢ëª«",13,10,0
;readonly_msg db " ⮫쪮 ç⥭¨¥",13,10,0
readonly_msg db " ⮫쪮 ç⥭¨¥",13,10,0
vrrm_msg db " [c] ˆá¯®«ì§®¢ ­¨¥ VRR:",0
preboot_device_msg db " [d] Ž¡à § ¤¨áª¥âë: ",0
preboot_device_msgs dw 0,pdm1,pdm2,pdm3,pdm4
@ -100,3 +80,34 @@ pdm4 db "ᮧ
loading_msg db "ˆ¤ñâ § £à㧪  KolibriOS...",0
save_quest db "‡ ¯®¬­¨âì ⥪ã騥 ­ áâனª¨? [y/n]: ",0
loader_block_error db "Žè¨¡ª  ¢ ¤ ­­ëå ­ ç «ì­®£® § £àã§ç¨ª , ¯à®¤®«¦¥­¨¥ ­¥¢®§¬®¦­®.",0
;_oem db 'oem: ',0
;db 5
;s_ven_intel db 'Intel'
;db 2
;s_ven_s3 db 'S3'
;;db 5
;s_ven_bochs db 'Bochs'
;db 8
;s_ven_vmware db 'V M ware'
;s_mode db " ????-????-?? (?) ",0
;s_mode1 db " 0640-0480-04 (a) 0320-0200-08 (b) ",13,10,0
_st db 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿',13,10,0
_r1 db 186,' ³ 320x200 EGA/CGA 256 梥⮢ ³Û³',13,10,0
_r2 db 186,' ³ 640x480 VGA 16 梥⮢ ³Û³',13,10,0
_rs db 186,' ³ ????x????@?? SVGA VESA ³Û³',13,10,0
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÙ',13,10,0
;_tl db 186,' ÚÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄ¿',13,10,\
; 186,' ³ 4 ³ 8 ³ 15 ³ 16 ³ 24 ³ 32 ³',13,10,\
; 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄ¿',13,10,0
;_rs db 186,' ³ ????x???? ³ ³ ³ ³ ³ ³ ³Û³',13,10,0
;_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÙ',13,10,0
;_sel1 db 0x1A,0
;_sel2 db 0x1B,0
;_selc db ' ',0

View File

@ -21,20 +21,6 @@ kernel_restart_bootblock:
dw 1 ; floppy image is in memory
dd 0 ; cannot save parameters
align 4
; videomodes table
gr_table:
dw 0x112+0100000000000000b , 640 , 480 ; 1
dw 0x115+0100000000000000b , 800 , 600 ; 2
dw 0x118+0100000000000000b , 1024 , 768 ; 3
dw 0x11B+0100000000000000b , 1280 , 1024 ; 4
dw 0x112 , 640 , 480 ; 5
dw 0x115 , 800 , 600 ; 6
dw 0x118 , 1024 , 768 ; 7
dw 0x11B , 1280 ,1024 ; 8
dw 0x13, 640, 480 ; 9
dw 0x12, 640, 480 ; 0
; table for move to extended memory (int 15h, ah=87h)
align 8
movedesc: