From 55d060c4566bd62cb671b6010ea8018b2231aafb Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Thu, 31 Aug 2006 12:56:29 +0000 Subject: [PATCH] bootcode.inc: fixed error in loader block checks dev_hdcd.inc: increased delay in reset function kernel.asm: now kernel loads system programs (vrr_m/launcher and cpu) via fn 70 shutdown.inc: corrected code of rose output IR, VRR_M: modified to use function 70 + optimization git-svn-id: svn://kolibrios.org@143 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/gfx_kernel/kernel.asm | 24 +- kernel/trunk/boot/bootcode.inc | 8 +- kernel/trunk/boot/shutdown.inc | 5 +- kernel/trunk/detect/dev_hdcd.inc | 2 +- kernel/trunk/kernel.asm | 24 +- programs/system/ir/trunk/ir.asm | 301 ++++++++++---------------- programs/system/vrr_m/trunk/vrr_m.asm | 63 +++--- 7 files changed, 188 insertions(+), 239 deletions(-) diff --git a/kernel/branches/gfx_kernel/kernel.asm b/kernel/branches/gfx_kernel/kernel.asm index 61cd9285c0..7575b6edd6 100644 --- a/kernel/branches/gfx_kernel/kernel.asm +++ b/kernel/branches/gfx_kernel/kernel.asm @@ -233,14 +233,14 @@ uglobal endg iglobal - firstapp db 'LAUNCHER ' + firstapp db '/rd/1/LAUNCHER',0 char db 'CHAR MT ' char2 db 'CHAR2 MT ' bootpath db '/KOLIBRI ' bootpath2 db 0 vmode db 'VMODE MDR' cur_file db 'ARROW CUR' - vrr_m db 'VRR_M ' + vrr_m db '/rd/1/VRR_M',0 endg @@ -772,21 +772,22 @@ mov [256+12],ebx mov [0x3000],dword 1 mov [0x3004],dword 1 cli - mov al,[0x2f0000+0x9030] - cmp al,1 + cmp byte [0x2f0000+0x9030],1 jne no_load_vrr_m - mov eax,vrr_m + mov ebp,vrr_m + lea esi,[ebp+6] ; skip '/RD/1/' xor ebx,ebx ; no parameters xor edx,edx ; no flags - call start_application_fl + call fs_RamdiskExecute.flags cmp eax,2 ; if vrr_m app found (PID=2) je first_app_found no_load_vrr_m: - mov eax,firstapp + mov ebp,firstapp + lea esi,[ebp+6] xor ebx,ebx ; no parameters xor edx,edx ; no flags - call start_application_fl + call fs_RamdiskExecute.flags cmp eax,2 ; continue if a process has been loaded je first_app_found @@ -3350,7 +3351,7 @@ uglobal mouse_active db 0 endg iglobal - cpustring db 'CPU ' + cpustring db '/RD/1/CPU',0 endg uglobal @@ -3364,10 +3365,11 @@ checkmisc: cmp [ctrl_alt_del], 1 jne nocpustart - mov eax, cpustring + mov ebp, cpustring + lea esi,[ebp+6] xor ebx,ebx ; no parameters xor edx,edx ; no flags - call start_application_fl + call fs_RamdiskExecute.flags mov [ctrl_alt_del], 0 nocpustart: cmp [mouse_active], 1 diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index ea95773d02..5321288ce5 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -448,8 +448,8 @@ cfgmanager: ; d) preboot_device = from what boot? mov di, preboot_graph-0x10000 ; check bootloader block - cmp [.loader_block-0x10000], 1 - jnz .noloaderblock + cmp [.loader_block-0x10000], -1 + jz .noloaderblock les bx, [.loader_block-0x10000] cmp byte [es:bx], 1 mov si, loader_block_error-0x10000 @@ -657,7 +657,7 @@ virtual at novesa .timer dd ? end virtual org $+0x10000 -.loader_block dd 0 +.loader_block dd -1 org $-0x10000 .gettime: mov ah, 0 @@ -727,7 +727,7 @@ end if _setcursor 15,0 cmp [.bSettingsChanged-0x10000], 0 jz .load - cmp [.loader_block-0x10000], 0 + cmp [.loader_block-0x10000], -1 jz .load les bx, [.loader_block-0x10000] mov eax, [es:bx+3] diff --git a/kernel/trunk/boot/shutdown.inc b/kernel/trunk/boot/shutdown.inc index e4188c3f29..5c54dd5ea7 100644 --- a/kernel/trunk/boot/shutdown.inc +++ b/kernel/trunk/boot/shutdown.inc @@ -136,7 +136,10 @@ system_shutdown: ; shut down the system nrl: call dtext - sub ebx,0x050000 +; sub ebx,0x050000 + ror ebx, 16 + sub bl, 0x05 + ror ebx, 16 add eax,8 add ecx,31 cmp cx,word 0x0001+25*31 diff --git a/kernel/trunk/detect/dev_hdcd.inc b/kernel/trunk/detect/dev_hdcd.inc index 0275c9f818..dd1d4646b2 100644 --- a/kernel/trunk/detect/dev_hdcd.inc +++ b/kernel/trunk/detect/dev_hdcd.inc @@ -329,7 +329,7 @@ DeviceReset: mov AL,08h inc DX ;ЁхушёЄЁ ъюьрэф out DX,AL - mov ecx,0xffff + mov ecx,0x80000 @@WaitHDReady_1: ; ╧ЁютхЁшЄ№ тЁхь  юцшфрэш  dec ecx diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 1f212435f1..89b16ede7c 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -231,13 +231,13 @@ uglobal endg iglobal - firstapp db 'LAUNCHER ' + firstapp db '/rd/1/LAUNCHER',0 char db 'CHAR MT ' char2 db 'CHAR2 MT ' bootpath db '/KOLIBRI ' bootpath2 db 0 vmode db 'VMODE MDR' - vrr_m db 'VRR_M ' + vrr_m db '/rd/1/VRR_M',0 endg @@ -727,21 +727,22 @@ finit ;reset the registers, contents which are still equal RM mov [0x3000],dword 1 mov [0x3004],dword 1 cli - mov al,[0x2f0000+0x9030] - cmp al,1 + cmp byte [0x2f0000+0x9030],1 jne no_load_vrr_m - mov eax,vrr_m + mov ebp,vrr_m + lea esi,[ebp+6] ; skip '/rd/1/' xor ebx,ebx ; no parameters xor edx,edx ; no flags - call start_application_fl + call fs_RamdiskExecute.flags cmp eax,2 ; if vrr_m app found (PID=2) je first_app_found no_load_vrr_m: - mov eax,firstapp + mov ebp,firstapp + lea esi,[ebp+6] xor ebx,ebx ; no parameters xor edx,edx ; no flags - call start_application_fl + call fs_RamdiskExecute.flags cmp eax,2 ; continue if a process has been loaded je first_app_found @@ -3336,7 +3337,7 @@ uglobal mouse_active db 0 endg iglobal - cpustring db 'CPU ' + cpustring db '/RD/1/CPU',0 endg uglobal @@ -3350,10 +3351,11 @@ checkmisc: cmp [ctrl_alt_del], 1 jne nocpustart - mov eax, cpustring + mov ebp, cpustring + lea esi,[ebp+6] xor ebx,ebx ; no parameters xor edx,edx ; no flags - call start_application_fl + call fs_RamdiskExecute.flags mov [ctrl_alt_del], 0 nocpustart: cmp [mouse_active], 1 diff --git a/programs/system/ir/trunk/ir.asm b/programs/system/ir/trunk/ir.asm index 04133eb849..b779a55cf3 100644 --- a/programs/system/ir/trunk/ir.asm +++ b/programs/system/ir/trunk/ir.asm @@ -8,43 +8,124 @@ use32 org 0x0 - db 'MENUET00' ; 8 byte id - dd 56 ; required os + db 'MENUET01' ; 8 byte id + dd 1 ; required os dd START ; program start dd I_END ; program image size dd 0x1000 ; required amount of memory dd 0x1000 ; esp = 0x7FFF0 - dd 0x00000000 ; reserved=no extended header + dd 0, 0 -include 'lang.inc' include 'macros.inc' START: ; start of execution - call draw_window ; at first, draw the window +set_variables: - call set_variables + mov eax,46 ; reserve ports 0x3f0 - 0x3ff + mov ebx,0 + mov ecx,0x3f0 + mov edx,0x3ff + int 0x40 + + mov eax,45 ; reserve irq 4 + mov ebx,0 + mov ecx,4 + int 0x40 + + mov eax,44 ; set read ports for irq 4 + mov ebx,irqtable +; mov ecx,4 + int 0x40 + + mov dh, 3 ; all ports have number 3xx hex + + mov dl, 0xf3+8 + mov al, 0x80 + out dx, al + + mov dl, 0xf1+8 + mov al, 0 + out dx, al + + mov dl, 0xf0+8 + mov al, 0x30 / 4 + out dx, al + + mov dl, 0xf3+8 + mov al, 3 + out dx, al + + mov dl, 0xf4+8 + mov al, 0xB + out dx, al + + mov dl, 0xf1+8 + mov al, 1 + out dx, al + + mov eax,5 + mov ebx,100 + int 0x40 + + mov dl, 0xf8 + mov al, 'I' + out dx, al + + mov eax,5 + mov ebx,10 + int 0x40 + + mov al, 'R' + out dx, al + + mov eax,40 ; get com 1 data with irq 4 + mov ebx,0000000000010000b shl 16 + 101b + int 0x40 + +red: + call draw_window still: mov eax,10 ; wait here for event int 0x40 + dec eax + jz red + dec eax + dec eax + jnz readir - cmp eax,1 ; redraw request ? - je red - cmp eax,2 ; key in buffer ? - je key - cmp eax,3 ; button in buffer ? - je button - cmp eax,16+4 - je readir + button: ; button + mov al,17 ; get id + int 0x40 - jmp still +; we have only one button, close + + mov eax,45 ; free irq + mov ebx,1 + mov ecx,4 + int 0x40 + + mov eax,46 ; free ports 0x3f0-0x3ff + mov ebx,1 + mov ecx,0x3f0 + mov edx,0x3ff + int 0x40 + + or eax,-1 ; close this program + int 0x40 pos dd 0x0 -cdplayer db 'CDPLAY ' +cdplayer: + dd 7 + dd 0 + dd 0 + dd 0 + dd 0 + db '/RD/1/CDP',0 readir: mov eax,42 @@ -54,9 +135,8 @@ cdplayer db 'CDPLAY ' cmp ebx,80 jne nocd - mov eax,19 + mov eax,70 mov ebx,cdplayer - mov ecx,0 int 0x40 @@ -85,38 +165,6 @@ cdplayer db 'CDPLAY ' call draw_data jmp still - red: ; redraw - call draw_window - jmp still - - key: ; key - mov eax,2 ; just read it and ignore - int 0x40 - jmp still - - button: ; button - mov eax,17 ; get id - int 0x40 - - cmp ah,1 ; button id=1 ? - jne noclose - - mov eax,45 ; free irq - mov ebx,1 - mov ecx,4 - int 0x40 - - mov eax,46 ; free ports 0x3f0-0x3ff - mov ebx,1 - mov ecx,0x3f0 - mov edx,0x3ff - int 0x40 - - mov eax,-1 ; close this program - int 0x40 - noclose: - - jmp still @@ -149,107 +197,9 @@ irqtable: dd 0x3f8+0x01000000 ; + 01 = read byte, 02 read word dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 -set_variables: - - - pusha - - mov eax,46 ; reserve ports 0x3f0 - 0x3ff - mov ebx,0 - mov ecx,0x3f0 - mov edx,0x3ff - int 0x40 - - mov eax,45 ; reserve irq 4 - mov ebx,0 - mov ecx,4 - int 0x40 - - mov eax,46 ; reserve ports 0x3f0-0x3ff - mov ebx,0 - mov ecx,0x3f0 - mov edx,0x3ff - int 0x40 - - mov eax,44 ; set read ports for irq 4 - mov ebx,irqtable - mov ecx,4 - int 0x40 - - mov cx,0x3f3+8 - mov bl,0x80 - mov eax,43 - int 0x40 - - mov cx,0x3f1+8 - mov bl,0 - mov eax,43 - int 0x40 - - mov cx,0x3f0+8 - mov bl,0x30 / 4 - mov eax,43 - int 0x40 - - mov cx,0x3f3+8 - mov bl,3 - mov eax,43 - int 0x40 - - mov cx,0x3f4+8 - mov bl,0xB - mov eax,43 - int 0x40 - - mov cx,0x3f1+8 - mov bl,1 - mov eax,43 - int 0x40 - - mov eax,5 - mov ebx,100 - int 0x40 - - mov cx,0x3f8 - mov bl,'I' - mov eax,43 - int 0x40 - - mov eax,5 - mov ebx,10 - int 0x40 - - mov cx,0x3f8 - mov bl,'R' - mov eax,43 - int 0x40 - - mov eax,40 ; get com 1 data with irq 4 - mov ebx,0000000000010000b shl 16 + 111b - int 0x40 - - popa - - ret - - ; ********************************************* ; ******* WINDOW DEFINITIONS AND DRAW ******** ; ********************************************* @@ -266,38 +216,27 @@ draw_window: mov ebx,100*65536+300 ; [x start] *65536 + [x size] mov ecx,100*65536+250 ; [y start] *65536 + [y size] mov edx,[wcolor] ; color of work area RRGGBB,8->color - mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide - mov edi,0x00ffffff ; color of frames RRGGBB + mov edi,labelt ; caption string int 0x40 - ; WINDOW LABEL - mov eax,4 ; function 4 : write text to window - mov ebx,8*65536+8 ; [x start] *65536 + [y start] - mov ecx,0x00ffffff ; color of text RRGGBB - mov edx,labelt ; pointer to text beginning - mov esi,labellen-labelt ; text length - int 0x40 - - ; CLOSE BUTTON - mov eax,8 ; function 8 : define and draw button - mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] - mov ecx,5*65536+12 ; [y start] *65536 + [y size] - mov edx,1 ; button id - mov esi,0x5599cc ; button color RRGGBB +; ; WINDOW LABEL +; mov eax,4 ; function 4 : write text to window +; mov ebx,8*65536+8 ; [x start] *65536 + [y start] +; mov ecx,0x00ffffff ; color of text RRGGBB +; mov edx,labelt ; pointer to text beginning +; mov esi,labellen-labelt ; text length ; int 0x40 - call draw_text - - mov eax,12 - mov ebx,2 - int 0x40 - - ret + ; CLOSE BUTTON +; mov eax,8 ; function 8 : define and draw button +; mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] +; mov ecx,5*65536+12 ; [y start] *65536 + [y size] +; mov edx,1 ; button id +; mov esi,0x5599cc ; button color RRGGBB +; int 0x40 draw_text: - pusha - mov ebx,25*65536+35 ; draw info text with function 4 mov ecx,0xffffff mov edx,text @@ -307,27 +246,23 @@ draw_text: mov eax,4 int 0x40 add ebx,10 - add edx,40 + add edx,esi dec edi jne newline - popa + mov eax,12 + mov ebx,2 + int 0x40 ret - ; DATA AREA -wcolor dd 0x03000000 +wcolor dd 0x13000000 -labelt db 'INFRARED RECEIVER FOR IRMAN IN COM 1' -labellen: +labelt db 'INFRARED RECEIVER FOR IRMAN IN COM 1',0 text: I_END: - - - - diff --git a/programs/system/vrr_m/trunk/vrr_m.asm b/programs/system/vrr_m/trunk/vrr_m.asm index 9310e3e249..fb34d08bcb 100644 --- a/programs/system/vrr_m/trunk/vrr_m.asm +++ b/programs/system/vrr_m/trunk/vrr_m.asm @@ -23,8 +23,7 @@ dd 0x0 ; адрес буфера для параметров (не используется) dd 0x0 ; зарезервировано -include 'lang.inc' -include 'macros.inc' ; макросы облегчают жизнь ассемблерщиков! +include 'MACROS.INC' ; макросы облегчают жизнь ассемблерщиков! ;--------------------------------------------------------------------- ;--- НАЧАЛО ПРОГРАММЫ ---------------------------------------------- @@ -32,11 +31,21 @@ include 'macros.inc' ; START: ; mcall 5,10 - mcall 21,13,1,drvinfo + mov ecx, 1 + mov edx, drvinfo + push @f + jmp call_driver +@@: ; jmp run_launcher - mcall 21,13,2 - cmp eax,-1 + mov ecx, 2 + push @f +call_driver: + mcall 21,13 + ret +@@: +; cmp eax,-1 + inc eax je run_launcher ; cmp ecx,280 ; je change_vrr @@ -64,34 +73,34 @@ change_vrr: ; mov dx,[_m1+ebx] ; rol edx,16 ;mov eax,ecx - xor eax,eax - sub ecx,3 - mov dx,cx - cmp cx,274 - je yes_274 - cmp cx,277 - je yes_277 - jmp yes_280 + mov eax, 10 + cmp cx,277+3 + je yes_277 + cmp cx,274+3 + jne yes_280 yes_274: add al,10 yes_277: add al,10 yes_280: - add al,10 - ror edx,16 - mov dx,[_m1+eax] - rol edx,16 -; mov dx,bx -; shl edx,16 -; mov dx,cx - mcall 21,13,3 -; mcall 5,300 + mov edx, [_m1+eax-2] + lea dx, [ecx-3] + push run_launcher + mov ecx, 3 + jmp call_driver run_launcher: - mcall 19,launcher,0 -; mcall 33,text,drvinfo,512,0 + mcall 70,launcher mcall -1 -launcher db 'LAUNCHER ' -;text db 'TEXT ' +launcher: + dd 7 + dd 0 + dd 0 + dd 0 + dd 0 + db '/RD/1/LAUNCHER' +I_END: ; метка конца программы + db ? ; system loader will zero all memory after program end + ; this byte will be terminating zero for launcher string drvinfo: ; 512 bytes driver info area ; +0 - Full driver name ; +32 - Driver version @@ -104,5 +113,3 @@ vidmode: org $+64 _m1: org drvinfo+200h - -I_END: ; метка конца программы