Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1507 → Rev 1508

/kernel/branches/Kolibri-A/trunk/boot/bootcode.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
196,13 → 196,6
mov ax, 1100h
int 10h
; End set VGA russian font
else if lang eq et
mov bp, ET_FNT ; ET_FNT1
mov bx, 1000h ;
mov cx, 255 ; 256 symbols
xor dx, dx ; 0 - position of first symbol
mov ax, 1100h
int 10h
end if
 
; draw frames
245,21 → 238,21
 
 
; TEST FOR 386+
 
mov bx, 0x4000
pushf
pop ax
mov dx, ax
xor ax, bx
push ax
popf
pushf
pop ax
and ax, bx
and dx, bx
cmp ax, dx
jnz cpugood
mov si, not386
jmp cpugood
; mov bx, 0x4000
; pushf
; pop ax
; mov dx, ax
; xor ax, bx
; push ax
; popf
; pushf
; pop ax
; and ax, bx
; and dx, bx
; cmp ax, dx
; jnz cpugood
; mov si, not386
sayerr:
call print
jmp $
315,32 → 308,32
.nopci:
; \end{Mario79}
 
mov al, 0xf6 ; Ñáðîñ êëàâèàòóðû, ðàçðåøèòü ñêàíèðîâàíèå
out 0x60, al
xor cx, cx
wait_loop: ; variant 2
; mov al, 0xf6 ; Ñáðîñ êëàâèàòóðû, ðàçðåøèòü ñêàíèðîâàíèå
; out 0x60, al
; xor cx, cx
;wait_loop: ; variant 2
; reading state of port of 8042 controller
in al, 64h
and al, 00000010b ; ready flag
; in al, 64h
; and al, 00000010b ; ready flag
; wait until 8042 controller is ready
loopnz wait_loop
; loopnz wait_loop
 
;;;/diamond today 5.02.2008
;;;/diamond 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
; 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)
/kernel/branches/Kolibri-A/trunk/boot/bootvesa.inc
187,15 → 187,15
lfs si, [es:vi.VideoModePtr]
 
mov bx,modes_table
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
mov word [es:bx],640
mov word [es:bx+2],480
mov word [es:bx+6],0x13
;save no vesa mode of work 320x200, EGA/CGA 256 colors and 640x480, VGA 16 cols
; mov word [es:bx],640
; mov word [es:bx+2],480
; mov word [es:bx+6],0x13
mov word [es:bx+10],640
mov word [es:bx+12],480
mov word [es:bx+16],0x12
add bx,20
; mov word [es:bx+10],640
; mov word [es:bx+12],480
; mov word [es:bx+16],0x12
; add bx,20
.next_mode:
mov cx,word [fs:si] ; mode number
cmp cx,-1
215,23 → 215,12
test [es:mi.ModeAttributes],10000000b ;LFB ?
jz @f
 
cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp
cmp [es:mi.BitsPerPixel], 32 ;to show only 32 bpp videomodes
jb @f
 
; cmp [es:mi.BitsPerPixel],16
; jne .l0
; cmp [es:mi.GreenMaskSize],5
; jne .l0
; mov [es:mi.BitsPerPixel],15
 
 
.l0:
cmp [es:mi.XRes],640
cmp [es:mi.XRes],800 ; only 800x600 and higher
jb @f
cmp [es:mi.YRes],480
jb @f
; cmp [es:mi.BitsPerPixel],8
; jb @f
 
mov ax,[es:mi.XRes]
mov [es:bx+0],ax ; +0[2] : resolution X
257,46 → 246,6
 
mov word[es:bx],-1 ;end video table
mov word[end_cursor],bx ;save end cursor position
;;;;;;;;;;;;;;;;;;
;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]
;
; cmp ax,bx
; ja .loops
; jmp .again
;.loops:
; 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
 
366,18 → 315,10
call .loops
test ax,ax
jz .ok_found_mode
mov ax,640
mov bx,480
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]
685,14 → 626,14
mov word [es:0x900C],bx ; resolution Y
mov word [es:0x9008],cx ; number of mode
 
cmp cx,0x12
je .mode0x12_0x13
cmp cx,0x13
je .mode0x12_0x13
; cmp cx,0x12
; je .mode0x12_0x13
; cmp cx,0x13
; je .mode0x12_0x13
 
 
cmp byte [s_vesa.ver],'2'
jb .vesa12
; cmp byte [s_vesa.ver],'2'
; jb .vesa12
 
; VESA 2 and Vesa 3
 
708,48 → 649,43
mov ax, [es:di+BytesPerLine]
mov [es:0x9001], ax
; BPP
cmp [es:mi.BitsPerPixel],16
jne .l0
cmp [es:mi.GreenMaskSize],5
jne .l0
mov [es:mi.BitsPerPixel],15
; cmp [es:mi.BitsPerPixel],16
; jne .l0
; cmp [es:mi.GreenMaskSize],5
; jne .l0
; mov [es:mi.BitsPerPixel],15
.l0:
mov al, byte [es:di+0x19]
mov [es:0x9000], al
jmp .exit
 
