Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 464 → Rev 465

/kernel/trunk/boot/bootcode.inc
20,120 → 20,7
;
;==========================================================================
 
; 16-bit data
org $+0x10000
 
old_ints_h:
dw 0x400
dd 0
dw 0
 
kernel_restart_bootblock:
db 1 ; version
dw 1 ; floppy image is in memory
dd 0 ; cannot save parameters
 
 
align 32
 
; GDT TABLE
 
gdts:
 
dw gdte-$-1
dd gdts
dw 0
 
; Attention! The order first four selectors not to change, is used in Fast System Call
; must be : os_code, os_data, app_code, app_data, ....
 
int_code_l:
os_code_l:
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10011010b
db 0x00
 
int_data_l:
os_data_l:
dw 0xffff
dw 0x0000
db 0x00
dw 11011111b *256 +10010010b
db 0x00
 
app_code_l:
dw 0xFFFF
dw 0
db 0
db cpl3
dw G32+D32+0x8000+0x7;
 
app_data_l:
dw 0xFFFF
dw 0
db 0
db drw3
dw G32+D32+0x8000+0x7;
 
; --------------- APM ---------------------
apm_code_32:
dw 0x0f ; limit 64kb
db 0, 0, 0
dw 11010000b *256 +10011010b
db 0x00
apm_code_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10011010b
db 0x00
apm_data_16:
dw 0x0f
db 0, 0, 0
dw 10010000b *256 +10010010b
db 0x00
; -----------------------------------------
 
graph_data_l:
 
dw 0x7ff
dw 0x0000
db 0x00
dw 11010000b *256 +11110010b
db 0x00
 
tss0_l:
; times (max_processes+10) dd 0,0
gdte = $ + (max_processes+10)*8
 
; 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)
movedesc:
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
 
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
 
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
org $-0x10000
 
putchar:
; in: al=character
mov ah, 0Eh
160,72 → 47,6
popa
ret
 
; Now int 16 is used for keyboard support.
; This is shorter, simpler and more reliable.
if 0
getkey: push ecx
push edx
add ebx,0x0101
xor eax,eax
 
gk1:
in al,0x60
mov cl,al
gk0:
in al,0x60
cmp al,cl
je gk0
cmp ax,11
jg gk0
gk0_1:
mov cl,al
 
; add al,47
; mov [ds:keyinbs-0x10000],al
; mov si,keyinbs-0x10000
; call printplain
 
gk12:
in al,0x60
cmp al,cl
je gk12
cmp ax,240
jne gk13
mov al,cl
jmp gk14
gk13:
add cl,128
cmp al,cl
jne gk1
sub al,128
gk14:
 
movzx edx,bl
cmp eax,edx
jb gk1
movzx edx,bh
cmp eax,edx
jg gk1
test ebx,0x010000
jnz gk3
mov cx,0x1000
mov dx,cx
add eax,47
mov cx,ax
cmp cx,58
jb gk_nozero
sub cx,10
gk_nozero:
mov [ds:keyin-0x10000],cl
mov si,keyin-0x10000
call printplain
gk3:
sub eax,48
pop edx
pop ecx
ret
end if
 
getkey:
; get number in range [bl,bh] (bl,bh in ['0'..'9'])
; in: bx=range
258,17 → 79,6
call setcursor
}
 
;pagetable_set:
;eax - physical address
;es:di - page table
;ecx - number of pages to map
; or al, 7
;@@:
; stosd
; add eax, 1000h
; loop @b
; ret
 
boot_read_floppy:
push si
xor si, si
281,7 → 91,7
inc si
cmp si, 10
jb @b
mov si, badsect-0x10000
mov si, badsect
sayerr_plain:
call printplain
jmp $
301,15 → 111,11
; \begin{diamond}[02.12.2005]
cmp ax, 'KL'
jnz @f
mov word [cs:cfgmanager.loader_block-0x10000], si
mov word [cs:cfgmanager.loader_block+2-0x10000], ds
mov word [cs:cfgmanager.loader_block], si
mov word [cs:cfgmanager.loader_block+2], ds
@@:
; \end{diamond}[02.12.2005]
 
 
mov word [cs:bx_from_load - 0x10000], bx ; {SPraid}[13.03.2007]
; set up stack
mov ax, 3000h
mov ss, ax
326,7 → 132,7
 
if lang eq ru
; Load & set russian VGA font (RU.INC)
mov bp,RU_FNT1-10000h ; RU_FNT1 - First part
mov bp, RU_FNT1 ; RU_FNT1 - First part
mov bx,1000h ; 768 bytes
mov cx,30h ; 48 symbols
mov dx,80h ; 128 - position of first symbol
333,7 → 139,7
mov ax,1100h
int 10h
 
