forked from KolibriOS/kolibrios
Good-bye VESA !
git-svn-id: svn://kolibrios.org@3163 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d1a0247624
commit
edb957dfa2
@ -174,6 +174,7 @@ cpugood:
|
||||
|
||||
; --------------- APM ---------------------
|
||||
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
|
||||
if 0
|
||||
mov ax, 0x5300
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
@ -196,6 +197,7 @@ cpugood:
|
||||
mov [es:0x9054], dx
|
||||
|
||||
apm_end:
|
||||
end if
|
||||
|
||||
;CHECK current of code
|
||||
cmp [cfgmanager.loader_block], -1
|
||||
@ -208,9 +210,9 @@ apm_end:
|
||||
|
||||
noloaderblock:
|
||||
; DISPLAY VESA INFORMATION
|
||||
call print_vesa_info
|
||||
call calc_vmodes_table
|
||||
call check_first_parm ;check and enable cursor_pos
|
||||
; call print_vesa_info
|
||||
; call calc_vmodes_table
|
||||
; call check_first_parm ;check and enable cursor_pos
|
||||
|
||||
; \begin{diamond}[30.11.2005]
|
||||
cfgmanager:
|
||||
@ -264,7 +266,7 @@ cfgmanager:
|
||||
|
||||
; ASK GRAPHICS MODE
|
||||
|
||||
call set_vmode
|
||||
; call set_vmode
|
||||
|
||||
; GRAPHICS ACCELERATION
|
||||
; force yes
|
||||
@ -293,12 +295,17 @@ cfgmanager:
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
|
||||
mov bx, [es:0x9008] ; vga & 320x200
|
||||
mov ax, 0x4f02 ; Vesa
|
||||
; mov bx, [es:0x9008] ; vga & 320x200
|
||||
mov ax, 0xA000 ; AtomBIOS Fn00
|
||||
mov cx, 0x550A ; 1024x768, 32bpp, ARGB8888
|
||||
setgr:
|
||||
int 0x10
|
||||
test ah, ah
|
||||
jnz $
|
||||
mov ax, 0xA006 ; AtomBIOS Fn06
|
||||
int 0x10
|
||||
mov [es:0x9018], ebx ; LFB
|
||||
|
||||
gmok2:
|
||||
push ds
|
||||
pop es
|
||||
|
@ -1,325 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
$Revision$
|
||||
|
||||
struc VBE_VGAInfo {
|
||||
.VESASignature dd ? ; char
|
||||
.VESAVersion dw ? ; short
|
||||
.OemStringPtr dd ? ; char *
|
||||
.Capabilities dd ? ; ulong
|
||||
.VideoModePtr dd ? ; ulong
|
||||
.TotalMemory dw ? ; short
|
||||
; VBE 2.0+
|
||||
.OemSoftwareRev db ? ; short
|
||||
.OemVendorNamePtr dw ? ; char *
|
||||
.OemProductNamePtr dw ? ; char *
|
||||
.OemProductRevPtr dw ? ; char *
|
||||
.reserved rb 222 ; char
|
||||
.OemData rb 256 ; char
|
||||
}
|
||||
|
||||
struc VBE_ModeInfo {
|
||||
.ModeAttributes dw ? ; short
|
||||
.WinAAttributes db ? ; char
|
||||
.WinBAttributes db ? ; char
|
||||
.WinGranularity dw ? ; short
|
||||
.WinSize dw ? ; short
|
||||
.WinASegment dw ? ; ushort
|
||||
.WinBSegment dw ? ; ushort
|
||||
.WinFuncPtr dd ? ; void *
|
||||
.BytesPerScanLine dw ? ; short
|
||||
.XRes dw ? ; short
|
||||
.YRes dw ? ; short
|
||||
.XCharSize db ? ; char
|
||||
.YCharSize db ? ; char
|
||||
.NumberOfPlanes db ? ; char
|
||||
.BitsPerPixel db ? ; char
|
||||
.NumberOfBanks db ? ; char
|
||||
.MemoryModel db ? ; char
|
||||
.BankSize db ? ; char
|
||||
.NumberOfImagePages db ? ; char
|
||||
.res1 db ? ; char
|
||||
.RedMaskSize db ? ; char
|
||||
.RedFieldPosition db ? ; char
|
||||
.GreenMaskSize db ? ; char
|
||||
.GreenFieldPosition db ? ; char
|
||||
.BlueMaskSize db ? ; char
|
||||
.BlueFieldPosition db ? ; char
|
||||
.RsvedMaskSize db ? ; char
|
||||
.RsvedFieldPosition db ? ; char
|
||||
.DirectColorModeInfo db ? ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE
|
||||
; VBE 2.0+
|
||||
.PhysBasePtr dd ? ; ulong
|
||||
.OffScreenMemOffset dd ? ; ulong
|
||||
.OffScreenMemSize dw ? ; short
|
||||
; VBE 3.0+
|
||||
.LinbytesPerScanLine dw ? ; short
|
||||
.BankNumberOfImagePages db ? ; char
|
||||
.LinNumberOfImagePages db ? ; char
|
||||
.LinRedMaskSize db ? ; char
|
||||
.LinRedFieldPosition db ? ; char
|
||||
.LingreenMaskSize db ? ; char
|
||||
.LinGreenFieldPosition db ? ; char
|
||||
.LinBlueMaskSize db ? ; char
|
||||
.LinBlueFieldPosition db ? ; char
|
||||
.LinRsvdMaskSize db ? ; char
|
||||
.LinRsvdFieldPosition db ? ; char
|
||||
.MaxPixelClock dd ? ; ulong
|
||||
.res2 rb 190 ; char
|
||||
}
|
||||
|
||||
virtual at $A000
|
||||
vi VBE_VGAInfo
|
||||
mi VBE_ModeInfo
|
||||
modes_table:
|
||||
end virtual
|
||||
cursor_pos dw 0 ;temporary cursor storage.
|
||||
home_cursor dw 0 ;current shows rows a table
|
||||
end_cursor dw 0 ;end of position current shows rows a table
|
||||
scroll_start dw 0 ;start position of scroll bar
|
||||
scroll_end dw 0 ;end position of scroll bar
|
||||
long_v_table equ 9 ;long of visible video table
|
||||
size_of_step equ 10
|
||||
scroll_area_size equ (long_v_table-2)
|
||||
int2str:
|
||||
dec bl
|
||||
jz @f
|
||||
xor edx,edx
|
||||
div ecx
|
||||
push edx
|
||||
call int2str
|
||||
pop eax
|
||||
@@: or al,0x30
|
||||
mov [ds:di],al
|
||||
inc di
|
||||
ret
|
||||
|
||||
int2strnz:
|
||||
cmp eax,ecx
|
||||
jb @f
|
||||
xor edx,edx
|
||||
div ecx
|
||||
push edx
|
||||
call int2strnz
|
||||
pop eax
|
||||
@@: or al,0x30
|
||||
mov [es:di],al
|
||||
inc di
|
||||
ret
|
||||
|
||||
|
||||
;-------------------------------------------------------
|
||||
print_vesa_info:
|
||||
|
||||
mov [es:vi.VESASignature],'VBE2'
|
||||
mov ax,0x4F00
|
||||
mov di,vi ;0xa000
|
||||
int 0x10
|
||||
or ah,ah
|
||||
jz @f
|
||||
mov [es:vi.VESASignature],'VESA'
|
||||
mov ax,$4F00
|
||||
mov di,vi
|
||||
int 0x10
|
||||
or ah,ah
|
||||
jnz $
|
||||
@@:
|
||||
cmp [es:vi.VESASignature],'VESA'
|
||||
jne $
|
||||
cmp [es:vi.VESAVersion],0x0100
|
||||
jb $
|
||||
|
||||
.vesaok2:
|
||||
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
calc_vmodes_table:
|
||||
pushad
|
||||
|
||||
; push 0
|
||||
; pop es
|
||||
|
||||
lfs si, [es:vi.VideoModePtr]
|
||||
|
||||
mov bx,modes_table
|
||||
|
||||
.next_mode:
|
||||
mov cx,word [fs:si] ; mode number
|
||||
cmp cx,-1
|
||||
je .modes_ok.2
|
||||
|
||||
mov ax,0x4F01
|
||||
mov di,mi
|
||||
int 0x10
|
||||
|
||||
or ah,ah
|
||||
jnz .modes_ok.2 ;vesa_info.exit
|
||||
|
||||
test [es:mi.ModeAttributes],00000001b ;videomode support ?
|
||||
jz @f
|
||||
test [es:mi.ModeAttributes],00010000b ;picture ?
|
||||
jz @f
|
||||
test [es:mi.ModeAttributes],10000000b ;LFB ?
|
||||
jz @f
|
||||
|
||||
cmp [es:mi.BitsPerPixel], 32 ;to show only 32 bpp videomodes
|
||||
jb @f
|
||||
|
||||
.l0:
|
||||
cmp [es:mi.XRes],800 ; only 800x600 and higher
|
||||
jb @f
|
||||
|
||||
mov ax,[es:mi.XRes]
|
||||
mov [es:bx+0],ax ; +0[2] : resolution X
|
||||
mov ax,[es:mi.YRes]
|
||||
mov [es:bx+2],ax ; +2[2] : resolution Y
|
||||
mov ax,[es:mi.ModeAttributes]
|
||||
mov [es:bx+4],ax ; +4[2] : attributes
|
||||
|
||||
;<< cmp [s_vesa.ver],'2'
|
||||
;<< jb .lp1
|
||||
|
||||
or cx,0x4000 ; use LFB <<< ?
|
||||
.lp1: mov [es:bx+6],cx ; +6 : mode number
|
||||
movzx ax,byte [es:mi.BitsPerPixel]
|
||||
mov word [es:bx+8],ax ; +8 : bits per pixel << ?
|
||||
add bx,size_of_step ; size of record
|
||||
|
||||
@@:
|
||||
add si,2
|
||||
jmp .next_mode
|
||||
|
||||
.modes_ok.2:
|
||||
|
||||
mov word[es:bx],-1 ;end video table
|
||||
mov word[end_cursor],bx ;save end cursor position
|
||||
popad
|
||||
ret
|
||||
|
||||
check_first_parm:
|
||||
mov si,word [preboot_graph]
|
||||
test si,si
|
||||
jnz .no_zero ;if no zero
|
||||
.zerro:
|
||||
mov word[preboot_graph], ax
|
||||
|
||||
mov ax,1024
|
||||
mov bx,768
|
||||
mov si,modes_table
|
||||
call .loops
|
||||
test ax,ax
|
||||
jz .ok_found_mode
|
||||
|
||||
mov si,modes_table
|
||||
jmp .ok_found_mode
|
||||
|
||||
.no_zero:
|
||||
mov bp,word [number_vm]
|
||||
cmp bp,word [es:si+6]
|
||||
jz .ok_found_mode
|
||||
mov ax,word [x_save]
|
||||
mov bx,word [y_save]
|
||||
mov si,modes_table
|
||||
call .loops
|
||||
test ax,ax
|
||||
jz .ok_found_mode
|
||||
|
||||
mov si,modes_table
|
||||
|
||||
.ok_found_mode:
|
||||
mov word [home_cursor],si
|
||||
mov word [preboot_graph],si
|
||||
mov ax,si
|
||||
|
||||
mov ecx,long_v_table
|
||||
|
||||
.loop: add ax,size_of_step
|
||||
cmp ax,word [end_cursor]
|
||||
jae .next_step
|
||||
loop .loop
|
||||
.next_step:
|
||||
sub ax,size_of_step*long_v_table
|
||||
cmp ax,modes_table
|
||||
jae @f
|
||||
mov ax,modes_table
|
||||
@@:
|
||||
|
||||
mov word [home_cursor],ax
|
||||
mov si,[preboot_graph]
|
||||
mov word [cursor_pos],si
|
||||
|
||||
push word [es:si]
|
||||
pop word [x_save]
|
||||
push word [es:si+2]
|
||||
pop word [y_save]
|
||||
push word [es:si+6]
|
||||
pop word [number_vm]
|
||||
|
||||
ret
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.loops:
|
||||
cmp ax,word [es:si]
|
||||
jne .next
|
||||
cmp bx,word [es:si+2]
|
||||
jne .next
|
||||
je .ok
|
||||
.next: add si,size_of_step
|
||||
cmp word [es:si],-1
|
||||
je .exit
|
||||
jmp .loops
|
||||
.ok: xor ax,ax
|
||||
ret
|
||||
.exit: or ax,-1
|
||||
ret
|
||||
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
set_vmode:
|
||||
push 0 ;0;x1000
|
||||
pop es
|
||||
|
||||
mov si,word [preboot_graph] ;[preboot_graph]
|
||||
mov cx,word [es:si+6] ; number of mode
|
||||
|
||||
|
||||
mov ax,word [es:si+0] ; resolution X
|
||||
mov bx,word [es:si+2] ; resolution Y
|
||||
|
||||
|
||||
mov word [es:0x900A],ax ; resolution X
|
||||
mov word [es:0x900C],bx ; resolution Y
|
||||
mov word [es:0x9008],cx ; number of mode
|
||||
|
||||
|
||||
; VESA 2 and Vesa 3 only
|
||||
|
||||
mov ax,0x4f01
|
||||
and cx,0xfff
|
||||
mov di,mi;0xa000
|
||||
int 0x10
|
||||
; LFB
|
||||
mov eax,[es:mi.PhysBasePtr] ;di+0x28]
|
||||
mov [es:0x9018],eax
|
||||
; ---- vbe voodoo
|
||||
BytesPerLine equ 0x10
|
||||
mov ax, [es:di+BytesPerLine]
|
||||
mov [es:0x9001], ax
|
||||
; BPP
|
||||
.l0:
|
||||
mov al, byte [es:di+0x19]
|
||||
mov [es:0x9000], al
|
||||
jmp .exit
|
||||
|
||||
.exit:
|
||||
ret
|
||||
|
||||
|
||||
;=============================================================================
|
||||
|
@ -24,7 +24,7 @@ dw ((x mod 16) shl 12 + (y mod 16) shl 8 + (r mod 4) shl 3 + ((len-8) mod 8) +
|
||||
end if
|
||||
}
|
||||
|
||||
macro char_entry charpos, wdbits, numticks
|
||||
macro char_entry charpos, wdbits, numticks
|
||||
{
|
||||
dw (charpos - .chars)*16 + (wdbits mod 4)*8 + (numticks mod 8)
|
||||
}
|
||||
@ -35,7 +35,7 @@ macro char_entry charpos, wdbits, numticks
|
||||
.numfonts db 2 ; number of system fonts
|
||||
.numsptks db 32 ; number of special ticks
|
||||
.numticks dw ? ; total number of ticks
|
||||
.ticktble dd nsvf.tick_table ; general table
|
||||
.ticktble dd nsvf.tick_table ; general table
|
||||
|
||||
align 4
|
||||
; ---- special tickfields ----
|
||||
@ -53,19 +53,19 @@ nsvf_info:
|
||||
.fnt0.x db 5 ; + 0: X-width
|
||||
.fnt0.y db 9 ; + 1: Y-heigth
|
||||
.fnt0.rs dw 0 ; + 2: reserved
|
||||
.fnt0.tab dd nsvf00.table ; + 4
|
||||
.fnt0.org dd nsvf00.origs ; + 8
|
||||
.fnt0.chr dd nsvf00.chars ; +12
|
||||
.fnt0.tab dd nsvf00.table ; + 4
|
||||
.fnt0.org dd nsvf00.origs ; + 8
|
||||
.fnt0.chr dd nsvf00.chars ; +12
|
||||
|
||||
|
||||
;align 16
|
||||
; System font #1: 7x10
|
||||
.fnt1.x db 7 ; X-width
|
||||
.fnt1.y db 10 ; Y-heigth
|
||||
.fnt1.rs dw 0 ; reserved
|
||||
.fnt1.tab dd nsvf01.table
|
||||
.fnt1.org dd nsvf01.origs
|
||||
.fnt1.chr dd nsvf01.chars
|
||||
.fnt1.x db 7 ; X-width
|
||||
.fnt1.y db 10 ; Y-heigth
|
||||
.fnt1.rs dw 0 ; reserved
|
||||
.fnt1.tab dd nsvf01.table
|
||||
.fnt1.org dd nsvf01.origs
|
||||
.fnt1.chr dd nsvf01.chars
|
||||
|
||||
|
||||
align 4
|
||||
@ -76,17 +76,17 @@ nsvf:
|
||||
.tick_table:
|
||||
db 0, 0, 0, 0, 0, 0 ;32..37 (reserved)
|
||||
.v1:
|
||||
; 38 39
|
||||
; 38 39
|
||||
db 01b ; XX XX
|
||||
db 11b ; X X
|
||||
.v2:
|
||||
; 40 41 42 43 44 45
|
||||
db 0100b ;40 XXX XXX XX XX XX XX
|
||||
db 1100b ;41 X X X XX X X
|
||||
db 0001b ;42 X X X
|
||||
db 1001b ;43
|
||||
db 0101b ;44
|
||||
db 1101b ;45?
|
||||
; 40 41 42 43 44 45
|
||||
db 0100b ;40 XXX XXX XX XX XX XX
|
||||
db 1100b ;41 X X X XX X X
|
||||
db 0001b ;42 X X X
|
||||
db 1001b ;43
|
||||
db 0101b ;44
|
||||
db 1101b ;45?
|
||||
db 0 ;46
|
||||
db 0 ;47
|
||||
.v3:
|
||||
@ -101,8 +101,8 @@ nsvf:
|
||||
db 010101b ;55 X X XX
|
||||
db 011101b ;56 X XX
|
||||
db 111100b ;57 X
|
||||
db 0 ;58
|
||||
db 0 ;59
|
||||
db 0 ;58
|
||||
db 0 ;59
|
||||
db 0, 0, 0, 0 ;60..63
|
||||
.v4:
|
||||
; 64 65 66 67 68 69 70
|
||||
@ -115,13 +115,13 @@ nsvf:
|
||||
db 10100000b ;70:
|
||||
db 01010101b ;71: 71
|
||||
db 00000000b ;72: XX
|
||||
db 00000000b ;73: X
|
||||
db 00000000b ;74: X
|
||||
db 00000000b ;75: XX
|
||||
db 00000000b ;73: X
|
||||
db 00000000b ;74: X
|
||||
db 00000000b ;75: XX
|
||||
db 00000000b ;76:
|
||||
db 00000000b ;77:
|
||||
db 00000000b ;78:
|
||||
db 00000000b ;79:
|
||||
db 00000000b ;77:
|
||||
db 00000000b ;78:
|
||||
db 00000000b ;79:
|
||||
|
||||
|
||||
.v5:
|
||||
@ -154,10 +154,10 @@ nsvf:
|
||||
db 0, 0, 0, 0, 0, 0 ;106..108
|
||||
db 0, 0, 0, 0, 0, 0 ;109..111
|
||||
|
||||
.v9: 112
|
||||
.v9:
|
||||
db 00100100b, 00100100b, 00b ;112: XXX
|
||||
db 0, 0, 0 ;113: XXXX
|
||||
db 0, 0, 0 ;114: XXX
|
||||
db 0, 0, 0 ;113: XXXX
|
||||
db 0, 0, 0 ;114: XXX
|
||||
db 0, 0, 0 ;115:
|
||||
.v10:
|
||||
db 00010100b, 01010000b, 0100b ;116:
|
||||
@ -173,7 +173,7 @@ nsvf:
|
||||
db 10011001b, 10011001b, 10011001b ;124:
|
||||
db 01000100b, 01000100b, 01000000b ;125:
|
||||
db 00000000b, 00000000b, 00000000b ;126:
|
||||
db 00000000b, 00000000b, 00000000b ;127:
|
||||
db 00000000b, 00000000b, 00000000b ;127:
|
||||
.v13:
|
||||
; WARNING: 13-16 vertex fields not implemented yet!
|
||||
|
||||
|
@ -335,27 +335,27 @@ high_code:
|
||||
; -----------------------------------------
|
||||
mov al, [BOOT_VAR+0x901F] ; DMA access
|
||||
mov [allow_dma_access], al
|
||||
mov eax, 32 ; bpp
|
||||
mov eax, 32 ; << bpp
|
||||
mov [ScreenBPP],al
|
||||
mov [_display.bpp], eax
|
||||
|
||||
mov [_display.vrefresh], 60
|
||||
mov [_display.disable_mouse], __sys_disable_mouse
|
||||
|
||||
movzx eax,word [BOOT_VAR+0x900A] ; X max
|
||||
mov eax, 1024 ; << X max
|
||||
mov [_display.width], eax
|
||||
dec eax
|
||||
mov [Screen_Max_X],eax
|
||||
mov [screen_workarea.right],eax
|
||||
movzx eax,word [BOOT_VAR+0x900C] ; Y max
|
||||
mov eax,768 ; << Y max
|
||||
mov [_display.height], eax
|
||||
dec eax
|
||||
mov [Screen_Max_Y],eax
|
||||
mov [screen_workarea.bottom],eax
|
||||
movzx eax,word [BOOT_VAR+0x9008] ; screen mode
|
||||
mov eax, 0x7055 ; << screen mode
|
||||
mov [SCR_MODE],eax
|
||||
|
||||
movzx eax, word[BOOT_VAR+0x9001] ; for other modes
|
||||
mov eax, 4096 ; << may be different!
|
||||
mov [BytesPerScanLine],ax
|
||||
mov [_display.pitch], eax
|
||||
|
||||
@ -373,16 +373,9 @@ high_code:
|
||||
; GRAPHICS ADDRESSES
|
||||
|
||||
and byte [BOOT_VAR+0x901e],0x0
|
||||
mov eax,[BOOT_VAR+0x9018]
|
||||
mov eax, [BOOT_VAR+0x9018]
|
||||
mov [LFBAddress],eax
|
||||
|
||||
cmp [SCR_MODE],word 0100000000000000b
|
||||
jge setvesa20
|
||||
mov eax, 0xDEADBEEF
|
||||
hlt
|
||||
; === EGA, VGA & Vesa 1.2 modes not supported ===
|
||||
setvesa20:
|
||||
v20ga32:
|
||||
mov [PUTPIXEL],dword __sys_putpixel
|
||||
mov [GETPIXEL],dword get_pixel
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user