2010-10-01 11:21:55 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
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
|
2012-03-08 09:33:38 +01:00
|
|
|
|
xor edx, edx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
div ecx
|
|
|
|
|
push edx
|
|
|
|
|
call int2str
|
|
|
|
|
pop eax
|
2012-03-08 09:33:38 +01:00
|
|
|
|
@@:
|
|
|
|
|
or al, 0x30
|
|
|
|
|
mov [ds:di], al
|
2010-10-01 11:21:55 +02:00
|
|
|
|
inc di
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
int2strnz:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp eax, ecx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
xor edx, edx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
div ecx
|
|
|
|
|
push edx
|
|
|
|
|
call int2strnz
|
|
|
|
|
pop eax
|
2012-03-08 09:33:38 +01:00
|
|
|
|
@@:
|
|
|
|
|
or al, 0x30
|
|
|
|
|
mov [es:di], al
|
2010-10-01 11:21:55 +02:00
|
|
|
|
inc di
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;-------------------------------------------------------
|
|
|
|
|
;Write message about incorrect v_mode and write message about jmp on swith v_mode
|
|
|
|
|
v_mode_error:
|
|
|
|
|
_setcursor 19,2
|
|
|
|
|
mov si, fatalsel
|
|
|
|
|
call printplain
|
|
|
|
|
_setcursor 20,2
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, pres_key
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
2012-03-08 09:33:38 +01:00
|
|
|
|
xor eax, eax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 16h
|
|
|
|
|
jmp cfgmanager.d
|
|
|
|
|
;-------------------------------------------------------
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;-------------------------------------------------------
|
|
|
|
|
print_vesa_info:
|
|
|
|
|
_setcursor 5,2
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov [es:vi.VESASignature], 'VBE2'
|
|
|
|
|
mov ax, 0x4F00
|
|
|
|
|
mov di, vi ;0xa000
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 0x10
|
2012-03-08 09:33:38 +01:00
|
|
|
|
or ah, ah
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov [es:vi.VESASignature], 'VESA'
|
|
|
|
|
mov ax, $4F00
|
|
|
|
|
mov di, vi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 0x10
|
2012-03-08 09:33:38 +01:00
|
|
|
|
or ah, ah
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jnz .exit
|
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:vi.VESASignature], 'VESA'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jne .exit
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:vi.VESAVersion], 0x0100
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb .exit
|
|
|
|
|
jmp .vesaok2
|
|
|
|
|
|
|
|
|
|
.exit:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, novesa
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.vesaok2:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, [es:vi.VESAVersion]
|
|
|
|
|
add ax, '00'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
mov [s_vesa.ver], ah
|
|
|
|
|
mov [s_vesa.ver+2], al
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, s_vesa
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
|
|
|
|
|
|
|
|
|
_setcursor 4,2
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, word[es:vi.OemStringPtr]
|
|
|
|
|
mov di, si
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
push ds
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ds, word[es:vi.OemStringPtr+2]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
|
|
|
|
pop ds
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
calc_vmodes_table:
|
|
|
|
|
pushad
|
|
|
|
|
|
|
|
|
|
; push 0
|
|
|
|
|
; pop es
|
|
|
|
|
|
|
|
|
|
lfs si, [es:vi.VideoModePtr]
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov bx, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word [es:bx], 640
|
|
|
|
|
mov word [es:bx+2], 480
|
|
|
|
|
mov word [es:bx+6], 0x13
|
2012-03-09 12:35:26 +01:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word [es:bx+10], 640
|
|
|
|
|
mov word [es:bx+12], 480
|
|
|
|
|
mov word [es:bx+16], 0x12
|
|
|
|
|
add bx, 20
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.next_mode:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov cx, word [fs:si]; mode number
|
|
|
|
|
cmp cx, -1
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .modes_ok.2
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, 0x4F01
|
|
|
|
|
mov di, mi
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 0x10
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
or ah, ah
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jnz .modes_ok.2;vesa_info.exit
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test [es:mi.ModeAttributes], 00000001b ;videomode support ?
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test [es:mi.ModeAttributes], 00010000b ;picture ?
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test [es:mi.ModeAttributes], 10000000b ;LFB ?
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz @f
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb @f
|
|
|
|
|
|
|
|
|
|
; cmp [es:mi.BitsPerPixel],16
|
|
|
|
|
; jne .l0
|
|
|
|
|
; cmp [es:mi.GreenMaskSize],5
|
|
|
|
|
; jne .l0
|
|
|
|
|
; mov [es:mi.BitsPerPixel],15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l0:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:mi.XRes], 640
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:mi.YRes], 480
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb @f
|
|
|
|
|
; cmp [es:mi.BitsPerPixel],8
|
|
|
|
|
; jb @f
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
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
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [s_vesa.ver], '2'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb .lp1
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
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
|
2012-03-09 12:35:26 +01:00
|
|
|
|
add bx, size_of_step ; size of record
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
add si, 2
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jmp .next_mode
|
|
|
|
|
|
|
|
|
|
.modes_ok.2:
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word[es:bx], -1 ;end video table
|
|
|
|
|
mov word[end_cursor], bx ;save end cursor position
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;Sort array
|
|
|
|
|
; mov si,modes_table
|
|
|
|
|
;.new_mode:
|
|
|
|
|
; mov ax,word [es:si]
|
|
|
|
|
; cmp ax,-1
|
|
|
|
|
; je .exxit
|
|
|
|
|
; add ax,word [es:si+2]
|
|
|
|
|
; add ax,word [es:si+8]
|
|
|
|
|
; mov bp,si
|
|
|
|
|
;.again:
|
|
|
|
|
; add bp,12
|
|
|
|
|
; mov bx,word [es:bp]
|
|
|
|
|
; cmp bx,-1
|
|
|
|
|
; je .exit
|
|
|
|
|
; add bx,word [es:bp+2]
|
|
|
|
|
; add bx,word [es:bp+8]
|
2012-03-09 12:35:26 +01:00
|
|
|
|
;
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; cmp ax,bx
|
|
|
|
|
; ja .loops
|
|
|
|
|
; jmp .again
|
2012-03-09 12:35:26 +01:00
|
|
|
|
;.loops:
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; push dword [es:si]
|
|
|
|
|
; push dword [es:si+4]
|
|
|
|
|
; push dword [es:si+8]
|
|
|
|
|
; push dword [es:bp]
|
|
|
|
|
; push dword [es:bp+4]
|
|
|
|
|
; push dword [es:bp+8]
|
|
|
|
|
;
|
|
|
|
|
; pop dword [es:si+8]
|
|
|
|
|
; pop dword [es:si+4]
|
|
|
|
|
; pop dword [es:si]
|
|
|
|
|
; pop dword [es:bp+8]
|
|
|
|
|
; pop dword [es:bp+4]
|
|
|
|
|
; pop dword [es:bp]
|
|
|
|
|
; jmp .new_mode
|
|
|
|
|
;
|
|
|
|
|
;.exit: add si,12
|
|
|
|
|
; jmp .new_mode
|
|
|
|
|
;.exxit:
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
draw_current_vmode:
|
|
|
|
|
push 0
|
|
|
|
|
pop es
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, word [cursor_pos]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp word [es:si+6], 0x12
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .no_vesa_0x12
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp word [es:si+6], 0x13
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .no_vesa_0x13
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov di, loader_block_error
|
|
|
|
|
movzx eax, word[es:si+0]
|
|
|
|
|
mov ecx, 10
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call int2strnz
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov byte[es:di], 'x'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
inc di
|
2012-03-08 09:33:38 +01:00
|
|
|
|
movzx eax, word[es:si+2]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call int2strnz
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov byte[es:di], 'x'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
inc di
|
2012-03-08 09:33:38 +01:00
|
|
|
|
movzx eax, word[es:si+8]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call int2strnz
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov dword[es:di], 0x00000d0a
|
|
|
|
|
mov si, loader_block_error
|
2010-10-01 11:21:55 +02:00
|
|
|
|
push ds
|
|
|
|
|
push es
|
|
|
|
|
pop ds
|
|
|
|
|
call printplain
|
|
|
|
|
pop ds
|
|
|
|
|
ret
|
|
|
|
|
.no_vesa_0x13:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, mode0
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jmp .print
|
|
|
|
|
.no_vesa_0x12:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, mode9
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.print:
|
|
|
|
|
call printplain
|
2012-03-08 09:33:38 +01:00
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
check_first_parm:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, word [preboot_graph]
|
|
|
|
|
test si, si
|
|
|
|
|
jnz .no_zero ;if no zero
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.zerro:
|
|
|
|
|
; mov ax,modes_table
|
|
|
|
|
; mov word [cursor_pos],ax
|
|
|
|
|
; mov word [home_cursor],ax
|
|
|
|
|
; mov word [preboot_graph],ax
|
|
|
|
|
;SET default video of mode first probe will fined a move of work 1024x768@32
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, 1024
|
|
|
|
|
mov bx, 768
|
|
|
|
|
mov si, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call .loops
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test ax, ax
|
|
|
|
|
jz .ok_found_mode
|
|
|
|
|
mov ax, 800
|
|
|
|
|
mov bx, 600
|
|
|
|
|
mov si, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call .loops
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test ax, ax
|
|
|
|
|
jz .ok_found_mode
|
|
|
|
|
mov ax, 640
|
|
|
|
|
mov bx, 480
|
|
|
|
|
mov si, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call .loops
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test ax, ax
|
|
|
|
|
jz .ok_found_mode
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jmp .ok_found_mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.no_zero:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov bp, word [number_vm]
|
|
|
|
|
cmp bp, word [es:si+6]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jz .ok_found_mode
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, word [x_save]
|
|
|
|
|
mov bx, word [y_save]
|
|
|
|
|
mov si, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call .loops
|
2012-03-08 09:33:38 +01:00
|
|
|
|
test ax, ax
|
|
|
|
|
jz .ok_found_mode
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; cmp ax,modes_table
|
|
|
|
|
; jb .zerro ;check on correct if bellow
|
|
|
|
|
; cmp ax,word [end_cursor]
|
|
|
|
|
; ja .zerro ;check on correct if anymore
|
|
|
|
|
|
|
|
|
|
.ok_found_mode:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word [home_cursor], si
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; mov word [cursor_pos],si
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word [preboot_graph], si
|
|
|
|
|
mov ax, si
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ecx, long_v_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
.loop:
|
|
|
|
|
add ax, size_of_step
|
|
|
|
|
cmp ax, word [end_cursor]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jae .next_step
|
|
|
|
|
loop .loop
|
|
|
|
|
.next_step:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
sub ax, size_of_step*long_v_table
|
|
|
|
|
cmp ax, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jae @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
@@:
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word [home_cursor], ax
|
|
|
|
|
mov si, [preboot_graph]
|
|
|
|
|
mov word [cursor_pos], si
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
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:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp ax, word [es:si]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jne .next
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp bx, word [es:si+2]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jne .next
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp word [es:si+8], 32
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .ok
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp word [es:si+8], 24
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .ok
|
2012-03-08 09:33:38 +01:00
|
|
|
|
.next:
|
|
|
|
|
add si, size_of_step
|
|
|
|
|
cmp word [es:si], -1
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .exit
|
|
|
|
|
jmp .loops
|
2012-03-08 09:33:38 +01:00
|
|
|
|
.ok:
|
|
|
|
|
xor ax, ax
|
|
|
|
|
ret
|
|
|
|
|
.exit:
|
|
|
|
|
or ax, -1
|
|
|
|
|
ret
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
;default_vmode:
|
2012-03-09 12:35:26 +01:00
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
draw_vmodes_table:
|
|
|
|
|
_setcursor 9, 2
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, gr_mode
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, _st
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
|
|
|
|
|
|
|
|
|
push word [cursor_pos]
|
|
|
|
|
pop ax
|
|
|
|
|
push word [home_cursor]
|
|
|
|
|
pop si
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov cx, si
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp ax, si
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .ok
|
|
|
|
|
jb .low
|
|
|
|
|
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
add cx, size_of_step*long_v_table
|
2012-03-09 12:35:26 +01:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp ax, cx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb .ok
|
2012-03-09 12:35:26 +01:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
sub cx, size_of_step*long_v_table
|
|
|
|
|
add cx, size_of_step
|
|
|
|
|
cmp cx, word[end_cursor]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jae .ok
|
2012-03-08 09:33:38 +01:00
|
|
|
|
add si, size_of_step
|
2010-10-01 11:21:55 +02:00
|
|
|
|
push si
|
|
|
|
|
pop word [home_cursor]
|
|
|
|
|
jmp .ok
|
|
|
|
|
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
.low:
|
|
|
|
|
sub cx, size_of_step
|
|
|
|
|
cmp cx, modes_table
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb .ok
|
|
|
|
|
push cx
|
|
|
|
|
push cx
|
|
|
|
|
pop word [home_cursor]
|
|
|
|
|
pop si
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ok:
|
|
|
|
|
; calculate scroll position
|
|
|
|
|
push si
|
|
|
|
|
mov ax, [end_cursor]
|
|
|
|
|
sub ax, modes_table
|
|
|
|
|
mov bx, size_of_step
|
|
|
|
|
cwd
|
|
|
|
|
div bx
|
|
|
|
|
mov si, ax ; si = size of list
|
|
|
|
|
mov ax, [home_cursor]
|
|
|
|
|
sub ax, modes_table
|
|
|
|
|
cwd
|
|
|
|
|
div bx
|
|
|
|
|
mov di, ax
|
|
|
|
|
mov ax, scroll_area_size*long_v_table
|
|
|
|
|
cwd
|
|
|
|
|
div si
|
|
|
|
|
test ax, ax
|
|
|
|
|
jnz @f
|
|
|
|
|
inc ax
|
|
|
|
|
@@:
|
|
|
|
|
cmp al, scroll_area_size
|
|
|
|
|
jb @f
|
|
|
|
|
mov al, scroll_area_size
|
|
|
|
|
@@:
|
|
|
|
|
mov cx, ax
|
|
|
|
|
; cx = scroll height
|
|
|
|
|
; calculate scroll pos
|
|
|
|
|
xor bx, bx ; initialize scroll pos
|
|
|
|
|
sub al, scroll_area_size+1
|
|
|
|
|
neg al
|
|
|
|
|
sub si, long_v_table-1
|
|
|
|
|
jbe @f
|
|
|
|
|
mul di
|
|
|
|
|
div si
|
|
|
|
|
mov bx, ax
|
|
|
|
|
@@:
|
|
|
|
|
inc bx
|
|
|
|
|
imul ax, bx, size_of_step
|
|
|
|
|
add ax, [home_cursor]
|
|
|
|
|
mov [scroll_start], ax
|
|
|
|
|
imul cx, size_of_step
|
|
|
|
|
add ax, cx
|
|
|
|
|
mov [scroll_end], ax
|
|
|
|
|
pop si
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov bp, long_v_table ;show rows
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.@@_next_bit:
|
|
|
|
|
;clear cursor
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, ' '
|
|
|
|
|
mov word[ds:_r1+21], ax
|
|
|
|
|
mov word[ds:_r1+50], ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word[ds:_r2+21], ax
|
|
|
|
|
mov word[ds:_r2+45], ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word[ds:_rs+21], ax
|
|
|
|
|
mov word[ds:_rs+46], ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; draw string
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp word [es:si+6], 0x12
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .show_0x12
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp word [es:si+6], 0x13
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .show_0x13
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
movzx eax, word[es:si]
|
|
|
|
|
cmp ax, -1
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .@@_end
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov di, _rs+23
|
|
|
|
|
mov ecx, 10
|
|
|
|
|
mov bl, 4
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call int2str
|
2012-03-08 09:33:38 +01:00
|
|
|
|
movzx eax, word[es:si+2]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
inc di
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov bl, 4
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call int2str
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
movzx eax, word[es:si+8]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
inc di
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov bl, 2
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call int2str
|
|
|
|
|
|
|
|
|
|
cmp si, word [cursor_pos]
|
|
|
|
|
jne .next
|
|
|
|
|
;draw cursor
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word[ds:_rs+21], '>>'
|
|
|
|
|
mov word[ds:_rs+46], '<<'
|
2012-03-09 12:35:26 +01:00
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.next:
|
|
|
|
|
push si
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, _rs
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.@@_sh:
|
|
|
|
|
; add to the string pseudographics for scrollbar
|
|
|
|
|
pop bx
|
|
|
|
|
push bx
|
|
|
|
|
mov byte [si+53], ' '
|
|
|
|
|
cmp bx, [scroll_start]
|
|
|
|
|
jb @f
|
|
|
|
|
cmp bx, [scroll_end]
|
|
|
|
|
jae @f
|
|
|
|
|
mov byte [si+53], 0xDB ; filled bar
|
|
|
|
|
@@:
|
|
|
|
|
push bx
|
|
|
|
|
add bx, size_of_step
|
|
|
|
|
cmp bx, [end_cursor]
|
|
|
|
|
jnz @f
|
|
|
|
|
mov byte [si+53], 31 ; 'down arrow' symbol
|
|
|
|
|
@@:
|
|
|
|
|
sub bx, [home_cursor]
|
|
|
|
|
cmp bx, size_of_step*long_v_table
|
|
|
|
|
jnz @f
|
|
|
|
|
mov byte [si+53], 31 ; 'down arrow' symbol
|
|
|
|
|
@@:
|
|
|
|
|
pop bx
|
|
|
|
|
cmp bx, [home_cursor]
|
|
|
|
|
jnz @f
|
|
|
|
|
mov byte [si+53], 30 ; 'up arrow' symbol
|
|
|
|
|
@@:
|
|
|
|
|
call printplain
|
|
|
|
|
pop si
|
2012-03-08 09:33:38 +01:00
|
|
|
|
add si, size_of_step
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
dec bp
|
|
|
|
|
jnz .@@_next_bit
|
|
|
|
|
|
|
|
|
|
.@@_end:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, _bt
|
2010-10-01 11:21:55 +02:00
|
|
|
|
call printplain
|
|
|
|
|
ret
|
|
|
|
|
.show_0x13:
|
|
|
|
|
push si
|
|
|
|
|
|
|
|
|
|
cmp si, word [cursor_pos]
|
|
|
|
|
jne @f
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word[ds:_r1+21], '>>'
|
|
|
|
|
mov word[ds:_r1+50], '<<'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, _r1
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jmp .@@_sh
|
|
|
|
|
.show_0x12:
|
|
|
|
|
push si
|
|
|
|
|
cmp si, word [cursor_pos]
|
|
|
|
|
jne @f
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov word[ds:_r2+21], '>>'
|
|
|
|
|
mov word[ds:_r2+45], '<<'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, _r2
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jmp .@@_sh
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
;Clear arrea of current video page (0xb800)
|
|
|
|
|
clear_vmodes_table:
|
|
|
|
|
pusha
|
|
|
|
|
; draw frames
|
|
|
|
|
push es
|
|
|
|
|
push 0xb800
|
|
|
|
|
pop es
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov di, 1444
|
|
|
|
|
xor ax, ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
mov ah, 1*16+15
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov cx, 70
|
|
|
|
|
mov bp, 12
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.loop_start:
|
2012-03-08 09:33:38 +01:00
|
|
|
|
rep stosw
|
|
|
|
|
mov cx, 70
|
|
|
|
|
add di, 20
|
2010-10-01 11:21:55 +02:00
|
|
|
|
dec bp
|
2012-03-08 09:33:38 +01:00
|
|
|
|
jns .loop_start
|
2010-10-01 11:21:55 +02:00
|
|
|
|
pop es
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
set_vmode:
|
|
|
|
|
push 0 ;0;x1000
|
|
|
|
|
pop es
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov si, word [preboot_graph] ;[preboot_graph]
|
|
|
|
|
mov cx, word [es:si+6] ; number of mode
|
2012-03-09 12:35:26 +01:00
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, word [es:si+0] ; resolution X
|
|
|
|
|
mov bx, word [es:si+2] ; resolution Y
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
|
2012-03-09 12:35:26 +01:00
|
|
|
|
mov word [es:BOOT_X_RES], ax ; resolution X
|
|
|
|
|
mov word [es:BOOT_Y_RES], bx ; resolution Y
|
|
|
|
|
mov word [es:BOOT_VESA_MODE], cx ; number of mode
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp cx, 0x12
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .mode0x12_0x13
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp cx, 0x13
|
2010-10-01 11:21:55 +02:00
|
|
|
|
je .mode0x12_0x13
|
|
|
|
|
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp byte [s_vesa.ver], '2'
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jb .vesa12
|
|
|
|
|
|
|
|
|
|
; VESA 2 and Vesa 3
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, 0x4f01
|
|
|
|
|
and cx, 0xfff
|
|
|
|
|
mov di, mi;0xa000
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 0x10
|
|
|
|
|
; LFB
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov eax, [es:mi.PhysBasePtr];di+0x28]
|
2012-03-09 12:35:26 +01:00
|
|
|
|
mov [es:BOOT_LFB], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; ---- vbe voodoo
|
|
|
|
|
BytesPerLine equ 0x10
|
|
|
|
|
mov ax, [es:di+BytesPerLine]
|
2012-03-09 12:35:26 +01:00
|
|
|
|
mov [es:BOOT_PITCH], ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
; BPP
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:mi.BitsPerPixel], 16
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jne .l0
|
2012-03-08 09:33:38 +01:00
|
|
|
|
cmp [es:mi.GreenMaskSize], 5
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jne .l0
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov [es:mi.BitsPerPixel], 15
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.l0:
|
|
|
|
|
mov al, byte [es:di+0x19]
|
2012-03-09 12:35:26 +01:00
|
|
|
|
mov [es:BOOT_BPP], al
|
2010-10-01 11:21:55 +02:00
|
|
|
|
jmp .exit
|
|
|
|
|
|
|
|
|
|
.mode0x12_0x13:
|
2012-03-09 12:35:26 +01:00
|
|
|
|
mov byte [es:BOOT_BPP], 32
|
|
|
|
|
or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; VESA 1.2 PM BANK SWITCH ADDRESS
|
|
|
|
|
|
|
|
|
|
.vesa12:
|
|
|
|
|
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov ax, 0x4f0A
|
|
|
|
|
xor bx, bx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
int 0x10
|
2012-03-08 09:33:38 +01:00
|
|
|
|
xor eax, eax
|
|
|
|
|
xor ebx, ebx
|
|
|
|
|
mov ax, es
|
|
|
|
|
shl eax, 4
|
|
|
|
|
mov bx, di
|
|
|
|
|
add eax, ebx
|
|
|
|
|
movzx ebx, word[es:di]
|
|
|
|
|
add eax, ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
push 0x0000
|
|
|
|
|
pop es
|
2012-03-08 09:33:38 +01:00
|
|
|
|
mov [es:0x9014], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
.exit:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;=============================================================================
|
|
|
|
|
;=============================================================================
|
|
|
|
|
;=============================================================================
|
|
|
|
|
|