mov bp,RU_FNT2-10000h ; RU_FNT2 -Second part
mov bp,RU_FNT2 ; RU_FNT2 -Second part
mov bx,1000h ; 512 bytes
mov cx,20h ; 32 symbols
mov dx,0E0h ; 224 - position of first symbol
341,7 → 147,7
int 10h
; End set VGA russian font
else if lang eq et
mov bp,ET_FNT-10000h ; ET_FNT1
mov bp,ET_FNT ; ET_FNT1
mov bx,1000h ;
mov cx,255 ; 256 symbols
mov dx,0h ; 0 - position of first symbol
353,16 → 159,10
push 0xb800
pop es
xor di, di
; mov si,d80x25-0x10000
; mov cx,80*25
; mov ah,1*16+15
; dfl1:
; lodsb
; stosw
; loop dfl1
mov ah, 1*16+15
 
; draw top
mov si, d80x25_top - 0x10000
mov si, d80x25_top
mov cx, d80x25_top_num * 80
@@:
lodsb
369,7 → 169,7
stosw
loop @b
; draw spaces
mov si, space_msg - 0x10000
mov si, space_msg
mov cx, 25 - d80x25_top_num - d80x25_bottom_num
dfl1:
push cx
383,7 → 183,7
pop cx
loop dfl1
; draw bottom
mov si, d80x25_bottom - 0x10000
mov si, d80x25_bottom
mov cx, d80x25_bottom_num * 80
@@:
lodsb
390,7 → 190,7
stosw
loop @b
 
mov byte [space_msg-0x10000+80], 0 ; now space_msg is null terminated
mov byte [space_msg+80], 0 ; now space_msg is null terminated
 
_setcursor d80x25_top_num,0
 
410,58 → 210,19
and dx,bx
cmp ax,dx
jnz cpugood
mov si,not386-0x10000
mov si,not386
sayerr:
call print
jmp $
cpugood:
 
push 0
popf
sti
 
; set up esp
movzx esp, sp
 
; FLUSH 8042 KEYBOARD CONTROLLER
 
;// mike.dld [
; mov al,0xED
; out 0x60,al
; or cx,-1
; @@:
; in al,0x64
; test al,2
; jz @f
; loop @b
; @@:
; mov al,0
; out 0x60,al
; or cx,-1
; @@:
; in al,0x64
; test al,2
; jz @f
; loop @b
; @@:
;// mike.dld ]
 
; mov ecx,10000
; fl1:
; in al,0x64
; loop fl1
; test al,1
; jz fl2
; in al,0x60
; jmp fl1
; fl2:
 
;****************************************************************
; The function is modified Mario79
;*****************************************************************
; wait_kbd: ; variant 1
; mov cx,2500h ;çàäåðæêà ïîðÿäêà 10 ìñåê
; test_kbd:
; in al,64h ;÷èòàåì ñîñòîÿíèå êëàâèàòóðû
; test al,2 ;ïðîâåðêà áèòà ãîòîâíîñòè
; loopnz test_kbd
 
push 0
pop es
and word [es:0x9031], 0
531,7 → 292,7
; Write APM ver ----
and ax, 0xf0f
add ax, '00'
mov si, msg_apm - 0x10000
mov si, msg_apm
mov [si + 5], ah
mov [si + 7], al
_setcursor 0, 3
544,26 → 305,17
mov ax, 0x5303 ; Connect 32 bit mode interface
xor bx, bx
int 0x15
; init selectors
movzx eax, ax ; real-mode segment base address of protected-mode 32-bit code segment
shl eax, 4
mov [apm_code_32 - 0x10000 + 2], ax
shr eax, 16
mov [apm_code_32 - 0x10000 + 4], al
movzx ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment
shl ecx, 4
mov [apm_code_16 - 0x10000 + 2], cx
shr ecx, 16
mov [apm_code_16 - 0x10000 + 4], cl
movzx edx, dx ; real-mode segment base address of protected-mode 16-bit data segment
shl edx, 4
mov [apm_data_16 - 0x10000 + 2], dx
shr edx, 16
mov [apm_data_16 - 0x10000 + 4], dl
mov [es : 0x9040], ebx ; offset of APM entry point
 
push 0
pop es
 
mov [es:0x9040], ebx
mov [es:0x9050], ax
mov [es:0x9052], cx
mov [es:0x9054], dx
 
