forked from KolibriOS/kolibrios
The universal cache of IDE devices.
Step 2: 1) Realized cache ATAPI device (CD\DVD). 2) Lock\Unlock ATAPI device for working with cache. 3) Eject (F70/10) and Load (F70/11) tray of ATAPI device. 4) Application CD_tray for control of tray ATAPI device. git-svn-id: svn://kolibrios.org@585 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
dfac57a317
commit
93e2c279ba
@ -16,7 +16,6 @@ $Revision$
|
||||
; данных из сектора компакт-диска
|
||||
; Автор текста программы Кулаков Владимир Геннадьевич.
|
||||
|
||||
|
||||
; Максимальное количество повторений операции чтения
|
||||
MaxRetr equ 10
|
||||
; Предельное время ожидания готовности к приему команды
|
||||
@ -68,6 +67,70 @@ ReadCD:
|
||||
;* Многократное повторение чтения при сбоях *
|
||||
;********************************************
|
||||
ReadCDWRetr:
|
||||
;-----------------------------------------------------------
|
||||
; input : eax = block to read
|
||||
; ebx = destination
|
||||
;-----------------------------------------------------------
|
||||
pushad
|
||||
mov eax,[CDSectorAddress]
|
||||
mov ebx,[CDDataBuf_pointer]
|
||||
call cd_calculate_cache
|
||||
add esi,8
|
||||
mov edi,1
|
||||
.hdreadcache:
|
||||
; push esi
|
||||
; mov esi,[esi]
|
||||
; call test_mario79
|
||||
; mov esi,eax
|
||||
; call test_mario79
|
||||
; pop esi
|
||||
|
||||
; cmp dword [esi+4],0 ; empty
|
||||
; je .nohdcache
|
||||
cmp [esi],eax ; correct sector
|
||||
je .yeshdcache
|
||||
.nohdcache:
|
||||
add esi,8
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz .hdreadcache
|
||||
call find_empty_slot_CD_cache ; ret in edi
|
||||
|
||||
push edi
|
||||
push eax
|
||||
call cd_calculate_cache_2
|
||||
shl edi,11
|
||||
add edi,eax
|
||||
mov [CDDataBuf_pointer],edi
|
||||
pop eax
|
||||
pop edi
|
||||
|
||||
call ReadCDWRetr_1
|
||||
mov [CDDataBuf_pointer],ebx
|
||||
call cd_calculate_cache_1
|
||||
lea esi,[edi*8+esi]
|
||||
; push esi
|
||||
; call test_mario79
|
||||
; mov esi,eax
|
||||
; call test_mario79
|
||||
; pop esi
|
||||
mov [esi],eax ; sector number
|
||||
; mov dword [esi+4],1 ; hd read - mark as same as in hd
|
||||
.yeshdcache:
|
||||
mov esi,edi
|
||||
shl esi,11 ;9
|
||||
push eax
|
||||
call cd_calculate_cache_2
|
||||
add esi,eax
|
||||
pop eax
|
||||
mov edi,ebx ;[CDDataBuf_pointer]
|
||||
mov ecx,512 ;/4
|
||||
cld
|
||||
rep movsd ; move data
|
||||
popad
|
||||
ret
|
||||
|
||||
ReadCDWRetr_1:
|
||||
pushad
|
||||
|
||||
; Цикл, пока команда не выполнена успешно или не
|
||||
@ -517,6 +580,45 @@ WaitUnitReady:
|
||||
popa
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ÇÀÏÐÅÒÈÒÜ ÑÌÅÍÓ ÄÈÑÊÀ *
|
||||
;* Âõîäíûå ïàðàìåòðû ïåðåäàþòñÿ ÷åðåç ãëîáàëüíûå *
|
||||
;* ïåðìåííûå: *
|
||||
;* ChannelNumber - íîìåð êàíàëà; *
|
||||
;* DiskNumber - íîìåð äèñêà íà êàíàëå. *
|
||||
;*************************************************
|
||||
prevent_medium_removal:
|
||||
pusha
|
||||
; Î÷èñòèòü áóôåð ïàêåòíîé êîìàíäû
|
||||
call clear_packet_buffer
|
||||
; Çàäàòü êîä êîìàíäû
|
||||
mov [PacketCommand],byte 0x1E
|
||||
; Çàäàòü êîä çàïðåòà
|
||||
mov [PacketCommand+4],byte 11b
|
||||
; Ïîäàòü êîìàíäó
|
||||
call SendPacketNoDatCommand
|
||||
popa
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ÐÀÇÐÅØÈÒÜ ÑÌÅÍÓ ÄÈÑÊÀ *
|
||||
;* Âõîäíûå ïàðàìåòðû ïåðåäàþòñÿ ÷åðåç ãëîáàëüíûå *
|
||||
;* ïåðìåííûå: *
|
||||
;* ChannelNumber - íîìåð êàíàëà; *
|
||||
;* DiskNumber - íîìåð äèñêà íà êàíàëå. *
|
||||
;*************************************************
|
||||
allow_medium_removal:
|
||||
pusha
|
||||
; Î÷èñòèòü áóôåð ïàêåòíîé êîìàíäû
|
||||
call clear_packet_buffer
|
||||
; Çàäàòü êîä êîìàíäû
|
||||
mov [PacketCommand],byte 0x1E
|
||||
; Çàäàòü êîä çàïðåòà
|
||||
mov [PacketCommand+4],byte 00b
|
||||
; Ïîäàòü êîìàíäó
|
||||
call SendPacketNoDatCommand
|
||||
popa
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ЗАГРУЗИТЬ НОСИТЕЛЬ В ДИСКОВОД *
|
||||
@ -546,7 +648,7 @@ LoadMedium:
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале. *
|
||||
;*************************************************
|
||||
UnloadMedium:
|
||||
EjectMedium:
|
||||
pusha
|
||||
; Очистить буфер пакетной команды
|
||||
call clear_packet_buffer
|
||||
|
@ -21,27 +21,18 @@ write_cache:
|
||||
push eax ecx edx esi edi
|
||||
|
||||
; write difference ( 2 ) from cache to hd
|
||||
|
||||
; mov ecx,cache_max
|
||||
; mov esi,HD_CACHE+8
|
||||
call calculate_cache
|
||||
add esi,8
|
||||
|
||||
mov edi,1
|
||||
|
||||
write_cache_more:
|
||||
|
||||
write_cache_more:
|
||||
cmp dword [esi+4],2 ; if cache slot is not different
|
||||
jne .write_chain
|
||||
|
||||
mov dword [esi+4],1 ; same as in hd
|
||||
mov eax,[esi] ; eax = sector to write
|
||||
|
||||
cmp eax,[PARTITION_START]
|
||||
jb danger
|
||||
cmp eax,[PARTITION_END]
|
||||
ja danger
|
||||
|
||||
; DMA write is permitted only if [allow_dma_access]=1
|
||||
cmp [allow_dma_access], 2
|
||||
jae .nodma
|
||||
@ -78,10 +69,8 @@ write_cache:
|
||||
call cache_write_pio
|
||||
.write_chain:
|
||||
call flush_cache_chain
|
||||
|
||||
.continue:
|
||||
danger:
|
||||
|
||||
danger:
|
||||
add esi,8
|
||||
inc edi
|
||||
dec ecx
|
||||
@ -98,8 +87,7 @@ flush_cache_chain:
|
||||
mov [cache_chain_started], 0
|
||||
@@:
|
||||
ret
|
||||
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
find_empty_slot:
|
||||
;-----------------------------------------------------------
|
||||
@ -108,33 +96,15 @@ find_empty_slot:
|
||||
;-----------------------------------------------------------
|
||||
; push ecx esi
|
||||
|
||||
search_again:
|
||||
|
||||
; mov ecx,cache_max*10/100
|
||||
; mov edi,[cache_search_start]
|
||||
search_again:
|
||||
call calculate_cache_3
|
||||
; push eax edx
|
||||
; mov eax,ecx
|
||||
; mov ecx,10
|
||||
; xor edx,edx
|
||||
; div ecx
|
||||
; mov ecx,eax
|
||||
; pop edx eax
|
||||
shr ecx,3
|
||||
search_for_empty:
|
||||
|
||||
search_for_empty:
|
||||
inc edi
|
||||
; cmp edi,cache_max
|
||||
; push eax
|
||||
call calculate_cache_4
|
||||
; cmp edi,eax
|
||||
; pop eax
|
||||
jbe inside_cache
|
||||
mov edi,1
|
||||
|
||||
inside_cache:
|
||||
|
||||
; cmp dword [edi*8+HD_CACHE+4],2 ; get cache slot info
|
||||
inside_cache:
|
||||
push esi
|
||||
call calculate_cache_1
|
||||
cmp dword [edi*8+esi+4],2
|
||||
@ -142,34 +112,20 @@ find_empty_slot:
|
||||
jb found_slot ; it's empty or read
|
||||
dec ecx
|
||||
jnz search_for_empty
|
||||
|
||||
call write_cache ; no empty slots found, write all
|
||||
cmp [hd_error],0
|
||||
jne found_slot_access_denied
|
||||
|
||||
jmp search_again ; and start again
|
||||
|
||||
found_slot:
|
||||
|
||||
; mov [cache_search_start],edi
|
||||
found_slot:
|
||||
call calculate_cache_5
|
||||
found_slot_access_denied:
|
||||
found_slot_access_denied:
|
||||
ret
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
clear_hd_cache:
|
||||
; push eax ecx edi
|
||||
; mov edi, HD_CACHE
|
||||
; mov ecx,16384
|
||||
; xor eax,eax
|
||||
; cld
|
||||
; rep stosd ; clear hd cache with 0
|
||||
; mov [cache_search_start],eax
|
||||
mov [fat_in_cache],-1
|
||||
mov [fat_change],0
|
||||
; pop edi ecx eax
|
||||
ret
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
calculate_cache:
|
||||
@ -448,10 +404,352 @@ calculate_cache_5:
|
||||
.ide3_appl_data:
|
||||
mov [cache_ide3_appl_search_start],edi
|
||||
ret
|
||||
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
calculate_linear_to_real:
|
||||
shr eax, 12
|
||||
mov eax, [page_tabs+eax*4]
|
||||
and eax, 0xFFFFF000
|
||||
find_empty_slot_CD_cache:
|
||||
;-----------------------------------------------------------
|
||||
; find empty or read slot, flush cache if next 10% is used by write
|
||||
; output : edi = cache slot
|
||||
;-----------------------------------------------------------
|
||||
.search_again:
|
||||
call cd_calculate_cache_3
|
||||
.search_for_empty:
|
||||
inc edi
|
||||
call cd_calculate_cache_4
|
||||
jbe .inside_cache
|
||||
mov edi,1
|
||||
.inside_cache:
|
||||
call cd_calculate_cache_5
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
clear_CD_cache:
|
||||
pusha
|
||||
.ide0:
|
||||
xor eax,eax
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
mov [cache_ide0_search_start],eax
|
||||
mov ecx,[cache_ide0_system_sad_size]
|
||||
mov edi,[cache_ide0_pointer]
|
||||
call .clear
|
||||
mov [cache_ide0_appl_search_start],eax
|
||||
mov ecx,[cache_ide0_appl_sad_size]
|
||||
mov edi,[cache_ide0_data_pointer]
|
||||
jmp .continue
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
mov [cache_ide1_search_start],eax
|
||||
mov ecx,[cache_ide1_system_sad_size]
|
||||
mov edi,[cache_ide1_pointer]
|
||||
call .clear
|
||||
mov [cache_ide1_appl_search_start],eax
|
||||
mov ecx,[cache_ide1_appl_sad_size]
|
||||
mov edi,[cache_ide1_data_pointer]
|
||||
jmp .continue
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
mov [cache_ide2_search_start],eax
|
||||
mov ecx,[cache_ide2_system_sad_size]
|
||||
mov edi,[cache_ide2_pointer]
|
||||
call .clear
|
||||
mov [cache_ide2_appl_search_start],eax
|
||||
mov ecx,[cache_ide2_appl_sad_size]
|
||||
mov edi,[cache_ide2_data_pointer]
|
||||
jmp .continue
|
||||
.ide3:
|
||||
mov [cache_ide3_search_start],eax
|
||||
mov ecx,[cache_ide3_system_sad_size]
|
||||
mov edi,[cache_ide3_pointer]
|
||||
call .clear
|
||||
mov [cache_ide3_appl_search_start],eax
|
||||
mov ecx,[cache_ide3_appl_sad_size]
|
||||
mov edi,[cache_ide3_data_pointer]
|
||||
.continue:
|
||||
call .clear
|
||||
popa
|
||||
ret
|
||||
.clear:
|
||||
shl ecx,1
|
||||
cld
|
||||
rep stosd
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
cd_calculate_cache:
|
||||
; mov ecx,cache_max ; entries in cache
|
||||
; mov esi,HD_CACHE+8
|
||||
|
||||
; 1 - IDE0 ... 4 - IDE3
|
||||
.ide0:
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide0_appl_data
|
||||
mov ecx,[cache_ide0_system_sad_size]
|
||||
mov esi,[cache_ide0_pointer]
|
||||
ret
|
||||
.ide0_appl_data:
|
||||
mov ecx,[cache_ide0_appl_sad_size]
|
||||
mov esi,[cache_ide0_data_pointer]
|
||||
ret
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide1_appl_data
|
||||
mov ecx,[cache_ide1_system_sad_size]
|
||||
mov esi,[cache_ide1_pointer]
|
||||
ret
|
||||
.ide1_appl_data:
|
||||
mov ecx,[cache_ide1_appl_sad_size]
|
||||
mov esi,[cache_ide1_data_pointer]
|
||||
ret
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide2_appl_data
|
||||
mov ecx,[cache_ide2_system_sad_size]
|
||||
mov esi,[cache_ide2_pointer]
|
||||
ret
|
||||
.ide2_appl_data:
|
||||
mov ecx,[cache_ide2_appl_sad_size]
|
||||
mov esi,[cache_ide2_data_pointer]
|
||||
ret
|
||||
.ide3:
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide3_appl_data
|
||||
mov ecx,[cache_ide3_system_sad_size]
|
||||
mov esi,[cache_ide3_pointer]
|
||||
ret
|
||||
.ide3_appl_data:
|
||||
mov ecx,[cache_ide3_appl_sad_size]
|
||||
mov esi,[cache_ide3_data_pointer]
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
cd_calculate_cache_1:
|
||||
; lea esi,[edi*8+HD_CACHE]
|
||||
; 1 - IDE0 ... 4 - IDE3
|
||||
.ide0:
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide0_appl_data
|
||||
mov esi,[cache_ide0_pointer]
|
||||
ret
|
||||
.ide0_appl_data:
|
||||
mov esi,[cache_ide0_data_pointer]
|
||||
ret
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide1_appl_data
|
||||
mov esi,[cache_ide1_pointer]
|
||||
ret
|
||||
.ide1_appl_data:
|
||||
mov esi,[cache_ide1_data_pointer]
|
||||
ret
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide2_appl_data
|
||||
mov esi,[cache_ide2_pointer]
|
||||
ret
|
||||
.ide2_appl_data:
|
||||
mov esi,[cache_ide2_data_pointer]
|
||||
ret
|
||||
.ide3:
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide3_appl_data
|
||||
mov esi,[cache_ide3_pointer]
|
||||
ret
|
||||
.ide3_appl_data:
|
||||
mov esi,[cache_ide3_data_pointer]
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
cd_calculate_cache_2:
|
||||
; add esi,HD_CACHE+65536
|
||||
; 1 - IDE0 ... 4 - IDE3
|
||||
.ide0:
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide0_appl_data
|
||||
mov eax,[cache_ide0_system_data]
|
||||
ret
|
||||
.ide0_appl_data:
|
||||
mov eax,[cache_ide0_appl_data]
|
||||
ret
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide1_appl_data
|
||||
mov eax,[cache_ide1_system_data]
|
||||
ret
|
||||
.ide1_appl_data:
|
||||
mov eax,[cache_ide1_appl_data]
|
||||
ret
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide2_appl_data
|
||||
mov eax,[cache_ide2_system_data]
|
||||
ret
|
||||
.ide2_appl_data:
|
||||
mov eax,[cache_ide2_appl_data]
|
||||
ret
|
||||
.ide3:
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide3_appl_data
|
||||
mov eax,[cache_ide3_system_data]
|
||||
ret
|
||||
.ide3_appl_data:
|
||||
mov eax,[cache_ide3_appl_data]
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
cd_calculate_cache_3:
|
||||
; mov ecx,cache_max*10/100
|
||||
; mov edi,[cache_search_start]
|
||||
|
||||
; 1 - IDE0 ... 4 - IDE3
|
||||
.ide0:
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide0_appl_data
|
||||
mov edi,[cache_ide0_search_start]
|
||||
ret
|
||||
.ide0_appl_data:
|
||||
mov edi,[cache_ide0_appl_search_start]
|
||||
ret
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide1_appl_data
|
||||
mov edi,[cache_ide1_search_start]
|
||||
ret
|
||||
.ide1_appl_data:
|
||||
mov edi,[cache_ide1_appl_search_start]
|
||||
ret
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide2_appl_data
|
||||
mov edi,[cache_ide2_search_start]
|
||||
ret
|
||||
.ide2_appl_data:
|
||||
mov edi,[cache_ide2_appl_search_start]
|
||||
ret
|
||||
.ide3:
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide3_appl_data
|
||||
mov edi,[cache_ide3_search_start]
|
||||
ret
|
||||
.ide3_appl_data:
|
||||
mov edi,[cache_ide3_appl_search_start]
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
cd_calculate_cache_4:
|
||||
; cmp edi,cache_max
|
||||
; 1 - IDE0 ... 4 - IDE3
|
||||
.ide0:
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide0_appl_data
|
||||
cmp edi,[cache_ide0_system_sad_size]
|
||||
ret
|
||||
.ide0_appl_data:
|
||||
cmp edi,[cache_ide0_appl_sad_size]
|
||||
ret
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide1_appl_data
|
||||
cmp edi,[cache_ide1_system_sad_size]
|
||||
ret
|
||||
.ide1_appl_data:
|
||||
cmp edi,[cache_ide1_appl_sad_size]
|
||||
ret
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide2_appl_data
|
||||
cmp edi,[cache_ide2_system_sad_size]
|
||||
ret
|
||||
.ide2_appl_data:
|
||||
cmp edi,[cache_ide2_appl_sad_size]
|
||||
ret
|
||||
.ide3:
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide3_appl_data
|
||||
cmp edi,[cache_ide3_system_sad_size]
|
||||
ret
|
||||
.ide3_appl_data:
|
||||
cmp edi,[cache_ide3_appl_sad_size]
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
align 4
|
||||
cd_calculate_cache_5:
|
||||
; mov [cache_search_start],edi
|
||||
; 1 - IDE0 ... 4 - IDE3
|
||||
.ide0:
|
||||
cmp [cdpos],1
|
||||
jne .ide1
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide0_appl_data
|
||||
mov [cache_ide0_search_start],edi
|
||||
ret
|
||||
.ide0_appl_data:
|
||||
mov [cache_ide0_appl_search_start],edi
|
||||
ret
|
||||
.ide1:
|
||||
cmp [cdpos],2
|
||||
jne .ide2
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide1_appl_data
|
||||
mov [cache_ide1_search_start],edi
|
||||
ret
|
||||
.ide1_appl_data:
|
||||
mov [cache_ide1_appl_search_start],edi
|
||||
ret
|
||||
.ide2:
|
||||
cmp [cdpos],3
|
||||
jne .ide3
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide2_appl_data
|
||||
mov [cache_ide2_search_start],edi
|
||||
ret
|
||||
.ide2_appl_data:
|
||||
mov [cache_ide2_appl_search_start],edi
|
||||
ret
|
||||
.ide3:
|
||||
cmp [cd_appl_data],0
|
||||
jne .ide3_appl_data
|
||||
mov [cache_ide3_search_start],edi
|
||||
ret
|
||||
.ide3_appl_data:
|
||||
mov [cache_ide3_appl_search_start],edi
|
||||
ret
|
||||
;--------------------------------------------------------------------
|
||||
;align 4
|
||||
;calculate_linear_to_real:
|
||||
; shr eax, 12
|
||||
; mov eax, [page_tabs+eax*4]
|
||||
; and eax, 0xFFFFF000
|
||||
; ret
|
||||
|
@ -306,6 +306,7 @@ hdbase rd 1 ; for boot 0x1f0
|
||||
hdid rd 1
|
||||
hdpos rd 1 ; for boot 0x1
|
||||
fat32part rd 1 ; for boot 0x1
|
||||
cdpos rd 1
|
||||
|
||||
sb16 rd 1
|
||||
|
||||
@ -387,6 +388,7 @@ cache_ide3_appl_search_start rd 1
|
||||
|
||||
debug_step_pointer rd 1
|
||||
hdd_appl_data rb 1 ; 0 = system cache, 1 - application cache
|
||||
cd_appl_data rb 1 ; 0 = system cache, 1 - application cache
|
||||
|
||||
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled
|
||||
pci_access_enabled rd 1 ; 0 = disabled , 1 = enabled
|
||||
|
@ -44,6 +44,7 @@
|
||||
mov [cache_ide3_search_start],eax
|
||||
mov [cache_ide3_appl_search_start],eax
|
||||
mov [hdd_appl_data],1 ;al
|
||||
mov [cd_appl_data],1
|
||||
|
||||
mov cl,[DRIVE_DATA+1]
|
||||
mov ch,cl
|
||||
|
@ -4114,6 +4114,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
„«ο CD-―ΰ¨Ά®¤®Ά Ά αΆο§¨ α ―― ΰ β묨 ®£ΰ ¨η¥¨ο¬¨ ¤®αβγ―λ
|
||||
β®«μ<EFBFBD>® ―®¤δγ<CEB3>樨 0,1,5 ¨ 7, Άλ§®Ά ¤ΰγ£¨ε ―®¤δγ<CEB3>権 § Ά¥ΰθ¨βαο
|
||||
®θ¨΅<EFBFBD>®© α <20>®¤®¬ 2.
|
||||
<EFBFBD>ਠ¯¥à¢®¬ ®¡à 饨¨ ¯®¤äãªæ¨© 0,1,5,7 ª ãáâனá⢠¬ ATAPI (CD ¨ DVD)
|
||||
¯à®¨§¢®¤¨âáï ¡«®ª¨à®¢ª àã箣® ã¯à ¢«¥¨ï ¬¥å ¨§¬®¬ «®âª . <20>â® á¢ï§ ®
|
||||
á «£®à¨â¬®¬ ªíè¨à®¢ ¨ï ¤ ëå ¯®«ãç¥ëå ®â ¯à¨¢®¤ . <20> §¡«®ª¨à®¢ª
|
||||
¯à®¨§¢®¤¨âáï ®¡à 饨¥¬ ¯®¤äãªæ¨¥© 10 ª ᮮ⢥âáâ¢ãî饬ã ãáâனáâ¢ã.
|
||||
|
||||
======================================================================
|
||||
= ”γ<CEB3>ζ¨ο 70, ―®¤δγ<CEB3>ζ¨ο 0 - η⥨¥ δ ©« α ―®¤¤¥ΰ¦<CEB0>®© ¤«¨λε ¨¬ρ. =
|
||||
@ -4473,6 +4477,66 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* <20>®¤¨β¥«μα<CEBC> ο ― ―<C2A0> ¤®«¦ 㦥 αγι¥αβΆ®Ά βμ.
|
||||
* …᫨ ― ―<C2A0> 㦥 αγι¥αβΆγ¥β, δγ<CEB3>ζ¨ο § Ά¥ΰθ¨βαο γα―¥θ® (eax=0).
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 70, ¯®¤äãªæ¨ï 10 - ¨§¢«¥çì «®â®ª ¯à¨¢®¤ ¤¨áª . ============
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 70 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 10 = ®¬¥à ¯®¤äãªæ¨¨
|
||||
* +4: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +8: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +12 = +0xC: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +16 = +0x10: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ¯ ¯ª¨, ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
¨«¨
|
||||
* +20 = +0x14: db 0
|
||||
* +21 = +0x15: dd 㪠§ ⥫ì ASCIIZ-áâபã á ¨¬¥¥¬ ¯ ¯ª¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* <20>¨ç¥£® ¥ ¢®§¢à é ¥âáï.
|
||||
‡ ¬¥ç ¨ï:
|
||||
* ”ãªæ¨ï ¯®¤¤¥à¦¨¢ ¥âáï ⮫쪮 ¤«ï ATAPI ãáâனá⢠(CD ¨ DVD).
|
||||
* <20>ਠ¨§¢«¥ç¥¨¨ «®âª ¯à®¨§¢®¤¨âáï à §¡«®ª¨à®¢ª àã箣® ã¯à ¢«¥¨ï ¬¥å ¨§¬®¬ «®âª .
|
||||
* <20>ਠ¨§¢«¥ç¥¨¨ «®âª ª®¤ ¯à®¨§¢®¤¨â ®ç¨áâªã ªíè ᮮ⢥âáâ¢ãî饣® ãáâனá⢠.
|
||||
* <20>ãâì ¢¢®¤¨âáï ¢ áâ ¤ à⮬ ¤«ï 70 äãªæ¨¨ ¢¨¤¥. „«ï à ¡®â®á¯®á®¡®á⨠¬®¦®
|
||||
®£à ¨ç¨âìáï ¯ãâﬨ ¢¨¤ :
|
||||
db '/cd0/1/',0
|
||||
db '/cd1/1/',0
|
||||
db '/cd2/1/',0
|
||||
db '/cd3/1/',0
|
||||
* <20>ਬ¥à®¬ ¨á¯®«ì§®¢ ¨ï äãªæ¨¨ ï¥âáï ¯à¨«®¦¥¨¥ CD_tray.
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 70, ¯®¤äãªæ¨ï 11 - § £à㧨âì «®â®ª ¯à¨¢®¤ ¤¨áª . ===========
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 70 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 11 = ®¬¥à ¯®¤äãªæ¨¨
|
||||
* +4: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +8: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +12 = +0xC: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +16 = +0x10: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ¯ ¯ª¨, ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
¨«¨
|
||||
* +20 = +0x14: db 0
|
||||
* +21 = +0x15: dd 㪠§ ⥫ì ASCIIZ-áâபã á ¨¬¥¥¬ ¯ ¯ª¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* <20>¨ç¥£® ¥ ¢®§¢à é ¥âáï.
|
||||
‡ ¬¥ç ¨ï:
|
||||
* ”ãªæ¨ï ¯®¤¤¥à¦¨¢ ¥âáï ⮫쪮 ¤«ï ATAPI ãáâனá⢠(CD ¨ DVD)
|
||||
* <20>ãâì ¢¢®¤¨âáï ¢ áâ ¤ à⮬ ¤«ï 70 äãªæ¨¨ ¢¨¤¥. „«ï à ¡®â®á¯®á®¡®á⨠¬®¦®
|
||||
®£à ¨ç¨âìáï ¯ãâﬨ ¢¨¤ :
|
||||
db '/cd0/1/',0
|
||||
db '/cd1/1/',0
|
||||
db '/cd2/1/',0
|
||||
db '/cd3/1/',0
|
||||
* <20>ਬ¥à®¬ ¨á¯®«ì§®¢ ¨ï äãªæ¨¨ ï¥âáï ¯à¨«®¦¥¨¥ CD_tray.
|
||||
|
||||
======================================================================
|
||||
=== ”γ<CEB3>ζ¨ο 71, ―®¤δγ<CEB3>ζ¨ο 1 - γαβ ®Ά¨βμ § £®«®Ά®<CE86> ®<> ―ΰ®£ΰ ¬¬λ. ==
|
||||
======================================================================
|
||||
|
@ -4075,6 +4075,10 @@ Available subfunctions:
|
||||
For CD-drives due to hardware limitations only subfunctions
|
||||
0,1,5 and 7 are available, other subfunctions return error
|
||||
with code 2.
|
||||
At the first call subfunctions 0,1,5,7 to devices ATAPI (CD and DVD) the locking
|
||||
of handle mechanism of a tray is made. It is connected to algorithm of caching
|
||||
given obtained from a drive. Deblocking is made by call subfunction 10
|
||||
to the appropriate device.
|
||||
|
||||
======================================================================
|
||||
=== Function 70, subfunction 0 - read file with long names support. ==
|
||||
@ -4429,6 +4433,64 @@ Remarks:
|
||||
* The parent folder must already exist.
|
||||
* If target folder already exists, function returns success (eax=0).
|
||||
|
||||
======================================================================
|
||||
================ Function 70, subfunction 10 - eject tray of disk drive. ==============
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 70 - function number
|
||||
* ebx = pointer to the information structure
|
||||
Format of the information structure:
|
||||
* +0: dword: 10 = subfunction number
|
||||
* +4: dword: 0 (reserved)
|
||||
* +8: dword: 0 (reserved)
|
||||
* +12 = +0xC: dword: 0 (reserved)
|
||||
* +16 = +0x10: dword: 0 (reserved)
|
||||
* +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
|
||||
given in the general description
|
||||
or
|
||||
* +20 = +0x14: db 0
|
||||
* +21 = +0x15: dd pointer to ASCIIZ-string with folder name
|
||||
Returned value:
|
||||
* Nothing comes back.
|
||||
Remarks:
|
||||
* The function is supported only for ATAPI devices (CD and DVD).
|
||||
* At extract of a tray is made deblocking of handle mechanism of a tray.
|
||||
* At extract of a tray the code makes clearing the cache of the appropriate device.
|
||||
* The path is standard for 70 functions. For serviceability it is possible to be limited to paths:
|
||||
db '/cd0/1/',0
|
||||
db '/cd1/1/',0
|
||||
db '/cd2/1/',0
|
||||
db '/cd3/1/',0
|
||||
* An example of usage of the function is the application CD_tray.
|
||||
|
||||
======================================================================
|
||||
============== Function 70, subfunction 11 - load tray of disk drive. =================
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 70 - function number
|
||||
* ebx = pointer to the information structure
|
||||
Format of the information structure:
|
||||
* +0: dword: 11 = subfunction number
|
||||
* +4: dword: 0 (reserved)
|
||||
* +8: dword: 0 (reserved)
|
||||
* +12 = +0xC: dword: 0 (reserved)
|
||||
* +16 = +0x10: dword: 0 (reserved)
|
||||
* +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
|
||||
given in the general description
|
||||
or
|
||||
* +20 = +0x14: db 0
|
||||
* +21 = +0x15: dd pointer to ASCIIZ-string with folder name
|
||||
Returned value:
|
||||
* Nothing comes back.
|
||||
Remarks:
|
||||
* The function is supported only for ATAPI devices (CD and DVD).
|
||||
* The path is standard for 70 functions. For serviceability it is possible to be limited to paths:
|
||||
db '/cd0/1/',0
|
||||
db '/cd1/1/',0
|
||||
db '/cd2/1/',0
|
||||
db '/cd3/1/',0
|
||||
* An example of usage of the function is the application CD_tray.
|
||||
|
||||
======================================================================
|
||||
========== Function 71, subfunction 1 - set window caption. ==========
|
||||
======================================================================
|
||||
|
@ -388,6 +388,8 @@ fs_RamdiskServices:
|
||||
dd 0
|
||||
dd fs_RamdiskDelete
|
||||
dd fs_RamdiskCreateFolder
|
||||
dd fs_NotImplemented
|
||||
dd fs_NotImplemented
|
||||
fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4
|
||||
|
||||
fs_OnFloppy:
|
||||
@ -419,6 +421,8 @@ fs_FloppyServices:
|
||||
dd 0
|
||||
dd fs_FloppyDelete
|
||||
dd fs_FloppyCreateFolder
|
||||
dd fs_NotImplemented
|
||||
dd fs_NotImplemented
|
||||
fs_NumFloppyServices = ($ - fs_FloppyServices)/4
|
||||
|
||||
fs_OnHd0:
|
||||
@ -492,6 +496,8 @@ fs_HdServices:
|
||||
dd 0
|
||||
dd fs_HdDelete
|
||||
dd fs_HdCreateFolder
|
||||
dd fs_NotImplemented
|
||||
dd fs_NotImplemented
|
||||
fs_NumHdServices = ($ - fs_HdServices)/4
|
||||
|
||||
;*******************************************************
|
||||
@ -500,28 +506,33 @@ fs_OnCd0:
|
||||
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 [hdpos], eax
|
||||
mov [cdpos], eax
|
||||
pop eax
|
||||
cmp ecx, 0x100
|
||||
jae .nf
|
||||
push ecx ebx
|
||||
@ -566,6 +577,10 @@ fs_CdServices:
|
||||
dd fs_CdGetFileInfo
|
||||
dd fs_NotImplemented
|
||||
dd 0
|
||||
dd fs_NotImplemented
|
||||
dd fs_NotImplemented
|
||||
dd fs_EjectDeviceTray
|
||||
dd fs_LoadDeviceTray
|
||||
fs_NumCdServices = ($ - fs_CdServices)/4
|
||||
|
||||
;*******************************************************
|
||||
|
@ -489,18 +489,31 @@ fs_CdGetFileInfo:
|
||||
pop edi
|
||||
xor eax, eax
|
||||
ret
|
||||
;----------------------------------------------------------------
|
||||
fs_EjectDeviceTray:
|
||||
call clear_CD_cache
|
||||
call allow_medium_removal
|
||||
call EjectMedium
|
||||
ret
|
||||
;----------------------------------------------------------------
|
||||
fs_LoadDeviceTray:
|
||||
call LoadMedium
|
||||
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 ñåêòîð íà÷àëî íàáîðà äåñêðèïòîðîâ òîìîâ
|
||||
mov [CDSectorAddress],dword 15
|
||||
mov [CDDataBuf_pointer],CDDataBuf
|
||||
call prevent_medium_removal
|
||||
.start:
|
||||
inc dword [CDSectorAddress]
|
||||
mov [CDDataBuf_pointer],CDDataBuf
|
||||
call ReadCDWRetr
|
||||
call ReadCDWRetr ;_1
|
||||
cmp [DevErrorCode],0
|
||||
jne .access_denied
|
||||
; ïðîâåðêà íà âøèâîñòü
|
||||
@ -546,6 +559,7 @@ cd_find_lfn:
|
||||
; íåò èñêîìîãî ýëåìåíòà öåïî÷êè
|
||||
.access_denied:
|
||||
pop esi eax
|
||||
mov [cd_appl_data],1
|
||||
stc
|
||||
ret
|
||||
; èñêîìûé ýëåìåíò öåïî÷êè íàéäåí
|
||||
@ -568,6 +582,7 @@ cd_find_lfn:
|
||||
jmp .nested
|
||||
@@:
|
||||
pop esi eax
|
||||
mov [cd_appl_data],1
|
||||
clc
|
||||
ret
|
||||
|
||||
|
186
programs/system/cd_tray/CD_tray.ASM
Normal file
186
programs/system/cd_tray/CD_tray.ASM
Normal file
@ -0,0 +1,186 @@
|
||||
;
|
||||
; Управление лотками дисковых приводов ATAPI
|
||||
; 22.07.2007 Mario79 исходный вариант
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
use32 ; включить 32-битный режим ассемблера
|
||||
org 0x0 ; адресация с нуля
|
||||
|
||||
db 'MENUET01' ; 8-байтный идентификатор MenuetOS
|
||||
dd 0x01 ; версия заголовка (всегда 1)
|
||||
dd START ; адрес первой команды
|
||||
dd I_END ; размер программы
|
||||
dd 0x11000 ; количество памяти
|
||||
dd 0x11000 ; адрес вершины стэка
|
||||
dd 0x0 ; адрес буфера для параметров (не используется)
|
||||
dd 0x0 ; зарезервировано
|
||||
|
||||
include 'MACROS.INC' ; макросы облегчают жизнь ассемблерщиков!
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- НАЧАЛО ПРОГРАММЫ ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
START:
|
||||
|
||||
red: ; перерисовать окно
|
||||
call draw_window ; вызываем процедуру отрисовки окна
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- ЦИКЛ ОБРАБОТКИ СОБЫТИЙ ----------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
still:
|
||||
mcall 10 ; функция 10 - ждать события
|
||||
|
||||
cmp eax,1 ; перерисовать окно ?
|
||||
je red ; если да - на метку red
|
||||
cmp eax,2 ; нажата клавиша ?
|
||||
je key ; если да - на key
|
||||
cmp eax,3 ; нажата кнопка ?
|
||||
je button ; если да - на button
|
||||
|
||||
jmp still ; если другое событие - в начало цикла
|
||||
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
|
||||
key: ; нажата клавиша на клавиатуре
|
||||
mcall 2 ; функция 2 - считать код символа (в ah)
|
||||
|
||||
jmp still ; вернуться к началу цикла
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
button:
|
||||
mcall 17 ; 17 - получить идентификатор нажатой кнопки
|
||||
cmp ah,2
|
||||
jne b3
|
||||
mov dword [load_tray.name],cd0
|
||||
jmp b5.1
|
||||
b3:
|
||||
cmp ah,3
|
||||
jne b4
|
||||
mov dword [load_tray.name],cd1
|
||||
jmp b5.1
|
||||
b4:
|
||||
cmp ah,4
|
||||
jne b5
|
||||
mov dword [load_tray.name],cd2
|
||||
jmp b5.1
|
||||
b5:
|
||||
cmp ah,5
|
||||
jne b6
|
||||
mov dword [load_tray.name],cd3
|
||||
.1:
|
||||
mcall 70, load_tray
|
||||
jmp red
|
||||
b6:
|
||||
cmp ah,6
|
||||
jne b7
|
||||
mov dword [eject_tray.name],cd0
|
||||
jmp b9.1
|
||||
b7:
|
||||
cmp ah,7
|
||||
jne b8
|
||||
mov dword [eject_tray.name],cd1
|
||||
jmp b9.1
|
||||
b8:
|
||||
cmp ah,8
|
||||
jne b9
|
||||
mov dword [eject_tray.name],cd2
|
||||
jmp b9.1
|
||||
b9:
|
||||
cmp ah,9
|
||||
jne b1
|
||||
mov dword [eject_tray.name],cd3
|
||||
.1:
|
||||
mcall 70, eject_tray
|
||||
jmp red
|
||||
b1:
|
||||
cmp ah, 1 ; если НЕ нажата кнопка с номером 1,
|
||||
jne still ; вернуться
|
||||
|
||||
.exit:
|
||||
mcall -1 ; иначе конец программы
|
||||
|
||||
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- ОПРЕДЕЛЕНИЕ И ОТРИСОВКА ОКНА ----------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
draw_window:
|
||||
mcall 12, 1 ; функция 12: сообщить ОС об отрисовке окна
|
||||
; 1 - начинаем рисовать
|
||||
; СОЗДАиМ ОКНО
|
||||
|
||||
mcall 0, <100,230>, <100,110>, 0x03AABBCC, 0x805080D0, 0x005080D0
|
||||
mcall 71, 1 ,header
|
||||
mcall 8,<15,42>,<40,20>,2,0xaaaaaa
|
||||
call draw_buttons
|
||||
mov edx,6
|
||||
add ecx,30 shl 16
|
||||
mcall
|
||||
call draw_buttons
|
||||
|
||||
mcall 4, <25,25>, 0x80ffffff,text1
|
||||
mov edx,text2
|
||||
|
||||
add ebx,3 shl 16+20
|
||||
mcall
|
||||
mov edx,text3
|
||||
add ebx,30
|
||||
sub ebx,3 shl 16
|
||||
mcall
|
||||
|
||||
mcall 12, 2 ; функция 12: сообщить ОС об отрисовке окна
|
||||
; 2, закончили рисовать
|
||||
|
||||
ret ; выходим из процедуры
|
||||
|
||||
draw_buttons:
|
||||
pusha
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;--- ДАННЫЕ ПРОГРАММЫ ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
header db ' ATAPI Device Tray Control',0
|
||||
text3 db 'eject eject eject eject',0
|
||||
text2 db 'load load load load',0
|
||||
text1 db '/cd0/ /cd1/ /cd2/ /cd3/',0
|
||||
cd0: db '/cd0/1/',0
|
||||
cd1: db '/cd1/1/',0
|
||||
cd2: db '/cd2/1/',0
|
||||
cd3: db '/cd3/1/',0
|
||||
;---------------------------------------------------------------------
|
||||
load_tray:
|
||||
.subfunction dd 11
|
||||
.rezerv dd 0
|
||||
.rezerv1 dd 0
|
||||
.rezerv2 dd 0
|
||||
.rezerv3 dd 0
|
||||
db 0
|
||||
.name: dd cd0
|
||||
|
||||
eject_tray:
|
||||
.subfunction dd 10
|
||||
.rezerv dd 0
|
||||
.rezerv1 dd 0
|
||||
.rezerv2 dd 0
|
||||
.rezerv3 dd 0
|
||||
db 0
|
||||
.name: dd cd0
|
||||
|
||||
I_END: ; метка конца программы
|
268
programs/system/cd_tray/MACROS.INC
Normal file
268
programs/system/cd_tray/MACROS.INC
Normal file
@ -0,0 +1,268 @@
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if used name
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if (used name)&(lang eq lng)
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
|
||||
; language for programs
|
||||
lang fix ru ; ru en fr ge fi
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro struct name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
}
|
||||
|
||||
; structures used in MeOS
|
||||
struc process_information
|
||||
{
|
||||
.cpu_usage dd ? ; +0
|
||||
.window_stack_position dw ? ; +4
|
||||
.window_stack_value dw ? ; +6
|
||||
.not_used1 dw ? ; +8
|
||||
.process_name rb 12 ; +10
|
||||
.memory_start dd ? ; +22
|
||||
.used_memory dd ? ; +26
|
||||
.PID dd ? ; +30
|
||||
.x_start dd ? ; +34
|
||||
.y_start dd ? ; +38
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.grab_button dd ?
|
||||
.grab_button_text dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
.work_button_text dd ?
|
||||
.work_text dd ?
|
||||
.work_graph dd ?
|
||||
}
|
||||
struct system_colors
|
||||
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
2
programs/system/cd_tray/build.bat
Normal file
2
programs/system/cd_tray/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm CD_tray.ASM CD_tray
|
||||
@pause
|
Loading…
Reference in New Issue
Block a user