mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-17 04:12:34 +03:00
Removed file/folder
git-svn-id: svn://kolibrios.org@456 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0305115a3b
commit
298b39f497
@ -1,554 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;**********************************************************
|
||||
; Непосредственная работа с устройством СD (ATAPI)
|
||||
;**********************************************************
|
||||
; Автор исходного текста Кулаков Владимир Геннадьевич.
|
||||
; Адаптация и доработка Mario79
|
||||
|
||||
; Процедура для полного считывания всех
|
||||
; данных из сектора компакт-диска
|
||||
; Автор текста программы Кулаков Владимир Геннадьевич.
|
||||
|
||||
|
||||
; Максимальное количество повторений операции чтения
|
||||
MaxRetr equ 3
|
||||
; Предельное время ожидания готовности к приему команды
|
||||
; (в тиках)
|
||||
BSYWaitTime equ 1000 ;2
|
||||
|
||||
;*************************************************
|
||||
;* ПОЛНОЕ ЧТЕНИЕ СЕКТОРА КОМПАКТ-ДИСКА *
|
||||
;* Считываются данные пользователя, информация *
|
||||
;* субканала и контрольная информация *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* перменные: *
|
||||
;* 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
|
||||
; call test_mario79
|
||||
popa
|
||||
ret
|
||||
|
||||
;********************************************
|
||||
;* ЧТЕНИЕ СЕКТОРА С ПОВТОРАМИ *
|
||||
;* Многократное повторение чтения при сбоях *
|
||||
;********************************************
|
||||
ReadCDWRetr:
|
||||
pusha
|
||||
; Цикл, пока команда не выполнена успешно или не
|
||||
; исчерпано количество попыток
|
||||
mov ECX,MaxRetr
|
||||
@@NextRetr:
|
||||
; Подать команду
|
||||
call ReadCD
|
||||
cmp [DevErrorCode],0
|
||||
je @@End_4
|
||||
; Задержка на 2,5 секунды
|
||||
mov EAX,[timer_ticks]
|
||||
add EAX,250 ;50
|
||||
@@Wait:
|
||||
call change_task
|
||||
cmp EAX,[timer_ticks]
|
||||
ja @@Wait
|
||||
loop @@NextRetr
|
||||
; call test_mario79
|
||||
; Сообщение об ошибке
|
||||
; mov SI,offset ErrS
|
||||
; call FatalError
|
||||
@@End_4:
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
; Универсальные процедуры, обеспечивающие выполнение
|
||||
; пакетных команд в режиме PIO
|
||||
;
|
||||
; Автор текста программы Кулаков Владимир Геннадьевич.
|
||||
|
||||
; Максимально допустимое время ожидания реакции
|
||||
; устройства на пакетную команду (в тиках)
|
||||
MaxCDWaitTime equ 1000 ;200 ;10 секунд
|
||||
|
||||
; Область памяти для формирования пакетной команды
|
||||
PacketCommand: rb 12 ;DB 12 DUP (?)
|
||||
; Область памяти для приема данных от дисковода
|
||||
;CDDataBuf DB 4096 DUP (0)
|
||||
; Размер принимаемого блока данных в байтах
|
||||
CDBlockSize DW ?
|
||||
; Адрес считываемого сектора данных
|
||||
CDSectorAddress: DD ?
|
||||
; Время начала очередной операции с диском
|
||||
TickCounter_1 DD 0
|
||||
; Время начала ожидания готовности устройства
|
||||
WURStartTime DD 0
|
||||
; указатель буфера для считывания
|
||||
CDDataBuf_pointer dd 0
|
||||
|
||||
;****************************************************
|
||||
;* ПОСЛАТЬ УСТРОЙСТВУ ATAPI ПАКЕТНУЮ КОМАНДУ, *
|
||||
;* ПРЕДУСМАТРИВАЮЩУЮ ПЕРЕДАЧУ ОДНОГО СЕКТОРА ДАННЫХ *
|
||||
;* РАЗМЕРОМ 2048 БАЙТ ОТ УСТРОЙСТВА К ХОСТУ *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* перменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале; *
|
||||
;* PacketCommand - 12-байтный командный пакет; *
|
||||
;* CDBlockSize - размер принимаемого блока данных. *
|
||||
;****************************************************
|
||||
SendPacketDatCommand:
|
||||
pushad
|
||||
; Задать режим CHS
|
||||
mov [ATAAddressMode],0
|
||||
; Послать ATA-команду передачи пакетной команды
|
||||
mov [ATAFeatures],0
|
||||
mov [ATASectorCount],0
|
||||
mov [ATASectorNumber],0
|
||||
; Загрузить размер передаваемого блока
|
||||
mov AX,[CDBlockSize]
|
||||
mov [ATACylinder],AX
|
||||
mov [ATAHead],0
|
||||
mov [ATACommand],0A0h
|
||||
call SendCommandToHDD_1
|
||||
; call test_mario79
|
||||
cmp [DevErrorCode],0 ;проверить код ошибки
|
||||
jne @@End_8 ;закончить, сохранив код ошибки
|
||||
|
||||
; Ожидание готовности дисковода к приему
|
||||
; пакетной команды
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
@@WaitDevice0:
|
||||
call change_task
|
||||
; Проверить время выполнения команды
|
||||
mov EAX,[timer_ticks]
|
||||
sub EAX,[TickCounter_1]
|
||||
cmp EAX,BSYWaitTime
|
||||
ja @@Err1_1 ;ошибка тайм-аута
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
jnz @@WaitDevice0
|
||||
test AL,1 ;состояние сигнала ERR
|
||||
jnz @@Err6
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitDevice0
|
||||
; Послать пакетную команду
|
||||
cli
|
||||
mov DX,[ATABasePortAddr]
|
||||
mov AX,[PacketCommand]
|
||||
out DX,AX
|
||||
mov AX,[PacketCommand+2]
|
||||
out DX,AX
|
||||
mov AX,[PacketCommand+4]
|
||||
out DX,AX
|
||||
mov AX,[PacketCommand+6]
|
||||
out DX,AX
|
||||
mov AX,[PacketCommand+8]
|
||||
out DX,AX
|
||||
mov AX,[PacketCommand+10]
|
||||
out DX,AX
|
||||
sti
|
||||
; Ожидание готовности данных
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
@@WaitDevice1:
|
||||
call change_task
|
||||
; Проверить время выполнения команды
|
||||
mov EAX,[timer_ticks]
|
||||
sub EAX,[TickCounter_1]
|
||||
cmp EAX,MaxCDWaitTime
|
||||
ja @@Err1_1 ;ошибка тайм-аута
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
jnz @@WaitDevice1
|
||||
test AL,1 ;состояние сигнала ERR
|
||||
jnz @@Err6_temp
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitDevice1
|
||||
cli
|
||||
; Принять блок данных от контроллера
|
||||
mov EDI,[CDDataBuf_pointer] ;0x7000 ;CDDataBuf
|
||||
; Загрузить адрес регистра данных контроллера
|
||||
mov DX,[ATABasePortAddr] ;порт 1x0h
|
||||
; Загрузить в счетчик размер блока в байтах
|
||||
mov CX,[CDBlockSize]
|
||||
; Вычислить размер блока в 16-разрядных словах
|
||||
shr CX,1 ;разделить размер блока на 2
|
||||
; Принять блок данных
|
||||
cld
|
||||
rep insw
|
||||
sti
|
||||
; Успешное завершение приема данных
|
||||
jmp @@End_8
|
||||
|
||||
; Записать код ошибки
|
||||
@@Err1_1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_8
|
||||
@@Err6_temp:
|
||||
mov [DevErrorCode],7
|
||||
jmp @@End_8
|
||||
@@Err6:
|
||||
mov [DevErrorCode],6
|
||||
|
||||
@@End_8:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;***********************************************
|
||||
;* ПОСЛАТЬ УСТРОЙСТВУ ATAPI ПАКЕТНУЮ КОМАНДУ, *
|
||||
;* НЕ ПРЕДУСМАТРИВАЮЩУЮ ПЕРЕДАЧИ ДАННЫХ *
|
||||
;* Входные параметры передаются через *
|
||||
;* глобальные перменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале; *
|
||||
;* PacketCommand - 12-байтный командный пакет. *
|
||||
;***********************************************
|
||||
SendPacketNoDatCommand:
|
||||
pushad
|
||||
; Задать режим CHS
|
||||
mov [ATAAddressMode],0
|
||||
; Послать ATA-команду передачи пакетной команды
|
||||
mov [ATAFeatures],0
|
||||
mov [ATASectorCount],0
|
||||
mov [ATASectorNumber],0
|
||||
mov [ATACylinder],0
|
||||
mov [ATAHead],0
|
||||
mov [ATACommand],0A0h
|
||||
call SendCommandToHDD_1
|
||||
cmp [DevErrorCode],0 ;проверить код ошибки
|
||||
jne @@End_9 ;закончить, сохранив код ошибки
|
||||
; Ожидание готовности дисковода к приему
|
||||
; пакетной команды
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
@@WaitDevice0_1:
|
||||
call change_task
|
||||
; Проверить время ожидания
|
||||
mov EAX,[timer_ticks]
|
||||
sub EAX,[TickCounter_1]
|
||||
cmp EAX,BSYWaitTime
|
||||
ja @@Err1_3 ;ошибка тайм-аута
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
jnz @@WaitDevice0_1
|
||||
test AL,1 ;состояние сигнала ERR
|
||||
jnz @@Err6_1
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitDevice0_1
|
||||
; Послать пакетную команду
|
||||
; cli
|
||||
mov DX,[ATABasePortAddr]
|
||||
mov AX,word [PacketCommand]
|
||||
out DX,AX
|
||||
mov AX,word [PacketCommand+2]
|
||||
out DX,AX
|
||||
mov AX,word [PacketCommand+4]
|
||||
out DX,AX
|
||||
mov AX,word [PacketCommand+6]
|
||||
out DX,AX
|
||||
mov AX,word [PacketCommand+8]
|
||||
out DX,AX
|
||||
mov AX,word [PacketCommand+10]
|
||||
out DX,AX
|
||||
; sti
|
||||
; Ожидание подтверждения приема команды
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
@@WaitDevice1_1:
|
||||
call change_task
|
||||
; Проверить время выполнения команды
|
||||
mov EAX,[timer_ticks]
|
||||
sub EAX,[TickCounter_1]
|
||||
cmp EAX,MaxCDWaitTime
|
||||
ja @@Err1_3 ;ошибка тайм-аута
|
||||
; Ожидать освобождения устройства
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
jnz @@WaitDevice1_1
|
||||
test AL,1 ;состояние сигнала ERR
|
||||
jnz @@Err6_1
|
||||
test AL,40h ;состояние сигнала DRDY
|
||||
jz @@WaitDevice1_1
|
||||
jmp @@End_9
|
||||
|
||||
; Записать код ошибки
|
||||
@@Err1_3:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_9
|
||||
@@Err6_1:
|
||||
mov [DevErrorCode],6
|
||||
@@End_9:
|
||||
popad
|
||||
ret
|
||||
|
||||
;****************************************************
|
||||
;* ПОСЛАТЬ КОМАНДУ ЗАДАННОМУ ДИСКУ *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* переменные: *
|
||||
;* ChannelNumber - номер канала (1 или 2); *
|
||||
;* DiskNumber - номер диска (0 или 1); *
|
||||
;* ATAFeatures - "особенности"; *
|
||||
;* ATASectorCount - количество секторов; *
|
||||
;* ATASectorNumber - номер начального сектора; *
|
||||
;* ATACylinder - номер начального цилиндра; *
|
||||
;* ATAHead - номер начальной головки; *
|
||||
;* ATAAddressMode - режим адресации (0-CHS, 1-LBA); *
|
||||
;* ATACommand - код команды. *
|
||||
;* После успешного выполнения функции: *
|
||||
;* в ATABasePortAddr - базовый адрес HDD; *
|
||||
;* в DevErrorCode - ноль. *
|
||||
;* При возникновении ошибки в DevErrorCode будет *
|
||||
;* возвращен код ошибки. *
|
||||
;****************************************************
|
||||
SendCommandToHDD_1:
|
||||
pushad
|
||||
; Проверить значение кода режима
|
||||
cmp [ATAAddressMode],1
|
||||
ja @@Err2_4
|
||||
; Проверить корректность номера канала
|
||||
mov BX,[ChannelNumber]
|
||||
cmp BX,1
|
||||
jb @@Err3_4
|
||||
cmp BX,2
|
||||
ja @@Err3_4
|
||||
; Установить базовый адрес
|
||||
dec BX
|
||||
shl BX,1
|
||||
movzx ebx,bx
|
||||
mov AX,[ebx+StandardATABases]
|
||||
mov [ATABasePortAddr],AX
|
||||
; Ожидание готовности HDD к приему команды
|
||||
; Выбрать нужный диск
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,6 ;адрес регистра головок
|
||||
mov AL,[DiskNumber]
|
||||
cmp AL,1 ;проверить номера диска
|
||||
ja @@Err4_4
|
||||
shl AL,4
|
||||
or AL,10100000b
|
||||
out DX,AL
|
||||
; Ожидать, пока диск не будет готов
|
||||
inc DX
|
||||
; mov ecx,0xfff
|
||||
mov eax,[timer_ticks]
|
||||
mov [TickCounter_1],eax
|
||||
@@WaitHDReady_2:
|
||||
call change_task
|
||||
; Проверить время ожидания
|
||||
; dec ecx
|
||||
; cmp ecx,0
|
||||
; je @@Err1
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[TickCounter_1]
|
||||
cmp eax,BSYWaitTime ;300 ;ожидать 3 сек.
|
||||
ja @@Err1_4 ;ошибка тайм-аута
|
||||
; Прочитать регистр состояния
|
||||
in AL,DX
|
||||
; Проверить состояние сигнала BSY
|
||||
test AL,80h
|
||||
jnz @@WaitHDReady_2
|
||||
; Проверить состояние сигнала DRQ
|
||||
test AL,08h
|
||||
jnz @@WaitHDReady_2
|
||||
; Загрузить команду в регистры контроллера
|
||||
cli
|
||||
mov DX,[ATABasePortAddr]
|
||||
inc DX ;регистр "особенностей"
|
||||
mov AL,[ATAFeatures]
|
||||
out DX,AL
|
||||
inc DX ;счетчик секторов
|
||||
mov AL,[ATASectorCount]
|
||||
out DX,AL
|
||||
inc DX ;регистр номера сектора
|
||||
mov AL,[ATASectorNumber]
|
||||
out DX,AL
|
||||
inc DX ;номер цилиндра (младший байт)
|
||||
mov AX,[ATACylinder]
|
||||
out DX,AL
|
||||
inc DX ;номер цилиндра (старший байт)
|
||||
mov AL,AH
|
||||
out DX,AL
|
||||
inc DX ;номер головки/номер диска
|
||||
mov AL,[DiskNumber]
|
||||
shl AL,4
|
||||
cmp [ATAHead],0Fh ;проверить номер головки
|
||||
ja @@Err5_4
|
||||
or AL,[ATAHead]
|
||||
or AL,10100000b
|
||||
mov AH,[ATAAddressMode]
|
||||
shl AH,6
|
||||
or AL,AH
|
||||
out DX,AL
|
||||
; Послать команду
|
||||
mov AL,[ATACommand]
|
||||
inc DX ;регистр команд
|
||||
out DX,AL
|
||||
sti
|
||||
; Сбросить признак ошибки
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_10
|
||||
; Записать код ошибки
|
||||
@@Err1_4:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_10
|
||||
@@Err2_4:
|
||||
mov [DevErrorCode],2
|
||||
jmp @@End_10
|
||||
@@Err3_4:
|
||||
mov [DevErrorCode],3
|
||||
jmp @@End_10
|
||||
@@Err4_4:
|
||||
mov [DevErrorCode],4
|
||||
jmp @@End_10
|
||||
@@Err5_4:
|
||||
mov [DevErrorCode],5
|
||||
; Завершение работы программы
|
||||
@@End_10:
|
||||
sti
|
||||
popad
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ОЖИДАНИЕ ГОТОВНОСТИ УСТРОЙСТВА К РАБОТЕ *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* перменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале. *
|
||||
;*************************************************
|
||||
WaitUnitReady:
|
||||
pusha
|
||||
; Запомнить время начала операции
|
||||
mov EAX,[timer_ticks]
|
||||
mov [WURStartTime],EAX
|
||||
; Очистить буфер пакетной команды
|
||||
call clear_packet_buffer
|
||||
; Сформировать команду TEST UNIT READY
|
||||
mov [PacketCommand],word 00h
|
||||
; ЦИКЛ ОЖИДАНИЯ ГОТОВНОСТИ УСТРОЙСТВА
|
||||
@@SendCommand:
|
||||
; Подать команду проверки готовности
|
||||
call SendPacketNoDatCommand
|
||||
call change_task
|
||||
; Проверить код ошибки
|
||||
cmp [DevErrorCode],0
|
||||
je @@End_11
|
||||
; Проверить время ожидания готовности
|
||||
mov EAX,[timer_ticks]
|
||||
sub EAX,[WURStartTime]
|
||||
cmp EAX,MaxCDWaitTime
|
||||
jb @@SendCommand
|
||||
; Ошибка тайм-аута
|
||||
mov [DevErrorCode],1
|
||||
@@End_11:
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
;*************************************************
|
||||
;* ЗАГРУЗИТЬ НОСИТЕЛЬ В ДИСКОВОД *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* перменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале. *
|
||||
;*************************************************
|
||||
LoadMedium:
|
||||
pusha
|
||||
; Очистить буфер пакетной команды
|
||||
call clear_packet_buffer
|
||||
; Сформировать команду START/STOP UNIT
|
||||
; Задать код команды
|
||||
mov [PacketCommand],word 1Bh
|
||||
; Задать операцию загрузки носителя
|
||||
mov [PacketCommand+4],word 00000011b
|
||||
; Подать команду
|
||||
call SendPacketNoDatCommand
|
||||
popa
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ИЗВЛЕЧЬ НОСИТЕЛЬ ИЗ ДИСКОВОДА *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* перменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале. *
|
||||
;*************************************************
|
||||
UnloadMedium:
|
||||
pusha
|
||||
; Очистить буфер пакетной команды
|
||||
call clear_packet_buffer
|
||||
; Сформировать команду START/STOP UNIT
|
||||
; Задать код команды
|
||||
mov [PacketCommand],word 1Bh
|
||||
; Задать операцию извлечения носителя
|
||||
mov [PacketCommand+4],word 00000010b
|
||||
; Подать команду
|
||||
call SendPacketNoDatCommand
|
||||
popa
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ОПРЕДЕЛИТЬ ОБЩЕЕ КОЛИЧЕСТВО СЕКТОРОВ НА ДИСКЕ *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* переменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале. *
|
||||
;*************************************************
|
||||
ReadCapacity:
|
||||
pusha
|
||||
; Очистить буфер пакетной команды
|
||||
call clear_packet_buffer
|
||||
; Задать размер буфера в байтах
|
||||
mov [CDBlockSize],8
|
||||
; Сформировать команду READ CAPACITY
|
||||
mov [PacketCommand],word 25h
|
||||
; Подать команду
|
||||
call SendPacketDatCommand
|
||||
popa
|
||||
ret
|
||||
|
||||
clear_packet_buffer:
|
||||
; Очистить буфер пакетной команды
|
||||
mov [PacketCommand],dword 0
|
||||
mov [PacketCommand+4],dword 0
|
||||
mov [PacketCommand+8],dword 0
|
||||
ret
|
||||
|
@ -1,269 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
sys_cd_audio:
|
||||
|
||||
cmp word [cdbase],word 0
|
||||
jnz @f
|
||||
mov eax,1
|
||||
ret
|
||||
@@:
|
||||
|
||||
; eax=1 cdplay at ebx 0x00FFSSMM
|
||||
; eax=2 get tracklist size of ecx to [ebx]
|
||||
; eax=3 stop/pause playing
|
||||
|
||||
cmp eax,1
|
||||
jnz nocdp
|
||||
call sys_cdplay
|
||||
ret
|
||||
nocdp:
|
||||
|
||||
cmp eax,2
|
||||
jnz nocdtl
|
||||
mov edi,[TASK_BASE]
|
||||
add edi,TASKDATA.mem_start
|
||||
add ebx,[edi]
|
||||
call sys_cdtracklist
|
||||
ret
|
||||
nocdtl:
|
||||
|
||||
cmp eax,3
|
||||
jnz nocdpause
|
||||
call sys_cdpause
|
||||
ret
|
||||
nocdpause:
|
||||
|
||||
mov eax,0xffffff01
|
||||
ret
|
||||
|
||||
|
||||
|
||||
sys_cd_atapi_command:
|
||||
|
||||
pushad
|
||||
|
||||
mov dx,word [cdbase]
|
||||
add dx,6
|
||||
mov ax,word [cdid]
|
||||
out dx,al
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
in al,dx
|
||||
and al,0x80
|
||||
cmp al,0
|
||||
jnz res
|
||||
jmp cdl6
|
||||
res:
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
mov al,0x8
|
||||
out dx,al
|
||||
mov dx,word [cdbase]
|
||||
add dx,0x206
|
||||
mov al,0xe
|
||||
out dx,al
|
||||
mov esi,1
|
||||
call delay_ms
|
||||
mov dx,word [cdbase]
|
||||
add dx,0x206
|
||||
mov al,0x8
|
||||
out dx,al
|
||||
mov esi,30
|
||||
call delay_ms
|
||||
xor cx,cx
|
||||
cdl5:
|
||||
inc cx
|
||||
cmp cx,10
|
||||
jz cdl6
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
in al,dx
|
||||
and al,0x88
|
||||
cmp al,0x00
|
||||
jz cdl5
|
||||
mov esi,100
|
||||
call delay_ms
|
||||
jmp cdl5
|
||||
cdl6:
|
||||
mov dx,word [cdbase]
|
||||
add dx,4
|
||||
mov al,0
|
||||
out dx,al
|
||||
mov dx,word [cdbase]
|
||||
add dx,5
|
||||
mov al,0
|
||||
out dx,al
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
mov al,0xec
|
||||
out dx,al
|
||||
mov esi,5
|
||||
call delay_ms
|
||||
mov dx,word [cdbase]
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,128
|
||||
out dx,al
|
||||
add dx,2
|
||||
mov al,0xa0
|
||||
out dx,al
|
||||
xor cx,cx
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
cdl1:
|
||||
inc cx
|
||||
cmp cx,100
|
||||
jz cdl2
|
||||
in al,dx
|
||||
and ax,0x88
|
||||
cmp al,0x8
|
||||
jz cdl2
|
||||
mov esi,2
|
||||
call delay_ms
|
||||
jmp cdl1
|
||||
cdl2:
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
sys_cdplay:
|
||||
|
||||
mov ax,5
|
||||
push ax
|
||||
push ebx
|
||||
cdplay:
|
||||
call sys_cd_atapi_command
|
||||
cli
|
||||
mov dx,word [cdbase]
|
||||
mov ax,0x0047
|
||||
out dx,ax
|
||||
mov al,1
|
||||
mov ah,[esp+0] ; min xx
|
||||
out dx,ax
|
||||
mov ax,[esp+1] ; fr sec
|
||||
out dx,ax
|
||||
mov ax,256+99
|
||||
out dx,ax
|
||||
mov ax,0x0001
|
||||
out dx,ax
|
||||
mov ax,0x0000
|
||||
out dx,ax
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
sti
|
||||
add dx,7
|
||||
in al,dx
|
||||
test al,1
|
||||
jz cdplayok
|
||||
mov ax,[esp+4]
|
||||
dec ax
|
||||
mov [esp+4],ax
|
||||
cmp ax,0
|
||||
jz cdplayfail
|
||||
jmp cdplay
|
||||
cdplayfail:
|
||||
cdplayok:
|
||||
pop ebx
|
||||
pop ax
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
||||
sys_cdtracklist:
|
||||
|
||||
push ebx
|
||||
tcdplay:
|
||||
call sys_cd_atapi_command
|
||||
mov dx,word [cdbase]
|
||||
mov ax,0x43+2*256
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
mov ax,200
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
in al,dx
|
||||
mov cx,1000
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
cld
|
||||
cdtrnwewait:
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
in al,dx
|
||||
and al,128
|
||||
cmp al,0
|
||||
jz cdtrl1
|
||||
loop cdtrnwewait
|
||||
cdtrl1:
|
||||
; read the result
|
||||
mov ecx,[esp+0]
|
||||
mov dx,word [cdbase]
|
||||
cdtrread:
|
||||
add dx,7
|
||||
in al,dx
|
||||
and al,8
|
||||
cmp al,8
|
||||
jnz cdtrdone
|
||||
sub dx,7
|
||||
in ax,dx
|
||||
mov [ecx],ax
|
||||
add ecx,2
|
||||
jmp cdtrread
|
||||
cdtrdone:
|
||||
pop ecx
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
||||
sys_cdpause:
|
||||
|
||||
call sys_cd_atapi_command
|
||||
|
||||
mov dx,word [cdbase]
|
||||
mov ax,0x004B
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
add dx,7
|
||||
in al,dx
|
||||
|
||||
xor eax, eax
|
||||
ret
|
||||
|
@ -1,82 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
iglobal
|
||||
;function pointers.
|
||||
fdc_irq_func dd fdc_null
|
||||
endg
|
||||
|
||||
uglobal
|
||||
dmasize db 0x0
|
||||
dmamode db 0x0
|
||||
endg
|
||||
|
||||
fdc_init: ;start with clean tracks.
|
||||
mov edi,OS_BASE+0xD201
|
||||
mov al,0
|
||||
mov ecx,160
|
||||
rep stosb
|
||||
ret
|
||||
|
||||
fdc_filesave: ;ebx: cluster to be saved.
|
||||
pusha ;returns immediately. does not trigger a write.
|
||||
mov eax,ebx
|
||||
add eax,31
|
||||
mov bl,18
|
||||
div bl
|
||||
mov ah,0
|
||||
add eax,OS_BASE+0xD201
|
||||
mov [eax],byte 1 ;This track is now dirty.
|
||||
popa
|
||||
ret
|
||||
|
||||
fdc_irq:
|
||||
call [fdc_irq_func]
|
||||
fdc_null:
|
||||
ret
|
||||
|
||||
save_image:
|
||||
call reserve_flp
|
||||
call restorefatchain
|
||||
pusha
|
||||
call check_label
|
||||
cmp [FDC_Status],0
|
||||
jne unnecessary_save_image
|
||||
mov [FDD_Track],0 ; Öèëèíäð
|
||||
mov [FDD_Head],0 ; Ñòîðîíà
|
||||
mov [FDD_Sector],1 ; Ñåêòîð
|
||||
mov esi,RAMDISK
|
||||
call SeekTrack
|
||||
save_image_1:
|
||||
push esi
|
||||
call take_data_from_application_1
|
||||
pop esi
|
||||
add esi,512
|
||||
call WriteSectWithRetr
|
||||
; call WriteSector
|
||||
cmp [FDC_Status],0
|
||||
jne unnecessary_save_image
|
||||
inc [FDD_Sector]
|
||||
cmp [FDD_Sector],19
|
||||
jne save_image_1
|
||||
mov [FDD_Sector],1
|
||||
inc [FDD_Head]
|
||||
cmp [FDD_Head],2
|
||||
jne save_image_1
|
||||
mov [FDD_Head],0
|
||||
inc [FDD_Track]
|
||||
call SeekTrack
|
||||
cmp [FDD_Track],80
|
||||
jne save_image_1
|
||||
unnecessary_save_image:
|
||||
mov [fdc_irq_func],fdc_null
|
||||
popa
|
||||
mov [flp_status],0
|
||||
ret
|
||||
|
@ -1,623 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;**********************************************************
|
||||
; Непосредственная работа с контроллером гибкого диска
|
||||
;**********************************************************
|
||||
; Автор исходного текста Кулаков Владимир Геннадьевич.
|
||||
; Адаптация и доработка Mario79
|
||||
|
||||
give_back_application_data: ; переслать приложению
|
||||
mov edi,[TASK_BASE]
|
||||
mov edi,[edi+TASKDATA.mem_start]
|
||||
add edi,ecx
|
||||
give_back_application_data_1:
|
||||
mov esi,FDD_BUFF ;FDD_DataBuffer ;0x40000
|
||||
xor ecx,ecx
|
||||
mov cx,128
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
|
||||
take_data_from_application: ; взять из приложени
|
||||
mov esi,[TASK_BASE]
|
||||
mov esi,[esi+TASKDATA.mem_start]
|
||||
add esi,ecx
|
||||
take_data_from_application_1:
|
||||
mov edi,FDD_BUFF ;FDD_DataBuffer ;0x40000
|
||||
xor ecx,ecx
|
||||
mov cx,128
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
|
||||
; Коды завершения операции с контроллером (FDC_Status)
|
||||
FDC_Normal equ 0 ;нормальное завершение
|
||||
FDC_TimeOut equ 1 ;ошибка тайм-аута
|
||||
FDC_DiskNotFound equ 2 ;в дисководе нет диска
|
||||
FDC_TrackNotFound equ 3 ;дорожка не найдена
|
||||
FDC_SectorNotFound equ 4 ;сектор не найден
|
||||
|
||||
; Максимальные значения координат сектора (заданные
|
||||
; значения соответствуют параметрам стандартного
|
||||
; трехдюймового гибкого диска объемом 1,44 Мб)
|
||||
MAX_Track equ 79
|
||||
MAX_Head equ 1
|
||||
MAX_Sector equ 18
|
||||
|
||||
uglobal
|
||||
; Счетчик тиков таймера
|
||||
TickCounter dd ?
|
||||
; Код завершения операции с контроллером НГМД
|
||||
FDC_Status DB ?
|
||||
; Флаг прерывания от НГМД
|
||||
FDD_IntFlag DB ?
|
||||
; Момент начала последней операции с НГМД
|
||||
FDD_Time DD ?
|
||||
; Номер дисковода
|
||||
FDD_Type db 0
|
||||
; Координаты сектора
|
||||
FDD_Track DB ?
|
||||
FDD_Head DB ?
|
||||
FDD_Sector DB ?
|
||||
|
||||
; Блок результата операции
|
||||
FDC_ST0 DB ?
|
||||
FDC_ST1 DB ?
|
||||
FDC_ST2 DB ?
|
||||
FDC_C DB ?
|
||||
FDC_H DB ?
|
||||
FDC_R DB ?
|
||||
FDC_N DB ?
|
||||
; Счетчик повторения операции чтени
|
||||
ReadRepCounter DB ?
|
||||
; Счетчик повторения операции рекалибровки
|
||||
RecalRepCounter DB ?
|
||||
endg
|
||||
; Область памяти для хранения прочитанного сектора
|
||||
;FDD_DataBuffer: times 512 db 0 ;DB 512 DUP (?)
|
||||
fdd_motor_status db 0
|
||||
timer_fdd_motor dd 0
|
||||
|
||||
;*************************************
|
||||
;* ИНИЦИАЛИЗАЦИЯ РЕЖИМА ПДП ДЛЯ НГМД *
|
||||
;*************************************
|
||||
Init_FDC_DMA:
|
||||
pushad
|
||||
mov al,0
|
||||
out 0x0c,al ; reset the flip-flop to a known state.
|
||||
mov al,6 ; mask channel 2 so we can reprogram it.
|
||||
out 0x0a,al
|
||||
mov al,[dmamode] ; 0x46 -> Read from floppy - 0x4A Write to floppy
|
||||
out 0x0b,al
|
||||
mov al,0
|
||||
out 0x0c,al ; reset the flip-flop to a known state.
|
||||
mov eax,0xD000
|
||||
out 0x04,al ; set the channel 2 starting address to 0
|
||||
shr eax,8
|
||||
out 0x04,al
|
||||
shr eax,8
|
||||
out 0x81,al
|
||||
mov al,0
|
||||
out 0x0c, al ; reset flip-flop
|
||||
mov al, 0xff ;set count (actual size -1)
|
||||
out 0x5, al
|
||||
mov al,0x1 ;[dmasize] ;(0x1ff = 511 / 0x23ff =9215)
|
||||
out 0x5,al
|
||||
mov al,2
|
||||
out 0xa,al
|
||||
popad
|
||||
ret
|
||||
|
||||
;***********************************
|
||||
;* ЗАПИСАТЬ БАЙТ В ПОРТ ДАННЫХ FDC *
|
||||
;* Параметры: *
|
||||
;* AL - выводимый байт. *
|
||||
;***********************************
|
||||
FDCDataOutput:
|
||||
; pusha
|
||||
push eax ecx edx
|
||||
mov AH,AL ;запомнить байт в AH
|
||||
; Сбросить переменную состояния контроллера
|
||||
mov [FDC_Status],FDC_Normal
|
||||
; Проверить готовность контроллера к приему данных
|
||||
mov DX,3F4h ;(порт состояния FDC)
|
||||
mov ecx, 0x10000 ;установить счетчик тайм-аута
|
||||
@@TestRS:
|
||||
in AL,DX ;прочитать регистр RS
|
||||
and AL,0C0h ;выделить разряды 6 и 7
|
||||
cmp AL,80h ;проверить разряды 6 и 7
|
||||
je @@OutByteToFDC
|
||||
loop @@TestRS
|
||||
; Ошибка тайм-аута
|
||||
mov [FDC_Status],FDC_TimeOut
|
||||
jmp @@End_5
|
||||
; Вывести байт в порт данных
|
||||
@@OutByteToFDC:
|
||||
inc DX
|
||||
mov AL,AH
|
||||
out DX,AL
|
||||
@@End_5:
|
||||
; popa
|
||||
pop edx ecx eax
|
||||
ret
|
||||
|
||||
;******************************************
|
||||
;* ПРОЧИТАТЬ БАЙТ ИЗ ПОРТА ДАННЫХ FDC *
|
||||
;* Процедура не имеет входных параметров. *
|
||||
;* Выходные данные: *
|
||||
;* AL - считанный байт. *
|
||||
;******************************************
|
||||
FDCDataInput:
|
||||
push ECX
|
||||
push DX
|
||||
; Сбросить переменную состояния контроллера
|
||||
mov [FDC_Status],FDC_Normal
|
||||
; Проверить готовность контроллера к передаче данных
|
||||
mov DX,3F4h ;(порт состояния FDC)
|
||||
xor CX,CX ;установить счетчик тайм-аута
|
||||
@@TestRS_1:
|
||||
in AL,DX ;прочитать регистр RS
|
||||
and AL,0C0h ;выдлить разряды 6 и 7
|
||||
cmp AL,0C0h ;проверить разряды 6 и 7
|
||||
je @@GetByteFromFDC
|
||||
loop @@TestRS_1
|
||||
; Ошибка тайм-аута
|
||||
mov [FDC_Status],FDC_TimeOut
|
||||
jmp @@End_6
|
||||
; Ввести байт из порта данных
|
||||
@@GetByteFromFDC:
|
||||
inc DX
|
||||
in AL,DX
|
||||
@@End_6: pop DX
|
||||
pop ECX
|
||||
ret
|
||||
|
||||
;*********************************************
|
||||
;* ОБРАБОТЧИК ПРЕРЫВАНИЯ ОТ КОНТРОЛЛЕРА НГМД *
|
||||
;*********************************************
|
||||
FDCInterrupt:
|
||||
; Установить флаг прерывани
|
||||
mov [FDD_IntFlag],1
|
||||
ret
|
||||
|
||||
|
||||
;******************************************
|
||||
;* УСТАНОВИТЬ НОВЫЙ ОБРАБОТЧИК ПРЕРЫВАНИЙ *
|
||||
;* НГМД *
|
||||
;******************************************
|
||||
SetUserInterrupts:
|
||||
mov [fdc_irq_func],FDCInterrupt
|
||||
ret
|
||||
|
||||
;*******************************************
|
||||
;* ОЖИДАНИЕ ПРЕРЫВАНИЯ ОТ КОНТРОЛЛЕРА НГМД *
|
||||
;*******************************************
|
||||
WaitFDCInterrupt:
|
||||
pusha
|
||||
; Сбросить байт состояния операции
|
||||
mov [FDC_Status],FDC_Normal
|
||||
; Сбросить флаг прерывани
|
||||
mov [FDD_IntFlag],0
|
||||
; Обнулить счетчик тиков
|
||||
mov eax,[timer_ticks]
|
||||
mov [TickCounter],eax
|
||||
; Ожидать установки флага прерывания НГМД
|
||||
@@TestRS_2:
|
||||
cmp [FDD_IntFlag],0
|
||||
jnz @@End_7 ;прерывание произошло
|
||||
call change_task
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[TickCounter]
|
||||
cmp eax,50 ;25 ;5 ;ожидать 5 тиков
|
||||
jb @@TestRS_2
|
||||
; jl @@TestRS_2
|
||||
; Ошибка тайм-аута
|
||||
mov [FDC_Status],FDC_TimeOut
|
||||
; mov [flp_status],0
|
||||
@@End_7: popa
|
||||
ret
|
||||
|
||||
;*********************************
|
||||
;* ВКЛЮЧИТЬ МОТОР ДИСКОВОДА "A:" *
|
||||
;*********************************
|
||||
FDDMotorON:
|
||||
pusha
|
||||
; cmp [fdd_motor_status],1
|
||||
; je fdd_motor_on
|
||||
mov al,[flp_number]
|
||||
cmp [fdd_motor_status],al
|
||||
je fdd_motor_on
|
||||
; Произвести сброс контроллера НГМД
|
||||
mov DX,3F2h ;порт управления двигателями
|
||||
mov AL,0
|
||||
out DX,AL
|
||||
; Выбрать и включить мотор дисковода
|
||||
cmp [flp_number],1
|
||||
jne FDDMotorON_B
|
||||
; call FDDMotorOFF_B
|
||||
mov AL,1Ch ; Floppy A
|
||||
jmp FDDMotorON_1
|
||||
FDDMotorON_B:
|
||||
; call FDDMotorOFF_A
|
||||
mov AL,2Dh ; Floppy B
|
||||
FDDMotorON_1:
|
||||
out DX,AL
|
||||
; Обнулить счетчик тиков
|
||||
mov eax,[timer_ticks]
|
||||
mov [TickCounter],eax
|
||||
; Ожидать 0,5 с
|
||||
@@dT:
|
||||
call change_task
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[TickCounter]
|
||||
cmp eax,50 ;10
|
||||
jb @@dT
|
||||
cmp [flp_number],1
|
||||
jne fdd_motor_on_B
|
||||
mov [fdd_motor_status],1
|
||||
jmp fdd_motor_on
|
||||
fdd_motor_on_B:
|
||||
mov [fdd_motor_status],2
|
||||
fdd_motor_on:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
|
||||
;*****************************************
|
||||
;* СОХРАНЕНИЕ УКАЗАТЕЛЯ ВРЕМЕНИ *
|
||||
;*****************************************
|
||||
save_timer_fdd_motor:
|
||||
mov eax,[timer_ticks]
|
||||
mov [timer_fdd_motor],eax
|
||||
ret
|
||||
|
||||
;*****************************************
|
||||
;* ПРОВЕРКА ЗАДЕРЖКИ ВЫКЛЮЧЕНИЯ МОТОРА *
|
||||
;*****************************************
|
||||
check_fdd_motor_status:
|
||||
cmp [fdd_motor_status],0
|
||||
je end_check_fdd_motor_status_1
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[timer_fdd_motor]
|
||||
cmp eax,500
|
||||
jb end_check_fdd_motor_status
|
||||
call FDDMotorOFF
|
||||
mov [fdd_motor_status],0
|
||||
end_check_fdd_motor_status_1:
|
||||
mov [flp_status],0
|
||||
end_check_fdd_motor_status:
|
||||
ret
|
||||
|
||||
;**********************************
|
||||
;* ВЫКЛЮЧИТЬ МОТОР ДИСКОВОДА *
|
||||
;**********************************
|
||||
FDDMotorOFF:
|
||||
push AX
|
||||
push DX
|
||||
cmp [flp_number],1
|
||||
jne FDDMotorOFF_1
|
||||
call FDDMotorOFF_A
|
||||
jmp FDDMotorOFF_2
|
||||
FDDMotorOFF_1:
|
||||
call FDDMotorOFF_B
|
||||
FDDMotorOFF_2:
|
||||
pop DX
|
||||
pop AX
|
||||
; сброс флагов кеширования в связи с устареванием информации
|
||||
mov [root_read],0
|
||||
mov [flp_fat],0
|
||||
ret
|
||||
|
||||
FDDMotorOFF_A:
|
||||
mov DX,3F2h ;порт управления двигателями
|
||||
mov AL,0Ch ; Floppy A
|
||||
out DX,AL
|
||||
ret
|
||||
|
||||
FDDMotorOFF_B:
|
||||
mov DX,3F2h ;порт управления двигателями
|
||||
mov AL,5h ; Floppy B
|
||||
out DX,AL
|
||||
ret
|
||||
|
||||
;*******************************
|
||||
;* РЕКАЛИБРОВКА ДИСКОВОДА "A:" *
|
||||
;*******************************
|
||||
RecalibrateFDD:
|
||||
pusha
|
||||
call save_timer_fdd_motor
|
||||
; Подать команду "Рекалибровка"
|
||||
mov AL,07h
|
||||
call FDCDataOutput
|
||||
mov AL,00h
|
||||
call FDCDataOutput
|
||||
; Ожидать завершения операции
|
||||
call WaitFDCInterrupt
|
||||
; cmp [FDC_Status],0
|
||||
; je no_fdc_status_error
|
||||
; mov [flp_status],0
|
||||
;no_fdc_status_error:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
|
||||
;*****************************************************
|
||||
;* ПОИСК ДОРОЖКИ *
|
||||
;* Параметры передаются через глобальные переменные: *
|
||||
;* FDD_Track - номер дорожки (0-79); *
|
||||
;* FDD_Head - номер головки (0-1). *
|
||||
;* Результат операции заносится в FDC_Status. *
|
||||
;*****************************************************
|
||||
SeekTrack:
|
||||
pusha
|
||||
call save_timer_fdd_motor
|
||||
; Подать команду "Поиск"
|
||||
mov AL,0Fh
|
||||
call FDCDataOutput
|
||||
; Передать байт номера головки/накопител
|
||||
mov AL,[FDD_Head]
|
||||
shl AL,2
|
||||
call FDCDataOutput
|
||||
; Передать байт номера дорожки
|
||||
mov AL,[FDD_Track]
|
||||
call FDCDataOutput
|
||||
; Ожидать завершения операции
|
||||
call WaitFDCInterrupt
|
||||
cmp [FDC_Status],FDC_Normal
|
||||
jne @@Exit
|
||||
; Сохранить результат поиска
|
||||
mov AL,08h
|
||||
call FDCDataOutput
|
||||
call FDCDataInput
|
||||
mov [FDC_ST0],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_C],AL
|
||||
; Проверить результат поиска
|
||||
; Поиск завершен?
|
||||
test [FDC_ST0],100000b
|
||||
je @@Err
|
||||
; Заданный трек найден?
|
||||
mov AL,[FDC_C]
|
||||
cmp AL,[FDD_Track]
|
||||
jne @@Err
|
||||
; Номер головки совпадает с заданным?
|
||||
mov AL,[FDC_ST0]
|
||||
and AL,100b
|
||||
shr AL,2
|
||||
cmp AL,[FDD_Head]
|
||||
jne @@Err
|
||||
; Операция завершена успешно
|
||||
mov [FDC_Status],FDC_Normal
|
||||
jmp @@Exit
|
||||
@@Err: ; Трек не найден
|
||||
mov [FDC_Status],FDC_TrackNotFound
|
||||
; mov [flp_status],0
|
||||
@@Exit:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* ЧТЕНИЕ СЕКТОРА ДАННЫХ *
|
||||
;* Параметры передаются через глобальные переменные: *
|
||||
;* FDD_Track - номер дорожки (0-79); *
|
||||
;* FDD_Head - номер головки (0-1); *
|
||||
;* FDD_Sector - номер сектора (1-18). *
|
||||
;* Результат операции заносится в FDC_Status. *
|
||||
;* В случае успешного выполнения операции чтения *
|
||||
;* содержимое сектора будет занесено в FDD_DataBuffer. *
|
||||
;*******************************************************
|
||||
ReadSector:
|
||||
pushad
|
||||
call save_timer_fdd_motor
|
||||
; Установить скорость передачи 500 Кбайт/с
|
||||
mov AX,0
|
||||
mov DX,03F7h
|
||||
out DX,AL
|
||||
; Инициализировать канал прямого доступа к памяти
|
||||
mov [dmamode],0x46
|
||||
call Init_FDC_DMA
|
||||
; Подать команду "Чтение данных"
|
||||
mov AL,0E6h ;чтение в мультитрековом режиме
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
shl AL,2
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Track]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Sector]
|
||||
call FDCDataOutput
|
||||
mov AL,2 ;код размера сектора (512 байт)
|
||||
call FDCDataOutput
|
||||
mov AL,18 ;+1; 3Fh ;число секторов на дорожке
|
||||
call FDCDataOutput
|
||||
mov AL,1Bh ;значение GPL
|
||||
call FDCDataOutput
|
||||
mov AL,0FFh ;значение DTL
|
||||
call FDCDataOutput
|
||||
; Ожидаем прерывание по завершении операции
|
||||
call WaitFDCInterrupt
|
||||
cmp [FDC_Status],FDC_Normal
|
||||
jne @@Exit_1
|
||||
; Считываем статус завершения операции
|
||||
call GetStatusInfo
|
||||
test [FDC_ST0],11011000b
|
||||
jnz @@Err_1
|
||||
mov [FDC_Status],FDC_Normal
|
||||
jmp @@Exit_1
|
||||
@@Err_1: mov [FDC_Status],FDC_SectorNotFound
|
||||
; mov [flp_status],0
|
||||
@@Exit_1:
|
||||
call save_timer_fdd_motor
|
||||
popad
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* ЧТЕНИЕ СЕКТОРА (С ПОВТОРЕНИЕМ ОПЕРАЦИИ ПРИ СБОЕ) *
|
||||
;* Параметры передаются через глобальные переменные: *
|
||||
;* FDD_Track - номер дорожки (0-79); *
|
||||
;* FDD_Head - номер головки (0-1); *
|
||||
;* FDD_Sector - номер сектора (1-18). *
|
||||
;* Результат операции заносится в FDC_Status. *
|
||||
;* В случае успешного выполнения операции чтения *
|
||||
;* содержимое сектора будет занесено в FDD_DataBuffer. *
|
||||
;*******************************************************
|
||||
ReadSectWithRetr:
|
||||
pusha
|
||||
; Обнулить счетчик повторения операции рекалибровки
|
||||
mov [RecalRepCounter],0
|
||||
@@TryAgain:
|
||||
; Обнулить счетчик повторения операции чтени
|
||||
mov [ReadRepCounter],0
|
||||
@@ReadSector_1:
|
||||
call ReadSector
|
||||
cmp [FDC_Status],0
|
||||
je @@Exit_2
|
||||
cmp [FDC_Status],1
|
||||
je @@Err_3
|
||||
; Троекратное повторение чтени
|
||||
inc [ReadRepCounter]
|
||||
cmp [ReadRepCounter],3
|
||||
jb @@ReadSector_1
|
||||
; Троекратное повторение рекалибровки
|
||||
call RecalibrateFDD
|
||||
call SeekTrack
|
||||
inc [RecalRepCounter]
|
||||
cmp [RecalRepCounter],3
|
||||
jb @@TryAgain
|
||||
; mov [flp_status],0
|
||||
@@Exit_2:
|
||||
popa
|
||||
ret
|
||||
@@Err_3:
|
||||
mov [flp_status],0
|
||||
popa
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* ЗАПИСЬ СЕКТОРА ДАННЫХ *
|
||||
;* Параметры передаются через глобальные переменные: *
|
||||
;* FDD_Track - номер дорожки (0-79); *
|
||||
;* FDD_Head - номер головки (0-1); *
|
||||
;* FDD_Sector - номер сектора (1-18). *
|
||||
;* Результат операции заносится в FDC_Status. *
|
||||
;* В случае успешного выполнения операции записи *
|
||||
;* содержимое FDD_DataBuffer будет занесено в сектор. *
|
||||
;*******************************************************
|
||||
WriteSector:
|
||||
pushad
|
||||
call save_timer_fdd_motor
|
||||
; Установить скорость передачи 500 Кбайт/с
|
||||
mov AX,0
|
||||
mov DX,03F7h
|
||||
out DX,AL
|
||||
; Инициализировать канал прямого доступа к памяти
|
||||
mov [dmamode],0x4A
|
||||
call Init_FDC_DMA
|
||||
; Подать команду "Запись данных"
|
||||
mov AL,0xC5 ;0x45 ;запись в мультитрековом режиме
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
shl AL,2
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Track]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Sector]
|
||||
call FDCDataOutput
|
||||
mov AL,2 ;код размера сектора (512 байт)
|
||||
call FDCDataOutput
|
||||
mov AL,18; 3Fh ;число секторов на дорожке
|
||||
call FDCDataOutput
|
||||
mov AL,1Bh ;значение GPL
|
||||
call FDCDataOutput
|
||||
mov AL,0FFh ;значение DTL
|
||||
call FDCDataOutput
|
||||
; Ожидаем прерывание по завершении операции
|
||||
call WaitFDCInterrupt
|
||||
cmp [FDC_Status],FDC_Normal
|
||||
jne @@Exit_3
|
||||
; Считываем статус завершения операции
|
||||
call GetStatusInfo
|
||||
test [FDC_ST0],11000000b ;11011000b
|
||||
jnz @@Err_2
|
||||
mov [FDC_Status],FDC_Normal
|
||||
jmp @@Exit_3
|
||||
@@Err_2: mov [FDC_Status],FDC_SectorNotFound
|
||||
@@Exit_3:
|
||||
call save_timer_fdd_motor
|
||||
popad
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* ЗАПИСЬ СЕКТОРА (С ПОВТОРЕНИЕМ ОПЕРАЦИИ ПРИ СБОЕ) *
|
||||
;* Параметры передаются через глобальные переменные: *
|
||||
;* FDD_Track - номер дорожки (0-79); *
|
||||
;* FDD_Head - номер головки (0-1); *
|
||||
;* FDD_Sector - номер сектора (1-18). *
|
||||
;* Результат операции заносится в FDC_Status. *
|
||||
;* В случае успешного выполнения операции записи *
|
||||
;* содержимое FDD_DataBuffer будет занесено в сектор. *
|
||||
;*******************************************************
|
||||
WriteSectWithRetr:
|
||||
pusha
|
||||
; Обнулить счетчик повторения операции рекалибровки
|
||||
mov [RecalRepCounter],0
|
||||
@@TryAgain_1:
|
||||
; Обнулить счетчик повторения операции чтени
|
||||
mov [ReadRepCounter],0
|
||||
@@WriteSector_1:
|
||||
call WriteSector
|
||||
cmp [FDC_Status],0
|
||||
je @@Exit_4
|
||||
cmp [FDC_Status],1
|
||||
je @@Err_4
|
||||
; Троекратное повторение чтени
|
||||
inc [ReadRepCounter]
|
||||
cmp [ReadRepCounter],3
|
||||
jb @@WriteSector_1
|
||||
; Троекратное повторение рекалибровки
|
||||
call RecalibrateFDD
|
||||
call SeekTrack
|
||||
inc [RecalRepCounter]
|
||||
cmp [RecalRepCounter],3
|
||||
jb @@TryAgain_1
|
||||
@@Exit_4:
|
||||
popa
|
||||
ret
|
||||
@@Err_4:
|
||||
mov [flp_status],0
|
||||
popa
|
||||
ret
|
||||
|
||||
;*********************************************
|
||||
;* ПОЛУЧИТЬ ИНФОРМАЦИЮ О РЕЗУЛЬТАТЕ ОПЕРАЦИИ *
|
||||
;*********************************************
|
||||
GetStatusInfo:
|
||||
push AX
|
||||
call FDCDataInput
|
||||
mov [FDC_ST0],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_ST1],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_ST2],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_C],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_H],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_R],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_N],AL
|
||||
pop AX
|
||||
ret
|
||||
|
@ -1,871 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; Low-level driver for HDD access
|
||||
; DMA support by Mario79
|
||||
|
||||
;**************************************************************************
|
||||
;
|
||||
; 0x600008 - first entry in cache list
|
||||
;
|
||||
; +0 - lba sector
|
||||
; +4 - state of cache sector
|
||||
; 0 = empty
|
||||
; 1 = used for read ( same as in hd )
|
||||
; 2 = used for write ( differs from hd )
|
||||
;
|
||||
; +65536 - cache entries
|
||||
;
|
||||
;**************************************************************************
|
||||
|
||||
align 4
|
||||
hd_read:
|
||||
;-----------------------------------------------------------
|
||||
; input : eax = block to read
|
||||
; ebx = destination
|
||||
;-----------------------------------------------------------
|
||||
and [hd_error], 0
|
||||
push ecx esi edi ; scan cache
|
||||
|
||||
mov ecx,cache_max ; entries in cache
|
||||
mov esi,OS_BASE+0x600000+8
|
||||
mov edi,1
|
||||
|
||||
hdreadcache:
|
||||
|
||||
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 ; ret in edi
|
||||
cmp [hd_error],0
|
||||
jne return_01
|
||||
cmp [dma_hdd], 1
|
||||
jnz .nodma
|
||||
call hd_read_dma
|
||||
jmp @f
|
||||
.nodma:
|
||||
call hd_read_pio
|
||||
@@:
|
||||
|
||||
lea esi,[edi*8+OS_BASE+0x600000]
|
||||
mov [esi],eax ; sector number
|
||||
mov dword [esi+4],1 ; hd read - mark as same as in hd
|
||||
|
||||
yeshdcache:
|
||||
|
||||
mov esi,edi
|
||||
shl esi,9
|
||||
add esi,OS_BASE+0x600000+65536
|
||||
mov edi,ebx
|
||||
mov ecx,512/4
|
||||
cld
|
||||
rep movsd ; move data
|
||||
return_01:
|
||||
pop edi esi ecx
|
||||
ret
|
||||
|
||||
align 4
|
||||
hd_read_pio:
|
||||
push eax edx
|
||||
|
||||
call wait_for_hd_idle
|
||||
cmp [hd_error],0
|
||||
jne hd_read_error
|
||||
|
||||
cli
|
||||
xor eax,eax
|
||||
mov edx,[hdbase]
|
||||
inc edx
|
||||
out dx,al ; ATAFeatures ॣ¨áâà "®á®¡¥®á⥩"
|
||||
inc edx
|
||||
inc eax
|
||||
out dx,al ; ATASectorCount áçñâ稪 ᥪâ®à®¢
|
||||
inc edx
|
||||
mov eax,[esp+4]
|
||||
out dx,al ; ATASectorNumber ॣ¨áâà ®¬¥à ᥪâ®à
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al ; ATACylinder ®¬¥à 樫¨¤à (¬« ¤è¨© ¡ ©â)
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al ; ®¬¥à 樫¨¤à (áâ à訩 ¡ ©â)
|
||||
shr eax,8
|
||||
inc edx
|
||||
and al,1+2+4+8
|
||||
add al,byte [hdid]
|
||||
add al,128+64+32
|
||||
out dx,al ; ®¬¥à £®«®¢ª¨/®¬¥à ¤¨áª
|
||||
inc edx
|
||||
mov al,20h
|
||||
out dx,al ; ATACommand ॣ¨áâà ª®¬ ¤
|
||||
sti
|
||||
|
||||
call wait_for_sector_buffer
|
||||
|
||||
cmp [hd_error],0
|
||||
jne hd_read_error
|
||||
|
||||
cli
|
||||
push edi
|
||||
shl edi,9
|
||||
add edi,OS_BASE+0x600000+65536
|
||||
mov ecx,256
|
||||
mov edx,[hdbase]
|
||||
cld
|
||||
rep insw
|
||||
pop edi
|
||||
sti
|
||||
|
||||
pop edx eax
|
||||
ret
|
||||
|
||||
disable_ide_int:
|
||||
; mov edx,[hdbase]
|
||||
; add edx,0x206
|
||||
; mov al,2
|
||||
; out dx,al
|
||||
cli
|
||||
ret
|
||||
|
||||
enable_ide_int:
|
||||
; mov edx,[hdbase]
|
||||
; add edx,0x206
|
||||
; mov al,0
|
||||
; out dx,al
|
||||
sti
|
||||
ret
|
||||
|
||||
align 4
|
||||
hd_write:
|
||||
;-----------------------------------------------------------
|
||||
; input : eax = block
|
||||
; ebx = pointer to memory
|
||||
;-----------------------------------------------------------
|
||||
push ecx esi edi
|
||||
|
||||
; check if the cache already has the sector and overwrite it
|
||||
|
||||
mov ecx,cache_max
|
||||
mov esi,OS_BASE+0x600000+8
|
||||
mov edi,1
|
||||
|
||||
hdwritecache:
|
||||
|
||||
cmp dword [esi+4],0 ; if cache slot is empty
|
||||
je not_in_cache_write
|
||||
|
||||
cmp [esi],eax ; if the slot has the sector
|
||||
je yes_in_cache_write
|
||||
|
||||
not_in_cache_write:
|
||||
|
||||
add esi,8
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz hdwritecache
|
||||
|
||||
; sector not found in cache
|
||||
; write the block to a new location
|
||||
|
||||
call find_empty_slot ; ret in edi
|
||||
cmp [hd_error],0
|
||||
jne hd_write_access_denied
|
||||
|
||||
lea esi,[edi*8+OS_BASE+0x600000]
|
||||
mov [esi],eax ; sector number
|
||||
|
||||
yes_in_cache_write:
|
||||
|
||||
mov dword [esi+4],2 ; write - differs from hd
|
||||
|
||||
shl edi,9
|
||||
add edi,OS_BASE+0x600000+65536
|
||||
mov esi,ebx
|
||||
mov ecx,512/4
|
||||
cld
|
||||
rep movsd ; move data
|
||||
hd_write_access_denied:
|
||||
pop edi esi ecx
|
||||
ret
|
||||
|
||||
|
||||
write_cache:
|
||||
;-----------------------------------------------------------
|
||||
; write all changed sectors to disk
|
||||
;-----------------------------------------------------------
|
||||
push eax ecx edx esi edi
|
||||
|
||||
; write difference ( 2 ) from cache to hd
|
||||
|
||||
mov ecx,cache_max
|
||||
mov esi,OS_BASE+0x600000+8
|
||||
mov edi,1
|
||||
|
||||
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
|
||||
|
||||
cmp [allow_dma_write], 1
|
||||
jnz .nodma
|
||||
cmp [dma_hdd], 1
|
||||
jnz .nodma
|
||||
; Ž¡ê¥¤¨ï¥¬ § ¯¨áì 楯®çª¨ ¯®á«¥¤®¢ ⥫ìëå ᥪâ®à®¢ ¢ ®¤® ®¡à 饨¥ ª ¤¨áªã
|
||||
cmp ecx, 1
|
||||
jz .nonext
|
||||
cmp dword [esi+8+4], 2
|
||||
jnz .nonext
|
||||
push eax
|
||||
inc eax
|
||||
cmp eax, [esi+8]
|
||||
pop eax
|
||||
jnz .nonext
|
||||
cmp [cache_chain_started], 1
|
||||
jz @f
|
||||
mov [cache_chain_started], 1
|
||||
mov [cache_chain_size], 0
|
||||
mov [cache_chain_pos], edi
|
||||
mov [cache_chain_ptr], esi
|
||||
@@:
|
||||
inc [cache_chain_size]
|
||||
cmp [cache_chain_size], 64
|
||||
jnz .continue
|
||||
jmp .write_chain
|
||||
.nonext:
|
||||
call flush_cache_chain
|
||||
mov [cache_chain_size], 1
|
||||
mov [cache_chain_ptr], esi
|
||||
call write_cache_sector
|
||||
jmp .continue
|
||||
.nodma:
|
||||
call cache_write_pio
|
||||
.write_chain:
|
||||
call flush_cache_chain
|
||||
|
||||
.continue:
|
||||
danger:
|
||||
|
||||
add esi,8
|
||||
inc edi
|
||||
dec ecx
|
||||
jnz write_cache_more
|
||||
call flush_cache_chain
|
||||
return_02:
|
||||
pop edi esi edx ecx eax
|
||||
ret
|
||||
|
||||
flush_cache_chain:
|
||||
cmp [cache_chain_started], 0
|
||||
jz @f
|
||||
call write_cache_chain
|
||||
mov [cache_chain_started], 0
|
||||
@@:
|
||||
ret
|
||||
|
||||
align 4
|
||||
cache_write_pio:
|
||||
call disable_ide_int
|
||||
|
||||
call wait_for_hd_idle
|
||||
cmp [hd_error],0
|
||||
jne hd_write_error
|
||||
|
||||
; cli
|
||||
xor eax,eax
|
||||
mov edx,[hdbase]
|
||||
inc edx
|
||||
out dx,al
|
||||
inc edx
|
||||
inc eax
|
||||
out dx,al
|
||||
inc edx
|
||||
mov eax,[esi] ; eax = sector to write
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
and al,1+2+4+8
|
||||
add al,byte [hdid]
|
||||
add al,128+64+32
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,30h
|
||||
out dx,al
|
||||
; sti
|
||||
|
||||
call wait_for_sector_buffer
|
||||
|
||||
cmp [hd_error],0
|
||||
jne hd_write_error
|
||||
|
||||
push ecx esi
|
||||
|
||||
; cli
|
||||
mov esi,edi
|
||||
shl esi,9
|
||||
add esi,OS_BASE+0x600000+65536 ; esi = from memory position
|
||||
mov ecx,256
|
||||
mov edx,[hdbase]
|
||||
cld
|
||||
rep outsw
|
||||
; sti
|
||||
|
||||
call enable_ide_int
|
||||
pop esi ecx
|
||||
|
||||
ret
|
||||
|
||||
align 4
|
||||
find_empty_slot:
|
||||
;-----------------------------------------------------------
|
||||
; find empty or read slot, flush cache if next 10% is used by write
|
||||
; output : edi = cache slot
|
||||
;-----------------------------------------------------------
|
||||
; push ecx esi
|
||||
|
||||
search_again:
|
||||
|
||||
mov ecx,cache_max*10/100
|
||||
mov edi,[cache_search_start]
|
||||
|
||||
search_for_empty:
|
||||
|
||||
inc edi
|
||||
cmp edi,cache_max
|
||||
jbe inside_cache
|
||||
mov edi,1
|
||||
|
||||
inside_cache:
|
||||
|
||||
cmp dword [edi*8+OS_BASE+0x600000+4],2 ; get cache slot info
|
||||
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_access_denied:
|
||||
ret
|
||||
|
||||
align 4
|
||||
clear_hd_cache:
|
||||
|
||||
push eax ecx edi
|
||||
mov edi,OS_BASE+0x600000
|
||||
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
|
||||
|
||||
save_hd_wait_timeout:
|
||||
|
||||
push eax
|
||||
mov eax,[timer_ticks];[0xfdf0]
|
||||
add eax,300 ; 3 sec timeout
|
||||
mov [hd_wait_timeout],eax
|
||||
pop eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
check_hd_wait_timeout:
|
||||
|
||||
push eax
|
||||
mov eax,[hd_wait_timeout]
|
||||
cmp [timer_ticks], eax ;[0xfdf0],eax
|
||||
jg hd_timeout_error
|
||||
pop eax
|
||||
mov [hd_error],0
|
||||
ret
|
||||
|
||||
;iglobal
|
||||
; hd_timeout_str db 'K : FS - HD timeout',0
|
||||
; hd_read_str db 'K : FS - HD read error',0
|
||||
; hd_write_str db 'K : FS - HD write error',0
|
||||
; hd_lba_str db 'K : FS - HD LBA error',0
|
||||
;endg
|
||||
|
||||
hd_timeout_error:
|
||||
|
||||
; call clear_hd_cache
|
||||
; call clear_application_table_status
|
||||
; mov esi,hd_timeout_str
|
||||
; call sys_msg_board_str
|
||||
DEBUGF 1,"K : FS - HD timeout\n"
|
||||
; jmp $
|
||||
mov [hd_error],1
|
||||
pop eax
|
||||
ret
|
||||
|
||||
hd_read_error:
|
||||
|
||||
; call clear_hd_cache
|
||||
; call clear_application_table_status
|
||||
; mov esi,hd_read_str
|
||||
; call sys_msg_board_str
|
||||
DEBUGF 1,"K : FS - HD read error\n"
|
||||
pop edx eax
|
||||
ret
|
||||
|
||||
hd_write_error:
|
||||
|
||||
; call clear_hd_cache
|
||||
; call clear_application_table_status
|
||||
; mov esi,hd_write_str
|
||||
; call sys_msg_board_str
|
||||
DEBUGF 1,"K : FS - HD write error\n"
|
||||
ret
|
||||
|
||||
hd_write_error_dma:
|
||||
; call clear_hd_cache
|
||||
; call clear_application_table_status
|
||||
; mov esi, hd_write_str
|
||||
; call sys_msg_board_str
|
||||
DEBUGF 1,"K : FS - HD read error\n"
|
||||
pop esi
|
||||
ret
|
||||
|
||||
hd_lba_error:
|
||||
; call clear_hd_cache
|
||||
; call clear_application_table_status
|
||||
; mov esi,hd_lba_str
|
||||
; call sys_msg_board_str
|
||||
DEBUGF 1,"K : FS - HD LBA error\n"
|
||||
jmp LBA_read_ret
|
||||
|
||||
|
||||
align 4
|
||||
wait_for_hd_idle:
|
||||
|
||||
push eax edx
|
||||
|
||||
call save_hd_wait_timeout
|
||||
|
||||
mov edx,[hdbase]
|
||||
add edx,0x7
|
||||
|
||||
wfhil1:
|
||||
|
||||
call check_hd_wait_timeout
|
||||
cmp [hd_error],0
|
||||
jne @f
|
||||
|
||||
in al,dx
|
||||
test al,128
|
||||
jnz wfhil1
|
||||
|
||||
@@:
|
||||
|
||||
pop edx eax
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
wait_for_sector_buffer:
|
||||
|
||||
push eax edx
|
||||
|
||||
mov edx,[hdbase]
|
||||
add edx,0x7
|
||||
|
||||
call save_hd_wait_timeout
|
||||
|
||||
hdwait_sbuf: ; wait for sector buffer to be ready
|
||||
|
||||
call check_hd_wait_timeout
|
||||
cmp [hd_error],0
|
||||
jne @f
|
||||
|
||||
in al,dx
|
||||
test al,8
|
||||
jz hdwait_sbuf
|
||||
|
||||
mov [hd_error],0
|
||||
|
||||
cmp [hd_setup],1 ; do not mark error for setup request
|
||||
je buf_wait_ok
|
||||
|
||||
test al,1 ; previous command ended up with an error
|
||||
jz buf_wait_ok
|
||||
@@:
|
||||
mov [hd_error],1
|
||||
|
||||
buf_wait_ok:
|
||||
|
||||
pop edx eax
|
||||
ret
|
||||
|
||||
; \begin{Mario79}
|
||||
align 4
|
||||
wait_for_sector_dma_ide0:
|
||||
push eax
|
||||
push edx
|
||||
call save_hd_wait_timeout
|
||||
.wait:
|
||||
call change_task
|
||||
cmp [irq14_func], hdd_irq14
|
||||
jnz .done
|
||||
call check_hd_wait_timeout
|
||||
cmp [hd_error], 0
|
||||
jz .wait
|
||||
mov [irq14_func], hdd_irq_null
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
mov al, 0
|
||||
out dx, al
|
||||
.done:
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
wait_for_sector_dma_ide1:
|
||||
push eax
|
||||
push edx
|
||||
call save_hd_wait_timeout
|
||||
.wait:
|
||||
call change_task
|
||||
cmp [irq15_func], hdd_irq15
|
||||
jnz .done
|
||||
call check_hd_wait_timeout
|
||||
cmp [hd_error], 0
|
||||
jz .wait
|
||||
mov [irq15_func], hdd_irq_null
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
add dx, 8
|
||||
mov al, 0
|
||||
out dx, al
|
||||
.done:
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary
|
||||
IDE_descriptor_table:
|
||||
dd OS_BASE+284000h
|
||||
dw 2000h
|
||||
dw 8000h
|
||||
|
||||
dma_cur_sector dd not 40h
|
||||
irq14_func dd hdd_irq_null
|
||||
irq15_func dd hdd_irq_null
|
||||
endg
|
||||
|
||||
uglobal
|
||||
; all uglobals are zeroed at boot
|
||||
dma_process dd 0
|
||||
dma_slot_ptr dd 0
|
||||
cache_chain_pos dd 0
|
||||
cache_chain_ptr dd 0
|
||||
cache_chain_size db 0
|
||||
cache_chain_started db 0
|
||||
dma_task_switched db 0
|
||||
dma_hdd db 0
|
||||
allow_dma_write db 0
|
||||
endg
|
||||
|
||||
align 4
|
||||
hdd_irq14:
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
mov [irq14_func], hdd_irq_null
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
mov al, 0
|
||||
out dx, al
|
||||
call update_counters
|
||||
mov ebx, [dma_process]
|
||||
cmp [CURRENT_TASK], ebx
|
||||
jz .noswitch
|
||||
mov [dma_task_switched], 1
|
||||
mov edi, [dma_slot_ptr]
|
||||
mov eax, [CURRENT_TASK]
|
||||
mov [dma_process], eax
|
||||
mov eax, [TASK_BASE]
|
||||
mov [dma_slot_ptr], eax
|
||||
mov [CURRENT_TASK], ebx
|
||||
mov [TASK_BASE], edi
|
||||
mov byte [0xFFFF], 1
|
||||
call do_change_task
|
||||
.noswitch:
|
||||
popad
|
||||
popfd
|
||||
align 4
|
||||
hdd_irq_null:
|
||||
ret
|
||||
|
||||
align 4
|
||||
hdd_irq15:
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
mov [irq15_func], hdd_irq_null
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
add dx, 8
|
||||
mov al, 0
|
||||
out dx, al
|
||||
call update_counters
|
||||
mov ebx, [dma_process]
|
||||
cmp [CURRENT_TASK], ebx
|
||||
jz .noswitch
|
||||
mov [dma_task_switched], 1
|
||||
mov edi, [dma_slot_ptr]
|
||||
mov eax, [CURRENT_TASK]
|
||||
mov [dma_process], eax
|
||||
mov eax, [TASK_BASE]
|
||||
mov [dma_slot_ptr], eax
|
||||
mov [CURRENT_TASK], ebx
|
||||
mov [TASK_BASE], edi
|
||||
mov byte [0xFFFF], 1
|
||||
call do_change_task
|
||||
.noswitch:
|
||||
popad
|
||||
popfd
|
||||
ret
|
||||
|
||||
align 4
|
||||
hd_read_dma:
|
||||
push eax
|
||||
push edx
|
||||
mov edx, [dma_cur_sector]
|
||||
cmp eax, edx
|
||||
jb .notread
|
||||
add edx, 15
|
||||
cmp [esp+4], edx
|
||||
ja .notread
|
||||
mov eax, [esp+4]
|
||||
sub eax, [dma_cur_sector]
|
||||
shl eax, 9
|
||||
add eax, OS_BASE+0x284000
|
||||
push ecx esi edi
|
||||
mov esi, eax
|
||||
shl edi, 9
|
||||
add edi, OS_BASE+0x610000
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
pop edi esi ecx
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
.notread:
|
||||
mov eax, IDE_descriptor_table-OS_BASE
|
||||
mov dword [eax+OS_BASE], 0x284000
|
||||
mov word [eax+4+OS_BASE], 0x2000
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
cmp [hdbase], 0x1F0
|
||||
jz @f
|
||||
add edx, 8
|
||||
@@:
|
||||
push edx
|
||||
add edx, 4
|
||||
out dx, eax
|
||||
pop edx
|
||||
mov al, 0
|
||||
out dx, al
|
||||
add edx, 2
|
||||
mov al, 6
|
||||
out dx, al
|
||||
call wait_for_hd_idle
|
||||
cmp [hd_error], 0
|
||||
jnz hd_read_error
|
||||
call disable_ide_int
|
||||
xor eax, eax
|
||||
mov edx, [hdbase]
|
||||
inc edx
|
||||
out dx, al
|
||||
inc edx
|
||||
mov eax, 10h
|
||||
out dx, al
|
||||
inc edx
|
||||
mov eax, [esp+4]
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
and al, 0xF
|
||||
add al, byte [hdid]
|
||||
add al, 11100000b
|
||||
out dx, al
|
||||
inc edx
|
||||
mov al, 0xC8
|
||||
out dx, al
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
cmp [hdbase], 0x1F0
|
||||
jz @f
|
||||
add dx, 8
|
||||
@@:
|
||||
mov al, 9
|
||||
out dx, al
|
||||
mov eax, [CURRENT_TASK]
|
||||
mov [dma_process], eax
|
||||
mov eax, [TASK_BASE]
|
||||
mov [dma_slot_ptr], eax
|
||||
cmp [hdbase], 0x1F0
|
||||
jnz .ide1
|
||||
mov [irq14_func], hdd_irq14
|
||||
jmp @f
|
||||
.ide1:
|
||||
mov [irq15_func], hdd_irq15
|
||||
@@:
|
||||
call enable_ide_int
|
||||
cmp [hdbase], 0x1F0
|
||||
jnz .wait_ide1
|
||||
call wait_for_sector_dma_ide0
|
||||
jmp @f
|
||||
.wait_ide1:
|
||||
call wait_for_sector_dma_ide1
|
||||
@@:
|
||||
cmp [hd_error], 0
|
||||
jnz hd_read_error
|
||||
pop edx
|
||||
pop eax
|
||||
mov [dma_cur_sector], eax
|
||||
jmp hd_read_dma
|
||||
|
||||
align 4
|
||||
write_cache_chain:
|
||||
push esi
|
||||
mov eax, IDE_descriptor_table
|
||||
mov edx, [cache_chain_pos]
|
||||
shl edx, 9
|
||||
add edx, OS_BASE+0x610000
|
||||
mov [eax], edx
|
||||
movzx edx, [cache_chain_size]
|
||||
shl edx, 9
|
||||
mov [eax+4], dx
|
||||
jmp do_write_dma
|
||||
write_cache_sector:
|
||||
push esi
|
||||
mov eax, IDE_descriptor_table
|
||||
mov edx, edi
|
||||
shl edx, 9
|
||||
add edx, OS_BASE+0x610000
|
||||
mov [eax], edx
|
||||
mov word [eax+4], 0x200
|
||||
do_write_dma:
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
cmp [hdbase], 0x1F0
|
||||
jz @f
|
||||
add edx, 8
|
||||
@@:
|
||||
push edx
|
||||
add edx, 4
|
||||
out dx, eax
|
||||
pop edx
|
||||
mov al, 0
|
||||
out dx, al
|
||||
add edx, 2
|
||||
mov al, 6
|
||||
out dx, al
|
||||
call wait_for_hd_idle
|
||||
cmp [hd_error], 0
|
||||
jnz hd_write_error_dma
|
||||
call disable_ide_int
|
||||
xor eax, eax
|
||||
mov edx, [hdbase]
|
||||
inc edx
|
||||
out dx, al
|
||||
inc edx
|
||||
mov al, [cache_chain_size]
|
||||
out dx, al
|
||||
inc edx
|
||||
mov esi, [cache_chain_ptr]
|
||||
mov eax, [esi]
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
and al, 0xF
|
||||
add al, byte [hdid]
|
||||
add al, 11100000b
|
||||
out dx, al
|
||||
inc edx
|
||||
mov al, 0xCA
|
||||
out dx, al
|
||||
mov dx, [IDEContrRegsBaseAddr]
|
||||
cmp [hdbase], 0x1F0
|
||||
jz @f
|
||||
add dx, 8
|
||||
@@:
|
||||
mov al, 1
|
||||
out dx, al
|
||||
mov eax, [CURRENT_TASK]
|
||||
mov [dma_process], eax
|
||||
mov eax, [TASK_BASE]
|
||||
mov [dma_slot_ptr], eax
|
||||
cmp [hdbase], 0x1F0
|
||||
jnz .ide1
|
||||
mov [irq14_func], hdd_irq14
|
||||
jmp @f
|
||||
.ide1:
|
||||
mov [irq15_func], hdd_irq15
|
||||
@@:
|
||||
call enable_ide_int
|
||||
mov [dma_cur_sector], not 0x40
|
||||
cmp [hdbase], 0x1F0
|
||||
jnz .wait_ide1
|
||||
call wait_for_sector_dma_ide0
|
||||
jmp @f
|
||||
.wait_ide1:
|
||||
call wait_for_sector_dma_ide1
|
||||
@@:
|
||||
cmp [hd_error], 0
|
||||
jnz hd_write_error_dma
|
||||
pop esi
|
||||
ret
|
||||
|
||||
uglobal
|
||||
IDEContrRegsBaseAddr dw ?
|
||||
endg
|
||||
; \end{Mario79}
|
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
iglobal
|
||||
saverd_fileinfo:
|
||||
dd 2 ; subfunction: write
|
||||
dd 0 ; (reserved)
|
||||
dd 0 ; (reserved)
|
||||
dd 1440*1024 ; size 1440 Kb
|
||||
dd 0x100000 - std_application_base_address ; base address
|
||||
db 0
|
||||
.name:
|
||||
dd ?
|
||||
endg
|
||||
sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
|
||||
call restorefatchain
|
||||
mov eax, saverd_fileinfo - std_application_base_address
|
||||
mov [saverd_fileinfo.name], ebx
|
||||
pushad
|
||||
push eax
|
||||
call file_system_lfn
|
||||
pop eax
|
||||
popad
|
||||
mov [esp+36], eax
|
||||
ret
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,94 +0,0 @@
|
||||
$Revision: 437 $
|
||||
;======================================================================
|
||||
;
|
||||
; BOOT DATA
|
||||
;
|
||||
;======================================================================
|
||||
|
||||
d80x25_bottom:
|
||||
db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY '
|
||||
db 'NO WARRANTY ',186
|
||||
db 186,' See file COPYING for details '
|
||||
db ' ',186
|
||||
line_full_bottom
|
||||
d80x25_bottom_num = 3
|
||||
|
||||
novesa db "Display: EGA/CGA",13,10,0
|
||||
vervesa db "Version of Vesa: Vesa x.x",13,10,0
|
||||
vervesa_off=22
|
||||
msg_apm db " APM x.x ", 0
|
||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
|
||||
db "[7] 1024x768, [8] 1280x1024",13,10
|
||||
db 186," EGA/CGA 256 Colors: [9] 320x200, "
|
||||
db "VGA 16 Colors: [0] 640x480",13,10
|
||||
db 186," Select mode: ",0
|
||||
bt24 db "Bits Per Pixel: 24",13,10,0
|
||||
bt32 db "Bits Per Pixel: 32",13,10,0
|
||||
vrrmprint db "Apply VRR? (picture frequency greater than 60Hz"
|
||||
db " only for transfers:",13,10
|
||||
db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0
|
||||
;askmouse db " Mouse at:"
|
||||
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||
; db " Select port [1-3]: ",0
|
||||
;no_com1 db 13,10,186, " No COM1 mouse",0
|
||||
;no_com2 db 13,10,186, " No COM2 mouse",0
|
||||
ask_dma db "Use DMA for HDD writing? [1-yes/2-no]: ",0
|
||||
;gr_direct db 186," Use direct LFB writing? "
|
||||
; db "[1-yes/2-no] ? ",0
|
||||
;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / "
|
||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
|
||||
;bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
|
||||
bdev db "Load ramdisk from [1-floppy; 2-C:\kolibri.img (FAT32);"
|
||||
db 13,10,186," "
|
||||
db "3-use preloaded ram-image from kernel restart]: ",0
|
||||
probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
|
||||
db "2-probe bios (Vesa 3.0)]: ",0
|
||||
;memokz256 db 13,10,186," RAM 256 Mb",0
|
||||
;memokz128 db 13,10,186," RAM 128 Mb",0
|
||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||
prnotfnd db "Fatal - Videomode not found.",0
|
||||
;modena db "Fatal - VBE 0x112+ required.",0
|
||||
not386 db "Fatal - CPU 386+ required.",0
|
||||
btns db "Fatal - Can't determine color depth.",0
|
||||
fatalsel db "Fatal - Graphics mode not supported by hardware.",0
|
||||
badsect db 13,10,186," Fatal - Bad sector. Replace floppy.",0
|
||||
memmovefailed db 13,10,186," Fatal - Int 0x15 move failed.",0
|
||||
okt db " ... OK"
|
||||
linef db 13,10,0
|
||||
diskload db "Loading diskette: 00 %",8,8,8,8,0
|
||||
pros db "00"
|
||||
backspace2 db 8,8,0
|
||||
boot_dev db 0 ; 0=floppy, 1=hd
|
||||
start_msg db "Press [abcd] to change settings, press [Enter] to continue booting",13,10,0
|
||||
time_msg db " or wait "
|
||||
time_str db " 5 seconds"
|
||||
db " before automatical continuation",13,10,0
|
||||
current_cfg_msg db "Current settings:",13,10,0
|
||||
curvideo_msg db " [a] Videomode: ",0
|
||||
mode1 db "640x480",0
|
||||
mode2 db "800x600",0
|
||||
mode3 db "1024x768",0
|
||||
mode4 db "1280x1024",0
|
||||
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
|
||||
modevesa20 db " with LFB",0
|
||||
modevesa12 db ", VESA 1.2 Bnk",0
|
||||
mode9 db "320x200, EGA/CGA 256 colors",0
|
||||
mode10 db "640x480, VGA 16 colors",0
|
||||
probeno_msg db " (standard mode)",0
|
||||
probeok_msg db " (check nonstandard modes)",0
|
||||
dma_msg db " [b] Use DMA for HDD writing:",0
|
||||
on_msg db " on",13,10,0
|
||||
off_msg db " off",13,10,0
|
||||
vrrm_msg db " [c] Use VRR:",0
|
||||
preboot_device_msg db " [d] Floppy image: ",0
|
||||
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
|
||||
pdm1 db "real floppy",13,10,0
|
||||
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
|
||||
pdm3 db "use already loaded image",13,10,0
|
||||
loading_msg db "Loading KolibriOS...",0
|
||||
save_quest db "Remember current settings? [y/n]: ",0
|
||||
loader_block_error db "Bootloader data invalid, I cannot continue. Stopped.",0
|
@ -1,94 +0,0 @@
|
||||
$Revision: 437 $
|
||||
;======================================================================
|
||||
;
|
||||
; BOOT DATA
|
||||
;
|
||||
;======================================================================
|
||||
|
||||
d80x25_bottom:
|
||||
db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY '
|
||||
db 'NO WARRANTY ',186
|
||||
db 186,' See file COPYING for details '
|
||||
db ' ',186
|
||||
line_full_bottom
|
||||
d80x25_bottom_num = 3
|
||||
|
||||
novesa db "Ekraan: EGA/CGA",13,10,0
|
||||
vervesa db "Vesa versioon: Vesa x.x",13,10,0
|
||||
vervesa_off=20
|
||||
msg_apm db " APM x.x ", 0
|
||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
|
||||
db "[7] 1024x768, [8] 1280x1024",13,10
|
||||
db 186," EGA/CGA 256 värvi: [9] 320x200, "
|
||||
db "VGA 16 värvi: [0] 640x480",13,10
|
||||
db 186," Vali reziim: ",0
|
||||
bt24 db "Bitti pikseli kohta: 24",13,10,0
|
||||
bt32 db "Bitti pikseli kohta: 32",13,10,0
|
||||
vrrmprint db "Kinnita VRR? (ekraani sagedus suurem kui 60Hz"
|
||||
db " ainult:",13,10
|
||||
db 186," 1024*768->800*600 ja 800*600->640*480) [1-jah,2-ei]:",0
|
||||
;askmouse db " Hiir:"
|
||||
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||
; db " Vali port [1-3]: ",0
|
||||
;no_com1 db 13,10,186, " No COM1 mouse",0
|
||||
;no_com2 db 13,10,186, " No COM2 mouse",0
|
||||
ask_dma db "Use DMA for HDD writing? [1-jah/2-ei]: ",0
|
||||
;gr_direct db 186," Use direct LFB writing? "
|
||||
; db "[1-yes/2-no] ? ",0
|
||||
;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / "
|
||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
|
||||
;bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
|
||||
bdev db "Paigalda mäluketas [1-diskett; 2-C:\kolibri.img (FAT32);"
|
||||
db 13,10,186," "
|
||||
db "3-kasuta eellaaditud mäluketast kerneli restardist]: ",0
|
||||
probetext db 13,10,13,10,186," Kasuta standartset graafika reziimi? [1-jah, "
|
||||
db "2-leia biosist (Vesa 3.0)]: ",0
|
||||
;memokz256 db 13,10,186," RAM 256 Mb",0
|
||||
;memokz128 db 13,10,186," RAM 128 Mb",0
|
||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||
prnotfnd db "Fataalne - Videoreziimi ei leitud.",0
|
||||
;modena db "Fataalne - VBE 0x112+ on vajalik.",0
|
||||
not386 db "Fataalne - CPU 386+ on vajalik.",0
|
||||
btns db "Fataalne - Ei suuda värvisügavust määratleda.",0
|
||||
fatalsel db "Fataalne - Graafilist reziimi riistvara ei toeta.",0
|
||||
badsect db 13,10,186," Fataalne - Vigane sektor. Asenda diskett.",0
|
||||
memmovefailed db 13,10,186," Fataalne - Int 0x15 liigutamine ebaõnnestus.",0
|
||||
okt db " ... OK"
|
||||
linef db 13,10,0
|
||||
diskload db "Loen disketti: 00 %",8,8,8,8,0
|
||||
pros db "00"
|
||||
backspace2 db 8,8,0
|
||||
boot_dev db 0 ; 0=floppy, 1=hd
|
||||
start_msg db "Vajuta [abcd] seadete muutmiseks, vajuta [Enter] laadimise jätkamiseks",13,10,0
|
||||
time_msg db " või oota "
|
||||
time_str db " 5 sekundit"
|
||||
db " automaatseks jätkamiseks",13,10,0
|
||||
current_cfg_msg db "Praegused seaded:",13,10,0
|
||||
curvideo_msg db " [a] Videoreziim: ",0
|
||||
mode1 db "640x480",0
|
||||
mode2 db "800x600",0
|
||||
mode3 db "1024x768",0
|
||||
mode4 db "1280x1024",0
|
||||
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
|
||||
modevesa20 db " koos LFB",0
|
||||
modevesa12 db ", VESA 1.2 Bnk",0
|
||||
mode9 db "320x200, EGA/CGA 256 värvi",0
|
||||
mode10 db "640x480, VGA 16 värvi",0
|
||||
probeno_msg db " (standard reziim)",0
|
||||
probeok_msg db " (kontrolli ebastandardseid reziime)",0
|
||||
dma_msg db " [b] Use DMA for HDD writing:",0
|
||||
on_msg db " sees",13,10,0
|
||||
off_msg db " väljas",13,10,0
|
||||
vrrm_msg db " [c] Kasuta VRR:",0
|
||||
preboot_device_msg db " [d] Disketi kujutis: ",0
|
||||
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
|
||||
pdm1 db "reaalne diskett",13,10,0
|
||||
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
|
||||
pdm3 db "kasuta juba laaditud kujutist",13,10,0
|
||||
loading_msg db "Laadin KolibriOS...",0
|
||||
save_quest db "Jäta meelde praegused seaded? [y/n]: ",0
|
||||
loader_block_error db "Alglaaduri andmed vigased, ei saa jätkata. Peatatud.",0
|
@ -1,99 +0,0 @@
|
||||
$Revision: 437 $
|
||||
;======================================================================
|
||||
;
|
||||
; BOOT DATA
|
||||
;
|
||||
;======================================================================
|
||||
|
||||
d80x25_bottom:
|
||||
; db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY '
|
||||
; db 'NO WARRANTY ',186
|
||||
; db 186,' See file COPYING for details '
|
||||
; db ' ',186
|
||||
|
||||
db 186,' KolibriOS basiert auf MenuetOS und wird ohne jegliche '
|
||||
db ' Garantie vertrieben ',186
|
||||
db 186,' Details stehen in der Datei COPYING '
|
||||
db ' ',186
|
||||
line_full_bottom
|
||||
d80x25_bottom_num = 3
|
||||
|
||||
novesa db "Anzeige: EGA/CGA ",13,10,0
|
||||
vervesa db "Vesa-Version: Vesa ",13,10,0
|
||||
vervesa_off=22
|
||||
msg_apm db " APM x.x ", 0
|
||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
|
||||
db "[7] 1024x768, [8] 1280x1024",13,10
|
||||
db 186," EGA/CGA 256 Farben: [9] 320x200, "
|
||||
db "VGA 16 Farben: [0] 640x480",13,10
|
||||
db 186," Waehle Modus: ",0
|
||||
bt24 db "Bits Per Pixel: 24",13,10,0
|
||||
bt32 db "Bits Per Pixel: 32",13,10,0
|
||||
vrrmprint db "VRR verwenden? (Monitorfrequenz groesser als 60Hz"
|
||||
db " only for transfers:",13,10
|
||||
db 186," 1024*768->800*600 und 800*600->640*480) [1-ja,2-nein]:",0
|
||||
;askmouse db " Maus angeschlossen an:"
|
||||
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||
; db " Waehle Port [1-3]: ",0
|
||||
;no_com1 db 13,10,186, " Keine COM1 Maus",0
|
||||
;no_com2 db 13,10,186, " Keine COM2 Maus",0
|
||||
ask_dma db "Nutze DMA zum HDD Aufschreiben? [1-ja/2-nein]: ",0
|
||||
;gr_direct db 186," Benutze direct LFB? "
|
||||
; db "[1-ja/2-nein] ? ",0
|
||||
;mem_model db 13,10,186," Hauptspeicher [1-16 Mb / 2-32 Mb / "
|
||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
|
||||
;bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
|
||||
bdev db "Lade die Ramdisk von [1-Diskette; 2-C:\kolibri.img (FAT32);"
|
||||
db 13,10,186," "
|
||||
db "3-benutze ein bereits geladenes Kernel image]: ",0
|
||||
probetext db 13,10,13,10,186," Nutze Standardgrafikmodi? [1-ja, "
|
||||
db "2-BIOS Test (Vesa 3.0)]: ",0
|
||||
;memokz256 db 13,10,186," RAM 256 Mb",0
|
||||
;memokz128 db 13,10,186," RAM 128 Mb",0
|
||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||
prnotfnd db "Fatal - Videomodus nicht gefunden.",0
|
||||
;modena db "Fatal - VBE 0x112+ required.",0
|
||||
not386 db "Fatal - CPU 386+ benoetigt.",0
|
||||
btns db "Fatal - konnte Farbtiefe nicht erkennen.",0
|
||||
fatalsel db "Fatal - Grafikmodus nicht unterstuetzt.",0
|
||||
badsect db 13,10,186," Fatal - Sektorfehler, Andere Diskette neutzen.",0
|
||||
memmovefailed db 13,10,186," Fatal - Int 0x15 Fehler.",0
|
||||
okt db " ... OK"
|
||||
linef db 13,10,0
|
||||
diskload db "Lade Diskette: 00 %",8,8,8,8,0
|
||||
pros db "00"
|
||||
backspace2 db 8,8,0
|
||||
boot_dev db 0 ; 0=floppy, 1=hd
|
||||
start_msg db "Druecke [abcd], um die Einstellungen zu aendern , druecke [Enter] zum starten",13,10,0
|
||||
time_msg db " oder warte "
|
||||
time_str db " 5 Sekunden"
|
||||
db " bis zum automatischen Start",13,10,0
|
||||
current_cfg_msg db "Aktuelle Einstellungen:",13,10,0
|
||||
curvideo_msg db " [a] Videomodus: ",0
|
||||
mode1 db "640x480",0
|
||||
mode2 db "800x600",0
|
||||
mode3 db "1024x768",0
|
||||
mode4 db "1280x1024",0
|
||||
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
|
||||
modevesa20 db " mit LFB",0
|
||||
modevesa12 db ", VESA 1.2 Bnk",0
|
||||
mode9 db "320x200, EGA/CGA 256 colors",0
|
||||
mode10 db "640x480, VGA 16 colors",0
|
||||
probeno_msg db " (Standard Modus)",0
|
||||
probeok_msg db " (teste nicht-standard Modi)",0
|
||||
dma_msg db " [b] Nutze DMA zum HDD Aufschreiben:",0
|
||||
on_msg db " an",13,10,0
|
||||
off_msg db " aus",13,10,0
|
||||
vrrm_msg db " [c] Nutze VRR:",0
|
||||
preboot_device_msg db " [d] Diskettenimage: ",0
|
||||
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
|
||||
pdm1 db "Echte Diskette",13,10,0
|
||||
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
|
||||
pdm3 db "Nutze bereits geladenes Image",13,10,0
|
||||
loading_msg db "Lade KolibriOS...",0
|
||||
save_quest db "Aktuelle Einstellungen speichern? [y/n]: ",0
|
||||
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0
|
@ -1,95 +0,0 @@
|
||||
$Revision: 437 $
|
||||
;======================================================================
|
||||
;
|
||||
; BOOT DATA
|
||||
;
|
||||
;======================================================================
|
||||
|
||||
d80x25_bottom:
|
||||
db 186,' Kolibri OS ®á®¢ Menuet OS ¨ ¥ ¯à¥¤®áâ ¢«ï¥â '
|
||||
db '¨ª ª¨å £ àa⨩. ',186
|
||||
db 186,' <20>®¤à®¡¥¥ ᬮâà¨â¥ ä ©« GNU.TXT '
|
||||
db ' ',186
|
||||
line_full_bottom
|
||||
d80x25_bottom_num = 3
|
||||
|
||||
novesa db "‚¨¤¥®ª àâ : EGA/CGA",13,10,0
|
||||
vervesa db "‚¥àá¨ï VESA: Vesa x.x",13,10,0
|
||||
vervesa_off=19
|
||||
msg_apm db " APM x.x ", 0
|
||||
|
||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
|
||||
db "[7] 1024x768, [8] 1280x1024",13,10
|
||||
db 186," EGA/CGA 256 –¢¥â®¢: [9] 320x200, "
|
||||
db "VGA 16 –¢¥â®¢: [0] 640x480",13,10
|
||||
db 186," ‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",0
|
||||
bt24 db "ƒ«ã¡¨ 梥â : 24",13,10,0
|
||||
bt32 db "ƒ«ã¡¨ 梥â : 32",13,10,0
|
||||
vrrmprint db "ˆá¯®«ì§®¢ âì VRR? (ç áâ®â ª ¤à®¢ ¢ëè¥ 60 ƒæ"
|
||||
db " ⮫쪮 ¤«ï ¯¥à¥å®¤®¢:",13,10
|
||||
db 186," 1024*768>800*600 ¨ 800*600>640*480) [1-¤ , 2-¥â]: ",0
|
||||
;askmouse db "Œëèì:" ; 186, " "
|
||||
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||
; db " ‚ë¡¥à¨â¥ ¯®àâ [1-3]: ",0
|
||||
;no_com1 db 13,10,186," No COM1 mouse",0
|
||||
;no_com2 db 13,10,186," No COM2 mouse",0
|
||||
ask_dma db "ˆá¯®«ì§®¢ âì DMA ¤«ï § ¯¨á¨ HDD? [1-¤ /2-¥â]: ",0
|
||||
;gr_direct db 186," ˆá¯®«ì§®¢ âì «¨¥©ë© ¢¨¤¥®¡ãä¥à? "
|
||||
; db "[1-¤ /2-¥â]: ",0
|
||||
;mem_model db 13,10,186," Ž¡ê+¬ ¯ ¬ï⨠[1-16 Mb / 2-32 Mb / "
|
||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0
|
||||
;bootlog db 13,10,186," <20>à®á¬®âà¥âì ¦ãà « § £à㧪¨? [1-¥â/2-¤ ]: ",0
|
||||
bdev db "‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-C:\kolibri.img (FAT32);"
|
||||
db 13,10,186," "
|
||||
db "3-¨á¯®«ì§®¢ âì 㦥 § £àã¦¥ë© ®¡à §]: ",0
|
||||
probetext db 13,10,13,10,186," ‘â ¤ àâë© ¢¨¤¥®à¥¦¨¬? [1-¤ , "
|
||||
db "2-¯à®¢¥à¨âì ¤à㣨¥ (Vesa 3.0)]: ",0
|
||||
;memokz256 db 13,10,186," RAM 256 Mb",0
|
||||
;memokz128 db 13,10,186," RAM 128 Mb",0
|
||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||
prnotfnd db "Žè¨¡ª - ‚¨¤¥®à¥¦¨¬ ¥ ©¤¥.",0
|
||||
;modena db "Žè¨¡ª - ’ॡã¥âáï ¯®¤¤¥à¦ª VBE 0x112+.",0
|
||||
not386 db "Žè¨¡ª - ’ॡã¥âáï ¯à®æ¥áá®à 386+.",0
|
||||
btns db "Žè¨¡ª - <20>¥ ¬®£ã ®¯à¥¤¥«¨âì £«ã¡¨ã 梥â .",0
|
||||
fatalsel db "Žè¨¡ª - ‚ë¡à ë© ¢¨¤¥®à¥¦¨¬ ¥ ¯®¤¤¥à¦¨¢ ¥âáï.",0
|
||||
badsect db 13,10,186," Žè¨¡ª - „¨áª¥â ¯®¢à¥¦¤¥ . <20>®¯à®¡ã©â¥ ¤àã£ãî.",0
|
||||
memmovefailed db 13,10,186," Žè¨¡ª - Int 0x15 move failed.",0
|
||||
okt db " ... OK"
|
||||
linef db 13,10,0
|
||||
diskload db "‡ £à㧪 ¤¨áª¥âë: 00 %",8,8,8,8,0
|
||||
pros db "00"
|
||||
backspace2 db 8,8,0
|
||||
boot_dev db 0
|
||||
start_msg db "<EFBFBD> ¦¬¨â¥ [abcd] ¤«ï ¨§¬¥¥¨ï áâ஥ª, [Enter] ¤«ï ¯à®¤®«¦¥¨ï § £à㧪¨",13,10,0
|
||||
time_msg db " ¨«¨ ¯®¤®¦¤¨â¥ "
|
||||
time_str db " 5 ᥪ㤠"
|
||||
db " ¤® ¢â®¬ â¨ç¥áª®£® ¯à®¤®«¦¥¨ï",13,10,0
|
||||
current_cfg_msg db "’¥ªã騥 áâனª¨:",13,10,0
|
||||
curvideo_msg db " [a] ‚¨¤¥®à¥¦¨¬: ",0
|
||||
mode1 db "640x480",0
|
||||
mode2 db "800x600",0
|
||||
mode3 db "1024x768",0
|
||||
mode4 db "1280x1024",0
|
||||
modes_msg dw mode4-0x10000,mode1-0x10000,mode2-0x10000,mode3-0x10000
|
||||
modevesa20 db " á LFB",0
|
||||
modevesa12 db ", VESA 1.2 Bnk",0
|
||||
mode9 db "320x200, EGA/CGA 256 梥⮢",0
|
||||
mode10 db "640x480, VGA 16 梥⮢",0
|
||||
probeno_msg db " (áâ ¤ àâë© ¢¨¤¥®à¥¦¨¬)",0
|
||||
probeok_msg db " (¯à®¢¥à¨âì ¥áâ ¤ àâë¥ à¥¦¨¬ë)",0
|
||||
dma_msg db " [b] ˆá¯®«ì§®¢ ¨¥ DMA ¤«ï § ¯¨á¨ HDD:",0
|
||||
on_msg db " ¢ª«",13,10,0
|
||||
off_msg db " ¢ëª«",13,10,0
|
||||
vrrm_msg db " [c] ˆá¯®«ì§®¢ ¨¥ VRR:",0
|
||||
preboot_device_msg db " [d] Ž¡à § ¤¨áª¥âë: ",0
|
||||
preboot_device_msgs dw 0,pdm1-0x10000,pdm2-0x10000,pdm3-0x10000
|
||||
pdm1 db " áâ®ïé ï ¤¨áª¥â ",13,10,0
|
||||
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
|
||||
pdm3 db "¨á¯®«ì§®¢ âì 㦥 § £àã¦¥ë© ®¡à §",13,10,0
|
||||
loading_msg db "ˆ¤ñâ § £à㧪 KolibriOS...",0
|
||||
save_quest db "‡ ¯®¬¨âì ⥪ã騥 áâனª¨? [y/n]: ",0
|
||||
loader_block_error db "Žè¨¡ª ¢ ¤ ëå ç «ì®£® § £àã§ç¨ª , ¯à®¤®«¦¥¨¥ ¥¢®§¬®¦®.",0
|
@ -1,52 +0,0 @@
|
||||
; boot data: common strings (for all languages)
|
||||
macro line_full_top {
|
||||
db 201
|
||||
times 78 db 205
|
||||
db 187
|
||||
}
|
||||
macro line_full_bottom {
|
||||
db 200
|
||||
times 78 db 205
|
||||
db 188
|
||||
}
|
||||
macro line_half {
|
||||
db 186,' '
|
||||
times 76 db 0xc4
|
||||
db ' ',186
|
||||
}
|
||||
macro line_space {
|
||||
db 186
|
||||
times 78 db 32
|
||||
db 186
|
||||
}
|
||||
d80x25_top:
|
||||
line_full_top
|
||||
cur_line_pos = 75
|
||||
store byte ' ' at d80x25_top+cur_line_pos+1
|
||||
rev_var = __REV__
|
||||
while rev_var > 0
|
||||
store byte rev_var mod 10 + '0' at d80x25_top+cur_line_pos
|
||||
cur_line_pos = cur_line_pos - 1
|
||||
rev_var = rev_var / 10
|
||||
end while
|
||||
store byte ' ' at d80x25_top+cur_line_pos
|
||||
store dword ' SVN' at d80x25_top+cur_line_pos-4
|
||||
|
||||
space_msg: line_space
|
||||
verstr:
|
||||
; line_space
|
||||
; version string
|
||||
db 186,32
|
||||
repeat 78
|
||||
load a byte from version+%-1
|
||||
if a = 13
|
||||
break
|
||||
end if
|
||||
db a
|
||||
end repeat
|
||||
repeat 78 - ($-verstr)
|
||||
db ' '
|
||||
end repeat
|
||||
db 32,186
|
||||
line_half
|
||||
d80x25_top_num = 4
|
@ -1,7 +0,0 @@
|
||||
$Revision: 425 $
|
||||
; Full ASCII code font
|
||||
; only õ and ä added
|
||||
; Kaitz
|
||||
ET_FNT:
|
||||
fontfile file "ETFONT.FNT"
|
||||
|
@ -1,34 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
display_modechg db 0 ; display mode change for text, yes/no (0 or 2)
|
||||
;
|
||||
; !! Important note !!
|
||||
;
|
||||
; Must be set to 2, to avoid two screenmode
|
||||
; changes within a very short period of time.
|
||||
|
||||
display_atboot db 0 ; show boot screen messages ( 2-no )
|
||||
|
||||
preboot_graph db 3 ; graph mode
|
||||
preboot_gprobe db 1 ; probe vesa3 videomodes (1-no, 2-yes)
|
||||
preboot_vrrm db 1 ; use VRR_M (1-yes, 2- no)
|
||||
preboot_dma_write db 2 ; use DMA for writing to HDD (1-yes, 2-no)
|
||||
preboot_device db 2 ; boot device
|
||||
; (1-floppy 2-harddisk 3-kernel restart)
|
||||
;!!!! 0 - autodetect !!!!
|
||||
preboot_blogesc db 1 ; start immediately after bootlog
|
||||
|
||||
if $>10200h
|
||||
ERROR: prebooting parameters must fit in first sector!!!
|
||||
end if
|
||||
hdsysimage db 'KOLIBRI IMG' ; load from
|
||||
image_save db 'KOLIBRI IMG' ; save to
|
||||
preboot_lfb db 0
|
||||
preboot_bootlog db 0
|
||||
|
@ -1,93 +0,0 @@
|
||||
$Revision: 425 $
|
||||
; Generated by RUFNT.EXE
|
||||
; By BadBugsKiller (C)
|
||||
; Modifyed by BadBugsKiller 12.01.2004 17:45
|
||||
; Øðèôò óìåíüøåí â ðàçìåðå è òåïåðü ñîñòîèò èç 2-óõ ÷àñòåé,
|
||||
; ñîäåðæàùèõ òîëüêî ñèìâîëû ðóññêîãî àëôàâèòà.
|
||||
; ñèìâîëû â êîäèðîâêå ASCII (ÄÎÑ'îâñêàÿ), êîäîâàÿ ñòàíèöà 866.
|
||||
RU_FNT1:
|
||||
db 0x00, 0x00, 0x1E, 0x36, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0x62, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, 0x81, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xDB, 0xDB, 0x5A, 0x5A, 0x7E, 0x7E, 0x5A, 0xDB, 0xDB, 0xDB, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xE6, 0x66, 0x6C, 0x6C, 0x78, 0x78, 0x6C, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x1F, 0x36, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xCF, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
db 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFF, 0xDB, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0x7E, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0x6C, 0x7C, 0x38, 0x38, 0x7C, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFF, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xF8, 0xF0, 0xB0, 0x30, 0x3E, 0x33, 0x33, 0x33, 0x33, 0x7E, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0xF3, 0xDB, 0xDB, 0xDB, 0xDB, 0xF3, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x26, 0x3E, 0x26, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xCE, 0xDB, 0xDB, 0xDB, 0xFB, 0xDB, 0xDB, 0xDB, 0xDB, 0xCE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x3F, 0x66, 0x66, 0x66, 0x3E, 0x3E, 0x66, 0x66, 0x66, 0xE7, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x02, 0x06, 0x7C, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x62, 0x62, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, 0xC3, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0x54, 0x7C, 0x54, 0xD6, 0xD6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x38, 0xC6, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xD6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
RU_FNT2:
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x3C, 0x18, 0x7E, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0x7E, 0x18, 0x18, 0x3C, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFF, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xB0, 0xB0, 0x3E, 0x33, 0x33, 0x7E, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xF6, 0xDE, 0xDE, 0xF6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x3E, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xDB, 0xDB, 0xFB, 0xDB, 0xDB, 0xCE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xC6, 0xC6, 0x7E, 0x36, 0x66, 0xE7, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
db 0x6C, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xFC, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC8, 0xF8, 0xC8, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xF8, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x66, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00
|
||||
db 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xCF, 0xCD, 0xEF, 0xEC, 0xFF, 0xDC, 0xDC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
@ -1,545 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; Shutdown for Menuet ;;
|
||||
;; ;;
|
||||
;; Distributed under General Public License ;;
|
||||
;; See file COPYING for details. ;;
|
||||
;; Copyright 2003 Ville Turjanmaa ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
system_shutdown: ; shut down the system
|
||||
call stop_all_services
|
||||
|
||||
push 3 ; stop playing cd
|
||||
pop eax
|
||||
call sys_cd_audio
|
||||
cld
|
||||
|
||||
mov al,[0x2f0000+0x9030]
|
||||
cmp al,1
|
||||
jl no_shutdown_parameter
|
||||
cmp al,4
|
||||
jle yes_shutdown_param
|
||||
no_shutdown_parameter:
|
||||
|
||||
; movzx ecx,word [0x2f0000+0x900A]
|
||||
; movzx esi,word [0x2f0000+0x900C]
|
||||
; imul ecx,esi ;[0xfe04]
|
||||
;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen
|
||||
; push ecx
|
||||
; mov esi,[0xfe80]
|
||||
; cmp esi,32*0x100000
|
||||
; jbe no_darken_screen
|
||||
; mov edi,16*0x100000
|
||||
; push esi edi
|
||||
; sdnewpix:
|
||||
; lodsd
|
||||
; shr eax,1
|
||||
; and eax,0x7f7f7f7f
|
||||
; stosd
|
||||
; loop sdnewpix
|
||||
; pop ecx
|
||||
; pop esi edi
|
||||
; rep movsd
|
||||
; no_darken_screen:
|
||||
|
||||
; read shutdown code:
|
||||
; 1) display shutdown "window"
|
||||
|
||||
mov eax,[0xfe00]
|
||||
shr eax,1
|
||||
lea esi,[eax+220] ; x end
|
||||
sub eax,220 ; x start
|
||||
|
||||
mov ebx,[ScreenHeight]
|
||||
shr ebx,1
|
||||
mov [shutdownpos],ebx
|
||||
lea ebp,[ebx+105] ; y end
|
||||
sub ebx,120 ; y start
|
||||
|
||||
xor edi,edi
|
||||
inc edi ; force putpixel & dtext
|
||||
mov ecx,0x0000ff
|
||||
|
||||
; vertical loop begin
|
||||
sdnewpix1:
|
||||
push eax ; save x start
|
||||
|
||||
; horizontal loop begin
|
||||
sdnewpix2:
|
||||
|
||||
call [putpixel]
|
||||
|
||||
inc eax
|
||||
cmp eax,esi
|
||||
jnz sdnewpix2
|
||||
; horizontal loop end
|
||||
|
||||
dec ecx ; color
|
||||
pop eax ; restore x start
|
||||
|
||||
inc ebx ; advance y pos
|
||||
cmp ebx,ebp
|
||||
jnz sdnewpix1
|
||||
; vertical loop end
|
||||
|
||||
; 2) display text strings
|
||||
; a) version
|
||||
mov eax,[0xfe00]
|
||||
shr eax,1
|
||||
shl eax,16
|
||||
mov ax,word [shutdownpos]
|
||||
push eax
|
||||
sub eax,(220-27)*10000h + 105
|
||||
mov ebx,0xffff00
|
||||
mov ecx,version
|
||||
push 34
|
||||
pop edx
|
||||
call dtext
|
||||
|
||||
; b) variants
|
||||
add eax,105+33
|
||||
push 6
|
||||
pop esi
|
||||
; mov ebx,0xffffff
|
||||
mov bl,0xFF
|
||||
mov ecx,shutdowntext
|
||||
mov dl,40
|
||||
newsdt:
|
||||
call dtext
|
||||
add eax,10
|
||||
add ecx,edx
|
||||
dec esi
|
||||
jnz newsdt
|
||||
|
||||
; 3) load & display rose.txt
|
||||
mov eax,rosef-std_application_base_address ; load rose.txt
|
||||
xor ebx,ebx
|
||||
push 2
|
||||
pop ecx
|
||||
mov edx,0x90000
|
||||
push edx
|
||||
push 12
|
||||
pop esi
|
||||
push edi ; may be destroyed
|
||||
|
||||
pushad
|
||||
push eax
|
||||
call file_system_lfn ; by SPraid fileread
|
||||
pop eax
|
||||
popad
|
||||
pop edi
|
||||
|
||||
pop ecx
|
||||
inc ecx ; do not display stars from rose.txt
|
||||
pop eax
|
||||
add eax,20*10000h - 110
|
||||
|
||||
mov ebx,0x00ff00
|
||||
push 27
|
||||
pop edx
|
||||
|
||||
nrl:
|
||||
call dtext
|
||||
; sub ebx,0x050000
|
||||
ror ebx, 16
|
||||
sub bl, 0x05
|
||||
ror ebx, 16
|
||||
add eax,8
|
||||
add ecx,31
|
||||
cmp cx,word 0x0001+25*31
|
||||
jnz nrl
|
||||
|
||||
call checkVga_N13
|
||||
|
||||
yes_shutdown_param:
|
||||
cli
|
||||
|
||||
mov eax,kernel ; load kernel.mnt to 0x8000:0
|
||||
push 12
|
||||
pop esi
|
||||
xor ebx,ebx
|
||||
or ecx,-1
|
||||
mov edx,0x80000
|
||||
call fileread
|
||||
|
||||
mov esi,restart_kernel_4000+0x10000 ; move kernel re-starter to 0x4000:0
|
||||
mov edi,0x40000
|
||||
mov ecx,1000
|
||||
rep movsb
|
||||
|
||||
mov eax,0x2F0000 ; restore 0x0 - 0xffff
|
||||
xor ebx,ebx
|
||||
mov ecx,0x10000
|
||||
call memmove
|
||||
|
||||
call restorefatchain
|
||||
|
||||
mov al, 0xFF
|
||||
out 0x21, al
|
||||
out 0xA1, al
|
||||
|
||||
mov word [0x467+0],pr_mode_exit-0x10000
|
||||
mov word [0x467+2],0x1000
|
||||
|
||||
mov al,0x0F
|
||||
out 0x70,al
|
||||
mov al,0x05
|
||||
out 0x71,al
|
||||
|
||||
mov al,0xFE
|
||||
out 0x64,al
|
||||
hlt
|
||||
|
||||
use16
|
||||
|
||||
pr_mode_exit:
|
||||
org $-0x10000
|
||||
|
||||
; setup stack
|
||||
mov ax, 3000h
|
||||
mov ss, ax
|
||||
mov esp, 0EC00h
|
||||
; setup ds
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
lidt [old_ints_h-0x10000]
|
||||
;remap IRQs
|
||||
mov al,0x11
|
||||
out 0x20,al
|
||||
call rdelay
|
||||
out 0xA0,al
|
||||
call rdelay
|
||||
|
||||
mov al,0x08
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
mov al,0x70
|
||||
out 0xA1,al
|
||||
call rdelay
|
||||
|
||||
mov al,0x04
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
mov al,0x02
|
||||
out 0xA1,al
|
||||
call rdelay
|
||||
|
||||
mov al,0x01
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
out 0xA1,al
|
||||
call rdelay
|
||||
|
||||
mov al,0xB8
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
mov al,0xBD
|
||||
out 0xA1,al
|
||||
sti
|
||||
|
||||
temp_3456:
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov al,byte [es:0x9030]
|
||||
cmp al,1
|
||||
jl nbw
|
||||
cmp al,4
|
||||
jle nbw32
|
||||
|
||||
nbw:
|
||||
in al,0x60
|
||||
call pause_key
|
||||
cmp al,6
|
||||
jae nbw
|
||||
mov bl,al
|
||||
nbw2:
|
||||
in al,0x60
|
||||
call pause_key
|
||||
cmp al,bl
|
||||
je nbw2
|
||||
cmp al,240 ;ax,240
|
||||
jne nbw31
|
||||
mov al,bl
|
||||
dec ax
|
||||
jmp nbw32
|
||||
nbw31:
|
||||
add bl,128
|
||||
cmp al,bl
|
||||
jne nbw
|
||||
sub al,129
|
||||
|
||||
nbw32:
|
||||
|
||||
dec ax ; 1 = write floppy
|
||||
js nbw
|
||||
jnz no_floppy_write
|
||||
call floppy_write
|
||||
jmp temp_3456 ;nbw
|
||||
no_floppy_write:
|
||||
|
||||
dec ax ; 2 = power off
|
||||
jnz no_apm_off
|
||||
call APM_PowerOff
|
||||
jmp $
|
||||
no_apm_off:
|
||||
|
||||
dec ax ; 3 = reboot
|
||||
jnz restart_kernel ; 4 = restart kernel
|
||||
push 0x40
|
||||
pop ds
|
||||
mov word[0x0072],0x1234
|
||||
jmp 0xF000:0xFFF0
|
||||
|
||||
pause_key:
|
||||
mov cx,100
|
||||
pause_key_1:
|
||||
loop pause_key_1
|
||||
ret
|
||||
|
||||
rdelay:
|
||||
ret
|
||||
|
||||
iglobal
|
||||
kernel db 'KERNEL MNT'
|
||||
; shutdown_parameter db 0
|
||||
endg
|
||||
|
||||
restart_kernel:
|
||||
|
||||
mov ax,0x0003 ; set text mode for screen
|
||||
int 0x10
|
||||
|
||||
jmp 0x4000:0000
|
||||
|
||||
|
||||
restart_kernel_4000:
|
||||
cli
|
||||
|
||||
; mov di,0x1000 ; load kernel image from 0x8000:0 -> 0x1000:0
|
||||
;
|
||||
; new_kernel_block_move:
|
||||
;
|
||||
; mov ebx,0
|
||||
;
|
||||
; new_kernel_byte_move:
|
||||
;
|
||||
; mov ax,di
|
||||
; add ax,0x7000
|
||||
; mov es,ax
|
||||
; mov dl,[es:bx]
|
||||
; mov es,di
|
||||
; mov [es:bx],dl
|
||||
;
|
||||
; inc ebx
|
||||
; cmp ebx,65536
|
||||
; jbe new_kernel_byte_move
|
||||
;
|
||||
; add di,0x1000
|
||||
; cmp di,0x2000
|
||||
; jbe new_kernel_block_move
|
||||
push ds
|
||||
pop es
|
||||
mov cx, 0x8000
|
||||
push cx
|
||||
mov ds, cx
|
||||
xor si, si
|
||||
xor di, di
|
||||
rep movsw
|
||||
push 0x9000
|
||||
pop ds
|
||||
push 0x2000
|
||||
pop es
|
||||
pop cx
|
||||
rep movsw
|
||||
|
||||
wbinvd ; write and invalidate cache
|
||||
|
||||
; mov ax,0x1000
|
||||
; mov es,ax
|
||||
; mov ax,0x3000
|
||||
; mov ss,ax
|
||||
; mov sp,0xec00
|
||||
; restore timer
|
||||
mov al, 00110100b
|
||||
out 43h, al
|
||||
jcxz $+2
|
||||
mov al, 0xFF
|
||||
out 40h, al
|
||||
jcxz $+2
|
||||
out 40h, al
|
||||
jcxz $+2
|
||||
sti
|
||||
|
||||
; (hint by Black_mirror)
|
||||
; We must read data from keyboard port,
|
||||
; because there may be situation when previous keyboard interrupt is lost
|
||||
; (due to return to real mode and IRQ reprogramming)
|
||||
; and next interrupt will not be generated (as keyboard waits for handling)
|
||||
in al, 0x60
|
||||
|
||||
; bootloader interface
|
||||
push 0x1000
|
||||
pop ds
|
||||
mov si, kernel_restart_bootblock-0x10000
|
||||
mov ax, 'KL'
|
||||
jmp 0x1000:0000
|
||||
|
||||
APM_PowerOff:
|
||||
mov ax, 5304h
|
||||
xor bx, bx
|
||||
int 15h
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
mov ax,0x5300
|
||||
xor bx,bx
|
||||
int 0x15
|
||||
push ax
|
||||
|
||||
mov ax,0x5301
|
||||
xor bx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x5308
|
||||
mov bx,1
|
||||
mov cx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x530E
|
||||
xor bx,bx
|
||||
pop cx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x530D
|
||||
mov bx,1
|
||||
mov cx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x530F
|
||||
mov bx,1
|
||||
mov cx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x5307
|
||||
mov bx,1
|
||||
mov cx,3
|
||||
int 0x15
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
fwwritedone:
|
||||
ret
|
||||
org $+0x10000
|
||||
flm db 0
|
||||
org $-0x10000
|
||||
|
||||
floppy_write: ; write diskette image to physical floppy
|
||||
|
||||
cmp [flm-0x10000],byte 1
|
||||
je fwwritedone
|
||||
mov [flm-0x10000],byte 1
|
||||
|
||||
xor ax, ax ; reset drive
|
||||
xor dx, dx
|
||||
int 0x13
|
||||
|
||||
mov cx,0x0001 ; startcyl,startsector
|
||||
; mov dx,0x0000 ; starthead,drive
|
||||
xor dx, dx
|
||||
mov ax, 80*2 ; read no of sect
|
||||
|
||||
fwwrites:
|
||||
push ax
|
||||
|
||||
; move 1mb+ -> 0:a000
|
||||
|
||||
pusha
|
||||
mov si,fwmovedesc -0x10000
|
||||
mov cx,256*18
|
||||
mov ah,0x87
|
||||
push ds
|
||||
pop es
|
||||
int 0x15
|
||||
add dword [fwmovedesc-0x10000+0x12], 512*18
|
||||
popa
|
||||
|
||||
xor si,si
|
||||
mov es,si
|
||||
fwnewwrite:
|
||||
mov bx,0xa000 ; es:bx -> data area
|
||||
mov ax,0x0300+18 ; read, no of sectors to read
|
||||
int 0x13
|
||||
|
||||
test ah, ah
|
||||
jz fwgoodwrite
|
||||
|
||||
inc si
|
||||
cmp si,10
|
||||
jnz fwnewwrite
|
||||
|
||||
; can't access diskette - return
|
||||
pop ax
|
||||
ret
|
||||
|
||||
fwgoodwrite:
|
||||
inc dh
|
||||
cmp dh,2
|
||||
jnz fwbb2
|
||||
mov dh,0
|
||||
inc ch
|
||||
fwbb2:
|
||||
pop ax
|
||||
dec ax
|
||||
jnz fwwrites
|
||||
ret
|
||||
org $+0x10000
|
||||
fwmovedesc:
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
|
||||
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
org $-0x10000
|
||||
use32
|
||||
org $+0x10000
|
||||
uglobal
|
||||
shutdownpos dd 0x0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
if lang eq en
|
||||
shutdowntext:
|
||||
db "IT'S SAFE TO POWER OFF COMPUTER OR "
|
||||
db ' '
|
||||
db '1) SAVE RAMDISK TO FLOPPY '
|
||||
db '2) APM - POWEROFF '
|
||||
db '3) REBOOT '
|
||||
db '4) RESTART KERNEL '
|
||||
else if lang eq ru
|
||||
shutdowntext:
|
||||
db "<EFBFBD>¥§®¯ ᮥ ¢ëª«î票¥ ª®¬¯ìîâ¥à ¨«¨ "
|
||||
db ' '
|
||||
db '1) ‘®åà ¨âì à ¬¤¨áª ¤¨áª¥âã '
|
||||
db '2) APM - ¢ëª«î票¥ ¯¨â ¨ï '
|
||||
db '3) <20>¥à¥§ £à㧪 á¨á⥬ë '
|
||||
db '4) <20>¥áâ àâ ï¤à ¨§ Ž‡“ '
|
||||
else
|
||||
shutdowntext:
|
||||
db "SIE KOENNEN DEN COMPUTER NUN AUSSCHALTEN"
|
||||
db ' '
|
||||
db '1) RAMDISK AUF DISK SPEICHERN '
|
||||
db '2) APM - AUSSCHALTEN '
|
||||
db '3) NEUSTARTEN '
|
||||
db '4) KERNEL NEU STARTEN '
|
||||
end if
|
||||
rosef:
|
||||
dd 0,0,0,1024,0x90000-std_application_base_address
|
||||
db '/rd/1/ROSE.TXT',0
|
||||
endg
|
@ -1,31 +0,0 @@
|
||||
boot_log:
|
||||
pushad
|
||||
|
||||
mov eax,10*65536
|
||||
mov ax,word [boot_y]
|
||||
add [boot_y],dword 10
|
||||
mov ebx,0x80ffffff ; ASCIIZ string with white color
|
||||
mov ecx,esi
|
||||
mov edi,1
|
||||
call dtext
|
||||
|
||||
mov [novesachecksum],1000
|
||||
call checkVga_N13
|
||||
|
||||
cmp [preboot_blogesc],byte 1
|
||||
je .bll2
|
||||
|
||||
cmp esi,boot_tasking
|
||||
jne .bll2
|
||||
; begin ealex 04.08.05
|
||||
; in al,0x61
|
||||
; and al,01111111b
|
||||
; out 0x61,al
|
||||
; end ealex 04.08.05
|
||||
.bll1: in al,0x60 ; wait for ESC key press
|
||||
cmp al,129
|
||||
jne .bll1
|
||||
|
||||
.bll2: popad
|
||||
|
||||
ret
|
@ -1,25 +0,0 @@
|
||||
iglobal
|
||||
boot_memdetect db 'Determining amount of memory',0
|
||||
boot_fonts db 'Fonts loaded',0
|
||||
boot_tss db 'Setting TSSs',0
|
||||
boot_cpuid db 'Reading CPUIDs',0
|
||||
boot_devices db 'Detecting devices',0
|
||||
boot_timer db 'Setting timer',0
|
||||
boot_irqs db 'Reprogramming IRQs',0
|
||||
boot_setmouse db 'Setting mouse',0
|
||||
boot_windefs db 'Setting window defaults',0
|
||||
boot_bgr db 'Calculating background',0
|
||||
boot_resirqports db 'Reserving IRQs & ports',0
|
||||
boot_setrports db 'Setting addresses for IRQs',0
|
||||
boot_setostask db 'Setting OS task',0
|
||||
boot_allirqs db 'Unmasking all IRQs',0
|
||||
boot_tsc db 'Reading TSC',0
|
||||
boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0
|
||||
boot_pal_vga db 'Setting VGA 640x480 palette',0
|
||||
boot_mtrr db 'Setting MTRR',0
|
||||
boot_tasking db 'All set - press ESC to start',0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
boot_y dd 10
|
||||
endg
|
@ -1,49 +0,0 @@
|
||||
align 4
|
||||
B32:
|
||||
include "clear.inc"
|
||||
include "rmode.inc"
|
||||
include "graphaddr.inc"
|
||||
include "sysenter.inc"
|
||||
call mem_test
|
||||
call init_mtrr
|
||||
call init_mem
|
||||
call init_page_map
|
||||
include "paging.inc"
|
||||
include "graphbase.inc"
|
||||
|
||||
call build_scheduler ; sys32.inc
|
||||
; LOAD IDT
|
||||
lidt [cs:idtreg]
|
||||
cli
|
||||
|
||||
include 'detect/disks.inc'
|
||||
;include 'rdload.inc'
|
||||
call calculatefatchain
|
||||
include 'vmodeld.inc'
|
||||
include "loadfont.inc"
|
||||
include "printmem.inc"
|
||||
include "redirirq.inc"
|
||||
include "timer.inc"
|
||||
include "setmouse.inc"
|
||||
include "windef.inc"
|
||||
include "setbgr.inc"
|
||||
include "resirq.inc"
|
||||
include "setports.inc"
|
||||
include "ostask.inc"
|
||||
call init_cursors
|
||||
include "tsc.inc"
|
||||
call set_variables
|
||||
call stack_init
|
||||
call fdc_init
|
||||
include "palette.Inc"
|
||||
include "loadskn.inc"
|
||||
include "firstapp.inc"
|
||||
include "kbset.inc"
|
||||
include "tasking.Inc"
|
||||
include "allirqs.inc"
|
||||
sti
|
||||
jmp $ ; wait here for timer to take control
|
||||
|
||||
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
; CLEAR 0x280000-0xF00000
|
||||
|
||||
xor eax,eax
|
||||
mov edi,0x280000
|
||||
mov ecx,(0x100000*0xF-0x280000) / 4
|
||||
cld
|
||||
rep stosd
|
||||
; CLEAR 0x80000-0x90000
|
||||
; xor eax,eax
|
||||
|
||||
mov edi,0x80000
|
||||
mov ecx,(0x90000-0x80000)/4
|
||||
; cld
|
||||
rep stosd
|
||||
|
||||
; CLEAR KERNEL UNDEFINED GLOBALS
|
||||
mov edi, endofcode
|
||||
mov ecx, (uglobals_size/4)+4
|
||||
rep stosd
|
||||
|
||||
; SAVE & CLEAR 0-0xffff
|
||||
|
||||
mov esi,0x0000
|
||||
mov edi,0x2F0000
|
||||
mov ecx,0x10000 / 4
|
||||
cld
|
||||
rep movsd
|
||||
xor eax,eax
|
||||
mov edi,0
|
||||
mov ecx,0x10000 / 4
|
||||
cld
|
||||
rep stosd
|
@ -1,28 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;***************************************************
|
||||
; ïðåäâàðèòåëüíàÿ î÷èñòêà îáëàñòè òàáëèöû
|
||||
; ïîèñê è çàíåñåíèå â òàáëèöó ïðèâîäîâ FDD
|
||||
; àâòîð Mario79
|
||||
;***************************************************
|
||||
xor eax,eax
|
||||
mov edi,DRIVE_DATA
|
||||
mov ecx,16384
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov al,0x10
|
||||
out 0x70,al
|
||||
mov cx,0xff
|
||||
wait_cmos:
|
||||
dec cx
|
||||
cmp cx,0
|
||||
jne wait_cmos
|
||||
in al,0x71
|
||||
mov [DRIVE_DATA],al
|
@ -1,382 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;******************************************************
|
||||
; поиск приводов HDD и CD
|
||||
; автор исходного текста Кулаков Владимир Геннадьевич.
|
||||
; адаптация и доработка Mario79
|
||||
;******************************************************
|
||||
|
||||
;****************************************************
|
||||
;* ПОИСК HDD и CD *
|
||||
;****************************************************
|
||||
FindHDD:
|
||||
mov [ChannelNumber],1
|
||||
mov [DiskNumber],0
|
||||
call FindHDD_3
|
||||
; mov ax,[Sector512+176]
|
||||
; mov [DRIVE_DATA+6],ax
|
||||
; mov ax,[Sector512+126]
|
||||
; mov [DRIVE_DATA+8],ax
|
||||
; mov ax,[Sector512+128]
|
||||
; mov [DRIVE_DATA+8],ax
|
||||
mov [DiskNumber],1
|
||||
call FindHDD_3
|
||||
; mov al,[Sector512+176]
|
||||
; mov [DRIVE_DATA+7],al
|
||||
inc [ChannelNumber]
|
||||
mov [DiskNumber],0
|
||||
call FindHDD_3
|
||||
; mov al,[Sector512+176]
|
||||
; mov [DRIVE_DATA+8],al
|
||||
mov [DiskNumber],1
|
||||
call FindHDD_1
|
||||
; mov al,[Sector512+176]
|
||||
; mov [DRIVE_DATA+9],al
|
||||
|
||||
jmp EndFindHDD
|
||||
|
||||
FindHDD_1:
|
||||
call ReadHDD_ID
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2
|
||||
cmp [Sector512+6],word 16
|
||||
ja FindHDD_2
|
||||
cmp [Sector512+12],word 255
|
||||
ja FindHDD_2
|
||||
inc byte [DRIVE_DATA+1]
|
||||
jmp FindHDD_2_2
|
||||
FindHDD_2:
|
||||
call DeviceReset
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2_2
|
||||
call ReadCD_ID
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2_2
|
||||
inc byte [DRIVE_DATA+1]
|
||||
inc byte [DRIVE_DATA+1]
|
||||
FindHDD_2_2:
|
||||
ret
|
||||
|
||||
FindHDD_3:
|
||||
call FindHDD_1
|
||||
shl byte [DRIVE_DATA+1],2
|
||||
ret
|
||||
|
||||
|
||||
; Адрес считываемого сектора в режиме LBA
|
||||
SectorAddress DD ?
|
||||
|
||||
;*************************************************
|
||||
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА ЖЕСТКОГО ДИСКА *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* переменные: *
|
||||
;* ChannelNumber - номер канала (1 или 2); *
|
||||
;* DiskNumber - номер диска на канале (0 или 1). *
|
||||
;* Идентификационный блок данных считывается *
|
||||
;* в массив Sector512. *
|
||||
;*************************************************
|
||||
ReadHDD_ID:
|
||||
; Задать режим CHS
|
||||
mov [ATAAddressMode],0
|
||||
; Послать команду идентификации устройства
|
||||
mov [ATAFeatures],0
|
||||
mov [ATAHead],0
|
||||
mov [ATACommand],0ECh
|
||||
call SendCommandToHDD
|
||||
cmp [DevErrorCode],0 ;проверить код ошибки
|
||||
jne @@End ;закончить, сохранив код ошибки
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;адрес регистра состояни
|
||||
mov ecx,0xffff
|
||||
@@WaitCompleet:
|
||||
; Проверить время выполнения команды
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Error1 ;ошибка тайм-аута
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
jnz @@WaitCompleet
|
||||
test AL,1 ;состояние сигнала ERR
|
||||
jnz @@Error6
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitCompleet
|
||||
; Принять блок данных от контроллера
|
||||
; mov AX,DS
|
||||
; mov ES,AX
|
||||
mov EDI,Sector512 ;offset Sector512
|
||||
mov DX,[ATABasePortAddr] ;регистр данных
|
||||
mov CX,256 ;число считываемых слов
|
||||
rep insw ;принять блок данных
|
||||
jmp @@End
|
||||
; Записать код ошибки
|
||||
@@Error1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End
|
||||
@@Error6:
|
||||
mov [DevErrorCode],6
|
||||
@@End: ret
|
||||
|
||||
|
||||
|
||||
; Стандартные базовые адреса каналов 1 и 2
|
||||
StandardATABases DW 1F0h, 170h
|
||||
; Номер канала
|
||||
ChannelNumber DW ?
|
||||
; Номер диска
|
||||
DiskNumber DB ?
|
||||
; Базовый адрес группы портов контроллера ATA
|
||||
ATABasePortAddr DW ?
|
||||
; Параметры ATA-команды
|
||||
ATAFeatures DB ? ;особенности
|
||||
ATASectorCount DB ? ;количество обрабатываемых секторов
|
||||
ATASectorNumber DB ? ;номер начального сектора
|
||||
ATACylinder DW ? ;номер начального цилиндра
|
||||
ATAHead DB ? ;номер начальной головки
|
||||
ATAAddressMode DB ? ;режим адресации (0 - CHS, 1 - LBA)
|
||||
ATACommand DB ? ;код команды, подлежащей выполнению
|
||||
; Код ошибки (0 - нет ошибок, 1 - превышен допустимый
|
||||
; интервал ожидания, 2 - неверный код режима адресации,
|
||||
; 3 - неверный номер канала, 4 - неверный номер диска,
|
||||
; 5 - неверный номер головки, 6 - ошибка при выполнении
|
||||
; команды)
|
||||
DevErrorCode DB ?
|
||||
|
||||
;****************************************************
|
||||
;* ПОСЛАТЬ КОМАНДУ ЗАДАННОМУ ДИСКУ *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* переменные: *
|
||||
;* ChannelNumber - номер канала (1 или 2); *
|
||||
;* DiskNumber - номер диска (0 или 1); *
|
||||
;* ATAFeatures - "особенности"; *
|
||||
;* ATASectorCount - количество секторов; *
|
||||
;* ATASectorNumber - номер начального сектора; *
|
||||
;* ATACylinder - номер начального цилиндра; *
|
||||
;* ATAHead - номер начальной головки; *
|
||||
;* ATAAddressMode - режим адресации (0-CHS, 1-LBA); *
|
||||
;* ATACommand - код команды. *
|
||||
;* После успешного выполнения функции: *
|
||||
;* в ATABasePortAddr - базовый адрес HDD; *
|
||||
;* в DevErrorCode - ноль. *
|
||||
;* При возникновении ошибки в DevErrorCode будет *
|
||||
;* возвращен код ошибки. *
|
||||
;****************************************************
|
||||
SendCommandToHDD:
|
||||
; Проверить значение кода режима
|
||||
cmp [ATAAddressMode],1
|
||||
ja @@Err2
|
||||
; Проверить корректность номера канала
|
||||
mov BX,[ChannelNumber]
|
||||
cmp BX,1
|
||||
jb @@Err3
|
||||
cmp BX,2
|
||||
ja @@Err3
|
||||
; Установить базовый адрес
|
||||
dec BX
|
||||
shl BX,1
|
||||
movzx ebx,bx
|
||||
mov AX,[ebx+StandardATABases]
|
||||
mov [ATABasePortAddr],AX
|
||||
; Ожидание готовности HDD к приему команды
|
||||
; Выбрать нужный диск
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,6 ;адрес регистра головок
|
||||
mov AL,[DiskNumber]
|
||||
cmp AL,1 ;проверить номера диска
|
||||
ja @@Err4
|
||||
shl AL,4
|
||||
or AL,10100000b
|
||||
out DX,AL
|
||||
; Ожидать, пока диск не будет готов
|
||||
inc DX
|
||||
mov ecx,0xfff
|
||||
; mov eax,[timer_ticks]
|
||||
; mov [TickCounter_1],eax
|
||||
@@WaitHDReady:
|
||||
; Проверить время ожидани
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1
|
||||
; mov eax,[timer_ticks]
|
||||
; sub eax,[TickCounter_1]
|
||||
; cmp eax,300 ;ожидать 300 тиков
|
||||
; ja @@Err1 ;ошибка тайм-аута
|
||||
; Прочитать регистр состояни
|
||||
in AL,DX
|
||||
; Проверить состояние сигнала BSY
|
||||
test AL,80h
|
||||
jnz @@WaitHDReady
|
||||
; Проверить состояние сигнала DRQ
|
||||
test AL,08h
|
||||
jnz @@WaitHDReady
|
||||
; Загрузить команду в регистры контроллера
|
||||
cli
|
||||
mov DX,[ATABasePortAddr]
|
||||
inc DX ;регистр "особенностей"
|
||||
mov AL,[ATAFeatures]
|
||||
out DX,AL
|
||||
inc DX ;счетчик секторов
|
||||
mov AL,[ATASectorCount]
|
||||
out DX,AL
|
||||
inc DX ;регистр номера сектора
|
||||
mov AL,[ATASectorNumber]
|
||||
out DX,AL
|
||||
inc DX ;номер цилиндра (младший байт)
|
||||
mov AX,[ATACylinder]
|
||||
out DX,AL
|
||||
inc DX ;номер цилиндра (старший байт)
|
||||
mov AL,AH
|
||||
out DX,AL
|
||||
inc DX ;номер головки/номер диска
|
||||
mov AL,[DiskNumber]
|
||||
shl AL,4
|
||||
cmp [ATAHead],0Fh ;проверить номер головки
|
||||
ja @@Err5
|
||||
or AL,[ATAHead]
|
||||
or AL,10100000b
|
||||
mov AH,[ATAAddressMode]
|
||||
shl AH,6
|
||||
or AL,AH
|
||||
out DX,AL
|
||||
; Послать команду
|
||||
mov AL,[ATACommand]
|
||||
inc DX ;регистр команд
|
||||
out DX,AL
|
||||
sti
|
||||
; Сбросить признак ошибки
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_2
|
||||
; Записать код ошибки
|
||||
@@Err1: mov [DevErrorCode],1
|
||||
jmp @@End_2
|
||||
@@Err2: mov [DevErrorCode],2
|
||||
jmp @@End_2
|
||||
@@Err3: mov [DevErrorCode],3
|
||||
jmp @@End_2
|
||||
@@Err4: mov [DevErrorCode],4
|
||||
jmp @@End_2
|
||||
@@Err5: mov [DevErrorCode],5
|
||||
; Завершение работы программы
|
||||
@@End_2:
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА УСТРОЙСТВА ATAPI *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* перменные: *
|
||||
;* ChannelNumber - номер канала; *
|
||||
;* DiskNumber - номер диска на канале. *
|
||||
;* Идентификационный блок данных считывается *
|
||||
;* в массив Sector512. *
|
||||
;*************************************************
|
||||
ReadCD_ID:
|
||||
; Задать режим CHS
|
||||
mov [ATAAddressMode],0
|
||||
; Послать команду идентификации устройства
|
||||
mov [ATAFeatures],0
|
||||
mov [ATASectorCount],0
|
||||
mov [ATASectorNumber],0
|
||||
mov [ATACylinder],0
|
||||
mov [ATAHead],0
|
||||
mov [ATACommand],0A1h
|
||||
call SendCommandToHDD
|
||||
cmp [DevErrorCode],0 ;проверить код ошибки
|
||||
jne @@End_1 ;закончить, сохранив код ошибки
|
||||
; Ожидать готовность данных HDD
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;порт 1х7h
|
||||
mov ecx,0xffff
|
||||
@@WaitCompleet_1:
|
||||
; Проверить врем
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Error1_1 ;ошибка тайм-аута
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
test AL,80h ;состояние сигнала BSY
|
||||
jnz @@WaitCompleet_1
|
||||
test AL,1 ;состояние сигнала ERR
|
||||
jnz @@Error6_1
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitCompleet_1
|
||||
; Принять блок данных от контроллера
|
||||
; mov AX,DS
|
||||
; mov ES,AX
|
||||
mov EDI,Sector512 ;offset Sector512
|
||||
mov DX,[ATABasePortAddr] ;порт 1x0h
|
||||
mov CX,256 ;число считываемых слов
|
||||
rep insw
|
||||
jmp @@End_1
|
||||
; Записать код ошибки
|
||||
@@Error1_1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_1
|
||||
@@Error6_1:
|
||||
mov [DevErrorCode],6
|
||||
@@End_1:
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* СБРОС УСТРОЙСТВА *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
;* переменные: *
|
||||
;* ChannelNumber - номер канала (1 или 2); *
|
||||
;* DiskNumber - номер диска (0 или 1). *
|
||||
;*************************************************
|
||||
DeviceReset:
|
||||
; Проверить корректность номера канала
|
||||
mov BX,[ChannelNumber]
|
||||
cmp BX,1
|
||||
jb @@Err3_2
|
||||
cmp BX,2
|
||||
ja @@Err3_2
|
||||
; Установить базовый адрес
|
||||
dec BX
|
||||
shl BX,1
|
||||
movzx ebx,bx
|
||||
mov DX,[ebx+StandardATABases]
|
||||
mov [ATABasePortAddr],DX
|
||||
; Выбрать нужный диск
|
||||
add DX,6 ;адрес регистра головок
|
||||
mov AL,[DiskNumber]
|
||||
cmp AL,1 ;проверить номера диска
|
||||
ja @@Err4_2
|
||||
shl AL,4
|
||||
or AL,10100000b
|
||||
out DX,AL
|
||||
; Послать команду "Сброс"
|
||||
mov AL,08h
|
||||
inc DX ;регистр команд
|
||||
out DX,AL
|
||||
mov ecx,0x80000
|
||||
@@WaitHDReady_1:
|
||||
; Проверить время ожидани
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1_2 ;ошибка тайм-аута
|
||||
; Прочитать регистр состояни
|
||||
in AL,DX
|
||||
; Проверить состояние сигнала BSY
|
||||
test AL,80h
|
||||
jnz @@WaitHDReady_1
|
||||
; Сбросить признак ошибки
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_3
|
||||
; Обработка ошибок
|
||||
@@Err1_2: mov [DevErrorCode],1
|
||||
jmp @@End_3
|
||||
@@Err3_2: mov [DevErrorCode],3
|
||||
jmp @@End_3
|
||||
@@Err4_2: mov [DevErrorCode],4
|
||||
; Записать код ошибки
|
||||
@@End_3:
|
||||
ret
|
||||
|
||||
EndFindHDD:
|
||||
|
@ -1,5 +0,0 @@
|
||||
$Revision: 425 $
|
||||
include 'dev_fd.inc'
|
||||
include 'dev_hdcd.inc'
|
||||
include 'sear_par.inc'
|
||||
|
@ -1,125 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;****************************************************
|
||||
; ïîèñê ëîãè÷åñêèõ äèñêîâ íà îáíàðóæåííûõ HDD
|
||||
; è çàíåñåíèå äàííûõ â îáëàñòü òàáëèöû
|
||||
; àâòîð Mario79
|
||||
;****************************************************
|
||||
mov [transfer_adress],DRIVE_DATA+0xa
|
||||
search_partitions_ide0:
|
||||
test [DRIVE_DATA+1],byte 0x40
|
||||
jz search_partitions_ide1
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],1
|
||||
mov [fat32part],1
|
||||
search_partitions_ide0_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne search_partitions_ide1
|
||||
inc byte [DRIVE_DATA+2]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide0_1
|
||||
|
||||
search_partitions_ide1:
|
||||
test [DRIVE_DATA+1],byte 0x10
|
||||
jz search_partitions_ide2
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],2
|
||||
mov [fat32part],1
|
||||
search_partitions_ide1_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne search_partitions_ide2
|
||||
inc byte [DRIVE_DATA+3]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide1_1
|
||||
|
||||
search_partitions_ide2:
|
||||
test [DRIVE_DATA+1],byte 0x4
|
||||
jz search_partitions_ide3
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],3
|
||||
mov [fat32part],1
|
||||
search_partitions_ide2_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne search_partitions_ide3
|
||||
inc byte [DRIVE_DATA+4]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide2_1
|
||||
|
||||
search_partitions_ide3:
|
||||
test [DRIVE_DATA+1],byte 0x1
|
||||
jz end_search_partitions_ide
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],4
|
||||
mov [fat32part],1
|
||||
search_partitions_ide3_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne end_search_partitions_ide
|
||||
inc byte [DRIVE_DATA+5]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide3_1
|
||||
|
||||
|
||||
partition_data_transfer:
|
||||
mov edi,[transfer_adress]
|
||||
mov esi,PARTITION_START
|
||||
mov ecx,(file_system_data_size+3)/4
|
||||
rep movsd
|
||||
ret
|
||||
uglobal
|
||||
transfer_adress dd 0
|
||||
endg
|
||||
partition_data_transfer_1:
|
||||
; cli
|
||||
push edi
|
||||
mov edi,PARTITION_START
|
||||
mov esi,[transfer_adress]
|
||||
mov ecx,(file_system_data_size+3)/4
|
||||
rep movsd
|
||||
pop edi
|
||||
; sti
|
||||
ret
|
||||
|
||||
end_search_partitions_ide:
|
||||
|
||||
;PARTITION_START dd 0x3f
|
||||
;PARTITION_END dd 0
|
||||
;SECTORS_PER_FAT dd 0x1f3a
|
||||
;NUMBER_OF_FATS dd 0x2
|
||||
;SECTORS_PER_CLUSTER dd 0x8
|
||||
;BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes
|
||||
;ROOT_CLUSTER dd 2 ; first rootdir cluster
|
||||
;FAT_START dd 0 ; start of fat table
|
||||
;ROOT_START dd 0 ; start of rootdir (only fat16)
|
||||
;ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16)
|
||||
;DATA_START dd 0 ; start of data area (=first cluster 2)
|
||||
;LAST_CLUSTER dd 0 ; last availabe cluster
|
||||
;ADR_FSINFO dd 0 ; used only by fat32
|
||||
;
|
||||
;fatRESERVED dd 0x0FFFFFF6
|
||||
;fatBAD dd 0x0FFFFFF7
|
||||
;fatEND dd 0x0FFFFFF8
|
||||
;fatMASK dd 0x0FFFFFFF
|
||||
;
|
||||
;fat_type db 0 ; 0=none, 16=fat16, 32=fat32
|
||||
|
@ -1,28 +0,0 @@
|
||||
; LOAD FIRST APPLICATION
|
||||
mov [CURRENT_TASK],dword 1
|
||||
mov [TASK_COUNT],dword 1
|
||||
cli
|
||||
cmp byte [0x2f0000+0x9030],1
|
||||
jne no_load_vrr_m
|
||||
|
||||
mov ebp, vrr_m
|
||||
xor ebx, ebx
|
||||
xor edx, edx
|
||||
call fs_execute
|
||||
cmp eax,2 ; if vrr_m app found (PID=2)
|
||||
je first_app_found
|
||||
|
||||
no_load_vrr_m:
|
||||
mov ebp, firstapp
|
||||
xor ebx, ebx
|
||||
xor edx, edx
|
||||
call fs_execute
|
||||
cmp eax,2 ; continue if a process has been loaded
|
||||
je first_app_found
|
||||
mov eax, 0xDEADBEEF ; otherwise halt
|
||||
hlt
|
||||
first_app_found:
|
||||
cli
|
||||
|
||||
;mov [TASK_COUNT],dword 2
|
||||
mov [CURRENT_TASK],dword 1 ; set OS task fisrt
|
@ -1,51 +0,0 @@
|
||||
; GRAPHICS ADDRESSES
|
||||
|
||||
;mov eax,0x100000*8 ; LFB address
|
||||
;cmp [0xfe0c],word 0x13
|
||||
;je no_d_lfb
|
||||
;cmp [0xfe0c],word 0x12
|
||||
;je no_d_lfb
|
||||
;cmp [0x2f0000+0x901e],byte 1
|
||||
;jne no_d_lfb
|
||||
mov byte [0x2f0000+0x901e],0x0
|
||||
mov eax,[0x2f0000+0x9018]
|
||||
;no_d_lfb:
|
||||
mov [LFBAddress],eax
|
||||
|
||||
cmp [SCR_MODE],word 0100000000000000b
|
||||
jge setvesa20
|
||||
cmp [SCR_MODE],word 0x13
|
||||
je v20ga32
|
||||
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
|
||||
mov [0xe024],dword Vesa12_getpixel24
|
||||
cmp [ScreenBPP],byte 24
|
||||
jz ga24
|
||||
mov [PUTPIXEL],dword Vesa12_putpixel32
|
||||
mov [0xe024],dword Vesa12_getpixel32
|
||||
ga24:
|
||||
jmp v20ga24
|
||||
setvesa20:
|
||||
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0
|
||||
mov [0xe024],dword Vesa20_getpixel24
|
||||
cmp [ScreenBPP],byte 24
|
||||
jz v20ga24
|
||||
v20ga32:
|
||||
mov [PUTPIXEL],dword Vesa20_putpixel32
|
||||
mov [0xe024],dword Vesa20_getpixel32
|
||||
v20ga24:
|
||||
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480
|
||||
jne no_mode_0x12
|
||||
mov [PUTPIXEL],dword VGA_putpixel
|
||||
mov [0xe024],dword Vesa20_getpixel32
|
||||
no_mode_0x12:
|
||||
|
||||
call test_cpu
|
||||
; btr [cpu_caps], CAPS_SSE ;test: dont't use sse code
|
||||
; btr [cpu_caps], CAPS_SSE2 ;test: don't use sse2
|
||||
|
||||
; btr [cpu_caps], CAPS_FXSR ;test: disable sse support
|
||||
;all sse commands rise #UD exption
|
||||
; btr [cpu_caps], CAPS_PSE ;test: don't use large pages
|
||||
; btr [cpu_caps], CAPS_PGE ;test: don't use global pages
|
||||
; btr [cpu_caps], CAPS_MTRR ;test: don't use MTRR
|
||||
bts [cpu_caps], CAPS_TSC ;force use rdtsc
|
@ -1,7 +0,0 @@
|
||||
;Set base of graphic segment to linear address of LFB
|
||||
mov eax,[LFBAddress] ; set for gs
|
||||
mov [graph_data_l+2],ax
|
||||
shr eax,16
|
||||
mov [graph_data_l+4],al
|
||||
mov [graph_data_l+7],ah
|
||||
|
@ -1,28 +0,0 @@
|
||||
; SET KEYBOARD PARAMETERS
|
||||
mov al, 0xf6 ; reset keyboard, scan enabled
|
||||
call kb_write
|
||||
|
||||
; wait until 8042 is ready
|
||||
xor ecx,ecx
|
||||
@@:
|
||||
in al,64h
|
||||
and al,00000010b
|
||||
loopnz @b
|
||||
|
||||
; mov al, 0xED ; svetodiody - only for testing!
|
||||
; call kb_write
|
||||
; call kb_read
|
||||
; mov al, 111b
|
||||
; call kb_write
|
||||
; call kb_read
|
||||
|
||||
mov al, 0xF3 ; set repeat rate & delay
|
||||
call kb_write
|
||||
; call kb_read
|
||||
mov al, 0 ; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500
|
||||
call kb_write
|
||||
; call kb_read
|
||||
;// mike.dld [
|
||||
call set_lights
|
||||
;// mike.dld ]
|
||||
|
@ -1,30 +0,0 @@
|
||||
; LOAD FONTS I and II
|
||||
|
||||
mov [CURRENT_TASK],dword 1
|
||||
mov [TASK_COUNT],dword 1
|
||||
mov [TASK_BASE],dword TASK_DATA
|
||||
|
||||
pushad
|
||||
push eax
|
||||
mov eax,char - std_application_base_address
|
||||
call file_system_lfn
|
||||
mov eax,char2 - std_application_base_address
|
||||
call file_system_lfn
|
||||
pop eax
|
||||
popad
|
||||
|
||||
|
||||
; mov esi,char
|
||||
; xor ebx,ebx
|
||||
; mov ecx,2560;26000
|
||||
; mov edx,FONT_I
|
||||
; call fs_RamdiskRead
|
||||
|
||||
; mov esi,char2
|
||||
; xor ebx,ebx
|
||||
; mov ecx,2560;26000
|
||||
; mov edx,FONT_II
|
||||
; call fs_RamdiskRead
|
||||
|
||||
mov esi,boot_fonts
|
||||
call boot_log
|
@ -1,8 +0,0 @@
|
||||
; LOAD DEFAULT SKIN
|
||||
|
||||
mov esi,_skin_file_default
|
||||
mov edi,_skin_file
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
call load_skin
|
@ -1,63 +0,0 @@
|
||||
; SET UP OS TASK
|
||||
|
||||
mov esi,boot_setostask
|
||||
call boot_log
|
||||
|
||||
; mov eax, fpu_data
|
||||
; mov dword [SLOT_BASE+APPDATA.fpu_state], eax
|
||||
; mov dword [SLOT_BASE+APPDATA.fpu_handler], 0
|
||||
; mov dword [SLOT_BASE+APPDATA.sse_handler], 0
|
||||
|
||||
; name for OS/IDLE process
|
||||
|
||||
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
|
||||
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
|
||||
mov edi, [os_stack]
|
||||
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
|
||||
add edi, RING0_STACK_SIZE
|
||||
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
|
||||
|
||||
mov esi, fpu_data
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
|
||||
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
|
||||
mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
|
||||
|
||||
mov ebx, [def_cursor]
|
||||
mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
|
||||
|
||||
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
|
||||
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
|
||||
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
|
||||
|
||||
; task list
|
||||
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 edi,tss_data+tss_step
|
||||
mov ecx, (tss_step)/4
|
||||
xor eax, eax
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov edi,tss_data+tss_step
|
||||
mov [edi+TSS._ss0], os_data
|
||||
mov eax,cr3
|
||||
mov [edi+TSS._cr3],eax
|
||||
mov [edi+TSS._eip],osloop
|
||||
mov [edi+TSS._eflags],dword 0x11202 ; sti and resume
|
||||
mov eax, [os_stack]
|
||||
add eax, RING0_STACK_SIZE
|
||||
mov [edi+TSS._esp], eax
|
||||
mov [edi+TSS._cs],os_code
|
||||
mov [edi+TSS._ss],os_data
|
||||
mov [edi+TSS._ds],os_data
|
||||
mov [edi+TSS._es],os_data
|
||||
mov [edi+TSS._fs],os_data
|
||||
mov [edi+TSS._gs],os_data
|
||||
|
||||
mov ax,tss0
|
||||
ltr ax
|
@ -1,53 +0,0 @@
|
||||
; ENABLE PAGING
|
||||
mov eax, sys_pgdir
|
||||
mov cr3, eax
|
||||
|
||||
mov eax,cr0
|
||||
or eax,CR0_PG
|
||||
mov cr0,eax
|
||||
|
||||
call init_kernel_heap
|
||||
stdcall kernel_alloc, RING0_STACK_SIZE+512
|
||||
mov [os_stack], eax
|
||||
|
||||
call init_LFB
|
||||
call init_fpu
|
||||
|
||||
call init_malloc
|
||||
|
||||
stdcall alloc_kernel_space, 0x4F000
|
||||
mov [ipc_tmp], eax
|
||||
mov ebx, 0x1000
|
||||
|
||||
add eax, 0x40000
|
||||
mov [proc_mem_map], eax
|
||||
|
||||
add eax, 0x8000
|
||||
mov [proc_mem_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [proc_mem_tab], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [tmp_task_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [tmp_task_ptab], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [ipc_pdir], eax
|
||||
|
||||
add eax, ebx
|
||||
mov [ipc_ptab], eax
|
||||
|
||||
call init_events
|
||||
|
||||
mov eax, srv.fd-SRV_FD_OFFSET
|
||||
mov [srv.fd], eax
|
||||
mov [srv.bk], eax
|
||||
|
||||
mov edi, irq_tab
|
||||
xor eax, eax
|
||||
mov ecx, 16
|
||||
rep stosd
|
||||
|
@ -1,16 +0,0 @@
|
||||
|
||||
; PALETTE FOR 320x200 and 640x480 16 col
|
||||
|
||||
cmp [SCR_MODE],word 0x12
|
||||
jne no_pal_vga
|
||||
mov esi,boot_pal_vga
|
||||
call boot_log
|
||||
call paletteVGA
|
||||
no_pal_vga:
|
||||
|
||||
cmp [SCR_MODE],word 0x13
|
||||
jne no_pal_ega
|
||||
mov esi,boot_pal_ega
|
||||
call boot_log
|
||||
call palette320x200
|
||||
no_pal_ega:
|
@ -1,13 +0,0 @@
|
||||
; PRINT AMOUNT OF MEMORY
|
||||
mov esi, boot_memdetect
|
||||
call boot_log
|
||||
|
||||
movzx ecx, word [boot_y]
|
||||
or ecx, (10+29*6) shl 16 ; "Determining amount of memory"
|
||||
sub ecx, 10
|
||||
mov edx, 0xFFFFFF
|
||||
mov ebx, [MEM_AMOUNT]
|
||||
shr ebx, 20
|
||||
mov edi, 1
|
||||
mov eax, 0x00040000
|
||||
call display_number_force
|
@ -1,102 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; READ RAMDISK IMAGE FROM HD
|
||||
|
||||
cmp [boot_dev],1
|
||||
jne no_sys_on_hd
|
||||
|
||||
test [DRIVE_DATA+1],byte 0x40
|
||||
jz position_2
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],1
|
||||
mov [fat32part],0
|
||||
position_1_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [DRIVE_DATA+2]
|
||||
cmp [fat32part],eax
|
||||
jle position_1_1
|
||||
position_2:
|
||||
test [DRIVE_DATA+1],byte 0x10
|
||||
jz position_3
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],2
|
||||
mov [fat32part],0
|
||||
position_2_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [DRIVE_DATA+3]
|
||||
cmp eax,[fat32part]
|
||||
jle position_2_1
|
||||
position_3:
|
||||
test [DRIVE_DATA+1],byte 0x4
|
||||
jz position_4
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],3
|
||||
mov [fat32part],0
|
||||
position_3_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [DRIVE_DATA+4]
|
||||
cmp eax,[fat32part]
|
||||
jle position_3_1
|
||||
position_4:
|
||||
test [DRIVE_DATA+1],byte 0x1
|
||||
jz no_sys_on_hd
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],4
|
||||
mov [fat32part],0
|
||||
position_4_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [DRIVE_DATA+5]
|
||||
cmp eax,[fat32part]
|
||||
jle position_4_1
|
||||
jmp yes_sys_on_hd
|
||||
|
||||
search_and_read_image:
|
||||
call set_FAT32_variables
|
||||
mov edx, bootpath
|
||||
call read_image
|
||||
test eax, eax
|
||||
jz image_present
|
||||
mov edx, bootpath2
|
||||
call read_image
|
||||
test eax, eax
|
||||
jz image_present
|
||||
ret
|
||||
image_present:
|
||||
mov [image_retrieved],1
|
||||
ret
|
||||
|
||||
read_image:
|
||||
mov eax, hdsysimage
|
||||
mov ebx, 1474560/512
|
||||
mov ecx, RAMDISK
|
||||
mov esi, 0
|
||||
mov edi, 12
|
||||
call file_read
|
||||
ret
|
||||
|
||||
image_retrieved db 0
|
||||
counter_of_partitions db 0
|
||||
no_sys_on_hd:
|
||||
yes_sys_on_hd:
|
@ -1,13 +0,0 @@
|
||||
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
|
||||
|
||||
mov esi,boot_irqs
|
||||
call boot_log
|
||||
call rerouteirqs
|
||||
|
||||
mov esi,boot_tss
|
||||
call boot_log
|
||||
|
||||
mov esi,boot_devices
|
||||
call boot_log
|
||||
call detect_devices
|
||||
|
@ -1,5 +0,0 @@
|
||||
; RESERVE SYSTEM IRQ'S JA PORT'S
|
||||
|
||||
mov esi,boot_resirqports
|
||||
call boot_log
|
||||
call reserve_irqs_ports
|
@ -1,37 +0,0 @@
|
||||
; SAVE REAL MODE VARIABLES
|
||||
mov ax, [0x2f0000 + 0x9031]
|
||||
mov [IDEContrRegsBaseAddr], ax
|
||||
; --------------- APM ---------------------
|
||||
mov eax, [0x2f0000 + 0x9040] ; entry point
|
||||
mov dword[apm_entry], eax
|
||||
mov word [apm_entry + 4], apm_code_32 - gdts
|
||||
|
||||
mov eax, [0x2f0000 + 0x9044] ; version & flags
|
||||
mov [apm_vf], eax
|
||||
; -----------------------------------------
|
||||
; movzx eax,byte [0x2f0000+0x9010] ; mouse port
|
||||
; mov [0xF604],byte 1 ;al
|
||||
mov al, [0x2F0000+0x901F] ; DMA writing
|
||||
mov [allow_dma_write], al
|
||||
mov al,[0x2f0000+0x9000] ; bpp
|
||||
mov [ScreenBPP],al
|
||||
movzx eax,word [0x2f0000+0x900A] ; X max
|
||||
dec eax
|
||||
mov [ScreenWidth],eax
|
||||
mov [screen_workarea.right],eax
|
||||
movzx eax,word [0x2f0000+0x900C] ; Y max
|
||||
dec eax
|
||||
mov [ScreenHeight],eax
|
||||
mov [screen_workarea.bottom],eax
|
||||
movzx eax,word [0x2f0000+0x9008] ; screen mode
|
||||
mov [SCR_MODE],eax
|
||||
mov eax,[0x2f0000+0x9014] ; Vesa 1.2 bnk sw add
|
||||
mov [BANK_SWITCH],eax
|
||||
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine
|
||||
cmp [SCR_MODE],word 0x13 ; 320x200
|
||||
je @f
|
||||
cmp [SCR_MODE],word 0x12 ; VGA 640x480
|
||||
je @f
|
||||
mov ax,[0x2f0000+0x9001] ; for other modes
|
||||
mov [BytesPerScanLine],ax
|
||||
@@:
|
@ -1,5 +0,0 @@
|
||||
; SET BACKGROUND DEFAULTS
|
||||
|
||||
mov esi,boot_bgr
|
||||
call boot_log
|
||||
call calculatebackground
|
@ -1,7 +0,0 @@
|
||||
; SET MOUSE
|
||||
|
||||
mov esi,boot_setmouse
|
||||
call boot_log
|
||||
call setmouse
|
||||
|
||||
mov [pci_access_enabled],1
|
@ -1,5 +0,0 @@
|
||||
; SET PORTS FOR IRQ HANDLERS
|
||||
|
||||
mov esi,boot_setrports
|
||||
call boot_log
|
||||
call setirqreadports
|
@ -1,65 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SWITCH TO 32 BIT PROTECTED MODE ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
os_data = os_data_l-gdts ; GDTs
|
||||
os_code = os_code_l-gdts
|
||||
int_code equ int_code_l-gdts
|
||||
int_data equ int_data_l-gdts
|
||||
tss0sys equ tss0sys_l-gdts
|
||||
graph_data equ 3+graph_data_l-gdts
|
||||
tss0 equ tss0_l-gdts
|
||||
app_code equ 3+app_code_l-gdts
|
||||
app_data equ 3+app_data_l-gdts
|
||||
|
||||
|
||||
|
||||
; CR0 Flags - Protected mode and Paging
|
||||
|
||||
mov ecx, CR0_PE
|
||||
|
||||
; Enabling 32 bit protected mode
|
||||
|
||||
sidt [cs:old_ints_h-0x10000]
|
||||
|
||||
cli ; disable all irqs
|
||||
cld
|
||||
mov al,255 ; mask all irqs
|
||||
out 0xa1,al
|
||||
out 0x21,al
|
||||
l.5: in al, 0x64 ; Enable A20
|
||||
test al, 2
|
||||
jnz l.5
|
||||
mov al, 0xD1
|
||||
out 0x64, al
|
||||
l.6: in al, 0x64
|
||||
test al, 2
|
||||
jnz l.6
|
||||
mov al, 0xDF
|
||||
out 0x60, al
|
||||
l.7: in al, 0x64
|
||||
test al, 2
|
||||
jnz l.7
|
||||
mov al, 0xFF
|
||||
out 0x64, al
|
||||
lgdt [cs:gdts-0x10000] ; Load GDT
|
||||
mov eax, cr0 ; Turn on paging // protected mode
|
||||
or eax, ecx
|
||||
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
|
||||
mov cr0, eax
|
||||
jmp $+2
|
||||
org $+0x10000
|
||||
mov ax,os_data ; Selector for os
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
mov fs,ax
|
||||
mov gs,ax
|
||||
mov ss,ax
|
||||
mov esp,0x3ec00 ; Set stack
|
||||
jmp pword os_code:B32 ; jmp to enable 32 bit mode
|
||||
|
||||
if gdte >= $
|
||||
error 'GDT overlaps with used code!'
|
||||
end if
|
@ -1,43 +0,0 @@
|
||||
; -------- Fast System Call init ----------
|
||||
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
|
||||
bt [cpu_caps], CAPS_SEP
|
||||
jnc .SEnP ; SysEnter not Present
|
||||
xor edx, edx
|
||||
mov ecx, MSR_SYSENTER_CS
|
||||
mov eax, os_code
|
||||
wrmsr
|
||||
mov ecx, MSR_SYSENTER_ESP
|
||||
; mov eax, sysenter_stack ; Check it
|
||||
xor eax, eax
|
||||
wrmsr
|
||||
mov ecx, MSR_SYSENTER_EIP
|
||||
mov eax, sysenter_entry
|
||||
wrmsr
|
||||
.SEnP:
|
||||
; AMD SYSCALL/SYSRET
|
||||
cmp byte[cpu_vendor], 'A'
|
||||
jne .noSYSCALL
|
||||
mov eax, 0x80000001
|
||||
cpuid
|
||||
test edx, 0x800 ; bit_11 - SYSCALL/SYSRET support
|
||||
jz .noSYSCALL
|
||||
mov ecx, MSR_AMD_EFER
|
||||
rdmsr
|
||||
or eax, 1 ; bit_0 - System Call Extension (SCE)
|
||||
wrmsr
|
||||
|
||||
; !!!! It`s dirty hack, fix it !!!
|
||||
; Bits of EDX :
|
||||
; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
|
||||
; and the contents of this field, plus 8, are copied into the SS register.
|
||||
; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
|
||||
; and the contents of this field, plus 8, are copied into the SS register.
|
||||
|
||||
; mov edx, (os_code + 16) * 65536 + os_code
|
||||
mov edx, 0x1B0013
|
||||
|
||||
mov eax, syscall_entry
|
||||
mov ecx, MSR_AMD_STAR
|
||||
wrmsr
|
||||
.noSYSCALL:
|
||||
; -----------------------------------------
|
@ -1,6 +0,0 @@
|
||||
; START MULTITASKING
|
||||
|
||||
mov esi,boot_tasking
|
||||
call boot_log
|
||||
|
||||
; mov [ENABLE_TASKSWITCH],byte 1 ; multitasking enabled
|
@ -1,10 +0,0 @@
|
||||
; TIMER SET TO 1/100 S
|
||||
|
||||
mov esi,boot_timer
|
||||
call boot_log
|
||||
mov al,0x34 ; set to 100Hz
|
||||
out 0x43,al
|
||||
mov al,0x9b ; lsb 1193180 / 1193
|
||||
out 0x40,al
|
||||
mov al,0x2e ; msb
|
||||
out 0x40,al
|
@ -1,15 +0,0 @@
|
||||
; READ TSC / SECOND
|
||||
|
||||
mov esi,boot_tsc
|
||||
call boot_log
|
||||
call _rdtsc
|
||||
mov ecx,eax
|
||||
mov esi,250 ; wait 1/4 a second
|
||||
call delay_ms
|
||||
call _rdtsc
|
||||
sub eax,ecx
|
||||
shl eax,2
|
||||
mov [CPU_FREQ],eax ; save tsc / sec
|
||||
mov ebx, 1000000
|
||||
div ebx
|
||||
mov [stall_mcs], eax
|
@ -1,38 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;
|
||||
; Load of videomode driver in memory
|
||||
;
|
||||
; (driver is located at 0x760000-0x768000 - 32kb) // if this area not occuped anything
|
||||
;
|
||||
; Author: Trans
|
||||
; Date: 19.07.2003
|
||||
;
|
||||
; Include in MeOS kernel and compile with FASM
|
||||
;
|
||||
|
||||
|
||||
; LOAD VIDEOMODE DRIVER
|
||||
; If vmode.mdr file not found
|
||||
or eax,-1 ; Driver ID = -1 (not present in system)
|
||||
mov [OS_BASE+0x760000],eax ;
|
||||
mov [OS_BASE+0x760100],byte 0xC3 ; Instruction RETN - driver loop
|
||||
|
||||
pushad
|
||||
push eax
|
||||
mov eax, vmode - std_application_base_address
|
||||
call file_system_lfn
|
||||
pop eax
|
||||
popad
|
||||
|
||||
; mov esi, vmode
|
||||
; xor ebx, ebx
|
||||
; mov ecx, 0x8000 ; size of memory area for driver
|
||||
; mov edx, OS_BASE+0x760000 ; Memory position of driver
|
||||
; call fs_RamdiskRead
|
@ -1,5 +0,0 @@
|
||||
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
||||
|
||||
mov esi,boot_windefs
|
||||
call boot_log
|
||||
call setwindowdefaults
|
@ -1,114 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set languages=en ru ge et
|
||||
set drivers=sound sis infinity ati2d
|
||||
set targets=all kernel drivers skins clean
|
||||
|
||||
call :Check_Target %1
|
||||
for %%a in (all kernel) do if %%a==%target% call :Check_Lang %2
|
||||
call :Target_%target%
|
||||
|
||||
if ERRORLEVEL 0 goto Exit_OK
|
||||
|
||||
echo Probably at runing has been created error
|
||||
echo For help send a report...
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
|
||||
|
||||
|
||||
:Check_Lang
|
||||
set res=%1
|
||||
:Check_Lang_loop
|
||||
for %%a in (%languages%) do if %%a==%res% set lang=%res%
|
||||
if defined lang goto :eof
|
||||
|
||||
echo Language "%res%" is not founded
|
||||
echo Enter valide languege
|
||||
echo [%languages%]
|
||||
|
||||
set /P res=">
|
||||
goto Check_Lang_loop
|
||||
goto :eof
|
||||
|
||||
:Check_Target
|
||||
set res=%1
|
||||
:Check_Target_loop
|
||||
for %%a in (%targets%) do if %%a==%res% set target=%res%
|
||||
if defined target goto :eof
|
||||
|
||||
echo Target "%res%" is not valide
|
||||
echo Enter valide target
|
||||
echo [%targets%]
|
||||
|
||||
set /P res=">
|
||||
goto Check_Target_loop
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_kernel
|
||||
echo building kernel with language %lang% ...
|
||||
|
||||
if not exist bin mkdir bin
|
||||
echo lang fix %lang% > lang.inc
|
||||
fasm -m 65536 kernel.asm bin\kernel.mnt
|
||||
if not %errorlevel%==0 goto :Error_FasmFailed
|
||||
erase lang.inc
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_all
|
||||
echo building all ...
|
||||
call :Target_kernel
|
||||
call :Target_drivers
|
||||
call :Target_skins
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_drivers
|
||||
echo building drivers ...
|
||||
|
||||
if not exist bin\drivers mkdir bin\drivers
|
||||
cd drivers
|
||||
for %%a in (%drivers%) do (
|
||||
fasm -m 65536 %%a.asm ..\bin\drivers\%%a.obj
|
||||
if not %errorlevel%==0 goto :Error_FasmFailed
|
||||
)
|
||||
cd ..
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_skins
|
||||
echo building skins ...
|
||||
|
||||
if not exist bin\skins mkdir bin\skins
|
||||
cd skin
|
||||
fasm -m 65536 default.asm ..\bin\skins\default.skn
|
||||
if not %errorlevel%==0 goto :Error_FasmFailed
|
||||
cd ..
|
||||
goto :eof
|
||||
|
||||
|
||||
:Target_clean
|
||||
echo cleaning ...
|
||||
|
||||
del /Q bin\drivers\*.*
|
||||
del /Q bin\skins\*.*
|
||||
del /Q bin\*.*
|
||||
rmdir bin\drivers
|
||||
rmdir bin\skins
|
||||
rmdir bin
|
||||
goto :Exit_OK
|
||||
|
||||
|
||||
:Error_FasmFailed
|
||||
echo error: fasm execution failed
|
||||
erase lang.inc
|
||||
pause
|
||||
exit 1
|
||||
|
||||
:Exit_OK
|
||||
echo all operations has been done
|
||||
pause
|
||||
exit 0
|
@ -1,50 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; PCI16.INC ;;
|
||||
;; ;;
|
||||
;; 16 bit PCI driver code ;;
|
||||
;; ;;
|
||||
;; Version 0.2 December 21st, 2002 ;;
|
||||
;; ;;
|
||||
;; Author: Victor Prodan, victorprodan@yahoo.com ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
init_pci_16:
|
||||
|
||||
pushad
|
||||
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov byte [es:0x9020],1 ;default mechanism:1
|
||||
mov ax,0xb101
|
||||
int 0x1a
|
||||
or ah,ah
|
||||
jnz pci16skip
|
||||
|
||||
mov [es:0x9021],cl ;last PCI bus in system
|
||||
mov [es:0x9022],bx
|
||||
mov [es:0x9024],edi
|
||||
|
||||
; we have a PCI BIOS, so check which configuration mechanism(s)
|
||||
; it supports
|
||||
; AL = PCI hardware characteristics (bit0 => mechanism1, bit1 => mechanism2)
|
||||
test al,1
|
||||
jnz pci16skip
|
||||
test al,2
|
||||
jz pci16skip
|
||||
mov byte [es:0x9020],2 ; if (al&3)==2 => mechanism 2
|
||||
|
||||
pci16skip:
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
|
||||
popad
|
@ -1,363 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; PCI32.INC ;;
|
||||
;; ;;
|
||||
;; 32 bit PCI driver code ;;
|
||||
;; ;;
|
||||
;; Version 0.2 December 21st, 2002 ;;
|
||||
;; ;;
|
||||
;; Author: Victor Prodan, victorprodan@yahoo.com ;;
|
||||
;; Credits: ;;
|
||||
;; Ralf Brown ;;
|
||||
;; Mike Hibbett, mikeh@oceanfree.net ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_api:
|
||||
;
|
||||
; Description
|
||||
; entry point for system PCI calls
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_api:
|
||||
|
||||
cmp [pci_access_enabled],1
|
||||
jne no_pci_access_for_applications
|
||||
|
||||
or al,al
|
||||
jnz pci_fn_1
|
||||
; PCI function 0: get pci version (AH.AL)
|
||||
movzx eax,word [0x2F0000+0x9022]
|
||||
ret
|
||||
|
||||
pci_fn_1:
|
||||
cmp al,1
|
||||
jnz pci_fn_2
|
||||
|
||||
; PCI function 1: get last bus in AL
|
||||
mov al,[0x2F0000+0x9021]
|
||||
ret
|
||||
|
||||
pci_fn_2:
|
||||
cmp al,2
|
||||
jne pci_fn_3
|
||||
; PCI function 2: get pci access mechanism
|
||||
mov al,[0x2F0000+0x9020]
|
||||
ret
|
||||
pci_fn_3:
|
||||
|
||||
cmp al,4
|
||||
jz pci_read_reg ;byte
|
||||
cmp al,5
|
||||
jz pci_read_reg ;word
|
||||
cmp al,6
|
||||
jz pci_read_reg ;dword
|
||||
|
||||
cmp al,8
|
||||
jz pci_write_reg ;byte
|
||||
cmp al,9
|
||||
jz pci_write_reg ;word
|
||||
cmp al,10
|
||||
jz pci_write_reg ;dword
|
||||
|
||||
no_pci_access_for_applications:
|
||||
|
||||
mov eax,-1
|
||||
|
||||
ret
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_make_config_cmd
|
||||
;
|
||||
; Description
|
||||
; creates a command dword for use with the PCI bus
|
||||
; bus # in ah
|
||||
; device+func in bh (dddddfff)
|
||||
; register in bl
|
||||
;
|
||||
; command dword returned in eax ( 10000000 bbbbbbbb dddddfff rrrrrr00 )
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_make_config_cmd:
|
||||
shl eax,8 ; move bus to bits 16-23
|
||||
mov ax,bx ; combine all
|
||||
and eax,0xffffff
|
||||
or eax,0x80000000
|
||||
ret
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_read_reg:
|
||||
;
|
||||
; Description
|
||||
; read a register from the PCI config space into EAX/AX/AL
|
||||
; IN: ah=bus,device+func=bh,register address=bl
|
||||
; number of bytes to read (1,2,4) coded into AL, bits 0-1
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_read_reg:
|
||||
cmp byte [0x2F0000+0x9020],2 ;what mechanism will we use?
|
||||
je pci_read_reg_2
|
||||
|
||||
; mechanism 1
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
call pci_make_config_cmd
|
||||
mov ebx,eax
|
||||
; get current state
|
||||
mov dx,0xcf8
|
||||
in eax, dx
|
||||
push eax
|
||||
; set up addressing to config data
|
||||
mov eax,ebx
|
||||
and al,0xfc ; make address dword-aligned
|
||||
out dx,eax
|
||||
; get requested DWORD of config data
|
||||
mov dl,0xfc
|
||||
and bl,3
|
||||
or dl,bl ; add to port address first 2 bits of register address
|
||||
|
||||
or esi,esi
|
||||
jz pci_read_byte1
|
||||
cmp esi,1
|
||||
jz pci_read_word1
|
||||
cmp esi,2
|
||||
jz pci_read_dword1
|
||||
jmp pci_fin_read1
|
||||
|
||||
pci_read_byte1:
|
||||
in al,dx
|
||||
jmp pci_fin_read1
|
||||
pci_read_word1:
|
||||
in ax,dx
|
||||
jmp pci_fin_read1
|
||||
pci_read_dword1:
|
||||
in eax,dx
|
||||
jmp pci_fin_read1
|
||||
pci_fin_read1:
|
||||
; restore configuration control
|
||||
xchg eax,[esp]
|
||||
mov dx,0xcf8
|
||||
out dx,eax
|
||||
|
||||
pop eax
|
||||
pop esi
|
||||
ret
|
||||
pci_read_reg_2:
|
||||
|
||||
test bh,128 ;mech#2 only supports 16 devices per bus
|
||||
jnz pci_read_reg_err
|
||||
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
push eax
|
||||
;store current state of config space
|
||||
mov dx,0xcf8
|
||||
in al,dx
|
||||
mov ah,al
|
||||
mov dl,0xfa
|
||||
in al,dx
|
||||
|
||||
xchg eax,[esp]
|
||||
; out 0xcfa,bus
|
||||
mov al,ah
|
||||
out dx,al
|
||||
; out 0xcf8,0x80
|
||||
mov dl,0xf8
|
||||
mov al,0x80
|
||||
out dx,al
|
||||
; compute addr
|
||||
shr bh,3 ; func is ignored in mechanism 2
|
||||
or bh,0xc0
|
||||
mov dx,bx
|
||||
|
||||
or esi,esi
|
||||
jz pci_read_byte2
|
||||
cmp esi,1
|
||||
jz pci_read_word2
|
||||
cmp esi,2
|
||||
jz pci_read_dword2
|
||||
jmp pci_fin_read2
|
||||
|
||||
pci_read_byte2:
|
||||
in al,dx
|
||||
jmp pci_fin_read2
|
||||
pci_read_word2:
|
||||
in ax,dx
|
||||
jmp pci_fin_read2
|
||||
pci_read_dword2:
|
||||
in eax,dx
|
||||
; jmp pci_fin_read2
|
||||
pci_fin_read2:
|
||||
|
||||
; restore configuration space
|
||||
xchg eax,[esp]
|
||||
mov dx,0xcfa
|
||||
out dx,al
|
||||
mov dl,0xf8
|
||||
mov al,ah
|
||||
out dx,al
|
||||
|
||||
pop eax
|
||||
pop esi
|
||||
ret
|
||||
|
||||
pci_read_reg_err:
|
||||
xor eax,eax
|
||||
dec eax
|
||||
ret
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_write_reg:
|
||||
;
|
||||
; Description
|
||||
; write a register from ECX/CX/CL into the PCI config space
|
||||
; IN: ah=bus,device+func=bh,register address (dword aligned)=bl,
|
||||
; value to write in ecx
|
||||
; number of bytes to write (1,2,4) coded into AL, bits 0-1
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_write_reg:
|
||||
cmp byte [0x2F0000+0x9020],2 ;what mechanism will we use?
|
||||
je pci_write_reg_2
|
||||
|
||||
; mechanism 1
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
call pci_make_config_cmd
|
||||
mov ebx,eax
|
||||
; get current state into ecx
|
||||
mov dx,0xcf8
|
||||
in eax, dx
|
||||
push eax
|
||||
; set up addressing to config data
|
||||
mov eax,ebx
|
||||
and al,0xfc ; make address dword-aligned
|
||||
out dx,eax
|
||||
; write DWORD of config data
|
||||
mov dl,0xfc
|
||||
and bl,3
|
||||
or dl,bl
|
||||
mov eax,ecx
|
||||
|
||||
or esi,esi
|
||||
jz pci_write_byte1
|
||||
cmp esi,1
|
||||
jz pci_write_word1
|
||||
cmp esi,2
|
||||
jz pci_write_dword1
|
||||
jmp pci_fin_write1
|
||||
|
||||
pci_write_byte1:
|
||||
out dx,al
|
||||
jmp pci_fin_write1
|
||||
pci_write_word1:
|
||||
out dx,ax
|
||||
jmp pci_fin_write1
|
||||
pci_write_dword1:
|
||||
out dx,eax
|
||||
jmp pci_fin_write1
|
||||
pci_fin_write1:
|
||||
|
||||
; restore configuration control
|
||||
pop eax
|
||||
mov dl,0xf8
|
||||
out dx,eax
|
||||
|
||||
xor eax,eax
|
||||
pop esi
|
||||
|
||||
ret
|
||||
pci_write_reg_2:
|
||||
|
||||
test bh,128 ;mech#2 only supports 16 devices per bus
|
||||
jnz pci_write_reg_err
|
||||
|
||||
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
push eax
|
||||
;store current state of config space
|
||||
mov dx,0xcf8
|
||||
in al,dx
|
||||
mov ah,al
|
||||
mov dl,0xfa
|
||||
in al,dx
|
||||
xchg eax,[esp]
|
||||
; out 0xcfa,bus
|
||||
mov al,ah
|
||||
out dx,al
|
||||
; out 0xcf8,0x80
|
||||
mov dl,0xf8
|
||||
mov al,0x80
|
||||
out dx,al
|
||||
; compute addr
|
||||
shr bh,3 ; func is ignored in mechanism 2
|
||||
or bh,0xc0
|
||||
mov dx,bx
|
||||
; write register
|
||||
mov eax,ecx
|
||||
|
||||
or esi,esi
|
||||
jz pci_write_byte2
|
||||
cmp esi,1
|
||||
jz pci_write_word2
|
||||
cmp esi,2
|
||||
jz pci_write_dword2
|
||||
jmp pci_fin_write2
|
||||
|
||||
pci_write_byte2:
|
||||
out dx,al
|
||||
jmp pci_fin_write2
|
||||
pci_write_word2:
|
||||
out dx,ax
|
||||
jmp pci_fin_write2
|
||||
pci_write_dword2:
|
||||
out dx,eax
|
||||
jmp pci_fin_write2
|
||||
pci_fin_write2:
|
||||
; restore configuration space
|
||||
pop eax
|
||||
mov dx,0xcfa
|
||||
out dx,al
|
||||
mov dl,0xf8
|
||||
mov al,ah
|
||||
out dx,al
|
||||
|
||||
xor eax,eax
|
||||
pop esi
|
||||
ret
|
||||
|
||||
pci_write_reg_err:
|
||||
xor eax,eax
|
||||
dec eax
|
||||
ret
|
@ -1,576 +0,0 @@
|
||||
$Revision: 434 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
drw0 equ 10010010b ; data read/write dpl0
|
||||
drw3 equ 11110010b ; data read/write dpl3
|
||||
cpl0 equ 10011010b ; code read dpl0
|
||||
cpl3 equ 11111010b ; code read dpl3
|
||||
|
||||
D32 equ 01000000b ; 32bit segment
|
||||
G32 equ 10000000b ; page gran
|
||||
|
||||
|
||||
;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;;
|
||||
|
||||
CPU_386 equ 3
|
||||
CPU_486 equ 4
|
||||
CPU_PENTIUM equ 5
|
||||
CPU_P6 equ 6
|
||||
CPU_PENTIUM4 equ 0x0F
|
||||
|
||||
CAPS_FPU equ 00 ;on-chip x87 floating point unit
|
||||
CAPS_VME equ 01 ;virtual-mode enhancements
|
||||
CAPS_DE equ 02 ;debugging extensions
|
||||
CAPS_PSE equ 03 ;page-size extensions
|
||||
CAPS_TSC equ 04 ;time stamp counter
|
||||
CAPS_MSR equ 05 ;model-specific registers
|
||||
CAPS_PAE equ 06 ;physical-address extensions
|
||||
CAPS_MCE equ 07 ;machine check exception
|
||||
CAPS_CX8 equ 08 ;CMPXCHG8B instruction
|
||||
CAPS_APIC equ 09 ;on-chip advanced programmable
|
||||
; interrupt controller
|
||||
; 10 ;unused
|
||||
CAPS_SEP equ 11 ;SYSENTER and SYSEXIT instructions
|
||||
CAPS_MTRR equ 12 ;memory-type range registers
|
||||
CAPS_PGE equ 13 ;page global extension
|
||||
CAPS_MCA equ 14 ;machine check architecture
|
||||
CAPS_CMOV equ 15 ;conditional move instructions
|
||||
CAPS_PAT equ 16 ;page attribute table
|
||||
|
||||
CAPS_PSE36 equ 17 ;page-size extensions
|
||||
CAPS_PSN equ 18 ;processor serial number
|
||||
CAPS_CLFLUSH equ 19 ;CLFUSH instruction
|
||||
|
||||
CAPS_DS equ 21 ;debug store
|
||||
CAPS_ACPI equ 22 ;thermal monitor and software
|
||||
;controlled clock supported
|
||||
CAPS_MMX equ 23 ;MMX instructions
|
||||
CAPS_FXSR equ 24 ;FXSAVE and FXRSTOR instructions
|
||||
CAPS_SSE equ 25 ;SSE instructions
|
||||
CAPS_SSE2 equ 26 ;SSE2 instructions
|
||||
CAPS_SS equ 27 ;self-snoop
|
||||
CAPS_HTT equ 28 ;hyper-threading technology
|
||||
CAPS_TM equ 29 ;thermal monitor supported
|
||||
CAPS_IA64 equ 30 ;IA64 capabilities
|
||||
CAPS_PBE equ 31 ;pending break enable
|
||||
|
||||
;ecx
|
||||
CAPS_SSE3 equ 32 ;SSE3 instructions
|
||||
; 33
|
||||
; 34
|
||||
CAPS_MONITOR equ 35 ;MONITOR/MWAIT instructions
|
||||
CAPS_DS_CPL equ 36 ;
|
||||
CAPS_VMX equ 37 ;virtual mode extensions
|
||||
; 38 ;
|
||||
CAPS_EST equ 39 ;enhansed speed step
|
||||
CAPS_TM2 equ 40 ;thermal monitor2 supported
|
||||
; 41
|
||||
CAPS_CID equ 42 ;
|
||||
; 43
|
||||
; 44
|
||||
CAPS_CX16 equ 45 ;CMPXCHG16B instruction
|
||||
CAPS_xTPR equ 46 ;
|
||||
;
|
||||
;reserved
|
||||
;
|
||||
;ext edx /ecx
|
||||
CAPS_SYSCAL equ 64 ;
|
||||
CAPS_XD equ 65 ;execution disable
|
||||
CAPS_FFXSR equ 66 ;
|
||||
CAPS_RDTSCP equ 67 ;
|
||||
CAPS_X64 equ 68 ;
|
||||
CAPS_3DNOW equ 69 ;
|
||||
CAPS_3DNOWEXT equ 70 ;
|
||||
CAPS_LAHF equ 71 ;
|
||||
CAPS_CMP_LEG equ 72 ;
|
||||
CAPS_SVM equ 73 ;secure virual machine
|
||||
CAPS_ALTMOVCR8 equ 74 ;
|
||||
|
||||
; CPU MSR names
|
||||
MSR_SYSENTER_CS equ 0x174
|
||||
MSR_SYSENTER_ESP equ 0x175
|
||||
MSR_SYSENTER_EIP equ 0x176
|
||||
MSR_AMD_EFER equ 0xC0000080 ; Extended Feature Enable Register
|
||||
MSR_AMD_STAR equ 0xC0000081 ; SYSCALL/SYSRET Target Address Register
|
||||
|
||||
CR0_PE equ 0x00000001 ;protected mode
|
||||
CR0_MP equ 0x00000002 ;monitor fpu
|
||||
CR0_EM equ 0x00000004 ;fpu emulation
|
||||
CR0_TS equ 0x00000008 ;task switch
|
||||
CR0_ET equ 0x00000010 ;extension type hardcoded to 1
|
||||
CR0_NE equ 0x00000020 ;numeric error
|
||||
CR0_WP equ 0x00010000 ;write protect
|
||||
CR0_AM equ 0x00040000 ;alignment check
|
||||
CR0_NW equ 0x20000000 ;not write-through
|
||||
CR0_CD equ 0x40000000 ;cache disable
|
||||
CR0_PG equ 0x80000000 ;paging
|
||||
|
||||
|
||||
CR4_VME equ 0x0001
|
||||
CR4_PVI equ 0x0002
|
||||
CR4_TSD equ 0x0004
|
||||
CR4_DE equ 0x0008
|
||||
CR4_PSE equ 0x0010
|
||||
CR4_PAE equ 0x0020
|
||||
CR4_MCE equ 0x0040
|
||||
CR4_PGE equ 0x0080
|
||||
CR4_PCE equ 0x0100
|
||||
CR4_OSFXSR equ 0x0200
|
||||
CR4_OSXMMEXPT equ 0x0400
|
||||
|
||||
SSE_IE equ 0x0001
|
||||
SSE_DE equ 0x0002
|
||||
SSE_ZE equ 0x0004
|
||||
SSE_OE equ 0x0008
|
||||
SSE_UE equ 0x0010
|
||||
SSE_PE equ 0x0020
|
||||
SSE_DAZ equ 0x0040
|
||||
SSE_IM equ 0x0080
|
||||
SSE_DM equ 0x0100
|
||||
SSE_ZM equ 0x0200
|
||||
SSE_OM equ 0x0400
|
||||
SSE_UM equ 0x0800
|
||||
SSE_PM equ 0x1000
|
||||
SSE_FZ equ 0x8000
|
||||
|
||||
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM)
|
||||
|
||||
OS_BASE equ 0
|
||||
|
||||
window_data equ (OS_BASE+0x0000000)
|
||||
|
||||
CURRENT_TASK equ (OS_BASE+0x0003000)
|
||||
TASK_COUNT equ (OS_BASE+0x0003004)
|
||||
CURRENT_RING0_ESP equ (OS_BASE+0x0003008)
|
||||
TASK_BASE equ (OS_BASE+0x0003010)
|
||||
TASK_DATA equ (OS_BASE+0x0003020)
|
||||
TASK_EVENT equ (OS_BASE+0x0003020)
|
||||
|
||||
mouseunder equ (OS_BASE+0x0006900)
|
||||
FLOPPY_BUFF equ (OS_BASE+0x0008000)
|
||||
ACTIVE_PROC_STACK equ (OS_BASE+0x000A400) ;unused
|
||||
idts equ (OS_BASE+0x000B100)
|
||||
WIN_STACK equ (OS_BASE+0x000C000)
|
||||
WIN_POS equ (OS_BASE+0x000C400)
|
||||
FDD_BUFF equ (OS_BASE+0x000D000)
|
||||
|
||||
;unused ? only one reference
|
||||
ENABLE_TASKSWITCH equ (OS_BASE+0x000E000)
|
||||
|
||||
PUTPIXEL equ (OS_BASE+0x000E020)
|
||||
GETPIXEL equ (OS_BASE+0x000E024)
|
||||
|
||||
;unused ? only one reference
|
||||
BANK_SWITCH equ (OS_BASE+0x000E030)
|
||||
|
||||
;unused ? store mousepointer
|
||||
MOUSE_PICTURE equ (OS_BASE+0x000F200)
|
||||
|
||||
MOUSE_VISIBLE equ (OS_BASE+0x000F204)
|
||||
WIN_TEMP_XY equ (OS_BASE+0x000F300)
|
||||
KEY_COUNT equ (OS_BASE+0x000F400)
|
||||
KEY_BUFF equ (OS_BASE+0x000F401)
|
||||
|
||||
BTN_COUNT equ (OS_BASE+0x000F500)
|
||||
BTN_BUFF equ (OS_BASE+0x000F501)
|
||||
|
||||
CPU_FREQ equ (OS_BASE+0x000F600)
|
||||
|
||||
;unused ? no active references
|
||||
MOUSE_PORT equ (OS_BASE+0x000F604)
|
||||
|
||||
;unused
|
||||
PS2_CHUNK equ (OS_BASE+0x000FB00)
|
||||
|
||||
MOUSE_X equ (OS_BASE+0x000FB0A)
|
||||
MOUSE_Y equ (OS_BASE+0x000FB0C)
|
||||
|
||||
MOUSE_COLOR_MEM equ (OS_BASE+0x000FB10)
|
||||
COLOR_TEMP equ (OS_BASE+0x000FB30)
|
||||
BTN_DOWN equ (OS_BASE+0x000FB40)
|
||||
MOUSE_DOWN equ (OS_BASE+0x000FB44)
|
||||
X_UNDER equ (OS_BASE+0x000FB4A)
|
||||
Y_UNDER equ (OS_BASE+0x000FB4C)
|
||||
ScreenBPP equ (OS_BASE+0x000FBF1)
|
||||
|
||||
;unused ? only one reference
|
||||
MOUSE_BUFF_COUNT equ (OS_BASE+0x000FCFF)
|
||||
|
||||
LFBAddress equ (OS_BASE+0x000FE80)
|
||||
MEM_AMOUNT equ (OS_BASE+0x000FE8C)
|
||||
;LFBSize equ (OS_BASE+0x02f9050)
|
||||
|
||||
ScreenWidth equ (OS_BASE+0x000FE00)
|
||||
ScreenHeight equ (OS_BASE+0x000FE04)
|
||||
BytesPerScanLine equ (OS_BASE+0x000FE08)
|
||||
SCR_MODE equ (OS_BASE+0x000FE0C)
|
||||
|
||||
BTN_ADDR equ (OS_BASE+0x000FE88)
|
||||
SYS_SHUTDOWN equ (OS_BASE+0x000FF00)
|
||||
TASK_ACTIVATE equ (OS_BASE+0x000FF01)
|
||||
|
||||
REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0)
|
||||
BANK_RW equ (OS_BASE+0x000FFF2)
|
||||
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
|
||||
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)
|
||||
DONT_SWITCH equ (OS_BASE+0x000FFFF)
|
||||
|
||||
TMP_STACK_TOP equ 0x003EC00
|
||||
|
||||
FONT_II equ (OS_BASE+0x003EC00)
|
||||
FONT_I equ (OS_BASE+0x003F600)
|
||||
DRIVE_DATA equ (OS_BASE+0x0040000)
|
||||
SLOT_BASE equ (OS_BASE+0x0080000)
|
||||
|
||||
;unused
|
||||
TMP_BUFF equ (OS_BASE+0x0090000)
|
||||
|
||||
VGABasePtr equ (OS_BASE+0x00A0000)
|
||||
|
||||
RAMDISK equ (OS_BASE+0x0100000)
|
||||
RAMDISK_FAT equ (OS_BASE+0x0280000)
|
||||
FLOPPY_FAT equ (OS_BASE+0x0282000)
|
||||
|
||||
; unused?
|
||||
SB16_Status equ (OS_BASE+0x02B0000)
|
||||
|
||||
BUTTON_INFO equ (OS_BASE+0x02C0000)
|
||||
RESERVED_PORTS equ (OS_BASE+0x02D0000)
|
||||
IRQ_SAVE equ (OS_BASE+0x02E0000)
|
||||
BOOT_VAR equ (OS_BASE+0x02f0000)
|
||||
IMG_BACKGROUND equ (OS_BASE+0x0300000)
|
||||
WinMapAddress equ (OS_BASE+0x0460000)
|
||||
display_data equ (OS_BASE+0x0460000)
|
||||
|
||||
;unused ?
|
||||
HD_CACHE equ (OS_BASE+0x0600000)
|
||||
|
||||
stack_data_start equ (OS_BASE+0x0700000)
|
||||
eth_data_start equ (OS_BASE+0x0700000)
|
||||
stack_data equ (OS_BASE+0x0704000)
|
||||
stack_data_end equ (OS_BASE+0x071ffff)
|
||||
VMODE_BASE equ (OS_BASE+0x0760000)
|
||||
resendQ equ (OS_BASE+0x0770000)
|
||||
|
||||
skin_data equ (OS_BASE+0x0778000)
|
||||
|
||||
|
||||
tss_data equ (OS_BASE+0x780000)
|
||||
draw_data equ (OS_BASE+0x988000)
|
||||
|
||||
HEAP_BASE equ (OS_BASE+0x98B000)
|
||||
|
||||
LFB_BASE equ 0x7DC00000
|
||||
|
||||
page_tabs equ 0x7FC00000
|
||||
master_tab equ 0x7FDFF000
|
||||
app_page_tabs equ 0x7FE00000
|
||||
|
||||
sys_pgdir equ OS_BASE+0x00050000
|
||||
sys_master_tab equ OS_BASE+0x00051000
|
||||
sys_pgmap equ OS_BASE+0x00052000
|
||||
|
||||
|
||||
|
||||
new_app_base equ 0x80000000
|
||||
|
||||
twdw equ (CURRENT_TASK-window_data)
|
||||
|
||||
std_application_base_address equ new_app_base
|
||||
RING0_STACK_SIZE equ (0x2000-512) ;512 áàéò äëÿ êîíòåêñòà FPU
|
||||
|
||||
;PAGES_USED equ 4
|
||||
|
||||
PG_UNMAP equ 0x000
|
||||
PG_MAP equ 0x001
|
||||
PG_WRITE equ 0x002
|
||||
PG_SW equ 0x003
|
||||
PG_USER equ 0x005
|
||||
PG_UW equ 0x007
|
||||
PG_NOCACHE equ 0x018
|
||||
PG_LARGE equ 0x080
|
||||
PG_GLOBAL equ 0x100
|
||||
|
||||
;;;;;;;;;;;boot time variables
|
||||
|
||||
;BOOT_BPP equ 0x9000 ;byte bits per pixel
|
||||
BOOT_SCANLINE equ 0x9001 ;word scanline length
|
||||
BOOT_VESA_MODE equ 0x9008 ;word vesa video mode
|
||||
;;BOOT_X_RES equ 0x900A ;word X res
|
||||
;;BOOT_Y_RES equ 0x900C ;word Y res
|
||||
;;BOOT_MOUSE_PORT equ 0x9010 ;byte mouse port - not used
|
||||
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch
|
||||
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address
|
||||
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration
|
||||
BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display)
|
||||
BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
|
||||
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data
|
||||
BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no
|
||||
BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr
|
||||
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount
|
||||
|
||||
TMP_FILE_NAME equ 0
|
||||
TMP_CMD_LINE equ 1024
|
||||
TMP_ICON_OFFS equ 1280
|
||||
|
||||
|
||||
EVENT_REDRAW equ 0x00000001
|
||||
EVENT_KEY equ 0x00000002
|
||||
EVENT_BUTTON equ 0x00000004
|
||||
EVENT_BACKGROUND equ 0x00000010
|
||||
EVENT_MOUSE equ 0x00000020
|
||||
EVENT_IPC equ 0x00000040
|
||||
EVENT_NETWORK equ 0x00000080
|
||||
EVENT_DEBUG equ 0x00000100
|
||||
EVENT_EXTENDED equ 0x00000200
|
||||
|
||||
EV_INTR equ 1
|
||||
|
||||
struc SYS_VARS
|
||||
{ .bpp dd ?
|
||||
.scanline dd ?
|
||||
.vesa_mode dd ?
|
||||
.x_res dd ?
|
||||
.y_res dd ?
|
||||
.cpu_caps dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
}
|
||||
|
||||
struc APPOBJ ;common object header
|
||||
{
|
||||
.magic dd ? ;
|
||||
.destroy dd ? ;internal destructor
|
||||
.fd dd ? ;next object in list
|
||||
.bk dd ? ;prev object in list
|
||||
.pid dd ? ;owner id
|
||||
};
|
||||
|
||||
virtual at 0
|
||||
APPOBJ APPOBJ
|
||||
end virtual
|
||||
|
||||
APP_OBJ_OFFSET equ 48
|
||||
APP_EV_OFFSET equ 40
|
||||
|
||||
struc CURSOR
|
||||
{;common object header
|
||||
.magic dd ? ;'CURS'
|
||||
.destroy dd ? ;internal destructor
|
||||
.fd dd ? ;next object in list
|
||||
.bk dd ? ;prev object in list
|
||||
.pid dd ? ;owner id
|
||||
|
||||
;cursor data
|
||||
.base dd ? ;allocated memory
|
||||
.hot_x dd ? ;hotspot coords
|
||||
.hot_y dd ?
|
||||
}
|
||||
virtual at 0
|
||||
CURSOR CURSOR
|
||||
end virtual
|
||||
|
||||
CURSOR_SIZE equ 32
|
||||
|
||||
struc EVENT
|
||||
{
|
||||
.magic dd ? ;'EVNT'
|
||||
.destroy dd ? ;internal destructor
|
||||
.fd dd ? ;next object in list
|
||||
.bk dd ? ;prev object in list
|
||||
.pid dd ? ;owner id
|
||||
|
||||
.id dd ? ;event uid
|
||||
.state dd ? ;internal flags
|
||||
.code dd ?
|
||||
rd 5
|
||||
}
|
||||
EVENT_SIZE equ 52
|
||||
|
||||
virtual at 0
|
||||
EVENT EVENT
|
||||
end virtual
|
||||
|
||||
|
||||
|
||||
struc HEAP_DATA
|
||||
{
|
||||
.mutex rd 1
|
||||
.refcount rd 1
|
||||
.heap_base rd 1
|
||||
.heap_top rd 1
|
||||
.app_mem rd 1
|
||||
}
|
||||
|
||||
HEAP_DATA_SIZE equ 20
|
||||
virtual at 0
|
||||
HEAP_DATA HEAP_DATA
|
||||
end virtual
|
||||
|
||||
struc BOOT_DATA
|
||||
{ .bpp dd ?
|
||||
.scanline dd ?
|
||||
.vesa_mode dd ?
|
||||
.x_res dd ?
|
||||
.y_res dd ?
|
||||
.mouse_port dd ?
|
||||
.bank_switch dd ?
|
||||
.lfb dd ?
|
||||
.vesa_mem dd ?
|
||||
.log dd ?
|
||||
.direct_lfb dd ?
|
||||
.pci_data dd ?
|
||||
; dd ?
|
||||
.vrr dd ?
|
||||
.ide_base dd ?
|
||||
.mem_amount dd ?
|
||||
.pages_count dd ?
|
||||
.pagemap_size dd ?
|
||||
.kernel_max dd ?
|
||||
.kernel_pages dd ?
|
||||
.kernel_tables dd ?
|
||||
|
||||
.cpu_vendor dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
.cpu_sign dd ?
|
||||
.cpu_info dd ?
|
||||
.cpu_caps dd ?
|
||||
dd ?
|
||||
dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
BOOT_DATA BOOT_DATA
|
||||
end virtual
|
||||
|
||||
struc MEM_STATE
|
||||
{ .mutex rd 1
|
||||
.smallmap rd 1
|
||||
.treemap rd 1
|
||||
.topsize rd 1
|
||||
.top rd 1
|
||||
.smallbins rd 4*32
|
||||
.treebins rd 32
|
||||
}
|
||||
|
||||
struc PG_DATA
|
||||
{ .mem_amount dd ?
|
||||
.vesa_mem dd ?
|
||||
.pages_count dd ?
|
||||
.pages_free dd ?
|
||||
.pages_faults dd ?
|
||||
.pagemap_size dd ?
|
||||
.kernel_max dd ?
|
||||
.kernel_pages dd ?
|
||||
.kernel_tables dd ?
|
||||
.sys_page_dir dd ?
|
||||
.pg_mutex dd ?
|
||||
}
|
||||
|
||||
;struc LIB
|
||||
;{ .lib_name rb 16
|
||||
; .lib_base dd ?
|
||||
; .lib_start dd ?
|
||||
; .export dd ?
|
||||
; .import dd ?
|
||||
;}
|
||||
|
||||
struc SRV
|
||||
{ .srv_name rb 16 ;ASCIIZ string
|
||||
.magic dd ? ;+0x10 ;'SRV '
|
||||
.size dd ? ;+0x14 ;size of structure SRV
|
||||
.fd dd ? ;+0x18 ;next SRV descriptor
|
||||
.bk dd ? ;+0x1C ;prev SRV descriptor
|
||||
.base dd ? ;+0x20 ;service base address
|
||||
.entry dd ? ;+0x24 ;service START function
|
||||
.srv_proc dd ? ;+0x28 ;main service handler
|
||||
}
|
||||
|
||||
SRV_FD_OFFSET equ 0x18
|
||||
SRV_SIZE equ 44
|
||||
|
||||
struc COFF_HEADER
|
||||
{ .machine dw ?
|
||||
.nSections dw ?
|
||||
.DataTime dd ?
|
||||
.pSymTable dd ?
|
||||
.nSymbols dd ?
|
||||
.optHeader dw ?
|
||||
.flags dw ?
|
||||
};
|
||||
|
||||
|
||||
struc COFF_SECTION
|
||||
{ .Name rb 8
|
||||
.VirtualSize dd ?
|
||||
.VirtualAddress dd ?
|
||||
.SizeOfRawData dd ?
|
||||
.PtrRawData dd ?
|
||||
.PtrReloc dd ?
|
||||
.PtrLinenumbers dd ?
|
||||
.NumReloc dw ?
|
||||
.NumLinenum dw ?
|
||||
.Characteristics dd ?
|
||||
}
|
||||
COFF_SECTION_SIZE equ 40
|
||||
|
||||
struc COFF_RELOC
|
||||
{ .VirtualAddress dd ?
|
||||
.SymIndex dd ?
|
||||
.Type dw ?
|
||||
}
|
||||
|
||||
struc COFF_SYM
|
||||
{ .Name rb 8
|
||||
.Value dd ?
|
||||
.SectionNumber dw ?
|
||||
.Type dw ?
|
||||
.StorageClass db ?
|
||||
.NumAuxSymbols db ?
|
||||
}
|
||||
CSYM_SIZE equ 18
|
||||
|
||||
struc IOCTL
|
||||
{ .handle dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
IOCTL IOCTL
|
||||
end virtual
|
||||
|
||||
;virtual at 0
|
||||
; LIB LIB
|
||||
;end virtual
|
||||
|
||||
virtual at 0
|
||||
SRV SRV
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CFH COFF_HEADER
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CFS COFF_SECTION
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CRELOC COFF_RELOC
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
CSYM COFF_SYM
|
||||
end virtual
|
||||
|
@ -1,507 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; diamond, 2006
|
||||
sys_debug_services:
|
||||
cmp eax, 9
|
||||
ja @f
|
||||
jmp dword [sys_debug_services_table+eax*4]
|
||||
@@: ret
|
||||
sys_debug_services_table:
|
||||
dd debug_set_event_data
|
||||
dd debug_getcontext
|
||||
dd debug_setcontext
|
||||
dd debug_detach
|
||||
dd debug_suspend
|
||||
dd debug_resume
|
||||
dd debug_read_process_memory
|
||||
dd debug_write_process_memory
|
||||
dd debug_terminate
|
||||
dd debug_set_drx
|
||||
|
||||
debug_set_event_data:
|
||||
; in: ebx = pointer
|
||||
; destroys eax
|
||||
mov eax, [CURRENT_TASK]
|
||||
shl eax, 8
|
||||
mov [eax+SLOT_BASE+APPDATA.dbg_event_mem], ebx
|
||||
ret
|
||||
|
||||
get_debuggee_slot:
|
||||
; in: ebx=PID
|
||||
; out: CF=1 if error
|
||||
; CF=0 and eax=slot*0x20 if ok
|
||||
; out: interrupts disabled
|
||||
cli
|
||||
mov eax, ebx
|
||||
call pid_to_slot
|
||||
test eax, eax
|
||||
jz .ret_bad
|
||||
shl eax, 5
|
||||
push ebx
|
||||
mov ebx, [CURRENT_TASK]
|
||||
cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx
|
||||
pop ebx
|
||||
jnz .ret_bad
|
||||
; clc ; automatically
|
||||
ret
|
||||
.ret_bad:
|
||||
stc
|
||||
ret
|
||||
|
||||
debug_detach:
|
||||
; in: ebx=pid
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
and dword [eax*8+SLOT_BASE+APPDATA.debugger_slot], 0
|
||||
call do_resume
|
||||
.ret:
|
||||
sti
|
||||
ret
|
||||
|
||||
debug_terminate:
|
||||
; in: ebx=pid
|
||||
call get_debuggee_slot
|
||||
jc debug_detach.ret
|
||||
mov ebx, eax
|
||||
shr ebx, 5
|
||||
push 2
|
||||
pop eax
|
||||
jmp sys_system
|
||||
|
||||
debug_suspend:
|
||||
; in: ebx=pid
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
mov bl, [CURRENT_TASK+eax+TASKDATA.state] ; process state
|
||||
test bl, bl
|
||||
jz .1
|
||||
cmp bl, 5
|
||||
jnz .ret
|
||||
mov bl, 2
|
||||
.2: mov [CURRENT_TASK+eax+TASKDATA.state], bl
|
||||
.ret:
|
||||
sti
|
||||
ret
|
||||
.1:
|
||||
inc ebx
|
||||
jmp .2
|
||||
|
||||
do_resume:
|
||||
mov bl, [CURRENT_TASK+eax+TASKDATA.state]
|
||||
cmp bl, 1
|
||||
jz .1
|
||||
cmp bl, 2
|
||||
jnz .ret
|
||||
mov bl, 5
|
||||
.2: mov [CURRENT_TASK+eax+TASKDATA.state], bl
|
||||
.ret: ret
|
||||
.1: dec ebx
|
||||
jmp .2
|
||||
|
||||
debug_resume:
|
||||
; in: ebx=pid
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
call do_resume
|
||||
.ret: sti
|
||||
ret
|
||||
|
||||
debug_getcontext:
|
||||
; in:
|
||||
; ebx=pid
|
||||
; ecx=sizeof(CONTEXT)
|
||||
; edx->CONTEXT
|
||||
; destroys eax,ecx,edx,esi,edi
|
||||
cmp ecx, 28h
|
||||
jnz .ret
|
||||
add edx, std_application_base_address
|
||||
push ebx
|
||||
mov ebx, edx
|
||||
call check_region
|
||||
pop ebx
|
||||
dec eax
|
||||
jnz .ret
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
imul eax, tss_step/32
|
||||
add eax, tss_data
|
||||
mov edi, edx
|
||||
cmp [eax+TSS._cs], app_code
|
||||
jnz .ring0
|
||||
lea esi, [eax+TSS._eip]
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
jmp .ret
|
||||
.ring0:
|
||||
; note that following code assumes that all interrupt/exception handlers
|
||||
; saves ring-3 context by push ds es, pushad in this order
|
||||
mov esi, [eax+TSS._esp0]
|
||||
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), ds, es, pushad
|
||||
sub esi, 8+12+8+20h
|
||||
lodsd
|
||||
mov [edi+24h], eax
|
||||
lodsd
|
||||
mov [edi+20h], eax
|
||||
lodsd
|
||||
mov [edi+1Ch], eax
|
||||
lodsd
|
||||
lodsd
|
||||
mov [edi+14h], eax
|
||||
lodsd
|
||||
mov [edi+10h], eax
|
||||
lodsd
|
||||
mov [edi+0Ch], eax
|
||||
lodsd
|
||||
mov [edi+8], eax
|
||||
add esi, 8
|
||||
lodsd
|
||||
mov [edi], eax
|
||||
lodsd
|
||||
lodsd
|
||||
mov [edi+4], eax
|
||||
lodsd
|
||||
mov [edi+18h], eax
|
||||
.ret:
|
||||
sti
|
||||
ret
|
||||
|
||||
debug_setcontext:
|
||||
; in:
|
||||
; ebx=pid
|
||||
; ecx=sizeof(CONTEXT)
|
||||
; edx->CONTEXT
|
||||
; destroys eax,ecx,edx,esi,edi
|
||||
cmp ecx, 28h
|
||||
jnz .ret
|
||||
add edx, std_application_base_address
|
||||
push ebx
|
||||
mov ebx, edx
|
||||
call check_region
|
||||
pop ebx
|
||||
dec eax
|
||||
jnz .ret
|
||||
call get_debuggee_slot
|
||||
jc .stiret
|
||||
imul eax, tss_step/32
|
||||
add eax, tss_data
|
||||
mov esi, edx
|
||||
cmp [eax+TSS._cs], app_code
|
||||
jnz .ring0
|
||||
lea edi, [eax+TSS._eip]
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
jmp .stiret
|
||||
.ring0:
|
||||
mov edi, [eax+TSS._esp0]
|
||||
sub edi, 8+12+8+20h
|
||||
mov eax, [esi+24h]
|
||||
stosd
|
||||
mov eax, [esi+20h]
|
||||
stosd
|
||||
mov eax, [esi+1Ch]
|
||||
stosd
|
||||
scasd
|
||||
mov eax, [esi+14h]
|
||||
stosd
|
||||
mov eax, [esi+10h]
|
||||
stosd
|
||||
mov eax, [esi+0Ch]
|
||||
stosd
|
||||
mov eax, [esi+8]
|
||||
stosd
|
||||
add edi, 8
|
||||
mov eax, [esi]
|
||||
stosd
|
||||
scasd
|
||||
mov eax, [esi+4]
|
||||
stosd
|
||||
mov eax, [esi+18h]
|
||||
stosd
|
||||
.stiret:
|
||||
sti
|
||||
.ret:
|
||||
ret
|
||||
|
||||
debug_set_drx:
|
||||
call get_debuggee_slot
|
||||
jc .errret
|
||||
mov ebp, eax
|
||||
lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs]
|
||||
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
||||
; [eax+10]=dr7
|
||||
add edx, std_application_base_address
|
||||
jc .errret
|
||||
cmp cl, 3
|
||||
ja .errret
|
||||
mov ebx, dr7
|
||||
shr ebx, cl
|
||||
shr ebx, cl
|
||||
test ebx, 2 ; bit 1+2*index = G0..G3, global break enable
|
||||
jnz .errret2
|
||||
test ch, ch
|
||||
jns .new
|
||||
; clear breakpoint
|
||||
movzx ecx, cl
|
||||
add ecx, ecx
|
||||
and dword [eax+ecx*2], 0 ; clear DR<i>
|
||||
btr dword [eax+10h], ecx ; clear L<i> bit
|
||||
test byte [eax+10h], 55h
|
||||
jnz .okret
|
||||
imul eax, ebp, tss_step/32
|
||||
and byte [eax + tss_data + TSS._trap], not 1
|
||||
.okret:
|
||||
and dword [esp+36], 0
|
||||
sti
|
||||
ret
|
||||
.errret:
|
||||
sti
|
||||
mov dword [esp+36], 1
|
||||
ret
|
||||
.errret2:
|
||||
sti
|
||||
mov dword [esp+36], 2
|
||||
ret
|
||||
.new:
|
||||
; add new breakpoint
|
||||
; cl=index; ch=flags; edx=address
|
||||
test ch, 0xF0
|
||||
jnz .errret
|
||||
mov bl, ch
|
||||
and bl, 3
|
||||
cmp bl, 2
|
||||
jz .errret
|
||||
mov bl, ch
|
||||
shr bl, 2
|
||||
cmp bl, 2
|
||||
jz .errret
|
||||
test dl, bl
|
||||
jnz .errret
|
||||
or byte [eax+10h+1], 3 ; set GE and LE flags
|
||||
movzx ebx, ch
|
||||
movzx ecx, cl
|
||||
add ecx, ecx
|
||||
bts dword [eax+10h], ecx ; set L<i> flag
|
||||
add ecx, ecx
|
||||
mov [eax+ecx], edx ; set DR<i>
|
||||
shl ebx, cl
|
||||
mov edx, 0xF
|
||||
shl edx, cl
|
||||
not edx
|
||||
and [eax+10h+2], dx
|
||||
or [eax+10h+2], bx ; set R/W and LEN fields
|
||||
imul eax, ebp, tss_step/32
|
||||
or byte [eax + tss_data + TSS._trap], 1
|
||||
jmp .okret
|
||||
|
||||
debug_read_process_memory:
|
||||
; in:
|
||||
; ebx=pid
|
||||
; ecx=length
|
||||
; esi->buffer in debugger
|
||||
; edx=address in debuggee
|
||||
; out: [esp+36]=sizeof(read)
|
||||
; destroys all
|
||||
add esi, std_application_base_address
|
||||
push ebx
|
||||
mov ebx, esi
|
||||
call check_region
|
||||
pop ebx
|
||||
dec eax
|
||||
jnz .err
|
||||
call get_debuggee_slot
|
||||
jc .err
|
||||
shr eax, 5
|
||||
mov ebx, esi
|
||||
call read_process_memory
|
||||
sti
|
||||
mov dword [esp+36], eax
|
||||
ret
|
||||
.err:
|
||||
or dword [esp+36], -1
|
||||
ret
|
||||
|
||||
debug_write_process_memory:
|
||||
; in:
|
||||
; ebx=pid
|
||||
; ecx=length
|
||||
; esi->buffer in debugger
|
||||
; edx=address in debuggee
|
||||
; out: [esp+36]=sizeof(write)
|
||||
; destroys all
|
||||
add esi, std_application_base_address
|
||||
push ebx
|
||||
mov ebx, esi
|
||||
call check_region
|
||||
pop ebx
|
||||
dec eax
|
||||
jnz debug_read_process_memory.err
|
||||
call get_debuggee_slot
|
||||
jc debug_read_process_memory.err
|
||||
shr eax, 5
|
||||
mov ebx, esi
|
||||
call write_process_memory
|
||||
sti
|
||||
mov [esp+36], eax
|
||||
ret
|
||||
|
||||
debugger_notify:
|
||||
; in: eax=debugger slot
|
||||
; ecx=size of debug message
|
||||
; [esp+4]..[esp+4+ecx]=message
|
||||
; interrupts must be disabled!
|
||||
; destroys all general registers
|
||||
; interrupts remain disabled
|
||||
xchg ebp, eax
|
||||
mov edi, [timer_ticks]
|
||||
add edi, 500 ; 5 sec timeout
|
||||
.1:
|
||||
mov eax, ebp
|
||||
shl eax, 8
|
||||
mov edx, [SLOT_BASE+eax+APPDATA.dbg_event_mem]
|
||||
test edx, edx
|
||||
jz .ret
|
||||
; read buffer header
|
||||
push ecx
|
||||
push eax
|
||||
push eax
|
||||
mov eax, ebp
|
||||
mov ebx, esp
|
||||
mov ecx, 8
|
||||
call read_process_memory
|
||||
cmp eax, ecx
|
||||
jz @f
|
||||
add esp, 12
|
||||
jmp .ret
|
||||
@@:
|
||||
cmp dword [ebx], 0
|
||||
jg @f
|
||||
.2:
|
||||
pop ecx
|
||||
pop ecx
|
||||
pop ecx
|
||||
cmp dword [CURRENT_TASK], 1
|
||||
jnz .notos
|
||||
cmp [timer_ticks], edi
|
||||
jae .ret
|
||||
.notos:
|
||||
sti
|
||||
call change_task
|
||||
cli
|
||||
jmp .1
|
||||
@@:
|
||||
mov ecx, [ebx+8]
|
||||
add ecx, [ebx+4]
|
||||
cmp ecx, [ebx]
|
||||
ja .2
|
||||
; advance buffer position
|
||||
push ecx
|
||||
mov ecx, 4
|
||||
sub ebx, ecx
|
||||
mov eax, ebp
|
||||
add edx, ecx
|
||||
call write_process_memory
|
||||
pop eax
|
||||
; write message
|
||||
mov eax, ebp
|
||||
add edx, ecx
|
||||
add edx, [ebx+8]
|
||||
add ebx, 20
|
||||
pop ecx
|
||||
pop ecx
|
||||
pop ecx
|
||||
call write_process_memory
|
||||
; new debug event
|
||||
mov eax, ebp
|
||||
shl eax, 8
|
||||
or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h
|
||||
.ret:
|
||||
ret
|
||||
|
||||
debug_exc:
|
||||
; int 1 = #DB
|
||||
save_ring3_context
|
||||
cld
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov eax, dr6
|
||||
test ax, ax
|
||||
jns @f
|
||||
; this is exception from task switch
|
||||
; set DRx registers for task and continue
|
||||
mov eax, [CURRENT_TASK]
|
||||
shl eax, 8
|
||||
add eax, SLOT_BASE+APPDATA.dbg_regs
|
||||
mov ecx, [eax+0]
|
||||
mov dr0, ecx
|
||||
mov ecx, [eax+4]
|
||||
mov dr1, ecx
|
||||
mov ecx, [eax+8]
|
||||
mov dr2, ecx
|
||||
mov ecx, [eax+0Ch]
|
||||
mov dr3, ecx
|
||||
xor ecx, ecx
|
||||
mov dr6, ecx
|
||||
mov ecx, [eax+10h]
|
||||
mov dr7, ecx
|
||||
restore_ring3_context
|
||||
iretd
|
||||
@@:
|
||||
push eax
|
||||
xor eax, eax
|
||||
mov dr6, eax
|
||||
; test if debugging
|
||||
cli
|
||||
mov eax, [CURRENT_TASK]
|
||||
shl eax, 8
|
||||
mov eax, [SLOT_BASE+eax+APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jnz .debug
|
||||
sti
|
||||
; not debuggee => say error and terminate
|
||||
add esp, 28h+4
|
||||
mov [error_interrupt], 1
|
||||
call show_error_parameters
|
||||
mov edx, [TASK_BASE]
|
||||
mov byte [edx+TASKDATA.state], 4
|
||||
jmp change_task
|
||||
.debug:
|
||||
; we are debugged process, notify debugger and suspend ourself
|
||||
; eax=debugger PID
|
||||
pop edx
|
||||
mov ebx, dr7
|
||||
mov cl, not 1
|
||||
.l1:
|
||||
test bl, 1
|
||||
jnz @f
|
||||
and dl, cl
|
||||
@@:
|
||||
shr ebx, 2
|
||||
add cl, cl
|
||||
inc ecx
|
||||
cmp cl, not 10h
|
||||
jnz .l1
|
||||
push edx ; DR6 image
|
||||
mov ecx, [TASK_BASE]
|
||||
push dword [ecx+TASKDATA.pid] ; PID
|
||||
push 12
|
||||
pop ecx
|
||||
push 3 ; 3 = debug exception
|
||||
call debugger_notify
|
||||
pop ecx
|
||||
pop ecx
|
||||
pop ecx
|
||||
mov edx, [TASK_BASE]
|
||||
mov byte [edx+TASKDATA.state], 1 ; suspended
|
||||
call change_task
|
||||
restore_ring3_context
|
||||
iretd
|
@ -1,143 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;**************************************************
|
||||
;* ÏÎÈÑÊ ÌÛØÈ ÏÎ ÏÎÑËÅÄÎÂÀÒÅËÜÍÛÌ ÏÎÐÒÀÌ *
|
||||
;* Ïðîöåäóðà ïîäãîòàâëèâàåò ãëîáàëüíûå ïåðåìåííûå *
|
||||
;* COMPortNum è COMPortBaseAddr äëÿ ïîäïðîãðàììû *
|
||||
;* óñòàíîâêè îáðàáîò÷èêà ïðåðûâàíèÿ *
|
||||
;**************************************************
|
||||
; Àâòîð èñõîäíîãî òåêñòà Êóëàêîâ Âëàäèìèð Ãåííàäüåâè÷.
|
||||
; Àäàïòàöèÿ è äîðàáîòêà Mario79
|
||||
|
||||
Detect_COM_Mouse:
|
||||
pusha
|
||||
call MSMouseSearch
|
||||
cmp AL,'M'
|
||||
jne @f
|
||||
mov [com1_mouse_detected],1
|
||||
pusha
|
||||
|
||||
mov eax,4
|
||||
shl eax,2
|
||||
mov [irq_owner+eax],byte 1
|
||||
|
||||
inc dword [RESERVED_PORTS]
|
||||
mov edi,[RESERVED_PORTS]
|
||||
shl edi,4
|
||||
mov [RESERVED_PORTS+edi+0],dword 1
|
||||
mov [RESERVED_PORTS+edi+4],dword 0x3f0
|
||||
mov [RESERVED_PORTS+edi+8],dword 0x3ff
|
||||
|
||||
popa
|
||||
mov esi,boot_setmouse_type+22
|
||||
call boot_log
|
||||
@@:
|
||||
sub [COMPortBaseAddr],100h
|
||||
call MSMouseSearch
|
||||
cmp AL,'M'
|
||||
jne @f
|
||||
mov [com2_mouse_detected],1
|
||||
pusha
|
||||
|
||||
mov eax,3
|
||||
shl eax,2
|
||||
mov [irq_owner+eax],byte 1
|
||||
|
||||
inc dword [RESERVED_PORTS]
|
||||
mov edi,[RESERVED_PORTS]
|
||||
shl edi,4
|
||||
mov [RESERVED_PORTS+edi+0],dword 1
|
||||
mov [RESERVED_PORTS+edi+4],dword 0x2f0
|
||||
mov [RESERVED_PORTS+edi+8],dword 0x2ff
|
||||
|
||||
popa
|
||||
mov esi,boot_setmouse_type+44
|
||||
call boot_log
|
||||
@@:
|
||||
popa
|
||||
jmp end_detecting_mouse
|
||||
|
||||
MSMouseSearch:
|
||||
; ÏÎÈÑÊ ÌÛØÈ ×ÅÐÅÇ COM-ÏÎÐÒÛ
|
||||
MouseSearch:
|
||||
; Óñòàíàâëèâàåì ñêîðîñòü
|
||||
; ïðèåìà/ïåðåäà÷è 1200 áîä
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,3
|
||||
in AL,DX
|
||||
or AL,80h ;óñòàíîâèòü áèò DLAB
|
||||
out DX,AL
|
||||
mov DX,[COMPortBaseAddr]
|
||||
mov AL,60h ;1200 áîä
|
||||
out DX,AL
|
||||
inc DX
|
||||
mov AL,0
|
||||
out DX,AL
|
||||
; Óñòàíîâèòü äëèíó ñëîâà 7 áèò, 1 ñòîïîâûé áèò,
|
||||
; ÷åòíîñòü íå êîíòðîëèðîâàòü
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,3
|
||||
mov AL,00000010b
|
||||
out DX,AL
|
||||
; Çàïðåòèòü âñå ïðåðûâàíè
|
||||
mov DX,[COMPortBaseAddr]
|
||||
inc DX
|
||||
mov AL,0
|
||||
out DX,AL
|
||||
; Ïðîâåðèòü, ÷òî óñòðîéñòâî ïîäêëþ÷åíî è ÿâëÿåòñ
|
||||
; ìûøüþ òèïà MSMouse
|
||||
; Îòêëþ÷èòü ïèòàíèå ìûøè è ïðåðûâàíè
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,4 ;ðåãèñòð óïðàâëåíèÿ ìîäåìîì
|
||||
mov AL,0 ;ñáðîñèòü DTR, RTS è OUT2
|
||||
out DX,AL
|
||||
; Îæèäàòü 5 "òèêîâ" (0,2 ñ)
|
||||
mov ecx,0xffff
|
||||
dT_1:
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
jne dT_1
|
||||
mov ecx,0xffff
|
||||
; Âêëþ÷èòü ïèòàíèå ìûøè
|
||||
mov AL,11b ;óñòàíîâèòü DTR è RTS
|
||||
out DX,AL
|
||||
; Î÷èñòèòü ðåãèñòð äàííûõ
|
||||
mov DX,[COMPortBaseAddr]
|
||||
in AL,DX
|
||||
; Öèêë îïðîñà ïîðòà
|
||||
WaitData:
|
||||
; Îæèäàòü åùå 10 "òèêîâ"
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je NoMouse
|
||||
; Ïðîâåðèòü íàëè÷èå èäåíòèôèêàöèîííîãî áàéòà
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,5
|
||||
in AL,DX
|
||||
test AL,1 ;Äàííûå ãîòîâû?
|
||||
jz WaitData
|
||||
; Ââåñòè äàííûå
|
||||
mov DX,[COMPortBaseAddr]
|
||||
in AL,DX
|
||||
NoMouse:
|
||||
ret
|
||||
|
||||
iglobal
|
||||
COMPortBaseAddr dw 3F8h
|
||||
;COMPortNum dw 0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
boot_setmouse_type db 'Detected - PS2 mouse',0
|
||||
db 'Detected - COM1 mouse',0
|
||||
db 'Detected - COM2 mouse',0
|
||||
endg
|
||||
|
||||
end_detecting_mouse:
|
||||
|
@ -1,139 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
MouseSearch_PS2:
|
||||
jmp MouseSearch_PS2_begin
|
||||
|
||||
mouse_error equ MouseSearch_PS2_begin.error
|
||||
|
||||
kb_cmd_c:
|
||||
call kb_cmd
|
||||
jmp check_kbd
|
||||
|
||||
kb_write_c:
|
||||
call kb_write
|
||||
jmp check_kbd
|
||||
|
||||
kb_read_c:
|
||||
call kb_read
|
||||
;jmp check_kbd
|
||||
|
||||
check_kbd:
|
||||
cmp ah, 1
|
||||
je mouse_error
|
||||
ret
|
||||
|
||||
uglobal
|
||||
mouse_cmd_byte db 0
|
||||
mouse_nr_tries db 0
|
||||
mouse_nr_resends db 0
|
||||
|
||||
mouse_error_esp dd 0
|
||||
endg
|
||||
|
||||
|
||||
mouse_cmd:
|
||||
mov [mouse_cmd_byte], al
|
||||
mov [mouse_nr_resends], 5
|
||||
.resend:
|
||||
mov bl, 0xd4
|
||||
call kb_cmd_c
|
||||
mov al, [mouse_cmd_byte]
|
||||
call kb_write_c
|
||||
|
||||
call mouse_read
|
||||
|
||||
cmp al, 0xFA ; ack
|
||||
jne .noack
|
||||
ret
|
||||
.noack:
|
||||
cmp al, 0xFE ; resend
|
||||
jne .noresend
|
||||
dec [mouse_nr_resends]
|
||||
jnz .resend
|
||||
.noresend:
|
||||
jmp mouse_error
|
||||
|
||||
|
||||
mouse_read:
|
||||
mov [mouse_nr_tries], 100
|
||||
.repeat:
|
||||
call kb_read
|
||||
cmp ah, 1
|
||||
jne .fin
|
||||
mov esi, 10
|
||||
call delay_ms
|
||||
dec [mouse_nr_tries]
|
||||
jnz .repeat
|
||||
jmp mouse_error
|
||||
.fin:
|
||||
ret
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
MouseSearch_PS2_begin:
|
||||
pushad
|
||||
|
||||
mov [mouse_error_esp], esp
|
||||
|
||||
mov bl, 0xAD ; disable keyboard interface
|
||||
call kb_cmd_c
|
||||
|
||||
mov bl, 0xA8 ; enable mouse interface
|
||||
call kb_cmd_c
|
||||
|
||||
mov al, 0xFF ; reset
|
||||
call mouse_cmd
|
||||
|
||||
; now the mouse is in Reset Mode
|
||||
; get the Basic Assurance Test completion code
|
||||
call mouse_read
|
||||
cmp al, 0xAA
|
||||
jne .error ; dead mouse
|
||||
|
||||
; get device ID
|
||||
call mouse_read
|
||||
cmp al, 0x00
|
||||
jne .error ; unknown device
|
||||
|
||||
; reset completed successfully
|
||||
|
||||
; enable mouse interrupt - IRQ12
|
||||
mov bl, 0x20 ; read command byte
|
||||
call kb_cmd_c
|
||||
call kb_read_c
|
||||
or al, 10b
|
||||
push eax
|
||||
mov bl, 0x60 ; write command byte
|
||||
call kb_cmd_c
|
||||
pop eax
|
||||
call kb_write_c
|
||||
|
||||
mov al, 0xF4 ; enable data reporting
|
||||
call mouse_cmd
|
||||
|
||||
mov [ps2_mouse_detected], 1
|
||||
mov bl, 0xAE ; enable keyboard interface
|
||||
call kb_cmd
|
||||
|
||||
mov esi, boot_setmouse_type
|
||||
call boot_log
|
||||
|
||||
jmp .finish
|
||||
|
||||
|
||||
.error:
|
||||
mov esp, [mouse_error_esp] ; clear stack frame
|
||||
mov [ps2_mouse_detected], 0
|
||||
mov bl, 0xA7 ; disable mouse interface
|
||||
call kb_cmd
|
||||
mov bl, 0xAE ; enable keyboard interface
|
||||
call kb_cmd
|
||||
|
||||
.finish:
|
||||
popad
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
iglobal
|
||||
szKernel db 'KERNEL', 0
|
||||
szVersion db 'version',0
|
||||
|
||||
szRegService db 'RegService',0
|
||||
szGetService db 'GetService',0
|
||||
szServiceHandler db 'ServiceHandler',0
|
||||
szAttachIntHandler db 'AttachIntHandler',0
|
||||
szFpuSave db 'FpuSave',0
|
||||
szFpuRestore db 'FpuRestore',0
|
||||
|
||||
szPciApi db 'PciApi', 0
|
||||
szPciRead32 db 'PciRead32', 0
|
||||
szPciRead8 db 'PciRead8', 0
|
||||
szPciWrite8 db 'PciWrite8',0
|
||||
|
||||
szAllocPage db 'AllocPage',0
|
||||
szAllocPages db 'AllocPages',0
|
||||
szFreePage db 'FreePage',0
|
||||
szGetPgAddr db 'GetPgAddr',0
|
||||
szMapPage db 'MapPage',0
|
||||
szMapSpace db 'MapSpace',0
|
||||
szCommitPages db 'CommitPages',0
|
||||
szReleasePages db 'ReleasePages',0
|
||||
|
||||
szAllocKernelSpace db 'AllocKernelSpace',0
|
||||
szFreeKernelSpace db 'FreeKernelSpace',0
|
||||
szKernelAlloc db 'KernelAlloc',0
|
||||
szKernelFree db 'KernelFree',0
|
||||
szUserAlloc db 'UserAlloc',0
|
||||
szUserFree db 'UserFree',0
|
||||
szKmalloc db 'Kmalloc',0
|
||||
szKfree db 'Kfree',0
|
||||
|
||||
szCreateObject db 'CreateObject',0
|
||||
szDestroyObject db 'DestroyObject',0
|
||||
szCreateEvent db 'CreateEvent',0
|
||||
szRaiseEvent db 'RaiseEvent',0
|
||||
szWaitEvent db 'WaitEvent',0
|
||||
szDestroyEvent db 'DestroyEvent',0
|
||||
szClearEvent db 'ClearEvent',0
|
||||
|
||||
szLoadCursor db 'LoadCursor',0
|
||||
szSetHwCursor db 'SetHwCursor',0
|
||||
szHwCursorRestore db 'HwCursorRestore', 0
|
||||
szHwCursorCreate db 'HwCursorCreate', 0
|
||||
|
||||
szSysMsgBoardStr db 'SysMsgBoardStr', 0
|
||||
szGetCurrentTask db 'GetCurrentTask',0
|
||||
szLFBAddress db 'LFBAddress',0
|
||||
szLoadFile db 'LoadFile',0
|
||||
szSendEvent db 'SendEvent',0
|
||||
|
||||
|
||||
align 16
|
||||
kernel_export:
|
||||
dd szRegService , reg_service
|
||||
dd szGetService , get_service
|
||||
dd szServiceHandler , srv_handler
|
||||
dd szAttachIntHandler, attach_int_handler
|
||||
dd szFpuSave , fpu_save
|
||||
dd szFpuRestore , fpu_restore
|
||||
|
||||
dd szPciApi , pci_api
|
||||
dd szPciRead32 , pci_read32
|
||||
dd szPciRead8 , pci_read8
|
||||
dd szPciWrite8 , pci_write8
|
||||
|
||||
dd szAllocPage , alloc_page
|
||||
dd szAllocPages , alloc_pages
|
||||
dd szFreePage , free_page
|
||||
dd szMapPage , map_page
|
||||
dd szMapSpace , map_space
|
||||
dd szGetPgAddr , get_pg_addr
|
||||
dd szCommitPages , commit_pages ;not implemented
|
||||
dd szReleasePages , release_pages
|
||||
|
||||
dd szAllocKernelSpace, alloc_kernel_space
|
||||
dd szFreeKernelSpace , free_kernel_space
|
||||
dd szKernelAlloc , kernel_alloc
|
||||
dd szKernelFree , kernel_free
|
||||
dd szUserAlloc , user_alloc
|
||||
dd szUserFree , user_free
|
||||
dd szKmalloc , malloc
|
||||
dd szKfree , free
|
||||
|
||||
dd szCreateObject , create_kernel_object
|
||||
dd szDestroyObject , destroy_kernel_object
|
||||
dd szCreateEvent , create_event
|
||||
dd szRaiseEvent , raise_event
|
||||
dd szWaitEvent , wait_event
|
||||
dd szDestroyEvent , destroy_event
|
||||
dd szClearEvent , clear_event
|
||||
|
||||
dd szLoadCursor , load_cursor
|
||||
dd szSetHwCursor , set_hw_cursor
|
||||
dd szHwCursorRestore , hw_restore
|
||||
dd szHwCursorCreate , create_cursor
|
||||
|
||||
dd szSysMsgBoardStr , sys_msg_board_str
|
||||
dd szGetCurrentTask , get_curr_task
|
||||
dd szLoadFile , load_file
|
||||
dd szSendEvent , send_event
|
||||
exp_lfb:
|
||||
dd szLFBAddress , 0
|
||||
dd 0
|
||||
|
||||
endg
|
||||
|
@ -1,283 +0,0 @@
|
||||
$Revision: 435 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
init_fpu:
|
||||
clts
|
||||
fninit
|
||||
|
||||
bt [cpu_caps], CAPS_SSE
|
||||
jnc .no_SSE
|
||||
|
||||
mov ebx, cr4
|
||||
mov ecx, cr0
|
||||
or ebx, CR4_OSFXSR+CR4_OSXMMEXPT
|
||||
mov cr4, ebx
|
||||
|
||||
and ecx, not (CR0_MP+CR0_EM)
|
||||
or ecx, CR0_NE
|
||||
mov cr0, ecx
|
||||
|
||||
mov dword [esp-4], SSE_INIT
|
||||
ldmxcsr [esp-4]
|
||||
|
||||
xorps xmm0, xmm0
|
||||
xorps xmm1, xmm1
|
||||
xorps xmm2, xmm2
|
||||
xorps xmm3, xmm3
|
||||
xorps xmm4, xmm4
|
||||
xorps xmm5, xmm5
|
||||
xorps xmm6, xmm6
|
||||
xorps xmm7, xmm7
|
||||
fxsave [fpu_data] ;[eax]
|
||||
ret
|
||||
.no_SSE:
|
||||
mov ecx, cr0
|
||||
and ecx, not CR0_EM
|
||||
or ecx, CR0_MP+CR0_NE
|
||||
mov cr0, ecx
|
||||
fnsave [fpu_data]
|
||||
ret
|
||||
|
||||
; param
|
||||
; eax= 512 bytes memory area
|
||||
|
||||
align 4
|
||||
fpu_save:
|
||||
push ecx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
pushfd
|
||||
cli
|
||||
|
||||
clts
|
||||
mov edi, eax
|
||||
|
||||
mov ecx, [fpu_owner]
|
||||
mov esi, [CURRENT_TASK]
|
||||
cmp ecx, esi
|
||||
jne .save
|
||||
|
||||
call save_context
|
||||
jmp .exit
|
||||
.save:
|
||||
mov [fpu_owner], esi
|
||||
|
||||
shl ecx, 8
|
||||
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state]
|
||||
|
||||
call save_context
|
||||
|
||||
shl esi, 8
|
||||
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
fninit
|
||||
.exit:
|
||||
popfd
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
align 4
|
||||
save_context:
|
||||
bt [cpu_caps], CAPS_SSE
|
||||
jnc .no_SSE
|
||||
|
||||
fxsave [eax]
|
||||
ret
|
||||
.no_SSE:
|
||||
fnsave [eax]
|
||||
ret
|
||||
|
||||
align 4
|
||||
fpu_restore:
|
||||
push ecx
|
||||
push esi
|
||||
|
||||
mov esi, eax
|
||||
|
||||
pushfd
|
||||
cli
|
||||
|
||||
mov ecx, [fpu_owner]
|
||||
mov eax, [CURRENT_TASK]
|
||||
cmp ecx, eax
|
||||
jne .copy
|
||||
|
||||
clts
|
||||
bt [cpu_caps], CAPS_SSE
|
||||
jnc .no_SSE
|
||||
|
||||
fxrstor [esi]
|
||||
popfd
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
.no_SSE:
|
||||
fnclex ;fix possible problems
|
||||
frstor [esi]
|
||||
popfd
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
.copy:
|
||||
shl eax, 8
|
||||
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
popfd
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
align 4
|
||||
e7: ;#NM exception handler
|
||||
save_ring3_context
|
||||
clts
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov ebx, [fpu_owner]
|
||||
cmp ebx, [CURRENT_TASK]
|
||||
je .exit
|
||||
|
||||
shl ebx, 8
|
||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
||||
bt [cpu_caps], CAPS_SSE
|
||||
jnc .no_SSE
|
||||
|
||||
fxsave [eax]
|
||||
mov ebx, [CURRENT_TASK]
|
||||
mov [fpu_owner], ebx
|
||||
shl ebx, 8
|
||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
||||
fxrstor [eax]
|
||||
.exit:
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
.no_SSE:
|
||||
fnsave [eax]
|
||||
mov ebx, [CURRENT_TASK]
|
||||
mov [fpu_owner], ebx
|
||||
shl ebx, 8
|
||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
||||
frstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
iglobal
|
||||
fpu_owner dd 1
|
||||
endg
|
||||
|
||||
reg_eip equ ebp+4
|
||||
reg_cs equ ebp+8
|
||||
reg_eflags equ ebp+12
|
||||
reg_esp equ ebp+16
|
||||
reg_ss equ ebp+20
|
||||
|
||||
align 4
|
||||
except_16: ;fpu native exceptions handler
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
mov ebx, [ss:CURRENT_TASK]
|
||||
shl ebx, 8
|
||||
|
||||
mov eax, [ss:ebx+SLOT_BASE+APPDATA.fpu_handler]
|
||||
test eax, eax
|
||||
jz .default
|
||||
|
||||
mov ecx, [reg_eip]
|
||||
mov edx, [reg_esp]
|
||||
sub edx, 4
|
||||
mov [ss:edx+new_app_base], ecx
|
||||
mov [reg_esp], edx
|
||||
mov dword [reg_eip], eax
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
leave
|
||||
iretd
|
||||
|
||||
.default:
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
leave
|
||||
|
||||
save_ring3_context ;debugger support
|
||||
|
||||
mov bl, 16
|
||||
jmp exc_c
|
||||
|
||||
align 4
|
||||
except_19: ;sse exceptions handler
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
mov ebx, [ss:CURRENT_TASK]
|
||||
shl ebx, 8
|
||||
|
||||
mov eax, [ss:ebx+SLOT_BASE+APPDATA.sse_handler]
|
||||
test eax, eax
|
||||
jz .default
|
||||
|
||||
mov ecx, [reg_eip]
|
||||
mov edx, [reg_esp]
|
||||
sub edx, 4
|
||||
mov [ss:edx+new_app_base], ecx
|
||||
mov [reg_esp], edx
|
||||
mov dword [reg_eip], eax
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
leave
|
||||
iretd
|
||||
|
||||
.default:
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
leave
|
||||
|
||||
save_ring3_context ;debugger support
|
||||
|
||||
mov bl, 19
|
||||
jmp exc_c
|
||||
|
||||
restore reg_eip
|
||||
restore reg_cs
|
||||
restore reg_eflags
|
||||
restore reg_esp
|
||||
restore reg_ss
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
checkidle:
|
||||
pushad
|
||||
|
||||
cmp [check_idle_semaphore],0
|
||||
jne no_idle_state
|
||||
|
||||
call change_task
|
||||
mov eax,[idlemem]
|
||||
mov ebx,[timer_ticks] ;[0xfdf0]
|
||||
cmp eax,ebx
|
||||
jnz idle_exit
|
||||
call _rdtsc
|
||||
mov ecx,eax
|
||||
idle_loop:
|
||||
hlt
|
||||
cmp [check_idle_semaphore],0
|
||||
jne idle_loop_exit
|
||||
mov eax,[timer_ticks] ;[0xfdf0]
|
||||
cmp ebx,eax
|
||||
jz idle_loop
|
||||
idle_loop_exit:
|
||||
mov [idlemem],eax
|
||||
call _rdtsc
|
||||
sub eax,ecx
|
||||
mov ebx,[idleuse]
|
||||
add ebx,eax
|
||||
mov [idleuse],ebx
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
idle_exit:
|
||||
|
||||
mov ebx,[timer_ticks] ;[0xfdf0]
|
||||
mov [idlemem],ebx
|
||||
call change_task
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
no_idle_state:
|
||||
|
||||
dec [check_idle_semaphore]
|
||||
|
||||
mov ebx,[timer_ticks] ;[0xfdf0]
|
||||
mov [idlemem],ebx
|
||||
call change_task
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
uglobal
|
||||
idlemem dd 0x0
|
||||
idleuse dd 0x0
|
||||
idleusesec dd 0x0
|
||||
check_idle_semaphore dd 0x0
|
||||
endg
|
@ -1,22 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;
|
||||
; MAIN OS LOOP START ;
|
||||
; ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
align 32
|
||||
osloop:
|
||||
call [draw_pointer]
|
||||
call checkbuttons
|
||||
call checkwindows
|
||||
; call check_window_move_request
|
||||
call checkmisc
|
||||
call checkVga_N13
|
||||
call stack_handler
|
||||
call checkidle
|
||||
call check_fdd_motor_status
|
||||
jmp osloop
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ;
|
||||
; MAIN OS LOOP END ;
|
||||
; ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,217 +0,0 @@
|
||||
$Revision: 434 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; IRQ0 HANDLER (TIMER INTERRUPT) ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 32
|
||||
irq0:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
inc dword [timer_ticks]
|
||||
|
||||
mov eax, [timer_ticks]
|
||||
call playNote ; <<<--- Speaker driver
|
||||
|
||||
cmp eax,[next_usage_update]
|
||||
jb .nocounter
|
||||
add eax,100
|
||||
mov [next_usage_update],eax
|
||||
call updatecputimes
|
||||
.nocounter:
|
||||
|
||||
cmp [DONT_SWITCH], byte 1
|
||||
jne .change_task
|
||||
|
||||
mov al,0x20 ; send End Of Interrupt signal
|
||||
mov dx,0x20
|
||||
out dx,al
|
||||
|
||||
mov [DONT_SWITCH], byte 0
|
||||
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
.change_task:
|
||||
call update_counters
|
||||
|
||||
call find_next_task
|
||||
mov ecx, eax
|
||||
|
||||
mov al,0x20 ; send End Of Interrupt signal
|
||||
mov dx,0x20
|
||||
out dx,al
|
||||
|
||||
test ecx, ecx ; if there is only one running process
|
||||
jnz .return
|
||||
|
||||
call do_change_task
|
||||
|
||||
.return:
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
|
||||
align 4
|
||||
change_task:
|
||||
|
||||
pushfd
|
||||
cli
|
||||
pushad
|
||||
|
||||
call update_counters
|
||||
; \begin{Mario79}
|
||||
cmp [dma_task_switched], 1
|
||||
jne .find_next_task
|
||||
mov [dma_task_switched], 0
|
||||
mov ebx, [dma_process]
|
||||
cmp [CURRENT_TASK], ebx
|
||||
je .return
|
||||
mov edi, [dma_slot_ptr]
|
||||
mov [CURRENT_TASK], ebx
|
||||
mov [TASK_BASE], edi
|
||||
jmp @f
|
||||
.find_next_task:
|
||||
; \end{Mario79}
|
||||
call find_next_task
|
||||
test eax, eax ; the same task -> skip switch
|
||||
jnz .return
|
||||
@@:
|
||||
mov [DONT_SWITCH],byte 1
|
||||
call do_change_task
|
||||
|
||||
.return:
|
||||
popad
|
||||
popfd
|
||||
|
||||
ret
|
||||
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
far_jump:
|
||||
.offs dd ?
|
||||
.sel dw ?
|
||||
context_counter dd ? ;noname & halyavin
|
||||
next_usage_update dd ?
|
||||
timer_ticks dd ?
|
||||
prev_slot dd ?
|
||||
event_sched dd ?
|
||||
endg
|
||||
|
||||
|
||||
update_counters:
|
||||
mov edi, [TASK_BASE]
|
||||
mov ebx, [edi+TASKDATA.counter_add] ; time stamp counter add
|
||||
call _rdtsc
|
||||
sub eax, ebx
|
||||
add eax, [edi+TASKDATA.counter_sum] ; counter sum
|
||||
mov [edi+TASKDATA.counter_sum], eax
|
||||
ret
|
||||
|
||||
|
||||
; Find next task to execute
|
||||
; result: ebx = number of the selected task
|
||||
; eax = 1 if the task is the same
|
||||
; edi = address of the data for the task in ebx
|
||||
; [0x3000] = ebx and [0x3010] = edi
|
||||
; corrupts other regs
|
||||
find_next_task:
|
||||
mov ebx, [CURRENT_TASK]
|
||||
mov edi, [TASK_BASE]
|
||||
mov [prev_slot], ebx
|
||||
|
||||
.waiting_for_termination:
|
||||
.waiting_for_reuse:
|
||||
.waiting_for_event:
|
||||
.suspended:
|
||||
cmp ebx, [TASK_COUNT]
|
||||
jb @f
|
||||
mov edi, CURRENT_TASK
|
||||
xor ebx, ebx
|
||||
@@:
|
||||
|
||||
add edi,0x20
|
||||
inc ebx
|
||||
|
||||
mov al, byte [edi+TASKDATA.state]
|
||||
test al, al
|
||||
jz .found
|
||||
cmp al, 1
|
||||
jz .suspended
|
||||
cmp al, 2
|
||||
jz .suspended
|
||||
cmp al, 3
|
||||
je .waiting_for_termination
|
||||
cmp al, 4
|
||||
je .waiting_for_termination
|
||||
cmp al, 9
|
||||
je .waiting_for_reuse
|
||||
|
||||
mov [CURRENT_TASK],ebx
|
||||
mov [TASK_BASE],edi
|
||||
push ebx
|
||||
shl ebx, 8
|
||||
mov ebx, [SLOT_BASE + ebx + APPDATA.pl0_stack]
|
||||
add ebx, RING0_STACK_SIZE
|
||||
mov [CURRENT_RING0_ESP], ebx
|
||||
pop ebx
|
||||
|
||||
cmp al, 5
|
||||
jne .noevents
|
||||
call get_event_for_app
|
||||
test eax, eax
|
||||
jz .waiting_for_event
|
||||
mov [event_sched], eax
|
||||
mov [edi+TASKDATA.state], byte 0
|
||||
.noevents:
|
||||
.found:
|
||||
mov [CURRENT_TASK],ebx
|
||||
mov [TASK_BASE],edi
|
||||
call _rdtsc
|
||||
mov [edi+TASKDATA.counter_add],eax
|
||||
|
||||
xor eax, eax
|
||||
cmp ebx, [prev_slot]
|
||||
sete al
|
||||
ret
|
||||
|
||||
; in: ebx = TSS selector index
|
||||
do_change_task:
|
||||
shl ebx, 3
|
||||
xor eax, eax
|
||||
add ebx, tss0
|
||||
mov [far_jump.sel], bx ; selector
|
||||
mov [far_jump.offs], eax ; offset
|
||||
jmp pword [far_jump]
|
||||
inc [context_counter] ;noname & halyavin
|
||||
ret
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
updatecputimes:
|
||||
|
||||
mov eax,[idleuse]
|
||||
mov [idleusesec],eax
|
||||
mov [idleuse],dword 0
|
||||
mov ecx, [TASK_COUNT]
|
||||
mov edi, TASK_DATA
|
||||
.newupdate:
|
||||
mov ebx,[edi+TASKDATA.counter_sum]
|
||||
mov [edi+TASKDATA.cpu_usage],ebx
|
||||
mov [edi+TASKDATA.counter_sum],dword 0
|
||||
add edi,0x20
|
||||
dec ecx
|
||||
jnz .newupdate
|
||||
|
||||
ret
|
@ -1,117 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; Synhronization for MenuetOS. ;;
|
||||
;; Author: Halyavin Andrey, halyavin@land.ru ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
if ~defined sync_inc
|
||||
sync_inc_fix:
|
||||
sync_inc fix sync_inc_fix
|
||||
|
||||
;simplest mutex.
|
||||
macro SimpleMutex name
|
||||
{
|
||||
; iglobal
|
||||
name dd 0
|
||||
name#.type = 1
|
||||
; endg
|
||||
}
|
||||
macro WaitSimpleMutex name
|
||||
{
|
||||
local start_wait,ok
|
||||
start_wait=$
|
||||
cli
|
||||
cmp [name],dword 0
|
||||
jz ok
|
||||
sti
|
||||
call change_task
|
||||
jmp start_wait
|
||||
ok=$
|
||||
push eax
|
||||
mov eax,dword [TASK_BASE+second_base_address]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
mov [name],eax
|
||||
pop eax
|
||||
sti
|
||||
}
|
||||
macro ReleaseSimpleMutex name
|
||||
{
|
||||
mov [name],dword 0
|
||||
}
|
||||
macro TryWaitSimpleMutex name ;result in eax and in flags
|
||||
{
|
||||
local ok,try_end
|
||||
cmp [name],dword 0
|
||||
jz ok
|
||||
xor eax,eax
|
||||
jmp try_end
|
||||
ok=$
|
||||
xor eax,eax
|
||||
inc eax
|
||||
try_end=$
|
||||
}
|
||||
macro SimpleCriticalSection name
|
||||
{
|
||||
; iglobal
|
||||
name dd 0
|
||||
dd 0
|
||||
name#.type=2
|
||||
; endg
|
||||
}
|
||||
macro WaitSimpleCriticalSection name
|
||||
{
|
||||
local start_wait,first_wait,inc_counter,end_wait
|
||||
push eax
|
||||
mov eax,[TASK_BASE+second_base_address]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
start_wait=$
|
||||
cli
|
||||
cmp [name],dword 0
|
||||
jz first_wait
|
||||
cmp [name],eax
|
||||
jz inc_counter
|
||||
sti
|
||||
call change_task
|
||||
jmp start_wait
|
||||
first_wait=$
|
||||
mov [name],eax
|
||||
mov [name+4],dword 1
|
||||
jmp end_wait
|
||||
inc_counter=$
|
||||
inc dword [name+4]
|
||||
end_wait=$
|
||||
sti
|
||||
pop eax
|
||||
}
|
||||
macro ReleaseSimpleCriticalSection name
|
||||
{
|
||||
local release_end
|
||||
dec dword [name+4]
|
||||
jnz release_end
|
||||
mov [name],dword 0
|
||||
release_end=$
|
||||
}
|
||||
macro TryWaitSimpleCriticalSection name ;result in eax and in flags
|
||||
{
|
||||
local ok,try_end
|
||||
mov eax,[CURRENT_TASK+second_base_address]
|
||||
mov eax,[eax+TASKDATA.pid]
|
||||
cmp [name],eax
|
||||
jz ok
|
||||
cmp [name],0
|
||||
jz ok
|
||||
xor eax,eax
|
||||
jmp try_end
|
||||
ok=$
|
||||
xor eax,eax
|
||||
inc eax
|
||||
try_end=$
|
||||
}
|
||||
_cli equ call MEM_HeapLock
|
||||
_sti equ call MEM_HeapUnLock
|
||||
end if
|
||||
|
@ -1,849 +0,0 @@
|
||||
$Revision: 434 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; MenuetOS process management, protected ring3 ;;
|
||||
;; ;;
|
||||
;; Distributed under GPL. See file COPYING for details. ;;
|
||||
;; Copyright 2003 Ville Turjanmaa ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 4
|
||||
idtreg:
|
||||
dw 8*0x41-1
|
||||
dd idts+8
|
||||
|
||||
build_process_gdt_tss_pointer:
|
||||
|
||||
mov ecx,tss_data
|
||||
mov edi,0
|
||||
setgdtl2:
|
||||
mov [edi+gdts+ tss0 +0], word tss_step
|
||||
mov [edi+gdts+ tss0 +2], cx
|
||||
mov eax,ecx
|
||||
shr eax,16
|
||||
mov [edi+gdts+ tss0 +4], al
|
||||
mov [edi+gdts+ tss0 +7], ah
|
||||
mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
|
||||
add ecx,tss_step
|
||||
add edi,8
|
||||
cmp edi,8*(max_processes+5)
|
||||
jbe setgdtl2
|
||||
|
||||
ret
|
||||
|
||||
build_interrupt_table:
|
||||
|
||||
mov edi, idts+8
|
||||
mov esi, sys_int
|
||||
mov ecx, 0x40
|
||||
@@:
|
||||
lodsd
|
||||
mov [edi], ax ; lower part of offset
|
||||
mov [edi+2], word os_code ; segment selector
|
||||
mov ax, word 10001110b shl 8 ; type: interrupt gate
|
||||
mov [edi+4], eax
|
||||
add edi, 8
|
||||
loop @b
|
||||
|
||||
;mov edi,8*0x40+idts+8
|
||||
mov dword [edi], (i40 and 0xFFFF) or (os_code shl 16)
|
||||
mov dword [edi+4], (11101111b shl 8) or (i40 and 0xFFFF0000)
|
||||
; type: trap gate
|
||||
ret
|
||||
|
||||
iglobal
|
||||
sys_int:
|
||||
dd e0,debug_exc,e2,e3
|
||||
dd e4,e5,e6,e7
|
||||
dd e8,e9,e10,e11
|
||||
dd e12,e13,page_fault_handler,e15
|
||||
|
||||
dd except_16, e17,e18, except_19
|
||||
times 12 dd unknown_interrupt
|
||||
|
||||
dd irq0 , irq_serv.irq_1, p_irq2 , p_irq3 ;irq_serv.irq_3
|
||||
dd p_irq4 ,irq_serv.irq_5,p_irq6,irq_serv.irq_7
|
||||
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
|
||||
dd irq_serv.irq_11,p_irq12,irqD ,p_irq14,p_irq15
|
||||
|
||||
times 16 dd unknown_interrupt
|
||||
|
||||
dd i40
|
||||
endg
|
||||
|
||||
macro save_ring3_context
|
||||
{
|
||||
push ds es
|
||||
pushad
|
||||
}
|
||||
macro restore_ring3_context
|
||||
{
|
||||
popad
|
||||
pop es ds
|
||||
}
|
||||
|
||||
; simply return control to interrupted process
|
||||
unknown_interrupt:
|
||||
iret
|
||||
|
||||
macro exc_wo_code [num]
|
||||
{
|
||||
forward
|
||||
e#num :
|
||||
save_ring3_context
|
||||
mov bl, num
|
||||
jmp exc_c
|
||||
}
|
||||
|
||||
macro exc_w_code [num]
|
||||
{
|
||||
forward
|
||||
e#num :
|
||||
add esp, 4
|
||||
save_ring3_context
|
||||
mov bl, num
|
||||
jmp exc_c
|
||||
}
|
||||
|
||||
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 18
|
||||
exc_w_code 8, 10, 11, 12, 13, 14, 17
|
||||
|
||||
exc_c:
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
; test if debugging
|
||||
cli
|
||||
mov eax, [CURRENT_TASK]
|
||||
shl eax, 8
|
||||
mov eax, [SLOT_BASE+eax+APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jnz .debug
|
||||
sti
|
||||
; not debuggee => say error and terminate
|
||||
add esp, 28h
|
||||
movzx eax, bl
|
||||
mov [error_interrupt], eax
|
||||
call show_error_parameters
|
||||
|
||||
mov edx, [TASK_BASE]
|
||||
mov [edx + TASKDATA.state], byte 4
|
||||
|
||||
jmp change_task
|
||||
|
||||
.debug:
|
||||
; we are debugged process, notify debugger and suspend ourself
|
||||
; eax=debugger PID
|
||||
cld
|
||||
movzx ecx, bl
|
||||
push ecx
|
||||
mov ecx, [TASK_BASE]
|
||||
push dword [ecx+TASKDATA.pid] ; PID of current process
|
||||
push 12
|
||||
pop ecx
|
||||
push 1 ; 1=exception
|
||||
call debugger_notify
|
||||
pop ecx
|
||||
pop ecx
|
||||
pop ecx
|
||||
mov edx, [TASK_BASE]
|
||||
mov byte [edx+TASKDATA.state], 1 ; suspended
|
||||
call change_task
|
||||
restore_ring3_context
|
||||
iretd
|
||||
|
||||
writehex:
|
||||
pusha
|
||||
|
||||
mov edi, [write_error_to]
|
||||
mov esi, 8
|
||||
@@:
|
||||
mov ecx, eax
|
||||
and ecx, 0xf
|
||||
|
||||
mov cl,[ecx+hexletters]
|
||||
mov [edi],cl
|
||||
dec edi
|
||||
|
||||
shr eax,4
|
||||
dec esi
|
||||
jnz @b
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
iglobal
|
||||
hexletters db '0123456789ABCDEF'
|
||||
|
||||
error_interrupt dd -1
|
||||
|
||||
process_error db 'K : Process - forced terminate INT: 00000000',13,10,0
|
||||
process_pid db 'K : Process - forced terminate PID: 00000000',13,10,0
|
||||
process_eip db 'K : Process - forced terminate EIP: 00000000',13,10,0
|
||||
system_error db 'K : Kernel error',13,10,0
|
||||
endg
|
||||
|
||||
uglobal
|
||||
write_error_to dd 0x0
|
||||
endg
|
||||
|
||||
show_error_parameters:
|
||||
|
||||
mov [write_error_to],process_pid+43
|
||||
mov eax,[CURRENT_TASK]
|
||||
shl eax, 5
|
||||
mov eax,[CURRENT_TASK+TASKDATA.pid+eax]
|
||||
call writehex
|
||||
|
||||
mov [write_error_to],process_error+43
|
||||
mov eax,[error_interrupt]
|
||||
call writehex
|
||||
|
||||
cmp dword [esp+4+4], os_code ; CS
|
||||
jnz @f
|
||||
mov esi,system_error
|
||||
call sys_msg_board_str
|
||||
@@:
|
||||
mov eax, [esp+4] ; EIP
|
||||
|
||||
mov [write_error_to],process_eip+43
|
||||
call writehex
|
||||
|
||||
mov esi,process_error
|
||||
call sys_msg_board_str
|
||||
|
||||
mov esi,process_pid
|
||||
call sys_msg_board_str
|
||||
|
||||
mov esi,process_eip
|
||||
call sys_msg_board_str
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; irq1 -> hid/keyboard.inc
|
||||
|
||||
|
||||
macro irqh [num]
|
||||
{
|
||||
forward
|
||||
p_irq#num :
|
||||
save_ring3_context
|
||||
mov edi, num
|
||||
jmp irq_c
|
||||
}
|
||||
|
||||
irqh 2,5,7,8,9,10,11
|
||||
|
||||
irq_c:
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call irqhandler
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
p_irq6:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call fdc_irq
|
||||
call ready_for_next_irq
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
p_irq3:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
cmp [com2_mouse_detected],0
|
||||
je old_irq3_handler
|
||||
call check_mouse_data_com2
|
||||
jmp p_irq3_1
|
||||
old_irq3_handler:
|
||||
mov edi,3
|
||||
call irqhandler
|
||||
p_irq3_1:
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
p_irq4:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
cmp [com1_mouse_detected],0
|
||||
je old_irq4_handler
|
||||
call check_mouse_data_com1
|
||||
jmp p_irq4_1
|
||||
old_irq4_handler:
|
||||
mov edi,4
|
||||
call irqhandler
|
||||
p_irq4_1:
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
p_irq12:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call check_mouse_data_ps2
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
p_irq14:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call [irq14_func]
|
||||
call ready_for_next_irq_1
|
||||
restore_ring3_context
|
||||
iret
|
||||
p_irq15:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call [irq15_func]
|
||||
call ready_for_next_irq_1
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
ready_for_next_irq:
|
||||
mov [check_idle_semaphore],5
|
||||
mov al, 0x20
|
||||
out 0x20, al
|
||||
ret
|
||||
|
||||
ready_for_next_irq_1:
|
||||
mov [check_idle_semaphore],5
|
||||
mov al, 0x20
|
||||
out 0xa0,al
|
||||
out 0x20, al
|
||||
ret
|
||||
|
||||
irqD:
|
||||
save_ring3_context
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov dx,0xf0
|
||||
mov al,0
|
||||
out dx,al
|
||||
|
||||
mov dx,0xa0
|
||||
mov al,0x20
|
||||
out dx,al
|
||||
mov dx,0x20
|
||||
out dx,al
|
||||
|
||||
restore_ring3_context
|
||||
|
||||
iret
|
||||
|
||||
|
||||
irqhandler:
|
||||
|
||||
push edi
|
||||
|
||||
mov esi,edi ; 1
|
||||
shl esi,6 ; 1
|
||||
add esi,irq00read ; 1
|
||||
shl edi,12 ; 1
|
||||
add edi,IRQ_SAVE
|
||||
mov ecx,16
|
||||
|
||||
mov [check_idle_semaphore],5
|
||||
|
||||
irqnewread:
|
||||
dec ecx
|
||||
js irqover
|
||||
|
||||
mov dx,[esi] ; 2+
|
||||
|
||||
cmp dx,0 ; 1
|
||||
jz irqover
|
||||
cmp [esi+3],byte 1 ; 2 ; byte read
|
||||
jne noirqbyte ; 4-11
|
||||
|
||||
in al,dx
|
||||
|
||||
mov edx,[edi]
|
||||
cmp edx,4000
|
||||
je irqfull
|
||||
mov ebx,edi
|
||||
add ebx,0x10
|
||||
add ebx,edx
|
||||
mov [ebx],al
|
||||
inc edx
|
||||
mov [edi],edx
|
||||
|
||||
add esi,4
|
||||
jmp irqnewread
|
||||
|
||||
noirqbyte:
|
||||
|
||||
|
||||
cmp [esi+3],byte 2 ; word read
|
||||
jne noirqword
|
||||
|
||||
in ax,dx
|
||||
|
||||
mov edx,[edi]
|
||||
cmp edx,4000
|
||||
je irqfull
|
||||
mov ebx,edi
|
||||
add ebx,0x10
|
||||
add ebx,edx
|
||||
mov [ebx],ax
|
||||
add edx,2
|
||||
mov [edi],edx
|
||||
add esi,4
|
||||
jmp irqnewread
|
||||
|
||||
noirqword:
|
||||
irqfull:
|
||||
irqover:
|
||||
|
||||
mov al,0x20 ; ready for next irq
|
||||
out 0x20,al
|
||||
|
||||
pop ebx
|
||||
cmp ebx,7
|
||||
jbe noa0
|
||||
out 0xa0,al
|
||||
noa0:
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
set_application_table_status:
|
||||
push eax
|
||||
|
||||
mov eax,[CURRENT_TASK]
|
||||
shl eax, 5
|
||||
add eax,CURRENT_TASK+TASKDATA.pid
|
||||
mov eax,[eax]
|
||||
|
||||
mov [application_table_status],eax
|
||||
|
||||
pop eax
|
||||
|
||||
ret
|
||||
|
||||
|
||||
clear_application_table_status:
|
||||
push eax
|
||||
|
||||
mov eax,[CURRENT_TASK]
|
||||
shl eax, 5
|
||||
add eax,CURRENT_TASK+TASKDATA.pid
|
||||
mov eax,[eax]
|
||||
|
||||
cmp eax,[application_table_status]
|
||||
jne apptsl1
|
||||
mov [application_table_status],0
|
||||
apptsl1:
|
||||
|
||||
pop eax
|
||||
|
||||
ret
|
||||
|
||||
sys_resize_app_memory:
|
||||
; eax = 1 - resize
|
||||
; ebx = new amount of memory
|
||||
|
||||
cmp eax,1
|
||||
jne .no_application_mem_resize
|
||||
|
||||
stdcall new_mem_resize, ebx
|
||||
mov [esp+36], eax
|
||||
ret
|
||||
|
||||
.no_application_mem_resize:
|
||||
ret
|
||||
|
||||
sys_threads:
|
||||
|
||||
; eax=1 create thread
|
||||
;
|
||||
; ebx=thread start
|
||||
; ecx=thread stack value
|
||||
;
|
||||
; on return : eax = pid
|
||||
jmp new_sys_threads
|
||||
|
||||
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
|
||||
endg
|
||||
|
||||
; param
|
||||
; esi= slot
|
||||
|
||||
terminate: ; terminate application
|
||||
|
||||
.slot equ esp ;locals
|
||||
|
||||
push esi ;save .slot
|
||||
|
||||
shl esi, 8
|
||||
cmp [SLOT_BASE+esi+APPDATA.dir_table], 0
|
||||
jne @F
|
||||
add esp, 4
|
||||
ret
|
||||
@@:
|
||||
mov esi,process_terminating
|
||||
call sys_msg_board_str
|
||||
@@:
|
||||
cli
|
||||
cmp [application_table_status],0
|
||||
je term9
|
||||
sti
|
||||
call change_task
|
||||
jmp @b
|
||||
term9:
|
||||
call set_application_table_status
|
||||
|
||||
mov esi, [.slot]
|
||||
shl esi,8
|
||||
add esi, SLOT_BASE+APP_OBJ_OFFSET
|
||||
@@:
|
||||
mov eax, [esi+APPOBJ.fd]
|
||||
test eax, eax
|
||||
jz @F
|
||||
|
||||
cmp eax, esi
|
||||
je @F
|
||||
|
||||
push esi
|
||||
call [eax+APPOBJ.destroy]
|
||||
mov esi, msg_obj_destroy
|
||||
call sys_msg_board_str
|
||||
pop esi
|
||||
jmp @B
|
||||
@@:
|
||||
mov eax, [.slot]
|
||||
shl eax, 8
|
||||
mov eax,[SLOT_BASE+eax+APPDATA.dir_table]
|
||||
stdcall destroy_app_space, eax
|
||||
|
||||
mov esi, [.slot]
|
||||
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
|
||||
jne @F
|
||||
|
||||
mov [fpu_owner],1
|
||||
mov eax, [256+SLOT_BASE+APPDATA.fpu_state]
|
||||
clts
|
||||
bt [cpu_caps], CAPS_SSE
|
||||
jnc .no_SSE
|
||||
fxrstor [eax]
|
||||
jmp @F
|
||||
.no_SSE:
|
||||
fnclex
|
||||
frstor [eax]
|
||||
@@:
|
||||
|
||||
mov [KEY_COUNT],byte 0 ; empty keyboard buffer
|
||||
mov [BTN_COUNT],byte 0 ; empty button buffer
|
||||
|
||||
|
||||
; remove defined hotkeys
|
||||
mov eax, hotkey_list
|
||||
.loop:
|
||||
cmp [eax+8], esi
|
||||
jnz .cont
|
||||
mov ecx, [eax]
|
||||
jecxz @f
|
||||
push dword [eax+12]
|
||||
pop dword [ecx+12]
|
||||
@@:
|
||||
mov ecx, [eax+12]
|
||||
push dword [eax]
|
||||
pop dword [ecx]
|
||||
xor ecx, ecx
|
||||
mov [eax], ecx
|
||||
mov [eax+4], ecx
|
||||
mov [eax+8], ecx
|
||||
mov [eax+12], ecx
|
||||
.cont:
|
||||
add eax, 16
|
||||
cmp eax, hotkey_list+256*16
|
||||
jb .loop
|
||||
; remove hotkeys in buffer
|
||||
mov eax, hotkey_buffer
|
||||
.loop2:
|
||||
cmp [eax], esi
|
||||
jnz .cont2
|
||||
and dword [eax+4], 0
|
||||
and dword [eax], 0
|
||||
.cont2:
|
||||
add eax, 8
|
||||
cmp eax, hotkey_buffer+120*8
|
||||
jb .loop2
|
||||
|
||||
mov ecx,esi ; remove buttons
|
||||
bnewba2:
|
||||
mov edi,[BTN_ADDR]
|
||||
mov eax,edi
|
||||
cld
|
||||
movzx ebx,word [edi]
|
||||
inc bx
|
||||
bnewba:
|
||||
dec bx
|
||||
jz bnmba
|
||||
add eax,0x10
|
||||
cmp cx,[eax]
|
||||
jnz bnewba
|
||||
pusha
|
||||
mov ecx,ebx
|
||||
inc ecx
|
||||
shl ecx,4
|
||||
mov ebx,eax
|
||||
add eax,0x10
|
||||
call memmove
|
||||
dec dword [edi]
|
||||
popa
|
||||
jmp bnewba2
|
||||
bnmba:
|
||||
|
||||
pusha ; save window coordinates for window restoring
|
||||
cld
|
||||
shl esi,5
|
||||
add esi,window_data
|
||||
mov eax,[esi+WDATA.box.left]
|
||||
mov [dlx],eax
|
||||
add eax,[esi+WDATA.box.width]
|
||||
mov [dlxe],eax
|
||||
mov eax,[esi+WDATA.box.top]
|
||||
mov [dly],eax
|
||||
add eax,[esi+WDATA.box.height]
|
||||
mov [dlye],eax
|
||||
|
||||
xor eax, eax
|
||||
mov [esi+WDATA.box.left],eax
|
||||
mov [esi+WDATA.box.width],eax
|
||||
mov [esi+WDATA.box.top],eax
|
||||
mov [esi+WDATA.box.height],eax
|
||||
mov [esi+WDATA.cl_workarea],eax
|
||||
mov [esi+WDATA.cl_titlebar],eax
|
||||
mov [esi+WDATA.cl_frames],eax
|
||||
mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn
|
||||
lea edi, [esi-window_data+draw_data]
|
||||
mov ecx,32/4
|
||||
rep stosd
|
||||
popa
|
||||
|
||||
; debuggee test
|
||||
pushad
|
||||
mov edi, esi
|
||||
shl edi, 5
|
||||
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jz .nodebug
|
||||
push 8
|
||||
pop ecx
|
||||
push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID
|
||||
push 2
|
||||
call debugger_notify
|
||||
pop ecx
|
||||
pop ecx
|
||||
.nodebug:
|
||||
popad
|
||||
|
||||
mov ebx, [.slot]
|
||||
shl ebx, 8
|
||||
mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack]
|
||||
|
||||
stdcall kernel_free, ebx
|
||||
|
||||
mov edi, [.slot]
|
||||
shl edi,8
|
||||
add edi,SLOT_BASE
|
||||
mov eax, 0x20202020
|
||||
stosd
|
||||
stosd
|
||||
stosd
|
||||
mov ecx,244/4
|
||||
xor eax, eax
|
||||
rep stosd
|
||||
|
||||
; activate window
|
||||
movzx eax, word [WIN_STACK + esi*2]
|
||||
cmp eax, [TASK_COUNT]
|
||||
jne .dont_activate
|
||||
pushad
|
||||
.check_next_window:
|
||||
dec eax
|
||||
cmp eax, 1
|
||||
jbe .nothing_to_activate
|
||||
lea esi, [WIN_POS+eax*2]
|
||||
movzx edi, word [esi] ; edi = process
|
||||
shl edi, 5
|
||||
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
|
||||
.dont_activate:
|
||||
|
||||
push esi ; remove hd1 & cd & flp reservation
|
||||
shl esi, 5
|
||||
mov esi, [esi+CURRENT_TASK+TASKDATA.pid]
|
||||
cmp [hd1_status], esi
|
||||
jnz @f
|
||||
call free_hd_channel
|
||||
mov [hd1_status], 0
|
||||
@@:
|
||||
cmp [cd_status], esi
|
||||
jnz @f
|
||||
call free_cd_channel
|
||||
mov [cd_status], 0
|
||||
@@:
|
||||
cmp [flp_status], esi
|
||||
jnz @f
|
||||
mov [flp_status], 0
|
||||
@@:
|
||||
pop esi
|
||||
|
||||
pusha ; remove all irq reservations
|
||||
mov eax,esi
|
||||
shl eax, 5
|
||||
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
|
||||
mov edi,irq_owner
|
||||
mov ecx,16
|
||||
newirqfree:
|
||||
scasd
|
||||
jne nofreeirq
|
||||
mov [edi-4],dword 0
|
||||
nofreeirq:
|
||||
loop newirqfree
|
||||
popa
|
||||
|
||||
pusha ; remove all port reservations
|
||||
mov edx,esi
|
||||
shl edx, 5
|
||||
add edx,CURRENT_TASK
|
||||
mov edx,[edx+TASKDATA.pid]
|
||||
|
||||
rmpr0:
|
||||
|
||||
mov esi,[RESERVED_PORTS]
|
||||
|
||||
cmp esi,0
|
||||
je rmpr9
|
||||
|
||||
rmpr3:
|
||||
|
||||
mov edi,esi
|
||||
shl edi,4
|
||||
add edi,RESERVED_PORTS
|
||||
|
||||
cmp edx,[edi]
|
||||
je rmpr4
|
||||
|
||||
dec esi
|
||||
jnz rmpr3
|
||||
|
||||
jmp rmpr9
|
||||
|
||||
rmpr4:
|
||||
|
||||
mov ecx,256
|
||||
sub ecx,esi
|
||||
shl ecx,4
|
||||
|
||||
mov esi,edi
|
||||
add esi,16
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
dec dword [RESERVED_PORTS]
|
||||
|
||||
jmp rmpr0
|
||||
|
||||
rmpr9:
|
||||
|
||||
popa
|
||||
mov edi,esi ; do not run this process slot
|
||||
shl edi, 5
|
||||
mov [edi+CURRENT_TASK + TASKDATA.state],byte 9
|
||||
; debugger test - terminate all debuggees
|
||||
mov eax, 2
|
||||
mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot
|
||||
.xd0:
|
||||
cmp eax, [TASK_COUNT]
|
||||
ja .xd1
|
||||
cmp dword [ecx], esi
|
||||
jnz @f
|
||||
and dword [ecx], 0
|
||||
pushad
|
||||
xchg eax, ebx
|
||||
mov eax, 2
|
||||
call sys_system
|
||||
popad
|
||||
@@:
|
||||
inc eax
|
||||
add ecx, 0x100
|
||||
jmp .xd0
|
||||
.xd1:
|
||||
; call systest
|
||||
sti ; .. and life goes on
|
||||
|
||||
mov eax, [dlx]
|
||||
mov ebx, [dly]
|
||||
mov ecx, [dlxe]
|
||||
mov edx, [dlye]
|
||||
call calculatescreen
|
||||
xor eax, eax
|
||||
xor esi, esi
|
||||
call redrawscreen
|
||||
|
||||
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
|
||||
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
|
||||
|
||||
mov [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
|
||||
endg
|
||||
|
||||
|
||||
build_scheduler:
|
||||
|
||||
; mov esi,boot_sched_1
|
||||
; call boot_log
|
||||
call build_process_gdt_tss_pointer
|
||||
|
||||
; mov esi,boot_sched_2
|
||||
; call boot_log
|
||||
call build_interrupt_table
|
||||
|
||||
ret
|
||||
|
@ -1,238 +0,0 @@
|
||||
$Revision: 434 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSTEM CALL ENTRY ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 32
|
||||
i40:
|
||||
; diamond, 27.03.2007: handler does not require disabled interrupts
|
||||
; so interrupts remain enabled when calling int 0x40
|
||||
push ds es
|
||||
pushad
|
||||
cld
|
||||
|
||||
mov ax,word os_data
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
|
||||
; load all registers in crossed order
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
mov edi, [esp+28]
|
||||
|
||||
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
|
||||
; sti
|
||||
push eax
|
||||
and edi,0xff
|
||||
call dword [servetable+edi*4]
|
||||
pop eax
|
||||
; cli
|
||||
|
||||
popad
|
||||
pop es ds
|
||||
iretd
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSENTER ENTRY ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;uglobal
|
||||
;times 100 db ?
|
||||
;sysenter_stack:
|
||||
;endg
|
||||
|
||||
align 32
|
||||
SYSENTER_VAR equ 0
|
||||
sysenter_entry:
|
||||
; Íàñòðàèâàåì ñòåê
|
||||
; cli sysenter clear IF
|
||||
; push eax
|
||||
; mov eax, [ss:CURRENT_TASK]
|
||||
; shl eax, 8
|
||||
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
|
||||
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP
|
||||
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
|
||||
mov esp, [ss:CURRENT_RING0_ESP]
|
||||
|
||||
sti
|
||||
;------------------
|
||||
push ds es
|
||||
pushad
|
||||
cld
|
||||
|
||||
mov ax, word os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
mov edi, [esp + 28]
|
||||
|
||||
push eax
|
||||
and edi, 0xff
|
||||
call dword [servetable + edi * 4]
|
||||
pop eax
|
||||
|
||||
popad
|
||||
pop es ds
|
||||
;------------------
|
||||
mov edx, [SYSENTER_VAR] ; eip
|
||||
mov ecx, [SYSENTER_VAR + 4] ; esp
|
||||
sysexit
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSCALL ENTRY ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
align 32
|
||||
syscall_entry:
|
||||
|
||||
; cli syscall clear IF
|
||||
xchg esp, [ss:CURRENT_RING0_ESP]
|
||||
push ecx
|
||||
lea ecx, [esp+4]
|
||||
xchg ecx, [ss:CURRENT_RING0_ESP]
|
||||
sti
|
||||
push ecx
|
||||
mov ecx, [ecx]
|
||||
|
||||
; mov [ss:sysenter_stack - 4], eax
|
||||
; mov eax, [ss:CURRENT_TASK]
|
||||
; shl eax, 8
|
||||
; mov eax, [ss:SLOT_BASE + eax + APPDATA.pl0_stack]
|
||||
; lea esp, [eax + RING0_STACK_SIZE] ; configure ESP
|
||||
; mov eax, [ss:sysenter_stack - 4] ; eax - original eax, from app
|
||||
|
||||
;------------------
|
||||
push ds es
|
||||
pushad
|
||||
cld
|
||||
|
||||
mov ax, word os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
mov edi, [esp + 28]
|
||||
|
||||
push eax
|
||||
and edi, 0xff
|
||||
call dword [servetable + edi * 4]
|
||||
pop eax
|
||||
|
||||
popad
|
||||
pop es ds
|
||||
;------------------
|
||||
|
||||
mov ecx, [ss:esp+4]
|
||||
pop esp
|
||||
sysret
|
||||
|
||||
iglobal
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; SYSTEM FUNCTIONS TABLE ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 4
|
||||
servetable:
|
||||
|
||||
dd sys_drawwindow ; 0-DrawWindow
|
||||
dd syscall_setpixel ; 1-SetPixel
|
||||
dd sys_getkey ; 2-GetKey
|
||||
dd sys_clock ; 3-GetTime
|
||||
dd syscall_writetext ; 4-WriteText
|
||||
dd delay_hs ; 5-DelayHs
|
||||
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
||||
dd syscall_putimage ; 7-PutImage
|
||||
dd sys_button ; 8-DefineButton
|
||||
dd sys_cpuusage ; 9-GetProcessInfo
|
||||
dd sys_waitforevent ; 10-WaitForEvent
|
||||
dd sys_getevent ; 11-CheckForEvent
|
||||
dd sys_redrawstat ; 12-BeginDraw and EndDraw
|
||||
dd syscall_drawrect ; 13-DrawRect
|
||||
dd syscall_getscreensize ; 14-GetScreenSize
|
||||
dd sys_background ; 15-bgr
|
||||
dd sys_cachetodiskette ; 16-FlushFloppyCache
|
||||
dd sys_getbutton ; 17-GetButton
|
||||
dd sys_system ; 18-System Services
|
||||
dd paleholder;undefined_syscall ; 19-reserved
|
||||
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 sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
||||
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd sys_sb16 ; 25-SetSb16
|
||||
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd undefined_syscall ; 27-reserved
|
||||
dd sys_sb16II ; 28-SetSb16
|
||||
dd sys_date ; 29-GetDate
|
||||
dd undefined_syscall ; 30-reserved
|
||||
dd undefined_syscall ; 31-reserved
|
||||
dd syscall_delramdiskfile ; 32-DelRamdiskFile
|
||||
dd syscall_writeramdiskfile; 33-WriteRamdiskFile
|
||||
dd undefined_syscall ; 34-reserved
|
||||
dd syscall_getpixel ; 35-GetPixel
|
||||
dd syscall_readstring ; 36-ReadString (not yet ready)
|
||||
dd readmousepos ; 37-GetMousePosition_ScreenRelative,.
|
||||
dd syscall_drawline ; 38-DrawLine
|
||||
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
|
||||
dd set_app_param ; 40-WantEvents
|
||||
dd syscall_getirqowner ; 41-GetIrqOwner
|
||||
dd get_irq_data ; 42-ReadIrqData
|
||||
dd sys_outport ; 43-SendDeviceData
|
||||
dd sys_programirq ; 44-ProgramIrqs
|
||||
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
||||
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
|
||||
dd display_number ; 47-WriteNum
|
||||
dd display_settings ; 48-SetRedrawType and SetButtonType
|
||||
dd sys_apm ; 49-Advanced Power Management (APM)
|
||||
dd random_shaped_window ; 50-Window shape & scale
|
||||
dd syscall_threads ; 51-Threads
|
||||
dd stack_driver_stat ; 52-Stack driver status
|
||||
dd socket ; 53-Socket interface
|
||||
dd user_events ; 54-User events
|
||||
dd sound_interface ; 55-Sound interface
|
||||
dd undefined_syscall ; 56-reserved
|
||||
dd undefined_syscall ; 57-reserved
|
||||
dd file_system ; 58-Common file system interface
|
||||
dd undefined_syscall ; 59-reserved
|
||||
dd sys_IPC ; 60-Inter Process Communication
|
||||
dd sys_gs ; 61-Direct graphics access
|
||||
dd sys_pci ; 62-PCI functions
|
||||
dd sys_msg_board ; 63-System message board
|
||||
dd sys_resize_app_memory ; 64-Resize application memory usage
|
||||
dd syscall_putimage_palette; 65-PutImagePalette
|
||||
dd sys_process_def ; 66-Process definitions - keyboard
|
||||
dd sys_window_move ; 67-Window move or resize
|
||||
dd new_services ; 68-Some internal services
|
||||
dd sys_debug_services ; 69-Debug
|
||||
dd file_system_lfn ; 70-Common file system interface, version 2
|
||||
dd syscall_windowsettings ; 71-Window settings
|
||||
|
||||
times 255 - ( ($-servetable) /4 ) dd undefined_syscall
|
||||
|
||||
dd sys_end ; -1-end application
|
||||
endg
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;
|
||||
; Call of videomode driver's functions
|
||||
;
|
||||
; (Add in System function 21 (and/or 26) as a subfunction 13)
|
||||
;
|
||||
; Author: Trans
|
||||
; Date: 19.07.2003
|
||||
;
|
||||
; Include in MeOS kernel and compile with FASM
|
||||
;
|
||||
|
||||
uglobal
|
||||
old_screen_width dd ?
|
||||
old_screen_height dd ?
|
||||
endg
|
||||
|
||||
cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS
|
||||
jne .no_vmode_drv_access
|
||||
pushd [ScreenWidth] [ScreenHeight]
|
||||
popd [old_screen_height] [old_screen_width]
|
||||
or eax,-1 ; If driver is absent then eax does not change
|
||||
call 0x760100 ; Entry point of video driver
|
||||
mov [esp+36],eax
|
||||
mov [esp+24],ebx
|
||||
mov [esp+32],ecx
|
||||
; mov [esp+28],edx
|
||||
mov eax,[old_screen_width]
|
||||
mov ebx,[old_screen_height]
|
||||
sub eax,[ScreenWidth]
|
||||
jnz @f
|
||||
sub ebx,[ScreenHeight]
|
||||
jz .resolution_wasnt_changed
|
||||
jmp .lp1
|
||||
@@: sub ebx,[ScreenHeight]
|
||||
.lp1: sub [screen_workarea.right],eax
|
||||
sub [screen_workarea.bottom],ebx
|
||||
|
||||
call repos_windows
|
||||
mov eax, 0
|
||||
mov ebx, 0
|
||||
mov ecx, [ScreenWidth]
|
||||
mov edx, [ScreenHeight]
|
||||
call calculatescreen
|
||||
|
||||
.resolution_wasnt_changed:
|
||||
ret
|
||||
.no_vmode_drv_access:
|
@ -1,347 +0,0 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
@ -1,518 +0,0 @@
|
||||
--------p-155300-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - INSTALLATION CHECK
|
||||
AX = 5300h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
AH = major version (BCD)
|
||||
AL = minor version (BCD)
|
||||
BX = 504Dh ("PM")
|
||||
CX = flags (see #00472)
|
||||
CF set on error
|
||||
AH = error code (06h,09h,86h) (see #00473)
|
||||
BUG: early versions of the Award Modular BIOS with built-in APM support
|
||||
reportedly do not set BX on return
|
||||
|
||||
Bitfields for APM flags:
|
||||
Bit(s) Description (Table 00472)
|
||||
0 16-bit protected mode interface supported
|
||||
1 32-bit protected mode interface supported
|
||||
2 CPU idle call reduces processor speed
|
||||
3 BIOS power management disabled
|
||||
4 BIOS power management disengaged (APM v1.1)
|
||||
5-7 reserved
|
||||
|
||||
(Table 00473)
|
||||
Values for APM error code:
|
||||
01h power management functionality disabled
|
||||
02h interface connection already in effect
|
||||
03h interface not connected
|
||||
04h real-mode interface not connected
|
||||
05h 16-bit protected-mode interface already connected
|
||||
06h 16-bit protected-mode interface not supported
|
||||
07h 32-bit protected-mode interface already connected
|
||||
08h 32-bit protected-mode interface not supported
|
||||
09h unrecognized device ID
|
||||
0Ah invalid parameter value in CX
|
||||
0Bh (APM v1.1) interface not engaged
|
||||
0Ch (APM v1.2) function not supported
|
||||
0Dh (APM v1.2) Resume Timer disabled
|
||||
0Eh-1Fh reserved for other interface and general errors
|
||||
20h-3Fh reserved for CPU errors
|
||||
40h-5Fh reserved for device errors
|
||||
60h can't enter requested state
|
||||
61h-7Fh reserved for other system errors
|
||||
80h no power management events pending
|
||||
81h-85h reserved for other power management event errors
|
||||
86h APM not present
|
||||
87h-9Fh reserved for other power management event errors
|
||||
A0h-FEh reserved
|
||||
FFh undefined
|
||||
--------p-155301-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CONNECT REAL-MODE INTERFACE
|
||||
AX = 5301h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (02h,05h,07h,09h) (see #00473)
|
||||
Note: on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
|
||||
compatibility mode until it is informed that the user supports a
|
||||
newer version of APM (see AX=530Eh)
|
||||
SeeAlso: AX=5302h,AX=5303h,AX=5304h
|
||||
--------p-155302-----------------------------
|
||||
INT 15 R - Advanced Power Management v1.0+ - CONNECT 16-BIT PROTMODE INTERFACE
|
||||
AX = 5302h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
AX = real-mode segment base address of protected-mode 16-bit code
|
||||
segment
|
||||
BX = offset of entry point
|
||||
CX = real-mode segment base address of protected-mode 16-bit data
|
||||
segment
|
||||
---APM v1.1---
|
||||
SI = APM BIOS code segment length
|
||||
DI = APM BIOS data segment length
|
||||
CF set on error
|
||||
AH = error code (02h,05h,06h,07h,09h) (see #00473)
|
||||
Notes: the caller must initialize two consecutive descriptors with the
|
||||
returned segment base addresses; these descriptors must be valid
|
||||
whenever the protected-mode interface is called, and will have
|
||||
their limits arbitrarily set to 64K.
|
||||
the protected mode interface is invoked by making a far call with the
|
||||
same register values as for INT 15; it must be invoked while CPL=0,
|
||||
the code segment descriptor must have a DPL of 0, the stack must be
|
||||
in a 16-bit segment and have enough room for BIOS use and possible
|
||||
interrupts, and the current I/O permission bit map must allow access
|
||||
to the I/O ports used for power management.
|
||||
functions 00h-03h are not available from protected mode
|
||||
on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
|
||||
compatibility mode until it is informed that the user supports a
|
||||
newer version of APM (see AX=530Eh)
|
||||
SeeAlso: AX=5301h,AX=5303h,AX=5304h
|
||||
--------p-155303-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CONNECT 32-BIT PROTMODE INTERFACE
|
||||
AX = 5303h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
AX = real-mode segment base address of protected-mode 32-bit code
|
||||
segment
|
||||
EBX = offset of entry point
|
||||
CX = real-mode segment base address of protected-mode 16-bit code
|
||||
segment
|
||||
DX = real-mode segment base address of protected-mode 16-bit data
|
||||
segment
|
||||
---APM v1.1---
|
||||
SI = APM BIOS code segment length
|
||||
DI = APM BIOS data segment length
|
||||
CF set on error
|
||||
AH = error code (02h,05h,07h,08h,09h) (see #00473)
|
||||
Notes: the caller must initialize three consecutive descriptors with the
|
||||
returned segment base addresses for 32-bit code, 16-bit code, and
|
||||
16-bit data, respectively; these descriptors must be valid whenever
|
||||
the protected-mode interface is called, and will have their limits
|
||||
arbitrarily set to 64K.
|
||||
the protected mode interface is invoked by making a far call to the
|
||||
32-bit code segment with the same register values as for INT 15; it
|
||||
must be invoked while CPL=0, the code segment descriptor must have a
|
||||
DPL of 0, the stack must be in a 32-bit segment and have enough room
|
||||
for BIOS use and possible interrupts, and the current I/O permission
|
||||
bit map must allow access to the I/O ports used for power management.
|
||||
functions 00h-03h are not available from protected mode
|
||||
on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
|
||||
compatibility mode until it is informed that the user supports a
|
||||
newer version of APM (see AX=530Eh)
|
||||
SeeAlso: AX=5301h,AX=5302h,AX=5304h
|
||||
--------p-155304-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - DISCONNECT INTERFACE
|
||||
AX = 5304h
|
||||
BX = device ID of system BIOS (0000h)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (03h,09h) (see #00473)
|
||||
SeeAlso: AX=5301h,AX=5302h,AX=5303h
|
||||
--------p-155305-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CPU IDLE
|
||||
AX = 5305h
|
||||
Return: CF clear if successful (after system leaves idle state)
|
||||
CF set on error
|
||||
AH = error code (03h,0Bh) (see #00473)
|
||||
Notes: call when the system is idle and should be suspended until the next
|
||||
system event or interrupt
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
if an interrupt causes the system to resume normal processing, the
|
||||
interrupt may or may not have been handled when the BIOS returns
|
||||
from this call; thus, the caller should allow interrupts on return
|
||||
interrupt handlers may not retain control if the BIOS allows
|
||||
interrupts while in idle mode even if they are able to determine
|
||||
that they were called from idle mode
|
||||
the caller should issue this call continuously in a loop until it needs
|
||||
to perform some processing of its own
|
||||
SeeAlso: AX=1000h,AX=5306h,INT 2F/AX=1680h
|
||||
--------p-155306-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - CPU BUSY
|
||||
AX = 5306h
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (03h,0Bh) (see #00473)
|
||||
Notes: called to ensure that the system runs at full speed even on systems
|
||||
where the BIOS is unable to recognize increased activity (especially
|
||||
if interrupts are hooked by other programs and not chained to the
|
||||
BIOS)
|
||||
this call may be made even when the system is already running at full
|
||||
speed, but it will create unnecessary overhead
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=5305h
|
||||
--------p-155307-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - SET POWER STATE
|
||||
AX = 5307h
|
||||
BX = device ID (see #00474)
|
||||
CX = system state ID (see #00475)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,03h,09h,0Ah,0Bh,60h) (see #00473)
|
||||
Note: should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=530Ch
|
||||
|
||||
(Table 00474)
|
||||
Values for APM device IDs:
|
||||
0000h system BIOS
|
||||
0001h all devices for which the system BIOS manages power
|
||||
01xxh display (01FFh for all attached display devices)
|
||||
02xxh secondary storage (02FFh for all attached secondary storage devices)
|
||||
03xxh parallel ports (03FFh for all attached parallel ports)
|
||||
04xxh serial ports (04FFh for all attached serial ports)
|
||||
---APM v1.1+ ---
|
||||
05xxh network adapters (05FFh for all attached network adapters)
|
||||
06xxh PCMCIA sockets (06FFh for all)
|
||||
0700h-7FFFh reserved
|
||||
80xxh system battery devices (APM v1.2)
|
||||
8100h-DFFFh reserved
|
||||
Exxxh OEM-defined power device IDs
|
||||
F000h-FFFFh reserved
|
||||
|
||||
(Table 00475)
|
||||
Values for system state ID:
|
||||
0000h ready (not supported for device ID 0001h)
|
||||
0001h stand-by
|
||||
0002h suspend
|
||||
0003h off (not supported for device ID 0001h in APM v1.0)
|
||||
---APM v1.1---
|
||||
0004h last request processing notification (only for device ID 0001h)
|
||||
0005h last request rejected (only for device ID 0001h)
|
||||
0006h-001Fh reserved system states
|
||||
0020h-003Fh OEM-defined system states
|
||||
0040h-007Fh OEM-defined device states
|
||||
0080h-FFFFh reserved device states
|
||||
--------p-155307CX0001-----------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - SYSTEM STAND-BY
|
||||
AX = 5307h
|
||||
CX = 0001h
|
||||
BX = 0001h (device ID for all power-managed devices)
|
||||
Return: CF clear
|
||||
Notes: puts the entire system into stand-by mode; normally called in response
|
||||
to a System Stand-by Request notification after any necessary
|
||||
processing, but may also be invoked at the caller's discretion
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
the stand-by state is typically exited on an interrupt
|
||||
SeeAlso: AX=4280h,AX=5307h/CX=0002h"SUSPEND",AX=5307h/CX=0003h,AX=530Bh
|
||||
--------p-155307CX0002-----------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - SUSPEND SYSTEM
|
||||
AX = 5307h
|
||||
CX = 0002h
|
||||
BX = 0001h (device ID for all power-managed devices)
|
||||
Return: after system is resumed
|
||||
CF clear
|
||||
Notes: puts the entire system into a low-power suspended state; normally
|
||||
called in response to a Suspend System Request notification after
|
||||
any necessary processing, but may also be invoked at the caller's
|
||||
discretion
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
the caller may need to update its date and time values because the
|
||||
system could have been suspended for a long period of time
|
||||
SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
|
||||
--------p-155307CX0003-----------------------
|
||||
INT 15 - Advanced Power Management v1.2 - TURN OFF SYSTEM
|
||||
AX = 5307h
|
||||
CX = 0003h
|
||||
BX = 0001h (device ID for all power-managed devices)
|
||||
Return: after system is resumed
|
||||
CF clear
|
||||
Notes: if supported by the system's power supply, turns off the system power
|
||||
SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
|
||||
--------p-155308-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - ENABLE/DISABLE POWER MANAGEMENT
|
||||
AX = 5308h
|
||||
BX = device ID for all devices power-managed by APM
|
||||
0001h (APM v1.1+)
|
||||
FFFFh (APM v1.0)
|
||||
CX = new state
|
||||
0000h disabled
|
||||
0001h enabled
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,03h,09h,0Ah,0Bh) (see #00473)
|
||||
Notes: when power management is disabled, the system BIOS will not
|
||||
automatically power down devices, enter stand-by or suspended mode,
|
||||
or perform any power-saving actions in response to AX=5305h calls
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
the APM BIOS should never be both disabled and disengaged at the same
|
||||
time
|
||||
SeeAlso: AX=5309h,AX=530Dh,AX=530Fh
|
||||
--------p-155309-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - RESTORE POWER-ON DEFAULTS
|
||||
AX = 5309h
|
||||
BX = device ID for all devices power-managed by APM
|
||||
0001h (APM v1.1)
|
||||
FFFFh (APM v1.0)
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Bh) (see #00473)
|
||||
Note: should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=5308h
|
||||
--------p-15530A-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - GET POWER STATUS
|
||||
AX = 530Ah
|
||||
BX = device ID
|
||||
0001h all devices power-managed by APM
|
||||
80xxh specific battery unit number XXh (01h-FFh) (APM v1.2)
|
||||
Return: CF clear if successful
|
||||
BH = AC line status
|
||||
00h off-line
|
||||
01h on-line
|
||||
02h on backup power (APM v1.1)
|
||||
FFh unknown
|
||||
other reserved
|
||||
BL = battery status (see #00476)
|
||||
CH = battery flag (APM v1.1+) (see #00477)
|
||||
CL = remaining battery life, percentage
|
||||
00h-64h (0-100) percentage of full charge
|
||||
FFh unknown
|
||||
DX = remaining battery life, time (APM v1.1) (see #00478)
|
||||
---if specific battery unit specified---
|
||||
SI = number of battery units currently installed
|
||||
CF set on error
|
||||
AH = error code (09h,0Ah) (see #00473)
|
||||
Notes: should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
supported in real mode (INT 15) and both 16-bit and 32-bit protected
|
||||
mode
|
||||
|
||||
(Table 00476)
|
||||
Values for APM v1.0+ battery status:
|
||||
00h high
|
||||
01h low
|
||||
02h critical
|
||||
03h charging
|
||||
FFh unknown
|
||||
other reserved
|
||||
SeeAlso: #00477,#00478
|
||||
|
||||
Bitfields for APM v1.1+ battery flag:
|
||||
Bit(s) Description (Table 00477)
|
||||
0 high
|
||||
1 low
|
||||
2 critical
|
||||
3 charging
|
||||
4 selected battery not present (APM v1.2)
|
||||
5-6 reserved (0)
|
||||
7 no system battery
|
||||
Note: all bits set (FFh) if unknown
|
||||
SeeAlso: #00476,#00478
|
||||
|
||||
Bitfields for APM v1.1+ remaining battery life:
|
||||
Bit(s) Description (Table 00478)
|
||||
15 time units: 0=seconds, 1=minutes
|
||||
14-0 battery life in minutes or seconds
|
||||
Note: all bits set (FFFFh) if unknown
|
||||
SeeAlso: #00476,#00477
|
||||
--------p-15530B-----------------------------
|
||||
INT 15 - Advanced Power Management v1.0+ - GET POWER MANAGEMENT EVENT
|
||||
AX = 530Bh
|
||||
Return: CF clear if successful
|
||||
BX = event code (see #00479)
|
||||
CX = event information (APM v1.2) if BX=0003h or BX=0004h
|
||||
bit 0: PCMCIA socket was powered down in suspend state
|
||||
CF set on error
|
||||
AH = error code (03h,0Bh,80h) (see #00473)
|
||||
Notes: although power management events are often asynchronous, notification
|
||||
will not be made until polled via this call to permit software to
|
||||
only receive event notification when it is prepared to process
|
||||
power management events; since these events are not very time-
|
||||
critical, it should be sufficient to poll once or twice per second
|
||||
the critical resume notification is made after the system resumes
|
||||
from an emergency suspension; normally, the system BIOS only notifies
|
||||
its partner that it wishes to suspend and relies on the partner to
|
||||
actually request the suspension, but no notification is made on an
|
||||
emergency suspension
|
||||
should not be called from within a hardware interrupt handler to avoid
|
||||
reentrance problems
|
||||
SeeAlso: AX=5307h,AX=5307h/CX=0001h"STAND-BY",AX=5307h/CX=0002h"SUSPEND"
|
||||
|
||||
(Table 00479)
|
||||
Values for APM event code:
|
||||
0001h system stand-by request
|
||||
0002h system suspend request
|
||||
0003h normal resume system notification
|
||||
0004h critical resume system notification
|
||||
0005h battery low notification
|
||||
---APM v1.1---
|
||||
0006h power status change notification
|
||||
0007h update time notification
|
||||
0008h critical system suspend notification
|
||||
0009h user system standby request notification
|
||||
000Ah user system suspend request notification
|
||||
000Bh system standby resume notification
|
||||
---APM v1.2---
|
||||
000Ch capabilities change notification (see AX=5310h)
|
||||
------
|
||||
000Dh-00FFh reserved system events
|
||||
01xxh reserved device events
|
||||
02xxh OEM-defined APM events
|
||||
0300h-FFFFh reserved
|
||||
--------p-15530C-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - GET POWER STATE
|
||||
AX = 530Ch
|
||||
BX = device ID (see #00474)
|
||||
Return: CF clear if successful
|
||||
CX = system state ID (see #00475)
|
||||
CF set on error
|
||||
AH = error code (01h,09h) (see #00473)
|
||||
SeeAlso: AX=5307h
|
||||
--------p-15530D-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - EN/DISABLE DEVICE POWER MANAGEMENT
|
||||
AX = 530Dh
|
||||
BX = device ID (see #00474)
|
||||
CX = function
|
||||
0000h disable power management
|
||||
0001h enable power management
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,03h,09h,0Ah,0Bh) (see #00473)
|
||||
Desc: specify whether automatic power management should be active for a
|
||||
given device
|
||||
SeeAlso: AX=5308h,AX=530Fh
|
||||
--------p-15530E-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - DRIVER VERSION
|
||||
AX = 530Eh
|
||||
BX = device ID of system BIOS (0000h)
|
||||
CH = APM driver major version (BCD)
|
||||
CL = APM driver minor version (BCD) (02h for APM v1.2)
|
||||
Return: CF clear if successful
|
||||
AH = APM connection major version (BCD)
|
||||
AL = APM connection minor version (BCD)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Bh) (see #00473)
|
||||
SeeAlso: AX=5300h,AX=5303h
|
||||
--------p-15530F-----------------------------
|
||||
INT 15 - Advanced Power Management v1.1+ - ENGAGE/DISENGAGE POWER MANAGEMENT
|
||||
AX = 530Fh
|
||||
BX = device ID (see #00474)
|
||||
CX = function
|
||||
0000h disengage power management
|
||||
0001h engage power management
|
||||
Return: CF clear if successful
|
||||
CF set on error
|
||||
AH = error code (01h,09h) (see #00473)
|
||||
Notes: unlike AX=5308h, this call does not affect the functioning of the APM
|
||||
BIOS
|
||||
when cooperative power management is disengaged, the APM BIOS performs
|
||||
automatic power management of the system or device
|
||||
SeeAlso: AX=5308h,AX=530Dh
|
||||
--------p-155310-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - GET CAPABILITIES
|
||||
AX = 5310h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
Return: CF clear if successful
|
||||
BL = number of battery units supported (00h if no system batteries)
|
||||
CX = capabilities flags (see #00480)
|
||||
CF set on error
|
||||
AH = error code (01h,09h,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces; it does not require that a
|
||||
connection be established prior to use
|
||||
this function will return the capabilities currently in effect, not
|
||||
any new settings which have been made but do not take effect until
|
||||
a system restart
|
||||
SeeAlso: AX=5300h,AX=530Fh,AX=5311h,AX=5312h,AX=5313h
|
||||
|
||||
Bitfields for APM v1.2 capabilities flags:
|
||||
Bit(s) Description (Table 00480)
|
||||
15-8 reserved
|
||||
7 PCMCIA Ring Indicator will wake up system from suspend mode
|
||||
6 PCMCIA Ring Indicator will wake up system from standby mode
|
||||
5 Resume on Ring Indicator will wake up system from suspend mode
|
||||
4 Resume on Ring Indicator will wake up system from standby mode
|
||||
3 resume timer will wake up system from suspend mode
|
||||
2 resume timer will wake up system from standby mode
|
||||
1 can enter global suspend state
|
||||
0 can enter global standby state
|
||||
--------p-155311-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - GET/SET/DISABLE RESUME TIMER
|
||||
AX = 5311h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
CL = function
|
||||
00h disable Resume Timer
|
||||
01h get Resume Timer
|
||||
02h set Resume Timer
|
||||
CH = resume time, seconds (BCD)
|
||||
DL = resume time, minutes (BCD)
|
||||
DH = resume time, hours (BCD)
|
||||
SI = resume date (BCD), high byte = month, low byte = day
|
||||
DI = resume date, year (BCD)
|
||||
Return: CF clear if successful
|
||||
---if getting timer---
|
||||
CH = resume time, seconds (BCD)
|
||||
DL = resume time, minutes (BCD)
|
||||
DH = resume time, hours (BCD)
|
||||
SI = resume date (BCD), high byte = month, low byte = day
|
||||
DI = resume date, year (BCD)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Ah,0Bh,0Ch,0Dh,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces
|
||||
SeeAlso: AX=5300h,AX=5310h,AX=5312h,AX=5313h
|
||||
--------p-155312-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE RESUME ON RING
|
||||
AX = 5312h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
CL = function
|
||||
00h disable Resume on Ring Indicator
|
||||
01h enable Resume on Ring Indicator
|
||||
02h get Resume on Ring Indicator status
|
||||
Return: CF clear if successful
|
||||
CX = resume status (0000h disabled, 0001h enabled)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Ah,0Bh,0Ch,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces
|
||||
SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5313h
|
||||
--------p-155313-----------------------------
|
||||
INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE TIMER-BASED REQUESTS
|
||||
AX = 5313h
|
||||
BX = device ID (see #00474)
|
||||
0000h (APM BIOS)
|
||||
other reserved
|
||||
CL = function
|
||||
00h disable timer-based requests
|
||||
01h enable timer-based requests
|
||||
02h get timer-based requests status
|
||||
Return: CF clear if successful
|
||||
CX = timer-based requests status (0000h disabled, 0001h enabled)
|
||||
CF set on error
|
||||
AH = error code (03h,09h,0Ah,0Bh,86h) (see #00473)
|
||||
Notes: this function is supported via the INT 15, 16-bit protected mode, and
|
||||
32-bit protected mode interfaces
|
||||
some BIOSes set AH on return even when successful
|
||||
SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5312h
|
@ -1,225 +0,0 @@
|
||||
$Revision: 425 $
|
||||
;
|
||||
; MEMORY MAP
|
||||
;
|
||||
; Boot:
|
||||
;
|
||||
; 0:9000 byte bits per pixel
|
||||
; 0:9001 word scanline length
|
||||
; 0:9008 word vesa video mode
|
||||
; 0:900A word X res
|
||||
; 0:900C word Y res
|
||||
; 0:9010 byte mouse port - not used
|
||||
; 0:9014 dword Vesa 1.2 pm bank switch
|
||||
; 0:9018 dword Vesa 2.0 LFB address
|
||||
; 0:901C byte 0 or 1 : enable MTRR graphics acceleration
|
||||
; 0:901D byte not used anymore (0 or 1 : enable system log display)
|
||||
; 0:901E byte 0 or 1 : enable direct lfb write, paging disabled
|
||||
; 0:901F byte DMA write : 1=yes, 2=no
|
||||
; 0:9020 8bytes pci data
|
||||
; 0:9030 byte VRR start enabled 1, 2-no
|
||||
; 0:9031 word IDEContrRegsBaseAddr
|
||||
; 0x9040 - dword - entry point of APM BIOS
|
||||
; 0x9044 - word - version (BCD)
|
||||
; 0x9046 - word - flags
|
||||
;
|
||||
; Runtime:
|
||||
;
|
||||
; 0000 -> 1FFF window_data - 256 entries
|
||||
;
|
||||
; 0000 dword x start
|
||||
; 0004 dword y start
|
||||
; 0008 dword x size
|
||||
; 000C dword y size
|
||||
; 0010 dword color of work area
|
||||
; 0014 dword color of grab bar
|
||||
; 0018 dword color of frames
|
||||
; 001C dword window flags, +30 = window drawn, +31 redraw flag
|
||||
;
|
||||
; 2000 -> 2FFF free
|
||||
;
|
||||
; 3000 -> 4FFF task list - 256 entries
|
||||
;
|
||||
; 00 dword process count
|
||||
; 04 dword no of processes
|
||||
; 10 dword base of running process at 0x3000+
|
||||
;
|
||||
; 20 dword application event mask
|
||||
; 24 dword PID - process identification number
|
||||
; 2a byte slot state: 0=running, 1,2=suspended
|
||||
; 3=zombie, 4=terminate,
|
||||
; 5=waiting for event, 9 = not used
|
||||
; 2e byte window number on screen
|
||||
; 30 dword exact position in memory
|
||||
; 34 dword counter sum
|
||||
; 38 dword time stamp counter add
|
||||
; 3c dword cpu usage in cpu timer tics
|
||||
;
|
||||
;
|
||||
; 5000 -> 68FF free
|
||||
; 6900 -> 6EFF saved picture under mouse pointer
|
||||
;
|
||||
; 6F00 -> 6FFF free
|
||||
;
|
||||
; 7000 -> 7FFF used CD driver
|
||||
;
|
||||
; 8000 -> A3FF used FLOPPY driver
|
||||
;
|
||||
; A400 -> B0FF free
|
||||
|
||||
; B100 -> B2FF IDT
|
||||
|
||||
; B300 -> BFFF free
|
||||
|
||||
; C000 -> C3FF window stack C000 no of windows - all in words
|
||||
; C402 -> C7FF window position in stack
|
||||
; D000 -> D1FF FDC controller
|
||||
; D200 -> D3FF FDC controller for Fat12
|
||||
; D400 -> DFFF free
|
||||
; E000 byte multitasking started
|
||||
; E020 dword putpixel address
|
||||
; E024 dword getpixel address
|
||||
; E030 dword Vesa 1.2 pm bank switch address
|
||||
; F200 dword mousepicture -pointer
|
||||
; F204 dword mouse appearance counter
|
||||
; F300 dword x & y temp for windowmove
|
||||
; F400 byte no of keys in buffer
|
||||
; F401 byte 'buffer'
|
||||
; F402 -> F4FF reserved for keys
|
||||
; F500 byte no of buttons in buffer
|
||||
; F501 dword 'buffer'
|
||||
; F502 -> F5FF reserved for buttons
|
||||
; F600 dword tsc / second
|
||||
; F604 byte mouse port: 1 ps2, 2 com1, 3 com2
|
||||
; FB00 -> FB0F mouse memory 00 chunk count - FB0A-B x - FB0C-D y
|
||||
; FB10 -> FB17 mouse color mem
|
||||
; FB21 x move
|
||||
; FB22 y move
|
||||
; FB28 high bits temp
|
||||
; FB30 color temp
|
||||
; FB40 byte buttons down
|
||||
; FB44 byte 0 mouse down -> do not draw
|
||||
; FB4A -> FB4D FB4A-B x-under - FB4C-D y-under
|
||||
; FBF1 byte bits per pixel
|
||||
; FC00 -> FCFE com1/ps2 buffer
|
||||
; FCFF com1/ps2 buffer count starting from FC00
|
||||
; FE00 dword screen x size
|
||||
; FE04 dword screen y size
|
||||
; FE08 dword screen y multiplier
|
||||
; FE0C dword screen mode
|
||||
; FE80 dword address of LFB in physical
|
||||
; FE84 dword address of applications memory start in physical
|
||||
; FE88 dword address of button list
|
||||
; FE8C dword memory to use
|
||||
; FF00 byte 1 = system shutdown request
|
||||
; FF01 dword free
|
||||
; FFF0 byte 1 = redraw background request from app
|
||||
; FFF1 byte 1 = diskette int occur
|
||||
; FFF2 write and read bank in screen
|
||||
; FFF4 byte 0 if first mouse draw & do not return picture under
|
||||
; FFF5 byte 1 do not draw pointer
|
||||
; FFFF byte do not change task for 1/100 sec.
|
||||
;
|
||||
; 10000 -> 3DBFF kernel, 32-bit run-time code (up to 183 Kb)
|
||||
; 3DC00 -> 3EBFF stack at boot time (4Kb)
|
||||
; 3EC00 -> 3F5FF basic text font II
|
||||
; 3F600 -> 3FFFF basic text font I
|
||||
; 40000 -> 4FFFF data of retrieved disks and partitions (Mario79)
|
||||
|
||||
; 50000 -> 50FFF main page directory
|
||||
; 50200 -> 5FFFF pages bitmap
|
||||
|
||||
; 60000 -> 7FFFF free (128 Kb)
|
||||
; 80000 -> 8FFFF additional app info, in 256 byte steps - 256 entries
|
||||
;
|
||||
; 00 11db name of app running
|
||||
; 10 108db floating point unit save area
|
||||
; 7f byte 0= no fpu saved , 1= fpu saved to 0x10 -> restore
|
||||
; 80 dword address of random shaped window area
|
||||
; 84 byte shape area scale
|
||||
; 88 dword free
|
||||
; 8C dword application memory size
|
||||
; 90 dword window X position save
|
||||
; 94 dword window Y position save
|
||||
; 98 dword window X size save
|
||||
; 9C dword window Y size save
|
||||
; A0 dword IPC memory start
|
||||
; A4 dword IPC memory size
|
||||
; A8 dword event bits: mouse, stack,..
|
||||
; AC dword 0 or debugger slot
|
||||
; B0 dword free
|
||||
; B4 byte keyboard mode: 0 = keymap, 1 = scancodes
|
||||
; B8 dword physical address of directory table
|
||||
; BC dword address of debug event memory
|
||||
; C0 5 dd thread debug registers: DR0,DR1,DR2,DR3,DR7
|
||||
;
|
||||
; 90000 -> 9FFFF tmp
|
||||
; A0000 -> AFFFF screen access area
|
||||
; B0000 -> FFFFF bios rest in peace -area
|
||||
; 100000 -> 27FFFF diskette image
|
||||
; 280000 -> 281FFF ramdisk fat
|
||||
; 282000 -> 283FFF floppy fat
|
||||
;
|
||||
; 284000 -> 29FFFF free (112 Kb)
|
||||
;
|
||||
; 2A0000 -> 2B00ff wav device data
|
||||
; 2C0000 -> 2C3fff button info
|
||||
;
|
||||
; 0000 word number of buttons
|
||||
; first button entry at 0x10
|
||||
; +0000 word process number
|
||||
; +0002 word button id number : bits 00-15
|
||||
; +0004 word x start
|
||||
; +0006 word x size
|
||||
; +0008 word y start
|
||||
; +000A word y size
|
||||
; +000C word button id number : bits 16-31
|
||||
;
|
||||
; 2C4000 -> 2CFFFF free (48Kb)
|
||||
;
|
||||
; 2D0000 -> 2DFFFF reserved port area
|
||||
;
|
||||
; 0000 dword no of port areas reserved
|
||||
; 0010 dword process id
|
||||
; dword start port
|
||||
; dword end port
|
||||
; dword 0
|
||||
;
|
||||
; 2E0000 -> 2EFFFF irq data area
|
||||
; 2F0000 -> 2FFFFF low memory save
|
||||
;
|
||||
; 300000 -> 45FFFF background image, max 1,375 M
|
||||
;
|
||||
; 460000 -> 5FFFFF display info
|
||||
;
|
||||
; 600000 -> 6FFFFF hd cache
|
||||
;
|
||||
; 700000 -> 71ffff tcp memory (128 kb)
|
||||
; 720000 -> 75ffff free (256 kb)
|
||||
;
|
||||
; 760000 -> 76ffff !vrr driver
|
||||
; 770000 -> 777fff tcp memory ( 32 kb)
|
||||
;
|
||||
; 780000 -> 987FFF TSS and IO map for (8192*8)=65536 ports
|
||||
; (128+8192)*256 = 2129920 = 0x208000
|
||||
;
|
||||
; 988000 -> 98AFFF draw_data - 256 entries
|
||||
;
|
||||
; 00 dword draw limit - x start
|
||||
; 04 dword draw limit - y start
|
||||
; 08 dword draw limit - x end
|
||||
; 0C dword draw limit - y end
|
||||
;
|
||||
;
|
||||
; 0x0098B000 -> kernel heap
|
||||
;
|
||||
; 0x01FFFFFF heap min limit
|
||||
; 0x7DBFFFFF heap max limit
|
||||
; 0x7DC00000 -> 0x7FBFFFFF LFB 32Mb
|
||||
; 0x7DC00000 -> 0x7E3FFFFF application available LFB 8Mb
|
||||
; 0x7E400000 -> 0x7FBFFFFF kernel LFB part 24 Mb
|
||||
; 0x7FC00000 -> 0x7FFFFFFF page tables 4Mb
|
||||
; 0x80000000 -> 0xFFFFFFFF application 2Gb
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.
|
||||
;; PROGRAMMING:
|
||||
;; Ivan Poddubny
|
||||
;; Marat Zakiyanov (Mario79)
|
||||
;; VaStaNi
|
||||
;; Trans
|
||||
;; Mihail Semenyako (mike.dld)
|
||||
;; Sergey Kuzmin (Wildwest)
|
||||
;; Andrey Halyavin (halyavin)
|
||||
;; Mihail Lisovin (Mihasik)
|
||||
;; Andrey Ignatiev (andrew_programmer)
|
||||
;; NoName
|
||||
;; Evgeny Grechnikov (Diamond)
|
||||
;; Iliya Mihailov (Ghost)
|
||||
;; Sergey Semyonov (Serge)
|
||||
;; Johnny_B
|
||||
;;
|
||||
;; Data in this file was originally part of MenuetOS project which is
|
||||
;; distributed under the terms of GNU GPL. It is modified and redistributed as
|
||||
;; part of KolibriOS project under the terms of GNU GPL.
|
||||
;;
|
||||
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa
|
||||
;; PROGRAMMING:
|
||||
;;
|
||||
;; Ville Mikael Turjanmaa, villemt@itu.jyu.fi
|
||||
;; - main os coding/design
|
||||
;; Jan-Michael Brummer, BUZZ2@gmx.de
|
||||
;; Felix Kaiser, info@felix-kaiser.de
|
||||
;; Paolo Minazzi, paolo.minazzi@inwind.it
|
||||
;; quickcode@mail.ru
|
||||
;; Alexey, kgaz@crosswinds.net
|
||||
;; Juan M. Caravaca, bitrider@wanadoo.es
|
||||
;; kristol@nic.fi
|
||||
;; Mike Hibbett, mikeh@oceanfree.net
|
||||
;; Lasse Kuusijarvi, kuusijar@lut.fi
|
||||
;; Jarek Pelczar, jarekp3@wp.pl
|
||||
;;
|
||||
;; KolibriOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
;; WARRANTY. No author or distributor accepts responsibility to anyone for the
|
||||
;; consequences of using it or for whether it serves any particular purpose or
|
||||
;; works at all, unless he says so in writing. Refer to the GNU General Public
|
||||
;; License (the "GPL") for full details.
|
||||
;
|
||||
;; Everyone is granted permission to copy, modify and redistribute KolibriOS,
|
||||
;; but only under the conditions described in the GPL. A copy of this license
|
||||
;; is supposed to have been given to you along with KolibriOS so you can know
|
||||
;; your rights and responsibilities. It should be in a file named COPYING.
|
||||
;; Among other things, the copyright notice and this notice must be preserved
|
||||
;; on all copies.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,226 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 4
|
||||
proc detect_codec
|
||||
locals
|
||||
codec_id dd ?
|
||||
endl
|
||||
|
||||
stdcall codec_read, dword 0x7C
|
||||
shl eax, 16
|
||||
mov [codec_id], eax
|
||||
|
||||
stdcall codec_read, dword 0x7E
|
||||
or eax, [codec_id]
|
||||
|
||||
mov [codec.chip_id], eax
|
||||
and eax, 0xFFFFFF00
|
||||
|
||||
mov edi, codecs
|
||||
@@:
|
||||
mov ebx, [edi]
|
||||
test ebx, ebx
|
||||
jz .unknown
|
||||
|
||||
cmp eax, ebx
|
||||
jne .next
|
||||
mov eax, [edi+4]
|
||||
mov [codec.ac_vendor_ids], eax
|
||||
stdcall detect_chip, [edi+8]
|
||||
ret
|
||||
.next:
|
||||
add edi, 12
|
||||
jmp @B
|
||||
.unknown:
|
||||
mov [codec.ac_vendor_ids], ac_unknown
|
||||
mov [codec.chip_ids], chip_unknown
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc detect_chip stdcall, chip_tab:dword
|
||||
|
||||
mov eax, [codec.chip_id]
|
||||
and eax, 0xFF
|
||||
|
||||
mov edi, [chip_tab]
|
||||
@@:
|
||||
mov ebx, [edi]
|
||||
test ebx, ebx
|
||||
jz .unknown
|
||||
|
||||
cmp eax,ebx
|
||||
jne .next
|
||||
mov eax, [edi+4]
|
||||
mov [codec.chip_ids], eax
|
||||
ret
|
||||
.next:
|
||||
add edi, 8
|
||||
jmp @b
|
||||
.unknown:
|
||||
mov [codec.chip_ids], chip_unknown
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc setup_codec
|
||||
|
||||
xor eax, eax
|
||||
stdcall codec_write, dword CODEC_AUX_VOL
|
||||
|
||||
mov eax, 0x0B0B
|
||||
stdcall codec_write, dword CODEC_MASTER_VOL_REG
|
||||
|
||||
mov ax, 0x08
|
||||
stdcall codec_write, dword 0x0C
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword CODEC_PCM_OUT_REG
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword 0x10
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword 0x12
|
||||
|
||||
mov ax, 0x0808
|
||||
stdcall codec_write, dword 0x16
|
||||
|
||||
|
||||
stdcall codec_read, dword CODEC_EXT_AUDIO_CTRL_REG
|
||||
|
||||
and eax, 0FFFFh - BIT1 ; clear DRA (BIT1)
|
||||
or eax, BIT0 ; set VRA (BIT0)
|
||||
stdcall codec_write, dword CODEC_EXT_AUDIO_CTRL_REG
|
||||
|
||||
stdcall set_sample_rate, dword 48000
|
||||
|
||||
.init_error:
|
||||
|
||||
xor eax, eax ; exit with error
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
; param
|
||||
; eax= volume -10000 - 0 for both channels
|
||||
|
||||
align 4
|
||||
set_master_vol:
|
||||
cmp eax, 0
|
||||
jl @F
|
||||
xor eax, eax
|
||||
jmp .set
|
||||
@@:
|
||||
cmp eax, -9450
|
||||
jg .set
|
||||
mov eax, -9450 ;clamp into 6 bits
|
||||
.set:
|
||||
cdq
|
||||
mov ebx, -150
|
||||
idiv ebx
|
||||
mov ah, al
|
||||
stdcall codec_write, dword CODEC_MASTER_VOL_REG
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
proc get_master_vol stdcall, pvol:dword
|
||||
|
||||
stdcall codec_read, dword CODEC_MASTER_VOL_REG
|
||||
and eax, 0x3F
|
||||
imul eax, -150
|
||||
mov ebx, [pvol]
|
||||
mov [ebx], eax
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc set_sample_rate stdcall, rate:dword
|
||||
mov eax, [rate]
|
||||
stdcall codec_write, dword CODEC_PCM_FRONT_DACRATE_REG
|
||||
ret
|
||||
endp
|
||||
|
||||
align 16
|
||||
ac_unknown db 'unknown manufacturer',13,10,0
|
||||
ac_Realtek db 'Realtek Semiconductor',13,10,0
|
||||
ac_Analog db 'Analog Devices',13,10,0
|
||||
ac_CMedia db 'C-Media Electronics',13,10,0
|
||||
chip_unknown db 'unknown chip', 13,10,0
|
||||
|
||||
CHIP_ANALOG equ 0x41445300
|
||||
CHIP_REALTEK equ 0x414C4700
|
||||
CHIP_CMEDIA equ 0x434D4900
|
||||
|
||||
align 16
|
||||
codecs dd CHIP_ANALOG, ac_Analog, chips_Analog
|
||||
dd CHIP_CMEDIA, ac_CMedia, chips_CMedia
|
||||
dd CHIP_REALTEK,ac_Realtek, chips_Realtek
|
||||
dd 0
|
||||
|
||||
align 16
|
||||
chips_Analog dd 0x03, chip_AD1819
|
||||
dd 0x40, chip_AD1881
|
||||
dd 0x48, chip_AD1881A
|
||||
dd 0x60, chip_AD1884
|
||||
dd 0x61, chip_AD1886
|
||||
dd 0x62, chip_AD1887
|
||||
dd 0x63, chip_AD1886A
|
||||
dd 0x70, chip_AD1980
|
||||
dd 0x75, chip_AD1985
|
||||
dd 0
|
||||
|
||||
chips_Realtek dd 0x20, chip_ALC650
|
||||
dd 0x21, chip_ALC650D
|
||||
dd 0x22, chip_ALC650E
|
||||
dd 0x23, chip_ALC650F
|
||||
dd 0x60, chip_ALC655
|
||||
dd 0x80, chip_ALC658
|
||||
dd 0x81, chip_ALC658D
|
||||
dd 0x90, chip_ALC850
|
||||
dd 0
|
||||
|
||||
chips_CMedia dd 0x41, chip_CM9738
|
||||
dd 0x61, chip_CM9739
|
||||
dd 0x69, chip_CM9780
|
||||
dd 0x78, chip_CM9761
|
||||
dd 0x82, chip_CM9761
|
||||
dd 0x83, chip_CM9761
|
||||
dd 0
|
||||
|
||||
align 16
|
||||
;Analog Devices
|
||||
chip_AD1819 db 'AD1819 ',0dh,0ah,00h
|
||||
chip_AD1881 db 'AD1881 ',0dh,0ah,00h
|
||||
chip_AD1881A db 'AD1881A',0dh,0ah,00h
|
||||
chip_AD1884 db 'AD1885 ',0dh,0ah,00h
|
||||
chip_AD1885 db 'AD1885 ',0dh,0ah,00h
|
||||
chip_AD1886 db 'AD1886 ',0dh,0ah,00h
|
||||
chip_AD1886A db 'AD1886A',0dh,0ah,00h
|
||||
chip_AD1887 db 'AD1887 ',0dh,0ah,00h
|
||||
chip_AD1980 db 'AD1980 ',0dh,0ah,00h
|
||||
chip_AD1985 db 'AD1985 ',0dh,0ah,00h
|
||||
|
||||
;Realtek
|
||||
chip_ALC650 db 'ALC650 ',0dh,0ah,00h
|
||||
chip_ALC650D db 'ALC650D',0dh,0ah,00h
|
||||
chip_ALC650E db 'ALC650E',0dh,0ah,00h
|
||||
chip_ALC650F db 'ALC650F',0dh,0ah,00h
|
||||
chip_ALC655 db 'ALC655 ',0dh,0ah,00h
|
||||
chip_ALC658 db 'ALC658 ',0dh,0ah,00h
|
||||
chip_ALC658D db 'ALC658D',0dh,0ah,00h
|
||||
chip_ALC850 db 'ALC850 ',0dh,0ah,00h
|
||||
|
||||
;CMedia
|
||||
chip_CM9738 db 'CMI9738', 0dh,0ah,0
|
||||
chip_CM9739 db 'CMI9739', 0dh,0ah,0
|
||||
chip_CM9780 db 'CMI9780', 0dh,0ah,0
|
||||
chip_CM9761 db 'CMI9761', 0dh,0ah,0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,142 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; all exported kernel functions and data
|
||||
|
||||
if used RegService
|
||||
extrn RegService
|
||||
end if
|
||||
if used GetService
|
||||
extrn GetService
|
||||
end if
|
||||
if used ServiceHandler
|
||||
extrn ServiceHandler
|
||||
end if
|
||||
if used AttachIntHandler
|
||||
extrn AttachIntHandler
|
||||
end if
|
||||
if used FpuSave
|
||||
extrn FpuSave
|
||||
end if
|
||||
if used FpuRestore
|
||||
extrn FpuRestore
|
||||
end if
|
||||
|
||||
if used PciApi
|
||||
extrn PciApi
|
||||
end if
|
||||
if used PciRead32
|
||||
extrn PciRead32
|
||||
end if
|
||||
if used PciRead8
|
||||
extrn PciRead8
|
||||
end if
|
||||
if used PciWrite8
|
||||
extrn PciWrite8
|
||||
end if
|
||||
|
||||
if used AllocPage
|
||||
extrn AllocPage
|
||||
end if
|
||||
if used AllocPages
|
||||
extrn AllocPages
|
||||
end if
|
||||
if used FreePage
|
||||
extrn FreePage
|
||||
end if
|
||||
if used MapPage
|
||||
extrn MapPage
|
||||
end if
|
||||
if used MapSpace
|
||||
extrn MapSpace
|
||||
end if
|
||||
if used GetPgAddr
|
||||
extrn GetPgAddr
|
||||
end if
|
||||
if used CommitPages
|
||||
extrn CommitPages
|
||||
end if
|
||||
if used ReleasePages
|
||||
extrn ReleasePages
|
||||
end if
|
||||
|
||||
if used AllocKernelSpace
|
||||
extrn AllocKernelSpace
|
||||
end if
|
||||
if used FreeKernelSpace
|
||||
extrn FreeKernelSpace
|
||||
end if
|
||||
if used KernelAlloc
|
||||
extrn KernelAlloc
|
||||
end if
|
||||
if used KernelFree
|
||||
extrn KernelFree
|
||||
end if
|
||||
if used UserAlloc
|
||||
extrn UserAlloc
|
||||
end if
|
||||
if used UserFree
|
||||
extrn UserFree
|
||||
end if
|
||||
if used Kmalloc
|
||||
extrn Kmalloc
|
||||
end if
|
||||
if used Kfree
|
||||
extrn Kfree
|
||||
end if
|
||||
|
||||
if used CreateObject
|
||||
extrn CreateObject
|
||||
end if
|
||||
if used DestroyObject
|
||||
extrn DestroyObject
|
||||
end if
|
||||
if used CreateEvent
|
||||
extrn CreateEvent
|
||||
end if
|
||||
if used RaiseEvent
|
||||
extrn RaiseEvent
|
||||
end if
|
||||
if used WaitEvent
|
||||
extrn WaitEvent
|
||||
end if
|
||||
if used DestroyEvent
|
||||
extrn DestroyEvent
|
||||
end if
|
||||
if used ClearEvent
|
||||
extrn ClearEvent
|
||||
end if
|
||||
|
||||
if used LoadCursor
|
||||
extrn LoadCursor
|
||||
end if
|
||||
if used SetHwCursor
|
||||
extrn SetHwCursor
|
||||
end if
|
||||
if used HwCursorRestore
|
||||
extrn HwCursorRestore
|
||||
end if
|
||||
if used HwCursorCreate
|
||||
extrn HwCursorCreate
|
||||
end if
|
||||
|
||||
if used SysMsgBoardStr
|
||||
extrn SysMsgBoardStr
|
||||
end if
|
||||
if used GetCurrentTask
|
||||
extrn GetCurrentTask
|
||||
end if
|
||||
if used LoadFile
|
||||
extrn LoadFile
|
||||
end if
|
||||
if used SendEvent
|
||||
extrn SendEvent
|
||||
end if
|
||||
if used LFBAddress
|
||||
extrn LFBAddress
|
||||
end if
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,163 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; (C) copyright Serge 2006-2007
|
||||
; email: infinity_sound@mail.ru
|
||||
|
||||
SOUND_VERSION equ 0x01000100
|
||||
|
||||
PLAY_SYNC equ 0x80000000
|
||||
|
||||
|
||||
PCM_ALL equ 0
|
||||
|
||||
PCM_OUT equ 0x08000000
|
||||
PCM_RING equ 0x10000000
|
||||
PCM_STATIC equ 0x20000000
|
||||
PCM_FLOAT equ 0x40000000 ;reserved
|
||||
PCM_FILTER equ 0x80000000 ;reserved
|
||||
|
||||
PCM_2_16_48 equ 1
|
||||
PCM_1_16_48 equ 2
|
||||
|
||||
PCM_2_16_44 equ 3
|
||||
PCM_1_16_44 equ 4
|
||||
|
||||
PCM_2_16_32 equ 5
|
||||
PCM_1_16_32 equ 6
|
||||
|
||||
PCM_2_16_24 equ 7
|
||||
PCM_1_16_24 equ 8
|
||||
|
||||
PCM_2_16_22 equ 9
|
||||
PCM_1_16_22 equ 10
|
||||
|
||||
PCM_2_16_16 equ 11
|
||||
PCM_1_16_16 equ 12
|
||||
|
||||
PCM_2_16_12 equ 13
|
||||
PCM_1_16_12 equ 14
|
||||
|
||||
PCM_2_16_11 equ 15
|
||||
PCM_1_16_11 equ 16
|
||||
|
||||
PCM_2_16_8 equ 17
|
||||
PCM_1_16_8 equ 18
|
||||
|
||||
PCM_2_8_48 equ 19
|
||||
PCM_1_8_48 equ 20
|
||||
|
||||
PCM_2_8_44 equ 21
|
||||
PCM_1_8_44 equ 22
|
||||
|
||||
PCM_2_8_32 equ 23
|
||||
PCM_1_8_32 equ 24
|
||||
|
||||
PCM_2_8_24 equ 25
|
||||
PCM_1_8_24 equ 26
|
||||
|
||||
PCM_2_8_22 equ 27
|
||||
PCM_1_8_22 equ 28
|
||||
|
||||
PCM_2_8_16 equ 29
|
||||
PCM_1_8_16 equ 30
|
||||
|
||||
PCM_2_8_12 equ 31
|
||||
PCM_1_8_12 equ 32
|
||||
|
||||
PCM_2_8_11 equ 33
|
||||
PCM_1_8_11 equ 34
|
||||
|
||||
PCM_2_8_8 equ 35
|
||||
PCM_1_8_8 equ 36
|
||||
|
||||
SRV_GETVERSION equ 0
|
||||
SND_CREATE_BUFF equ 1
|
||||
SND_DESTROY_BUFF equ 2
|
||||
SND_SETFORMAT equ 3
|
||||
SND_GETFORMAT equ 4
|
||||
SND_RESET equ 5
|
||||
SND_SETPOS equ 6
|
||||
SND_GETPOS equ 7
|
||||
SND_SETBUFF equ 8
|
||||
SND_OUT equ 9
|
||||
SND_PLAY equ 10
|
||||
SND_STOP equ 11
|
||||
SND_SETVOLUME equ 12
|
||||
SND_GETVOLUME equ 13
|
||||
SND_SETPAN equ 14
|
||||
SND_GETPAN equ 15
|
||||
SND_GETBUFFSIZE equ 16
|
||||
|
||||
struc STREAM
|
||||
{
|
||||
.magic dd ? ;'WAVE'
|
||||
.destroy dd ? ;internal destructor
|
||||
.fd dd ? ;next object in list
|
||||
.bk dd ? ;prev object in list
|
||||
.pid dd ? ;owner id
|
||||
|
||||
.size dd ?
|
||||
.str_fd dd ?
|
||||
.str_bk dd ?
|
||||
.device dd ?
|
||||
.format dd ?
|
||||
.flags dd ?
|
||||
|
||||
.out_base dd ?
|
||||
.out_wp dd ?
|
||||
.out_rp dd ?
|
||||
.out_count dd ?
|
||||
.out_top dd ?
|
||||
|
||||
.r_size dd ?
|
||||
.r_dt dd ?
|
||||
.r_silence dd ?
|
||||
.resample dd ?
|
||||
.l_vol dd ?
|
||||
.r_vol dd ?
|
||||
.l_amp dw ?
|
||||
.r_amp dw ?
|
||||
.pan dd ?
|
||||
|
||||
.in_base dd ?
|
||||
.in_size dd ?
|
||||
.in_wp dd ?
|
||||
.in_rp dd ?
|
||||
.in_count dd ?
|
||||
.in_free dd ?
|
||||
.in_top dd ?
|
||||
|
||||
.notify_event dd ?
|
||||
.notify_id dd ?
|
||||
}
|
||||
|
||||
STREAM_SIZE equ 34*4
|
||||
FD_OFFSET equ 24
|
||||
|
||||
virtual at 0
|
||||
STREAM STREAM
|
||||
end virtual
|
||||
|
||||
struc WAVE_HEADER
|
||||
{ .riff_id dd ?
|
||||
.riff_size dd ?
|
||||
.riff_format dd ?
|
||||
|
||||
.fmt_id dd ?
|
||||
.fmt_size dd ?
|
||||
.format_tag dw ?
|
||||
.channels dw ?
|
||||
.freq dd ?
|
||||
.bytes_sec dd ?
|
||||
.block_align dw ?
|
||||
.bits_sample dw ?
|
||||
|
||||
.data_id dd ?
|
||||
.data_size dd ?
|
||||
}
|
||||
|
@ -1,247 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; params
|
||||
; edi= output
|
||||
; eax= input stream 1
|
||||
; ebx= input stream 2
|
||||
|
||||
if used mmx_mix_2
|
||||
|
||||
align 4
|
||||
mmx_mix_2:
|
||||
movq mm0, [eax]
|
||||
movq mm1, [eax+8]
|
||||
movq mm2, [eax+16]
|
||||
movq mm3, [eax+24]
|
||||
movq mm4, [eax+32]
|
||||
movq mm5, [eax+40]
|
||||
movq mm6, [eax+48]
|
||||
movq mm7, [eax+56]
|
||||
|
||||
paddsw mm0, [ebx]
|
||||
movq [edi], mm0
|
||||
paddsw mm1,[ebx+8]
|
||||
movq [edi+8], mm1
|
||||
paddsw mm2, [ebx+16]
|
||||
movq [edi+16], mm2
|
||||
paddsw mm3, [ebx+24]
|
||||
movq [edi+24], mm3
|
||||
paddsw mm4, [ebx+32]
|
||||
movq [edi+32], mm4
|
||||
paddsw mm5, [ebx+40]
|
||||
movq [edi+40], mm5
|
||||
paddsw mm6, [ebx+48]
|
||||
movq [edi+48], mm6
|
||||
paddsw mm7, [ebx+56]
|
||||
movq [edi+56], mm7
|
||||
|
||||
movq mm0, [eax+64]
|
||||
movq mm1, [eax+72]
|
||||
movq mm2, [eax+80]
|
||||
movq mm3, [eax+88]
|
||||
movq mm4, [eax+96]
|
||||
movq mm5, [eax+104]
|
||||
movq mm6, [eax+112]
|
||||
movq mm7, [eax+120]
|
||||
|
||||
paddsw mm0, [ebx+64]
|
||||
movq [edi+64], mm0
|
||||
paddsw mm1, [ebx+72]
|
||||
movq [edi+72], mm1
|
||||
paddsw mm2, [ebx+80]
|
||||
movq [edi+80], mm2
|
||||
paddsw mm3, [ebx+88]
|
||||
movq [edi+88], mm3
|
||||
paddsw mm4, [ebx+96]
|
||||
movq [edi+96], mm4
|
||||
paddsw mm5, [ecx+104]
|
||||
movq [edx+104], mm5
|
||||
paddsw mm6, [ebx+112]
|
||||
movq [edi+112], mm6
|
||||
paddsw mm7, [ebx+120]
|
||||
movq [edi+120], mm7
|
||||
ret
|
||||
|
||||
align 4
|
||||
mmx_mix_3:
|
||||
movq mm0, [eax]
|
||||
movq mm1, [eax+8]
|
||||
movq mm2, [eax+16]
|
||||
movq mm3, [eax+24]
|
||||
movq mm4, [eax+32]
|
||||
movq mm5, [eax+40]
|
||||
movq mm6, [eax+48]
|
||||
movq mm7, [eax+56]
|
||||
|
||||
paddsw mm0, [ebx]
|
||||
paddsw mm1, [ebx+8]
|
||||
paddsw mm2, [ebx+16]
|
||||
paddsw mm3, [ebx+24]
|
||||
paddsw mm4, [ebx+32]
|
||||
paddsw mm5, [ebx+40]
|
||||
paddsw mm6, [ebx+48]
|
||||
paddsw mm7, [ebx+56]
|
||||
paddsw mm0, [ecx]
|
||||
movq [edi], mm0
|
||||
paddsw mm1,[ecx+8]
|
||||
movq [edi+8], mm1
|
||||
paddsw mm2, [ecx+16]
|
||||
movq [edi+16], mm2
|
||||
paddsw mm3, [ecx+24]
|
||||
movq [edi+24], mm3
|
||||
paddsw mm4, [ecx+32]
|
||||
movq [edi+32], mm4
|
||||
paddsw mm5, [ecx+40]
|
||||
movq [edi+40], mm5
|
||||
paddsw mm6, [ecx+48]
|
||||
movq [edi+48], mm6
|
||||
paddsw mm7, [ecx+56]
|
||||
movq [edi+56], mm7
|
||||
|
||||
movq mm0, [eax+64]
|
||||
movq mm1, [eax+72]
|
||||
movq mm2, [eax+80]
|
||||
movq mm3, [eax+88]
|
||||
movq mm4, [eax+96]
|
||||
movq mm5, [eax+104]
|
||||
movq mm6, [eax+112]
|
||||
movq mm7, [eax+120]
|
||||
paddsw mm0, [ebx+64]
|
||||
paddsw mm1, [ebx+72]
|
||||
paddsw mm2, [ebx+80]
|
||||
paddsw mm3, [ebx+88]
|
||||
paddsw mm4, [ebx+96]
|
||||
paddsw mm5, [ebx+104]
|
||||
paddsw mm6, [ebx+112]
|
||||
paddsw mm7, [ebx+120]
|
||||
paddsw mm0, [ecx+64]
|
||||
movq [edi+64], mm0
|
||||
paddsw mm1, [ecx+72]
|
||||
movq [edi+72], mm1
|
||||
paddsw mm2, [ecx+80]
|
||||
movq [edi+80], mm2
|
||||
paddsw mm3, [ecx+88]
|
||||
movq [edi+88], mm3
|
||||
paddsw mm4, [ecx+96]
|
||||
movq [edi+96], mm4
|
||||
paddsw mm5, [ecx+104]
|
||||
movq [edi+104], mm5
|
||||
paddsw mm6, [ecx+112]
|
||||
movq [edi+112], mm6
|
||||
paddsw mm7, [ecx+120]
|
||||
movq [edi+120], mm7
|
||||
ret
|
||||
|
||||
align 4
|
||||
mmx_mix_4:
|
||||
|
||||
movq mm0, [eax]
|
||||
movq mm2, [eax+8]
|
||||
movq mm4, [eax+16]
|
||||
movq mm6, [eax+24]
|
||||
movq mm1, [ebx]
|
||||
movq mm3, [ebx+8]
|
||||
movq mm5, [ebx+16]
|
||||
movq mm7, [ebx+24]
|
||||
paddsw mm0, [ecx]
|
||||
paddsw mm2, [ecx+8]
|
||||
paddsw mm4, [ecx+16]
|
||||
paddsw mm6, [ecx+24]
|
||||
paddsw mm1, [edx]
|
||||
paddsw mm3, [edx+8]
|
||||
paddsw mm5, [edx+16]
|
||||
paddsw mm7, [edx+24]
|
||||
|
||||
paddsw mm0, mm1
|
||||
movq [edi], mm0
|
||||
paddsw mm2, mm3
|
||||
movq [edi+8], mm2
|
||||
paddsw mm4, mm5
|
||||
movq [edi+16], mm4
|
||||
paddsw mm5, mm6
|
||||
movq [edi+24], mm6
|
||||
|
||||
movq mm0, [eax+32]
|
||||
movq mm2, [eax+40]
|
||||
movq mm4, [eax+48]
|
||||
movq mm6, [eax+56]
|
||||
movq mm1, [ebx+32]
|
||||
movq mm3, [ebx+40]
|
||||
movq mm5, [ebx+48]
|
||||
movq mm7, [ebx+56]
|
||||
paddsw mm0, [ecx+32]
|
||||
paddsw mm2, [ecx+40]
|
||||
paddsw mm4, [ecx+48]
|
||||
paddsw mm6, [ecx+56]
|
||||
paddsw mm1, [edx+32]
|
||||
paddsw mm3, [edx+40]
|
||||
paddsw mm5, [edx+48]
|
||||
paddsw mm7, [edx+56]
|
||||
|
||||
paddsw mm0, mm1
|
||||
movq [edi+32], mm0
|
||||
paddsw mm2, mm2
|
||||
movq [edi+40], mm2
|
||||
paddsw mm4, mm5
|
||||
movq [edi+48], mm4
|
||||
paddsw mm6, mm7
|
||||
movq [edi+56], mm6
|
||||
|
||||
movq mm0, [eax+64]
|
||||
movq mm2, [eax+72]
|
||||
movq mm4, [eax+80]
|
||||
movq mm6, [eax+88]
|
||||
movq mm1, [ebx+64]
|
||||
movq mm3, [ebx+72]
|
||||
movq mm5, [ebx+80]
|
||||
movq mm7, [ebx+88]
|
||||
paddsw mm0, [ecx+64]
|
||||
paddsw mm2, [ecx+72]
|
||||
paddsw mm4, [ecx+80]
|
||||
paddsw mm6, [ecx+88]
|
||||
paddsw mm1, [edx+64]
|
||||
paddsw mm3, [edx+72]
|
||||
paddsw mm5, [edx+80]
|
||||
paddsw mm7, [edx+88]
|
||||
|
||||
paddsw mm0, mm1
|
||||
movq [edi+64], mm0
|
||||
paddsw mm2, mm3
|
||||
movq [edi+72], mm2
|
||||
paddsw mm4, mm5
|
||||
movq [edi+80], mm4
|
||||
paddsw mm6, mm5
|
||||
movq [edi+88], mm7
|
||||
|
||||
movq mm0, [eax+96]
|
||||
movq mm2, [eax+104]
|
||||
movq mm4, [eax+112]
|
||||
movq mm6, [eax+120]
|
||||
movq mm1, [ebx+96]
|
||||
movq mm3, [ebx+104]
|
||||
movq mm5, [ebx+112]
|
||||
movq mm7, [ebx+120]
|
||||
paddsw mm0, [ecx+96]
|
||||
paddsw mm2, [ecx+104]
|
||||
paddsw mm4, [ecx+112]
|
||||
paddsw mm6, [ecx+120]
|
||||
paddsw mm1, [edx+96]
|
||||
paddsw mm3, [edx+104]
|
||||
paddsw mm5, [edx+112]
|
||||
paddsw mm7, [edx+120]
|
||||
paddsw mm0, mm1
|
||||
movq [eax+96], mm0
|
||||
paddsw mm2, mm3
|
||||
movq [edi+104], mm2
|
||||
paddsw mm4, mm5
|
||||
movq [edi+112], mm4
|
||||
paddsw mm6, mm7
|
||||
movq [edi+120], mm6
|
||||
ret
|
||||
|
||||
end if
|
@ -1,145 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
if used mmx128_mix_2
|
||||
|
||||
align 4
|
||||
mmx128_mix_2:
|
||||
prefetcht1 [eax+128]
|
||||
prefetcht1 [ebx+128]
|
||||
|
||||
movaps xmm0, [eax]
|
||||
movaps xmm1, [eax+16]
|
||||
movaps xmm2, [eax+32]
|
||||
movaps xmm3, [eax+48]
|
||||
movaps xmm4, [eax+64]
|
||||
movaps xmm5, [eax+80]
|
||||
movaps xmm6, [eax+96]
|
||||
movaps xmm7, [eax+112]
|
||||
|
||||
paddsw xmm0, [ebx]
|
||||
movaps [edi], xmm0
|
||||
paddsw xmm1,[ebx+16]
|
||||
movaps [edi+16], xmm1
|
||||
paddsw xmm2, [ebx+32]
|
||||
movaps [edi+32], xmm2
|
||||
paddsw xmm3, [ebx+48]
|
||||
movaps [edi+48], xmm3
|
||||
paddsw xmm4, [ebx+64]
|
||||
movaps [edi+64], xmm4
|
||||
paddsw xmm5, [ebx+80]
|
||||
movaps [edi+80], xmm5
|
||||
paddsw xmm6, [ebx+96]
|
||||
movaps [edi+96], xmm6
|
||||
paddsw xmm7, [ebx+112]
|
||||
movaps [edi+112], xmm7
|
||||
ret
|
||||
|
||||
align 4
|
||||
mmx128_mix_3:
|
||||
prefetcht1 [eax+128]
|
||||
prefetcht1 [ebx+128]
|
||||
prefetcht1 [ecx+128]
|
||||
|
||||
movaps xmm0, [eax]
|
||||
movaps xmm1, [eax+16]
|
||||
movaps xmm2, [eax+32]
|
||||
movaps xmm3, [eax+48]
|
||||
movaps xmm4, [eax+64]
|
||||
movaps xmm5, [eax+80]
|
||||
movaps xmm6, [eax+96]
|
||||
movaps xmm7, [eax+112]
|
||||
|
||||
paddsw xmm0, [ebx]
|
||||
paddsw xmm1, [ebx+16]
|
||||
paddsw xmm2, [ebx+32]
|
||||
paddsw xmm3, [ebx+48]
|
||||
paddsw xmm4, [ebx+64]
|
||||
paddsw xmm5, [ebx+80]
|
||||
paddsw xmm6, [ebx+96]
|
||||
paddsw xmm7, [ebx+112]
|
||||
|
||||
paddsw xmm0, [ecx]
|
||||
movaps [edi], xmm0
|
||||
paddsw xmm1, [ecx+16]
|
||||
movaps [edi+16], xmm1
|
||||
paddsw xmm2, [ecx+32]
|
||||
movaps [edi+32], xmm2
|
||||
paddsw xmm3, [ecx+48]
|
||||
movaps [edi+48], xmm3
|
||||
paddsw xmm4, [ecx+64]
|
||||
movaps [edi+64], xmm4
|
||||
paddsw xmm5, [ecx+80]
|
||||
movaps [edi+80], xmm5
|
||||
paddsw xmm6, [ecx+96]
|
||||
movaps [edi+96], xmm6
|
||||
paddsw xmm7, [ecx+112]
|
||||
movaps [edi+112], xmm7
|
||||
ret
|
||||
|
||||
align 4
|
||||
mmx128_mix_4:
|
||||
prefetcht1 [eax+128]
|
||||
prefetcht1 [ebx+128]
|
||||
prefetcht1 [ecx+128]
|
||||
prefetcht1 [edx+128]
|
||||
|
||||
movaps xmm0, [eax]
|
||||
movaps xmm2, [eax+16]
|
||||
movaps xmm4, [eax+32]
|
||||
movaps xmm6, [eax+48]
|
||||
movaps xmm1, [ebx]
|
||||
movaps xmm3, [ebx+16]
|
||||
movaps xmm5, [ebx+32]
|
||||
movaps xmm7, [ebx+48]
|
||||
|
||||
paddsw xmm0, [ecx]
|
||||
paddsw xmm2, [ecx+16]
|
||||
paddsw xmm4, [ecx+32]
|
||||
paddsw xmm6, [ecx+48]
|
||||
paddsw xmm1, [edx]
|
||||
paddsw xmm3, [edx+16]
|
||||
paddsw xmm5, [edx+32]
|
||||
paddsw xmm7, [edx+48]
|
||||
|
||||
paddsw xmm0, xmm1
|
||||
movaps [edi], xmm0
|
||||
paddsw xmm2, xmm3
|
||||
movaps [edi+16], xmm2
|
||||
paddsw xmm4, xmm5
|
||||
movaps [edi+32], xmm4
|
||||
paddsw xmm6, xmm7
|
||||
movaps [edi+48], xmm6
|
||||
|
||||
movaps xmm0, [eax+64]
|
||||
movaps xmm2, [eax+80]
|
||||
movaps xmm4, [eax+96]
|
||||
movaps xmm6, [eax+112]
|
||||
|
||||
movaps xmm1, [ebx+64]
|
||||
movaps xmm3, [ebx+80]
|
||||
movaps xmm5, [ebx+96]
|
||||
movaps xmm7, [ebx+112]
|
||||
paddsw xmm0, [ecx+64]
|
||||
paddsw xmm2, [ecx+80]
|
||||
paddsw xmm4, [ecx+96]
|
||||
paddsw xmm6, [ecx+112]
|
||||
|
||||
paddsw xmm1, [edx+64]
|
||||
paddsw xmm3, [edx+80]
|
||||
paddsw xmm5, [edx+96]
|
||||
paddsw xmm7, [edx+112]
|
||||
paddsw xmm0, xmm1
|
||||
movaps [edi+64], xmm0
|
||||
paddsw xmm2, xmm3
|
||||
movaps [edi+80], xmm2
|
||||
paddsw xmm4, xmm5
|
||||
movaps [edi+96], xmm4
|
||||
paddsw xmm6, xmm7
|
||||
movaps [edi+112], xmm6
|
||||
ret
|
||||
end if
|
File diff suppressed because it is too large
Load Diff
@ -1,268 +0,0 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if (flag and 10000b) | (parmbytes=0)
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label . \\{ deflocal@proc .,:, \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
restruc byte,word,dword,pword,tword,qword
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
..var def val
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
@ -1,163 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;driver sceletone
|
||||
|
||||
format MS COFF
|
||||
|
||||
include 'proc32.inc'
|
||||
include 'imports.inc'
|
||||
|
||||
OS_BASE equ 0;
|
||||
new_app_base equ 0x60400000
|
||||
PROC_BASE equ OS_BASE+0x0080000
|
||||
|
||||
struc IOCTL
|
||||
{ .handle dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
IOCTL IOCTL
|
||||
end virtual
|
||||
|
||||
public START
|
||||
public service_proc
|
||||
public version
|
||||
|
||||
DEBUG equ 1
|
||||
|
||||
DRV_ENTRY equ 1
|
||||
DRV_EXIT equ -1
|
||||
STRIDE equ 4 ;size of row in devices table
|
||||
|
||||
section '.flat' code readable align 16
|
||||
|
||||
proc START stdcall, state:dword
|
||||
|
||||
cmp [state], 1
|
||||
jne .exit
|
||||
.entry:
|
||||
|
||||
if DEBUG
|
||||
mov esi, msgInit
|
||||
call SysMsgBoardStr
|
||||
end if
|
||||
|
||||
stdcall RegService, my_service, service_proc
|
||||
ret
|
||||
.fail:
|
||||
.exit:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
handle equ IOCTL.handle
|
||||
io_code equ IOCTL.io_code
|
||||
input equ IOCTL.input
|
||||
inp_size equ IOCTL.inp_size
|
||||
output equ IOCTL.output
|
||||
out_size equ IOCTL.out_size
|
||||
|
||||
align 4
|
||||
proc service_proc stdcall, ioctl:dword
|
||||
|
||||
; mov edi, [ioctl]
|
||||
; mov eax, [edi+io_code]
|
||||
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
restore handle
|
||||
restore io_code
|
||||
restore input
|
||||
restore inp_size
|
||||
restore output
|
||||
restore out_size
|
||||
|
||||
align 4
|
||||
proc detect
|
||||
locals
|
||||
last_bus dd ?
|
||||
endl
|
||||
|
||||
xor eax, eax
|
||||
mov [bus], eax
|
||||
inc eax
|
||||
call PciApi
|
||||
cmp eax, -1
|
||||
je .err
|
||||
|
||||
mov [last_bus], eax
|
||||
|
||||
.next_bus:
|
||||
and [devfn], 0
|
||||
.next_dev:
|
||||
stdcall PciRead32, [bus], [devfn], dword 0
|
||||
test eax, eax
|
||||
jz .next
|
||||
cmp eax, -1
|
||||
je .next
|
||||
|
||||
mov edi, devices
|
||||
@@:
|
||||
mov ebx, [edi]
|
||||
test ebx, ebx
|
||||
jz .next
|
||||
|
||||
cmp eax, ebx
|
||||
je .found
|
||||
add edi, STRIDE
|
||||
jmp @B
|
||||
|
||||
.next: inc [devfn]
|
||||
cmp [devfn], 256
|
||||
jb .next_dev
|
||||
mov eax, [bus]
|
||||
inc eax
|
||||
mov [bus], eax
|
||||
cmp eax, [last_bus]
|
||||
jna .next_bus
|
||||
xor eax, eax
|
||||
ret
|
||||
.found:
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
.err:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;DEVICE_ID equ ; pci device id
|
||||
;VENDOR_ID equ ; device vendor id
|
||||
|
||||
|
||||
;all initialized data place here
|
||||
|
||||
align 4
|
||||
devices dd (DEVICE_ID shl 16)+VENDOR_ID
|
||||
dd 0 ;terminator
|
||||
|
||||
version dd 0x00030003
|
||||
|
||||
my_service db 'MY_SERVICE',0 ;max 16 chars include zero
|
||||
|
||||
msgInit db 'detect hardware...',13,10,0
|
||||
msgPCI db 'PCI accsess not supported',13,10,0
|
||||
msgFail db 'device not found',13,10,0
|
||||
|
||||
section '.data' data readable writable align 16
|
||||
|
||||
;all uninitialized data place here
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,428 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; Formatted Debug Output (FDO)
|
||||
; Copyright (c) 2005-2006, mike.dld
|
||||
; Created: 2005-01-29, Changed: 2006-11-10
|
||||
;
|
||||
; For questions and bug reports, mail to mike.dld@gmail.com
|
||||
;
|
||||
; Available format specifiers are: %s, %d, %u, %x (with partial width support)
|
||||
;
|
||||
|
||||
; to be defined:
|
||||
; __DEBUG__ equ 1
|
||||
; __DEBUG_LEVEL__ equ 5
|
||||
|
||||
macro debug_func name {
|
||||
if used name
|
||||
name@of@func equ name
|
||||
}
|
||||
|
||||
macro debug_beginf {
|
||||
align 4
|
||||
name@of@func:
|
||||
}
|
||||
|
||||
debug_endf fix end if
|
||||
|
||||
macro DEBUGS _sign,[_str] {
|
||||
common
|
||||
local tp
|
||||
tp equ 0
|
||||
match _arg:_num,_str \{
|
||||
DEBUGS_N _sign,_num,_arg
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 _arg,tp _str \{
|
||||
DEBUGS_N _sign,,_arg
|
||||
\}
|
||||
}
|
||||
|
||||
macro DEBUGS_N _sign,_num,[_str] {
|
||||
common
|
||||
pushf
|
||||
pushad
|
||||
local ..str,..label,is_str
|
||||
is_str = 0
|
||||
forward
|
||||
if _str eqtype ''
|
||||
is_str = 1
|
||||
end if
|
||||
common
|
||||
if is_str = 1
|
||||
jmp ..label
|
||||
..str db _str,0
|
||||
..label:
|
||||
add esp,4*8+4
|
||||
mov edx,..str
|
||||
sub esp,4*8+4
|
||||
else
|
||||
mov edx,_str
|
||||
end if
|
||||
if ~_num eq
|
||||
if _num eqtype eax
|
||||
if _num in <eax,ebx,ecx,edx,edi,ebp,esp>
|
||||
mov esi,_num
|
||||
else if ~_num eq esi
|
||||
movzx esi,_num
|
||||
end if
|
||||
else if _num eqtype 0
|
||||
mov esi,_num
|
||||
else
|
||||
local tp
|
||||
tp equ 0
|
||||
match [_arg],_num \{
|
||||
mov esi,dword[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 =dword[_arg],tp _num \{
|
||||
mov esi,dword[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 =word[_arg],tp _num \{
|
||||
movzx esi,word[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 =byte[_arg],tp _num \{
|
||||
movzx esi,byte[_arg]
|
||||
tp equ 1
|
||||
\}
|
||||
match =0,tp \{
|
||||
'Error: specified string width is incorrect'
|
||||
\}
|
||||
end if
|
||||
else
|
||||
mov esi,0x7FFFFFFF
|
||||
end if
|
||||
call fdo_debug_outstr
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
macro DEBUGD _sign,_dec {
|
||||
local tp
|
||||
tp equ 0
|
||||
match _arg:_num,_dec \{
|
||||
DEBUGD_N _sign,_num,_arg
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 _arg,tp _dec \{
|
||||
DEBUGD_N _sign,,_arg
|
||||
\}
|
||||
}
|
||||
|
||||
macro DEBUGD_N _sign,_num,_dec {
|
||||
pushf
|
||||
pushad
|
||||
if (~_num eq)
|
||||
if (_dec eqtype eax | _dec eqtype 0)
|
||||
'Error: precision allowed only for in-memory variables'
|
||||
end if
|
||||
if (~_num in <1,2,4>)
|
||||
if _sign
|
||||
'Error: 1, 2 and 4 are only allowed for precision in %d'
|
||||
else
|
||||
'Error: 1, 2 and 4 are only allowed for precision in %u'
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
if _dec eqtype eax
|
||||
if _dec in <ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
mov eax,_dec
|
||||
else if ~_dec eq eax
|
||||
if _sign = 1
|
||||
movsx eax,_dec
|
||||
else
|
||||
movzx eax,_dec
|
||||
end if
|
||||
end if
|
||||
else if _dec eqtype 0
|
||||
mov eax,_dec
|
||||
else
|
||||
add esp,4*8+4
|
||||
if _num eq
|
||||
mov eax,dword _dec
|
||||
else if _num = 1
|
||||
if _sign = 1
|
||||
movsx eax,byte _dec
|
||||
else
|
||||
movzx eax,byte _dec
|
||||
end if
|
||||
else if _num = 2
|
||||
if _sign = 1
|
||||
movsx eax,word _dec
|
||||
else
|
||||
movzx eax,word _dec
|
||||
end if
|
||||
else
|
||||
mov eax,dword _dec
|
||||
end if
|
||||
sub esp,4*8+4
|
||||
end if
|
||||
mov cl,_sign
|
||||
call fdo_debug_outdec
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
macro DEBUGH _sign,_hex {
|
||||
local tp
|
||||
tp equ 0
|
||||
match _arg:_num,_hex \{
|
||||
DEBUGH_N _sign,_num,_arg
|
||||
tp equ 1
|
||||
\}
|
||||
match =0 _arg,tp _hex \{
|
||||
DEBUGH_N _sign,,_arg
|
||||
\}
|
||||
}
|
||||
|
||||
macro DEBUGH_N _sign,_num,_hex {
|
||||
pushf
|
||||
pushad
|
||||
if (~_num eq) & (~_num in <1,2,3,4,5,6,7,8>)
|
||||
'Error: 1..8 are only allowed for precision in %x'
|
||||
end if
|
||||
if _hex eqtype eax
|
||||
if _hex in <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
if ~_hex eq eax
|
||||
mov eax,_hex
|
||||
end if
|
||||
else if _hex in <ax,bx,cx,dx,si,di,bp,sp>
|
||||
if ~_hex eq ax
|
||||
movzx eax,_hex
|
||||
end if
|
||||
shl eax,16
|
||||
if (_num eq)
|
||||
mov edx,4
|
||||
end if
|
||||
else if _hex in <al,ah,bl,bh,cl,ch,dl,dh>
|
||||
if ~_hex eq al
|
||||
movzx eax,_hex
|
||||
end if
|
||||
shl eax,24
|
||||
if (_num eq)
|
||||
mov edx,2
|
||||
end if
|
||||
end if
|
||||
else if _hex eqtype 0
|
||||
mov eax,_hex
|
||||
else
|
||||
add esp,4*8+4
|
||||
mov eax,dword _hex
|
||||
sub esp,4*8+4
|
||||
end if
|
||||
if ~_num eq
|
||||
mov edx,_num
|
||||
else
|
||||
if ~_hex eqtype eax
|
||||
mov edx,8
|
||||
end if
|
||||
end if
|
||||
call fdo_debug_outhex
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
debug_func fdo_debug_outchar
|
||||
debug_beginf
|
||||
pushad
|
||||
movzx ebx,al
|
||||
mov eax,1
|
||||
call sys_msg_board
|
||||
popad
|
||||
ret
|
||||
debug_endf
|
||||
|
||||
debug_func fdo_debug_outstr
|
||||
debug_beginf
|
||||
mov eax,1
|
||||
.l1: dec esi
|
||||
js .l2
|
||||
movzx ebx,byte[edx]
|
||||
or bl,bl
|
||||
jz .l2
|
||||
call sys_msg_board
|
||||
inc edx
|
||||
jmp .l1
|
||||
.l2: ret
|
||||
debug_endf
|
||||
|
||||
debug_func fdo_debug_outdec
|
||||
debug_beginf
|
||||
or cl,cl
|
||||
jz @f
|
||||
or eax,eax
|
||||
jns @f
|
||||
neg eax
|
||||
push eax
|
||||
mov al,'-'
|
||||
call fdo_debug_outchar
|
||||
pop eax
|
||||
@@: push 10
|
||||
pop ecx
|
||||
push -'0'
|
||||
.l1: xor edx,edx
|
||||
div ecx
|
||||
push edx
|
||||
test eax,eax
|
||||
jnz .l1
|
||||
.l2: pop eax
|
||||
add al,'0'
|
||||
jz .l3
|
||||
call fdo_debug_outchar
|
||||
jmp .l2
|
||||
.l3: ret
|
||||
debug_endf
|
||||
|
||||
debug_func fdo_debug_outhex
|
||||
__fdo_hexdigits db '0123456789ABCDEF'
|
||||
debug_beginf
|
||||
mov cl,dl
|
||||
neg cl
|
||||
add cl,8
|
||||
shl cl,2
|
||||
rol eax,cl
|
||||
.l1: rol eax,4
|
||||
push eax
|
||||
and eax,0x0000000F
|
||||
mov al,[__fdo_hexdigits+eax]
|
||||
call fdo_debug_outchar
|
||||
pop eax
|
||||
dec edx
|
||||
jnz .l1
|
||||
ret
|
||||
debug_endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
macro DEBUGF _level,_format,[_arg] {
|
||||
common
|
||||
if __DEBUG__ = 1 & _level >= __DEBUG_LEVEL__
|
||||
local ..f1,f2,a1,a2,c1,c2,c3,..lbl
|
||||
_debug_str_ equ __debug_str_ # a1
|
||||
a1 = 0
|
||||
c2 = 0
|
||||
c3 = 0
|
||||
f2 = 0
|
||||
repeat ..lbl-..f1
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
load c1 word from %-1
|
||||
end virtual
|
||||
if c1 = '%s'
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
store word 0 at %-1
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if c1 <> 0
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
c2 = c2 + 1
|
||||
f2 = %+1
|
||||
DEBUGF_HELPER S,a1,0,_arg
|
||||
else if c1 = '%x'
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
store word 0 at %-1
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if c1 <> 0
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
c2 = c2 + 1
|
||||
f2 = %+1
|
||||
DEBUGF_HELPER H,a1,0,_arg
|
||||
else if c1 = '%d' | c1 = '%u'
|
||||
local c4
|
||||
if c1 = '%d'
|
||||
c4 = 1
|
||||
else
|
||||
c4 = 0
|
||||
end if
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
store word 0 at %-1
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if c1 <> 0
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
c2 = c2 + 1
|
||||
f2 = %+1
|
||||
DEBUGF_HELPER D,a1,c4,_arg
|
||||
else if c1 = '\n'
|
||||
c3 = c3 + 1
|
||||
end if
|
||||
end repeat
|
||||
virtual at 0
|
||||
db _format,0,0
|
||||
load c1 from f2-c2
|
||||
end virtual
|
||||
if (c1<>0)&(f2<>..lbl-..f1-1)
|
||||
DEBUGS 0,_debug_str_+f2-c2
|
||||
end if
|
||||
virtual at 0
|
||||
..f1 db _format,0
|
||||
..lbl:
|
||||
__debug_strings equ __debug_strings,_debug_str_,<_format>,..lbl-..f1-1-c2-c3
|
||||
end virtual
|
||||
end if
|
||||
}
|
||||
|
||||
macro __include_debug_strings dummy,[_id,_fmt,_len] {
|
||||
common
|
||||
local c1,a1,a2
|
||||
forward
|
||||
if defined _len & ~_len eq
|
||||
_id:
|
||||
a1 = 0
|
||||
a2 = 0
|
||||
repeat _len
|
||||
virtual at 0
|
||||
db _fmt,0,0
|
||||
load c1 word from %+a2-1
|
||||
end virtual
|
||||
if (c1='%s')|(c1='%x')|(c1='%d')|(c1='%u')
|
||||
db 0
|
||||
a2 = a2 + 1
|
||||
else if (c1='\n')
|
||||
dw $0A0D
|
||||
a1 = a1 + 1
|
||||
a2 = a2 + 1
|
||||
else
|
||||
db c1 and 0x0FF
|
||||
end if
|
||||
end repeat
|
||||
db 0
|
||||
end if
|
||||
}
|
||||
|
||||
macro DEBUGF_HELPER _letter,_num,_sign,[_arg] {
|
||||
common
|
||||
local num
|
||||
num = 0
|
||||
forward
|
||||
if num = _num
|
||||
DEBUG#_letter _sign,_arg
|
||||
end if
|
||||
num = num+1
|
||||
common
|
||||
_num = _num+1
|
||||
}
|
||||
|
||||
macro include_debug_strings {
|
||||
if __DEBUG__ = 1
|
||||
match dbg_str,__debug_strings \{
|
||||
__include_debug_strings dbg_str
|
||||
\}
|
||||
end if
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,841 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; System service for filesystem call ;;
|
||||
;; (C) 2004 Ville Turjanmaa, License: GPL ;;
|
||||
;; 29.04.2006 Elimination of hangup after the ;;
|
||||
;; expiration hd_wait_timeout (for LBA) - Mario79 ;;
|
||||
;; 15.01.2005 get file size/attr/date, ;;
|
||||
;; file_append (only for hd) - ATV ;;
|
||||
;; 23.11.2004 test if hd/partition is set - ATV ;;
|
||||
;; 18.11.2004 get_disk_info and more error codes - ATV ;;
|
||||
;; 08.11.2004 expand_pathz and rename (only for hd) - ATV ;;
|
||||
;; 20.10.2004 Makedir/Removedir (only for hd) - ATV ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
iglobal
|
||||
dir0: db 'HARDDISK '
|
||||
db 'RAMDISK '
|
||||
db 'FLOPPYDISK '
|
||||
db 0
|
||||
|
||||
dir1: db 'FIRST '
|
||||
db 'SECOND '
|
||||
db 'THIRD '
|
||||
db 'FOURTH '
|
||||
db 0
|
||||
|
||||
not_select_IDE db 0
|
||||
|
||||
hd_address_table: dd 0x1f0,0x00,0x1f0,0x10
|
||||
dd 0x170,0x00,0x170,0x10
|
||||
endg
|
||||
|
||||
file_system:
|
||||
|
||||
; IN:
|
||||
;
|
||||
; eax = 0 ; read file /RamDisk/First 6
|
||||
; eax = 1 ; write file /RamDisk/First 33 /HardDisk/First 56
|
||||
; eax = 8 ; lba read
|
||||
; eax = 15 ; get_disk_info
|
||||
;
|
||||
; OUT:
|
||||
;
|
||||
; eax = 0 : read ok
|
||||
; eax = 1 : no hd base and/or partition defined
|
||||
; eax = 2 : function is unsupported for this FS
|
||||
; eax = 3 : unknown FS
|
||||
; eax = 4 : partition not defined at hd
|
||||
; eax = 5 : file not found
|
||||
; eax = 6 : end of file
|
||||
; eax = 7 : memory pointer not in application area
|
||||
; eax = 8 : disk full
|
||||
; eax = 9 : fat table corrupted
|
||||
; eax = 10 : access denied
|
||||
; eax = 11 : disk error
|
||||
;
|
||||
; ebx = size
|
||||
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; for subfunction 16 (start application) error codes must be negative
|
||||
; because positive values are valid PIDs
|
||||
; so possible return values are:
|
||||
; eax > 0 : process created, eax=PID
|
||||
|
||||
; -0x10 <= eax < 0 : -eax is filesystem error code:
|
||||
; eax = -1 = 0xFFFFFFFF : no hd base and/or partition defined
|
||||
; eax = -3 = 0xFFFFFFFD : unknown FS
|
||||
; eax = -5 = 0xFFFFFFFB : file not found
|
||||
; eax = -6 = 0xFFFFFFFA : unexpected end of file (probably not executable file)
|
||||
; eax = -9 = 0xFFFFFFF7 : fat table corrupted
|
||||
; eax = -10 = 0xFFFFFFF6 : access denied
|
||||
|
||||
; -0x20 <= eax < -0x10: eax is process creation error code:
|
||||
; eax = -0x20 = 0xFFFFFFE0 : too many processes
|
||||
; eax = -0x1F = 0xFFFFFFE1 : not Menuet/Kolibri executable
|
||||
; eax = -0x1E = 0xFFFFFFE2 : no memory
|
||||
|
||||
; ebx is not changed
|
||||
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
; Extract parameters
|
||||
add eax, std_application_base_address ; abs start of info block
|
||||
|
||||
cmp dword [eax+0],15 ; GET_DISK_INFO
|
||||
je fs_info
|
||||
|
||||
cmp dword [CURRENT_TASK],1 ; no memory checks for kernel requests
|
||||
jz no_checks_for_kernel
|
||||
mov edx,eax
|
||||
cmp dword [eax+0],1
|
||||
jnz .usual_check
|
||||
mov ebx,[eax+12]
|
||||
add ebx,std_application_base_address
|
||||
mov ecx,[eax+8]
|
||||
call check_region
|
||||
test eax,eax
|
||||
jnz area_in_app_mem
|
||||
|
||||
.error_output:
|
||||
mov esi,buffer_failed
|
||||
call sys_msg_board_str
|
||||
; mov eax,7
|
||||
mov dword [esp+36],7
|
||||
ret
|
||||
iglobal
|
||||
buffer_failed db 'K : Buffer check failed',13,10,0
|
||||
endg
|
||||
.usual_check:
|
||||
cmp dword [eax+0],0
|
||||
mov ecx,512
|
||||
jnz .small_size
|
||||
mov ecx,[eax+8]
|
||||
shl ecx,9
|
||||
.small_size:
|
||||
mov ebx,[eax+12]
|
||||
add ebx,std_application_base_address
|
||||
call check_region
|
||||
test eax,eax
|
||||
jz .error_output
|
||||
area_in_app_mem:
|
||||
mov eax,edx
|
||||
no_checks_for_kernel:
|
||||
|
||||
fs_read:
|
||||
|
||||
mov ebx,[eax+20] ; program wants root directory ?
|
||||
test bl,bl
|
||||
je fs_getroot
|
||||
test bh,bh
|
||||
jne fs_noroot
|
||||
fs_getroot:
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; root - only read is allowed
|
||||
; other operations return "access denied", eax=10
|
||||
; (execute operation returns eax=-10)
|
||||
cmp dword [eax], 0
|
||||
jz .read_root
|
||||
mov dword [esp+36], 10
|
||||
ret
|
||||
.read_root:
|
||||
; \end{diamond}[18.03.2006]
|
||||
mov esi,dir0
|
||||
mov edi,[eax+12]
|
||||
add edi,std_application_base_address
|
||||
mov ecx,11
|
||||
push ecx
|
||||
; cld ; already is
|
||||
rep movsb
|
||||
mov al,0x10
|
||||
stosb
|
||||
add edi,32-11-1
|
||||
pop ecx
|
||||
rep movsb
|
||||
stosb
|
||||
and dword [esp+36],0 ; ok read
|
||||
mov dword [esp+24],32*2 ; size of root
|
||||
ret
|
||||
|
||||
fs_info: ;start of code - Mihasik
|
||||
push eax
|
||||
cmp [eax+21],byte 'h'
|
||||
je fs_info_h
|
||||
cmp [eax+21],byte 'H'
|
||||
je fs_info_h
|
||||
cmp [eax+21],byte 'r'
|
||||
je fs_info_r
|
||||
cmp [eax+21],byte 'R'
|
||||
je fs_info_r
|
||||
mov eax,3 ;if unknown disk
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
jmp fs_info1
|
||||
fs_info_r:
|
||||
call ramdisk_free_space ;if ramdisk
|
||||
mov ecx,edi ;free space in ecx
|
||||
shr ecx,9 ;free clusters
|
||||
mov ebx,2847 ;total clusters
|
||||
mov edx,512 ;cluster size
|
||||
xor eax,eax ;always 0
|
||||
jmp fs_info1
|
||||
fs_info_h: ;if harddisk
|
||||
call get_hd_info
|
||||
fs_info1:
|
||||
pop edi
|
||||
mov [esp+36],eax
|
||||
mov [esp+24],ebx ; total clusters on disk
|
||||
mov [esp+32],ecx ; free clusters on disk
|
||||
mov [edi],edx ; cluster size in bytes
|
||||
ret ;end of code - Mihasik
|
||||
|
||||
fs_noroot:
|
||||
|
||||
push dword [eax+0] ; read/write/delete/.../makedir/rename/lba/run
|
||||
push dword [eax+4] ; 512 block number to read
|
||||
push dword [eax+8] ; bytes to write/append or 512 blocks to read
|
||||
mov ebx,[eax+12]
|
||||
add ebx,std_application_base_address
|
||||
push ebx ; abs start of return/save area
|
||||
|
||||
lea esi,[eax+20] ; abs start of dir + filename
|
||||
mov edi,[eax+16]
|
||||
add edi,std_application_base_address ; abs start of work area
|
||||
|
||||
call expand_pathz
|
||||
|
||||
push edi ; dir start
|
||||
push ebx ; name of file start
|
||||
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'RD '
|
||||
je fs_yesramdisk
|
||||
cmp eax,'RAMD'
|
||||
jne fs_noramdisk
|
||||
|
||||
fs_yesramdisk:
|
||||
|
||||
cmp byte [edi+1+11],0
|
||||
je fs_give_dir1
|
||||
|
||||
mov eax,[edi+1+12]
|
||||
cmp eax,'1 '
|
||||
je fs_yesramdisk_first
|
||||
cmp eax,'FIRS'
|
||||
jne fs_noramdisk
|
||||
|
||||
fs_yesramdisk_first:
|
||||
|
||||
cmp dword [esp+20],8 ; LBA read ramdisk
|
||||
jne fs_no_LBA_read_ramdisk
|
||||
|
||||
mov eax,[esp+16] ; LBA block to read
|
||||
mov ecx,[esp+8] ; abs pointer to return area
|
||||
|
||||
call LBA_read_ramdisk
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_no_LBA_read_ramdisk:
|
||||
|
||||
cmp dword [esp+20],0 ; READ
|
||||
jne fs_noramdisk_read
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,2*12+1
|
||||
mov ebx,[esp+16] ; block start
|
||||
inc ebx
|
||||
mov ecx,[esp+12] ; block count
|
||||
mov edx,[esp+8] ; return
|
||||
mov esi,[esp+0]
|
||||
sub esi,eax
|
||||
add esi,12+1 ; file name length
|
||||
call fileread
|
||||
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_noramdisk_read:
|
||||
|
||||
cmp dword [esp+20],1 ; WRITE
|
||||
jne fs_noramdisk_write
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,2*12+1
|
||||
mov ebx,[esp+8] ; buffer
|
||||
mov ecx,[esp+12] ; count to write
|
||||
mov edx,0 ; create new
|
||||
call filesave
|
||||
|
||||
; eax=0 ok - eax=1 not enough free space
|
||||
|
||||
jmp file_system_return
|
||||
|
||||
fs_noramdisk_write:
|
||||
fs_noramdisk:
|
||||
|
||||
;********************************************************************
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'FD '
|
||||
je fs_yesflpdisk
|
||||
cmp eax,'FLOP'
|
||||
jne fs_noflpdisk
|
||||
|
||||
fs_yesflpdisk:
|
||||
call reserve_flp
|
||||
|
||||
cmp byte [edi+1+11],0
|
||||
je fs_give_dir1
|
||||
|
||||
mov eax,[edi+1+12]
|
||||
cmp eax,'1 '
|
||||
je fs_yesflpdisk_first
|
||||
cmp eax,'FIRS'
|
||||
je fs_yesflpdisk_first
|
||||
cmp eax,'2 '
|
||||
je fs_yesflpdisk_second
|
||||
cmp eax,'SECO'
|
||||
jne fs_noflpdisk
|
||||
jmp fs_yesflpdisk_second
|
||||
|
||||
fs_yesflpdisk_first:
|
||||
mov [flp_number],1
|
||||
jmp fs_yesflpdisk_start
|
||||
fs_yesflpdisk_second:
|
||||
mov [flp_number],2
|
||||
fs_yesflpdisk_start:
|
||||
cmp dword [esp+20],0 ; READ
|
||||
jne fs_noflpdisk_read
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,2*12+1
|
||||
mov ebx,[esp+16] ; block start
|
||||
inc ebx
|
||||
mov ecx,[esp+12] ; block count
|
||||
mov edx,[esp+8] ; return
|
||||
mov esi,[esp+0]
|
||||
sub esi,eax
|
||||
add esi,12+1 ; file name length
|
||||
call floppy_fileread
|
||||
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_noflpdisk_read:
|
||||
|
||||
cmp dword [esp+20],1 ; WRITE
|
||||
jne fs_noflpdisk_write
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,2*12+1
|
||||
mov ebx,[esp+8] ; buffer
|
||||
mov ecx,[esp+12] ; count to write
|
||||
mov edx,0 ; create new
|
||||
call floppy_filesave
|
||||
|
||||
; eax=0 ok - eax=1 not enough free space
|
||||
|
||||
jmp file_system_return
|
||||
|
||||
fs_noflpdisk_write:
|
||||
|
||||
fs_noflpdisk:
|
||||
;*****************************************************************
|
||||
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'HD0 '
|
||||
je fs_yesharddisk_IDE0
|
||||
cmp eax,'HD1 '
|
||||
je fs_yesharddisk_IDE1
|
||||
cmp eax,'HD2 '
|
||||
je fs_yesharddisk_IDE2
|
||||
cmp eax,'HD3 '
|
||||
je fs_yesharddisk_IDE3
|
||||
jmp old_path_harddisk
|
||||
fs_yesharddisk_IDE0:
|
||||
call reserve_hd1
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],1
|
||||
jmp fs_yesharddisk_partition
|
||||
fs_yesharddisk_IDE1:
|
||||
call reserve_hd1
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],2
|
||||
jmp fs_yesharddisk_partition
|
||||
fs_yesharddisk_IDE2:
|
||||
call reserve_hd1
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],3
|
||||
jmp fs_yesharddisk_partition
|
||||
fs_yesharddisk_IDE3:
|
||||
call reserve_hd1
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],4
|
||||
fs_yesharddisk_partition:
|
||||
call reserve_hd_channel
|
||||
; call choice_necessity_partition
|
||||
; jmp fs_yesharddisk_all
|
||||
jmp fs_for_new_semantic
|
||||
|
||||
choice_necessity_partition:
|
||||
mov eax,[edi+1+12]
|
||||
call StringToNumber
|
||||
mov [fat32part],eax
|
||||
choice_necessity_partition_1:
|
||||
mov ecx,[hdpos]
|
||||
xor eax,eax
|
||||
mov [hd_entries], eax ; entries in hd cache
|
||||
mov edx,DRIVE_DATA+2
|
||||
search_partition_array:
|
||||
mov bl,[edx]
|
||||
movzx ebx,bl
|
||||
add eax,ebx
|
||||
inc edx
|
||||
loop search_partition_array
|
||||
sub eax,ebx
|
||||
add eax,[fat32part]
|
||||
dec eax
|
||||
xor edx,edx
|
||||
imul eax,100
|
||||
add eax,DRIVE_DATA+0xa
|
||||
mov [transfer_adress],eax
|
||||
call partition_data_transfer_1
|
||||
ret
|
||||
|
||||
old_path_harddisk:
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'HD '
|
||||
je fs_yesharddisk
|
||||
cmp eax,'HARD'
|
||||
jne fs_noharddisk
|
||||
|
||||
fs_yesharddisk:
|
||||
cmp dword [esp+20],8 ; LBA read
|
||||
jne fs_no_LBA_read
|
||||
mov eax,[esp+16] ; LBA block to read
|
||||
lea ebx,[edi+1+12] ; pointer to FIRST/SECOND/THIRD/FOURTH
|
||||
mov ecx,[esp+8] ; abs pointer to return area
|
||||
call LBA_read
|
||||
jmp file_system_return
|
||||
|
||||
fs_no_LBA_read:
|
||||
|
||||
cmp byte [edi+1+11],0 ; directory read
|
||||
je fs_give_dir1
|
||||
call reserve_hd1
|
||||
fs_for_new_semantic:
|
||||
call choice_necessity_partition
|
||||
|
||||
fs_yesharddisk_all:
|
||||
mov eax,1
|
||||
mov ebx, [esp+24+24]
|
||||
cmp [hdpos],0 ; is hd base set?
|
||||
jz hd_err_return
|
||||
cmp [fat32part],0 ; is partition set?
|
||||
jnz @f
|
||||
hd_err_return:
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
jmp file_system_return
|
||||
@@:
|
||||
|
||||
cmp dword [esp+20],0 ; READ
|
||||
jne fs_noharddisk_read
|
||||
|
||||
mov eax,[esp+0] ; /fname
|
||||
lea edi,[eax+12]
|
||||
mov byte [eax],0 ; path to asciiz
|
||||
inc eax ; filename start
|
||||
|
||||
mov ebx,[esp+12] ; count to read
|
||||
mov ecx,[esp+8] ; buffer
|
||||
mov edx,[esp+4]
|
||||
add edx,12*2 ; dir start
|
||||
sub edi,edx ; path length
|
||||
mov esi,[esp+16] ; blocks to read
|
||||
|
||||
call file_read
|
||||
|
||||
mov edi,[esp+0]
|
||||
mov byte [edi],'/'
|
||||
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
jmp file_system_return
|
||||
|
||||
fs_noharddisk_read:
|
||||
|
||||
|
||||
cmp dword [esp+20],1 ; WRITE
|
||||
jne fs_noharddisk_write
|
||||
|
||||
mov eax,[esp+0] ; /fname
|
||||
mov byte [eax],0 ; path to asciiz
|
||||
inc eax ; filename start
|
||||
|
||||
mov ebx,[esp+12] ; count to write
|
||||
mov ecx,[esp+8] ; buffer
|
||||
mov edx,[esp+4]
|
||||
add edx,12*2 ; path start
|
||||
|
||||
call file_write
|
||||
|
||||
mov edi,[esp+0]
|
||||
mov byte [edi],'/'
|
||||
|
||||
; eax=0 ok - eax=1 not enough free space
|
||||
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_noharddisk_write:
|
||||
|
||||
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
|
||||
fs_noharddisk:
|
||||
; \begin{diamond}[18.03.2006]
|
||||
mov eax, 5 ; file not found
|
||||
; à ìîæåò áûòü, âîçâðàùàòü äðóãîé êîä îøèáêè?
|
||||
mov ebx, [esp+24+24] ; do not change ebx in application
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
file_system_return:
|
||||
|
||||
add esp,24
|
||||
|
||||
mov [esp+36],eax
|
||||
mov [esp+24],ebx
|
||||
ret
|
||||
|
||||
|
||||
fs_give_dir1:
|
||||
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; /RD,/FD,/HD - only read is allowed
|
||||
; other operations return "access denied", eax=10
|
||||
; (execute operation returns eax=-10)
|
||||
cmp dword [esp+20], 0
|
||||
jz .read
|
||||
add esp, 20
|
||||
pop ecx
|
||||
mov dword [esp+36], 10
|
||||
ret
|
||||
.read:
|
||||
; \end{diamond}[18.03.2006]
|
||||
mov al,0x10
|
||||
mov ebx,1
|
||||
mov edi,[esp+8]
|
||||
mov esi,dir1
|
||||
fs_d1_new:
|
||||
mov ecx,11
|
||||
; cld
|
||||
rep movsb
|
||||
stosb
|
||||
add edi,32-11-1
|
||||
dec ebx
|
||||
jne fs_d1_new
|
||||
|
||||
add esp,24
|
||||
|
||||
and dword [esp+36],0 ; ok read
|
||||
mov dword [esp+24],32*1 ; dir/data size
|
||||
ret
|
||||
|
||||
|
||||
|
||||
LBA_read_ramdisk:
|
||||
|
||||
cmp [lba_read_enabled],1
|
||||
je lbarrl1
|
||||
|
||||
xor ebx,ebx
|
||||
mov eax,2
|
||||
ret
|
||||
|
||||
lbarrl1:
|
||||
|
||||
cmp eax,18*2*80
|
||||
jb lbarrl2
|
||||
xor ebx,ebx
|
||||
mov eax,3
|
||||
ret
|
||||
|
||||
lbarrl2:
|
||||
|
||||
pushad
|
||||
|
||||
call restorefatchain
|
||||
|
||||
mov edi,ecx
|
||||
mov esi,eax
|
||||
|
||||
shl esi,9
|
||||
add esi,RAMDISK
|
||||
mov ecx,512/4
|
||||
; cld
|
||||
rep movsd
|
||||
|
||||
popad
|
||||
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
ret
|
||||
|
||||
LBA_read:
|
||||
|
||||
; IN:
|
||||
;
|
||||
; eax = LBA block to read
|
||||
; ebx = pointer to FIRST/SECOND/THIRD/FOURTH
|
||||
; ecx = abs pointer to return area
|
||||
|
||||
cmp [lba_read_enabled],1
|
||||
je lbarl1
|
||||
mov eax,2
|
||||
ret
|
||||
|
||||
lbarl1:
|
||||
|
||||
call reserve_hd1
|
||||
|
||||
push eax
|
||||
push ecx
|
||||
|
||||
mov edi,hd_address_table
|
||||
mov esi,dir1
|
||||
mov eax,[ebx]
|
||||
mov edx,'1 '
|
||||
mov ecx,4
|
||||
blar0:
|
||||
cmp eax,[esi]
|
||||
je blar2
|
||||
cmp eax,edx
|
||||
je blar2
|
||||
inc edx
|
||||
add edi,8
|
||||
add esi,11
|
||||
dec ecx
|
||||
jnz blar0
|
||||
|
||||
mov eax,1
|
||||
mov ebx,1
|
||||
jmp LBA_read_ret
|
||||
|
||||
blar2:
|
||||
mov eax,[edi+0]
|
||||
mov ebx,[edi+4]
|
||||
|
||||
mov [hdbase],eax
|
||||
mov [hdid],ebx
|
||||
|
||||
call wait_for_hd_idle
|
||||
cmp [hd_error],0
|
||||
jne hd_lba_error
|
||||
|
||||
; eax = hd port
|
||||
; ebx = set for primary (0x00) or slave (0x10)
|
||||
|
||||
cli
|
||||
|
||||
mov edx,eax
|
||||
inc edx
|
||||
xor eax,eax
|
||||
out dx,al
|
||||
inc edx
|
||||
inc eax
|
||||
out dx,al
|
||||
inc edx
|
||||
mov eax,[esp+4]
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
and al,1+2+4+8
|
||||
add al,bl
|
||||
add al,128+64+32
|
||||
out dx,al
|
||||
|
||||
inc edx
|
||||
mov al,20h
|
||||
out dx,al
|
||||
|
||||
sti
|
||||
|
||||
call wait_for_sector_buffer
|
||||
cmp [hd_error],0
|
||||
jne hd_lba_error
|
||||
|
||||
cli
|
||||
|
||||
mov edi,[esp+0]
|
||||
mov ecx,256
|
||||
sub edx,7
|
||||
cld
|
||||
rep insw
|
||||
|
||||
sti
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
|
||||
LBA_read_ret:
|
||||
mov [hd_error],0
|
||||
mov [hd1_status],0
|
||||
add esp,2*4
|
||||
|
||||
ret
|
||||
|
||||
|
||||
expand_pathz:
|
||||
; IN:
|
||||
; esi = asciiz path & file
|
||||
; edi = buffer for path & file name
|
||||
; OUT:
|
||||
; edi = directory & file : / 11 + / 11 + / 11 - zero terminated
|
||||
; ebx = /file name - zero terminated
|
||||
; esi = pointer after source
|
||||
|
||||
push eax
|
||||
push ecx
|
||||
push edi ;[esp+0]
|
||||
|
||||
pathz_start:
|
||||
mov byte [edi],'/'
|
||||
inc edi
|
||||
mov al,32
|
||||
mov ecx,11
|
||||
cld
|
||||
rep stosb ; clear filename area
|
||||
sub edi,11
|
||||
mov ebx,edi ; start of dir/file name
|
||||
|
||||
pathz_new_char:
|
||||
mov al,[esi]
|
||||
inc esi
|
||||
cmp al,0
|
||||
je pathz_end
|
||||
|
||||
cmp al,'/'
|
||||
jne pathz_not_path
|
||||
cmp edi,ebx ; skip first '/'
|
||||
jz pathz_new_char
|
||||
lea edi,[ebx+11] ; start of next directory
|
||||
jmp pathz_start
|
||||
|
||||
pathz_not_path:
|
||||
cmp al,'.'
|
||||
jne pathz_not_ext
|
||||
lea edi,[ebx+8] ; start of extension
|
||||
jmp pathz_new_char
|
||||
|
||||
pathz_not_ext:
|
||||
cmp al,'a'
|
||||
jb pathz_not_low
|
||||
cmp al,'z'
|
||||
ja pathz_not_low
|
||||
sub al,0x20 ; char to uppercase
|
||||
|
||||
pathz_not_low:
|
||||
mov [edi],al
|
||||
inc edi
|
||||
mov eax,[esp+0] ; start_of_dest_path
|
||||
add eax,512 ; keep maximum path under 512 bytes
|
||||
cmp edi,eax
|
||||
jb pathz_new_char
|
||||
|
||||
pathz_end:
|
||||
cmp ebx,edi ; if path end with '/'
|
||||
jnz pathz_put_zero ; go back 1 level
|
||||
sub ebx,12
|
||||
|
||||
pathz_put_zero:
|
||||
mov byte [ebx+11],0
|
||||
dec ebx ; include '/' char into file name
|
||||
pop edi
|
||||
pop ecx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;*******************************************
|
||||
;* string to number
|
||||
;* input eax - 4 byte string
|
||||
;* output eax - number
|
||||
;*******************************************
|
||||
StringToNumber:
|
||||
; ÏÅÐÅÂÎÄ ÑÒÐÎÊÎÂÎÃÎ ×ÈÑËÀ  ×ÈÑËÎÂÎÉ ÂÈÄ
|
||||
; Âõîä:
|
||||
; EDI - àäðåñ ñòðîêè ñ ÷èñëîì. Êîíåö ÷èñëà îòìå÷åí êîäîì 0Dh
|
||||
; Âûõîä:
|
||||
; CF - èíäèêàòîð îøèáîê:
|
||||
; 0 - îøèáîê íåò;
|
||||
; 1 - îøèáêà
|
||||
; Åñëè CF=0, òî AX - ÷èñëî.
|
||||
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push edi
|
||||
mov [partition_string],eax
|
||||
mov edi,partition_string
|
||||
xor cx,cx
|
||||
i1:
|
||||
mov al,[edi]
|
||||
cmp al,32 ;13
|
||||
je i_exit
|
||||
; cmp al,'0'
|
||||
; jb err
|
||||
; cmp al,'9'
|
||||
; ja err
|
||||
sub al,48
|
||||
shl cx,1
|
||||
jc err
|
||||
mov bx,cx
|
||||
shl cx,1
|
||||
jc err
|
||||
shl cx,1
|
||||
jc err
|
||||
add cx,bx
|
||||
jc err
|
||||
cbw
|
||||
add cx,ax
|
||||
jc err
|
||||
i3:
|
||||
inc edi
|
||||
jmp i1
|
||||
i_exit:
|
||||
mov ax,cx
|
||||
clc
|
||||
i4:
|
||||
movzx eax,ax
|
||||
pop edi
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
ret
|
||||
|
||||
err:
|
||||
stc
|
||||
jmp i4
|
||||
|
||||
partition_string: dd 0
|
||||
db 32
|
@ -1,686 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; System function 70 - files with long names (LFN)
|
||||
; diamond, 2006
|
||||
|
||||
iglobal
|
||||
; in this table names must be in lowercase
|
||||
rootdirs:
|
||||
db 2,'rd'
|
||||
dd fs_OnRamdisk
|
||||
dd fs_NextRamdisk
|
||||
db 7,'ramdisk'
|
||||
dd fs_OnRamdisk
|
||||
dd fs_NextRamdisk
|
||||
db 2,'fd'
|
||||
dd fs_OnFloppy
|
||||
dd fs_NextFloppy
|
||||
db 10,'floppydisk'
|
||||
dd fs_OnFloppy
|
||||
dd fs_NextFloppy
|
||||
db 3,'hd0'
|
||||
dd fs_OnHd0
|
||||
dd fs_NextHd0
|
||||
db 3,'hd1'
|
||||
dd fs_OnHd1
|
||||
dd fs_NextHd1
|
||||
db 3,'hd2'
|
||||
dd fs_OnHd2
|
||||
dd fs_NextHd2
|
||||
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
|
||||
|
||||
|
||||
virtual_root_query:
|
||||
dd fs_HasRamdisk
|
||||
db 'rd',0
|
||||
dd fs_HasFloppy
|
||||
db 'fd',0
|
||||
dd fs_HasHd0
|
||||
db 'hd0',0
|
||||
dd fs_HasHd1
|
||||
db 'hd1',0
|
||||
dd fs_HasHd2
|
||||
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
|
||||
endg
|
||||
|
||||
file_system_lfn:
|
||||
; in: eax->fileinfo block
|
||||
; operation codes:
|
||||
; 0 : read file
|
||||
; 1 : read folder
|
||||
; 2 : create/rewrite file
|
||||
; 3 : write/append to file
|
||||
; 4 : set end of file
|
||||
; 5 : get file/directory attributes structure
|
||||
; 6 : set file/directory attributes structure
|
||||
; 7 : start application
|
||||
; 8 : delete file
|
||||
; 9 : create directory
|
||||
|
||||
add eax, std_application_base_address
|
||||
; parse file name
|
||||
xchg ebx, eax
|
||||
lea esi, [ebx+20]
|
||||
mov ebp, esi ; for 'start app' function full path must be known
|
||||
lodsb
|
||||
test al, al
|
||||
jnz @f
|
||||
mov esi, [esi]
|
||||
add esi, std_application_base_address
|
||||
mov ebp, esi
|
||||
lodsb
|
||||
@@:
|
||||
cmp dword [ebx], 7
|
||||
jne @F
|
||||
mov edx, [ebx+4]
|
||||
mov ebx, [ebx+8]
|
||||
test ebx, ebx
|
||||
jz .l1
|
||||
add ebx, new_app_base
|
||||
.l1:
|
||||
call fs_execute ; ebp, ebx, edx
|
||||
mov [esp+36], eax
|
||||
ret
|
||||
@@:
|
||||
cmp al, '/'
|
||||
jz @f
|
||||
.notfound:
|
||||
mov dword [esp+36], 5 ; file not found
|
||||
ret
|
||||
@@:
|
||||
cmp byte [esi], 0
|
||||
jz .rootdir
|
||||
mov edi, rootdirs-8
|
||||
xor ecx, ecx
|
||||
push esi
|
||||
.scan1:
|
||||
pop esi
|
||||
add edi, ecx
|
||||
scasd
|
||||
scasd
|
||||
mov cl, byte [edi]
|
||||
jecxz .notfound
|
||||
inc edi
|
||||
push esi
|
||||
@@:
|
||||
lodsb
|
||||
or al, 20h
|
||||
scasb
|
||||
loopz @b
|
||||
jnz .scan1
|
||||
lodsb
|
||||
cmp al, '/'
|
||||
jz .found1
|
||||
test al, al
|
||||
jnz .scan1
|
||||
pop eax
|
||||
; directory /xxx
|
||||
.maindir:
|
||||
cmp dword [ebx], 1
|
||||
jnz .access_denied
|
||||
xor eax, eax
|
||||
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
|
||||
mov esi, [edi+4]
|
||||
; ebx=flags, [esp]=first block, ebp=number of blocks, edx=return area, esi='Next' handler
|
||||
mov edi, edx
|
||||
mov ecx, 32/4
|
||||
rep stosd
|
||||
mov byte [edx], 1 ; version
|
||||
.maindir_loop:
|
||||
call esi
|
||||
jc .maindir_done
|
||||
inc dword [edx+8]
|
||||
dec dword [esp]
|
||||
jns .maindir_loop
|
||||
dec ebp
|
||||
js .maindir_loop
|
||||
inc dword [edx+4]
|
||||
mov dword [edi], 0x10 ; attributes: folder
|
||||
mov dword [edi+4], 1 ; name type: UNICODE
|
||||
push eax
|
||||
xor eax, eax
|
||||
add edi, 8
|
||||
mov ecx, 40/4-2
|
||||
rep stosd
|
||||
pop eax
|
||||
push eax edx
|
||||
; convert number in eax to decimal UNICODE string
|
||||
push edi
|
||||
push -'0'
|
||||
mov cl, 10
|
||||
@@:
|
||||
xor edx, edx
|
||||
div ecx
|
||||
push edx
|
||||
test eax, eax
|
||||
jnz @b
|
||||
@@:
|
||||
pop eax
|
||||
add al, '0'
|
||||
stosb
|
||||
test bl, 1 ; UNICODE name?
|
||||
jz .ansi2
|
||||
mov byte [edi], 0
|
||||
inc edi
|
||||
.ansi2:
|
||||
test al, al
|
||||
jnz @b
|
||||
mov byte [edi-1], 0
|
||||
pop edi
|
||||
; UNICODE name length is 520 bytes, ANSI - 264
|
||||
add edi, 520
|
||||
test bl, 1
|
||||
jnz @f
|
||||
sub edi, 520-264
|
||||
@@:
|
||||
pop edx eax
|
||||
jmp .maindir_loop
|
||||
.maindir_done:
|
||||
pop eax
|
||||
mov ebx, [edx+4]
|
||||
xor eax, eax
|
||||
dec ebp
|
||||
js @f
|
||||
mov al, ERROR_END_OF_FILE
|
||||
@@:
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
; directory /
|
||||
.rootdir:
|
||||
cmp dword [ebx], 1 ; read folder?
|
||||
jz .readroot
|
||||
.access_denied:
|
||||
mov dword [esp+36], 10 ; access denied
|
||||
ret
|
||||
|
||||
.readroot:
|
||||
; virtual root folder - special handler
|
||||
mov esi, virtual_root_query
|
||||
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
|
||||
xor eax, eax
|
||||
; eax=0, [esp]=first block, ebx=flags, ebp=number of blocks, edx=return area
|
||||
mov edi, edx
|
||||
mov ecx, 32/4
|
||||
rep stosd
|
||||
mov byte [edx], 1 ; version
|
||||
.readroot_loop:
|
||||
cmp dword [esi], eax
|
||||
jz .readroot_done
|
||||
call dword [esi]
|
||||
add esi, 4
|
||||
test eax, eax
|
||||
jnz @f
|
||||
.readroot_next:
|
||||
or ecx, -1
|
||||
xchg esi, edi
|
||||
repnz scasb
|
||||
xchg esi, edi
|
||||
jmp .readroot_loop
|
||||
@@:
|
||||
xor eax, eax
|
||||
inc dword [edx+8]
|
||||
dec dword [esp]
|
||||
jns .readroot_next
|
||||
dec ebp
|
||||
js .readroot_next
|
||||
inc dword [edx+4]
|
||||
mov dword [edi], 0x10 ; attributes: folder
|
||||
mov dword [edi+4], 1 ; name type: UNICODE
|
||||
add edi, 8
|
||||
mov ecx, 40/4-2
|
||||
rep stosd
|
||||
push edi
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test bl, 1
|
||||
jz .ansi
|
||||
mov byte [edi], 0
|
||||
inc edi
|
||||
.ansi:
|
||||
test eax, eax
|
||||
jnz @b
|
||||
pop edi
|
||||
add edi, 520
|
||||
test bl, 1
|
||||
jnz .readroot_loop
|
||||
sub edi, 520-264
|
||||
jmp .readroot_loop
|
||||
.readroot_done:
|
||||
pop eax
|
||||
mov ebx, [edx+4]
|
||||
xor eax, eax
|
||||
dec ebp
|
||||
js @f
|
||||
mov al, ERROR_END_OF_FILE
|
||||
@@:
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
|
||||
.found1:
|
||||
pop eax
|
||||
cmp byte [esi], 0
|
||||
jz .maindir
|
||||
; read partition number
|
||||
xor ecx, ecx
|
||||
xor eax, eax
|
||||
@@:
|
||||
lodsb
|
||||
cmp al, '/'
|
||||
jz .done1
|
||||
test al, al
|
||||
jz .done1
|
||||
sub al, '0'
|
||||
cmp al, 9
|
||||
ja .notfound
|
||||
imul ecx, 10
|
||||
add ecx, eax
|
||||
jmp @b
|
||||
.done1:
|
||||
test ecx, ecx
|
||||
jz .notfound
|
||||
test al, al
|
||||
jnz @f
|
||||
dec esi
|
||||
@@:
|
||||
; now [edi] contains handler address, ecx - partition number,
|
||||
; esi points to ASCIIZ string - rest of name
|
||||
jmp dword [edi]
|
||||
|
||||
; handlers for devices
|
||||
; in: ecx = 0 => query virtual directory /xxx
|
||||
; in: ecx = partition number
|
||||
; esi -> relative (for device) name
|
||||
; ebx -> fileinfo
|
||||
; out: [esp+36]=image of eax, [esp+24]=image of ebx
|
||||
|
||||
fs_OnRamdisk:
|
||||
cmp ecx, 1
|
||||
jnz file_system_lfn.notfound
|
||||
mov eax, [ebx]
|
||||
cmp eax, fs_NumRamdiskServices
|
||||
jae .not_impl
|
||||
mov ecx, [ebx+12]
|
||||
mov edx, [ebx+16]
|
||||
add edx, std_application_base_address
|
||||
add ebx, 4
|
||||
call dword [fs_RamdiskServices + eax*4]
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
.not_impl:
|
||||
mov dword [esp+36], 2 ; not implemented
|
||||
ret
|
||||
|
||||
fs_NotImplemented:
|
||||
mov eax, 2
|
||||
ret
|
||||
|
||||
fs_RamdiskServices:
|
||||
dd fs_RamdiskRead
|
||||
dd fs_RamdiskReadFolder
|
||||
dd fs_RamdiskRewrite
|
||||
dd fs_RamdiskWrite
|
||||
dd fs_RamdiskSetFileEnd
|
||||
dd fs_RamdiskGetFileInfo
|
||||
dd fs_RamdiskSetFileInfo
|
||||
dd 0 ;fs_RamdiskExecute
|
||||
dd fs_RamdiskDelete
|
||||
dd fs_RamdiskCreateFolder
|
||||
fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4
|
||||
|
||||
fs_OnFloppy:
|
||||
cmp ecx, 2
|
||||
ja file_system_lfn.notfound
|
||||
mov eax, [ebx]
|
||||
cmp eax, fs_NumFloppyServices
|
||||
jae fs_OnRamdisk.not_impl
|
||||
call reserve_flp
|
||||
mov [flp_number], cl
|
||||
mov ecx, [ebx+12]
|
||||
mov edx, [ebx+16]
|
||||
add edx, std_application_base_address
|
||||
add ebx, 4
|
||||
call dword [fs_FloppyServices + eax*4]
|
||||
and [flp_status], 0
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
|
||||
fs_FloppyServices:
|
||||
dd fs_FloppyRead
|
||||
dd fs_FloppyReadFolder
|
||||
dd fs_FloppyRewrite
|
||||
dd fs_FloppyWrite
|
||||
dd fs_FloppySetFileEnd
|
||||
dd fs_FloppyGetFileInfo
|
||||
dd fs_FloppySetFileInfo
|
||||
dd 0 ;fs_FloppyExecute
|
||||
dd fs_FloppyDelete
|
||||
dd fs_FloppyCreateFolder
|
||||
fs_NumFloppyServices = ($ - fs_FloppyServices)/4
|
||||
|
||||
fs_OnHd0:
|
||||
call reserve_hd1
|
||||
mov [hdbase], 0x1F0
|
||||
mov [hdid], 0
|
||||
push 1
|
||||
jmp fs_OnHd
|
||||
fs_OnHd1:
|
||||
call reserve_hd1
|
||||
mov [hdbase], 0x1F0
|
||||
mov [hdid], 0x10
|
||||
push 2
|
||||
jmp fs_OnHd
|
||||
fs_OnHd2:
|
||||
call reserve_hd1
|
||||
mov [hdbase], 0x170
|
||||
mov [hdid], 0
|
||||
push 3
|
||||
jmp fs_OnHd
|
||||
fs_OnHd3:
|
||||
call reserve_hd1
|
||||
mov [hdbase], 0x170
|
||||
mov [hdid], 0x10
|
||||
push 4
|
||||
fs_OnHd:
|
||||
call reserve_hd_channel
|
||||
pop eax
|
||||
mov [hdpos], eax
|
||||
cmp ecx, 0x100
|
||||
jae .nf
|
||||
cmp cl, [DRIVE_DATA+1+eax]
|
||||
jbe @f
|
||||
.nf:
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
mov dword [esp+36], 5 ; not found
|
||||
ret
|
||||
@@:
|
||||
mov [fat32part], ecx
|
||||
push ebx esi
|
||||
call choice_necessity_partition_1
|
||||
pop esi ebx
|
||||
mov ecx, [ebx+12]
|
||||
mov edx, [ebx+16]
|
||||
add edx, std_application_base_address
|
||||
mov eax, [ebx]
|
||||
cmp eax, fs_NumHdServices
|
||||
jae .not_impl
|
||||
add ebx, 4
|
||||
call dword [fs_HdServices + eax*4]
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
.not_impl:
|
||||
call free_hd_channel
|
||||
and [hd1_status], 0
|
||||
mov dword [esp+36], 2 ; not implemented
|
||||
ret
|
||||
|
||||
fs_HdServices:
|
||||
dd fs_HdRead
|
||||
dd fs_HdReadFolder
|
||||
dd fs_HdRewrite
|
||||
dd fs_HdWrite
|
||||
dd fs_HdSetFileEnd
|
||||
dd fs_HdGetFileInfo
|
||||
dd fs_HdSetFileInfo
|
||||
dd 0 ;fs_HdExecute
|
||||
dd fs_HdDelete
|
||||
dd fs_HdCreateFolder
|
||||
fs_NumHdServices = ($ - fs_HdServices)/4
|
||||
|
||||
;*******************************************************
|
||||
fs_OnCd0:
|
||||
call reserve_cd
|
||||
mov [ChannelNumber],1
|
||||
mov [DiskNumber],0
|
||||
push 6
|
||||
jmp fs_OnCd
|
||||
fs_OnCd1:
|
||||
call reserve_cd
|
||||
mov [ChannelNumber],1
|
||||
mov [DiskNumber],1
|
||||
push 4
|
||||
jmp fs_OnCd
|
||||
fs_OnCd2:
|
||||
call reserve_cd
|
||||
mov [ChannelNumber],2
|
||||
mov [DiskNumber],0
|
||||
push 2
|
||||
jmp fs_OnCd
|
||||
fs_OnCd3:
|
||||
call reserve_cd
|
||||
mov [ChannelNumber],2
|
||||
mov [DiskNumber],1
|
||||
push 0
|
||||
fs_OnCd:
|
||||
call reserve_cd_channel
|
||||
pop eax
|
||||
mov [hdpos], 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 [esp+36], 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 [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
.not_impl:
|
||||
call free_cd_channel
|
||||
and [cd_status], 0
|
||||
mov dword [esp+36], 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 fs_CdExecute
|
||||
fs_NumCdServices = ($ - fs_CdServices)/4
|
||||
|
||||
;*******************************************************
|
||||
|
||||
fs_HasRamdisk:
|
||||
mov al, 1 ; we always have ramdisk
|
||||
ret
|
||||
|
||||
fs_HasFloppy:
|
||||
cmp byte [DRIVE_DATA], 0
|
||||
setnz al
|
||||
ret
|
||||
|
||||
fs_HasHd0:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 11000000b
|
||||
cmp al, 01000000b
|
||||
setz al
|
||||
ret
|
||||
fs_HasHd1:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 00110000b
|
||||
cmp al, 00010000b
|
||||
setz al
|
||||
ret
|
||||
fs_HasHd2:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 00001100b
|
||||
cmp al, 00000100b
|
||||
setz al
|
||||
ret
|
||||
fs_HasHd3:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 00000011b
|
||||
cmp al, 00000001b
|
||||
setz al
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
fs_HasCd0:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 11000000b
|
||||
cmp al, 10000000b
|
||||
setz al
|
||||
ret
|
||||
fs_HasCd1:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 00110000b
|
||||
cmp al, 00100000b
|
||||
setz al
|
||||
ret
|
||||
fs_HasCd2:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 00001100b
|
||||
cmp al, 00001000b
|
||||
setz al
|
||||
ret
|
||||
fs_HasCd3:
|
||||
mov al, [DRIVE_DATA+1]
|
||||
and al, 00000011b
|
||||
cmp al, 00000010b
|
||||
setz al
|
||||
ret
|
||||
;*******************************************************
|
||||
|
||||
; fs_NextXXX functions:
|
||||
; in: eax = partition number, from which start to scan
|
||||
; out: CF=1 => no more partitions
|
||||
; CF=0 => eax=next partition number
|
||||
|
||||
fs_NextRamdisk:
|
||||
; we always have /rd/1
|
||||
test eax, eax
|
||||
stc
|
||||
jnz @f
|
||||
mov al, 1
|
||||
clc
|
||||
@@:
|
||||
ret
|
||||
|
||||
fs_NextFloppy:
|
||||
; we have /fd/1 iff (([DRIVE_DATA] and 0xF0) != 0) and /fd/2 iff (([DRIVE_DATA] and 0x0F) != 0)
|
||||
test byte [DRIVE_DATA], 0xF0
|
||||
jz .no1
|
||||
test eax, eax
|
||||
jnz .no1
|
||||
inc eax
|
||||
ret ; CF cleared
|
||||
.no1:
|
||||
test byte [DRIVE_DATA], 0x0F
|
||||
jz .no2
|
||||
cmp al, 2
|
||||
jae .no2
|
||||
mov al, 2
|
||||
clc
|
||||
ret
|
||||
.no2:
|
||||
stc
|
||||
ret
|
||||
|
||||
; on hdx, we have partitions from 1 to [0x40002+x]
|
||||
fs_NextHd0:
|
||||
push 0
|
||||
jmp fs_NextHd
|
||||
fs_NextHd1:
|
||||
push 1
|
||||
jmp fs_NextHd
|
||||
fs_NextHd2:
|
||||
push 2
|
||||
jmp fs_NextHd
|
||||
fs_NextHd3:
|
||||
push 3
|
||||
fs_NextHd:
|
||||
pop ecx
|
||||
movzx ecx, byte [DRIVE_DATA+2+ecx]
|
||||
cmp eax, ecx
|
||||
jae fs_NextFloppy.no2
|
||||
inc eax
|
||||
clc
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
fs_NextCd:
|
||||
; we always have /cdX/1
|
||||
test eax, eax
|
||||
stc
|
||||
jnz @f
|
||||
mov al, 1
|
||||
clc
|
||||
@@:
|
||||
ret
|
||||
;*******************************************************
|
||||
|
@ -1,833 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
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
|
||||
|
||||
CDDataBuf equ 0x7000
|
||||
|
||||
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 al
|
||||
shl eax,1
|
||||
; ýòî êàòàëîã?
|
||||
test [ebp-8],byte 2
|
||||
jz .file
|
||||
inc al
|
||||
.file:
|
||||
; ìåòêà òîìà íå êàê â FAT, â ýòîì âèäå îòñóòñâóåò
|
||||
; ôàéë íå ÿâëÿåòñÿ ñèñòåìíûì
|
||||
shl eax,3
|
||||
; ôàéë ÿâëÿåòñÿ ñêðûòûì? (àòðèáóò ñóùåñòâîâàíèå)
|
||||
test [ebp-8],byte 1
|
||||
jz .hidden
|
||||
inc al
|
||||
.hidden:
|
||||
shl eax,1
|
||||
; ôàéë âñåãäà òîëüêî äëÿ ÷òåíèÿ, òàê êàê ýòî CD
|
||||
inc al
|
||||
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 ebp
|
||||
call cd_find_lfn
|
||||
pushfd
|
||||
cmp [DevErrorCode], 0
|
||||
jz @f
|
||||
popfd
|
||||
pop ebp edi
|
||||
mov eax, 11
|
||||
ret
|
||||
@@:
|
||||
popfd
|
||||
jnc @f
|
||||
pop ebp edi
|
||||
mov eax, ERROR_FILE_NOT_FOUND
|
||||
ret
|
||||
@@:
|
||||
|
||||
mov edi, edx
|
||||
call cd_get_parameters_of_file_1
|
||||
and dword [edi+4], 0
|
||||
pop ebp edi
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_CdExecute - LFN variant for executing from CD
|
||||
;
|
||||
; esi points to hd filename (e.g. 'dir1/name')
|
||||
; ebp points to full filename (e.g. '/hd0/1/dir1/name')
|
||||
; dword [ebx] = flags
|
||||
; dword [ebx+4] = cmdline
|
||||
;
|
||||
; ret ebx,edx destroyed
|
||||
; eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
fs_CdExecute:
|
||||
mov edx, [ebx]
|
||||
mov ebx, [ebx+4]
|
||||
test ebx, ebx
|
||||
jz @f
|
||||
add ebx, std_application_base_address
|
||||
@@:
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_CdExecute.flags - second entry
|
||||
;
|
||||
; esi points to floppy filename (kernel address)
|
||||
; ebp points to full filename
|
||||
; edx flags
|
||||
; ebx cmdline (kernel address)
|
||||
;
|
||||
; ret eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
|
||||
.flags:
|
||||
cmp byte [esi], 0
|
||||
jnz @f
|
||||
; cannot execute root!
|
||||
mov eax, -ERROR_ACCESS_DENIED
|
||||
ret
|
||||
@@:
|
||||
push edi
|
||||
call cd_find_lfn
|
||||
jnc .found
|
||||
pop edi
|
||||
mov eax, -ERROR_FILE_NOT_FOUND
|
||||
cmp [DevErrorCode], 0
|
||||
jz @f
|
||||
mov al, -11
|
||||
@@:
|
||||
ret
|
||||
.found:
|
||||
mov edi,[cd_current_pointer_of_input]
|
||||
mov eax,[edi+2]
|
||||
push 0
|
||||
push eax
|
||||
push dword [edi+10] ; size
|
||||
push .DoRead
|
||||
call fs_execute
|
||||
add esp, 16
|
||||
pop edi
|
||||
ret
|
||||
|
||||
.DoRead:
|
||||
; read next block
|
||||
; in: eax->parameters, edi->buffer
|
||||
; out: eax = error code
|
||||
pushad
|
||||
cmp dword [eax], 0 ; file size
|
||||
jz .eof
|
||||
cmp [eax+8],dword 0
|
||||
jne @f
|
||||
mov ecx,[eax+4]
|
||||
inc dword [eax+4]
|
||||
mov [CDSectorAddress],ecx
|
||||
mov [CDDataBuf_pointer],CDDataBuf ;edi
|
||||
call ReadCDWRetr
|
||||
cmp [DevErrorCode], 0
|
||||
jnz .err
|
||||
@@:
|
||||
push esi edi ecx
|
||||
mov esi,512
|
||||
imul esi,[eax+8]
|
||||
add esi,CDDataBuf
|
||||
mov ecx,512/4
|
||||
cld
|
||||
rep movsd
|
||||
pop ecx edi esi
|
||||
|
||||
mov eax, [esp+28]
|
||||
mov ecx, [eax]
|
||||
sub ecx, 512
|
||||
jae @f
|
||||
lea edi, [edi+ecx+512]
|
||||
neg ecx
|
||||
push eax
|
||||
xor eax, eax
|
||||
rep stosb
|
||||
pop eax
|
||||
@@:
|
||||
mov [eax], ecx
|
||||
mov edx, [eax+8]
|
||||
inc edx
|
||||
cmp edx, 4 ; 2048/512=4
|
||||
jb @f
|
||||
xor edx, edx
|
||||
@@:
|
||||
mov [eax+8], edx
|
||||
popad
|
||||
xor eax, eax
|
||||
ret
|
||||
.eof:
|
||||
popad
|
||||
mov eax, 6
|
||||
ret
|
||||
.err:
|
||||
popad
|
||||
mov eax, 11
|
||||
ret
|
||||
|
||||
cd_find_lfn:
|
||||
; in: esi->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
|
||||
.start:
|
||||
inc dword [CDSectorAddress]
|
||||
mov [CDDataBuf_pointer],CDDataBuf
|
||||
call ReadCDWRetr
|
||||
cmp [DevErrorCode],0
|
||||
jne .access_denied
|
||||
; ïðîâåðêà íà âøèâîñòü
|
||||
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
|
||||
call cd_find_name_in_buffer
|
||||
jnc .found
|
||||
sub eax,2048
|
||||
; äèðåêòîðèÿ çàêîí÷èëàñü?
|
||||
cmp eax,0
|
||||
ja .read_to_buffer
|
||||
; íåò èñêîìîãî ýëåìåíòà öåïî÷êè
|
||||
.access_denied:
|
||||
pop esi eax
|
||||
stc
|
||||
ret
|
||||
; èñêîìûé ýëåìåíò öåïî÷êè íàéäåí
|
||||
.found:
|
||||
; êîíåö ïóòè ôàéëà
|
||||
cmp byte [esi-1], 0
|
||||
jz .done
|
||||
mov eax,[cd_current_pointer_of_input]
|
||||
push dword [eax+2]
|
||||
pop dword [CDSectorAddress] ; íà÷àëî äèðåêòîðèè
|
||||
mov eax,[eax+2+8] ; ðàçìåð äèðåêòîðèè
|
||||
jmp .mainloop
|
||||
; óêàçàòåëü ôàéëà íàéäåí
|
||||
.done:
|
||||
pop esi eax
|
||||
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]
|
||||
cmp eax,0 ; âõîäû çàêîí÷èëèñü?
|
||||
je .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 ax
|
||||
call char_todown
|
||||
call ansi2uni_char
|
||||
xchg ah,al
|
||||
cld
|
||||
scasw
|
||||
pop ax
|
||||
je .coincides
|
||||
call char_toupper
|
||||
call ansi2uni_char
|
||||
xchg ah,al
|
||||
cld
|
||||
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
|
File diff suppressed because it is too large
Load Diff
@ -1,452 +0,0 @@
|
||||
$Revision: 431 $
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;*************************************************************
|
||||
;* 29.04.2006 Elimination of hangup after the *
|
||||
;* expiration hd_wait_timeout - Mario79 *
|
||||
;* 28.01.2006 find all Fat16/32 partition in all input point *
|
||||
;* to MBR - Mario79 *
|
||||
;*************************************************************
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
|
||||
;******************************************************
|
||||
; Please do not change this place - variables in text
|
||||
; Mario79
|
||||
; START place
|
||||
;******************************************************
|
||||
PARTITION_START dd 0x3f
|
||||
PARTITION_END dd 0
|
||||
fs_type db 0 ; 0=none, 1=NTFS, 16=FAT16, 32=FAT32
|
||||
align 4
|
||||
|
||||
fs_dependent_data_start:
|
||||
; FATxx data
|
||||
|
||||
SECTORS_PER_FAT dd 0x1f3a
|
||||
NUMBER_OF_FATS dd 0x2
|
||||
SECTORS_PER_CLUSTER dd 0x8
|
||||
BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes
|
||||
ROOT_CLUSTER dd 2 ; first rootdir cluster
|
||||
FAT_START dd 0 ; start of fat table
|
||||
ROOT_START dd 0 ; start of rootdir (only fat16)
|
||||
ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16)
|
||||
DATA_START dd 0 ; start of data area (=first cluster 2)
|
||||
LAST_CLUSTER dd 0 ; last availabe cluster
|
||||
ADR_FSINFO dd 0 ; used only by fat32
|
||||
|
||||
fatRESERVED dd 0x0FFFFFF6
|
||||
fatBAD dd 0x0FFFFFF7
|
||||
fatEND dd 0x0FFFFFF8
|
||||
fatMASK dd 0x0FFFFFFF
|
||||
|
||||
fs_dependent_data_end:
|
||||
file_system_data_size = $ - PARTITION_START
|
||||
if file_system_data_size > 96
|
||||
ERROR: sizeof(file system data) too big!
|
||||
end if
|
||||
|
||||
virtual at fs_dependent_data_start
|
||||
; NTFS data
|
||||
ntfs_data:
|
||||
.sectors_per_cluster dd ?
|
||||
.mft_cluster dd ?
|
||||
.mftmirr_cluster dd ?
|
||||
.frs_size dd ? ; FRS size in bytes
|
||||
.iab_size dd ? ; IndexAllocationBuffer size in bytes
|
||||
.frs_buffer dd ?
|
||||
.iab_buffer dd ?
|
||||
.mft_retrieval dd ?
|
||||
.mft_retrieval_size dd ?
|
||||
.mft_retrieval_alloc dd ?
|
||||
.mft_retrieval_end dd ?
|
||||
.cur_index_size dd ?
|
||||
.cur_index_buf dd ?
|
||||
if $ > fs_dependent_data_end
|
||||
ERROR: increase sizeof(fs_dependent_data)!
|
||||
end if
|
||||
end virtual
|
||||
|
||||
;***************************************************************************
|
||||
; End place
|
||||
; Mario79
|
||||
;***************************************************************************
|
||||
endg
|
||||
iglobal
|
||||
|
||||
partition_types: ; list of fat16/32 partitions
|
||||
db 0x04 ; DOS: fat16 <32M
|
||||
db 0x06 ; DOS: fat16 >32M
|
||||
db 0x0b ; WIN95: fat32
|
||||
db 0x0c ; WIN95: fat32, LBA-mapped
|
||||
db 0x0e ; WIN95: fat16, LBA-mapped
|
||||
db 0x14 ; Hidden DOS: fat16 <32M
|
||||
db 0x16 ; Hidden DOS: fat16 >32M
|
||||
db 0x1b ; Hidden WIN95: fat32
|
||||
db 0x1c ; Hidden WIN95: fat32, LBA-mapped
|
||||
db 0x1e ; Hidden WIN95: fat16, LBA-mapped
|
||||
db 0xc4 ; DRDOS/secured: fat16 <32M
|
||||
db 0xc6 ; DRDOS/secured: fat16 >32M
|
||||
db 0xcb ; DRDOS/secured: fat32
|
||||
db 0xcc ; DRDOS/secured: fat32, LBA-mapped
|
||||
db 0xce ; DRDOS/secured: fat16, LBA-mapped
|
||||
db 0xd4 ; Old Multiuser DOS secured: fat16 <32M
|
||||
db 0xd6 ; Old Multiuser DOS secured: fat16 >32M
|
||||
db 0x07 ; NTFS
|
||||
partition_types_end:
|
||||
|
||||
|
||||
extended_types: ; list of extended partitions
|
||||
db 0x05 ; DOS: extended partition
|
||||
db 0x0f ; WIN95: extended partition, LBA-mapped
|
||||
db 0xc5 ; DRDOS/secured: extended partition
|
||||
db 0xd5 ; Old Multiuser DOS secured: extended partition
|
||||
extended_types_end:
|
||||
|
||||
endg
|
||||
|
||||
; Partition chain used:
|
||||
; MBR ; PARTITION2 ; PARTITION3 ; PARTITION4
|
||||
;==========================================================
|
||||
; fat16/32 +-- fat16/32 +-- fat16/32 +-- fat16/32 +--
|
||||
; extended --+ extended --+ extended --+ extended --+
|
||||
; 0 0 0 0
|
||||
; 0 0 0 0
|
||||
; Notes:
|
||||
; - extended partition need to be in second entry on table
|
||||
; - it will skip over removed partitions
|
||||
|
||||
set_FAT32_variables:
|
||||
mov [problem_partition],0
|
||||
call reserve_hd1
|
||||
call reserve_hd_channel
|
||||
|
||||
cmp dword [hdpos],0
|
||||
je problem_hd
|
||||
|
||||
pushad
|
||||
xor ecx,ecx ; partition count
|
||||
mov edx,-1 ; flag for partition
|
||||
xor eax,eax ; read MBR
|
||||
xor ebp,ebp ; extended partition start
|
||||
|
||||
new_partition:
|
||||
test ebp,ebp ; is there extended partition?
|
||||
jnz extended_already_set ; yes
|
||||
xchg ebp,eax ; no. set it now
|
||||
|
||||
extended_already_set:
|
||||
add eax,ebp ; mbr=mbr+0, ext_part=ext_start+relat_start
|
||||
mov ebx,buffer
|
||||
call hd_read
|
||||
cmp [hd_error],0
|
||||
jne problem_hd
|
||||
|
||||
cmp word [ebx+0x1fe],0xaa55 ; is it valid boot sector?
|
||||
jnz end_partition_chain
|
||||
cmp dword [ebx+0x1be+0xc],0 ; skip over empty partition
|
||||
jz next_partition
|
||||
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4] ; get primary partition type
|
||||
call scan_partition_types
|
||||
pop eax
|
||||
jnz next_primary_partition ; no. skip over
|
||||
|
||||
inc ecx
|
||||
cmp ecx,[fat32part] ; is it wanted partition?
|
||||
jnz next_primary_partition ; no
|
||||
|
||||
mov edx, eax ; start sector
|
||||
add edx, [ebx+0x1be+8] ; add relative start
|
||||
push edx
|
||||
add edx, [ebx+0x1be+12] ; add length
|
||||
dec edx ; PARTITION_END is inclusive
|
||||
mov [PARTITION_END], edx ; note that this can be changed
|
||||
; when file system data will be available
|
||||
mov dl, [ebx+0x1be+4]
|
||||
mov [fs_type], dl ; save for FS recognizer (separate FAT vs NTFS)
|
||||
pop edx
|
||||
|
||||
next_primary_partition:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4+16] ; get primary partition type
|
||||
call scan_partition_types
|
||||
pop eax
|
||||
jnz next_primary_partition_1 ; no. skip over
|
||||
|
||||
inc ecx
|
||||
cmp ecx,[fat32part] ; is it wanted partition?
|
||||
jnz next_primary_partition_1 ; no
|
||||
|
||||
mov edx, eax
|
||||
add edx, [ebx+0x1be+8+16]
|
||||
push edx
|
||||
add edx, [ebx+0x1be+12+16]
|
||||
dec edx
|
||||
mov [PARTITION_END], edx
|
||||
mov dl, [ebx+0x1be+4+16]
|
||||
mov [fs_type], dl
|
||||
pop edx
|
||||
|
||||
next_primary_partition_1:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4+16+16] ; get primary partition type
|
||||
call scan_partition_types
|
||||
pop eax
|
||||
jnz next_primary_partition_2 ; no. skip over
|
||||
|
||||
inc ecx
|
||||
cmp ecx,[fat32part] ; is it wanted partition?
|
||||
jnz next_primary_partition_2 ; no
|
||||
|
||||
mov edx, eax
|
||||
add edx, [ebx+0x1be+8+16+16]
|
||||
push edx
|
||||
add edx, [ebx+0x1be+12+16+16]
|
||||
dec edx
|
||||
mov [PARTITION_END], edx
|
||||
mov dl, [ebx+0x1be+4+16+16]
|
||||
mov [fs_type], dl
|
||||
pop edx
|
||||
|
||||
next_primary_partition_2:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4+16+16+16] ; get primary partition type
|
||||
call scan_partition_types
|
||||
pop eax
|
||||
jnz next_partition ; no. skip over
|
||||
|
||||
inc ecx
|
||||
cmp ecx,[fat32part] ; is it wanted partition?
|
||||
jnz next_partition ; no
|
||||
|
||||
mov edx, eax
|
||||
add edx, [ebx+0x1be+8+16+16+16]
|
||||
push edx
|
||||
add edx, [ebx+0x1be+12+16+16+16]
|
||||
dec edx
|
||||
mov [PARTITION_END], edx
|
||||
mov dl, [ebx+0x1be+4+16+16+16]
|
||||
mov [fs_type], dl
|
||||
pop edx
|
||||
|
||||
next_partition:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4] ; get extended partition type
|
||||
call scan_extended_types
|
||||
pop eax
|
||||
jnz next_partition_1
|
||||
|
||||
mov eax,[ebx+0x1be+8] ; add relative start
|
||||
test eax,eax ; is there extended partition?
|
||||
jnz new_partition ; yes. read it
|
||||
|
||||
next_partition_1:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4+16] ; get extended partition type
|
||||
call scan_extended_types
|
||||
pop eax
|
||||
jnz next_partition_2
|
||||
|
||||
mov eax,[ebx+0x1be+8+16] ; add relative start
|
||||
test eax,eax ; is there extended partition?
|
||||
jnz new_partition ; yes. read it
|
||||
|
||||
next_partition_2:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4+16+16] ; get extended partition type
|
||||
call scan_extended_types
|
||||
pop eax
|
||||
jnz next_partition_3
|
||||
|
||||
mov eax,[ebx+0x1be+8+16+16] ; add relative start
|
||||
test eax,eax ; is there extended partition?
|
||||
jnz new_partition ; yes. read it
|
||||
|
||||
next_partition_3:
|
||||
push eax
|
||||
mov al,[ebx+0x1be+4+16+16+16] ; get extended partition type
|
||||
call scan_extended_types
|
||||
pop eax
|
||||
jnz end_partition_chain ; no. end chain
|
||||
|
||||
mov eax,[ebx+0x1be+8+16+16+16] ; get start of extended partition
|
||||
test eax,eax ; is there extended partition?
|
||||
jnz new_partition ; yes. read it
|
||||
|
||||
end_partition_chain:
|
||||
mov [partition_count],ecx
|
||||
|
||||
cmp edx,-1 ; found wanted partition?
|
||||
jnz hd_and_partition_ok ; yes. install it
|
||||
jmp problem_partition_or_fat
|
||||
|
||||
scan_partition_types:
|
||||
push ecx
|
||||
mov edi,partition_types
|
||||
mov ecx,partition_types_end-partition_types
|
||||
cld
|
||||
repne scasb ; is partition type ok?
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
scan_extended_types:
|
||||
push ecx
|
||||
mov edi,extended_types
|
||||
mov ecx,extended_types_end-extended_types
|
||||
cld
|
||||
repne scasb ; is it extended partition?
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
problem_fat_dec_count: ; bootsector is missing or another problem
|
||||
dec [partition_count] ; remove it from partition_count
|
||||
|
||||
problem_partition_or_fat:
|
||||
popad
|
||||
|
||||
problem_hd:
|
||||
mov [fs_type],0
|
||||
call free_hd_channel
|
||||
mov [hd1_status],0 ; free
|
||||
mov [problem_partition],1
|
||||
ret
|
||||
|
||||
hd_and_partition_ok:
|
||||
mov eax,edx
|
||||
mov [PARTITION_START],eax
|
||||
mov edx, [PARTITION_END]
|
||||
sub edx, eax
|
||||
inc edx ; edx = length of partition
|
||||
|
||||
; mov [hd_setup],1
|
||||
mov ebx,buffer
|
||||
call hd_read ; read boot sector of partition
|
||||
cmp [hd_error], 0
|
||||
jz boot_read_ok
|
||||
cmp [fs_type], 7
|
||||
jnz problem_fat_dec_count
|
||||
; NTFS duplicates bootsector:
|
||||
; NT4/2k/XP+ saves bootsector copy in the end of disk
|
||||
; NT 3.51 saves bootsector copy in the middle of disk
|
||||
and [hd_error], 0
|
||||
mov eax, [PARTITION_END]
|
||||
call hd_read
|
||||
cmp [hd_error], 0
|
||||
jnz @f
|
||||
call ntfs_test_bootsec
|
||||
jnc boot_read_ok
|
||||
@@:
|
||||
and [hd_error], 0
|
||||
mov eax, edx
|
||||
shr eax, 1
|
||||
add eax, [PARTITION_START]
|
||||
call hd_read
|
||||
cmp [hd_error], 0
|
||||
jnz problem_fat_dec_count ; ¥ áã¤ì¡ ...
|
||||
boot_read_ok:
|
||||
; mov [hd_setup], 0
|
||||
; if we are running on NTFS, check bootsector
|
||||
cmp [fs_type], 7
|
||||
jz ntfs_setup
|
||||
|
||||
cmp word [ebx+0x1fe],0xaa55 ; is it valid boot sector?
|
||||
jnz problem_fat_dec_count
|
||||
|
||||
movzx eax,word [ebx+0xe] ; sectors reserved
|
||||
add eax,[PARTITION_START]
|
||||
mov [FAT_START],eax ; fat_start = partition_start + reserved
|
||||
|
||||
movzx eax,byte [ebx+0xd] ; sectors per cluster
|
||||
mov [SECTORS_PER_CLUSTER],eax
|
||||
|
||||
movzx ecx,word [ebx+0xb] ; bytes per sector
|
||||
mov [BYTES_PER_SECTOR],ecx
|
||||
|
||||
movzx eax,word [ebx+0x11] ; count of rootdir entries (=0 fat32)
|
||||
mov edx,32
|
||||
mul edx
|
||||
dec ecx
|
||||
add eax,ecx ; round up if not equal count
|
||||
inc ecx ; bytes per sector
|
||||
div ecx
|
||||
mov [ROOT_SECTORS],eax ; count of rootdir sectors
|
||||
|
||||
movzx eax,word [ebx+0x16] ; sectors per fat <65536
|
||||
test eax,eax
|
||||
jnz fat16_fatsize
|
||||
mov eax,[ebx+0x24] ; sectors per fat
|
||||
fat16_fatsize:
|
||||
mov [SECTORS_PER_FAT],eax
|
||||
|
||||
movzx eax,byte [ebx+0x10] ; number of fats
|
||||
test eax,eax ; if 0 it's not fat partition
|
||||
jz problem_fat_dec_count
|
||||
mov [NUMBER_OF_FATS],eax
|
||||
imul eax,[SECTORS_PER_FAT]
|
||||
add eax,[FAT_START]
|
||||
mov [ROOT_START],eax ; rootdir = fat_start + fat_size * fat_count
|
||||
add eax,[ROOT_SECTORS] ; rootdir sectors should be 0 on fat32
|
||||
mov [DATA_START],eax ; data area = rootdir + rootdir_size
|
||||
|
||||
movzx eax,word [ebx+0x13] ; total sector count <65536
|
||||
test eax,eax
|
||||
jnz fat16_total
|
||||
mov eax,[ebx+0x20] ; total sector count
|
||||
fat16_total:
|
||||
add eax,[PARTITION_START]
|
||||
dec eax
|
||||
mov [PARTITION_END],eax
|
||||
inc eax
|
||||
sub eax,[DATA_START] ; eax = count of data sectors
|
||||
xor edx,edx
|
||||
div dword [SECTORS_PER_CLUSTER]
|
||||
inc eax
|
||||
mov [LAST_CLUSTER],eax
|
||||
dec eax ; cluster count
|
||||
|
||||
; limits by Microsoft Hardware White Paper v1.03
|
||||
cmp eax,4085 ; 0xff5
|
||||
jb problem_fat_dec_count ; fat12 not supported
|
||||
cmp eax,65525 ; 0xfff5
|
||||
jb fat16_partition
|
||||
|
||||
fat32_partition:
|
||||
mov eax,[ebx+0x2c] ; rootdir cluster
|
||||
mov [ROOT_CLUSTER],eax
|
||||
movzx eax,word [ebx+0x30] ; fs info sector
|
||||
add eax,[PARTITION_START]
|
||||
mov [ADR_FSINFO],eax
|
||||
|
||||
popad
|
||||
|
||||
mov [fatRESERVED],0x0FFFFFF6
|
||||
mov [fatBAD],0x0FFFFFF7
|
||||
mov [fatEND],0x0FFFFFF8
|
||||
mov [fatMASK],0x0FFFFFFF
|
||||
mov [fs_type],32 ; Fat32
|
||||
call free_hd_channel
|
||||
mov [hd1_status],0 ; free
|
||||
ret
|
||||
|
||||
fat16_partition:
|
||||
xor eax,eax
|
||||
mov [ROOT_CLUSTER],eax
|
||||
|
||||
popad
|
||||
|
||||
mov [fatRESERVED],0x0000FFF6
|
||||
mov [fatBAD],0x0000FFF7
|
||||
mov [fatEND],0x0000FFF8
|
||||
mov [fatMASK],0x0000FFFF
|
||||
mov [fs_type],16 ; Fat16
|
||||
call free_hd_channel
|
||||
mov [hd1_status],0 ; free
|
||||
ret
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user