apm_end:
_setcursor d80x25_top_num, 0
; -----------------------------------------
 
; DISPLAY VESA INFORMATION
 
573,7 → 325,7
mov di,0xa000
int 0x10
cmp ax,0x004f
mov si, novesa-0x10000
mov si, novesa
jnz @f
mov bx, word [es:di+0x12]
shl ebx,16
580,7 → 332,7
mov [es:0x9050], ebx
mov ax,[es:di+4]
add ax,'0'*256+'0'
mov si,vervesa-0x10000
mov si,vervesa
mov [si+vervesa_off], ah
mov [si+vervesa_off+2], al
@@: call print
593,13 → 345,13
; b) preboot_dma_write = use DMA write?
; c) preboot_vrrm = use VRR?
; d) preboot_device = from what boot?
mov di, preboot_graph-0x10000
mov di, preboot_graph
; check bootloader block
cmp [.loader_block-0x10000], -1
cmp [.loader_block], -1
jz .noloaderblock
les bx, [.loader_block-0x10000]
les bx, [.loader_block]
cmp byte [es:bx], 1
mov si, loader_block_error-0x10000
mov si, loader_block_error
jnz sayerr
test byte [es:bx+1], 1
jz @f
610,11 → 362,11
@@:
.noloaderblock:
; determine default settings
mov [.bSettingsChanged-0x10000], 0
mov [.bSettingsChanged], 0
cmp byte [di], 0
jnz .preboot_gr_end
mov [di+preboot_gprobe-preboot_graph], 0
mov al, [vervesa+vervesa_off-0x10000]
mov al, [vervesa+vervesa_off]
cmp al, 'x'
jz .novesa
cmp al, '1'
637,42 → 389,42
cmp [di+preboot_device-preboot_graph], 1
adc [di+preboot_device-preboot_graph], 0
; notify user
mov si, linef-0x10000
mov si, linef
call print
mov si, start_msg-0x10000
mov si, start_msg
call print
mov si, time_msg-0x10000
mov si, time_msg
call print
; get start time
call .gettime
mov [.starttime-0x10000], eax
mov word [.timer-0x10000], .newtimer
mov word [.timer-0x10000+2], cs
mov [.starttime], eax
mov word [.timer], .newtimer
mov word [.timer+2], cs
.printcfg:
_setcursor 9,0
mov si, current_cfg_msg-0x10000
mov si, current_cfg_msg
call print
mov si, curvideo_msg-0x10000
mov si, curvideo_msg
call print
mov al, [preboot_graph-0x10000]
mov al, [preboot_graph]
cmp al, 8
ja .pnovesa
mov dl, al
and eax, 3
mov si, [modes_msg-0x10000+eax*2]
mov si, [modes_msg+eax*2]
call printplain
mov si, modevesa20-0x10000
mov si, modevesa20
cmp dl, 4
jbe @f
mov si, modevesa12-0x10000
mov si, modevesa12
@@:
call printplain
cmp dl, 4
ja .x
mov si, probeno_msg-0x10000
cmp [preboot_gprobe-0x10000], 2
mov si, probeno_msg
cmp [preboot_gprobe], 2
jnz @f
mov si, probeok_msg-0x10000
mov si, probeok_msg
@@:
call printplain
.x:
679,24 → 431,24
jmp .c
.pnovesa:
cmp al, 9
mov si, mode9-0x10000
mov si, mode9
jz @b
mov si, mode10-0x10000
mov si, mode10
jmp @b
.c:
mov si, linef-0x10000
mov si, linef
call printplain
mov si, dma_msg-0x10000
cmp [preboot_dma_write-0x10000], 1
mov si, dma_msg
cmp [preboot_dma_write], 1
call .say_on_off
mov si, vrrm_msg-0x10000
cmp [preboot_vrrm-0x10000], 1
mov si, vrrm_msg
cmp [preboot_vrrm], 1
call .say_on_off
mov si, preboot_device_msg-0x10000
mov si, preboot_device_msg
call print
mov al, [preboot_device-0x10000]
mov al, [preboot_device]
and eax, 3
mov si, [preboot_device_msgs-0x10000+eax*2]
mov si, [preboot_device_msgs+eax*2]
call printplain
.wait:
_setcursor 25,0 ; out of screen
705,8 → 457,8
push 0
pop es
mov eax, [es:8*4]
mov [.oldtimer-0x10000], eax
mov eax, [.timer-0x10000]
mov [.oldtimer], eax
mov eax, [.timer]
mov [es:8*4], eax
sti
; wait for keypressed
716,11 → 468,11
; restore timer interrupt
push 0
pop es
mov eax, [.oldtimer-0x10000]
mov eax, [.oldtimer]
mov [es:8*4], eax
mov [.timer-0x10000], eax
mov [.timer], eax
_setcursor 7,0
mov si, space_msg-0x10000
mov si, space_msg
call printplain
pop ax
; switch on key
736,15 → 488,15
cmp al, 'd'
jnz .wait
_setcursor 15,0
mov si,bdev-0x10000
mov si,bdev
call print
mov bx,'13'
call getkey
mov [preboot_device-0x10000], al
mov [preboot_device], al
_setcursor 13,0
.d:
mov [.bSettingsChanged-0x10000], 1
mov si, space_msg-0x10000
mov [.bSettingsChanged], 1
mov si, space_msg
call printplain
_setcursor 15,0
mov cx, 6
754,46 → 506,46
jmp .printcfg
.change_a:
_setcursor 15,0
mov si, gr_mode-0x10000
mov si, gr_mode
call printplain
mov bx, '09'
call getkey
mov [preboot_graph-0x10000], al
mov [preboot_graph], al
cmp al, 4
ja @f
mov si, probetext-0x10000
mov si, probetext
call printplain
mov bx, '12'
call getkey
mov [preboot_gprobe-0x10000], al
mov [preboot_gprobe], al
@@:
_setcursor 10,0
jmp .d
.change_b:
_setcursor 15,0
mov si, ask_dma-0x10000
mov si, ask_dma
call print
mov bx, '12'
call getkey
mov [preboot_dma_write-0x10000], al
mov [preboot_dma_write], al
_setcursor 11,0
jmp .d
.change_c:
_setcursor 15,0
mov si, vrrmprint-0x10000
mov si, vrrmprint
call print
mov bx, '12'
call getkey
mov [preboot_vrrm-0x10000], al
mov [preboot_vrrm], al
_setcursor 12,0
jmp .d
.say_on_off:
pushf
call print
mov si, on_msg-0x10000
mov si, on_msg
popf
jz @f
mov si, off_msg-0x10000
mov si, off_msg
@@: call printplain
ret
; novesa and vervesa strings are not used at the moment of executing this code
803,9 → 555,7
.bSettingsChanged db ?
.timer dd ?
end virtual
org $+0x10000
.loader_block dd -1
org $-0x10000
.gettime:
mov ah, 0
int 1Ah
818,10 → 568,10
push cs
pop ds
pushf
call [.oldtimer-0x10000]
call [.oldtimer]
pushad
call .gettime
sub eax, [.starttime-0x10000]
sub eax, [.starttime]
sub ax, 18*5
jae .timergo
neg ax
838,12 → 588,12
mov cl, 'ã'
jz @f
mov cl, 'ë'
@@: mov [time_str+9-0x10000], cl
@@: mov [time_str+9], cl
else if lang eq et
cmp al, 1
ja @f
mov [time_str+9-0x10000], ' '
mov [time_str+10-0x10000],' '
mov [time_str+9], ' '
mov [time_str+10],' '
@@:
else
; wait 5/4/3/2 seconds, 1 second
851,11 → 601,11
mov cl, 's'
ja @f
mov cl, ' '
@@: mov [time_str+9-0x10000], cl
@@: mov [time_str+9], cl
end if
add al, '0'
mov [time_str+1-0x10000], al
mov si, time_msg-0x10000
mov [time_str+1], al
mov si, time_msg
_setcursor 7,0
call print
_setcursor 25,0
865,24 → 615,24
.timergo:
push 0
pop es
mov eax, [.oldtimer-0x10000]
mov eax, [.oldtimer]
mov [es:8*4], eax
mov sp, 0EC00h
.continue:
sti
_setcursor 6,0
mov si, space_msg-0x10000
mov si, space_msg
call printplain
call printplain
_setcursor 6,0
mov si, loading_msg-0x10000
mov si, loading_msg
call print
_setcursor 15,0
cmp [.bSettingsChanged-0x10000], 0
cmp [.bSettingsChanged], 0
jz .load
cmp [.loader_block-0x10000], -1
cmp [.loader_block], -1
jz .load
les bx, [.loader_block-0x10000]
les bx, [.loader_block]
mov eax, [es:bx+3]
push ds
pop es
889,7 → 639,7
test eax, eax
jz .load
push eax
mov si, save_quest-0x10000
mov si, save_quest
call print
.waityn:
mov ah, 0
900,7 → 650,7
cmp al, 'y'
jnz .waityn
call putchar
mov byte [space_msg-0x10000+80], 186
mov byte [space_msg+80], 186
pop eax
push cs
push .cont
911,7 → 661,7
.cont:
push cs
pop ds
mov si, space_msg-0x10000
mov si, space_msg
mov byte [si+80], 0
_setcursor 15,0
call printplain
921,12 → 671,12
 
