diff --git a/kernel/branches/Kolibri-A/trunk/core/sys32.inc b/kernel/branches/Kolibri-A/trunk/core/sys32.inc index 32c4e80a49..3d95d31bfb 100644 --- a/kernel/branches/Kolibri-A/trunk/core/sys32.inc +++ b/kernel/branches/Kolibri-A/trunk/core/sys32.inc @@ -100,19 +100,19 @@ uglobal pf_err_code dd ? endg -page_fault_exc: ; дуракоусточивость: селекторы испорчены... - pop [ss:pf_err_code]; действительно до следующего #PF +page_fault_exc: ; fool-proofing: if selectors damaged... + pop [ss:pf_err_code]; active to the next #PF save_ring3_context mov bl,14 -exc_c: ; исключения (все, кроме 7-го - #NM) -; Фрэйм стека при исключении/прерывании из 3-го кольца + pushad (т.е., именно здесь) +exc_c: ; exceptions (all but the 7th - #NM) +; the stack frame for an exception/interrupt occured in Ring3 + pushad (i.e. here) reg_ss equ esp+0x30 reg_esp3 equ esp+0x2C reg_eflags equ esp+0x28 reg_cs3 equ esp+0x24 reg_eip equ esp+0x20 - ; это фрэйм от pushad + ; pushad's frame reg_eax equ esp+0x1C reg_ecx equ esp+0x18 reg_edx equ esp+0x14 @@ -122,9 +122,9 @@ exc_c: ; reg_esi equ esp+0x04 reg_edi equ esp+0x00 - Mov ds,ax,app_data ; загрузим правильные значения - mov es,ax ; в сегментные регистры - cld ; и приводим DF к стандарту + Mov ds,ax,app_data ; load the correct values + mov es,ax ; to segregs + cld ; and clear DF movzx ebx,bl ; redirect to V86 manager? (EFLAGS & 0x20000) != 0? test byte[reg_eflags+2],2 @@ -259,7 +259,6 @@ p_irq14: mov edi, 14 cmp [v86_irqhooks+edi*8], 0 jnz v86_irq2 -; mov byte [BOOT_VAR + 0x48E], 0xFF call [irq14_func] call ready_for_next_irq_1 restore_ring3_context @@ -272,7 +271,6 @@ p_irq15: mov edi, 15 cmp [v86_irqhooks+edi*8], 0 jnz v86_irq2 -; mov byte [BOOT_VAR + 0x48E], 0xFF call [irq15_func] call ready_for_next_irq_1 restore_ring3_context @@ -281,11 +279,10 @@ p_irq15: ready_for_next_irq: mov eax,5 mov [check_idle_semaphore],eax -; mov al, 0x20 add eax,(0x20-0x5) - out 0x20, al ret + ;destroy eax ready_for_next_irq_1: mov eax,5 @@ -409,18 +406,14 @@ clear_application_table_status: ret -; * eax = 64 - номер функции -; * ebx = 1 - единственная подфункция -; * ecx = новый размер памяти -;Возвращаемое значение: -; * eax = 0 - успешно -; * eax = 1 - недостаточно памяти +; * eax = 64 - sysFn # +; * ebx = 1 - subFn +; * ecx = new memory size +;Returns: +; * eax = 0 - OK +; * eax = 1 - insufficient memory sys_resize_app_memory: - ; ebx = 1 - resize - ; ecx = new amount of memory - -; cmp eax,1 dec ebx jnz .no_application_mem_resize stdcall new_mem_resize, ecx @@ -429,15 +422,14 @@ sys_resize_app_memory: ret iglobal -; process_terminating db 'K : Process - terminating',13,10,0 -; process_terminated db 'K : Process - done',13,10,0 - msg_obj_destroy db 'K : destroy app object',13,10,0 + msg_obj_destroy db 'K : app object destroyed',13,10,0 endg +; terminate application ; param ; esi= slot -terminate: ; terminate application +terminate: .slot equ esp ;locals @@ -450,9 +442,6 @@ terminate: ; terminate application shl esi, 5 mov [CURRENT_TASK+esi+TASKDATA.state], 9 ret -@@: - ;mov esi,process_terminating - ;call sys_msg_board_str @@: cli cmp [application_table_status],0 @@ -674,11 +663,10 @@ term9: cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots je .check_next_window add edi, window_data -; \begin{diamond}[19.09.2006] + ; skip minimized windows test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED jnz .check_next_window -; \end{diamond} call waredraw .nothing_to_activate: popad @@ -691,11 +679,11 @@ term9: jnz @f call free_hd_channel and [hd1_status], 0 -@@: - cmp [cd_status], esi - jnz @f - call free_cd_channel - and [cd_status], 0 +;@@: +; cmp [cd_status], esi +; jnz @f +; call free_cd_channel +; and [cd_status], 0 @@: cmp [flp_status], esi jnz @f @@ -794,7 +782,6 @@ term9: add ecx, 0x100 jmp .xd0 .xd1: -; call systest sti ; .. and life goes on mov eax, [draw_limits.left] @@ -810,15 +797,13 @@ term9: mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse and [application_table_status],0 - ;mov esi,process_terminated - ;call sys_msg_board_str add esp, 4 ret restore .slot iglobal boot_sched_1 db 'Building gdt tss pointer',0 - boot_sched_2 db 'Building IDT table',0 +; boot_sched_2 db 'Building IDT table',0 endg @@ -826,9 +811,4 @@ build_scheduler: mov esi,boot_sched_1 call boot_log - ; call build_process_gdt_tss_pointer - - ; mov esi,boot_sched_2 - ; call boot_log - ret diff --git a/kernel/branches/Kolibri-A/trunk/core/syscall.inc b/kernel/branches/Kolibri-A/trunk/core/syscall.inc index a65f85bad2..6a6a136c3b 100644 --- a/kernel/branches/Kolibri-A/trunk/core/syscall.inc +++ b/kernel/branches/Kolibri-A/trunk/core/syscall.inc @@ -100,7 +100,7 @@ iglobal dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,. dd sys_settime ; 22-setting date,time,clock and alarm-clock dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent - dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist + dd undefined_syscall ; syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd undefined_syscall ; 25-reserved dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,. dd undefined_syscall ; 27-reserved @@ -155,9 +155,9 @@ iglobal align 4 servetable3: - dd FHT_4 ; 0 - dd FHT_4 ; 1 - dd paleholder ; 2 + dd paleholder ; 0 + dd paleholder ; 1 + dd paleholder ; 2 dd sys_end ; last endg diff --git a/kernel/branches/Kolibri-A/trunk/fs/fat32.inc b/kernel/branches/Kolibri-A/trunk/fs/fat32.inc index 67a9b8f34d..8b4ae503e3 100644 --- a/kernel/branches/Kolibri-A/trunk/fs/fat32.inc +++ b/kernel/branches/Kolibri-A/trunk/fs/fat32.inc @@ -128,6 +128,8 @@ reserve_hd1: uglobal hd_in_cache db ? +IDE_Channel_1 db 0 ; moved from fs/iso9660.inc +IDE_Channel_2 db 0 endg reserve_hd_channel: diff --git a/kernel/branches/Kolibri-A/trunk/fs/fs_lfn.inc b/kernel/branches/Kolibri-A/trunk/fs/fs_lfn.inc index 5650b8bff3..1391030f8a 100644 --- a/kernel/branches/Kolibri-A/trunk/fs/fs_lfn.inc +++ b/kernel/branches/Kolibri-A/trunk/fs/fs_lfn.inc @@ -1,4 +1,3 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; @@ -41,20 +40,6 @@ rootdirs: db 3,'hd3' dd fs_OnHd3 dd fs_NextHd3 -;********************************************** - db 3,'cd0' - dd fs_OnCd0 - dd fs_NextCd - db 3,'cd1' - dd fs_OnCd1 - dd fs_NextCd - db 3,'cd2' - dd fs_OnCd2 - dd fs_NextCd - db 3,'cd3' - dd fs_OnCd3 - dd fs_NextCd -;*********************************************** db 0 @@ -71,16 +56,6 @@ virtual_root_query: db 'hd2',0 dd fs_HasHd3 db 'hd3',0 -;********************************************** - dd fs_HasCd0 - db 'cd0',0 - dd fs_HasCd1 - db 'cd1',0 - dd fs_HasCd2 - db 'cd2',0 - dd fs_HasCd3 - db 'cd3',0 -;********************************************** dd 0 fs_additional_handlers: @@ -167,8 +142,8 @@ file_system_lfn: cmp dword [ebx], 1 jnz .access_denied xor eax, eax - mov ebp, [ebx+12] ;количество блоков для считывания - mov edx, [ebx+16] ;РєСѓРґР° записывать рузельтат + mov ebp, [ebx+12] ;количество блоков для считывания + mov edx, [ebx+16] ;куда записывать рузельтат ; add edx, std_application_base_address push dword [ebx+4] ; first block mov ebx, [ebx+8] ; flags @@ -571,88 +546,6 @@ fs_HdServices: dd fs_HdCreateFolder fs_NumHdServices = ($ - fs_HdServices)/4 -;******************************************************* -fs_OnCd0: - call reserve_cd - mov [ChannelNumber],1 - mov [DiskNumber],0 - push 6 - push 1 - jmp fs_OnCd -fs_OnCd1: - call reserve_cd - mov [ChannelNumber],1 - mov [DiskNumber],1 - push 4 - push 2 - jmp fs_OnCd -fs_OnCd2: - call reserve_cd - mov [ChannelNumber],2 - mov [DiskNumber],0 - push 2 - push 3 - jmp fs_OnCd -fs_OnCd3: - call reserve_cd - mov [ChannelNumber],2 - mov [DiskNumber],1 - push 0 - push 4 -fs_OnCd: - call reserve_cd_channel - pop eax - mov [cdpos], eax - pop eax - cmp ecx, 0x100 - jae .nf - push ecx ebx - mov cl,al - mov bl,[DRIVE_DATA+1] - shr bl,cl - test bl,2 - pop ebx ecx - - jnz @f -.nf: - call free_cd_channel - and [cd_status], 0 - mov dword [image_of_eax], 5 ; not found - ret -@@: - mov ecx, [ebx+12] - mov edx, [ebx+16] - ; add edx, std_application_base_address - mov eax, [ebx] - cmp eax,fs_NumCdServices - jae .not_impl - add ebx, 4 - call dword [fs_CdServices + eax*4] - call free_cd_channel - and [cd_status], 0 - mov [image_of_eax], eax - mov [image_of_ebx], ebx - ret -.not_impl: - call free_cd_channel - and [cd_status], 0 - mov dword [image_of_eax], 2 ; not implemented - ret - -fs_CdServices: - dd fs_CdRead - dd fs_CdReadFolder - dd fs_NotImplemented - dd fs_NotImplemented - dd fs_NotImplemented - dd fs_CdGetFileInfo - dd fs_NotImplemented - dd 0 - dd fs_NotImplemented - dd fs_NotImplemented -fs_NumCdServices = ($ - fs_CdServices)/4 - -;******************************************************* fs_HasRamdisk: mov al, 1 ; we always have ramdisk @@ -1141,3 +1034,65 @@ get_full_file_name: jz .ret.ok mov byte [edi-1], '/' jmp .set_copy_cont + +; =============== moved from fs/iso9660.inc + +char_todown: +; convert character to uppercase, using cp866 encoding +; in: al=symbol +; out: al=converted symbol + cmp al, 'A' + jb .ret + cmp al, 'Z' + jbe .az + cmp al, 'Ђ' + jb .ret + cmp al, 'ђ' + jb .rus1 + cmp al, 'џ' + ja .ret +; 0x90-0x9F -> 0xE0-0xEF + add al, 'а'-'ђ' +.ret: + ret +.rus1: +; 0x80-0x8F -> 0xA0-0xAF +.az: + add al, 0x20 + ret + +uni2ansi_char: +; convert UNICODE character in al to ANSI character in ax, using cp866 encoding +; in: ax=UNICODE character +; out: al=converted ANSI character + cmp ax, 0x80 + jb .ascii + cmp ax, 0x401 + jz .yo1 + cmp ax, 0x451 + jz .yo2 + cmp ax, 0x410 + jb .unk + cmp ax, 0x440 + jb .rus1 + cmp ax, 0x450 + jb .rus2 +.unk: + mov al, '_' + jmp .doit +.yo1: + mov al, 'р' + jmp .doit +.yo2: + mov al, 'с' + jmp .doit +.rus1: +; 0x410-0x43F -> 0x80-0xAF + add al, 0x70 + jmp .doit +.rus2: +; 0x440-0x44F -> 0xE0-0xEF + add al, 0xA0 +.ascii: +.doit: + ret diff --git a/kernel/branches/Kolibri-A/trunk/fs/iso9660.inc b/kernel/branches/Kolibri-A/trunk/fs/iso9660.inc deleted file mode 100644 index dad1361bf8..0000000000 --- a/kernel/branches/Kolibri-A/trunk/fs/iso9660.inc +++ /dev/null @@ -1,757 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -$Revision:1322 $ - - -uglobal -cd_current_pointer_of_input dd 0 -cd_current_pointer_of_input_2 dd 0 -cd_mem_location dd 0 -cd_counter_block dd 0 -IDE_Channel_1 db 0 -IDE_Channel_2 db 0 -endg - -reserve_cd: - - cli - cmp [cd_status],0 - je reserve_ok2 - - sti - call change_task - jmp reserve_cd - - reserve_ok2: - - push eax - mov eax,[CURRENT_TASK] - shl eax,5 - mov eax,[eax+CURRENT_TASK+TASKDATA.pid] - mov [cd_status],eax - pop eax - sti - ret - -reserve_cd_channel: - cmp [ChannelNumber],1 - jne .IDE_Channel_2 -.IDE_Channel_1: - cli - cmp [IDE_Channel_1],0 - je .reserve_ok_1 - sti - call change_task - jmp .IDE_Channel_1 -.IDE_Channel_2: - cli - cmp [IDE_Channel_2],0 - je .reserve_ok_2 - sti - call change_task - jmp .IDE_Channel_1 -.reserve_ok_1: - mov [IDE_Channel_1],1 - ret -.reserve_ok_2: - mov [IDE_Channel_2],1 - ret - -free_cd_channel: - cmp [ChannelNumber],1 - jne .IDE_Channel_2 -.IDE_Channel_1: - mov [IDE_Channel_1],0 - ret -.IDE_Channel_2: - mov [IDE_Channel_2],0 - ret - -uglobal -cd_status dd 0 -endg - -;---------------------------------------------------------------- -; -; fs_CdRead - LFN variant for reading CD disk -; -; esi points to filename /dir1/dir2/.../dirn/file,0 -; ebx pointer to 64-bit number = first wanted byte, 0+ -; may be ebx=0 - start from first byte -; ecx number of bytes to read, 0+ -; edx mem location to return data -; -; ret ebx = bytes read or 0xffffffff file not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -fs_CdRead: - push edi - cmp byte [esi], 0 - jnz @f -.noaccess: - pop edi -.noaccess_2: - or ebx, -1 - mov eax, ERROR_ACCESS_DENIED - ret - -.noaccess_3: - pop eax edx ecx edi - jmp .noaccess_2 - -@@: - call cd_find_lfn - jnc .found - pop edi - cmp [DevErrorCode],0 - jne .noaccess_2 - or ebx, -1 - mov eax, ERROR_FILE_NOT_FOUND - ret - -.found: - mov edi,[cd_current_pointer_of_input] - test byte [edi+25],10b ; do not allow read directories - jnz .noaccess - test ebx, ebx - jz .l1 - cmp dword [ebx+4], 0 - jz @f - xor ebx, ebx -.reteof: - mov eax, 6 ; end of file - pop edi - ret -@@: - mov ebx, [ebx] -.l1: - push ecx edx - push 0 - mov eax, [edi+10] ; реальный размер файловой секции - sub eax, ebx - jb .eof - cmp eax, ecx - jae @f - mov ecx, eax - mov byte [esp], 6 -@@: - mov eax,[edi+2] - mov [CDSectorAddress],eax -; now eax=cluster, ebx=position, ecx=count, edx=buffer for data -.new_sector: - test ecx, ecx - jz .done - sub ebx, 2048 - jae .next - add ebx, 2048 - jnz .incomplete_sector - cmp ecx, 2048 - jb .incomplete_sector -; we may read and memmove complete sector - mov [CDDataBuf_pointer],edx - call ReadCDWRetr ; читаем сектор файла - cmp [DevErrorCode],0 - jne .noaccess_3 - add edx, 2048 - sub ecx, 2048 -.next: - inc dword [CDSectorAddress] - jmp .new_sector -.incomplete_sector: -; we must read and memmove incomplete sector - mov [CDDataBuf_pointer],CDDataBuf - call ReadCDWRetr ; читаем сектор файла - cmp [DevErrorCode],0 - jne .noaccess_3 - push ecx - add ecx, ebx - cmp ecx, 2048 - jbe @f - mov ecx, 2048 -@@: - sub ecx, ebx - push edi esi ecx - mov edi,edx - lea esi, [CDDataBuf + ebx] - cld - rep movsb - pop ecx esi edi - add edx, ecx - sub [esp], ecx - pop ecx - xor ebx, ebx - jmp .next - -.done: - mov ebx, edx - pop eax edx ecx edi - sub ebx, edx - ret -.eof: - mov ebx, edx - pop eax edx ecx - sub ebx, edx - jmp .reteof - -;---------------------------------------------------------------- -; -; fs_CdReadFolder - LFN variant for reading CD disk folder -; -; esi points to filename /dir1/dir2/.../dirn/file,0 -; ebx pointer to structure 32-bit number = first wanted block, 0+ -; & flags (bitfields) -; flags: bit 0: 0=ANSI names, 1=UNICODE names -; ecx number of blocks to read, 0+ -; edx mem location to return data -; -; ret ebx = blocks read or 0xffffffff folder not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -fs_CdReadFolder: - push edi - call cd_find_lfn - jnc .found - pop edi - cmp [DevErrorCode], 0 - jne .noaccess_1 - or ebx, -1 - mov eax, ERROR_FILE_NOT_FOUND - ret -.found: - mov edi, [cd_current_pointer_of_input] - test byte [edi+25], 10b ; do not allow read directories - jnz .found_dir - pop edi -.noaccess_1: - or ebx, -1 - mov eax, ERROR_ACCESS_DENIED - ret -.found_dir: - mov eax, [edi+2] ; eax=cluster - mov [CDSectorAddress], eax - mov eax, [edi+10] ; размер директрории -.doit: -; init header - push eax ecx - mov edi, edx - mov ecx, 32/4 - xor eax, eax - rep stosd - pop ecx eax - mov byte [edx], 1 ; version - mov [cd_mem_location], edx - add [cd_mem_location], 32 -; начинаем переброску БДВК в УСВК -;.mainloop: - mov [cd_counter_block], dword 0 - dec dword [CDSectorAddress] - push ecx -.read_to_buffer: - inc dword [CDSectorAddress] - mov [CDDataBuf_pointer], CDDataBuf - call ReadCDWRetr ; читаем сектор директории - cmp [DevErrorCode], 0 - jne .noaccess_1 - call .get_names_from_buffer - sub eax,2048 -; директория закончилась? - ja .read_to_buffer - mov edi, [cd_counter_block] - mov [edx+8], edi - mov edi, [ebx] - sub [edx+4], edi - xor eax, eax - dec ecx - js @f - mov al, ERROR_END_OF_FILE -@@: - pop ecx edi - mov ebx, [edx+4] - ret - -.get_names_from_buffer: - mov [cd_current_pointer_of_input_2],CDDataBuf - push eax esi edi edx -.get_names_from_buffer_1: - call cd_get_name - jc .end_buffer - inc dword [cd_counter_block] - mov eax,[cd_counter_block] - cmp [ebx],eax - jae .get_names_from_buffer_1 - test ecx, ecx - jz .get_names_from_buffer_1 - mov edi,[cd_counter_block] - mov [edx+4],edi - dec ecx - mov esi,ebp - mov edi,[cd_mem_location] - add edi,40 - test dword [ebx+4], 1 ; 0=ANSI, 1=UNICODE - jnz .unicode -; jmp .unicode -.ansi: - cmp [cd_counter_block],2 - jbe .ansi_parent_directory - cld - lodsw - xchg ah,al - call uni2ansi_char - cld - stosb -; проверка конца файла - mov ax,[esi] - cmp ax,word 3B00h ; сепаратор конца файла ';' - je .cd_get_parameters_of_file_1 -; проверка для файлов не заканчивающихся сепаратором - movzx eax,byte [ebp-33] - add eax,ebp - sub eax,34 - cmp esi,eax - je .cd_get_parameters_of_file_1 -; проверка конца папки - movzx eax,byte [ebp-1] - add eax,ebp - cmp esi,eax - jb .ansi -.cd_get_parameters_of_file_1: - mov [edi],byte 0 - call cd_get_parameters_of_file - add [cd_mem_location],304 - jmp .get_names_from_buffer_1 - -.ansi_parent_directory: - cmp [cd_counter_block],2 - je @f - mov [edi],byte '.' - inc edi - jmp .cd_get_parameters_of_file_1 -@@: - mov [edi],word '..' - add edi,2 - jmp .cd_get_parameters_of_file_1 - -.unicode: - cmp [cd_counter_block],2 - jbe .unicode_parent_directory - cld - movsw -; проверка конца файла - mov ax,[esi] - cmp ax,word 3B00h ; сепаратор конца файла ';' - je .cd_get_parameters_of_file_2 -; проверка для файлов не заканчивающихся сепаратором - movzx eax,byte [ebp-33] - add eax,ebp - sub eax,34 - cmp esi,eax - je .cd_get_parameters_of_file_2 -; проверка конца папки - movzx eax,byte [ebp-1] - add eax,ebp - cmp esi,eax - jb .unicode -.cd_get_parameters_of_file_2: - mov [edi],word 0 - call cd_get_parameters_of_file - add [cd_mem_location],560 - jmp .get_names_from_buffer_1 - -.unicode_parent_directory: - cmp [cd_counter_block],2 - je @f - mov [edi],word 2E00h ; '.' - add edi,2 - jmp .cd_get_parameters_of_file_2 -@@: - mov [edi],dword 2E002E00h ; '..' - add edi,4 - jmp .cd_get_parameters_of_file_2 - -.end_buffer: - pop edx edi esi eax - ret - -cd_get_parameters_of_file: - mov edi,[cd_mem_location] -cd_get_parameters_of_file_1: -; получаем атрибуты файла - xor eax,eax -; файл не архивировался - inc eax - shl eax,1 -; это каталог? - test [ebp-8],byte 2 - jz .file - inc eax -.file: -; метка тома не как в FAT, в этом виде отсутсвует -; файл не является системным - shl eax,3 -; файл является скрытым? (атрибут существование) - test [ebp-8],byte 1 - jz .hidden - inc eax -.hidden: - shl eax,1 -; файл всегда только для чтения, так как это CD - inc eax - mov [edi],eax -; получаем время для файла -;час - movzx eax,byte [ebp-12] - shl eax,8 -;минута - mov al,[ebp-11] - shl eax,8 -;секунда - mov al,[ebp-10] -;время создания файла - mov [edi+8],eax -;время последнего доступа - mov [edi+16],eax -;время последней записи - mov [edi+24],eax -; получаем дату для файла -;год - movzx eax,byte [ebp-15] - add eax,1900 - shl eax,8 -;месяц - mov al,[ebp-14] - shl eax,8 -;день - mov al,[ebp-13] -;дата создания файла - mov [edi+12],eax -;время последнего доступа - mov [edi+20],eax -;время последней записи - mov [edi+28],eax -; получаем тип данных имени - xor eax,eax - test dword [ebx+4], 1 ; 0=ANSI, 1=UNICODE - jnz .unicode_1 - mov [edi+4],eax - jmp @f -.unicode_1: - inc eax - mov [edi+4],eax -@@: -; получаем размер файла в байтах - xor eax,eax - mov [edi+32+4],eax - mov eax,[ebp-23] - mov [edi+32],eax - ret - -;---------------------------------------------------------------- -; -; fs_CdGetFileInfo - LFN variant for CD -; get file/directory attributes structure -; -;---------------------------------------------------------------- -fs_CdGetFileInfo: - cmp byte [esi], 0 - jnz @f - mov eax, 2 - ret -@@: - push edi - call cd_find_lfn - pushfd - cmp [DevErrorCode], 0 - jz @f - popfd - pop edi - mov eax, 11 - ret -@@: - popfd - jnc @f - pop edi - mov eax, ERROR_FILE_NOT_FOUND - ret -@@: - - mov edi, edx - push ebp - mov ebp, [cd_current_pointer_of_input] - add ebp, 33 - call cd_get_parameters_of_file_1 - pop ebp - and dword [edi+4], 0 - pop edi - xor eax, eax - ret - -;---------------------------------------------------------------- -cd_find_lfn: - mov [cd_appl_data],0 -; in: esi+ebp -> name -; out: CF=1 - file not found -; else CF=0 and [cd_current_pointer_of_input] direntry - push eax esi -; 16 сектор начало набора дескрипторов томов - - call WaitUnitReady - cmp [DevErrorCode],0 - jne .access_denied - - call prevent_medium_removal -; тестовое чтение - mov [CDSectorAddress],dword 16 - mov [CDDataBuf_pointer],CDDataBuf - call ReadCDWRetr ;_1 - cmp [DevErrorCode],0 - jne .access_denied - -; вычисление последней сессии - call WaitUnitReady - cmp [DevErrorCode],0 - jne .access_denied - call Read_TOC - mov ah,[CDDataBuf+4+4] - mov al,[CDDataBuf+4+5] - shl eax,16 - mov ah,[CDDataBuf+4+6] - mov al,[CDDataBuf+4+7] - add eax,15 - mov [CDSectorAddress],eax -; mov [CDSectorAddress],dword 15 - mov [CDDataBuf_pointer],CDDataBuf - -.start: - inc dword [CDSectorAddress] - call ReadCDWRetr ;_1 - cmp [DevErrorCode],0 - jne .access_denied - -.start_check: -; проверка на вшивость - cmp [CDDataBuf+1],dword 'CD00' - jne .access_denied - cmp [CDDataBuf+5],byte '1' - jne .access_denied -; сектор является терминатором набор дескрипторов томов? - cmp [CDDataBuf],byte 0xff - je .access_denied -; сектор является дополнительным и улучшенным дескриптором тома? - cmp [CDDataBuf],byte 0x2 - jne .start -; сектор является дополнительным дескриптором тома? - cmp [CDDataBuf+6],byte 0x1 - jne .start - -; параметры root директрории - mov eax,[CDDataBuf+0x9c+2] ; начало root директрории - mov [CDSectorAddress],eax - mov eax,[CDDataBuf+0x9c+10] ; размер root директрории - cmp byte [esi], 0 - jnz @f - mov [cd_current_pointer_of_input],CDDataBuf+0x9c - jmp .done -@@: -; начинаем поиск -.mainloop: - dec dword [CDSectorAddress] -.read_to_buffer: - inc dword [CDSectorAddress] - mov [CDDataBuf_pointer],CDDataBuf - call ReadCDWRetr ; читаем сектор директории - cmp [DevErrorCode],0 - jne .access_denied - push ebp - call cd_find_name_in_buffer - pop ebp - jnc .found - sub eax,2048 -; директория закончилась? - cmp eax,0 - ja .read_to_buffer -; нет искомого элемента цепочки -.access_denied: - pop esi eax - mov [cd_appl_data],1 - stc - ret -; искомый элемент цепочки найден - .found: -; конец пути файла - cmp byte [esi-1], 0 - jz .done - .nested: - mov eax,[cd_current_pointer_of_input] - push dword [eax+2] - pop dword [CDSectorAddress] ; начало директории - mov eax,[eax+2+8] ; размер директории - jmp .mainloop -; указатель файла найден - .done: - test ebp, ebp - jz @f - mov esi, ebp - xor ebp, ebp - jmp .nested -@@: - pop esi eax - mov [cd_appl_data],1 - clc - ret - -cd_find_name_in_buffer: - mov [cd_current_pointer_of_input_2],CDDataBuf -.start: - call cd_get_name - jc .not_found - call cd_compare_name - jc .start -.found: - clc - ret -.not_found: - stc - ret - -cd_get_name: - push eax - mov ebp,[cd_current_pointer_of_input_2] - mov [cd_current_pointer_of_input],ebp - mov eax,[ebp] - test eax,eax ; входы закончились? - jz .next_sector - cmp ebp,CDDataBuf+2048 ; буфер закончился? - jae .next_sector - movzx eax, byte [ebp] - add [cd_current_pointer_of_input_2],eax ; следующий вход каталога - add ebp,33 ; указатель установлен на начало имени - pop eax - clc - ret -.next_sector: - pop eax - stc - ret - -cd_compare_name: -; compares ASCIIZ-names, case-insensitive (cp866 encoding) -; in: esi->name, ebp->name -; out: if names match: ZF=1 and esi->next component of name -; else: ZF=0, esi is not changed -; destroys eax - push esi eax edi - mov edi,ebp -.loop: - cld - lodsb - push eax - call char_todown - call ansi2uni_char - xchg ah,al - scasw - pop eax - je .coincides - call char_toupper - call ansi2uni_char - xchg ah,al - sub edi,2 - scasw - jne .name_not_coincide -.coincides: - cmp [esi],byte '/' ; разделитель пути, конец имени текущего элемента - je .done - cmp [esi],byte 0 ; разделитель пути, конец имени текущего элемента - je .done - jmp .loop -.name_not_coincide: - pop edi eax esi - stc - ret -.done: -; проверка конца файла - cmp [edi],word 3B00h ; сепаратор конца файла ';' - je .done_1 -; проверка для файлов не заканчивающихся сепаратором - movzx eax,byte [ebp-33] - add eax,ebp - sub eax,34 - cmp edi,eax - je .done_1 -; проверка конца папки - movzx eax,byte [ebp-1] - add eax,ebp - cmp edi,eax - jne .name_not_coincide -.done_1: - pop edi eax - add esp,4 - inc esi - clc - ret - -char_todown: -; convert character to uppercase, using cp866 encoding -; in: al=symbol -; out: al=converted symbol - cmp al, 'A' - jb .ret - cmp al, 'Z' - jbe .az - cmp al, 'Ђ' - jb .ret - cmp al, 'ђ' - jb .rus1 - cmp al, 'џ' - ja .ret -; 0x90-0x9F -> 0xE0-0xEF - add al, 'а'-'ђ' -.ret: - ret -.rus1: -; 0x80-0x8F -> 0xA0-0xAF -.az: - add al, 0x20 - ret - -uni2ansi_char: -; convert UNICODE character in al to ANSI character in ax, using cp866 encoding -; in: ax=UNICODE character -; out: al=converted ANSI character - cmp ax, 0x80 - jb .ascii - cmp ax, 0x401 - jz .yo1 - cmp ax, 0x451 - jz .yo2 - cmp ax, 0x410 - jb .unk - cmp ax, 0x440 - jb .rus1 - cmp ax, 0x450 - jb .rus2 -.unk: - mov al, '_' - jmp .doit -.yo1: - mov al, 'р' - jmp .doit -.yo2: - mov al, 'с' - jmp .doit -.rus1: -; 0x410-0x43F -> 0x80-0xAF - add al, 0x70 - jmp .doit -.rus2: -; 0x440-0x44F -> 0xE0-0xEF - add al, 0xA0 -.ascii: -.doit: - ret diff --git a/kernel/branches/Kolibri-A/trunk/kernel.asm b/kernel/branches/Kolibri-A/trunk/kernel.asm index c972f42d81..0681a3f61e 100644 --- a/kernel/branches/Kolibri-A/trunk/kernel.asm +++ b/kernel/branches/Kolibri-A/trunk/kernel.asm @@ -1026,7 +1026,7 @@ osloop: call stack_handler call checkidle call check_fdd_motor_status - call check_ATAPI_device_event +; call check_ATAPI_device_event jmp osloop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; @@ -4347,63 +4347,6 @@ syscall_getscreensize: ; GetScreenSize align 4 -syscall_cdaudio: ; CD - - cmp ebx, 4 - jb .audio - jz .eject - cmp ebx, 5 - jnz .ret -.load: - call .reserve - call LoadMedium - ;call .free - jmp .free -; ret -.eject: - call .reserve - call clear_CD_cache - call allow_medium_removal - call EjectMedium -; call .free - jmp .free -; ret -.audio: - call sys_cd_audio - mov [esp+36-4],eax -.ret: - ret - -.reserve: - call reserve_cd - mov eax, ecx - shr eax, 1 - and eax, 1 - inc eax - mov [ChannelNumber], ax - mov eax, ecx - and eax, 1 - mov [DiskNumber], al - call reserve_cd_channel - and ebx, 3 - inc ebx - mov [cdpos], ebx - add ebx, ebx - mov cl, 8 - sub cl, bl - mov al, [DRIVE_DATA+1] - shr al, cl - test al, 2 - jz .free;.err - ret -.free: - call free_cd_channel - and [cd_status], 0 - ret -.err: - call .free -; pop eax - ret align 4 @@ -4734,9 +4677,6 @@ system_shutdown: ; shut down the system ret @@: call stop_all_services - push 3 ; stop playing cd - pop eax - call sys_cd_audio yes_shutdown_param: cli diff --git a/kernel/branches/Kolibri-A/trunk/kernel32.inc b/kernel/branches/Kolibri-A/trunk/kernel32.inc index dbcdf360e6..1aae78cd1d 100644 --- a/kernel/branches/Kolibri-A/trunk/kernel32.inc +++ b/kernel/branches/Kolibri-A/trunk/kernel32.inc @@ -214,19 +214,19 @@ include "fs/ntfs.inc" ; read / write for ntfs filesystem include "fs/fat12.inc" ; read / write for fat12 filesystem include "blkdev/rd.inc" ; ramdisk read /write include "fs/fs_lfn.inc" ; syscall, version 2 -include "fs/iso9660.inc" ; read for iso9660 filesystem CD +;include "fs/iso9660.inc" ; read for iso9660 filesystem CD include "fs/ext2.inc" ; read / write for ext2 filesystem ; sound include "sound/playnote.inc" ; player Note for Speaker PC -include "sound/FHT.inc" ; fast Fourier transform routines +;include "sound/FHT.inc" ; fast Fourier transform routines ; display ;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/vga.inc" ; VGA 16 color functions include "video/cursors.inc" ; cursors functions ; Network Interface & TCPIP Stack @@ -262,8 +262,8 @@ include "blkdev/hd_drv.inc" ; CD drive controller -include "blkdev/cdrom.inc" -include "blkdev/cd_drv.inc" +;include "blkdev/cdrom.inc" +;include "blkdev/cd_drv.inc" ; Character devices diff --git a/kernel/branches/Kolibri-A/trunk/video/vesa12.inc b/kernel/branches/Kolibri-A/trunk/video/vesa12.inc deleted file mode 100644 index 6034790759..0000000000 --- a/kernel/branches/Kolibri-A/trunk/video/vesa12.inc +++ /dev/null @@ -1,1004 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;; VESA12.INC ;; -;; ;; -;; Vesa 1.2 functions for MenuetOS ;; -;; ;; -;; Copyright 2002 Ville Turjanmaa ;; -;; ;; -;; quickcode@mail.ru - bankswitch for S3 cards ;; -;; ;; -;; See file COPYING for details ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -$Revision$ - - -TRIDENT equ 0 -S3_VIDEO equ 0 -INTEL_VIDEO equ 0 - -if TRIDENT - if S3_VIDEO or INTEL_VIDEO - stop - end if -end if - -if S3_VIDEO - if TRIDENT or INTEL_VIDEO - stop - end if -end if - -if INTEL_VIDEO - if S3_VIDEO or TRIDENT - stop - end if -end if - - -; A complete video driver should include the following types of function -; -; Putpixel -; Getpixel -; -; Drawimage -; Drawbar -; -; Drawbackground -; -; -; Modifying the set_bank -function is mostly enough -; for different Vesa 1.2 setups. - -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -; set_bank for Trident videocards, work on Trident 9440 -; modified by Mario79 - -if TRIDENT -set_bank: - pushfd - cli - cmp al,[BANK_RW] - je .retsb - - mov [BANK_RW],al - push dx - mov dx,3D8h - out dx,al - pop dx -.retsb: - popfd - ret -end if - -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -; set_bank for S3 videocards, work on S3 ViRGE PCI (325) -; modified by kmeaw - -if S3_VIDEO -set_bank: - pushfd - cli - cmp al,[BANK_RW] - je .retsb - - mov [BANK_RW],al - push ax - push dx - push cx - mov cl, al - mov dx, 0x3D4 - mov al, 0x38 - out dx, al ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to - ;unlock and 00h to lock - inc dx - mov al, 0x48 - out dx, al ;3d5 -? - dec dx - mov al, 0x31 - out dx, al ;CR31 Memory Configuration Register -;0 Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear. -;4-5 Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h, -;for the 864/964 see index 69h. - - inc dx - in al, dx - dec dx - mov ah, al - mov al, 0x31 - out dx, ax - mov al, ah - or al, 9 - inc dx - out dx, al - dec dx - mov al, 0x35 - out dx, al ;CR35 CRT Register Lock - inc dx - in al, dx - dec dx - and al, 0xF0 - mov ch, cl - and ch, 0x0F - or ch, al - mov al, 0x35 - out dx, al - inc dx - mov al, ch - out dx, ax - dec dx - mov al, 0x51 ;Extended System Control 2 Register - out dx, al - inc dx - in al, dx - dec dx - and al, 0xF3 - shr cl, 2 - and cl, 0x0C - or cl, al - mov al, 0x51 - out dx, al - inc dx - mov al, cl - out dx, al - dec dx - mov al, 0x38 - out dx, al - inc dx - xor al, al - out dx, al - dec dx - pop cx - pop dx - pop ax -.retsb: - popfd - ret -end if - -;Set bank function for Intel 810/815 chipsets -; *****Modified by Protopopius, Russia.***** -; ********* http://menuetos.hut.ru ************** -; ************************************************ - -if INTEL_VIDEO - -set_bank: - pushfd - cli - - cmp al,[BANK_RW] - je .retsb - - mov [BANK_RW],al - push ax - push dx - mov dx,3CEh - mov ah,al ; Save value for later use - mov al,10h ; Index GR10 (Address Mapping) - out dx,al ; Select GR10 - inc dl - mov al,3 ; Set bits 0 and 1 (Enable linear page mapping) - out dx,al ; Write value - dec dl - mov al,11h ; Index GR11 (Page Selector) - out dx,al ; Select GR11 - inc dl - mov al,ah ; Write address - out dx,al ; Write the value - pop dx - pop ax -.retsb: - popfd - ret -end if - -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} - -if (TRIDENT or S3_VIDEO or INTEL_VIDEO) -else -set_bank: - pushfd - cli - - cmp al,[BANK_RW] - je .retsb - - mov [BANK_RW],al - push ax - push dx - mov ah,al - mov dx,0x03D4 - mov al,0x39 - out dx,al - inc dl - mov al,0xA5 - out dx,al - dec dl - mov al,6Ah - out dx,al - inc dl - mov al,ah - out dx,al - dec dl - mov al,0x39 - out dx,al - inc dl - mov al,0x5A - out dx,al - dec dl - pop dx - pop ax - -.retsb: - popfd - ret -end if - -vesa12_drawbackground: - - call [_display.disable_mouse] - - push eax - push ebx - push ecx - push edx - - xor edx,edx - mov eax,dword[BgrDataWidth] - mov ebx,dword[BgrDataHeight] - mul ebx - mov ebx,3 - mul ebx - mov [imax],eax - mov eax,[draw_data+32+RECT.left] - mov ebx,[draw_data+32+RECT.top] - xor edi,edi ;no force - - v12dp3: - - push eax - push ebx - - cmp [BgrDrawMode],dword 1 ; tiled background - jne no_vesa12_tiled_bgr - - push edx - - xor edx,edx - div dword [BgrDataWidth] - - push edx - mov eax,ebx - xor edx,edx - div dword [BgrDataHeight] - mov ebx,edx - pop eax - - pop edx - - no_vesa12_tiled_bgr: - - cmp [BgrDrawMode],dword 2 ; stretched background - jne no_vesa12_stretched_bgr - - push edx - - mul dword [BgrDataWidth] - mov ecx,[Screen_Max_X] - inc ecx - div ecx - - push eax - mov eax,ebx - mul dword [BgrDataHeight] - mov ecx,[Screen_Max_Y] - inc ecx - div ecx - mov ebx,eax - pop eax - - pop edx - - no_vesa12_stretched_bgr: - - - mov esi,ebx - imul esi, dword [BgrDataWidth] - add esi,eax - lea esi,[esi*3] - add esi,[img_background] ;IMG_BACKGROUND - pop ebx - pop eax - - v12di4: - - mov cl,[esi+2] - shl ecx,16 - mov cx,[esi] - pusha - mov esi,eax - mov edi,ebx - mov eax,[Screen_Max_X] - add eax,1 - mul ebx - add eax, [_WinMapAddress] - cmp [eax+esi],byte 1 - jnz v12nbgp - mov eax,[BytesPerScanLine] - mov ebx,edi - mul ebx - add eax, esi - lea eax, [VGABasePtr+eax+esi*2] - cmp [ScreenBPP],byte 24 - jz v12bgl3 - add eax,esi - - v12bgl3: - - push ebx - push eax - - sub eax,VGABasePtr - - shr eax,16 - call set_bank - pop eax - and eax,65535 - add eax,VGABasePtr - pop ebx - - mov [eax],cx - add eax,2 - shr ecx,16 - mov [eax],cl - sti - - v12nbgp: - - popa - add esi,3 - inc eax - cmp eax,[draw_data+32+RECT.right] - jg v12nodp31 - jmp v12dp3 - - v12nodp31: - - mov eax,[draw_data+32+RECT.left] - inc ebx - cmp ebx,[draw_data+32+RECT.bottom] - jg v12dp4 - jmp v12dp3 - - v12dp4: - - pop edx - pop ecx - pop ebx - pop eax - ret - - -vesa12_drawbar: - - call [_display.disable_mouse] - -;; mov [novesachecksum],dword 0 - sub edx,ebx - sub ecx,eax - push esi - push edi - push eax - push ebx - push ecx - push edx - mov ecx,[TASK_BASE] - add eax,[ecx-twdw+WDATA.box.left] - add ebx,[ecx-twdw+WDATA.box.top] - push eax - mov eax,ebx ; y - mov ebx,[BytesPerScanLine] - mul ebx - pop ecx - add eax,ecx ; x - add eax,ecx - add eax,ecx - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start - jz dbpi2412 - add eax,ecx - - dbpi2412: - - add eax,VGABasePtr - mov edi,eax - - ; x size - - mov eax,[esp+4] ; [esp+6] - mov ecx,eax - add ecx,eax - add ecx,eax - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz dbpi24312 - add ecx,eax - - dbpi24312: - - mov ebx,[esp+0] - - ; check limits ? - - push eax - push ecx - mov eax,[TASK_BASE] - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left] - cmp ecx,0 - jnz dbcblimitlset12 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top] - cmp ecx,0 - jnz dbcblimitlset12 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] - cmp ecx,[Screen_Max_X] - jnz dbcblimitlset12 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] - cmp ecx,[Screen_Max_Y] - jnz dbcblimitlset12 - pop ecx - pop eax - push dword 0 - jmp dbcblimitlno12 - - dbcblimitlset12: - - pop ecx - pop eax - push dword 1 - - dbcblimitlno12: - - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - jz dbpi24bit12 - jmp dbpi32bit12 - - -; DRAWBAR 24 BBP - - -dbpi24bit12: - - push eax - push ebx - push edx - mov eax,ecx - mov ebx,3 - div ebx - mov ecx,eax - pop edx - pop ebx - pop eax - cld - - dbnewpi12: - - push ebx - push edi - push ecx - - xor edx,edx - mov eax,edi - sub eax,VGABasePtr - mov ebx,3 - div ebx - add eax, [_WinMapAddress] - mov ebx,[CURRENT_TASK] - cld - - dbnp2412: - - mov dl,[eax] - push eax - push ecx - cmp dl,bl - jnz dbimp24no12 - cmp [esp+5*4],dword 0 - jz dbimp24yes12 -; call dbcplimit -; jnz dbimp24no12 - - dbimp24yes12: - - push edi - mov eax,edi - sub eax,VGABasePtr - shr eax,16 - call set_bank - and edi,0xffff - add edi,VGABasePtr - mov eax,[esp+8+3*4+16+4+4] - stosw - shr eax,16 - stosb - sti - pop edi - add edi,3 - pop ecx - pop eax - inc eax - loop dbnp2412 - jmp dbnp24d12 - - dbimp24no12: - - pop ecx - pop eax - cld - add edi,3 - inc eax - loop dbnp2412 - - dbnp24d12: - - mov eax,[esp+3*4+16+4] - test eax,0x80000000 - jz nodbgl2412 - cmp al,0 - jz nodbgl2412 - dec eax - mov [esp+3*4+16+4],eax - - nodbgl2412: - - pop ecx - pop edi - pop ebx - add edi,[BytesPerScanLine] - dec ebx - jz dbnonewpi12 - jmp dbnewpi12 - - dbnonewpi12: - - add esp,7*4 - - ret - - -; DRAWBAR 32 BBP - - - dbpi32bit12: - - cld - shr ecx,2 - - dbnewpi3212: - - push ebx - push edi - push ecx - - mov eax,edi - sub eax,VGABasePtr - shr eax,2 - add eax, [_WinMapAddress] - mov ebx,[CURRENT_TASK] - cld - - dbnp3212: - - mov dl,[eax] - push eax - push ecx - cmp dl,bl - jnz dbimp32no12 - cmp [esp+5*4],dword 0 - jz dbimp32yes12 -; call dbcplimit -; jnz dbimp32no12 - - dbimp32yes12: - - push edi - mov eax,edi - sub eax,VGABasePtr - shr eax,16 - call set_bank - and edi,0xffff - add edi,VGABasePtr - mov eax,[esp+8+3*4+16+4+4] - stosw - shr eax,16 - stosb - sti - pop edi - add edi,4 - inc ebp - pop ecx - pop eax - inc eax - loop dbnp3212 - jmp dbnp32d12 - - dbimp32no12: - - pop ecx - pop eax - inc eax - add edi,4 - inc ebp - loop dbnp3212 - - dbnp32d12: - - mov eax,[esp+12+16+4] - test eax,0x80000000 - jz nodbgl3212 - cmp al,0 - jz nodbgl3212 - dec eax - mov [esp+12+16+4],eax - - nodbgl3212: - - pop ecx - pop edi - pop ebx - add edi,[BytesPerScanLine] - dec ebx - jz nodbnewpi3212 - jmp dbnewpi3212 - - nodbnewpi3212: - - add esp,7*4 - ret - - -Vesa12_putpixel24: - - mov edi,eax ; x - mov eax,ebx ; y - lea edi,[edi+edi*2] - mov ebx,[BytesPerScanLine] - mul ebx - add edi,eax - mov eax,edi - shr eax,16 - call set_bank - and edi,65535 - add edi,VGABasePtr - mov eax,[esp+28] - stosw - shr eax,16 - mov [edi],al - sti - ret - - - -Vesa12_putpixel32: - - mov edi,eax ; x - mov eax,ebx ; y - shl edi,2 - mov ebx,[BytesPerScanLine] - mul ebx - add edi,eax - mov eax,edi - shr eax,16 - call set_bank - and edi,65535 - add edi,VGABasePtr - mov ecx,[esp+28] - mov [edi],ecx - sti - ret - - -Vesa12_getpixel24: - - mov edi,eax ; x - mov eax,ebx ; y - lea edi,[edi+edi*2] - mov ebx,[BytesPerScanLine] - mul ebx - add edi,eax - mov eax,edi - shr eax,16 - call set_bank - and edi,65535 - add edi,VGABasePtr - mov ecx,[edi] - and ecx,255*256*256+255*256+255 - sti - ret - - -Vesa12_getpixel32: - - mov edi,eax ; x - mov eax,ebx ; y - shl edi,2 - mov ebx,[BytesPerScanLine] - xor edx,edx - mul ebx - add edi,eax - mov eax,edi - shr eax,16 - call set_bank - and edi,65535 - add edi,VGABasePtr - mov ecx,[edi] - and ecx,255*256*256+255*256+255 - sti - - ret - - - -vesa12_putimage: -; ebx = pointer to image -; ecx = size [x|y] -; edx = coordinates [x|y] -; ebp = pointer to 'get' function -; esi = pointer to 'init' function -; edi = parameter for 'get' function - -; mov ebx,image -; mov ecx,320*65536+240 -; mov edx,20*65536+20 - - call [_display.disable_mouse] - - mov [novesachecksum],dword 0 - push esi - push edi - push eax - push ebx - push ecx - push edx - movzx eax,word [esp+2] - movzx ebx,word [esp+0] - mov ecx,[TASK_BASE] - add eax,[ecx-twdw+WDATA.box.left] - add ebx,[ecx-twdw+WDATA.box.top] - push eax - mov eax,ebx ; y - mul dword [BytesPerScanLine] - pop ecx - add eax,ecx ; x - add eax,ecx - add eax,ecx - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start - jz pi2412 - add eax,ecx - - pi2412: - - add eax,VGABasePtr - mov edi,eax - - ; x size - - movzx ecx,word [esp+6] - - mov esi,[esp+8] - movzx ebx,word [esp+4] - - ; check limits while draw ? - - push ecx - mov eax,[TASK_BASE] - cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 - jnz dbcblimitlset212 - cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 - jnz dbcblimitlset212 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] - cmp ecx,[Screen_Max_X] - jnz dbcblimitlset212 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] - cmp ecx,[Screen_Max_Y] - jnz dbcblimitlset212 - pop ecx - push 0 - jmp dbcblimitlno212 - - dbcblimitlset212: - - pop ecx - push 1 - - dbcblimitlno212: - - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - jnz pi32bit12 - - pi24bit12: - - newpi12: - - push edi - push ecx - push ebx - - mov edx,edi - sub edx,VGABasePtr - mov ebx,3 - div ebx - add edx, [_WinMapAddress] - mov ebx,[CURRENT_TASK] - mov bh,[esp+4*3] - - np2412: - - cmp bl,[edx] - jnz imp24no12 -; mov eax,[esi] - push dword [esp+4*3+20] - call ebp -; cmp bh,0 -; jz imp24yes12 -; call dbcplimit -; jnz imp24no12 - - imp24yes12: - - push edi - push eax - mov eax,edi - sub eax,VGABasePtr - shr eax,16 - call set_bank - pop eax - and edi,0xffff - add edi,VGABasePtr - mov [edi],ax - shr eax,16 - mov [edi+2],al - pop edi - - imp24no12: - - inc edx -; add esi,3 - add edi,3 - dec ecx - jnz np2412 - - np24d12: - - pop ebx - pop ecx - pop edi - - add edi,[BytesPerScanLine] - add esi,[esp+32] - cmp ebp,putimage_get1bpp - jz .correct - cmp ebp,putimage_get2bpp - jz .correct - cmp ebp,putimage_get4bpp - jnz @f -.correct: - mov eax,[esp+20] - mov byte[eax],80h -@@: - dec ebx - jnz newpi12 - - nonewpi12: - - pop eax edx ecx ebx eax edi esi - xor eax, eax - ret - - - pi32bit12: - - newpi3212: - - push edi - push ecx - push ebx - - mov edx,edi - sub edx,VGABasePtr - shr edx,2 - add edx, [_WinMapAddress] - mov ebx,[CURRENT_TASK] - mov bh,[esp+4*3] - - np3212: - - cmp bl,[edx] - jnz imp32no12 -; mov eax,[esi] - push dword [esp+4*3+20] - call ebp -; cmp bh,0 -; jz imp32yes12 -; call dbcplimit -; jnz imp32no12 - - imp32yes12: - - push edi - push eax - mov eax,edi - sub eax,VGABasePtr - shr eax,16 - call set_bank - pop eax - and edi,0xffff - mov [edi+VGABasePtr],eax - pop edi - - imp32no12: - - inc edx -; add esi,3 - add edi,4 - dec ecx - jnz np3212 - - np32d12: - - pop ebx - pop ecx - pop edi - - add edi,[BytesPerScanLine] - cmp ebp,putimage_get1bpp - jz .correct - cmp ebp,putimage_get2bpp - jz .correct - cmp ebp,putimage_get4bpp - jnz @f -.correct: - mov eax,[esp+20] - mov byte[eax],80h -@@: - dec ebx - jnz newpi3212 - - nonewpi3212: - - pop eax edx ecx ebx eax edi esi - xor eax, eax - ret - - -vesa12_read_screen_pixel: - - and eax,0x3FFFFF - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - jz v12rsp24 - mov edi,eax - shl edi,2 - mov eax,edi - shr eax,16 - call set_bank - and edi,65535 - add edi,VGABasePtr - mov eax,[edi] - and eax,0x00ffffff - ret - v12rsp24: - - imul eax,3 - mov edi,eax - shr eax,16 - call set_bank - and edi,65535 - add edi,VGABasePtr - mov eax,[edi] - and eax,0x00ffffff - ret - - diff --git a/kernel/branches/Kolibri-A/trunk/video/vesa20.inc b/kernel/branches/Kolibri-A/trunk/video/vesa20.inc index 7b035c8ffe..7e33feeaef 100644 --- a/kernel/branches/Kolibri-A/trunk/video/vesa20.inc +++ b/kernel/branches/Kolibri-A/trunk/video/vesa20.inc @@ -288,8 +288,8 @@ align 4 .finish: add esp, putimg.stack_data popad - call VGA__putimage - mov [EGA_counter],1 +; call VGA__putimage +; mov [EGA_counter],1 ret @@ -731,9 +731,6 @@ align 4 jnz .new_y add esp, drbar.stack_data popad - call VGA_draw_bar - xor eax, eax - mov [EGA_counter],1 ret align 4 @@ -820,8 +817,6 @@ dp4: cmp ebx, [draw_data+32+RECT.bottom] jbe dp2 popad - mov [EGA_counter], 1 - call VGA_drawbackground ret ; ---------- @@ -1002,8 +997,6 @@ sdp4: sdpdone: add esp, 44 popad - mov [EGA_counter],1 - call VGA_drawbackground ret uglobal diff --git a/kernel/branches/Kolibri-A/trunk/video/vga.inc b/kernel/branches/Kolibri-A/trunk/video/vga.inc deleted file mode 100644 index bd23d1a1c2..0000000000 --- a/kernel/branches/Kolibri-A/trunk/video/vga.inc +++ /dev/null @@ -1,450 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;; VGA.INC ;; -;; ;; -;; 640x480 mode 0x12 VGA functions for MenuetOS ;; -;; ;; -;; Paul Butcher, paul.butcher@asa.co.uk ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -$Revision$ - - -paletteVGA: - -;16 colour palette - mov dx,0x3c8 - mov al,0 - out dx,al - - mov ecx,16 - mov dx,0x3c9 - xor eax,eax - - palvganew: - - mov al,0 - test ah,4 - jz palvgalbl1 - add al,31 - test ah,8 - jz palvgalbl1 - add al,32 - palvgalbl1: - out dx,al ; red 0,31 or 63 - mov al,0 - test ah,2 - jz palvgalbl2 - add al,31 - test ah,8 - jz palvgalbl2 - add al,32 - palvgalbl2: - out dx,al ; blue 0,31 or 63 - mov al,0 - test ah,1 - jz palvgalbl3 - add al,31 - test ah,8 - jz palvgalbl3 - add al,32 - palvgalbl3: - out dx,al ; green 0,31 or 63 - add ah,1 - loop palvganew -; mov dx, 3ceh -; mov ax, 0005h -; out dx, ax - ret - -palette320x200: - - mov edx,0x3c8 - xor eax, eax - out dx,al - mov ecx,256 - mov edx,0x3c9 - xor eax,eax - - palnew: - mov al,0 - test ah,64 - jz pallbl1 - add al,21 - pallbl1: - test ah,128 - jz pallbl2 - add al,42 - pallbl2: - out dx,al - mov al,0 - test ah,8 - jz pallbl3 - add al,8 - pallbl3: - test ah,16 - jz pallbl4 - add al,15 - pallbl4: - test ah,32 - jz pallbl5 - add al,40 - pallbl5: - out dx,al - mov al,0 - test ah,1 - jz pallbl6 - add al,8 - pallbl6: - test ah,2 - jz pallbl7 - add al,15 - pallbl7: - test ah,4 - jz pallbl8 - add al,40 - pallbl8: - out dx,al - add ah,1 - loop palnew - - ret -align 4 -uglobal - novesachecksum dd 0x0 - EGA_counter db 0 - VGA_drawing_screen db 0 - VGA_8_pixels: - rb 16 - temp: - .cx dd 0 -endg -align 4 -checkVga_N13: - - cmp [SCR_MODE],dword 0x13 - jne @f - -; cnvl: - pushad - cmp [EGA_counter],1 - je novesal - mov ecx,[MOUSE_X] - cmp ecx,[novesachecksum] - jne novesal - popad - @@: - ret - - novesal: - mov [novesachecksum],ecx - mov ecx,0 - movzx eax,word [MOUSE_Y] - cmp eax,100 - jge m13l3 - mov eax,100 - m13l3: - cmp eax,480-100 - jbe m13l4 - mov eax,480-100 - m13l4: - sub eax,100 - imul eax,640*4 - add ecx,eax - movzx eax,word [MOUSE_X] - cmp eax,160 - jge m13l1 - mov eax,160 - m13l1: - cmp eax,640-160 - jbe m13l2 - mov eax,640-160 - m13l2: - sub eax,160 - shl eax,2 - add ecx,eax - mov esi,[LFBAddress] - add esi,ecx - mov edi,VGABasePtr - mov edx,200 - mov ecx,320 - cld - m13pix: - lodsd - test eax,eax - jz .save_pixel - push eax - mov ebx,eax - and eax,(128+64+32) ; blue - shr eax,5 - and ebx,(128+64+32)*256 ; green - shr ebx,8+2 - add eax,ebx - pop ebx - and ebx,(128+64)*256*256 ; red - shr ebx,8+8 - add eax,ebx - .save_pixel: - stosb - loop m13pix - mov ecx,320 - add esi,4*(640-320) - dec edx - jnz m13pix - mov [EGA_counter],0 - popad - ret - -VGA_drawbackground: -; draw all - cmp [SCR_MODE],dword 0x12 - jne .end - pushad - mov esi,[LFBAddress] - mov edi,VGABasePtr - mov ebx,640/32 ; 640*480/(8*4) - mov edx,480 - @@: - push ebx edx esi edi - shl edx,9 - lea edx,[edx+edx*4] - add esi,edx - shr edx,5 - add edi,edx - call VGA_draw_long_line - pop edi esi edx ebx - dec edx - jnz @r - call VGA_draw_long_line_1 - popad - .end: - ret - -VGA_draw_long_line: - mov dx,3ceh - mov ax,0ff08h - cli - out dx, ax - mov ax,0005h - out dx, ax - m12pix: - call VGA_draw_32_pixels - dec ebx - jnz m12pix - mov dx,3c4h - mov ax,0ff02h - out dx,ax - mov dx,3ceh - mov ax,0205h - out dx,ax - mov dx,3ceh - mov al,08h - out dx,al - sti - ret - -VGA_draw_32_pixels: - xor eax,eax - mov ebp,VGA_8_pixels - mov [ebp],eax - mov [ebp+4],eax - mov [ebp+8],eax - mov [ebp+12],eax - mov ch,4 - .main_loop: - mov cl,8 - .convert_pixels_to_VGA: - lodsd ; eax = 24bit colour - test eax,eax - jz .end - rol eax,8 - mov al,ch - ror eax,8 - mov ch,1 - dec cl - shl ch,cl - cmp al,85 - jbe .p13green - or [ebp],ch - cmp al,170 - jbe .p13green - or [ebp+12],ch - .p13green: - cmp ah,85 - jbe .p13red - or [ebp+4],ch - cmp ah,170 - jbe .p13red - or [ebp+12],ch - .p13red: - shr eax,8 - cmp ah,85 - jbe .p13cont - or [ebp+8],ch - cmp ah,170 - jbe .p13cont - or [ebp+12],ch - .p13cont: - ror eax,8 - mov ch,ah - inc cl - .end: - dec cl - jnz .convert_pixels_to_VGA - inc ebp - dec ch - jnz .main_loop - push esi - sub ebp,4 - mov esi,ebp - mov dx, 3c4h - mov ah, 1h - @@: - mov al, 02h - out dx,ax - xchg ax,bp - lodsd - mov [edi],eax - xchg ax,bp - shl ah, 1 - cmp ah, 10h - jnz @r - add edi,4 - pop esi - ret - -VGA_putpixel: - ; eax = x - ; ebx = y - mov ecx,eax - mov eax, [esp+32-8+4] ; color - shl ebx,9 - lea ebx,[ebx+ebx*4] ; умножение на 5 - lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) - mov edi,edx - add edi, [LFBAddress] ; + LFB address - mov [edi], eax ; write to LFB for Vesa2.0 - shr edx,5 ; change BytesPerPixel to 1/8 - mov edi,edx - add edi, VGABasePtr ; address of pixel in VGA area - and ecx,0x07 ; bit no. (modulo 8) - pushfd - ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) - xor edx,edx - test eax,eax - jz .p13cont - cmp al,85 - jbe .p13green - or dl,0x01 - cmp al,170 - jbe .p13green - or dl,0x08 -.p13green: - cmp ah,85 - jbe .p13red - or dl,0x02 - cmp ah,170 - jbe .p13red - or dl,0x08 -.p13red: - shr eax,8 - cmp ah,85 - jbe .p13cont - or dl,0x04 - cmp ah,170 - jbe .p13cont - or dl,0x08 -.p13cont: - ror edx,8 - inc cl - xor eax,eax - inc ah - shr ax,cl - mov dx,3cfh - cli - out dx,al - mov al,[edi] ; dummy read - rol edx,8 - mov [edi],dl - popfd -;.end: - ret - -VGA__putimage: -; ecx = size [x|y] -; edx = coordinates [x|y] - cmp [SCR_MODE],dword 0x12 - jne @f - pushad - rol edx,16 - movzx eax,dx - rol edx,16 - movzx ebx,dx - movzx edx,cx - rol ecx,16 - movzx ecx,cx - call VGA_draw_bar_1 - popad -@@: - ret - -VGA_draw_bar: -; eax cx -; ebx cy -; ecx xe -; edx ye - cmp [SCR_MODE],dword 0x12 - jne @f - pushad - sub ecx,eax - sub edx,ebx - and eax,0xffff - and ebx,0xffff - and ecx,0xffff - and edx,0xffff - call VGA_draw_bar_1 - popad -@@: - ret - -VGA_draw_bar_1: - mov [temp.cx],eax - mov eax, [TASK_BASE] - add ebx, [eax-twdw + 4] - mov eax, [eax-twdw + 0] - add eax, [temp.cx] - and eax,0xfff8 - shl ebx,9 - lea ebx,[ebx+ebx*4] ; умножение на 5 - lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32) - mov esi,ebx - add esi, [LFBAddress] ; + LFB address - shr ebx,5 ; change BytesPerPixel to 1/8 - mov edi,ebx - add edi, VGABasePtr ; address of pixel in VGA area - mov ebx,ecx - shr ebx,5 - inc ebx -.main_loop: - call VGA_draw_long_line_1 - dec edx - jnz .main_loop - call VGA_draw_long_line_1 - ret - -VGA_draw_long_line_1: - push ebx edx esi edi - shl edx,9 - lea edx,[edx+edx*4] - add esi,edx - shr edx,5 - add edi,edx - call VGA_draw_long_line - pop edi esi edx ebx - ret - -