forked from KolibriOS/kolibrios
I'm not sure what all my change is right.
Some optimization. git-svn-id: svn://kolibrios.org@1276 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b81d03be4e
commit
7ac27a2f61
@ -12,7 +12,7 @@ $Revision$
|
||||
; Непосредственная работа с устройством СD (ATAPI)
|
||||
;**********************************************************
|
||||
; Автор части исходного текста Кулаков Владимир Геннадьевич
|
||||
; Àäàïòàöèÿ, äîðàáîòêà è ðàçðàáîòêà Mario79
|
||||
; Àäàïòàöèÿ, äîðàáîòêà è ðàçðàáîòêà Mario79,<Lrz>
|
||||
|
||||
; Максимальное количество повторений операции чтения
|
||||
MaxRetr equ 10
|
||||
@ -20,46 +20,7 @@ MaxRetr equ 10
|
||||
; (в тиках)
|
||||
BSYWaitTime equ 1000 ;2
|
||||
NoTickWaitTime equ 0xfffff
|
||||
|
||||
;*************************************************
|
||||
;* ÏÎËÍÎÅ ×ÒÅÍÈÅ ÑÅÊÒÎÐÀ ÊÎÌÏÀÊÒ-ÄÈÑÊÀ *
|
||||
;* Ñ÷èòûâàþòñÿ äàííûå ïîëüçîâàòåëÿ, èíôîðìàöèÿ *
|
||||
;* ñóáêàíàëà è êîíòðîëüíàÿ èíôîðìàöèÿ *
|
||||
;* Âõîäíûå ïàðàìåòðû ïåðåäàþòñÿ ÷åðåç ãëîáàëüíûå *
|
||||
;* ïåðìåííûå: *
|
||||
;* ChannelNumber - íîìåð êàíàëà; *
|
||||
;* DiskNumber - íîìåð äèñêà íà êàíàëå; *
|
||||
;* CDSectorAddress - àäðåñ ñ÷èòûâàåìîãî ñåêòîðà. *
|
||||
;* Äàííûå ñ÷èòûâàåòñÿ â ìàññèâ CDDataBuf. *
|
||||
;*************************************************
|
||||
ReadCD:
|
||||
pusha
|
||||
; Çàäàòü ðàçìåð ñåêòîðà
|
||||
mov [CDBlockSize],2048 ;2352
|
||||
; Î÷èñòèòü áóôåð ïàêåòíîé êîìàíäû
|
||||
call clear_packet_buffer
|
||||
; Ñôîðìèðîâàòü ïàêåòíóþ êîìàíäó äëÿ ñ÷èòûâàíèÿ
|
||||
; ñåêòîðà äàííûõ
|
||||
; Çàäàòü êîä êîìàíäû Read CD
|
||||
mov [PacketCommand],byte 0x28 ;0xBE
|
||||
; Çàäàòü àäðåñ ñåêòîðà
|
||||
mov AX,word [CDSectorAddress+2]
|
||||
xchg AL,AH
|
||||
mov word [PacketCommand+2],AX
|
||||
mov AX,word [CDSectorAddress]
|
||||
xchg AL,AH
|
||||
mov word [PacketCommand+4],AX
|
||||
; mov eax,[CDSectorAddress]
|
||||
; mov [PacketCommand+2],eax
|
||||
; Çàäàòü êîëè÷åñòâî ñ÷èòûâàåìûõ ñåêòîðîâ
|
||||
mov [PacketCommand+8],byte 1
|
||||
; Çàäàòü ñ÷èòûâàíèå äàííûõ â ïîëíîì îáúåìå
|
||||
; mov [PacketCommand+9],byte 0xF8
|
||||
; Ïîäàòü êîìàíäó
|
||||
call SendPacketDatCommand
|
||||
popa
|
||||
ret
|
||||
|
||||
CDBlockSize equ 2048
|
||||
;********************************************
|
||||
;* ЧТЕНИЕ СЕКТОРА С ПОВТОРАМИ *
|
||||
;* Многократное повторение чтения при сбоях *
|
||||
@ -73,8 +34,9 @@ ReadCDWRetr:
|
||||
mov eax,[CDSectorAddress]
|
||||
mov ebx,[CDDataBuf_pointer]
|
||||
call cd_calculate_cache
|
||||
xor edi,edi
|
||||
add esi,8
|
||||
mov edi,1
|
||||
inc edi
|
||||
.hdreadcache:
|
||||
; cmp dword [esi+4],0 ; empty
|
||||
; je .nohdcache
|
||||
@ -128,9 +90,49 @@ ReadCDWRetr_1:
|
||||
mov ECX,MaxRetr
|
||||
@@NextRetr:
|
||||
; Подать команду
|
||||
call ReadCD
|
||||
cmp [DevErrorCode],0
|
||||
je @@End_4
|
||||
;*************************************************
|
||||
;* ÏÎËÍÎÅ ×ÒÅÍÈÅ ÑÅÊÒÎÐÀ ÊÎÌÏÀÊÒ-ÄÈÑÊÀ *
|
||||
;* Ñ÷èòûâàþòñÿ äàííûå ïîëüçîâàòåëÿ, èíôîðìàöèÿ *
|
||||
;* ñóáêàíàëà è êîíòðîëüíàÿ èíôîðìàöèÿ *
|
||||
;* Âõîäíûå ïàðàìåòðû ïåðåäàþòñÿ ÷åðåç ãëîáàëüíûå *
|
||||
;* ïåðìåííûå: *
|
||||
;* ChannelNumber - íîìåð êàíàëà; *
|
||||
;* DiskNumber - íîìåð äèñêà íà êàíàëå; *
|
||||
;* CDSectorAddress - àäðåñ ñ÷èòûâàåìîãî ñåêòîðà. *
|
||||
;* Äàííûå ñ÷èòûâàåòñÿ â ìàññèâ CDDataBuf. *
|
||||
;*************************************************
|
||||
;ReadCD:
|
||||
push ecx
|
||||
; pusha
|
||||
; Çàäàòü ðàçìåð ñåêòîðà
|
||||
; mov [CDBlockSize],2048 ;2352
|
||||
; Î÷èñòèòü áóôåð ïàêåòíîé êîìàíäû
|
||||
call clear_packet_buffer
|
||||
; Ñôîðìèðîâàòü ïàêåòíóþ êîìàíäó äëÿ ñ÷èòûâàíèÿ
|
||||
; ñåêòîðà äàííûõ
|
||||
; Çàäàòü êîä êîìàíäû Read CD
|
||||
mov [PacketCommand],byte 0x28 ;0xBE
|
||||
; Çàäàòü àäðåñ ñåêòîðà
|
||||
mov AX,word [CDSectorAddress+2]
|
||||
xchg AL,AH
|
||||
mov word [PacketCommand+2],AX
|
||||
mov AX,word [CDSectorAddress]
|
||||
xchg AL,AH
|
||||
mov word [PacketCommand+4],AX
|
||||
; mov eax,[CDSectorAddress]
|
||||
; mov [PacketCommand+2],eax
|
||||
; Çàäàòü êîëè÷åñòâî ñ÷èòûâàåìûõ ñåêòîðîâ
|
||||
mov [PacketCommand+8],byte 1
|
||||
; Çàäàòü ñ÷èòûâàíèå äàííûõ â ïîëíîì îáúåìå
|
||||
; mov [PacketCommand+9],byte 0xF8
|
||||
; Ïîäàòü êîìàíäó
|
||||
call SendPacketDatCommand
|
||||
pop ecx
|
||||
; ret
|
||||
|
||||
; cmp [DevErrorCode],0
|
||||
test eax,eax
|
||||
jz @@End_4
|
||||
|
||||
or ecx,ecx ;{SPraid.simba} (for cd load)
|
||||
jz @@End_4
|
||||
@ -141,8 +143,8 @@ ReadCDWRetr_1:
|
||||
mov eax,NoTickWaitTime
|
||||
.wait:
|
||||
dec eax
|
||||
cmp eax,0
|
||||
je @@NextRetr
|
||||
; test eax,eax
|
||||
jz @@NextRetr
|
||||
jmp .wait
|
||||
@@:
|
||||
; Задержка на 2,5 секунды
|
||||
@ -154,23 +156,25 @@ ReadCDWRetr_1:
|
||||
; ja @@Wait
|
||||
loop @@NextRetr
|
||||
@@End_4:
|
||||
mov dword [DevErrorCode],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
; Óíèâåðñàëüíûå ïðîöåäóðû, îáåñïå÷èâàþùèå âûïîëíåíèå
|
||||
; Óíèâåðñàëüíûå ïðîöåäóðû, îáåñïå÷èâàþùèå âûïîëíåíèå
|
||||
; пакетных команд в режиме PIO
|
||||
|
||||
; Максимально допустимое время ожидания реакции
|
||||
; устройства на пакетную команду (в тиках)
|
||||
MaxCDWaitTime equ 1000 ;200 ;10 ñåêóíä
|
||||
|
||||
MaxCDWaitTime equ 1000 ;200 ;10 ñåêóíä
|
||||
uglobal
|
||||
; Область памяти для формирования пакетной команды
|
||||
PacketCommand: rb 12 ;DB 12 DUP (?)
|
||||
; Область памяти для приема данных от дисковода
|
||||
;CDDataBuf DB 4096 DUP (0)
|
||||
; Размер принимаемого блока данных в байтах
|
||||
CDBlockSize DW ?
|
||||
;CDBlockSize DW ?
|
||||
; Адрес считываемого сектора данных
|
||||
CDSectorAddress: DD ?
|
||||
; Время начала очередной операции с диском
|
||||
@ -179,7 +183,7 @@ TickCounter_1 DD 0
|
||||
WURStartTime DD 0
|
||||
; указатель буфера для считывания
|
||||
CDDataBuf_pointer dd 0
|
||||
|
||||
endg
|
||||
;****************************************************
|
||||
;* ПОСЛАТЬ УСТРОЙСТВУ ATAPI ПАКЕТНУЮ КОМАНДУ, *
|
||||
;* ПРЕДУСМАТРИВАЮЩУЮ ПЕРЕДАЧУ ОДНОГО СЕКТОРА ДАННЫХ *
|
||||
@ -190,24 +194,26 @@ CDDataBuf_pointer dd 0
|
||||
;* DiskNumber - номер диска на канале; *
|
||||
;* PacketCommand - 12-байтный командный пакет; *
|
||||
;* CDBlockSize - размер принимаемого блока данных. *
|
||||
; return eax DevErrorCode
|
||||
;****************************************************
|
||||
SendPacketDatCommand:
|
||||
pushad
|
||||
mov [DevErrorCode],0
|
||||
xor eax,eax
|
||||
; mov byte [DevErrorCode],al
|
||||
; Задать режим CHS
|
||||
mov [ATAAddressMode],0
|
||||
mov byte [ATAAddressMode],al
|
||||
; Послать ATA-команду передачи пакетной команды
|
||||
mov [ATAFeatures],0
|
||||
mov [ATASectorCount],0
|
||||
mov [ATASectorNumber],0
|
||||
mov byte [ATAFeatures],al
|
||||
mov byte [ATASectorCount],al
|
||||
mov byte [ATASectorNumber],al
|
||||
; Загрузить размер передаваемого блока
|
||||
mov AX,[CDBlockSize]
|
||||
mov [ATACylinder],AX
|
||||
mov [ATAHead],0
|
||||
mov [ATAHead],al
|
||||
; mov AX,[CDBlockSize]
|
||||
mov [ATACylinder],CDBlockSize
|
||||
mov [ATACommand],0A0h
|
||||
call SendCommandToHDD_1
|
||||
cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè
|
||||
jne @@End_8 ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè
|
||||
test eax,eax
|
||||
; cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè
|
||||
jnz @@End_8 ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè
|
||||
|
||||
; Ожидание готовности дисковода к приему
|
||||
; пакетной команды
|
||||
@ -218,8 +224,8 @@ SendPacketDatCommand:
|
||||
cmp [timer_ticks_enable],0
|
||||
jne @f
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1_1
|
||||
; test ecx,ecx
|
||||
jz @@Err1_1
|
||||
jmp .test
|
||||
@@:
|
||||
call change_task
|
||||
@ -261,8 +267,8 @@ SendPacketDatCommand:
|
||||
cmp [timer_ticks_enable],0
|
||||
jne @f
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1_1
|
||||
; test ecx,ecx
|
||||
jz @@Err1_1
|
||||
jmp .test_1
|
||||
@@:
|
||||
call change_task
|
||||
@ -286,7 +292,7 @@ SendPacketDatCommand:
|
||||
mov DX,[ATABasePortAddr] ;порт 1x0h
|
||||
; Загрузить в счетчик размер блока в байтах
|
||||
xor ecx,ecx
|
||||
mov CX,[CDBlockSize]
|
||||
mov CX,CDBlockSize
|
||||
; Вычислить размер блока в 16-разрядных словах
|
||||
shr CX,1 ;разделить размер блока на 2
|
||||
; Принять блок данных
|
||||
@ -294,21 +300,29 @@ SendPacketDatCommand:
|
||||
cld
|
||||
rep insw
|
||||
sti
|
||||
; Óñïåøíîå çàâåðøåíèå ïðèåìà äàííûõ
|
||||
jmp @@End_8
|
||||
; Óñïåøíîå çàâåðøåíèå ïðèåìà äàííûõ
|
||||
@@End_8:
|
||||
xor eax,eax
|
||||
ret
|
||||
|
||||
; Записать код ошибки
|
||||
@@Err1_1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_8
|
||||
xor eax,eax
|
||||
inc eax
|
||||
ret
|
||||
; mov [DevErrorCode],1
|
||||
; ret
|
||||
@@Err6_temp:
|
||||
mov [DevErrorCode],7
|
||||
jmp @@End_8
|
||||
mov eax,7
|
||||
ret
|
||||
; mov [DevErrorCode],7
|
||||
; ret
|
||||
@@Err6:
|
||||
mov [DevErrorCode],6
|
||||
@@End_8:
|
||||
popad
|
||||
ret
|
||||
mov eax,6
|
||||
ret
|
||||
; mov [DevErrorCode],6
|
||||
;@@End_8:
|
||||
; ret
|
||||
|
||||
|
||||
|
||||
@ -323,19 +337,21 @@ SendPacketDatCommand:
|
||||
;***********************************************
|
||||
SendPacketNoDatCommand:
|
||||
pushad
|
||||
mov [DevErrorCode],0
|
||||
xor eax,eax
|
||||
; mov byte [DevErrorCode],al
|
||||
; Задать режим CHS
|
||||
mov [ATAAddressMode],0
|
||||
mov byte [ATAAddressMode],al
|
||||
; Послать ATA-команду передачи пакетной команды
|
||||
mov [ATAFeatures],0
|
||||
mov [ATASectorCount],0
|
||||
mov [ATASectorNumber],0
|
||||
mov [ATACylinder],0
|
||||
mov [ATAHead],0
|
||||
mov byte [ATAFeatures],al
|
||||
mov byte [ATASectorCount],al
|
||||
mov byte [ATASectorNumber],al
|
||||
mov word [ATACylinder],ax
|
||||
mov byte [ATAHead],al
|
||||
mov [ATACommand],0A0h
|
||||
call SendCommandToHDD_1
|
||||
cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè
|
||||
jne @@End_9 ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè
|
||||
; cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè
|
||||
test eax,eax
|
||||
jnz @@End_9 ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè
|
||||
; Ожидание готовности дисковода к приему
|
||||
; пакетной команды
|
||||
mov DX,[ATABasePortAddr]
|
||||
@ -371,8 +387,8 @@ SendPacketNoDatCommand:
|
||||
mov AX,word [PacketCommand+10]
|
||||
out DX,AX
|
||||
; sti
|
||||
cmp [ignore_CD_eject_wait],1
|
||||
je @@End_9
|
||||
cmp [ignore_CD_eject_wait],1
|
||||
je @@clear_DEC
|
||||
; Ожидание подтверждения приема команды
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
@ -391,15 +407,19 @@ SendPacketNoDatCommand:
|
||||
jnz @@Err6_1
|
||||
test AL,40h ;состояние сигнала DRDY
|
||||
jz @@WaitDevice1_1
|
||||
jmp @@End_9
|
||||
|
||||
@@clear_DEC:
|
||||
and [DevErrorCode],0
|
||||
popad
|
||||
ret
|
||||
; Записать код ошибки
|
||||
@@Err1_3:
|
||||
mov [DevErrorCode],1
|
||||
xor eax,eax
|
||||
inc eax
|
||||
jmp @@End_9
|
||||
@@Err6_1:
|
||||
mov [DevErrorCode],6
|
||||
mov eax,6
|
||||
@@End_9:
|
||||
mov [DevErrorCode],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
@ -420,11 +440,11 @@ SendPacketNoDatCommand:
|
||||
;* в ATABasePortAddr - базовый адрес HDD; *
|
||||
;* в DevErrorCode - ноль. *
|
||||
;* При возникновении ошибки в DevErrorCode будет *
|
||||
;* âîçâðàùåí êîä îøèáêè. *
|
||||
;* âîçâðàùåí êîä îøèáêè â eax *
|
||||
;****************************************************
|
||||
SendCommandToHDD_1:
|
||||
pushad
|
||||
mov [DevErrorCode],0
|
||||
; pushad
|
||||
; mov [DevErrorCode],0 not need
|
||||
; Проверить значение кода режима
|
||||
cmp [ATAAddressMode],1
|
||||
ja @@Err2_4
|
||||
@ -459,8 +479,8 @@ SendCommandToHDD_1:
|
||||
cmp [timer_ticks_enable],0
|
||||
jne @f
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1_4
|
||||
; test ecx,ecx
|
||||
jz @@Err1_4
|
||||
jmp .test
|
||||
@@:
|
||||
call change_task
|
||||
@ -514,28 +534,35 @@ SendCommandToHDD_1:
|
||||
out DX,AL
|
||||
sti
|
||||
; Сбросить признак ошибки
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_10
|
||||
; mov [DevErrorCode],0
|
||||
@@End_10:
|
||||
xor eax,eax
|
||||
ret
|
||||
; Записать код ошибки
|
||||
@@Err1_4:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_10
|
||||
xor eax,eax
|
||||
inc eax
|
||||
; mov [DevErrorCode],1
|
||||
ret
|
||||
@@Err2_4:
|
||||
mov [DevErrorCode],2
|
||||
jmp @@End_10
|
||||
mov eax,2
|
||||
; mov [DevErrorCode],2
|
||||
ret
|
||||
@@Err3_4:
|
||||
mov [DevErrorCode],3
|
||||
jmp @@End_10
|
||||
mov eax,3
|
||||
; mov [DevErrorCode],3
|
||||
ret
|
||||
@@Err4_4:
|
||||
mov [DevErrorCode],4
|
||||
jmp @@End_10
|
||||
mov eax,4
|
||||
; mov [DevErrorCode],4
|
||||
ret
|
||||
@@Err5_4:
|
||||
mov [DevErrorCode],5
|
||||
mov eax,5
|
||||
; mov [DevErrorCode],5
|
||||
; Завершение работы программы
|
||||
@@End_10:
|
||||
ret
|
||||
; sti
|
||||
popad
|
||||
ret
|
||||
; popad
|
||||
|
||||
;*************************************************
|
||||
;* ОЖИДАНИЕ ГОТОВНОСТИ УСТРОЙСТВА К РАБОТЕ *
|
||||
@ -563,8 +590,8 @@ WaitUnitReady:
|
||||
cmp [DevErrorCode],0
|
||||
je @@End_11
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je .Error
|
||||
; cmp ecx,0
|
||||
jz .Error
|
||||
jmp @@SendCommand
|
||||
@@:
|
||||
call change_task
|
||||
@ -815,14 +842,14 @@ check_ATAPI_device_event:
|
||||
call EjectMedium
|
||||
mov [ignore_CD_eject_wait],0
|
||||
ret
|
||||
|
||||
iglobal
|
||||
timer_ATAPI_check dd 0
|
||||
ATAPI_IDE0_lock db 0
|
||||
ATAPI_IDE1_lock db 0
|
||||
ATAPI_IDE2_lock db 0
|
||||
ATAPI_IDE3_lock db 0
|
||||
ignore_CD_eject_wait db 0
|
||||
|
||||
endg
|
||||
;*************************************************
|
||||
;* Получить сообщение о событии или состоянии *
|
||||
;* устройства *
|
||||
@ -896,7 +923,7 @@ Read_TOC:
|
||||
|
||||
clear_packet_buffer:
|
||||
; Очистить буфер пакетной команды
|
||||
mov [PacketCommand],dword 0
|
||||
mov [PacketCommand+4],dword 0
|
||||
mov [PacketCommand+8],dword 0
|
||||
and [PacketCommand],dword 0
|
||||
and [PacketCommand+4],dword 0
|
||||
and [PacketCommand+8],dword 0
|
||||
ret
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
$Revision$
|
||||
|
||||
|
||||
iglobal
|
||||
conf_path_sect: db 'path',0
|
||||
|
||||
conf_fname db '/sys/sys.conf',0
|
||||
|
||||
endg
|
||||
; set soke kernel configuration
|
||||
proc set_kernel_conf
|
||||
locals
|
||||
@ -64,7 +64,7 @@ proc set_kernel_conf
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
iglobal
|
||||
ugui db 'gui',0
|
||||
ugui_mouse_speed db 'mouse_speed',0
|
||||
ugui_mouse_speed_def db '2',0
|
||||
@ -74,7 +74,7 @@ ugui_mouse_delay_def db '0x00A',0
|
||||
udev db 'dev',0
|
||||
udev_midibase db 'midibase',0
|
||||
udev_midibase_def db '0x320',0
|
||||
|
||||
endg
|
||||
;set up netvork configuration
|
||||
proc set_network_conf
|
||||
locals
|
||||
@ -123,14 +123,14 @@ endl
|
||||
|
||||
|
||||
endp
|
||||
|
||||
iglobal
|
||||
unet db 'net',0
|
||||
unet_active db 'active',0
|
||||
unet_addr db 'addr',0
|
||||
unet_mask db 'mask',0
|
||||
unet_gate db 'gate',0
|
||||
unet_def db 0
|
||||
|
||||
endg
|
||||
; convert string to DWord
|
||||
proc strtoint stdcall,strs
|
||||
pushad
|
||||
|
@ -986,9 +986,9 @@ sysfn_meminfo:
|
||||
mov [ecx+24], eax
|
||||
ret
|
||||
.fail:
|
||||
mov dword [esp+32], -1
|
||||
or dword [esp+32], -1
|
||||
ret
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
f68call:
|
||||
dd f68.11 ; init_heap
|
||||
@ -1006,7 +1006,7 @@ f68call:
|
||||
dd f68.23 ; shmem_close
|
||||
dd f68.24
|
||||
dd f68.25
|
||||
|
||||
endg
|
||||
align 4
|
||||
f68:
|
||||
cmp eax,4
|
||||
|
@ -226,6 +226,7 @@ struc TIMER
|
||||
.arg dd ?
|
||||
}
|
||||
|
||||
|
||||
MAX_PROIRITY 0 ; highest, used for kernel tasks
|
||||
MAX_USER_PRIORITY 0 ; highest priority for user processes
|
||||
USER_PRIORITY 7 ; default (should correspond to nice 0)
|
||||
@ -233,7 +234,9 @@ MIN_USER_PRIORITY 14 ; minimum priority for user processes
|
||||
IDLE_PRIORITY 15 ; lowest, only IDLE process goes here
|
||||
NR_SCHED_QUEUES 16 ; MUST equal IDLE_PRIORYTY + 1
|
||||
|
||||
uglobal
|
||||
rdy_head rd 16
|
||||
endg
|
||||
|
||||
align 4
|
||||
pick_task:
|
||||
|
@ -123,13 +123,13 @@ iglobal
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd sys_midi ; 20-ResetMidi and OutputMidi
|
||||
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd sys_settime ; 22-setting date,time,clock and alarm-clock
|
||||
dd 0
|
||||
dd 0
|
||||
dd sys_settime
|
||||
dd 0
|
||||
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd 0 ;
|
||||
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd 0 ; 25
|
||||
dd 0 ; 26
|
||||
dd 0
|
||||
dd 0 ;
|
||||
dd 0
|
||||
@ -202,13 +202,13 @@ iglobal
|
||||
dd sys_getbutton ; 17-GetButton
|
||||
dd sys_system ; 18-System Services
|
||||
dd paleholder ; 19-reserved
|
||||
dd cross_order ; 20-ResetMidi and OutputMidi
|
||||
dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd cross_order ; 22-setting date,time,clock and alarm-clock
|
||||
dd sys_midi ; 20-ResetMidi and OutputMidi
|
||||
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd cross_order ; 22-setting date,time,clock and alarm-clock
|
||||
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
||||
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd undefined_syscall ; 25-reserved
|
||||
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd undefined_syscall ; 27-reserved
|
||||
dd undefined_syscall ; 28-reserved
|
||||
dd sys_date ; 29-GetDate
|
||||
|
@ -121,26 +121,26 @@ shmem_list:
|
||||
|
||||
; supported videomodes
|
||||
|
||||
mode_1280_1024_32:
|
||||
dw 1280,1024,32,60
|
||||
mode_1280_1024_24:
|
||||
dw 1280,1024,24,60
|
||||
mode_1024_768_32:
|
||||
dw 1024,768,32,60
|
||||
mode_1024_768_24:
|
||||
dw 1024,768,24,60
|
||||
mode_800_600_32:
|
||||
dw 800,600,32,60
|
||||
mode_800_600_24:
|
||||
dw 800,600,24,60
|
||||
mode_640_480_32:
|
||||
dw 640,480,32,60
|
||||
mode_640_480_24:
|
||||
dw 640,480,24,60
|
||||
mode_640_480_16:
|
||||
dw 640,480,16,60
|
||||
mode_320_240_8:
|
||||
dw 320,240,8,60
|
||||
;mode_1280_1024_32:
|
||||
; dw 1280,1024,32,60
|
||||
;mode_1280_1024_24:
|
||||
; dw 1280,1024,24,60
|
||||
;mode_1024_768_32:
|
||||
; dw 1024,768,32,60
|
||||
;mode_1024_768_24:
|
||||
; dw 1024,768,24,60
|
||||
;mode_800_600_32:
|
||||
; dw 800,600,32,60
|
||||
;mode_800_600_24:
|
||||
; dw 800,600,24,60
|
||||
;mode_640_480_32:
|
||||
; dw 640,480,32,60
|
||||
;mode_640_480_24:
|
||||
; dw 640,480,24,60
|
||||
;mode_640_480_16:
|
||||
; dw 640,480,16,60
|
||||
;mode_320_240_8:
|
||||
; dw 320,240,8,60
|
||||
|
||||
; mike.dld {
|
||||
db 0
|
||||
|
@ -72,8 +72,9 @@ FindHDD_3:
|
||||
|
||||
|
||||
; Адрес считываемого сектора в режиме LBA
|
||||
uglobal
|
||||
SectorAddress DD ?
|
||||
|
||||
endg
|
||||
;*************************************************
|
||||
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
@ -99,8 +100,8 @@ ReadHDD_ID:
|
||||
@@WaitCompleet:
|
||||
; Проверить время выполнения команды
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Error1 ;îøèáêà òàéì-àóòà
|
||||
; cmp ecx,0
|
||||
jz @@Error1 ;îøèáêà òàéì-àóòà
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
@ -116,19 +117,21 @@ ReadHDD_ID:
|
||||
mov DX,[ATABasePortAddr] ;регистр данных
|
||||
mov CX,256 ;число считываемых слов
|
||||
rep insw ;принять блок данных
|
||||
jmp @@End
|
||||
ret
|
||||
; Записать код ошибки
|
||||
@@Error1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End
|
||||
ret
|
||||
@@Error6:
|
||||
mov [DevErrorCode],6
|
||||
@@End: ret
|
||||
|
||||
|
||||
|
||||
iglobal
|
||||
; Стандартные базовые адреса каналов 1 и 2
|
||||
StandardATABases DW 1F0h, 170h
|
||||
endg
|
||||
uglobal
|
||||
; Номер канала
|
||||
ChannelNumber DW ?
|
||||
; Номер диска
|
||||
@ -148,8 +151,8 @@ ATACommand DB ? ;
|
||||
; 3 - неверный номер канала, 4 - неверный номер диска,
|
||||
; 5 - неверный номер головки, 6 - ошибка при выполнении
|
||||
; команды)
|
||||
DevErrorCode DB ?
|
||||
|
||||
DevErrorCode dd ?
|
||||
endg
|
||||
;****************************************************
|
||||
;* ПОСЛАТЬ КОМАНДУ ЗАДАННОМУ ДИСКУ *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
@ -203,8 +206,8 @@ SendCommandToHDD:
|
||||
@@WaitHDReady:
|
||||
; Проверить время ожидани
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1
|
||||
; cmp ecx,0
|
||||
jz @@Err1
|
||||
; mov eax,[timer_ticks]
|
||||
; sub eax,[TickCounter_1]
|
||||
; cmp eax,300 ;ожидать 300 тиков
|
||||
@ -253,19 +256,18 @@ SendCommandToHDD:
|
||||
sti
|
||||
; Сбросить признак ошибки
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_2
|
||||
ret
|
||||
; Записать код ошибки
|
||||
@@Err1: mov [DevErrorCode],1
|
||||
jmp @@End_2
|
||||
ret
|
||||
@@Err2: mov [DevErrorCode],2
|
||||
jmp @@End_2
|
||||
ret
|
||||
@@Err3: mov [DevErrorCode],3
|
||||
jmp @@End_2
|
||||
ret
|
||||
@@Err4: mov [DevErrorCode],4
|
||||
jmp @@End_2
|
||||
ret
|
||||
@@Err5: mov [DevErrorCode],5
|
||||
; Завершение работы программы
|
||||
@@End_2:
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
@ -293,12 +295,12 @@ ReadCD_ID:
|
||||
; Ожидать готовность данных HDD
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
mov ecx,0xffff
|
||||
mov ecx,0xffff
|
||||
@@WaitCompleet_1:
|
||||
; Проверить врем
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Error1_1 ;îøèáêà òàéì-àóòà
|
||||
dec ecx
|
||||
; cmp ecx,0
|
||||
jz @@Error1_1 ;îøèáêà òàéì-àóòà
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
@ -314,11 +316,11 @@ ReadCD_ID:
|
||||
mov DX,[ATABasePortAddr] ;порт 1x0h
|
||||
mov CX,256 ;число считываемых слов
|
||||
rep insw
|
||||
jmp @@End_1
|
||||
ret
|
||||
; Записать код ошибки
|
||||
@@Error1_1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_1
|
||||
ret
|
||||
@@Error6_1:
|
||||
mov [DevErrorCode],6
|
||||
@@End_1:
|
||||
@ -360,7 +362,7 @@ DeviceReset:
|
||||
@@WaitHDReady_1:
|
||||
; Проверить время ожидани
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
; cmp ecx,0
|
||||
je @@Err1_2 ;ошибка тайм-аута
|
||||
; Прочитать регистр состояни
|
||||
in AL,DX
|
||||
@ -369,15 +371,14 @@ DeviceReset:
|
||||
jnz @@WaitHDReady_1
|
||||
; Сбросить признак ошибки
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_3
|
||||
ret
|
||||
; Обработка ошибок
|
||||
@@Err1_2: mov [DevErrorCode],1
|
||||
jmp @@End_3
|
||||
ret
|
||||
@@Err3_2: mov [DevErrorCode],3
|
||||
jmp @@End_3
|
||||
ret
|
||||
@@Err4_2: mov [DevErrorCode],4
|
||||
; Записать код ошибки
|
||||
@@End_3:
|
||||
ret
|
||||
|
||||
EndFindHDD:
|
||||
|
@ -316,13 +316,13 @@ high_code:
|
||||
; --------------- APM ---------------------
|
||||
|
||||
; init selectors
|
||||
mov ebx, [BOOT_VAR+0x9040] ; offset of APM entry point
|
||||
movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of
|
||||
; protected-mode 32-bit code segment
|
||||
movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of
|
||||
; protected-mode 16-bit code segment
|
||||
movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of
|
||||
; protected-mode 16-bit data segment
|
||||
mov ebx,[BOOT_VAR+0x9040] ; offset of APM entry point
|
||||
movzx eax,word [BOOT_VAR+0x9050] ; real-mode segment base address of
|
||||
; protected-mode 32-bit code segment
|
||||
movzx ecx,word [BOOT_VAR+0x9052] ; real-mode segment base address of
|
||||
; protected-mode 16-bit code segment
|
||||
movzx edx,word [BOOT_VAR+0x9054] ; real-mode segment base address of
|
||||
; protected-mode 16-bit data segment
|
||||
|
||||
shl eax, 4
|
||||
mov [dword apm_code_32 + 2], ax
|
||||
@ -345,23 +345,18 @@ high_code:
|
||||
mov eax, [BOOT_VAR + 0x9044] ; version & flags
|
||||
mov [apm_vf], eax
|
||||
; -----------------------------------------
|
||||
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
|
||||
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
|
||||
; mov [0xF604],byte 1 ;al
|
||||
mov al, [BOOT_VAR+0x901F] ; DMA access
|
||||
mov [allow_dma_access], al
|
||||
movzx eax, byte [BOOT_VAR+0x9000] ; bpp
|
||||
mov [ScreenBPP],al
|
||||
|
||||
mov [_display.bpp], eax
|
||||
mov [_display.vrefresh], 60
|
||||
mov al, [BOOT_VAR+0x901F] ; DMA access
|
||||
mov [allow_dma_access], al
|
||||
mov al,[BOOT_VAR+0x9000] ; bpp
|
||||
mov [ScreenBPP],al
|
||||
|
||||
movzx eax,word [BOOT_VAR+0x900A] ; X max
|
||||
mov [_display.width], eax
|
||||
dec eax
|
||||
mov [Screen_Max_X],eax
|
||||
mov [screen_workarea.right],eax
|
||||
movzx eax,word [BOOT_VAR+0x900C] ; Y max
|
||||
mov [_display.height], eax
|
||||
dec eax
|
||||
mov [Screen_Max_Y],eax
|
||||
mov [screen_workarea.bottom],eax
|
||||
@ -374,9 +369,8 @@ high_code:
|
||||
je @f
|
||||
cmp [SCR_MODE],word 0x12 ; VGA 640x480
|
||||
je @f
|
||||
movzx eax, word[BOOT_VAR+0x9001] ; for other modes
|
||||
mov ax,[BOOT_VAR+0x9001] ; for other modes
|
||||
mov [BytesPerScanLine],ax
|
||||
mov [_display.pitch], eax
|
||||
@@:
|
||||
mov esi, BOOT_VAR+0x9080
|
||||
movzx ecx, byte [esi-1]
|
||||
@ -386,7 +380,7 @@ high_code:
|
||||
|
||||
; GRAPHICS ADDRESSES
|
||||
|
||||
mov byte [BOOT_VAR+0x901e],0x0
|
||||
and byte [BOOT_VAR+0x901e],0x0
|
||||
mov eax,[BOOT_VAR+0x9018]
|
||||
mov [LFBAddress],eax
|
||||
|
||||
@ -646,8 +640,9 @@ no_lib_load:
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, [MEM_AMOUNT]
|
||||
shr ebx, 20
|
||||
mov edi, 1
|
||||
xor edi,edi
|
||||
mov eax, 0x00040000
|
||||
inc edi
|
||||
call display_number_force
|
||||
|
||||
; BUILD SCHEDULER
|
||||
@ -725,13 +720,15 @@ no_lib_load:
|
||||
mov dword [SLOT_BASE+256+APPDATA.tls_base], eax
|
||||
|
||||
; task list
|
||||
mov [CURRENT_TASK],dword 1
|
||||
mov [TASK_COUNT],dword 1
|
||||
mov dword [TASK_DATA+TASKDATA.mem_start],eax ; process base address
|
||||
inc eax
|
||||
mov dword [CURRENT_TASK],eax
|
||||
mov dword [TASK_COUNT],eax
|
||||
mov [current_slot], SLOT_BASE+256
|
||||
mov [TASK_BASE],dword TASK_DATA
|
||||
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
|
||||
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
|
||||
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
|
||||
mov byte[TASK_DATA+TASKDATA.wnd_number],al ; on screen number
|
||||
mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number
|
||||
|
||||
|
||||
call init_cursors
|
||||
mov eax, [def_cursor]
|
||||
@ -769,8 +766,9 @@ no_lib_load:
|
||||
movzx ecx, word [boot_y]
|
||||
add ecx, (10+17*6) shl 16 - 10 ; 'CPU frequency is '
|
||||
mov edx, 0xFFFFFF
|
||||
mov edi, 1
|
||||
xor edi,edi
|
||||
mov eax, 0x00040000
|
||||
inc edi
|
||||
call display_number_force
|
||||
|
||||
; SET VARIABLES
|
||||
@ -864,7 +862,8 @@ first_app_found:
|
||||
cli
|
||||
|
||||
;mov [TASK_COUNT],dword 2
|
||||
mov [CURRENT_TASK],dword 1 ; set OS task fisrt
|
||||
push 1
|
||||
pop dword [CURRENT_TASK] ; set OS task fisrt
|
||||
|
||||
; SET KEYBOARD PARAMETERS
|
||||
mov al, 0xf6 ; reset keyboard, scan enabled
|
||||
@ -991,21 +990,21 @@ align 4
|
||||
boot_log:
|
||||
pushad
|
||||
|
||||
mov ebx,10*65536
|
||||
mov bx,word [boot_y]
|
||||
add [boot_y],dword 10
|
||||
mov ecx,0x80ffffff ; ASCIIZ string with white color
|
||||
mov edx,esi
|
||||
mov edi,1
|
||||
call dtext
|
||||
mov ebx,10*65536
|
||||
mov bx,word [boot_y]
|
||||
add [boot_y],dword 10
|
||||
mov ecx,0x80ffffff ; ASCIIZ string with white color
|
||||
xor edi,edi
|
||||
mov edx,esi
|
||||
inc edi
|
||||
call dtext
|
||||
|
||||
mov [novesachecksum],1000
|
||||
call checkVga_N13
|
||||
mov [novesachecksum],1000
|
||||
call checkVga_N13
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;
|
||||
@ -1083,7 +1082,7 @@ reserve_irqs_ports:
|
||||
|
||||
push eax
|
||||
xor eax,eax
|
||||
inc eax
|
||||
inc eax
|
||||
mov byte [irq_owner+4*0],al ;1 ; timer
|
||||
;mov [irq_owner+4*1], 1 ; keyboard
|
||||
mov byte [irq_owner+4*6],al ;1 ; floppy diskette
|
||||
@ -1125,7 +1124,7 @@ reserve_irqs_ports:
|
||||
setirqreadports:
|
||||
|
||||
mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte
|
||||
and dword [irq12read+4],0 ; end of port list
|
||||
and dword [irq12read+4],0 ; end of port list
|
||||
; mov [irq12read+4],dword 0 ; end of port list
|
||||
;mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
|
||||
;mov [irq04read+4],dword 0 ; end of port list
|
||||
@ -1210,7 +1209,7 @@ sys_outport:
|
||||
|
||||
mov dx,bx ; write
|
||||
out dx,al
|
||||
mov [esp+36],dword 0
|
||||
and [esp+36],dword 0
|
||||
ret
|
||||
|
||||
sopl4:
|
||||
@ -1218,7 +1217,7 @@ sys_outport:
|
||||
mov dx,bx ; read
|
||||
in al,dx
|
||||
and eax,0xff
|
||||
mov [esp+36],dword 0
|
||||
and [esp+36],dword 0
|
||||
mov [esp+24],eax
|
||||
ret
|
||||
|
||||
@ -1235,14 +1234,14 @@ display_number:
|
||||
; ebx = number or pointer
|
||||
; ecx = x shl 16 + y
|
||||
; edx = color
|
||||
xor edi, edi
|
||||
xor edi, edi
|
||||
display_number_force:
|
||||
push eax
|
||||
and eax,0x3fffffff
|
||||
cmp eax,0xffff ; length > 0 ?
|
||||
pop eax
|
||||
jge cont_displ
|
||||
ret
|
||||
push eax
|
||||
and eax,0x3fffffff
|
||||
cmp eax,0xffff ; length > 0 ?
|
||||
pop eax
|
||||
jge cont_displ
|
||||
ret
|
||||
cont_displ:
|
||||
push eax
|
||||
and eax,0x3fffffff
|
||||
@ -1260,22 +1259,22 @@ display_number_force:
|
||||
add ebp,4
|
||||
mov ebp,[ebp+std_application_base_address]
|
||||
mov ebx,[ebx+std_application_base_address]
|
||||
displnl1:
|
||||
displnl1:
|
||||
sub esp,64
|
||||
|
||||
cmp ah,0 ; DECIMAL
|
||||
jne no_display_desnum
|
||||
shr eax,16
|
||||
and eax,0xC03f
|
||||
test ah,ah ; DECIMAL
|
||||
jnz no_display_desnum
|
||||
shr eax,16
|
||||
and eax,0xC03f
|
||||
; and eax,0x3f
|
||||
push eax
|
||||
and eax,0x3f
|
||||
mov edi,esp
|
||||
add edi,4+64-1
|
||||
mov ecx,eax
|
||||
mov eax,ebx
|
||||
mov ebx,10
|
||||
d_desnum:
|
||||
push eax
|
||||
and eax,0x3f
|
||||
mov edi,esp
|
||||
add edi,4+64-1
|
||||
mov ecx,eax
|
||||
mov eax,ebx
|
||||
mov ebx,10
|
||||
d_desnum:
|
||||
xor edx,edx
|
||||
call division_64_bits
|
||||
div ebx
|
||||
@ -1421,154 +1420,155 @@ sys_setup:
|
||||
; 12 = enable pci access
|
||||
|
||||
|
||||
mov [esp+36],dword 0
|
||||
cmp eax,1 ; MIDI
|
||||
jnz nsyse1
|
||||
cmp ebx,0x100
|
||||
jb nsyse1
|
||||
mov edx,65535
|
||||
cmp edx,ebx
|
||||
jb nsyse1
|
||||
mov [midi_base],bx
|
||||
mov word [mididp],bx
|
||||
inc bx
|
||||
mov word [midisp],bx
|
||||
ret
|
||||
and [esp+32],dword 0
|
||||
dec ebx ; MIDI
|
||||
jnz nsyse1
|
||||
cmp ecx,0x100
|
||||
|
||||
jb nsyse1
|
||||
mov esi,65535
|
||||
cmp esi,ecx
|
||||
|
||||
jb nsyse1
|
||||
mov [midi_base],cx ;bx
|
||||
mov word [mididp],cx ;bx
|
||||
inc cx ;bx
|
||||
mov word [midisp],cx ;bx
|
||||
ret
|
||||
|
||||
iglobal
|
||||
midi_base dw 0
|
||||
endg
|
||||
|
||||
nsyse1:
|
||||
dec ebx ; KEYBOARD
|
||||
jnz nsyse2
|
||||
mov edi,[TASK_BASE]
|
||||
add edi,[edi+TASKDATA.mem_start]
|
||||
mov eax,edi
|
||||
|
||||
; cmp eax,2 ; KEYBOARD
|
||||
sub eax,2
|
||||
jnz nsyse2
|
||||
; cmp ebx,1
|
||||
dec ebx
|
||||
jnz kbnobase
|
||||
mov edi,[TASK_BASE]
|
||||
add ecx,[edi+TASKDATA.mem_start]
|
||||
mov eax,ecx
|
||||
mov ebx,keymap
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
dec ecx
|
||||
jnz kbnobase
|
||||
mov ebx,keymap
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnobase:
|
||||
; cmp ebx,2
|
||||
dec ebx
|
||||
jnz kbnoshift
|
||||
mov edi,[TASK_BASE]
|
||||
add ecx,[edi+TASKDATA.mem_start]
|
||||
mov eax,ecx
|
||||
mov ebx,keymap_shift
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnoshift:
|
||||
; cmp ebx,3
|
||||
dec ebx
|
||||
jnz kbnoalt
|
||||
mov edi,[TASK_BASE]
|
||||
add ecx,[edi+TASKDATA.mem_start]
|
||||
mov eax,ecx
|
||||
mov ebx,keymap_alt
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnoalt:
|
||||
; cmp ebx,9
|
||||
sub ebx,6
|
||||
jnz kbnocountry
|
||||
mov word [keyboard],cx
|
||||
ret
|
||||
kbnocountry:
|
||||
mov [esp+36],dword 1
|
||||
ret
|
||||
nsyse2:
|
||||
; cmp eax,3 ; CD
|
||||
dec eax
|
||||
jnz nsyse4
|
||||
test ebx,ebx
|
||||
jz nosesl
|
||||
cmp ebx, 4
|
||||
ja nosesl
|
||||
mov [cd_base],bl
|
||||
cmp ebx,1
|
||||
jnz noprma
|
||||
mov [cdbase],0x1f0
|
||||
mov [cdid],0xa0
|
||||
noprma:
|
||||
cmp ebx,2
|
||||
jnz noprsl
|
||||
mov [cdbase],0x1f0
|
||||
mov [cdid],0xb0
|
||||
noprsl:
|
||||
cmp ebx,3
|
||||
jnz nosema
|
||||
mov [cdbase],0x170
|
||||
mov [cdid],0xa0
|
||||
nosema:
|
||||
cmp ebx,4
|
||||
jnz nosesl
|
||||
mov [cdbase],0x170
|
||||
mov [cdid],0xb0
|
||||
nosesl:
|
||||
ret
|
||||
dec ecx
|
||||
jnz kbnoshift
|
||||
|
||||
mov ebx,keymap_shift
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnoshift:
|
||||
dec ecx
|
||||
jnz kbnoalt
|
||||
mov ebx,keymap_alt
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnoalt:
|
||||
sub ecx,6
|
||||
jnz kbnocountry
|
||||
mov word [keyboard],dx
|
||||
ret
|
||||
kbnocountry:
|
||||
mov [esp+32],dword 1
|
||||
ret
|
||||
nsyse2:
|
||||
dec ebx ; CD
|
||||
jnz nsyse4
|
||||
|
||||
test ecx,ecx
|
||||
jz nosesl
|
||||
|
||||
cmp ecx, 4
|
||||
ja nosesl
|
||||
mov [cd_base],cl
|
||||
|
||||
dec ecx
|
||||
jnz noprma
|
||||
mov [cdbase],0x1f0
|
||||
mov [cdid],0xa0
|
||||
noprma:
|
||||
|
||||
dec ecx
|
||||
jnz noprsl
|
||||
mov [cdbase],0x1f0
|
||||
mov [cdid],0xb0
|
||||
noprsl:
|
||||
dec ecx
|
||||
jnz nosema
|
||||
mov [cdbase],0x170
|
||||
mov [cdid],0xa0
|
||||
nosema:
|
||||
dec ecx
|
||||
jnz nosesl
|
||||
mov [cdbase],0x170
|
||||
mov [cdid],0xb0
|
||||
nosesl:
|
||||
ret
|
||||
|
||||
iglobal
|
||||
cd_base db 0
|
||||
|
||||
endg
|
||||
nsyse4:
|
||||
|
||||
; cmp eax,5 ; SYSTEM LANGUAGE
|
||||
sub eax,2
|
||||
jnz nsyse5
|
||||
mov [syslang],ebx
|
||||
ret
|
||||
|
||||
sub ebx,2 ; SYSTEM LANGUAGE
|
||||
jnz nsyse5
|
||||
mov [syslang],ecx
|
||||
ret
|
||||
nsyse5:
|
||||
|
||||
sub ebx,2 ; HD BASE
|
||||
jnz nsyse7
|
||||
|
||||
; cmp eax,7 ; HD BASE
|
||||
sub eax,2
|
||||
jnz nsyse7
|
||||
test ebx,ebx
|
||||
jz nosethd
|
||||
cmp ebx,4
|
||||
ja nosethd
|
||||
mov [hd_base],bl
|
||||
cmp ebx,1
|
||||
jnz noprmahd
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],1
|
||||
test ecx,ecx
|
||||
jz nosethd
|
||||
|
||||
cmp ecx,4
|
||||
ja nosethd
|
||||
mov [hd_base],cl
|
||||
|
||||
cmp ecx,1
|
||||
jnz noprmahd
|
||||
mov [hdbase],0x1f0
|
||||
and dword [hdid],0x0
|
||||
mov dword [hdpos],ecx
|
||||
; call set_FAT32_variables
|
||||
noprmahd:
|
||||
cmp ebx,2
|
||||
jnz noprslhd
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],2
|
||||
|
||||
cmp ecx,2
|
||||
jnz noprslhd
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov dword [hdpos],ecx
|
||||
; call set_FAT32_variables
|
||||
noprslhd:
|
||||
cmp ebx,3
|
||||
jnz nosemahd
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],3
|
||||
|
||||
cmp ecx,3
|
||||
jnz nosemahd
|
||||
mov [hdbase],0x170
|
||||
and dword [hdid],0x0
|
||||
mov dword [hdpos],ecx
|
||||
; call set_FAT32_variables
|
||||
nosemahd:
|
||||
cmp ebx,4
|
||||
jnz noseslhd
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],4
|
||||
|
||||
cmp ecx,4
|
||||
jnz noseslhd
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov dword [hdpos],ecx
|
||||
; call set_FAT32_variables
|
||||
noseslhd:
|
||||
call reserve_hd1
|
||||
call reserve_hd_channel
|
||||
call free_hd_channel
|
||||
mov [hd1_status],0 ; free
|
||||
call reserve_hd1
|
||||
call reserve_hd_channel
|
||||
call free_hd_channel
|
||||
and dword [hd1_status],0 ; free
|
||||
nosethd:
|
||||
ret
|
||||
ret
|
||||
|
||||
iglobal
|
||||
hd_base db 0
|
||||
@ -1577,43 +1577,42 @@ endg
|
||||
nsyse7:
|
||||
|
||||
; cmp eax,8 ; HD PARTITION
|
||||
dec eax
|
||||
jnz nsyse8
|
||||
mov [fat32part],ebx
|
||||
dec ebx
|
||||
jnz nsyse8
|
||||
mov [fat32part],ecx
|
||||
; call set_FAT32_variables
|
||||
call reserve_hd1
|
||||
call reserve_hd_channel
|
||||
call free_hd_channel
|
||||
pusha
|
||||
call choice_necessity_partition_1
|
||||
popa
|
||||
mov [hd1_status],0 ; free
|
||||
ret
|
||||
call reserve_hd1
|
||||
call reserve_hd_channel
|
||||
call free_hd_channel
|
||||
; pusha
|
||||
call choice_necessity_partition_1
|
||||
; popa
|
||||
and dword [hd1_status],0 ; free
|
||||
ret
|
||||
|
||||
nsyse8:
|
||||
; cmp eax,11 ; ENABLE LBA READ
|
||||
sub eax,3
|
||||
jnz no_set_lba_read
|
||||
and ebx,1
|
||||
mov [lba_read_enabled],ebx
|
||||
ret
|
||||
and ecx,1
|
||||
sub ebx,3
|
||||
jnz no_set_lba_read
|
||||
mov [lba_read_enabled],ecx
|
||||
ret
|
||||
|
||||
no_set_lba_read:
|
||||
; cmp eax,12 ; ENABLE PCI ACCESS
|
||||
dec eax
|
||||
jnz no_set_pci_access
|
||||
and ebx,1
|
||||
mov [pci_access_enabled],ebx
|
||||
ret
|
||||
no_set_pci_access:
|
||||
dec ebx
|
||||
jnz no_set_pci_access
|
||||
mov [pci_access_enabled],ecx
|
||||
ret
|
||||
no_set_pci_access:
|
||||
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
include 'vmodeint.inc'
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
sys_setup_err:
|
||||
mov [esp+36],dword -1
|
||||
ret
|
||||
or [esp+32],dword -1
|
||||
ret
|
||||
|
||||
align 4
|
||||
|
||||
@ -1627,100 +1626,114 @@ sys_getsetup:
|
||||
; 8=fat32 partition in hd
|
||||
; 9=get hs timer tic
|
||||
|
||||
cmp eax,1
|
||||
jne ngsyse1
|
||||
movzx eax,[midi_base]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,1
|
||||
dec ebx
|
||||
jnz ngsyse1
|
||||
movzx eax,[midi_base]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse1:
|
||||
; cmp eax,2
|
||||
dec ebx
|
||||
jnz ngsyse2
|
||||
|
||||
cmp eax,2
|
||||
jne ngsyse2
|
||||
cmp ebx,1
|
||||
jnz kbnobaseret
|
||||
mov edi,[TASK_BASE]
|
||||
add ecx,[edi+TASKDATA.mem_start]
|
||||
mov ebx,ecx
|
||||
mov eax,keymap
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
mov edi,[TASK_BASE]
|
||||
add edi,[edi+TASKDATA.mem_start]
|
||||
mov ebx,edi
|
||||
|
||||
; cmp ebx,1
|
||||
dec ecx
|
||||
jnz kbnobaseret
|
||||
mov eax,keymap
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnobaseret:
|
||||
cmp ebx,2
|
||||
jnz kbnoshiftret
|
||||
mov edi,[TASK_BASE]
|
||||
add ecx,[edi+TASKDATA.mem_start]
|
||||
mov ebx,ecx
|
||||
mov eax,keymap_shift
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
; cmp ebx,2
|
||||
dec ecx
|
||||
jnz kbnoshiftret
|
||||
|
||||
mov eax,keymap_shift
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnoshiftret:
|
||||
cmp ebx,3
|
||||
jne kbnoaltret
|
||||
mov edi,[TASK_BASE]
|
||||
add ecx,[edi+TASKDATA.mem_start]
|
||||
mov ebx,ecx
|
||||
mov eax,keymap_alt
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
; cmp ebx,3
|
||||
dec ecx
|
||||
jne kbnoaltret
|
||||
|
||||
|
||||
|
||||
mov eax,keymap_alt
|
||||
mov ecx,128
|
||||
call memmove
|
||||
ret
|
||||
kbnoaltret:
|
||||
cmp ebx,9
|
||||
jnz ngsyse2
|
||||
movzx eax,word [keyboard]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp ebx,9
|
||||
sub ecx,6
|
||||
jnz ngsyse2
|
||||
movzx eax,word [keyboard]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
|
||||
|
||||
ngsyse2:
|
||||
|
||||
cmp eax,3
|
||||
jnz ngsyse3
|
||||
movzx eax,[cd_base]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,3
|
||||
dec ebx
|
||||
jnz ngsyse3
|
||||
movzx eax,[cd_base]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse3:
|
||||
cmp eax,5
|
||||
jnz ngsyse5
|
||||
mov eax,[syslang]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,5
|
||||
sub ebx,2
|
||||
jnz ngsyse5
|
||||
mov eax,[syslang]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse5:
|
||||
cmp eax,7
|
||||
jnz ngsyse7
|
||||
movzx eax,[hd_base]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,7
|
||||
sub ebx,2
|
||||
jnz ngsyse7
|
||||
movzx eax,[hd_base]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse7:
|
||||
cmp eax,8
|
||||
jnz ngsyse8
|
||||
mov eax,[fat32part]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,8
|
||||
dec ebx
|
||||
jnz ngsyse8
|
||||
mov eax,[fat32part]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse8:
|
||||
cmp eax,9
|
||||
jne ngsyse9
|
||||
mov eax,[timer_ticks] ;[0xfdf0]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,9
|
||||
dec ebx
|
||||
jnz ngsyse9
|
||||
mov eax,[timer_ticks] ;[0xfdf0]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse9:
|
||||
cmp eax,11
|
||||
jnz ngsyse11
|
||||
mov eax,[lba_read_enabled]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,11
|
||||
sub ebx,2
|
||||
jnz ngsyse11
|
||||
mov eax,[lba_read_enabled]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse11:
|
||||
cmp eax,12
|
||||
jnz ngsyse12
|
||||
mov eax,[pci_access_enabled]
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
; cmp eax,12
|
||||
dec ebx
|
||||
jnz ngsyse12
|
||||
mov eax,[pci_access_enabled]
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
ngsyse12:
|
||||
mov [esp+36],dword 1
|
||||
ret
|
||||
mov [esp+32],dword 1
|
||||
ret
|
||||
|
||||
|
||||
get_timer_ticks:
|
||||
mov eax,[timer_ticks]
|
||||
ret
|
||||
mov eax,[timer_ticks]
|
||||
ret
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
@ -1782,12 +1795,12 @@ msz:
|
||||
shl eax,16
|
||||
mov ax,[MOUSE_SCROLL_V]
|
||||
mov [esp+36],eax
|
||||
mov [MOUSE_SCROLL_H],word 0
|
||||
mov [MOUSE_SCROLL_V],word 0
|
||||
and [MOUSE_SCROLL_H],word 0
|
||||
and [MOUSE_SCROLL_V],word 0
|
||||
ret
|
||||
@@:
|
||||
mov [esp+36],dword 0
|
||||
ret
|
||||
and [esp+36],dword 0
|
||||
; ret
|
||||
msset:
|
||||
ret
|
||||
|
||||
@ -1846,67 +1859,56 @@ put_mpu_out:
|
||||
ret
|
||||
|
||||
|
||||
setuart:
|
||||
|
||||
su1:
|
||||
call is_output
|
||||
cmp al,0
|
||||
jnz su1
|
||||
mov dx,word [midisp]
|
||||
mov al,0xff
|
||||
out dx,al
|
||||
su2:
|
||||
mov dx,word [midisp]
|
||||
mov al,0xff
|
||||
out dx,al
|
||||
call is_input
|
||||
cmp al,0
|
||||
jnz su2
|
||||
call get_mpu_in
|
||||
cmp al,0xfe
|
||||
jnz su2
|
||||
su3:
|
||||
call is_output
|
||||
cmp al,0
|
||||
jnz su3
|
||||
mov dx,word [midisp]
|
||||
mov al,0x3f
|
||||
out dx,al
|
||||
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
|
||||
sys_midi:
|
||||
|
||||
cmp [mididp],0
|
||||
jnz sm0
|
||||
mov [esp+36],dword 1
|
||||
ret
|
||||
sm0:
|
||||
|
||||
cmp eax,1
|
||||
mov [esp+36],dword 0
|
||||
jnz smn1
|
||||
call setuart
|
||||
ret
|
||||
smn1:
|
||||
|
||||
cmp eax,2
|
||||
jnz smn2
|
||||
sm10:
|
||||
call get_mpu_in
|
||||
call is_output
|
||||
test al,al
|
||||
jnz sm10
|
||||
mov al,bl
|
||||
call put_mpu_out
|
||||
ret
|
||||
smn2:
|
||||
|
||||
ret
|
||||
|
||||
cmp [mididp],0
|
||||
jnz sm0
|
||||
mov [esp+36],dword 1
|
||||
ret
|
||||
sm0:
|
||||
and [esp+36],dword 0
|
||||
dec ebx
|
||||
jnz smn1
|
||||
; call setuart
|
||||
su1:
|
||||
call is_output
|
||||
test al,al
|
||||
jnz su1
|
||||
mov dx,word [midisp]
|
||||
mov al,0xff
|
||||
out dx,al
|
||||
su2:
|
||||
mov dx,word [midisp]
|
||||
mov al,0xff
|
||||
out dx,al
|
||||
call is_input
|
||||
test al,al
|
||||
jnz su2
|
||||
call get_mpu_in
|
||||
cmp al,0xfe
|
||||
jnz su2
|
||||
su3:
|
||||
call is_output
|
||||
test al,al
|
||||
jnz su3
|
||||
mov dx,word [midisp]
|
||||
mov al,0x3f
|
||||
out dx,al
|
||||
ret
|
||||
smn1:
|
||||
dec ebx
|
||||
jnz smn2
|
||||
sm10:
|
||||
call get_mpu_in
|
||||
call is_output
|
||||
test al,al
|
||||
jnz sm10
|
||||
mov al,bl
|
||||
call put_mpu_out
|
||||
smn2:
|
||||
ret
|
||||
|
||||
detect_devices:
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
@ -1918,7 +1920,6 @@ detect_devices:
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
ret
|
||||
|
||||
|
||||
sys_end:
|
||||
|
||||
mov ecx, [current_slot]
|
||||
@ -2531,8 +2532,8 @@ nosb7:
|
||||
ret
|
||||
|
||||
force_redraw_background:
|
||||
mov [draw_data+32 + RECT.left],dword 0
|
||||
mov [draw_data+32 + RECT.top],dword 0
|
||||
and [draw_data+32 + RECT.left],dword 0
|
||||
and [draw_data+32 + RECT.top],dword 0
|
||||
push eax ebx
|
||||
mov eax,[Screen_Max_X]
|
||||
mov ebx,[Screen_Max_Y]
|
||||
@ -3819,7 +3820,7 @@ delay_hs: ; delay in 1/100 secs
|
||||
|
||||
ret
|
||||
|
||||
|
||||
align 16 ;very often call this subrutine
|
||||
memmove: ; memory move in bytes
|
||||
|
||||
; eax = from
|
||||
@ -3828,7 +3829,6 @@ memmove: ; memory move in bytes
|
||||
test ecx, ecx
|
||||
jle .ret
|
||||
|
||||
|
||||
push esi edi ecx
|
||||
|
||||
mov edi, ebx
|
||||
@ -5065,7 +5065,7 @@ sys_gs: ; direct screen access
|
||||
ret
|
||||
no_gs3:
|
||||
|
||||
mov [esp+36],dword -1
|
||||
or [esp+36],dword -1
|
||||
ret
|
||||
|
||||
|
||||
|
@ -24,15 +24,16 @@ uglobal
|
||||
old_screen_height dd ?
|
||||
endg
|
||||
|
||||
cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS
|
||||
jne .no_vmode_drv_access
|
||||
; cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS
|
||||
dec ebx
|
||||
jnz .no_vmode_drv_access
|
||||
pushd [Screen_Max_X] [Screen_Max_Y]
|
||||
popd [old_screen_height] [old_screen_width]
|
||||
or eax,-1 ; If driver is absent then eax does not change
|
||||
call (VMODE_BASE+0x100) ; Entry point of video driver
|
||||
mov [esp+36],eax
|
||||
mov [esp+24],ebx
|
||||
mov [esp+32],ecx
|
||||
mov [esp+36-4],eax
|
||||
mov [esp+24-4],ebx
|
||||
mov [esp+32-4],ecx
|
||||
; mov [esp+28],edx
|
||||
mov eax,[old_screen_width]
|
||||
mov ebx,[old_screen_height]
|
||||
@ -46,8 +47,8 @@ endg
|
||||
sub [screen_workarea.bottom],ebx
|
||||
|
||||
call repos_windows
|
||||
mov eax, 0
|
||||
mov ebx, 0
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov ecx, [Screen_Max_X]
|
||||
mov edx, [Screen_Max_Y]
|
||||
call calculatescreen
|
||||
|
Loading…
Reference in New Issue
Block a user