; ASK GRAPHICS MODE
 
movzx ax, [preboot_graph-0x10000]
movzx ax, [preboot_graph]
push 0
pop es
; address is gr_table+6*(ax-1)-0x10000
; address is gr_table+6*(ax-1)
add ax, ax
lea si, [gr_table-0x10000 + eax + eax*2 - 6]
lea si, [gr_table + eax + eax*2 - 6]
mov bx,[si+0]
mov cx,[si+2]
mov dx,[si+4]
945,7 → 695,7
; USE DEFAULTS OR PROBE
 
; bx - mode : cx - x size : dx - y size
cmp [preboot_gprobe-0x10000], 1
cmp [preboot_gprobe], 1
jz noprobe
 
mov bx,0x100
952,7 → 702,7
newprobe:
inc bx
cmp bx,0x17f
mov si,prnotfnd-0x10000
mov si,prnotfnd
jz sayerr
 
probemore:
999,12 → 749,12
mov [es:0x9000],al
nov:
cmp al,24
mov si,bt24-0x10000
mov si,bt24
jz bppl
cmp al,32
mov si,bt32-0x10000
mov si,bt32
jz bppl
mov si,btns-0x10000
mov si,btns
jmp sayerr
bppl:
call print
1033,26 → 783,26
 
; DMA WRITE
 