.mode0x12_0x13:
mov byte [es:0x9000], 32
or dword [es:0x9018], 0xFFFFFFFF; 0x800000
;.mode0x12_0x13:
; mov byte [es:0x9000], 32
; or dword [es:0x9018], 0xFFFFFFFF; 0x800000
 
 
; VESA 1.2 PM BANK SWITCH ADDRESS
 
.vesa12:
;.vesa12:
 
 
mov ax,0x4f0A
xor bx,bx
int 0x10
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
push 0x0000
pop es
mov [es:0x9014],eax
; mov ax,0x4f0A
; xor bx,bx
; int 0x10
; 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
; push 0x0000
; pop es
; mov [es:0x9014],eax
.exit:
ret
 
 
; mov dword[es:0x9018],0x000A0000
; ret
 
;=============================================================================
;=============================================================================
;=============================================================================
 
/kernel/branches/Kolibri-A/trunk/build.bat
1,13 → 1,10
@echo off
cls
set languages=en ru ge et
set drivers=sound sis infinity ensoniq ps2mouse com_mouse uart ati2d vmode
set targets=all kernel drivers skins clean
 
call :Check_Target %1
for %%a in (all kernel) do if %%a==%target% call :Check_Lang %2
call :Target_%target%
set languages=en ru
 
call :Check_Lang en
call :Target_kernel
 
if ERRORLEVEL 0 goto Exit_OK
 
echo There was an error executing script.
31,20 → 28,7
goto Check_Lang_loop
goto :eof
 
:Check_Target
set res=%1
:Check_Target_loop
for %%a in (%targets%) do if %%a==%res% set target=%res%
if defined target goto :eof
 
echo Target '%res%' is incorrect
echo Enter valid target [ %targets% ]:
 
set /P res=">
goto Check_Target_loop
goto :eof
 
 
:Target_kernel
echo *** building kernel with language '%lang%' ...
 
56,87 → 40,14
goto :eof
 
 
:Target_all
call :Target_kernel
call :Target_drivers
call :Target_skins
goto :eof
 
 
:Target_drivers
echo *** building drivers ...
 
if not exist bin\drivers mkdir bin\drivers
cd drivers
for %%a in (%drivers%) do (
fasm -m 65536 %%a.asm ..\bin\drivers\%%a.obj
if not %errorlevel%==0 goto :Error_FasmFailed
)
cd ..
move bin\drivers\vmode.obj bin\drivers\vmode.mdr
 
 
kpack >nul 2>&1
 
if %errorlevel%==9009 goto :Error_KpackFailed
 
echo *
echo ##############################################
echo *
echo Kpack KolibriOS drivers?
echo *
 
set /P res=[y/n]?
 
if "%res%"=="y" (
 
echo *
echo Compressing system
 
echo *
for %%a in (bin\drivers\*.obj) do (
echo ================== kpack %%a
kpack %%a
if not %errorlevel%==0 goto :Error_KpackFailed
)
 
)
goto :eof
 
 
:Target_skins
echo *** building skins ...
 
if not exist bin\skins mkdir bin\skins
cd skin
fasm -m 65536 default.asm ..\bin\skins\default.skn
if not %errorlevel%==0 goto :Error_FasmFailed
cd ..
goto :eof
 
:Target_clean
echo *** cleaning ...
rmdir /S /Q bin
goto :Exit_OK
 
 
:Error_FasmFailed
echo error: fasm execution failed
erase lang.inc >nul 2>&1
echo.
erase lang.inc
pause
exit 1
 
:Error_KpackFailed
echo *** NOTICE ***
echo If you want to pack all applications you may
echo place "kpack" in accessible directory or system %PATH%.
echo You can get this tool from KolibriOS distribution kit.
pause
exit 1
 
:Exit_OK
echo.
echo all operations have been done
echo all operations has been done
pause
exit 0
/kernel/branches/Kolibri-A/trunk/bus/pci/PCIe.inc
28,14 → 28,13
;
;***************************************************************************
 
mmio_pcie_cfg_addr dd 0x0 ; intel pcie space may be defined here
mmio_pcie_cfg_lim dd 0x0 ; upper pcie space address
mmio_pcie_cfg_addr dd 0x00000000 ; pcie space may be defined here
mmio_pcie_cfg_lim dd 0x000FFFFF ; upper pcie space address
 
 
align 4
 
pci_ext_config:
 
