CDROM is not supported any more...

git-svn-id: svn://kolibrios.org@1664 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Artem Jerdev (art_zh) 2010-10-17 18:19:57 +00:00
parent 29c78b8e54
commit c801706373
10 changed files with 103 additions and 2444 deletions

View File

@ -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

View File

@ -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,8 +155,8 @@ iglobal
align 4
servetable3:
dd FHT_4 ; 0
dd FHT_4 ; 1
dd paleholder ; 0
dd paleholder ; 1
dd paleholder ; 2
dd sys_end ; last

View File

@ -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:

View File

@ -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, '<27>'
jb .rus1
cmp al, 'Ÿ'
ja .ret
; 0x90-0x9F -> 0xE0-0xEF
add al, 'à'-'<27>'
.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

View File

@ -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, '<27>'
jb .rus1
cmp al, 'Ÿ'
ja .ret
; 0x90-0x9F -> 0xE0-0xEF
add al, 'à'-'<27>'
.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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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