mov al, [preboot_dma_write-0x10000]
mov al, [preboot_dma_write]
mov [es:0x901F],al
 
; VRR_M USE
 
mov al,[preboot_vrrm-0x10000]
mov al,[preboot_vrrm]
mov [es:0x9030],al
mov [es:0x901E],byte 1
 
; BOOT DEVICE
 
mov al, [preboot_device-0x10000]
mov al, [preboot_device]
dec al
mov [boot_dev-0x10000],al
mov [boot_dev],al
 
; READ DISKETTE TO MEMORY
 
; cmp [boot_dev-0x10000],0
; cmp [boot_dev],0
jne no_sys_on_floppy
mov si,diskload-0x10000
mov si,diskload
call print
xor ax, ax ; reset drive
xor dx, dx
1065,7 → 815,7
mov bx, 0xB000 ; es:bx -> data area
call boot_read_floppy
; and copy them to extended memory
mov si, movedesc-0x10000
mov si, movedesc
mov [si+8*2+3], bh
push es
push ds
1079,7 → 829,7
mov dx, 0x3f2
mov al, 0
out dx, al
mov si, memmovefailed-0x10000
mov si, memmovefailed
jmp sayerr_plain
@@:
add dword [si+8*3+2], 512*10
1168,7 → 918,7
aam
xchg al, ah
add ax, '00'
mov si, pros-0x10000
mov si, pros
cmp [si], ax
jz @f
mov [si], ax
1246,9 → 996,10
; jnz reads
; readdone:
; pop ax
mov si,backspace2-0x10000
 
mov si,backspace2
call printplain
mov si,okt-0x10000
mov si,okt
call printplain
no_sys_on_floppy:
xor ax, ax ; reset drive
1274,7 → 1025,7
setgr:
int 0x10
test ah,ah
mov si, fatalsel-0x10000
mov si, fatalsel
jnz sayerr
; set mode 0x12 graphics registers:
cmp bx,0x12
1302,4 → 1053,3
gmok2:
push ds
pop es
 