mov ebx, [mmio_pcie_cfg_addr]
or ebx,ebx
jz @f
99,8 → 98,8
.pcie_cfg_mapped:
; -- glad to have the extended PCIe config field found
; mov esi, boot_pcie_ok
; call boot_log
mov esi, boot_pcie_ok
call boot_log
ret ; <<<<<<<<<<< OK >>>>>>>>>>>
.no_pcie_cfg:
112,7 → 111,7
cmp bl, 0xC0 ; MMIO regs lay below this offset
jb .check_HT_mmio
.pcie_failed:
; mov esi, boot_pcie_fail
; call boot_log
mov esi, boot_pcie_fail
call boot_log
ret ; <<<<<<<<< FAILURE >>>>>>>>>
 
/kernel/branches/Kolibri-A/trunk/bus/pci/pci32.inc
378,7 → 378,6
dec eax
ret
 
if defined mmio_pci_addr ; must be set above
;***************************************************************************
; Function
; pci_mmio_init
388,15 → 387,11
; Returns eax = phys. address of user-accessible DMA block
; Error codes
; eax = -1 : PCI user access blocked,
; eax = -2 : device not registered for uMMIO service
; eax = -3 : user heap initialization failure
;***************************************************************************
pci_mmio_init:
cmp bx, [mmio_pci_addr]
jz @f
mov eax,-2
ret
@@:
mov [mmio_pci_addr],bx
 
call init_heap ; (if not initialized yet)
or eax,eax
jz @f
521,8 → 516,6
stdcall user_free, ebx
ret
 
end if
 
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uglobal
align 4
/kernel/branches/Kolibri-A/trunk/core/memory.inc
394,11 → 394,11
add eax, 0x007FFFF0
and eax, 0xFF800000 ; align at 8M boundary
mov [UserDMAaddr], eax
or eax, PG_UW + PG_NOCACHE
mov ebx, USER_DMA_BUFFER
mov ecx, 2048 ; 8M, to be sure
call commit_pages
mov eax, [UserDMAaddr]
; or eax, PG_UW + PG_NOCACHE
; mov ebx, USER_DMA_BUFFER
; mov ecx, 2048 ; 8M, to be sure
; call commit_pages
; mov eax, [UserDMAaddr]
or eax, PG_LARGE + PG_UW + PG_NOCACHE
mov ebx, sys_pgdir + (USER_DMA_BUFFER shr 20)
mov [ebx], eax
/kernel/branches/Kolibri-A/trunk/data32.inc
67,6 → 67,8
boot_pal_vga db 'Setting VGA 640x480 palette',0
boot_failed db 'Failed to start first app',0
boot_mtrr db 'Setting MTRR',0
boot_pcie_ok db 'PCIe config set OK',0
boot_pcie_fail db 'PCIe config XXX failed XXX',0
if preboot_blogesc
boot_tasking db 'All set - press ESC to start',0
end if
/kernel/branches/Kolibri-A/trunk/kernel.asm
127,14 → 127,9
 
if lang eq en
include "boot/booteng.inc" ; english system boot messages
else if lang eq ru
else
include "boot/bootru.inc" ; russian system boot messages
include "boot/ru.inc" ; Russian font
else if lang eq et
include "boot/bootet.inc" ; estonian system boot messages
include "boot/et.inc" ; Estonian font
else
include "boot/bootge.inc" ; german system boot messages
end if
 
include "boot/bootcode.inc" ; 16 bit system boot code
395,31 → 390,31
mov eax,[BOOT_VAR+0x9018]
mov [LFBAddress],eax
 
cmp [SCR_MODE],word 0100000000000000b
jge setvesa20
cmp [SCR_MODE],word 0x13
je v20ga32
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
mov [GETPIXEL],dword Vesa12_getpixel24
cmp [ScreenBPP],byte 24
jz ga24
mov [PUTPIXEL],dword Vesa12_putpixel32
mov [GETPIXEL],dword Vesa12_getpixel32
ga24:
jmp v20ga24
;== cmp [SCR_MODE],word 0100000000000000b
; jge setvesa20
; cmp [SCR_MODE],word 0x13
; je v20ga32
; mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
; mov [GETPIXEL],dword Vesa12_getpixel24
; cmp [ScreenBPP],byte 24
; jz ga24
; mov [PUTPIXEL],dword Vesa12_putpixel32
; mov [GETPIXEL],dword Vesa12_getpixel32
; ga24:
; jmp v20ga24
setvesa20:
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0
mov [GETPIXEL],dword Vesa20_getpixel24
cmp [ScreenBPP],byte 24
jz v20ga24
; mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0
; mov [GETPIXEL],dword Vesa20_getpixel24
; cmp [ScreenBPP],byte 24
; jz v20ga24
v20ga32:
mov [PUTPIXEL],dword Vesa20_putpixel32
mov [GETPIXEL],dword Vesa20_getpixel32
v20ga24:
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480
jne no_mode_0x12
mov [PUTPIXEL],dword VGA_putpixel
mov [GETPIXEL],dword Vesa20_getpixel32
; v20ga24:
; cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480
; jne no_mode_0x12
; mov [PUTPIXEL],dword VGA_putpixel
; mov [GETPIXEL],dword Vesa20_getpixel32
no_mode_0x12:
 
