merge kolibri-cfg into trunk

git-svn-id: svn://kolibrios.org@1962 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse
2011-06-16 17:09:40 +00:00
parent 2b6c1306c4
commit 08246cd957
180 changed files with 318 additions and 95890 deletions

View File

@@ -91,6 +91,7 @@ boot_read_floppy:
inc si
cmp si, 10
jb @b
sayerr_badsect:
mov si, badsect
sayerr_plain:
call printplain
@@ -145,8 +146,119 @@ FirstDataSector dw 0 ; begin of data
;=========================================================================
include 'bootvesa.inc' ;Include source for boot vesa
if defined extended_primary_loader
include 'parsers.inc'
end if
start_of_code:
if defined extended_primary_loader
; save data from primary loader
mov word [cs:bootcallback], si
mov word [cs:bootcallback+2], ds
push cs
pop ds
mov [bootdevice], ax
mov [bootfs], bx
; set up stack
mov ax, 3000h
mov ss, ax
mov sp, 0EC00h
; try to load configuration file
mov ax, 1
mov di, config_file_struct
call [bootcallback]
cld
push cs
pop es
; bx=0 - ok, bx=1 - part of file loaded, assume this is ok
cmp bx, 1
ja .config_bad
; configuration file was loaded, parse
; if length is too big, use first 0FFFFh bytes
test dx, dx
jz @f
mov ax, 0FFFFh
@@:
; ds:si will be pointer to current data, dx = limit
xchg ax, dx
push 4000h
pop ds
xor si, si
.parse_loop:
; skip spaces
cmp si, dx
jae .parse_done
lodsb
cmp al, ' '
jbe .parse_loop
dec si
; loop over all possible configuration values
mov bx, config_file_variables
.find_variant:
; get length
mov cx, [es:bx]
; zero length = end of list
jecxz .find_newline
; skip over length
inc bx
inc bx
mov di, bx
; skip over string
add bx, cx
; test whether we have at least cx symbols left
mov ax, cx
add ax, si
jc .next_variant1
cmp ax, dx
jae .next_variant1
; save current position
push si
; compare strings
repz cmpsb
jnz .next_variant2
; strings are equal; look for "=" with possible spaces before and after
@@:
cmp si, dx
jae .next_variant2
lodsb
cmp al, ' '
jbe @b
cmp al, '='
jnz .next_variant2
; ok, we found the true variant
; ignore saved position on the stack
pop ax
; call the parser
call word [es:bx]
; line parsed, find next
.find_newline:
cmp si, dx
jae .parse_done
lodsb
cmp al, 13
jz .parse_loop
cmp al, 10
jz .parse_loop
jmp .find_newline
.next_variant2:
; continue to the next variant, restoring current position
pop si
.next_variant1:
; continue to the next variant
; skip over the parser
inc bx
inc bx
jmp .find_variant
.parse_done:
.config_bad:
; set up segment registers
push cs
pop ds
else
cld
; \begin{diamond}[02.12.2005]
; if bootloader sets ax = 'KL', then ds:si points to loader block
@@ -175,6 +287,7 @@ no_hd_load:
pop ds
push cs
pop es
end if
; set videomode
mov ax, 3
@@ -378,6 +491,7 @@ wait_loop: ; variant 2
apm_end:
_setcursor d80x25_top_num, 0
if ~ defined extended_primary_loader
;CHECK current of code
cmp [cfgmanager.loader_block], -1
jz noloaderblock
@@ -387,6 +501,7 @@ apm_end:
jnz sayerr
push 0
pop es
end if
noloaderblock:
; DISPLAY VESA INFORMATION
@@ -404,7 +519,9 @@ cfgmanager:
; d) preboot_device = from what boot?
; determine default settings
if ~ defined extended_primary_loader
mov [.bSettingsChanged], 0
end if
;.preboot_gr_end:
mov di, preboot_device
@@ -412,6 +529,12 @@ cfgmanager:
; set it to use this preloaded image
cmp byte [di], 0
jnz .preboot_device_inited
if defined extended_primary_loader
inc byte [di]
cmp byte [bootdevice], 'f' ; floppy?
jz .preboot_device_inited
inc byte [di]
else
cmp [.loader_block], -1
jz @f
les bx, [.loader_block]
@@ -422,6 +545,7 @@ cfgmanager:
@@:
; otherwise, set [preboot_device] to 1 (default value - boot from floppy)
mov byte [di], 1
end if
.preboot_device_inited:
; following 4 lines set variables to 1 if its current value is 0
cmp byte [di+preboot_dma-preboot_device], 1
@@ -466,7 +590,11 @@ cfgmanager:
mov si, preboot_device_msg
call print
mov al, [preboot_device]
if defined extended_primary_loader
and eax, 3
else
and eax, 7
end if
mov si, [preboot_device_msgs+eax*2]
call printplain
.show_remarks:
@@ -553,12 +681,18 @@ cfgmanager:
_setcursor 15,0
mov si, bdev
call print
if defined extended_primary_loader
mov bx, '12'
else
mov bx, '14'
end if
call getkey
mov [preboot_device], al
_setcursor 13,0
.d:
if ~ defined extended_primary_loader
mov [.bSettingsChanged], 1
end if
call clear_vmodes_table ;clear vmodes_table
jmp .printcfg
.change_a:
@@ -672,10 +806,14 @@ cfgmanager:
virtual at novesa
.oldtimer dd ?
.starttime dd ?
if ~ defined extended_primary_loader
.bSettingsChanged db ?
end if
.timer dd ?
end virtual
if ~ defined extended_primary_loader
.loader_block dd -1
end if
.gettime:
mov ah, 0
int 1Ah
@@ -692,7 +830,11 @@ end virtual
pushad
call .gettime
sub eax, [.starttime]
if defined extended_primary_loader
sub ax, [preboot_timeout]
else
sub ax, 18*5
end if
jae .timergo
neg ax
add ax, 18-1
@@ -748,6 +890,7 @@ end if
mov si, loading_msg
call print
_setcursor 15,0
if ~ defined extended_primary_loader
cmp [.bSettingsChanged], 0
jz .load
cmp [.loader_block], -1
@@ -788,6 +931,7 @@ end if
call printplain
_setcursor 15,0
.load:
end if
; \end{diamond}[02.12.2005]
; ASK GRAPHICS MODE
@@ -967,6 +1111,7 @@ sayerr_floppy:
mov dx, 0x3f2
mov al, 0
out dx, al
sayerr_memmove:
mov si, memmovefailed
jmp sayerr_plain
@@:
@@ -1145,6 +1290,40 @@ no_sys_on_floppy:
mov al, 0
out dx, al
if defined extended_primary_loader
cmp [boot_dev], 1
jne no_sys_from_primary
; load kolibri.img using callback from primary loader
and word [movedesc + 24 + 2], 0
mov byte [movedesc + 24 + 4], 10h
; read in blocks of 64K until file is fully loaded
mov ax, 1
.repeat:
mov di, image_file_struct
call [bootcallback]
push cs
pop ds
push cs
pop es
cmp bx, 1
ja sayerr_badsect
push bx
mov si, movedesc
and word [si + 16 + 2], 0
mov byte [si + 16 + 4], 4
mov ah, 87h
mov cx, 8000h
int 15h
pop bx
test ah, ah
jnz sayerr_memmove
inc byte [si + 24 + 4]
test bx, bx
jz no_sys_from_primary
mov ax, 2
jmp .repeat
no_sys_from_primary:
end if
; SET GRAPHICS