/kernel/trunk/boot/booteng.inc
73,7 → 73,7
mode2 db "800x600",0
mode3 db "1024x768",0
mode4 db "1280x1024",0
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
modes_msg dw mode4,mode1,mode2,mode3
modevesa20 db " with LFB",0
modevesa12 db ", VESA 1.2 Bnk",0
mode9 db "320x200, EGA/CGA 256 colors",0
85,7 → 85,7
off_msg db " off",13,10,0
vrrm_msg db " [c] Use VRR:",0
preboot_device_msg db " [d] Floppy image: ",0
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "real floppy",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "use already loaded image",13,10,0
/kernel/trunk/boot/bootet.inc
73,7 → 73,7
mode2 db "800x600",0
mode3 db "1024x768",0
mode4 db "1280x1024",0
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
modes_msg dw mode4,mode1,mode2,mode3
modevesa20 db " koos LFB",0
modevesa12 db ", VESA 1.2 Bnk",0
mode9 db "320x200, EGA/CGA 256 värvi",0
85,7 → 85,7
off_msg db " väljas",13,10,0
vrrm_msg db " [c] Kasuta VRR:",0
preboot_device_msg db " [d] Disketi kujutis: ",0
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "reaalne diskett",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "kasuta juba laaditud kujutist",13,10,0
/kernel/trunk/boot/bootge.inc
78,7 → 78,7
mode2 db "800x600",0
mode3 db "1024x768",0
mode4 db "1280x1024",0
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
modes_msg dw mode4,mode1,mode2,mode3
modevesa20 db " mit LFB",0
modevesa12 db ", VESA 1.2 Bnk",0
mode9 db "320x200, EGA/CGA 256 colors",0
90,7 → 90,7
off_msg db " aus",13,10,0
vrrm_msg db " [c] Nutze VRR:",0
preboot_device_msg db " [d] Diskettenimage: ",0
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "Echte Diskette",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "Nutze bereits geladenes Image",13,10,0
/kernel/trunk/boot/bootru.inc
17,7 → 17,6
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, "
74,7 → 73,7
mode2 db "800x600",0
mode3 db "1024x768",0
mode4 db "1280x1024",0
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
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
86,7 → 85,7
off_msg db " ¢ëª«",13,10,0
vrrm_msg db " [c] ˆá¯®«ì§®¢ ­¨¥ VRR:",0
preboot_device_msg db " [d] Ž¡à § ¤¨áª¥âë: ",0
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "­ áâ®ïé ï ¤¨áª¥â ",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §",13,10,0
/kernel/trunk/boot/preboot.inc
24,7 → 24,7
;!!!! 0 - autodetect !!!!
preboot_blogesc db 1 ; start immediately after bootlog
 
if $>10200h
if $>0x200
ERROR: prebooting parameters must fit in first sector!!!
end if
hdsysimage db 'KOLIBRI IMG' ; load from
/kernel/trunk/boot/rdload.inc
8,7 → 8,7
 
; READ RAMDISK IMAGE FROM HD
 
cmp [boot_dev],1
cmp [boot_dev+OS_BASE+0x10000],1
jne no_sys_on_hd
 
test [DRIVE_DATA+1],byte 0x40
88,7 → 88,7
ret
 
read_image:
mov eax, hdsysimage
mov eax, hdsysimage+OS_BASE+0x10000
mov ebx, 1474560/512
mov ecx, RAMDISK
mov esi, 0
/kernel/trunk/boot/shutdown.inc
12,205 → 12,18
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
system_shutdown: ; shut down the system
call stop_all_services
 
push 3 ; stop playing cd
pop eax
call sys_cd_audio
cld
 
mov al,[0x2f0000+0x9030]
cmp al,1
jl no_shutdown_parameter
cmp al,4
jle yes_shutdown_param
no_shutdown_parameter:
 
; movzx ecx,word [0x2f0000+0x900A]
; movzx esi,word [0x2f0000+0x900C]
; imul ecx,esi ;[0xfe04]
;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen
; push ecx
; mov esi,[0xfe80]
; cmp esi,32*0x100000
; jbe no_darken_screen
; mov edi,16*0x100000
; push esi edi
; sdnewpix:
; lodsd
; shr eax,1
; and eax,0x7f7f7f7f
; stosd
; loop sdnewpix
; pop ecx
; pop esi edi
; rep movsd
; no_darken_screen:
 
; read shutdown code:
; 1) display shutdown "window"
 
mov eax,[0xfe00]
shr eax,1
lea esi,[eax+220] ; x end
sub eax,220 ; x start
 
mov ebx,[ScreenHeight]
shr ebx,1
mov [shutdownpos],ebx
lea ebp,[ebx+105] ; y end
sub ebx,120 ; y start
 
xor edi,edi
inc edi ; force putpixel & dtext
mov ecx,0x0000ff
 
; vertical loop begin
sdnewpix1:
push eax ; save x start
 
; horizontal loop begin
sdnewpix2:
 
call [putpixel]
 
inc eax
cmp eax,esi
jnz sdnewpix2
; horizontal loop end
 
dec ecx ; color
pop eax ; restore x start
 
inc ebx ; advance y pos
cmp ebx,ebp
jnz sdnewpix1
; vertical loop end
 
; 2) display text strings
; a) version
mov eax,[0xfe00]
shr eax,1
shl eax,16
mov ax,word [shutdownpos]
push eax
sub eax,(220-27)*10000h + 105
mov ebx,0xffff00
mov ecx,version
push 34
pop edx
call dtext
 