; -------- Fast System Call init ----------
814,19 → 809,19
 
; PALETTE FOR 320x200 and 640x480 16 col
 
cmp [SCR_MODE],word 0x12
jne no_pal_vga
mov esi,boot_pal_vga
call boot_log
call paletteVGA
no_pal_vga:
; cmp [SCR_MODE],word 0x12
; jne no_pal_vga
; mov esi,boot_pal_vga
; call boot_log
; call paletteVGA
; no_pal_vga:
 
cmp [SCR_MODE],word 0x13
jne no_pal_ega
mov esi,boot_pal_ega
call boot_log
call palette320x200
no_pal_ega:
; cmp [SCR_MODE],word 0x13
; jne no_pal_ega
; mov esi,boot_pal_ega
; call boot_log
; call palette320x200
; no_pal_ega:
 
; LOAD DEFAULT SKIN
 
1023,8 → 1018,8
inc edi
call dtext
 
mov [novesachecksum],1000
call checkVga_N13
; mov [novesachecksum],1000
; call checkVga_N13
 
popad
 
1041,7 → 1036,7
call window_check_events
call mouse_check_events
call checkmisc
call checkVga_N13
; call checkVga_N13
call stack_handler
call checkidle
call check_fdd_motor_status
3801,9 → 3796,9
dbrv12:
cmp [SCR_MODE],word 0100000000000000b
jge dbrv20
cmp [SCR_MODE],word 0x13
je dbrv20
call vesa12_drawbackground
; cmp [SCR_MODE],word 0x13
; je dbrv20
; call vesa12_drawbackground
dec [mouse_pause]
call [draw_pointer]
ret
3843,16 → 3838,14
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
sys_putimage_bpp:
; call [disable_mouse] ; this will be done in xxx_putimage
; mov eax, vga_putimage
cmp [SCR_MODE], word 0x12
jz @f ;.doit
mov eax, vesa12_putimage
cmp [SCR_MODE], word 0100000000000000b
jae @f
cmp [SCR_MODE], word 0x13
jnz .doit
@@:
; cmp [SCR_MODE], word 0x12
; jz @f ;.doit
; mov eax, vesa12_putimage
; cmp [SCR_MODE], word 0100000000000000b
; jae @f
; cmp [SCR_MODE], word 0x13
; jnz .doit
;@@:
mov eax, vesa20_putimage
.doit:
inc [mouse_pause]
4140,14 → 4133,14
cmp [SCR_MODE],word 0x12
je dbv20
sdbv20:
cmp [SCR_MODE],word 0100000000000000b
jge dbv20
cmp [SCR_MODE],word 0x13
je dbv20
call vesa12_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
; cmp [SCR_MODE],word 0100000000000000b
; jge dbv20
; cmp [SCR_MODE],word 0x13
; je dbv20
; call vesa12_drawbar
; dec [mouse_pause]
; call [draw_pointer]
; ret
dbv20:
call vesa20_drawbar
dec [mouse_pause]
/kernel/branches/Kolibri-A/trunk/kernel32.inc
247,7 → 247,7
 
; display
 
include "video/vesa12.inc" ; Vesa 1.2 functions
;include "video/vesa12.inc" ; Vesa 1.2 functions
include "video/vesa20.inc" ; Vesa 2.0 functions
include "video/vga.inc" ; VGA 16 color functions
include "video/cursors.inc" ; cursors functions
/kernel/branches/Kolibri-A/trunk/memmap.inc
123,8 → 123,8
; FE08 dword screen y multiplier
; FE0C dword screen mode
; FE10 -> FE7F free (112)
; FE80 dword address of LFB in physical
; FE84 dword address of applications memory start in physical ?
; FE80 dword physical address of LFB
; FE84 dword physical address of user-accessible static system buffer
; FE88 dword address of button list
; FE8C dword memory to use
; FE90 -> FEFF free (112)
253,9 → 253,10
 
; 0x80800000 -> kernel heap
; 0x80FFFFFF heap min limit
; 0xFDBFFFFF heap max limit
; 0xEFFFFFFF heap max limit
 
; 0xF0000000 -> 0xF1FFFFFF PCI-express extended config space
; 0xFD000000 -> 0xFD3FFFFF static system buffer 4Mb
; 0xFDC00000 -> 0xFDFFFFFF page tables 4Mb
; 0xFE000000 -> 0xFFFFFFFF LFB 32Mb
; 0xFE000000 -> 0xFE7FFFFF application available LFB 8Mb