; b) variants
add eax,105+33
push 6
pop esi
; mov ebx,0xffffff
mov bl,0xFF
mov ecx,shutdowntext
mov dl,40
newsdt:
call dtext
add eax,10
add ecx,edx
dec esi
jnz newsdt
 
; 3) load & display rose.txt
mov eax,rosef-std_application_base_address ; load rose.txt
xor ebx,ebx
push 2
pop ecx
mov edx,0x90000
push edx
push 12
pop esi
push edi ; may be destroyed
 
pushad
push eax
call file_system_lfn ; by SPraid fileread
pop eax
popad
pop edi
 
pop ecx
inc ecx ; do not display stars from rose.txt
pop eax
add eax,20*10000h - 110
 
mov ebx,0x00ff00
push 27
pop edx
 
nrl:
call dtext
; sub ebx,0x050000
ror ebx, 16
sub bl, 0x05
ror ebx, 16
add eax,8
add ecx,31
cmp cx,word 0x0001+25*31
jnz nrl
 
call checkVga_N13
 
yes_shutdown_param:
cli
 
mov eax,kernel ; load kernel.mnt to 0x8000:0
push 12
pop esi
xor ebx,ebx
or ecx,-1
mov edx,0x80000
call fileread
 
mov esi,restart_kernel_4000+0x10000 ; move kernel re-starter to 0x4000:0
mov edi,0x40000
mov ecx,1000
rep movsb
 
mov eax,0x2F0000 ; restore 0x0 - 0xffff
xor ebx,ebx
mov ecx,0x10000
call memmove
 
call restorefatchain
 
mov al, 0xFF
out 0x21, al
out 0xA1, al
 
mov word [0x467+0],pr_mode_exit-0x10000
mov word [0x467+2],0x1000
 
mov al,0x0F
out 0x70,al
mov al,0x05
out 0x71,al
 
mov al,0xFE
out 0x64,al
hlt
 
use16
 
align 4
pr_mode_exit:
org $-0x10000
 
; setup stack
mov ax, 3000h
mov ax, 0x3000
mov ss, ax
mov esp, 0EC00h
mov esp, 0x0EC00
; setup ds
push cs
pop ds
 
lidt [old_ints_h-0x10000]
lidt [old_ints_h]
;remap IRQs
mov al,0x11
out 0x20,al
307,90 → 120,64
rdelay:
ret
 
iglobal
kernel db 'KERNEL MNT'
; shutdown_parameter db 0
endg
floppy_write: ; write diskette image to physical floppy
 
restart_kernel:
cmp [flm],byte 1
je fwwritedone
mov [flm],byte 1
 
mov ax,0x0003 ; set text mode for screen
int 0x10
xor ax, ax ; reset drive
xor dx, dx
int 0x13
 
jmp 0x4000:0000
mov cx,0x0001 ; startcyl,startsector
xor dx, dx ; starthead,drive
mov ax, 80*2 ; read no of sect
 
fwwrites:
push ax
 
restart_kernel_4000:
cli
; move 1mb+ -> 0:a000
 
; mov di,0x1000 ; load kernel image from 0x8000:0 -> 0x1000:0
;
; new_kernel_block_move:
;
; mov ebx,0
;
; new_kernel_byte_move:
;
; mov ax,di
; add ax,0x7000
; mov es,ax
; mov dl,[es:bx]
; mov es,di
; mov [es:bx],dl
;
; inc ebx
; cmp ebx,65536
; jbe new_kernel_byte_move
;
; add di,0x1000
; cmp di,0x2000
; jbe new_kernel_block_move
pusha
mov si, fwmovedesc
mov cx,256*18
mov ah,0x87
push ds
pop es
mov cx, 0x8000
push cx
mov ds, cx
int 0x15
add dword [fwmovedesc+0x12], 512*18
popa
 
xor si, si
xor di, di
rep movsw
push 0x9000
pop ds
push 0x2000
pop es
pop cx
rep movsw
mov es,si
fwnewwrite:
mov bx,0xa000 ; es:bx -> data area
mov ax,0x0300+18 ; read, no of sectors to read
int 0x13
 
wbinvd ; write and invalidate cache
test ah, ah
jz fwgoodwrite
 
; mov ax,0x1000
; mov es,ax
; mov ax,0x3000
; mov ss,ax
; mov sp,0xec00
; restore timer
mov al, 00110100b
out 43h, al
jcxz $+2
mov al, 0xFF
out 40h, al
jcxz $+2
out 40h, al
jcxz $+2
sti
inc si
cmp si,10
jnz fwnewwrite
 
; (hint by Black_mirror)
; We must read data from keyboard port,
; because there may be situation when previous keyboard interrupt is lost
; (due to return to real mode and IRQ reprogramming)
; and next interrupt will not be generated (as keyboard waits for handling)
in al, 0x60
; can't access diskette - return
pop ax
ret
 
; bootloader interface
push 0x1000
pop ds
mov si, kernel_restart_bootblock-0x10000
mov ax, 'KL'
jmp 0x1000:0000
fwgoodwrite:
inc dh
cmp dh,2
jnz fwbb2
mov dh,0
inc ch
fwbb2:
pop ax
dec ax
jnz fwwrites
ret
 
APM_PowerOff:
mov ax, 5304h
433,113 → 220,55
;!!!!!!!!!!!!!!!!!!!!!!!!
fwwritedone:
ret
org $+0x10000
flm db 0
org $-0x10000
 
floppy_write: ; write diskette image to physical floppy
restart_kernel:
 
cmp [flm-0x10000],byte 1
je fwwritedone
mov [flm-0x10000],byte 1
mov ax,0x0003 ; set text mode for screen
int 0x10
jmp 0x4000:0000
 
xor ax, ax ; reset drive
xor dx, dx
int 0x13
restart_kernel_4000:
cli
 
mov cx,0x0001 ; startcyl,startsector
; mov dx,0x0000 ; starthead,drive
xor dx, dx
mov ax, 80*2 ; read no of sect
 
fwwrites:
push ax
 
; move 1mb+ -> 0:a000
 
pusha
mov si,fwmovedesc -0x10000
mov cx,256*18
mov ah,0x87
push ds
pop es
int 0x15
add dword [fwmovedesc-0x10000+0x12], 512*18
popa
 
mov cx, 0x8000
push cx
mov ds, cx
xor si,si
mov es,si
fwnewwrite:
mov bx,0xa000 ; es:bx -> data area
mov ax,0x0300+18 ; read, no of sectors to read
int 0x13
xor di, di
rep movsw
push 0x9000
pop ds
push 0x2000
pop es
pop cx
rep movsw
 
test ah, ah
jz fwgoodwrite
wbinvd ; write and invalidate cache
 
inc si
cmp si,10
jnz fwnewwrite
mov al, 00110100b
out 43h, al
jcxz $+2
mov al, 0xFF
out 40h, al
jcxz $+2
out 40h, al
jcxz $+2
sti
 
; can't access diskette - return
pop ax
ret
; (hint by Black_mirror)
; We must read data from keyboard port,
; because there may be situation when previous keyboard interrupt is lost
; (due to return to real mode and IRQ reprogramming)
; and next interrupt will not be generated (as keyboard waits for handling)
in al, 0x60
 
fwgoodwrite:
inc dh
cmp dh,2
jnz fwbb2
mov dh,0
inc ch
fwbb2:
pop ax
dec ax
jnz fwwrites
ret
org $+0x10000
fwmovedesc:
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
org $-0x10000
use32
org $+0x10000
uglobal
shutdownpos dd 0x0
endg
; bootloader interface
push 0x1000
pop ds
mov si, kernel_restart_bootblock
mov ax, 'KL'
jmp 0x1000:0000
 
iglobal
if lang eq en
shutdowntext:
db "IT'S SAFE TO POWER OFF COMPUTER OR "
db ' '
db '1) SAVE RAMDISK TO FLOPPY '
db '2) APM - POWEROFF '
db '3) REBOOT '
db '4) RESTART KERNEL '
else if lang eq ru
shutdowntext:
db "¥§®¯ á­®¥ ¢ëª«î祭¨¥ ª®¬¯ìîâ¥à  ¨«¨ "
db ' '
db '1) ‘®åà ­¨âì à ¬¤¨áª ­  ¤¨áª¥âã '
db '2) APM - ¢ëª«î祭¨¥ ¯¨â ­¨ï '
db '3) ¥à¥§ £à㧪  á¨á⥬ë '
db '4) ¥áâ àâ ï¤à  ¨§ Ž‡“ '
else
shutdowntext:
db "SIE KOENNEN DEN COMPUTER NUN AUSSCHALTEN"
db ' '
db '1) RAMDISK AUF DISK SPEICHERN '
db '2) APM - AUSSCHALTEN '
db '3) NEUSTARTEN '
db '4) KERNEL NEU STARTEN '
end if
rosef:
dd 0,0,0,1024,0x90000-std_application_base_address
db '/rd/1/ROSE.TXT',0
endg