From 9a27b206b31c6d3cb7598c0e048ad4ff3207a85a Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Thu, 3 Aug 2006 19:30:32 +0000 Subject: [PATCH] Added two flags to 0th function (edx = 0xXYRRGGBB, X = DCBAb) A - window has a caption; if Y=3, then caption scting address could be passed in edi, otherwise use function 71/1 B - treat all drawing performed to be relative to window client area D - use gradient fill for client area Added function 71: subfunction 1 - set window caption string address (in ecx) subfunction 2 - get window caption into buffer (not implemented yet) Updated sysfuncr.txt, added sysfuncs.txt git-svn-id: svn://kolibrios.org@114 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sys32.inc | 16 +- kernel/trunk/core/syscall.inc | 1 + kernel/trunk/docs/sysfuncr.txt | 449 ++-- kernel/trunk/docs/sysfuncs.txt | 4285 ++++++++++++++++++++++++++++++++ kernel/trunk/gui/button.inc | 18 +- kernel/trunk/gui/skincode.inc | 128 +- kernel/trunk/gui/skindata.inc | 6 +- kernel/trunk/gui/window.inc | 281 ++- kernel/trunk/kernel.asm | 298 ++- kernel/trunk/kernel32.inc | 108 +- 10 files changed, 5125 insertions(+), 465 deletions(-) create mode 100644 kernel/trunk/docs/sysfuncs.txt diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 7245338c1a..8325063d98 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -797,20 +797,20 @@ terminate: ; terminate application cld shl esi,5 add esi,window_data - mov eax,[esi+WDATA.left] + mov eax,[esi+WDATA.box.left] mov [dlx],eax - add eax,[esi+WDATA.width] + add eax,[esi+WDATA.box.width] mov [dlxe],eax - mov eax,[esi+WDATA.top] + mov eax,[esi+WDATA.box.top] mov [dly],eax - add eax,[esi+WDATA.height] + add eax,[esi+WDATA.box.height] mov [dlye],eax - mov [esi+WDATA.left], 0 - mov [esi+WDATA.width], 5 + mov [esi+WDATA.box.left], 0 + mov [esi+WDATA.box.width], 5 mov eax,[0xFE04] - mov [esi+WDATA.top],eax - mov [esi+WDATA.height], 5 + mov [esi+WDATA.box.top],eax + mov [esi+WDATA.box.height], 5 xor eax, eax mov [esi+16],eax mov [esi+20],eax diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index c0e657bb3e..4f1ebe7fdf 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -143,6 +143,7 @@ iglobal dd sys_internal_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 diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index ba1a76ed7c..0583ca6152 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -1,4 +1,4 @@ -СИСТЕМНЫЕ ФУНКЦИИ ОПЕРАЦИОННОЙ СИСТЕМЫ Kolibri 0.5.3.1 +СИСТЕМНЫЕ ФУНКЦИИ ОПЕРАЦИОННОЙ СИСТЕМЫ Kolibri 0.5.8.1 Номер функции помещается в регистр eax. Вызов системной функции осуществляется командой "int 0x40". @@ -27,9 +27,12 @@ * RR, GG, BB = соответственно красная, зеленая, синяя составляющие цвета рабочей области окна (игнорируется для стиля Y=2) - * X=0 - нормальная заливка рабочей области, - X=8 - градиентная заливка, - остальные значения зарезервированы + * X = DCBA (биты) + * A = 1 - у окна есть заголовок; если Y=3, адрес строки заголовка может быть задан + в edi, иначе - использованием подфункции 1 функции 71 + * B = 1 - рисовать все примитивы относитльно клиентской области окна + * C - зарезервирован + * D = 8 - градиентная заливка клиентской области Следующие параметры предназначены для окон типа I и II и игнорируются для стилей Y=1,3: * esi = 0xXYRRGGBB - цвет заголовка @@ -76,11 +79,11 @@ * Вид окна стиля Y=1: * полностью определяется приложением * Вид окна типа II: - * рисуется внешняя рамка шириной 1 пиксель "затенённого" цвета + * рисуется внешняя рамка шириной 1 пиксель "затен+нного" цвета edi (все составляющие цвета уменьшаются в два раза) * рисуется промежуточная рамка шириной 3 пикселя цвета edi * рисуется внутренняя рамка шириной 1 пиксель - "затенённого" цвета edi + "затен+нного" цвета edi * рисуется заголовок - прямоугольник с левым верхним углом (4,4) и правым нижним (xsize-4,min(20,ysize)) цвета, указанного в esi (с учетом градиента) @@ -134,7 +137,7 @@ Замечания: * Существует общесистемный буфер нажатых клавиш размером 120 байт, организованный как очередь. - * Существует ещё один общесистемный буфер на 120 "горячих клавиш". + * Существует ещ+ один общесистемный буфер на 120 "горячих клавиш". * При вызове этой функции приложением с неактивным окном считается, что буфер нажатых клавиш пуст. * По умолчанию эта функция возвращает ASCII-коды; переключиться на @@ -169,6 +172,9 @@ ====================================================================== ================== Функция 4 - вывести текст в окно. ================= ====================================================================== +Может выводить как строку заданной длины, так и строку, оканчивающуюся +NULL-символом(0x0) - ASCIIZ(string db 'text',0). Чтобы вывести +ASCIIZ-строку поместите в esi -1 (mov esi,-1). Параметры: * eax = 4 - номер функции * ebx = [координата по оси x]*65536 + [координата по оси y] @@ -425,7 +431,7 @@ Возвращаемое значение: * функция не возвращает значения Замечания: - * Функция начала перерисовки удаляет все определённые + * Функция начала перерисовки удаляет все определ+нные функцией 8 кнопки, их следует определить повторно. ====================================================================== @@ -469,7 +475,7 @@ * функция не возвращает значения Замечания: * Проверок на корректность не делается. Установка слишком больших - значений приведёт к тому, что в фон войдут данные за границей + значений привед+т к тому, что в фон войдут данные за границей буфера фонового изображения. Размер буфера = 0x160000-0x10, что соответствует максимальным размерам 800*600. (800*600*3=0x15F900) * Для обновления экрана (после завершения серии команд, работающих с @@ -616,7 +622,7 @@ * Узнать, какое окно является активным, можно вызовом подфункции 7. ====================================================================== - Функция 18, подфункция 4 - получить счётчик пустых тактов в секунду. + Функция 18, подфункция 4 - получить сч+тчик пустых тактов в секунду. ====================================================================== Под пустыми тактами понимается время, в которое процессор простаивает в ожидании прерывания (в инструкции hlt). @@ -625,7 +631,7 @@ * eax = 18 - номер функции * ebx = 4 - номер подфункции Возвращаемое значение: - * eax = значение счётчика пустых тактов в секунду + * eax = значение сч+тчика пустых тактов в секунду ====================================================================== ======== Функция 18, подфункция 5 - получить тактовую частоту. ======= @@ -637,7 +643,7 @@ * eax = тактовая частота (по модулю 2^32 тактов = 4ГГц) ====================================================================== - Функция 18, подфункция 6 - сохранить рамдиск в файл на жёстком диске. + Функция 18, подфункция 6 - сохранить рамдиск в файл на ж+стком диске. ====================================================================== Параметры: * eax = 18 - номер функции @@ -646,18 +652,16 @@ * 1 = в папке "/KOLIBRI" * 2 = в корневом каталоге * 3 = edx указывает на путь (имена папок в формате 8+3, - разделённые '/') + раздел+нные '/') Возвращаемое значение: * eax = 0 - успешно * иначе eax = код ошибки файловой системы Замечания: * Имя файла фиксировано, "menuet.img" (глобальная переменная ядра image_save из preboot.inc) - * На каком разделе какого диска файл будет сохранён, определяется + * На каком разделе какого диска файл будет сохран+н, определяется подфункцией 7 и подфункцией 8 функции 21. - * Ядро предполагает, что во время записи никакая другая программа - не будет обращаться к жёсткому диску. - * Все папки в указанном пути должны существовать, иначе вернётся + * Все папки в указанном пути должны существовать, иначе верн+тся значение 5, "файл не найден". ====================================================================== @@ -671,14 +675,14 @@ активно) Замечания: * Активное окно находится вверху оконного стэка и получает - сообщения обо всём вводе с клавиатуры. + сообщения обо вс+м вводе с клавиатуры. * Сделать окно активным можно вызовом подфункции 3. ====================================================================== ==== Функция 18, подфункция 8 - отключить/разрешить звук спикера. ==== ====================================================================== -При отключённом звуке вызовы подфункции 55 функции 55 игнорируются. -При включённом - направляются на встроенный спикер. +При отключ+нном звуке вызовы подфункции 55 функции 55 игнорируются. +При включ+нном - направляются на встроенный спикер. --------------- Подподфункция 1 - получить состояние. ---------------- Параметры: @@ -686,7 +690,7 @@ * ebx = 8 - номер подфункции * ecx = 1 - номер подподфункции Возвращаемое значение: - * eax = 0 - звук спикера разрешён; 1 - запрещён + * eax = 0 - звук спикера разреш+н; 1 - запрещ+н -------------- Подподфункция 2 - переключить состояние. -------------- Переключает состояния разрешения/запрещения. @@ -738,10 +742,10 @@ и размеры. * Восстановление окна приложения происходит при активизировании подфункцией 3. - * Обычно нет необходимости явно сворачивать/разворачивать своё окно: + * Обычно нет необходимости явно сворачивать/разворачивать сво+ окно: сворачивание окна осуществляется системой при нажатии на кнопку минимизации (которая для окон со скином определяется автоматически - функцией 0, для окон без скина её можно определить функцией 8), + функцией 0, для окон без скина е+ можно определить функцией 8), восстановление - приложением @panel. ====================================================================== @@ -759,7 +763,7 @@ * функция не возвращает значения Формат таблицы: короткая версия: * +0: byte: информация о НГМД (дисководах для дискет), AAAABBBB, - где AAAA задаёт тип первого дисковода, BBBB - второго согласно + где AAAA зада+т тип первого дисковода, BBBB - второго согласно следующему списку: * 0 = нет дисковода * 1 = 360Kb, 5.25'' @@ -770,19 +774,19 @@ Например, для стандартной конфигурации из одного 1.44-дисковода здесь будет 40h, а для случая 1.2Mb на A: и 1.44Mb на B: значение оказывается 24h. - * +1: byte: информация о жёстких дисках и CD-приводах, AABBCCDD, + * +1: byte: информация о ж+стких дисках и CD-приводах, AABBCCDD, где AA соответствует контроллеру IDE0, ..., DD - IDE3: * 0 = устройство отсутствует - * 1 = жёсткий диск + * 1 = ж+сткий диск * 2 = CD-привод Например, в случае HD на IDE0 и CD на IDE2 здесь будет 48h. - * +2: 4 db: число найденных разделов на жёстких дисках с + * +2: 4 db: число найденных разделов на ж+стких дисках с соответственно IDE0,...,IDE3. - При отсутствии жёсткого диска на IDEx соответствующий байт + При отсутствии ж+сткого диска на IDEx соответствующий байт нулевой, при наличии показывает число распознанных разделов, которых может и не быть (если носитель не отформатирован или если файловая система не поддерживается). В текущей версии ядра - для жёстких дисков поддерживаются только FAT16 и FAT32. + для ж+стких дисков поддерживаются только FAT16 и FAT32. * +6: 4 db: зарезервировано Формат таблицы: полная версия: * +0: 10 db: такие же, как и в короткой версии @@ -853,7 +857,7 @@ db 'Kolibri',0 ====================================================================== ====================== Функция 18, подфункция 14 ===================== -======= Ожидать начала обратного хода луча развёртки монитора. ======= +======= Ожидать начала обратного хода луча разв+ртки монитора. ======= ====================================================================== Параметры: * eax = 18 - номер функции @@ -923,7 +927,7 @@ db 'Kolibri',0 * Если eax < 0, то -eax - код ошибки файловой системы Замечания: * Эта функция устарела; используйте подфункцию 7 функции 70. - * Комадная строка должна заканчиваться символом с кодом 0 + * Командная строка должна заканчиваться символом с кодом 0 (ASCIIZ-строка); учитываются либо все символы до завершающего нуля включительно, либо первые 256 символов, в зависимости от того, что меньше. @@ -944,9 +948,9 @@ db 'Kolibri',0 * cl = байт для вывода Возвращаемое значение (одинаково для обеих подфункций): * eax = 0 - успешно - * eax = 1 - не определён базовый порт + * eax = 1 - не определ+н базовый порт Замечания: - * Предварительно должен быть определён базовый порт вызовом + * Предварительно должен быть определ+н базовый порт вызовом подфункции 1 функции 21. ====================================================================== @@ -1065,9 +1069,9 @@ db 'Kolibri',0 ====================================================================== =========== Функция 21, подфункция 7 - установить базу HD. =========== ====================================================================== -База HD нужна для определения, на какой жёсткий диск писать, при +База HD нужна для определения, на какой ж+сткий диск писать, при использовании устаревших функций работы с файловой системой и функций, -неявно использующих жёсткий диск (типа подфункции 6 функции 18); +неявно использующих ж+сткий диск (типа подфункции 6 функции 18); при использовании функций 58 и 70 и современного синтаксиса /HD0,/HD1,/HD2,/HD3 эти функции сами устанавливают базу. Параметры: @@ -1079,17 +1083,17 @@ db 'Kolibri',0 Замечания: * Любое приложение в любой момент времени может изменить базу. * Не следует изменять базу, когда какое-нибудь приложение работает - с жёстким диском. Если не хотите глюков системы. + с ж+стким диском. Если не хотите глюков системы. * Получить установленную базу можно вызовом подфункции 7 функции 26. - * Следует также определить используемый раздел жёсткого диска + * Следует также определить используемый раздел ж+сткого диска подфункцией 8. ====================================================================== ========== Функция 21, подфункция 8 - установить раздел HD. ========== ====================================================================== -Раздел HD нужен для определения, на какой раздел жёсткого диска +Раздел HD нужен для определения, на какой раздел ж+сткого диска писать, при использовании устаревших функций работы с файловой -системой и функций, неявно использующих жёсткий диск (типа +системой и функций, неявно использующих ж+сткий диск (типа подфункции 6 функции 18); при использовании функций 58 и 70 и современного синтаксиса /HD0,/HD1,/HD2,/HD3 эти функции сами устанавливают базу и раздел. @@ -1102,13 +1106,13 @@ db 'Kolibri',0 Замечания: * Любое приложение в любой момент времени может изменить раздел. * Не следует изменять раздел, когда какое-нибудь приложение работает - с жёстким диском. Если не хотите глюков системы. + с ж+стким диском. Если не хотите глюков системы. * Получить установленный раздел можно вызовом подфункции 8 функции 26. * Проверок на корректность не делается. - * Узнать число разделов на жёстком диске можно вызовом + * Узнать число разделов на ж+стком диске можно вызовом подфункции 11 функции 18. - * Следует также определить используемую базу жёсткого диска + * Следует также определить используемую базу ж+сткого диска подфункцией 7. ====================================================================== @@ -1173,7 +1177,7 @@ db 'Kolibri',0 * если драйвер загружен: * eax = 'MDAZ' (в стиле fasm'а, т.е. 'M' - младший байт, 'Z' - старший) - сигнатура - * ebx = текущая частота развёртки (в Гц) + * ebx = текущая частота разв+ртки (в Гц) * ecx разрушается * буфер, на который указывает edx, заполнен Формат буфера: @@ -1184,15 +1188,15 @@ db 'Kolibri',0 * +36 = +0x24: 7*dword: зарезервировано (0 в текущей реализации) * +64 = +0x40: 32*word: список поддерживаемых видеорежимов (каждое слово - номер видеорежима, после собственно списка идут нули) - * +128 = +0x80: 32*(5*word): список поддерживаемых частот развёрток + * +128 = +0x80: 32*(5*word): список поддерживаемых частот разв+рток для видеорежимов: для каждого видеорежима, указанного в предыдущем поле, указано до 5 поддерживаемых частот (в неиспользуемых позициях записаны нули) Замечания: - * Функция инициализирует драйвер (если он ещё не инициализирован) + * Функция инициализирует драйвер (если он ещ+ не инициализирован) и должна вызываться первой, перед остальными (иначе они будут возвращать -1, ничего не делая). - * В текущей реализации поддерживается только одна частота развёртки + * В текущей реализации поддерживается только одна частота разв+ртки на видеорежим. ====================================================================== @@ -1207,13 +1211,13 @@ db 'Kolibri',0 * eax = -1 - драйвер не загружен или не инициализирован; ebx,ecx разрушаются * eax = [ширина]*65536 + [высота] - * ebx = частота вертикальной развёртки (в Гц) + * ebx = частота вертикальной разв+ртки (в Гц) * ecx = номер текущего видеорежима Замечания: * Драйвер предварительно должен быть инициализирован вызовом функции драйвера 1. * Если нужны только размеры экрана, целесообразней использовать - функцию 14 с учётом того, что она возвращает размеры на 1 меньше. + функцию 14 с уч+том того, что она возвращает размеры на 1 меньше. ====================================================================== = Функция 21, подфункция 13, подподфункция 3 - установить видеорежим. @@ -1222,7 +1226,7 @@ db 'Kolibri',0 * eax = 21 - номер функции * ebx = 13 - номер подфункции * ecx = 3 - номер функции драйвера - * edx = [частота развёртки]*65536 + [номер видеорежима] + * edx = [частота разв+ртки]*65536 + [номер видеорежима] Возвращаемое значение: * eax = -1 - драйвер не загружен, не инициализирован или произошла ошибка @@ -1307,7 +1311,7 @@ db 'Kolibri',0 * Вообще-то CMOS поддерживает для будильника установку значения 0xFF в качестве одного из параметров и означает это, что соответствующий параметр игнорируется. Но в текущей реализации - это не пройдёт (вернётся значение 1). + это не пройд+т (верн+тся значение 1). * Будильник - глобальный системный ресурс; установка будильника автоматически отменяет предыдущую установку. Впрочем, на данный момент ни одна программа его не использует. @@ -1315,7 +1319,7 @@ db 'Kolibri',0 ====================================================================== ============== Функция 23 - ожидать события с таймаутом. ============= ====================================================================== -Если очередь сообщений пуста, ждёт появления сообщения в очереди, +Если очередь сообщений пуста, жд+т появления сообщения в очереди, но не более указанного времени. Затем считывает сообщение из очереди. Параметры: @@ -1331,8 +1335,8 @@ db 'Kolibri',0 * Для проверки, есть ли сообщение в очереди, используйте функцию 11. Чтобы ждать сколь угодно долго, используйте функцию 10. * Передача ebx=0 приводит к моментальному возвращению eax=0. - * При текущей реализации произойдёт немедленный возврат из функции - с eax=0, если сложение ebx с текущим значением счётчика времени + * При текущей реализации произойд+т немедленный возврат из функции + с eax=0, если сложение ebx с текущим значением сч+тчика времени вызовет 32-битное переполнение. ====================================================================== @@ -1468,7 +1472,7 @@ db 'Kolibri',0 * eax = база CD: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 Замечания: * База CD используется функцией 24. - * Установлить базу CD можно вызовом подфункции 3 функции 21. + * Установить базу CD можно вызовом подфункции 3 функции 21. ====================================================================== === Функция 26, подфункция 4 - получить базовый порт Sound Blaster. == @@ -1511,9 +1515,9 @@ db 'Kolibri',0 ====================================================================== ============ Функция 26, подфункция 7 - получить базу HD. ============ ====================================================================== -База HD нужна для определения, на какой жёсткий диск писать, при +База HD нужна для определения, на какой ж+сткий диск писать, при использовании устаревших функций работы с файловой системой и функций, -неявно использующих жёсткий диск (типа подфункции 6 функции 18); +неявно использующих ж+сткий диск (типа подфункции 6 функции 18); при использовании функций 58 и 70 и современного синтаксиса /HD0,/HD1,/HD2,/HD3 эти функции сами устанавливают базу. Параметры: @@ -1524,14 +1528,14 @@ db 'Kolibri',0 Замечания: * Любое приложение в любой момент времени может изменить базу. * Установить базу можно вызовом подфункции 7 функции 21. - * Получить используемый раздел жёсткого диска можно подфункцией 8. + * Получить используемый раздел ж+сткого диска можно подфункцией 8. ====================================================================== =========== Функция 26, подфункция 8 - получить раздел HD. =========== ====================================================================== -Раздел HD нужен для определения, на какой раздел жёсткого диска +Раздел HD нужен для определения, на какой раздел ж+сткого диска писать, при использовании устаревших функций работы с файловой -системой и функций, неявно использующих жёсткий диск (типа +системой и функций, неявно использующих ж+сткий диск (типа подфункции 6 функции 18); при использовании функций 58 и 70 и современного синтаксиса /HD0,/HD1,/HD2,/HD3 эти функции сами устанавливают базу и раздел. @@ -1543,12 +1547,12 @@ db 'Kolibri',0 Замечания: * Любое приложение в любой момент времени может изменить раздел. * Установить раздел можно вызовом подфункции 8 функции 21. - * Узнать число разделов на жёстком диске можно вызовом + * Узнать число разделов на ж+стком диске можно вызовом подфункции 11 функции 18. - * Получить используемую базу жёсткого диска можно подфункцией 7. + * Получить используемую базу ж+сткого диска можно подфункцией 7. ====================================================================== -=== Функция 26, подфункция 9 - получить значение счётчика времени. === +=== Функция 26, подфункция 9 - получить значение сч+тчика времени. === ====================================================================== Параметры: * eax = 26 - номер функции @@ -1557,7 +1561,7 @@ db 'Kolibri',0 * eax = число сотых долей секунды, прошедших с момента запуска системы Замечания: - * Счётчик берётся по модулю 2^32, что соответствует немногим более + * Сч+тчик бер+тся по модулю 2^32, что соответствует немногим более 497 суток. * Системное время можно получить функцией 3. @@ -1576,13 +1580,13 @@ db 'Kolibri',0 ====================================================================== ====================== Функция 26, подфункция 11 ===================== -=========== Узнать, разрешён ли низкоуровневый доступ к HD. ========== +=========== Узнать, разреш+н ли низкоуровневый доступ к HD. ========== ====================================================================== Параметры: * eax = 26 - номер функции * ebx = 11 - номер подфункции Возвращаемое значение: - * eax = 0/1 - запрещён/разрешён + * eax = 0/1 - запрещ+н/разреш+н Замечания: * Используется при LBA-чтении (подфункция 8 функции 58). * Установить текущее состояние можно вызовом @@ -1590,13 +1594,13 @@ db 'Kolibri',0 ====================================================================== ====================== Функция 26, подфункция 12 ===================== -========== Узнать, разрешён ли низкоуровневый доступ к PCI. ========== +========== Узнать, разреш+н ли низкоуровневый доступ к PCI. ========== ====================================================================== Параметры: * eax = 26 - номер функции * ebx = 12 - номер подфункции Возвращаемое значение: - * eax = 0/1 - запрещён/разрешён + * eax = 0/1 - запрещ+н/разреш+н Замечания: * Используется при работе с шиной PCI (функция 62). * Текущая реализация использует только младший бит ecx. @@ -1695,7 +1699,7 @@ db 'Kolibri',0 * Эта функция устарела; функция 58 позволяет выполнять те же действия с расширенными возможностями. * Если указать ненулевое значение в esi и на рамдиске уже есть - указанный файл, то будет создан ещё один файл с тем же именем. + указанный файл, то будет создан ещ+ один файл с тем же именем. * В противном случае файл перезаписывается. * Имя файла должно быть либо в формате 8+3 символов (первые 8 символов - собственно имя, последние 3 - расширение, @@ -1746,7 +1750,7 @@ db 'Kolibri',0 Если y>=ywnd, то младшее слово неотрицательно и содержит относительную y-координату, а старшее - относительную x-координату (правильного знака). В противном случае младшее слово отрицательно - и всё равно содержит относительную y-координату, + и вс+ равно содержит относительную y-координату, а к старшему слову следует прибавить 1. ----------------- Подфункция 2 - нажатые кнопки мыши ----------------- @@ -1823,7 +1827,7 @@ db 'Kolibri',0 ======== Функция 40 - установить маску для ожидаемых событий. ======== ====================================================================== Маска для ожидаемых событий влияет на функции работы с событиями 10, -11, 23 - они сообщают только о событиях, разрешённых этой маской. +11, 23 - они сообщают только о событиях, разреш+нных этой маской. Параметры: * eax = 40 - номер функции * ebx = маска: бит i соответствует событию i+1 (см. список событий) @@ -1834,7 +1838,7 @@ db 'Kolibri',0 * Маска по умолчанию (7=111b) разрешает извещения о перерисовке и нажатиях клавиш и кнопок. Этого достаточно для большинства приложений. - * События, запрещённые в маске, всё равно сохраняются, если + * События, запрещ+нные в маске, вс+ равно сохраняются, если приходят; о них просто не извещают функции работы с событиями. * Функции работы с событиями учитывают маску на момент вызова функции, а не на момент поступления сообщения. @@ -1867,8 +1871,8 @@ db 'Kolibri',0 * eax = 0 * ecx = 1 * ebx разрушается - * если всё в порядке и данные были: - * eax = размер данных, ещё не прочитанных из буфера (в байтах) + * если вс+ в порядке и данные были: + * eax = размер данных, ещ+ не прочитанных из буфера (в байтах) * ecx = 0 * ebx = очередной байт Замечания: @@ -1896,7 +1900,7 @@ db 'Kolibri',0 * ebx игнорируется * ecx = 0x8000nnnn, где nnnn = номер порта (от 0 до 0xFFFF) Возвращаемое значение: - * eax = 0 - успешно, при этом ebx = введённый байт + * eax = 0 - успешно, при этом ebx = введ+нный байт * eax = 1 - поток не зарезервировал данный порт Замечания: * Предварительно поток должен зарезервировать за собой @@ -1904,7 +1908,7 @@ db 'Kolibri',0 * Для зарезервированных портов вместо вызова этих функций лучше использовать команды процессора in/out - это значительно быстрее и несколько короче и проще. Из незарезервированных - портов читать всё равно нельзя. + портов читать вс+ равно нельзя. ====================================================================== ======== Функция 44 - определить действия при поступлении IRQ. ======= @@ -2034,7 +2038,7 @@ db 'Kolibri',0 * ebx = 1 - номер подфункции * ecx = тип кнопок: * 0 = плоские - * 1 = объёмные + * 1 = объ+мные Возвращаемое значение: * функция не возвращает значения Замечания: @@ -2059,7 +2063,7 @@ db 'Kolibri',0 подфункцией 0. * Таблица стандартных цветов влияет только на приложения, которые эту таблицу явным образом получают (подфункцией 3) и - используют (указывая цвета из неё при вызовах функций рисования). + используют (указывая цвета из не+ при вызовах функций рисования). * Таблица стандартных цветов входит в скин и устанавливается заново при установке скина (подфункции 8). * Таблицу цветов можно просматривать/изменять интерактивно с помощью @@ -2094,11 +2098,11 @@ dword- Замечания: * Структура таблицы цветов описана в стандартном включаемом файле macros.inc под названием system_colors; например, можно писать: - sc system_colors ; объявление переменной - ... ; где-то надо вызвать - ; описываемую функцию с ecx=sc - mov ecx, [sc.work_button_text] ; читаем цвет текста - ; на кнопке в рабочей области + sc system_colors ; объявление переменной + ... ; где-то надо вызвать + ; описываемую функцию с ecx=sc + mov ecx, [sc.work_button_text] ; читаем цвет текста + ; на кнопке в рабочей области * Использование/неиспользование этих цветов - дело исключительно самой программы. Для использования нужно просто при вызове функций рисования указывать цвет, взятый из этой таблицы. @@ -2205,7 +2209,7 @@ dword- поле промежуточного буфера и указано имя файла Возвращаемое значение: * eax = 0 - успешно - * иначе eax = код ошибки файловой системы; если файл не задаёт скин, + * иначе eax = код ошибки файловой системы; если файл не зада+т скин, то возвращается ошибка 3 (неизвестная файловая система). Замечания: * При успешной загрузке скина все окна извещаются о необходимости @@ -2240,7 +2244,7 @@ dword- ================= Функция 50 - установка формы окна. ================= ====================================================================== Обычные окна представляют собой прямоугольники. С помощью этой функции -окну можно придать произвольную форму. Форма задаётся набором точек +окну можно придать произвольную форму. Форма зада+тся набором точек внутри обрамляющего прямоугольника, принадлежащих окну. Положение и размеры обрамляющего прямоугольника задаются функцией 0 и изменяются функцией 67. @@ -2257,7 +2261,7 @@ dword- Параметры: * eax = 50 - номер функции * ebx = 1 - номер подфункции - * ecx задаёт масштаб: каждый байт данных определяет + * ecx зада+т масштаб: каждый байт данных определяет (2^scale)*(2^scale) пикселей Возвращаемое значение: * функция не возвращает значения @@ -2451,8 +2455,8 @@ dword- * eax = 53 - номер функции * ebx = 0 - номер подфункции * ecx = локальный порт (учитывается только младшее слово) - * edx = удалённый порт (учитывается только младшее слово) - * esi = удалённый IP + * edx = удал+нный порт (учитывается только младшее слово) + * esi = удал+нный IP Возвращаемое значение: * eax = -1 = 0xFFFFFFFF - ошибка; ebx разрушается * eax = хэндл сокета (некоторое число, однозначно идентифицирующее @@ -2500,9 +2504,9 @@ dword- * ecx = хэндл сокета Возвращаемое значение: * если нет принятых данных: eax=0, bl=0, - прочие байты ebx разрушаются + прочие биты ebx разрушаются * если были принятые данные: eax=число оставшихся байт - (возможно, 0), bl=прочитанный байт, прочие байты ebx разрушаются + (возможно, 0), bl=прочитанный байт, прочие биты ebx разрушаются Замечания: * Проверки корректности не производится. @@ -2521,7 +2525,7 @@ dword- * eax = 0 - успешно * ebx разрушается Замечания: - * Проверка на валидность хэндла минимальна - исключаются только + * Проверка на правильность хэндла минимальна - исключаются только не очень неправильные неоткрытые хэндлы. * Число байт для записи не может превышать 1500-28, хотя соответствующей проверки не делается. @@ -2533,8 +2537,8 @@ dword- * eax = 53 - номер функции * ebx = 5 - номер подфункции * ecx = локальный порт (учитывается только младшее слово) - * edx = удалённый порт (учитывается только младшее слово) - * esi = удалённый IP + * edx = удал+нный порт (учитывается только младшее слово) + * esi = удал+нный IP * edi = режим открытия: SOCKET_PASSIVE=0 или SOCKET_ACTIVE=1 Возвращаемое значение: * eax = -1 = 0xFFFFFFFF - ошибка; ebx разрушается @@ -2581,7 +2585,7 @@ dword- * eax = 0 - успешно * ebx разрушается Замечания: - * Проверка на валидность хэндла минимальна - исключаются только + * Проверка на правильность хэндла минимальна - исключаются только не очень неправильные неоткрытые хэндлы. * Число байт для записи не может превышать 1500-40, хотя соответствующей проверки не делается. @@ -2639,7 +2643,7 @@ dword- * 201: размер таблицы ARP (в элементах) (20 в текущей версии) * 202: прочитать элемент edx таблицы ARP во временный буфер, откуда берут информацию 5 последующих типов; - в этом случае eax неопределён + в этом случае eax неопредел+н * 203: IP-адрес, запомненный типом 202 * 204: старшее dword MAC-адреса, запомненного типом 202 * 205: младшее word MAC-адреса, запомненного типом 202 @@ -2675,9 +2679,9 @@ dword- * функция не возвращает значения Замечания: * Предварительно данные должны быть загружены подфункцией 0 и - определён их формат подфункцией 2. + определ+н их формат подфункцией 2. * Функция возвращает управление, когда началось проигрывание данных; - после этого проигрывание идёт независимо от приложения (и вообще + после этого проигрывание ид+т независимо от приложения (и вообще не требует загрузки процессора). * Предварительно должны быть определены базовый порт SB16 (подфункцией 4 функции 21) и канал DMA @@ -2715,18 +2719,18 @@ dword- * esi = указатель на данные Возвращаемое значение: * eax = 0 - успешно - * eax = 55 - ошибка (спикер отключён или занят) + * eax = 55 - ошибка (спикер отключ+н или занят) Данные - это массив элементов переменной длины. Формат каждого элемента определяется первым байтом: * 0 = конец данных - * 1..0x80 = задаёт длительность звучания в сотых долях секунды + * 1..0x80 = зада+т длительность звучания в сотых долях секунды ноты, определяемой непосредственным значением частоты * следующее слово (2 байта) содержит делитель частоты; частота определяется как 1193180/divider * 0x81 = invalid * 0x82..0xFF = нота, определяемая октавой и номером: * длительность в сотых долях секунды = (первый байт)-0x81 - * присутствует ещё один байт; + * присутствует ещ+ один байт; * (второй байт)=0xFF - пауза * иначе он имеет вид a*0x10+b, где b=номер ноты в октаве от 1 до 12, a=номер октавы (считая с 0) @@ -2734,12 +2738,12 @@ dword- * Пищание спикером может быть запрещено/разрешено подфункцией 8 функции 18. * Функция возвращает управление, сообщив куда следует информацию - о запросе. Само проигрывание идёт независимо от программы. + о запросе. Само проигрывание ид+т независимо от программы. * Данные должны сохраняться в памяти по крайней мере до конца проигрывания. ====================================================================== -============= Функция 56 - записать файл на жёсткий диск. ============ +============= Функция 56 - записать файл на ж+сткий диск. ============ ====================================================================== Параметры: * eax = 56 - номер функции @@ -2752,11 +2756,11 @@ dword- Замечания: * Эта функция устарела; функция 70 позволяет выполнять те же действия с расширенными возможностями. - * Данная функция предполагает, что во время её вызова одним + * Данная функция предполагает, что во время е+ вызова одним приложением никакое другое приложение не работает - с жёстким диском. + с ж+стким диском. * Путь к файлу - ASCIIZ-строка, которая может быть пустой - (если файл создаётся в корневом каталоге) или иметь формат + (если файл созда+тся в корневом каталоге) или иметь формат /d1/d2/.../dn, где все имена папок должны иметь формат 8+3, т.е. 8 символов имени и 3 символа расширения без разделителя, при необходимости дополненные пробелами; @@ -2791,7 +2795,7 @@ dword- * /RD/1 = /RAMDISK/1 для доступа к рамдиску * /FD/1 = /FLOPPYDISK/1 для доступа к первому флоппи-дисководу, /FD/2 = /FLOPPYDISK/2 для второго флоппи-дисковода - * /HD/x = /HARDDISK/x - устаревший вариант доступа к жёсткому диску + * /HD/x = /HARDDISK/x - устаревший вариант доступа к ж+сткому диску (в этом случае база определяется подфункцией 7 функции 21), x - номер раздела (считая с 1) * /HD0/x, /HD1/x, /HD2/x, /HD3/x для доступа соответственно @@ -2842,7 +2846,7 @@ dword- * +12 = +0xC: dword: указатель на буфер, куда будут записаны данные * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании Возвращаемое значение: * eax = 0 - успешно, иначе код ошибки файловой системы @@ -2857,7 +2861,7 @@ dword- документации по FAT. * Размер папки определяется по размеру цепочки кластеров в FAT. * Если файл кончился раньше, чем был прочитан последний запрошенный - блок, то функция прочитает, сколько сможет, после чего вернёт + блок, то функция прочитает, сколько сможет, после чего верн+т eax=6 (EOF). * Функция позволяет читать корневые папки /rd/1,/fd/x,/hd[n]/x, но в первых двух случаях текущая реализация не следует @@ -2871,7 +2875,7 @@ dword- 0x1C00=7168 байт; но возвращается ebx=0 (за исключением случая предыдущего пункта); * как ни странно, можно прочитать 14-й блок (там, вообще говоря, - мусор - напоминаю, счёт ведётся с 0); + мусор - напоминаю, сч+т вед+тся с 0); * если был запрошен хотя бы один блок с номером, не меньшим 14, то возвращается eax=6(EOF); иначе eax=0. Для /fd/x: @@ -2893,7 +2897,7 @@ dword- ====================================================================== ============ Функция 58, подфункция 1 - перезаписать файл. =========== ====================================================================== -Если файл не существует, он создаётся. +Если файл не существует, он созда+тся. Если файл существует, он перезаписывается. Параметры: * eax = 58 - номер функции @@ -2905,7 +2909,7 @@ dword- * +12 = +0xC: dword: указатель на данные для записи * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании Возвращаемое значение: * eax = 0 - успешно, иначе код ошибки файловой системы @@ -2926,14 +2930,14 @@ dword- * +12 = +0xC: dword: игнорируется * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании Возвращаемое значение: * eax = 0 - успешно, иначе код ошибки файловой системы * ebx разрушается Замечания: * При работе с дискетой не следует удалять непустую папку. - Код работы с жёстким диском непустые папки удаляет корректно + Код работы с ж+стким диском непустые папки удаляет корректно (т.е. рекурсивно со всеми файлами и вложенными папками). Рамдиск папок не поддерживает. @@ -2950,20 +2954,20 @@ dword- * +12 = +0xC: dword: указатель на данные для записи * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании Возвращаемое значение: * eax = 0 - успешно, иначе код ошибки файловой системы * ebx разрушается Замечания: * Рамдиск и дискеты не поддерживают эту функцию, она только для - жёстких дисков. + ж+стких дисков. * Файл должен уже существовать (иначе возвращается 5, not found). Для создания файлов используйте подфункцию 1. * Если начальная позиция больше размера файла, возвращается eax=6(EOF). Если конечная позиция больше размера файла, файл расширяется. - * Код обработки записи данных для жёсткого диска интерпретирует + * Код обработки записи данных для ж+сткого диска интерпретирует нулевое значение поля +8 как указание усечения файла до размера, указанного в поле +4. Однако код обработки 58-й функции блокирует эту возможность для приложений, сразу возвращая управление @@ -2982,14 +2986,14 @@ dword- * +12 = +0xC: dword: игнорируется * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании Возвращаемое значение: * eax = 0 - успешно, иначе код ошибки файловой системы * ebx разрушается Замечания: * Рамдиск и дискеты не поддерживают эту функцию, - она только для жёстких дисков. + она только для ж+стких дисков. ====================================================================== == Функция 58, подфункция 5 - переименовать/переместить файл/папку. == @@ -3004,21 +3008,21 @@ dword- * +12 = +0xC: dword: игнорируется * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании * +20+n: (сразу после завершающего нулевого символа) новое ASCIIZ-имя, должно начинаться с /hd/1, что интерпретируется как - жёсткий диск, указанный в первом имени + ж+сткий диск, указанный в первом имени (перемещение с одного диска на другой не поддерживается) Возвращаемое значение: * eax = 0 - успешно, иначе код ошибки файловой системы * ebx разрушается Замечания: * Рамдиск и дискеты не поддерживают эту функцию, - она только для жёстких дисков. + она только для ж+стких дисков. * Если новое ASCIIZ-имя сильно неправильное, т.е. не начинается с /hd/1, /hd/first, /harddisk/1, /harddisk/first или после этого - начала идёт пробел или символ с кодом 0, то функция возвращает, + начала ид+т пробел или символ с кодом 0, то функция возвращает, как ни странно, код ошибки 4. Это единственная функция, которая вообще возвращает этот код. @@ -3050,7 +3054,7 @@ dword- (за исключением предыдущего случая): * eax = 5 * ebx не меняется - * если LBA-доступ запрещён подфункцией 11 функции 21: + * если LBA-доступ запрещ+н подфункцией 11 функции 21: * eax = 2 * ebx разрушается * для рамдиска: попытка чтения блока за пределами рамдиска @@ -3063,17 +3067,17 @@ dword- * Размер блока - 512 байт; читается один блок. * Не следует полагаться на возвращаемое значение, оно может измениться в следующих версиях. - * Требуется, чтобы был разрешён LBA-доступ к устройствам + * Требуется, чтобы был разреш+н LBA-доступ к устройствам подфункцией 11 функции 21. Узнать это можно вызовом подфункцией 11 функции 26. * LBA-чтение дискеты не поддерживается. - * Функция считывает данные физического жёсткого диска; + * Функция считывает данные физического ж+сткого диска; если по каким-то причинам нужны данные конкретного раздела, - придётся определять начальный сектор этого раздела + прид+тся определять начальный сектор этого раздела (либо напрямую через MBR, либо из расширенной структуры, возвращаемой той же подфункцией 11 функции 18). - * Функция не проверяет код ошибки жёсткого диска, так что запрос - несуществующего сектора всё равно что-то прочитает + * Функция не проверяет код ошибки ж+сткого диска, так что запрос + несуществующего сектора вс+ равно что-то прочитает (вероятнее всего, нули, но это определяется устройством) и это будет считаться успехом (eax=0). @@ -3100,7 +3104,7 @@ dword- * ebx = общее число кластеров = 2847 * ecx = число свободных кластеров * dword [fileinfo] = размер кластера = 512 - * для жёсткого диска: база и раздел определяются подфункциями 7 и 8 + * для ж+сткого диска: база и раздел определяются подфункциями 7 и 8 функции 21: * eax = 0 (успех) * ebx = общее число кластеров @@ -3113,10 +3117,10 @@ dword- pushad-структуры, передающейся как аргумент системной функции). Теперь это исправлено, так что, возможно, имеет смысл возвращать размер кластера в edx, пока эту функцию не начали использовать. - * Вообще-то ещё существует подфункция 11 функции 18, возвращающая + * Вообще-то ещ+ существует подфункция 11 функции 18, возвращающая информацию о файловой системе. По расширенной таблице дисковой подсистемы можно определить размер кластера (там он хранится - в секторах) и общее число кластеров для жёстких дисков. + в секторах) и общее число кластеров для ж+стких дисков. ====================================================================== ========== Функция 58, подфункция 16 - запустить программу. ========== @@ -3133,7 +3137,7 @@ dword- * +12 = +0xC: dword: игнорируется * +16 = +0x10: dword: указатель на буфер для работы системы (4096 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании Возвращаемое значение: * eax > 0 - программа загружена, eax содержит PID @@ -3141,11 +3145,11 @@ dword- код ошибки файловой системы Замечания: * Эта функция устарела, используйте подфункцию 7 функции 70. - * Комадная строка должна заканчиваться символом с кодом 0 + * Командная строка должна заканчиваться символом с кодом 0 (ASCIIZ-строка); учитываются либо все символы до завершающего нуля включительно, либо первые 256 символов, в зависимости от того, что меньше. - * Если процесс запускается как отлаживаемый, он создаётся + * Если процесс запускается как отлаживаемый, он созда+тся в замороженном состоянии; для запуска используйте подфункцию 5 функции 69. @@ -3183,7 +3187,7 @@ dword- из ядра убрать совсем, вместе с приложением systrace. * Информация о системных вызовах сохраняется в системном кольцевом буфере на 0x10 входов. - Эта функция просто копирует указанный объём данных + Эта функция просто копирует указанный объ+м данных из упомянутого буфера по указанному адресу. * Какой из входов в буфере соответствует последнему вызову, можно определить по значению eax, а именно, @@ -3206,7 +3210,7 @@ IPC интерпретировать конкретное сообщение. -------- Подфункция 1 - установить область для получения IPC --------- -Вызывается процессом-приёмником. +Вызывается процессом-при+мником. Параметры: * eax = 60 - номер функции * ebx = 1 - номер подфункции @@ -3233,21 +3237,21 @@ IPC Параметры: * eax = 60 - номер функции * ebx = 2 - номер подфункции - * ecx = PID приёмника + * ecx = PID при+мника * edx = указатель на данные сообщения * esi = длина сообщения (в байтах) Возвращаемое значение: * eax = 0 - успешно - * eax = 1 - приёмник не определил буфер для IPC-сообщений - (может быть, ещё не успел, а может быть, это не тот поток, + * eax = 1 - при+мник не определил буфер для IPC-сообщений + (может быть, ещ+ не успел, а может быть, это не тот поток, который нужен) - * eax = 2 - приёмник заблокировал IPC-буфер; + * eax = 2 - при+мник заблокировал IPC-буфер; попробуйте немного подождать - * eax = 3 - переполнение IPC-буфера приёмника + * eax = 3 - переполнение IPC-буфера при+мника * eax = 4 - процесса/потока с таким PID не существует Замечания: * Система сразу после записи IPC-сообщения в буфер посылает - потоку-приёмнику событие с кодом 7 (см. коды событий). + потоку-при+мнику событие с кодом 7 (см. коды событий). ====================================================================== === Функция 61 - получить параметры для прямого доступа к графике. === @@ -3255,10 +3259,10 @@ IPC Программе доступны данные графического экрана (область памяти, которая собственно и отображает содержимое экрана) напрямую без вызовов системных функций через селектор gs: - mov eax, [gs:0] + mov eax, [gs:0] поместит в eax первый dword буфера, содержащий информацию о цвете левой верхней точки (и, возможно, цвета нескольких следующих). - mov [gs:0], eax + mov [gs:0], eax при работе в режимах VESA c LFB установит цвет левой верхней точки (и возможно, цвета нескольких следующих). @@ -3276,7 +3280,7 @@ IPC собственно LFB, так что чтение/запись по gs приводят непосредственно к изменению содержимого экрана. При работе в видеорежимах без LFB gs указывает на некоторую область данных - ядра, причём все функции вывода на экран добросовестно выполняют + ядра, прич+м все функции вывода на экран добросовестно выполняют двойную работу по записи непосредственно на экран и по записи в этот буфер. В результате при чтении содержимого этого буфера результаты соответствуют содержимому экрана @@ -3293,7 +3297,7 @@ IPC Возвращаемое значение: * eax = [разрешение по оси x]*65536 + [разрешение по оси y] Замечания: - * Можно использовать функцию 14 с учётом того, что она возвращает + * Можно использовать функцию 14 с уч+том того, что она возвращает размеры на 1 меньше. Это полностью эквивалентный способ. ------------------------ Число бит на пиксель ------------------------ @@ -3308,7 +3312,7 @@ IPC * eax = 61 - номер функции * ebx = 3 - номер подфункции Возвращаемое значение: - * eax = число байт, которое занимает одна строка развёртки + * eax = число байт, которое занимает одна строка разв+ртки (горизонтальная линия на экране) ====================================================================== @@ -3318,13 +3322,13 @@ IPC * eax = 62 - номер функции * bl = 0 - номер подфункции Возвращаемое значение: - * eax = -1 - доступ к PCI запрещён; иначе + * eax = -1 - доступ к PCI запрещ+н; иначе * ah.al = версия PCI-интерфейса (ah=версия, al=подверсия) * старшее слово eax обнулено Замечания: - * Предварительно должен быть разрешён низкоуровневый доступ к PCI + * Предварительно должен быть разреш+н низкоуровневый доступ к PCI для приложений подфункцией 12 функции 21. - * Если PCI BIOS не поддерживается, то значение ax неопределено. + * Если PCI BIOS не поддерживается, то значение ax не определено. ====================================================================== ==== Функция 62, подфункция 1 - получить номер последней PCI-шины. === @@ -3333,12 +3337,12 @@ IPC * eax = 62 - номер функции * bl = 1 - номер подфункции Возвращаемое значение: - * eax = -1 - доступ к PCI запрещён; иначе - * al = номер последней PCI-шины; оставшиеся байты eax разрушаются + * eax = -1 - доступ к PCI запрещ+н; иначе + * al = номер последней PCI-шины; оставшиеся биты eax разрушаются Замечания: - * Предварительно должен быть разрешён низкоуровневый доступ к PCI + * Предварительно должен быть разреш+н низкоуровневый доступ к PCI для приложений подфункцией 12 функции 21. - * Если PCI BIOS не поддерживается, то значение al неопределено. + * Если PCI BIOS не поддерживается, то значение al не определено. ====================================================================== ====================== Функция 62, подфункция 2 ====================== @@ -3348,10 +3352,10 @@ IPC * eax = 62 - номер функции * bl = 2 - номер подфункции Возвращаемое значение: - * eax = -1 - доступ к PCI запрещён; иначе - * al = механизм (1 или 2); прочие байты eax разрушаются + * eax = -1 - доступ к PCI запрещ+н; иначе + * al = механизм (1 или 2); прочие биты eax разрушаются Замечания: - * Предварительно должен быть разрешён низкоуровневый доступ к PCI + * Предварительно должен быть разреш+н низкоуровневый доступ к PCI для приложений подфункцией 12 функции 21. * Механизм обращения выбирается в соответствии с характеристиками оборудования. @@ -3369,15 +3373,15 @@ IPC * bh = номер PCI-шины * ch = dddddfff, где ddddd = номер устройства на шине, fff = номер функции устройства - * cl = номер регистра (должен быть чётным для bl=5, + * cl = номер регистра (должен быть ч+тным для bl=5, делиться на 4 для bl=6) Возвращаемое значение: - * eax = -1 - ошибка (запрещён доступ к PCI или + * eax = -1 - ошибка (запрещ+н доступ к PCI или неподдерживаемые параметры); иначе * al/ax/eax (в зависимости от запрошенного размера) содержит данные; оставшаяся часть регистра eax разрушается Замечания: - * Предварительно должен быть разрешён низкоуровневый доступ к PCI + * Предварительно должен быть разреш+н низкоуровневый доступ к PCI для приложений подфункцией 12 функции 21. * Механизм доступа 2 поддерживает только 16 устройств на шине и игнорирует номер функции. Получить механизм доступа можно вызовом @@ -3400,16 +3404,16 @@ IPC * bh = номер PCI-шины * ch = dddddfff, где ddddd = номер устройства на шине, fff = номер функции устройства - * cl = номер регистра (должен быть чётным для bl=9, + * cl = номер регистра (должен быть ч+тным для bl=9, делиться на 4 для bl=10) * dl/dx/edx (в зависимости от запрошенного размера) содержит данные для записи Возвращаемое значение: - * eax = -1 - ошибка (запрещён доступ к PCI или + * eax = -1 - ошибка (запрещ+н доступ к PCI или неподдерживаемые параметры) * eax = 0 - успешно Замечания: - * Предварительно должен быть разрешён низкоуровневый доступ к PCI + * Предварительно должен быть разреш+н низкоуровневый доступ к PCI для приложений подфункцией 12 функции 21. * Механизм доступа 2 поддерживает только 16 устройств на шине и игнорирует номер функции. Получить механизм доступа можно вызовом @@ -3427,16 +3431,16 @@ IPC данные и из которого другая программа может эти данные прочитать. Есть соглашение, в соответствии с которым записываемые данные - текстовые строки, интерпретируемые как отладочные сообщения о ходе -выполнения программы. Ядро в определённых ситуациях также записывает +выполнения программы. Ядро в определ+нных ситуациях также записывает на доску отладки сведения о выполнении некоторых функций; по соглашению сообщения ядра начинаются с префикса "K : ". Для просмотра доски отладки создано приложение board, -которое считывает данные из буфера и отображает их в своём окне. board +которое считывает данные из буфера и отображает их в сво+м окне. board понимает последовательность кодов 13,10 как переход на новую строку. Символ с нулевым кодом в конце строки не обязателен, но и не мешает. В связи с появлением отладчика ценность доски отладки несколько снизилась, поскольку отладчик позволяет полностью контролировать ход -выполнения программы, причём для этого не требуется никаких усилий +выполнения программы, прич+м для этого не требуется никаких усилий со стороны самой программы. Тем не менее во многих случаях доска отладки продолжает оставаться полезной. @@ -3483,7 +3487,7 @@ IPC ================= Функция 66 - работа с клавиатурой. ================= ====================================================================== Режим ввода влияет на результаты чтения клавиш функцией 2. -При загрузке программы для неё устанавливается ASCII-режим ввода. +При загрузке программы для не+ устанавливается ASCII-режим ввода. -------- Подфункция 1 - установить режим ввода с клавиатуры. --------- Параметры: @@ -3514,14 +3518,14 @@ IPC * бит 3 (маска 8): правый Ctrl нажат * бит 4 (маска 0x10): левый Alt нажат * бит 5 (маска 0x20): правый Alt нажат - * бит 6 (маска 0x40): CapsLock включён - * бит 7 (маска 0x80): NumLock включён - * бит 8 (маска 0x100): ScrollLock включён + * бит 6 (маска 0x40): CapsLock включ+н + * бит 7 (маска 0x80): NumLock включ+н + * бит 8 (маска 0x100): ScrollLock включ+н * прочие биты сброшены ----- Подфункция 4 - установить общесистемную "горячую клавишу". ----- О нажатии "горячей клавиши" извещаются только приложения, -установившие её; активное приложение (к которому поступает +установившие е+; активное приложение (к которому поступает весь нормальный ввод) таких клавиш не получает. Извещение заключается в посылке события с кодом 2. Прочитать "горячую клавишу" можно так же, как и обычную, - @@ -3529,10 +3533,10 @@ IPC Параметры: * eax = 66 - номер функции * ebx = 4 - номер подфункции - * cl задаёт сканкод клавиши; + * cl зада+т сканкод клавиши; используйте cl=0 для задания комбинаций типа Ctrl+Shift - * edx = 0xXYZ задаёт возможные состояния управляющих клавиш: - * Z (младшие 4 бита) задаёт состояние клавиш LShift и RShift: + * edx = 0xXYZ зада+т возможные состояния управляющих клавиш: + * Z (младшие 4 бита) зада+т состояние клавиш LShift и RShift: * 0 = ни одна из клавиш не должна быть нажата; * 1 = ровно одна из клавиш должна быть нажата; * 2 = обе клавиши должны быть нажаты; @@ -3580,7 +3584,7 @@ IPC * Значение -1 для параметра означает "не изменять"; например, для перемещения окна без изменения размеров можно указать edx=esi=-1. * Предварительно окно должно быть определено функцией 0. - Она же задаёт начальные координаты и размеры окна. + Она же зада+т начальные координаты и размеры окна. * Размеры окна понимаются в смысле функции 0, т.е. на один пиксель меньше, чем реальные размеры. * Вызов функции для максимизированных окон просто игнорируется. @@ -3590,7 +3594,7 @@ IPC * Функция посылает окну событие перерисовки (с кодом 1). ====================================================================== -=== Функция 68, подфункция 0 - получить счётчик переключений задач. == +=== Функция 68, подфункция 0 - получить сч+тчик переключений задач. == ====================================================================== Параметры: * eax = 68 - номер функции @@ -3606,7 +3610,7 @@ IPC Функция завершает текущий квант времени, выделенный потоку, и переключается на следующий. (Какой поток какого процесса будет следующим, предсказать нельзя). -Позднее, когда до текущего потока дойдёт очередь, +Позднее, когда до текущего потока дойд+т очередь, выполнение возобновится. Параметры: * eax = 68 - номер функции @@ -3623,7 +3627,7 @@ IPC * ecx = требуемое действие: * ecx = 0 - разрешить выполнение инструкции rdpmc (ReaD Performance-Monitoring Counters) - * ecx = 1 - узнать, включён/выключен кэш + * ecx = 1 - узнать, включ+н/выключен кэш * ecx = 2 - включить кэш * ecx = 3 - выключить кэш Возвращаемое значение: @@ -3631,7 +3635,7 @@ IPC * eax = значение cr4 * для ecx=1: * eax = (cr0 and 0x60000000): - * eax = 0 - кэш включён + * eax = 0 - кэш включ+н * eax <> 0 - кэш выключен * для ecx=2 и ecx=3: * функция не возвращает значения @@ -3642,7 +3646,7 @@ IPC MSR = Model Specific Register; полный список MSR-регистров процессора содержится в документации по процессору (например, IA-32 Intel Architecture Software Developer's Manual, Volume 3, Appendix B); -каждое семейство процессоров имеет своё подмножество MSR-регистров. +каждое семейство процессоров имеет сво+ подмножество MSR-регистров. Параметры: * eax = 68 - номер функции * ebx = 3 - номер подфункции @@ -3652,10 +3656,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * ebx:eax = старший:младший dword результата Замечания: * Указание в ecx несуществующего или нереализованного для данного - процессора MSR повлечёт исключение в ядре, которое прибьёт поток. + процессора MSR повлеч+т исключение в ядре, которое прибь+т поток. * Предварительно следует определить, поддерживаются ли MSR в целом, командой cpuid. Иначе возникнет уже другое исключение в ядре, - которое всё равно прибьёт поток. + которое вс+ равно прибь+т поток. ====================================================================== ========= Функция 68, подфункция 4 - записать в MSR-регистр. ========= @@ -3663,7 +3667,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); MSR = Model Specific Register; полный список MSR-регистров процессора содержится в документации по процессору (например, IA-32 Intel Architecture Software Developer's Manual, Volume 3, Appendix B); -каждое семейство процессоров имеет своё подмножество MSR-регистров. +каждое семейство процессоров имеет сво+ подмножество MSR-регистров. Параметры: * eax = 68 - номер функции * ebx = 4 - номер подфункции @@ -3674,10 +3678,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * ebx:eax = копия esi:edi Замечания: * Указание в ecx несуществующего или нереализованного для данного - процессора MSR повлечёт исключение в ядре, которое прибьёт поток. + процессора MSR повлеч+т исключение в ядре, которое прибь+т поток. * Предварительно следует определить, поддерживаются ли MSR в целом, командой cpuid. Иначе возникнет уже другое исключение в ядре, - которое всё равно прибьёт поток. + которое вс+ равно прибь+т поток. ====================================================================== ======= Функция 68, подфункция 5 - выделить физическую память. ======= @@ -3694,7 +3698,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); устройством требуется разместить данные по известному физическому адресу. (В сущности, эта функция разрабатывалась для AC97WAV.) * Число блоков физической памяти ограничено (константой 24, - причём эта константа включает и несколько блоков памяти + прич+м эта константа включает и несколько блоков памяти для надобностей ядра). * Освободить выделенную таким образом память можно подфункцией 6, копированием данных туда/обратно @@ -3764,7 +3768,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); У процесса может быть только один отладчик; один процесс может отлаживать несколько разных. Система уведомляет отладчик о событиях, происходящих с отлаживаемым процессом. Сообщения записываются в буфер, -определённый подфункцией 0. +определ+нный подфункцией 0. Формат сообщения: * +0: dword: код сообщения * +4: dword: PID отлаживаемого процесса @@ -3772,14 +3776,14 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); определяемые кодом сообщения Коды сообщений: * 1 = исключение - * дополнительно передаётся dword-номер исключения + * дополнительно переда+тся dword-номер исключения * процесс приостановлен * 2 = процесс завершился * приходит при любом завершении: как через системную функцию -1, так и при "убийстве" любым другим процессом (в том числе самим отладчиком) * 3 = отладочное исключение int 1 = #DB - * дополнительно передаётся dword-образ регистра DR6: + * дополнительно переда+тся dword-образ регистра DR6: * биты 0-3: выполнено условие соответствующей точки останова (установленной подфункцией 9) * бит 14: исключение произошло из-за режима @@ -3823,7 +3827,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); и при поступлении нового сообщения система будет ждать. Для синхронизации обрамляйте всю работу с буфером операциями блокировки/разблокировки - neg [bufsize] + neg [bufsize] * Данные в буфере трактуются как массив элементов переменной длины - сообщений. Формат сообщения указан в общем описании. @@ -3986,7 +3990,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * 01 = слово * 11 = двойное слово * esi = адрес точки останова; должен быть выровнен - соответственно длине (т.е. должен быть чётным для + соответственно длине (т.е. должен быть ч+тным для точек останова на слово, кратен 4 для двойного слова) * если старший бит установлен - сбросить точку останова Возвращаемое значение: @@ -4006,10 +4010,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * Срабатывание точки останова заключается в генерировании отладочного исключения #DB, о котором система сообщает отладчику. * Точка останова на запись и чтение/запись срабатывает после - выполнения вызвавшей её инструкции. + выполнения вызвавшей е+ инструкции. ====================================================================== -= Функция 70 - работа с файловой системой с поддержкой длинных имён. = += Функция 70 - работа с файловой системой с поддержкой длинных им+н. = ====================================================================== Параметры: * eax = 70 @@ -4039,7 +4043,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * /FD/1 = /FLOPPYDISK/1 для доступа к первому флоппи-дисководу, /FD/2 = /FLOPPYDISK/2 для второго флоппи-дисковода * /HD0/x, /HD1/x, /HD2/x, /HD3/x для доступа соответственно - к жёстким дискам на IDE0 (Primary Master), IDE1 (Primary Slave), + к ж+стким дискам на IDE0 (Primary Master), IDE1 (Primary Slave), IDE2 (Secondary Master), IDE3 (Secondary Slave); x - номер раздела на выбранном винчестере, изменяется от 1 до 255 (на каждом из винчестеров нумерация начинается с 1) @@ -4060,7 +4064,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * подфункция 7 - запуск программы ====================================================================== -= Функция 70, подфункция 0 - чтение файла с поддержкой длинных имён. = += Функция 70, подфункция 0 - чтение файла с поддержкой длинных им+н. = ====================================================================== Параметры: * eax = 70 - номер функции @@ -4071,7 +4075,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +8: dword: 0 (зарезервировано под старший dword позиции) * +12 = +0xC: dword: сколько байт читать * +16 = +0x10: dword: указатель на буфер, куда будут записаны данные - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании или * +20 = +0x14: db 0 @@ -4082,13 +4086,13 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); -1=0xffffffff, если файл не найден Замечания: * Если файл кончился раньше, чем был прочитан последний запрошенный - блок, то функция прочитает, сколько сможет, после чего вернёт + блок, то функция прочитает, сколько сможет, после чего верн+т eax=6 (EOF). * Функция не позволяет читать папки - (вернётся eax=10, access denied). + (верн+тся eax=10, access denied). ====================================================================== -= Функция 70, подфункция 1 - чтение папки с поддержкой длинных имён. = += Функция 70, подфункция 1 - чтение папки с поддержкой длинных им+н. = ====================================================================== Параметры: * eax = 70 - номер функции @@ -4104,7 +4108,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +12 = +0xC: dword: сколько блоков читать * +16 = +0x10: dword: указатель на буфер, куда будут записаны данные, размер буфера должен быть не меньше 32 + [+12]*560 байт - * +20 = +0x14: ASCIIZ-имя папки, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя папки, правила формирования им+н указаны в общем описании или * +20 = +0x14: db 0 @@ -4120,7 +4124,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * ... Структура заголовка: * +0: dword: версия структуры (текущая версия = 1) - * +4: dword: количество размещённых блоков; не больше, чем запрошено + * +4: dword: количество размещ+нных блоков; не больше, чем запрошено в поле +12 информационной структуры; может быть меньше, если в папке кончились файлы (то же самое, что и в ebx) * +8: dword: общее число файлов в папке @@ -4177,7 +4181,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); данные содержат мусор. * Если файлы в папке кончились раньше, чем было прочитано запрошенное количество, то функция прочитает, сколько сможет, - после чего вернёт eax=6 (EOF). + после чего верн+т eax=6 (EOF). * Любая папка на диске, кроме корневой, содержит два специальных входа "." и "..", идентифицирующих соответственно саму папку и родительскую папку. @@ -4188,7 +4192,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); ====================================================================== ====================== Функция 70, подфункция 2 ====================== -======== Создание/перезапись файла с поддержкой длинных имён. ======== +======== Создание/перезапись файла с поддержкой длинных им+н. ======== ====================================================================== Параметры: * eax = 70 - номер функции @@ -4199,7 +4203,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +8: dword: 0 (зарезервировано) * +12 = +0xC: dword: сколько байт писать * +16 = +0x10: dword: указатель на данные - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании или * +20 = +0x14: db 0 @@ -4208,10 +4212,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * eax = 0 - успешно, иначе код ошибки файловой системы * ebx = число записанных байт (возможно, 0) Замечания: - * Если файл с таким именем не существовал, он создаётся; если + * Если файл с таким именем не существовал, он созда+тся; если существовал, то перезаписывается. * Если свободного места на диске недостаточно, то функция запишет, - сколько сможет, после чего вернёт код ошибки 8. + сколько сможет, после чего верн+т код ошибки 8. ====================================================================== === Функция 70, подфункция 5 - получение информации о файле/папке. === @@ -4226,7 +4230,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +12 = +0xC: dword: 0 (зарезервировано) * +16 = +0x10: dword: указатель на буфер, куда будут записаны данные (40 байт) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании или * +20 = +0x14: db 0 @@ -4254,7 +4258,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +8: dword: 0 (зарезервировано) * +12 = +0xC: dword: 0 (зарезервировано) * +16 = +0x10: dword: указатель на буфер с атрибутами (32 байта) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании или * +20 = +0x14: db 0 @@ -4285,7 +4289,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * +8: dword: 0 или указатель на ASCIIZ-строку с параметрами * +12 = +0xC: dword: 0 (зарезервировано) * +16 = +0x10: dword: 0 (зарезервировано) - * +20 = +0x14: ASCIIZ-имя файла, правила формирования имён указаны в + * +20 = +0x14: ASCIIZ-имя файла, правила формирования им+н указаны в общем описании или * +20 = +0x14: db 0 @@ -4300,10 +4304,26 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); (ASCIIZ-строка); учитываются либо все символы до завершающего нуля включительно, либо первые 256 символов, в зависимости от того, что меньше. - * Если процесс запускается как отлаживаемый, он создаётся + * Если процесс запускается как отлаживаемый, он созда+тся в замороженном состоянии; для запуска используйте подфункцию 5 функции 69. +====================================================================== +====== Функция 71, подфункция 1 - установить заголовок программы ===== +====================================================================== +Параметры: + * eax = 71 - номер функции + * ebx = 1 - номер подфункции + * eсx = адрес строки заголовка +Возвращаемое значение: + * eax = 0 - заголовок установлен успешно + * eax = 1 - произошла ошибка +Замечания: + * Строка заголовка должна быть в формате ASCIIZ. В заголовке + отображается не более 255 символовб независимо от реальной длины + строки. + * Чтобы убрать заголовок, передайте NULL в ecx + ====================================================================== ========== Функция -1 - завершить выполнение потока/процесса ========= ====================================================================== @@ -4333,7 +4353,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * 2 = нажата клавиша на клавиатуре (поступает, только когда окно активно) или нажата "горячая клавиша"; сбрасывается, когда все клавиши из буфера считаны функцией 2 - * 3 = нажата кнопка, определённая ранее функцией 8 (или кнопка + * 3 = нажата кнопка, определ+нная ранее функцией 8 (или кнопка закрытия, созданная неявно функцией 0; кнопка минимизации обрабатывается системой и о ней сообщения не приходит; поступает, только когда окно активно; сбрасывается, когда все @@ -4342,7 +4362,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); при размаскировке функцией 40) * 5 = перерисовывается фон рабочего стола (сбрасывается автоматически после перерисовки, так что если во время перерисовки - фона программа не ждёт и не проверяет события, то этого события + фона программа не жд+т и не проверяет события, то этого события она не заметит) * 6 = событие от мыши (что-то случилось - нажатие на кнопку мыши или перемещение; сбрасывается при прочтении) @@ -4359,10 +4379,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); ==================== Коды ошибок файловой системы ==================== ====================================================================== * 0 = успешно - * 1 = не определена база и/или раздел жёсткого диска (подфункциями + * 1 = не определена база и/или раздел ж+сткого диска (подфункциями 7, 8 функции 21) * 2 = функция не поддерживается для данной файловой системы - (возвращается в случае попытки LBA-чтения при запрещённом LBA) + (возвращается в случае попытки LBA-чтения при запрещ+нном LBA) * 3 = неизвестная файловая система * 4 = возвращается только функцией rename при передаче сильно неверного параметра и никак не соответствует описанию @@ -4372,9 +4392,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B); * 7 = указатель вне памяти приложения * 8 = диск заполнен * 9 = таблица FAT разрушена - * 10 = доступ запрещён + * 10 = доступ запрещ+н * 11 = ошибка устройства При запуске программы возможны также следующие коды ошибок: * 30 = 0x1E = недостаточно памяти * 31 = 0x1F = файл не является исполнимым * 32 = 0x20 = слишком много процессов + diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt new file mode 100644 index 0000000000..8b330ea3f5 --- /dev/null +++ b/kernel/trunk/docs/sysfuncs.txt @@ -0,0 +1,4285 @@ +SYSTEM FUNCTIONS of OS Kolibri 0.5.8.1 + +Number of the function is located in the register eax. +The call of the system function is carried out by the command "int 0x40". +All registers, except for obviously indicated in returned value, +including the register of flags eflags, are saved. + + +====================================================================== +============== Function 0 - define and draw the window. ============== +====================================================================== +Defines an application window. Draws a frame of the window, header and +working area. For windows with ёъшэюь defines standard buttons of closing +and minimization. +Parameters: + * eax = 0 - number of the function + * ebx = [coordinate on axis x]*65536 + [size on axis x] + * ecx = [coordinate on axis y]*65536 + [size on axis y] + * edx = 0xXYRRGGBB, where: + * Y = style of the window: + * Y=0 - type I - window of the fixed sizes + * Y=1 - only to define window area, nothing to draw + * Y=2 - type II - window with changed sizes + * Y=3 - window with skinned + * other possible values (from 4 up to 15) reserved, + function call with such Y is ignored + * RR, GG, BB = accordingly red, green, blue + colours of a working area of the window + (is ignored for style Y=2) + * X = DCBA (bits) + * A = 1 - window has caption; if Y=3, caption string address could be passed in edi, + otherwise use function 71 subfunction 1 + * B = 1 - draw all graphics primitives relative to window client area + * C - reserved + * D = 8 - fill client area with gradient + other values are reserved + The following parameters are intended for windows of a type I and II, + and ignored for styles Y=1,3: + * esi = 0xXYRRGGBB - colour of header + * RR, GG, BB define colour + * Y=0 - usual window, Y=1 - unmovable window + * X defines a gradient of header: X=0 - no gradient, + X=8 - usual gradient, + for windows of a type II X=4 - negative gradient + * other values X and Y reserved + * edi = 0x00RRGGBB - colour of a frame +Returned value: + * function does not return value +Remarks: + * Location and the sizes of the window are installed by the first call of + this function and are ignored at subsequent; for change of location + and/or of sizes already of created window use function 67. + * If to use windows of appropriate styles, location and - or the sizes of + the window can vary by the user. + Current location and the sizes can be obtained by function 9. + * The window should be located on the screen. If the transferred coordinates + nd the sizes do not satisfy to this condition, appropriate coordinate + (or, probably, is considered both) as zero, and if also it does not help, + the appropriate size (or, probably, both) is installed in a size of the + screen. + + Further we shall designate xpos, ypos, xsize, ysize - values transmitted + in ebx, ecx. The coordinates are resulted concerning the left upper corner + of the window, which, thus, is set as (0,0), coordinate of the right lower + corner essence (xsize, ysize). + * The sizes of the window are understood in sense of coordinates of the + right lower corner. This concerns and to all other functions. It means, + that the real sizes on 1 pixel are more. + * Look of the window of a type I: + * draw external frame of colour indicated in edi, + in width 1 pixel + * draw header - rectangle with the left upper corner (1,1) and right lower + (xsize-1, min (25, ysize)) colour indicated in esi + (in view of a gradient) + * If ysize > =26, the working area of the window - rectangle with the left + upper corner (1,21) and right lower + (xsize-1, ysize-1) (sizes (xsize-1) * (ysize-21)) - colour + indicated in edx (in view of a gradient) is painted over + * Look of the window of a type Y=1: + * completely defined by the application + * Look of the window of a type II: + * draw external frame of width 1 pixel of the "shaded" colour + edi (all making colours decrease twice) + * drawn intermediate frame of width 3 pixels of colour edi + * draw internal frame of width 1 pixel + "shaded" colour edi + * draw header - rectangle with the left upper corner (4,4) + and right lower (xsize-4,min(20,ysize)) colour, indicated т esi + (in view of a gradient) + * If ysize > =26, the working area of the window is painted over - + rectangle with the left upper corner (5,20) and right lower + (xsize-5,ysize-5) - colour indicated in edx (in view of a gradient) + * Look of the window with skinned: + * draw external frame of width 1 pixel + colour 'outer' from skin + * draw intermediate framework of width 3 pixels + colour 'frame' from skin + * draw internal framework of width 1 pixel + colour 'inner' from skin + * draw header (on pictures from skin) in a rectangle + (0,0) - (xsize,_skinh-1) + * If ysize > =26, the working area of the window is painted over - + rectangle with the left upper corner (5, _skinh) and right lower + (xsize-5,ysize-5) - colour indicated in edx (in view of a gradient) + * two standard buttons are defined: closings and minimizations + (see function 8) + * value _skinh is accessible as result of call + subfunction 4 functions 48 + +====================================================================== +================= Function 1 - put a point in the window. ============ +====================================================================== +Parameters: + * eax = 1 - number of the function + * ebx = x-coordinate (concerning the window) + * ecx = y-coordinate (concerning the window) + * edx = 0x00RRGGBB - colour of a point + edx = 0x01xxxxxx - to invert colour of a point + (low 24 bits ignored) +Returned value: + * function does not return value + +====================================================================== +======== Function 2 - receive the code of the pressed key. =========== +====================================================================== +Takes away the code of the pressed key from the buffer. +Parameters: + * eax = 2 - number of the function +Returned value: + * if the buffer is empty, comes back eax=1 + * If the buffer is nonblank, that comes back al=0, ah=code of the pressed key, + high word of the register eax is set zero + * If there is "hotkey", comes back + al=2, ah=scancode of the pressed key (0 for direction keys), + high word of the register eax contains a status of direction keys + at the moment of pressing a hotkey +Remarks: + * There is a common system buffer of the pressed keys by a size of 120 bytes, + organized as queue. + * There is one more common system buffer on 120 "hotkey". + * By call of this function the application with the inactive window + considers, that the buffer of the pressed keys is empty. + * By default this function returns ASCII-codes; to switch to the mode + scancode (and back) it is possible with usage of the function 66. + However, the hotkey always come back as scancodes. + * Ffind out, what keys correspond to what codes, is possible, having started + the applications keyascii and scancode. + * Scancodes come back directly by keyboard and are fixed; ASCII-codes turn + out with usage of the conversion tables, which can be installed + subfunction 2 functions 21 and to read subfunction 2 functions 26. + * As a consequence, ASCII-codes take into account current keyboard layout + (rus/en) as against scancodes. + * The information only about those hotkeys acts which were defined by this + stream subfunction 4 functions 66. + +====================================================================== +================ Function 3 - get system time. ======================= +====================================================================== +Parameters: + * eax = 3 - number of the function +Returned value: + * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds + * each unit comes back as BCD-number, for example, + for time 23:59:59 result will be 0x00595923 +Remarks: + * Look also subfunction 9 functions 26 - obtaining of time from the moment + of start of the system; it in many cases is more convenient, as returns + simply DWORD-value of the counter of time. + * System time can be installed by the function 22. + +====================================================================== +================ Function 4 - draw text in the window. =============== +====================================================================== +Can output both strings with given length and NULL-terminated strings +(0x0) - ASCIIZ(string db 'text',0). To draw ASCIIZ string, pass -1 +in esi (mov esi,-1). +Parameters: + * eax = 4 - number of the function + * ebx = [coordinate on axis x]*65536 + [coordinate on axis y] + * ecx = 0xX0RRGGBB, where + * RR, GG, BB set colour of the text + * X sets the used font: 0=system monowide, + 1=system font of variable width + * edx = pointer by the beginning of string + * esi = length of string, should be no more 255 +Returned value: + * function does not return value +Remarks: + * The first system font is read out at loading from the file char.mt, + second system font - from char2.mt. + * Both fonts have height 9 pixels, width of the monowide font + is equal 6 pixels. + +====================================================================== +========================= Function 5 - pause. ========================= +====================================================================== +Delays execution of the program on the given time. +Parameters: + * eax = 5 - number of the function + * ebx = time in the 1/100 of second +Returned value: + * function does not return value +Remarks: + * The transmission ebx=0 does not transfer handle the following process + and at all does not make any operations. If really it is required to + transfer handle to the following process (to complete a current time + slice), use subfunction of 1 function 68. + * At current realization there will be an immediate return from the function, + if the addition ebx with current value of the counter of time will call + 32-bit overflow. + +====================================================================== +============== Function 6 - read the file with ramdisk. ============== +====================================================================== +Parameters: + * eax = 6 - number of the function + * ebx = pointer on a filename + * ecx = number of the start block, beginning from 1; + ecx=0 - read from a beginning of the file (same, as ecx=1); + * edx = number of blocks for reading; + edx=0 - read one block (same, as edx=1) + * esi = pointer on area of memory, where the data will be written +Returned value: + * eax = file size in bytes, if the file is successfully read + * eax = -1, if the file is not retrieved +Remarks: + * The given function is out-of-date; the function 70 allows to fulfil + the same operations with the extended possibilities. + * Block = 512 bytes. + * For reading all file it is possible to specify the certainly large value + in edx, for example, edx = -1; but in this case be ready that the program + "will fall", if the file will appear too large and "will not be placed" in + memory of the program. + * The filename should be or in the format 8+3 characters (first 8 characters + - purely name, last 3 - extension, the short names and extensions are + supplemented by blanks), or in the format 8.3 characters + "FILE.EXT" / "FILE.EX " (name no more than 8 characters, point, + extension 3 characters supplemented if necessary by blanks). + The filename should be written by capital letters. The completing + character with the code 0 is not necessary (ASCIIZ-string). + * Current implementation ramdisk does not support the directory. + +====================================================================== +=============== Function 7 - draw image in the window. =============== +====================================================================== +Parameters: + * eax = 7 - number of the function + * ebx = pointer on the image in the format BBGGRRBBGGRR... + * ecx = [size on axis x]*65536 + [size on axis y] + * edx = [coordinate on axis x]*65536 + [coordinate on axis y] +Returned value: + * function does not return value +Remarks: + * Coordinates of the image are coordinates of the upper left corner of the + image concerning the window. + * Size of the image in bytes is 3*xsize*ysize. + +====================================================================== +=============== Function 8 - define/delete the button. =============== +====================================================================== +Parameters for юяЁхфхыхэш  ъэюяъш: + * eax = 8 - number of the function + * ebx = [coordinate on axis x]*65536 + [size on axis x] + * ecx = [coordinate on axis y]*65536 + [size on axis y] + * edx = 0xXYnnnnnn, where: + * nnnnnn = identifier of the button + * high (31-st) bit edx is reset + * if 30-th bit edx is installed - to not draw the button + * If 29-th bit edx is installed - to not draw a frame + at pressing the button + * esi = 0x00RRGGBB - colour of the button +Parameters for deleting the button: + * eax = 8 - number of the function + * edx = 0x80nnnnnn, where nnnnnn - identifier of the button +Returned value: + * function does not return value +Remarks: + * Sizes of the button should be more than 0 and less than 0x8000. + * For windows with skin at definition of the window (call of 0-th function) + there are two standard buttons - closing of the window with the + identifier 1 and minimization of the window with the identifier 0xffff. + * The creation of two buttons with identical identifiers is admitted. + * The button with the identifier 0xffff at pressing is interpreted by the + system as the button of minimization, the system handles such pressing + independently, not accessing to the application. In rest it is + the usual button. + * Total of buttons for all applications is limited to number 4095. + +====================================================================== +========== Function 9 - information on thread of execution. ========== +====================================================================== +Parameters: + * eax = 9 - number of the function + * ebx = pointer on the buffer of a size 1 Kb + * ecx = number of the slot of thread + ecx = -1 - get information on current thread +Returned value: + * eax = maximum number of the slot of thread + * buffer, which specifies ebx, contains the following information: + * +0: dword: usage of the processor (how many clock ticks per one second + leaves on fulfilment of this thread) + * +4: word: position of the window of thread in the window stack + * +6: word: (there is no ratio to the requested thread) + number of the slot thread, which window is in the window stack + in a position ecx + * +8: word: reserved + * +10 = +0xA: 11 bytes: name of the process + (name of an appropriate executable file in the format 8+3) + * +21 = +0x15: byte: alignment, this byte does not vary + * +22 = +0x16: dword: address of the process in memory + * +26 = +0x1A: dword: size of used memory - 1 + * +30 = +0x1E: dword: identifier (PID/TID) + * +34 = +0x22: dword: coordinate of the window thread on axis x + * +38 = +0x26: dword: coordinate of the window thread on axis y + * +42 = +0x2A: dword: size of the window thread on axis x + * +46 = +0x2E: dword: size of the window thread on axis y + * +50 = +0x32: word: status of the slot thread: + * 0 = thread worked + * 1 = thread paused + * 2 = thread paused at the moment of waiting event + * 3 = thread completed as a result of function call -1 or + under duress as a consequence of call subfunction 2 functions 18 + or termination of the system + * 4 = thread is completed as a result of exception + * 5 = thread wait event + * 9 = requested slot is free, + all other information on the slot is not meaningful +Remarks: + * Slots are numbered with 1. + * Returned value not is a total number of streams, as there are free slots. + * ╧Ёш ёючфрэшш яЁюЎхёёр ртЄюьрЄшўхёъш ёючфрхЄё  thread т√яюыэхэш . + * Function produces the information on thread. Each process has even one + thread. One process can create some thread, in this case everyone thread + receives the slot, and the fields +10, +22, +26 in these slots coincide. + For the applications there is no common way to define, whether two thread + belong to one process. + * Active window - window which is taking place on top of the window stack, + it receives the messages on a keyboard input. For it the position in the + window stack coincides with returned value. + * Slot 1 corresponds to special thread of an operating system, for which: + * window is in the bottom of the window stack, the fields +4 and +6 + contain value 1 + * Nname of the process - "OS/IDLE" (supplemented by blanks) + * address of the process is equal memory 0, size of used memory + 16 Mb (0x1000000) + * PID=1 + * coordinates and sizes of the window conditionally rely equal 0 + * status of the slot - always 0 (worked) + * The execution time adds of time leaving on purely operation, and down + time in waiting interruption (which can be received by call + subfunction 4 functions 18). + * Since the slot 2, the usual applications are placed. + * Usual applications are placed in memory to the address 0x10000000 + (constant of a kernel std_application_base_address). + Intersection does not occur, as for each process the own page table. + * At creation thread to it are assigned the slot in the system table and + identifier (Process/Thread IDentifier = PID/TID), which for given thread + do not vary in the subsequent time. + After completion thread its slot can be anew used for another thread. + The identifier thread can not be assigned to other stream even after + completion first. + Identifiers, assigned to new thread, monotonously grow. + * If thread yet has not defined the window by function call 0, + a location and the sizes of this window rely in zero. + * In the given moment the part of the buffer by a size 52 = 0x34 of byte + is used only. Nevertheless it is recommended to use the buffer + by a size 1 KB for the future compatibility, in the future some fields + can be added. + +====================================================================== +====================== Function 10 - wait event. ===================== +====================================================================== +If the message queue is empty, waits for appearance of the message in queue. +In such status thread does not receive CPU time. +Then reads out the message from queue. + +Parameters: + * eax = 10 - number of the function +Returned value: + * eax = event (look the list of events) +Remarks: + * Those events are taken into account only which enter into a mask installed + by the function 40. By default it is events redraw, pressing keys + and buttons. + * For check, whether there is a message in queue, use the function 11. + To wait for the no more defined time, use the function 23. + +======================================================================= += Function 11 - check up, whether there is an event, without waiting. = +======================================================================= +If in a message queue there is any event, reads out and returns it. +If queue is empty, returns zero. +Parameters: + * eax = 11 - number of the function +Returned value: + * eax = 0 - message queue is empty + * шэрўх eax = event (look the list of events) +Remarks: + * Those events are taken into account only which enter into a mask installed + by the function 40. By default it is events redraw, pressing keys + and buttons. + * For waiting appearance of event in queue, use the function 10. + To wait for the no more defined time, use the function 23. + +====================================================================== +========= Function 12 - begin/complete redraw of the window. ========= +====================================================================== + +---------- Subfunction 1 - begin redraw of the window. --------------- +Parameters: + * eax = 12 - number of the function + * ebx = 1 - number subfunction +Returned value: + * function does not return value + +--------- Subfunction 2 - complete redraw of the window. ------------- +Parameters: + * eax = 12 - number of the function + * ebx = 2 - number subfunction +Returned value: + * function does not return value +Remarks: + * Function of a beginning redraw all deletes defined by the + function 8 buttons, they should be defined again. + +====================================================================== +============ Function 13 - draw a rectangle in the window. =========== +====================================================================== +Parameters: + * eax = 13 - number of the function + * ebx = [coordinate on axis x]*65536 + [size on axis x] + * ecx = [coordinate on axis y]*65536 + [size on axis y] + * edx = colour 0xRRGGBB шыш 0x80RRGGBB for a gradient of filling +Returned value: + * function does not return value +Remarks: + * Coordinates are understood as coordinates of the left upper corner + of a rectangle concerning the window. + +====================================================================== +================ Function 14 - get sizes of the screen. ============== +====================================================================== +Parameters: + * eax = 14 - number of the function +Returned value: + * eax = [xsize]*65536 + [ysize], where + * xsize = x-coordinate of the right lower corner of the screen = + size on a horizontal - 1 + * ysize = y-coordinate of the right lower corner of the screen = + size on a vertical - 1 +Remarks: + * Look also subfunction 5 functions 48 - to receive sizes of + a working area of the screen. + +======================================================================== += Function 15, subfunction 1 - install a size of the background image. = +======================================================================== +Parameters: + * eax = 15 - number of the function + * ebx = 1 - number subfunction + * ecx = width of the image + * edx = height of the image +Returned value: + * function does not return value +Remarks: + * Checks on a correctness is not done. The installation of the too large + values will result that the background will be entered with the data abroad + of buffer of the background map. The size of the buffer = 0x160000-0x10, + that corresponds to maximum sizes 800*600. (800*600*3=0x15F900) + * For upgrade of the screen (after completion of a series of commands + working with a background) call subfunction 3 redraw of a background. + * There is a pair function of get of sizes of the background image - + subfunction 1 function 39. + +====================================================================== += Function 15, subfunction 2 - put a point on the background image. == +====================================================================== +Parameters: + * eax = 15 - number of the function + * ebx = 2 - number subfunction + * ecx = offset + * edx = colour of a point 0xRRGGBB +Returned value: + * function does not return value +Remarks: + * Offset for a point with coordinates (x, y) is calculated as + (x+y*xsize)*3. + * If the indicated offset exceeds 0x160000-16 = + 1.375 Mb - 16 bytes, call is ignored. + * For upgrade of the screen (after completion of a series of commands + working with a background) call subfunction 3 redraw of a background. + * There is a pair function of obtaining of a point from the background + image - subfunction 2 functions 39. + +====================================================================== +=========== Function 15, subfunction 3 - redraw background. ========== +====================================================================== +Parameters: + * eax = 15 - number of the function + * ebx = 3 - number subfunction +Returned value: + * function does not return value + +========================================================================= += Function 15, subfunction 4 - set the mode of drawing of a background. = +========================================================================= +Parameters: + * eax = 15 - number of the function + * ebx = 4 - number subfunction + * ecx = mode of drawing: + * 1 = tile + * 2 = stretch +Returned value: + * function does not return value +Remarks: + * For upgrade of the screen (after completion of a series of commands + working with a background) call subfunction 3 redraw of a background. + * There is a pair command of obtaining of the mode redraw of a background + - subfunction 4 functions 39. + +=========================================================================== += Function 15, subfunction 5 - place the block of pixels on a background. = +=========================================================================== +Parameters: + * eax = 15 - number of the function + * ebx = 5 - number subfunction + * ecx = pointer on the data in the format BBGGRRBBGGRR... + * edx = offset in data of the background image + * esi = size given in bytes = 3 * number of pixels +Returned value: + * function does not return value +Remarks: + * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes, + the call is ignored. + * Colour of each pixel is stored as 3 bytes the value BBGGRR. + * Pixels of the background image are written sequentially from left to right, + from above downwards. + * Offset of a pixel with coordinates (x,y) it (x+y*xsize)*3. + * For upgrade of the screen (after completion of a series of commands + working with a background) call subfunction 3 redraw of a background. + +====================================================================== +============= Function 16 - save ramdisk on a diskette. ============== +====================================================================== +Parameters: + * eax = 16 - number of the function + * ebx = 1 шыш ebx = 2 - on what floppy to save +Returned value: + * eax = 0 - successfully + * eax = 1 - error + +====================================================================== +============== Function 17 - get code of pressed button. ============= +====================================================================== +Takes away the code of the pressed button from the buffer. +Parameters: + * eax = 17 - number of the function +Returned value: + * If the buffer is empty, comes back eax=1 + * If the buffer is nonblank, comes back al=0, the high 24 bits eax contain + the identifier of the button (in particular, in ah there is a low byte of + the identifier; if all buttons have the identifier, smaller 256, for + distinguishing there is enough ah) +Remarks: + * "Buffer" keeps only one button, at pressing the new button the information + about old is lost. + * By call of this function by the application with the inactive window the + answer " the buffer comes back is empty ". + +====================================================================== +============ Function 18, subfunction 1 - shutdown system. =========== +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 1 - number subfunction +Returned value: + * Always comes back eax = 0 as tag of success +Remarks: + * On last step there is a menu of quit waiting responses of the user. + * Look also subfunction 9, termination of the system with the parameter + to speed up choice in the menu of an exit. + +====================================================================== += Function 18, subfunction 2 - complete process/thread on the slot. == +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 2 - number subfunction + * ecx = number of the slot of process/thread +Returned value: + * function does not return value +Remarks: + * It is impossible to complete thread of an operating system OS/IDLE + (number of the slot 1), it is possible to complete + any usual thread/process. + * See also subfunction 18 - completion of process/thread + with the given identifier. + +========================================================================= += Function 18, subfunction 3 - do to the active window selected thread. = +========================================================================= +Parameters: + * eax = 18 - number of the function + * ebx = 3 - number subfunction + * ecx = number of the slot thread +Returned value: + * function does not return value +Remarks: + * At the instruction correct, but nonexistent slot any window is made active. + * Find out, what window is active, is possible by call subfunction 7. + +============================================================================== + Function 18, subfunction 4 - get counter of empty clock ticks per one second. +============================================================================== +Empty clock ticks are understood as time, in which the processor stands idle +in waiting interruption (in the instruction hlt). + +Parameters: + * eax = 18 - number of the function + * ebx = 4 - number subfunction +Returned value: + * eax = value of the counter of empty clock ticks per one second + +====================================================================== +=========== Function 18, subfunction 5 - get cpu frequency. ========== +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 5 - number subfunction +Returned value: + * eax = cpu frequency (modulo 2^32 clock ticks = 4GHz) + +===================================================================== +== Function 18, subfunction 6 - save ramdisk in file on hard disk. == +===================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 6 - number subfunction + * ecx defines path to the file: + * 1 = in the directory "/KOLIBRI" + * 2 = in the root + * 3 = edx specifies path (names of folders in the format 8+3, divided '/') +Returned value: + * eax = 0 - successfully + * differently eax = an error code of a file system +Remarks: + * Filename is fixed, "menuet.img" (global variable of + a kernel image_save from preboot.inc) + * On what partition what disk the file will be saved, is defined + subfunction 7 and subfunction 8 functions 21. + * All directories in the indicated path should exist, differently will + return value 5, " the file is not retrieved ". + +====================================================================== +====== Function 18, subfunction 7 - get number of active window. ===== +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 7 - number subfunction +Returned value: + * eax = number of active window (number of the slot thread, which window + is active) +Remarks: + * Active window is at the top of the window stack and receives the messages + on all keyboard input. + * Make the window active it is possible by call subfunction 3. + +======================================================================= +==== Function 18, subfunction 8 - disable/enable a speaker sound . ==== +======================================================================= +At the disconnected sound the calls subfunction 55 functions 55 are ignored. +At included - are routed on built - in speaker. + +--------------- Subsubfunction 1 - get a status. ---------------- +Parameters: + * eax = 18 - number of the function + * ebx = 8 - number subfunction + * ecx = 1 - number subsubfunction +Returned value: + * eax = 0 - sound speaker is enabled; 1 - is disabled + +-------------- Subsubfunction 2 - switch a status. -------------- +Switches statuses of disable/enable. +Parameters: + * eax = 18 - number of the function + * ebx = 8 - number subfunction + * ecx = 2 - number subsubfunction +Returned value: + * function does not return value + +=========================================================================== += Function 18, subfunction 9 - shutdown of the system with the parameter. = +=========================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 9 - number subfunction + * ecx = parameter: + * 1 = On last step of shutdown to save ramdisk on a diskette then to + output the menu of an exit and to request of the user further operations + * 2 = switch off the computer + * 3 = reboot the computer + * 4 = restart a kernel from the file kernel.mnt on ramdisk +Returned value: + * At incorrect ecx the registers do not vary (i.e. eax=18) + * By correct call tag of success eax=0 always comes back +Remarks: + * It is not necessary to rely on returned value by incorrect call, + it can vary in the subsequent versions of a kernel. + * It is possible to use subfunction 1, that on last step of termination + the user himself has selected, that it is necessary. + * It is not recommended to use value ecx=1 (to not irritate the user with + excessive questions); to save ramdisk on a diskette it is possible by the + function 16 (which admits specification, on which diskette to write), and + to complete operation from the menu of an output(exit) it is possible + already mentioned subfunction 1. + +======================================================================= +====== Function 18, subfunction 10 - minimize application window. ===== +======================================================================= +Turns off the own window. +Parameters: + * eax = 18 - number of the function + * ebx = 10 - number subfunction +Returned value: + * function does not return value +Remarks: + * The minimized window from the point of view of the function 9 saves + a location and sizes. + * Restoring of an application window occurs at activation subfunction 3. + * Usually there is no necessity obviously to turn off/restore the window: + turn off of the window is carried out by the system at pressing the button + of minimization (which for windows with SKIN is defined automatically by + function 0, for windows without SKIN it is possible to define by the + function 8), restoring - application @panel. + +====================================================================== +==================== Function 18, subfunction 11 ===================== +================ Get information on a disk subsystem. ================ +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 11 - number subfunction + * ecx = type of the table: + * 1 = short version, 10 bytes + * 2 = full version, 65536 bytes + * edx = pointer on the buffer (in the application) for table +Returned value: + * function does not return value +Format of the table: the short version: + * +0: byte: information about FDD's (drives for diskettes), AAAABBBB, + where AAAA sets type of the first drive, BBBB - second disk agrees + to the following list: + * 0 = there is no drive + * 1 = 360Kb, 5.25'' + * 2 = 1.2Mb, 5.25'' + * 3 = 720Kb, 3.5'' + * 4 = 1.44Mb, 3.5'' + * 5 = 2.88Mb, 3.5'' (such diskettes already are not used) + For example, for the standard configuration from one 1.44-drive here will + be 40h, and for a case 1.2Mb on A: and 1.44Mb on B: the value appears 24h. + * +1: byte: information about hard disks and CD - drives, AABBCCDD, + where AA corresponds to the controller IDE0, ..., DD - IDE3: + * 0 = device is absent + * 1 = hard disk + * 2 = CD - drive + For example, in a case HD on IDE0 and CD on IDE2 here will be 48h. + * +2: 4 db: Number of the retrieved sections on hard disks with + accordingly IDE0..., IDE3. + At absence of the hard disk on IDEx appropriate byte zero, at presence + shows number of the recognized partitions, which can and to not be (if the + drive is not formatted or if the file system is not supported). In the + current version of a kernel for hard disks are supported only FAT16 + and FAT32. + * +6: 4 db: reserved +Format of the table: the complete version: + * +0: 10 db: same, as well as in the short version + * +10: 100 db: data for the first partition + * +110: 100 db: data for the second partition + * ... + * +10+100*(n-1): 100 db: data for the last partition +The sections are located in the following order: at first sequentially all +recognized partitions on HD on IDE0 (if are), then on HD on IDE1 (if is) +etc. up to IDE3. +Format of the information about partition (while is supported only FAT): + * +0: dword: first physical sector of the partition + * +4: dword: last physical sector of the partition + (belongs to partition) + * +8: dword: sectors in one copy FAT + * +12 = +0xC: dword: number of copies FAT + * +16 = +0x10: dword: number of sectors in a cluster + * +20 = +0x14: dword: byte in sector; the current implementation expects, + that here 0x200 = 512 + * +24 = +0x18: dword: first cluster of the root in FAT32, 0 for FAT16 + * +28 = +0x1C: dword: first physical sector FAT + * +32 = +0x20: dword: first physical sector of the root for FAT16, + is ignored for FAT32 + * +36 = +0x24: dword: number of sectors in the root for FAT16, 0 for FAT32 + * +40 = +0x28: dword: physical sector of a beginning of area of the data + * +44 = +0x2C: dword: maximum number of a cluster + * +48 = +0x30: dword: physical sector of the information about a file system + for FAT32, is ignored for FAT16 + * +52 = +0x34: dword: value used as boundary of special values in FAT + * +56 = +0x38: dword: value used for bad clusters in FAT + * +60 = +0x3C: dword: Value used as the end mark at recording of a chain + in FAT + * +64 = +0x40: dword: mask superimposed on a unit FAT + * +68 = +0x44: byte: type of a file system: 16 or 32 + * +69 = +0x45: 31 db: reserved +Remarks: + * Short table can be used for obtaining the information about available + devices. + * First two information fields about partition in the complete version of + the table inform parameters of the unit which has stayed - parameters of + a file system FAT. For other file systems (when they will be supported) + information, specific to a file system, naturally, there will be another, + but first two fields will be saved constant. + +====================================================================== +======== Function 18, subfunction 13 - get version of a kernel. ====== +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 13 - number subfunction + * ecx = pointer on the buffer (not less than 16 bytes), where the + information will be placed +Returned value: + * function does not return value +Structure of the buffer: +db a,b,c,d for version a.b.c.d +db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2 +db 'name',0 - ASCIIZ-string with a name +For kernel Kolibri 0.5.8.1: +db 0,5,8,1 +db 2 +db 'Kolibri',0 + +========================================================================= +====================== Function 18, subfunction 14 ====================== += Expect a beginning of retrace of a ray of scanning of screen monitor. = +========================================================================= +Parameters: + * eax = 18 - number of the function + * ebx = 14 - number subfunction +Returned value: + * eax = 0 as tag of success +Remarks: + * Function is intended only for the active high-efficiency graphics + applications; is used for smooth output of a graphics. + +============================================================================ += Function 18, subfunction 15 - place a mouse pointer in centre of screen. = +============================================================================ +Parameters: + * eax = 18 - number of the function + * ebx = 15 - number subfunction +Returned value: + * eax = 0 as tag of success + +====================================================================== +====================== Function 18, subfunction 16 =================== +====================== Get a size of the free RAM. =================== +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 16 - number subfunction +Returned value: + * eax = size of free memory in kilobytes + +====================================================================== +====================== Function 18, subfunction 17 =================== +====================== Get a size of the amount RAM. ================= +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 17 - number subfunction +Returned value: + * eax = common size of amount memory in kilobytes + +====================================================================== +====================== Function 18, subfunction 18 =================== +============= complete process/thread on the identifier. ============= +====================================================================== +Parameters: + * eax = 18 - number of the function + * ebx = 18 - number subfunction + * ecx = identifier of process/thread (PID/TID) +Returned value: + * eax = 0 - successfully + * eax = -1 - error (the process is not retrieved or is system) +Remarks: + * It is impossible to complete thread of an operating system OS/IDLE + (number of the slot 1), it is possible to complete any usual thread/process. + * See also subfunction 2 - completion of process / thread on the given slot. + +====================================================================== +============ Function 19 - start application with ramdisk. =========== +====================================================================== +Parameters: + * eax = 19 - number of the function + * ebx = pointer on an application name in format similar to function 6 + * ecx = 0 or ecx = the pointer on parameters of the command line +Returned value: + * If eax > 0, eax contains PID of the created process + * If eax < 0, -eax - error code of a file system +Remarks: + * This function is obsolete; use subfunction 7 functions 70. + * Command line should be ended by the character with the code 0 + (ASCIIZ-strings); it are taken into account or all characters up to + completing zero inclusively, or the first 256 characters, that are less. + +====================================================================== +==================== Function 20 - interface MIDI. =================== +====================================================================== + +------------------------ Subfunction 1 - reset ------------------------ +Parameters: + * eax = 20 - number of the function + * ebx = 1 - number subfunction + +-------------------- Subfunction 2 - output byte --------------------- +Parameters: + * eax = 20 - number of the function + * ebx = 2 - number subfunction + * cl = byte for output +Returned value (is identical to both subfunctions): + * eax = 0 - successfully + * eax = 1 - base port is not defined +Remarks: + * Base port previously should be defined by call + subfunction of 1 function 21. + +====================================================================== +==== Function 21, subfunction 1 - install a base port MPU MIDI. ====== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 1 - number subfunction + * ecx = number of a base port +Returned value: + * eax = 0 - successfully + * eax = -1 - erratic number of a port +Remarks: + * Number of a port should satisfy to conditions 0x100<=ecx<=0xFFFF. + * Installation of base is necessary for operation of the function 20. + * Get installed base port it is possible by call + subfunction of 1 function 26. + +====================================================================== +======== Function 21, subfunction 2 - install keyboard layout. ======= +====================================================================== +Keyboard layout is used for conversion scancodes, acting from the keyboard, +in ASCII-codes which were read - out by the function 2. +Parameters: + * eax = 21 - number of the function + * ebx = 2 - number subfunction + * ecx = what layout to install: + * 1 = normal layout + * 2 = layout at pressed Shift + * 3 = layout at pressed Alt + * edx = pointer on layout - table of length 128 bytes +Or: + * ecx = 9 + * dx = identifier of the country (1=eng, 2=fi, 3=ger, 4=rus) +Returned value: + * eax = 0 - successfully + * eax = 1 - parameter is given incorrectly +Remarks: + * If is pressed Alt, the layout with Alt is used; if not is pressed Alt, + but is pressed Shift, the layout with Shift is used; if not are + pressed Alt and Shift, but is pressed Ctrl, the normal layout is used, + then from the code is subtracted 0x60; if not any of direction keys + is pressed, the normal layout is used. + * get layouts and identifier of the country it is possible with the help + subfunction 2 functions 26. + * The identifier of the country - global environment variable, which by + kernel is not used; however application @panel displays an icon, + appropriate to the current country. + * Application @panel switches layouts on search of the user. + +====================================================================== +=========== Function 21, subfunction 3 - install base CD. ============ +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 3 - number subfunction + * ecx = base CD: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 +Returned value: + * eax = 0 +Remarks: + * Base CD is used by the function 24. + * Receive the installed base CD it is possible by call + subfunction 3 functions 26. + +====================================================================== +=== Function 21, subfunction 4 - install base port Sound Blaster. ==== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 4 - number subfunction + * ecx = number base port +Returned value: + * eax = 0 - successfully + * eax = -1 - erratic number of a port +Remarks: + * Number of a port should satisfy to conditions 0x100<=ecx<=0xFFFF. + * Installation of base is necessary for operation of functions 25, 28, 55. + * Get installed base port it is possible by call subfunction 4 functions 26. + +====================================================================== +==== Function 21, subfunction 5 - install the language of system. ==== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 5 - number subfunction + * ecx = language of system (1=eng, 2=fi, 3=ger, 4=rus) +Returned value: + * eax = 0 +Remarks: + * Language of the system - global environment variable in any way which + is not used by kernel, however application @panel draws + an appropriate icon. + * Checks on a correctness is not done, as the kernel this variable + does not use. + * Get language of the system it is possible by call + subfunction 5 functions 26. + +====================================================================== +========= Function 21, subfunction 6 - install base port WSS. ======== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 6 - number subfunction + * ecx = base port +Returned value: + * eax = 0 - successfully + * eax = -1 - erratic number of a port +Remarks: + * Number of a port should satisfy to conditions 0x100<=ecx. + * Base WSS is used by the function 27. + * Get installed base port WSS it is possible by call + subfunction 6 functions 26. + +====================================================================== +=========== Function 21, subfunction 7 - install base HD. ============ +====================================================================== +The base HD is necessary for definition, on what hard disk to write, at usage +of out-of-date functions of operation with a file system and functions +implicitly using the hard disk (such as subfunction of 6 functions 18); +At usage of functions 58 and 70 and modern syntax /HD0, /HD1, /HD2, /HD3 +these functions install base. +Parameters: + * eax = 21 - number of the function + * ebx = 7 - number subfunction + * ecx = base HD: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 +Returned value: + * eax = 0 +Remarks: + * Any application at any moment of time can change base. + * It is not necessary to change base, when any application works + with the hard disk. If not want errors of the system. + * Get installed base it is possible by call subfunction 7 functions 26. + * It is necessary also to define used partition of + the hard disk subfunction 8. + +====================================================================== +========= Function 21, subfunction 8 - install partition HD. ========= +====================================================================== +The section HD is necessary for definition, on what partition of the hard disk +to write, at usage of out-of-date functions of operation with a file system and +functions implicitly using the hard disk (such as subfunction of 6 functions +18); at usage of functions 58 and 70 and modern syntax /HD0, /HD1, /HD2, /HD3 +these functions install base and partition. +Parameters: + * eax = 21 - number of the function + * ebx = 8 - number subfunction + * ecx = partition HD (beginning from 1) +Returned value: + * eax = 0 +Remarks: + * Any application at any moment of time can change partition. + * It is not necessary to change partition, when any application works + with the hard disk. If not want errors of the system. + * Get installed partition it is possible by call subfunction 8 functions 26. + * Checks on a correctness is not done. + * Find out number of partitions on the hard disk it is possible by call + subfunction 11 functions 18. + * It is necessary also to define used base of the hard disk subfunction 7 + +====================================================================== +=== Function 21, subfunction 10 - install channel DMA for a sound. === +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 10 - number subfunction + * ecx = number of channel (from 0 up to 3 inclusively) +Returned value: + * eax = 0 - successfully + * eax = -1 - incorrect number of the channel +Remarks: + * Number of the channel DMA is used in subfunction of 1 function 55. + * Get channel DMA for a sound it is possible by call + subfunction 10 functions 26. + +====================================================================== +====================== Function 21, subfunction 11 =================== +=============== Permit/prohibit low level access to HD. ============== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 11 - number subfunction + * ecx = 0/1 - prohibit/permit +Returned value: + * eax = 0 +Remarks: + * Is used at LBA-reading (subfunction 8 functions 58). + * Current realization uses only low bit ecx. + * Get a current status it is possible by call subfunction 11 functions 26. + +====================================================================== +====================== Function 21, subfunction 12 =================== +============= Permit/prohibit low level access to PCI. =============== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 12 - number subfunction + * ecx = 0/1 - prohibit/permit +Returned value: + * eax = 0 +Remarks: + * Is used by operation with the bus PCI (function 62). + * Current realization uses only low bit ecx. + * Get a current status it is possible by call subfunction 12 functions 26. + +====================================================================== +============= Function 21, subfunction 13, subsubfunction 1 ========== +======= Initialize + get information on the driver vmode.mdr. ======== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 13 - number subfunction + * ecx = 1 - number of the function фЁрщтхЁр + * edx = pointer on the buffer of a size of 512 bytes +Returned value: + * If the driver is not loaded (never it happens in current implementation): + * eax = -1 + * ebx, ecx fail + * If the driver is loaded: + * eax = 'MDAZ' (in style fasm, i.e. 'M' - low byte, + 'Z' - high) - signature + * ebx = current frequency of the scanning (in a Hz) + * ecx fail + * buffer, which specifies edx, is filled +Format of the buffer: + * +0: 32*byte: name of the driver, " Trans VideoDriver " (without quotes, + is supplemented by blanks) + * +32 = +0x20: dword: version of the driver (version x.y is encoded + as y*65536+x), for current implementation 1 (1.0) + * +36 = +0x24: 7*dword: reserved (0 in current implementation) + * +64 = +0x40: 32*word: list of supported videomodes (each word - number + of videomode, after the purely list there are zero) + * +128 = +0x80: 32*(5*word): list of supported frequencies of the scannings + for videomodes: for each videomode indicated in the previous field, + up to 5 supported frequencies (in unused positions are indicated the zero) + are written. +Remarks: + * Function initializes the driver (if it is not initialized yet) and should + be called by first, before others (differently they will return -1, + nothing doing). + * In current implementation one frequency of the scanning on videomode + is supported only. + +====================================================================== +============= Function 21, subfunction 13, subsubfunction 2 ========== +================= Get information on current videomode. ============== +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 13 - number subfunction + * ecx = 2 - number of the function of the driver +Returned value: + * eax = -1 - driver is not loaded or is not initialized; + ebx,ecx fail + * eax = [width]*65536 + [height] + * ebx = frequency of the vertical scanning (in a Hz) + * ecx = number of current videomode +Remarks: + * Driver previously should be initialized by function call of the driver 1. + * If the sizes of the screen are necessary only, it is more expedient + to use the function 14 that it returns sizes on 1 less. + +====================================================================== += Function 21, subfunction 13, subsubfunction 3 - install videomode. +====================================================================== +Parameters: + * eax = 21 - number of the function + * ebx = 13 - number subfunction + * ecx = 3 - number of the function of the driver + * edx = [frequency of the scanning] *65536 + [number of videomode] +Returned value: + * eax = -1 - driver is not loaded, not initialized or has taken place error + * eax = 0 - successfully + * ebx, ecx fail +Remarks: + * Driver previously should be initialized by function call of the driver 1. + * Number of videomode and frequency should be in the table returned + function 1 of the driver. + +====================================================================== +============= Function 21, subfunction 13, subsubfunction 4 ========== +===================== Return to former videomode. ==================== +====================================================================== +┬ючтЁр∙рхЄ ¤ъЁрэ т videomode, єёЄрэютыхээюь яЁш чруЁєчъх ёшёЄхь√. +Parameters: + * eax = 21 - number of the function + * ebx = 13 - number subfunction + * ecx = 4 - number of the function of the driver +Returned value: + * eax = -1 - driver is not loaded or is not initialized + * eax = 0 - successfully + * ebx, ecx fail +Remarks: + * Driver previously should be initialized by function call of the driver 1. + +======================================================================= +============= Function 21, subfunction 13, subsubfunction 5 =========== +====== Increase/reduce a size of visible area of screen monitor. ====== +======================================================================= +Parameters: + * eax = 21 - number of the function + * ebx = 13 - number subfunction + * ecx = 5 - number of the function of the driver + * edx = 0/1 - reduce/increase a size on a horizontal by one position + * edx = 2/3 - in current realization is not supported; is planned as + decrease/increase of a size on a vertical for one position +Returned value: + * eax = -1 - driver is not loaded or is not initialized + * eax = 0 - successfully + * ebx, ecx fail +Remarks: + * Driver previously should be initialized by function call of the driver 1. + * Function influences only a physical size of the map on the screen monitor; + the logical size (number of pixels) does not vary. + +====================================================================== +=============== Function 22 - install system date/time. ============== +====================================================================== +Parameters: + * eax = 22 - number of the function + * ebx = 0 - install time + * ecx = 0x00SSMMHH - time in a binary-decimal code (BCD): + * HH=hour 00..23 + * MM=minute 00..59 + * SS=second 00..59 + * ebx = 1 - єёЄрэютшЄ№ фрЄє + * ecx = 0x00DDMMYY - date in a binary-decimal code (BCD): + * DD=day 01..31 + * MM=month 01..12 + * YY=year 00..99 + * ebx = 2 - install day of week + * ecx = 1 for Sunday, ..., 7 for Saturday + * ebx = 3 - install an alarm clock + * ecx = 0x00SSMMHH +Returned value: + * eax = 0 - successfully + * eax = 1 - parameter is given incorrectly + * eax = 2 - CMOS-battery was unloaded +Remarks: + * value of installation of day of week is represented doubtful, as it a + little where is used (day of week it is possible to calculate by date of). + * Alarm clock can be installed on operation in the given time each day. + Thus to disable by its existing system functions it is impossible. + * Operation of an alarm clock consists in generation IRQ8. + * Generally CMOS supports for an alarm clock installation of value 0xFF + as one of parameters and means it, that the appropriate parameter + is ignored. But in current implementation it will not pass + (will return value 1). + * Alarm clock - global system resource; the installation of an alarm clock + automatically cancels the previous installation. However, at present any + program it does not use. + +====================================================================== +============== Function 23 - expect event with timeout. ============= +====================================================================== +If message queue is empty, waits for appearance of the message in queue, but no more indicated time. Then reads out the message from queue. + +Parameters: + * eax = 23 - number of the function + * ebx = timeout (in 1/100 of second) +Returned value: + * eax = 0 - message queue is empty + * differently eax = event (look the list of events) +Remarks: + * Those events are taken into account only which enter into a mask installed + by the function 40. By default it is events redraw, pressing keys + and buttons. + * For check, whether there is a message in queue, use the function 11. + To wait as much as long, use the function 10. + * Transmission ebx=0 results in instant returning eax=0. + * At current realization there will be an immediate return from the function + with eax=0, if the addition ebx with current value of the counter of time + will call 32-bit overflow. + +====================================================================== +======= Function 24, subfunction 1 - begin to play a CD - audio. ===== +====================================================================== +Parameters: + * eax = 24 - number of the function + * ebx = 1 - number subfunction + * ecx = 0x00FRSSMM, where + * MM = initial minute + * SS = initial second + * FR = initial frame +Returned value: + * eax = 0 - successfully + * eax = 1 - base CD is not defined +Remarks: + * Previously it is necessary to define a base port CD by call + subfunction 3 functions 21. + * In one second 75 frames, in one minute 60 seconds. + * Function is asynchronous (returns handle, when the playing) began. + +====================================================================== +====== Function 24, subfunction 2 - get information on tracks. ======= +====================================================================== +Parameters: + * eax = 24 - number of the function + * ebx = 2 - number subfunction + * ecx = pointer on the buffer for the table + (maximal 8*64h+4 byte =100 tracks) +Returned value: + * eax = 0 - successfully + * eax = 1 - base CD is not defined +Remarks: + * The format of the table with the information on tracks same, as well + as for a ATAPI-CD of the command 43h (READ TOC), usual table + (subcommand 00h). The addresses come back in the format MSF. + * Previously it is necessary to define a base port CD by call + subfunction 3 functions 21. + * Function returns the information only about no more than 100 first tracks. + In most cases it is enough of it. + +====================================================================== +========= Function 24, subfunction 3 - stop play CD - audio. ========= +====================================================================== +Parameters: + * eax = 24 - number of the function + * ebx = 1 - number subfunction +Returned value: + * eax = 0 - successfully + * eax = 1 - base CD is not defined +Remarks: + * Previously it is necessary to define a base port CD by call + subfunction 3 functions 21. + +====================================================================== +================= Function 25 - install volume SBPro. ================ +====================================================================== +Parameters: + * eax = 25 - number of the function + * ebx = what to install: + * 1 - install common volume + * 2 - install volume of CD - audio + * cl = Level of volume: high 4 bits for the left column, low 4 - for right +Returned value: + * eax = 0 - successfully + * eax = 1 - base SB is not defined + * eax = 2 - incorrect subfunction +Remarks: + * Previously it is necessary to define a base port SB by call + subfunction 4 functions 21. + * See also function 28 installations of a sound for later standard SB16. + +====================================================================== +======== Function 26, subfunction 1 - get base port MPU MIDI. ======== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 1 - number subfunction +Returned value: + * eax = number of a port +Remarks: + * Install a base port it is possible by call subfunction of 1 function 21. + +====================================================================== +========== Function 26, subfunction 2 - get keyboard layout. ========= +====================================================================== +The keyboard layout is used for conversion scancodes, acting from the keyboard, +in ASCII-codes which were read - out by the function 2. +Parameters: + * eax = 26 - number of the function + * ebx = 2 - number subfunction + * ecx = what layout to get: + * 1 = normal layout + * 2 = layout at pressed Shift + * 3 = layout at pressed Alt + * edx = pointer on the buffer of length 128 bytes, where the layout + will be copied +Returned value: + * function does not return value +╚ыш: + * eax = 26 - number of the function + * ebx = 2 - number subfunction + * ecx = 9 +Returned value: + * eax = identifier of the country (1=eng, 2=fi, 3=ger, 4=rus) +Remarks: + * If is pressed Alt, the layout with Alt is used; if not is pressed Alt, + but is pressed Shift, the layout with Shift is used; if not are + pressed Alt and Shift, but is pressed Ctrl, the normal layout is used, + then from the code is subtracted 0x60; if not any of direction keys + is pressed, the normal layout is used. + * Install layouts and identifier of the country it is possible with the help + subfunction 2 functions 21. + * The identifier of the country - global environment variable, which by + kernel is not used; however application @panel displays an icon, + appropriate to the current country (using the described function). + * Application @panel switches layouts on search of the user. + +====================================================================== +============= Function 26, subfunction 3 - get base CD. ============== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 3 - number subfunction +Returned value: + * eax = base CD: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 +Remarks: + * Base CD is used by the function 24. + * Install base CD it is possible by call subfunction 3 functions 21. + +====================================================================== +====== Function 26, subfunction 4 - get base port Sound Blaster. ===== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 4 - number subfunction +Returned value: + * eax = number of a base port +Remarks: + * Installation of base is necessary for operation of functions 25, 55. + * Install a base port it is possible by call subfunction 4 functions 21. + +====================================================================== +======== Function 26, subfunction 5 - get language of system. ======== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 5 - number subfunction +Returned value: + * eax = language of system (1=eng, 2=fi, 3=ger, 4=rus) +Remarks: + * Language of the system - global environment variable in any way which + is not used by kernel, however application @panel draws + an appropriate icon (using described function). + * Install the language of the system it is possible by call + subfunction 5 functions 21. + +====================================================================== +=========== Function 26, subfunction 6 - get base port WSS. ========== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 6 - number subfunction +Returned value: + * eax = base port +Remarks: + * Base WSS is used by the function 27. + * Install a base port WSS it is possible by call subfunction 6 functions 21. + +====================================================================== +============== Function 26, subfunction 7 - get base HD. ============= +====================================================================== +The base HD is necessary for definition, on what hard disk to write, at usage +of out-of-date functions of operation with a file system and functions +implicitly using the hard disk (such as subfunction of 6 functions 18); +At usage of functions 58 and 70 and modern syntax /HD0, /HD1, /HD2, /HD3 +these functions install base. +Parameters: + * eax = 26 - number of the function + * ebx = 7 - number subfunction +Returned value: + * eax = base HD: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 +Remarks: + * Any application at any moment of time can change срчє. + * Install base it is possible by call subfunction 7 functions 21. + * Get used partition of the hard disk it is possible subfunction 8. + +====================================================================== +=========== Function 26, subfunction 8 - get partition HD. =========== +====================================================================== +The partition HD is necessary for definition, on what partition of the hard disk +to write, at usage of out-of-date functions of operation with a file system and +functions implicitly using the hard disk (such as subfunction of 6 functions +18); at usage of functions 58 and 70 and modern syntax /HD0, /HD1, /HD2, /HD3 +these functions install base and partition. +Parameters: + * eax = 26 - number of the function + * ebx = 8 - number subfunction +Returned value: + * eax = partition HD (beginning from 1) +Remarks: + * Any application at any moment of time can change partition. + * Install partition it is possible by call subfunction 8 functions 21. + * Find out number of partitions on the hard disk it is possible by call + subfunction 11 functions 18. + * Get used base of the hard disk it is possible subfunction 7. + +====================================================================== +=== Function 26, subfunction 9 - get value of the counter of time. === +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 9 - number subfunction +Returned value: + * eax = number of 1/100 second, past from the moment of start of the system +Remarks: + * counter takes modulo 2^32, that there corresponds by little more+ + than 497 day. + * System time can be get by the function 3. + +====================================================================== +====== Function 26, subfunction 10 - get channel DMA for a sound. ==== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 10 - number subfunction +Returned value: + * eax = number of the channel (from 0 up to 3 inclusively) +Remarks: + * Number of the channel DMA is used in subfunction 1 function 55. + * Install the channel DMA for a sound it is possible by call + subfunction 10 functions 21. + +====================================================================== +====================== Function 26, subfunction 11 =================== +========= Find out, whether low level access to HD is allowed. ======= +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 11 - number subfunction +Returned value: + * eax = 0/1 - prohibit/permit +Remarks: + * Is used at LBA-reading (subfunction 8 functions 58). + * Install a current status it is possible by call + subfunction 11 functions 21. + +====================================================================== +====================== Function 26, subfunction 12 =================== +======= Find out, whether low level access to PCI is allowed. ======== +====================================================================== +Parameters: + * eax = 26 - number of the function + * ebx = 12 - number subfunction +Returned value: + * eax = 0/1 - prohibit/permit +Remarks: + * Is used by operation with the bus PCI (function 62). + * Current realization uses only low bit ecx. + * install a current status it is possible by call + subfunction 12 functions 21. + +====================================================================== +==== Function 27 - install volume Windows Sound System (WSS). === +====================================================================== +Parameters: + * eax = 27 - number of the function + * ebx = what to install: + * 1 - install common volume + * 2 - install volume Line In + * cl = Level of volume (0x0 = highest, 0x1F = lowest, + installed bit 0x80 = to disable) +Returned value: + * eax = 0 - successfully + * eax = 1 - the base WSS is not defined + * eax = 2 - incorrect subfunction +Remarks: + * Previously it is necessary to define a base port WSS by call + subfunction 6 functions 21. + * Installation of common volume is actually ignored (comes back eax=0). + * In old documentation and in source code of a kernel subfunction 2 + is erraticly called as volume of a CD - audio. + +====================================================================== +================= Function 28 - install volume SB16. ================= +====================================================================== +Parameters: + * eax = 28 - number of the function + * ebx = what to install: + * 1 - install common volume + * 2 - install volume of a CD - audio + * cl = level of volume (0=off, 0xFF=max) +Returned value: + * eax = 0 - successfully + * eax = 1 - the base SB is not defined + * eax = 2 - incorrect subfunction +Remarks: + * Previously it is necessary to define a base port SB by call + subfunction 4 functions 21. + * This function gives more variants for volume, than function 25. + +====================================================================== +==================== Function 29 - get system date. ================== +====================================================================== +Parameters: + * eax = 29 - number of the function +Returned value: + * eax = 0x00DDMMYY, where + (binary-decimal coding is used, BCD) + * YY = two low digits of year (00.. 99) + * MM = month (01.. 12) + * DD = day (01.. 31) +Remarks: + * The system date can be installed by the function 22. + +====================================================================== +=============== Function 32 - delete file with ramdisk. ============== +====================================================================== +Parameters: + * eax = 32 - number of the function + * ebx = pointer on a filename +Returned value: + * eax = 0 - successfully; differently error code of a file system +Remarks: + * This function is obsolete; the function 58 allows to fulfil the same + operations with the extended possibilities. + * Current realization returns only values 0 (successes) + and 5 (the file is not retrieved). + * The filename should be or in the format 8+3 characters (first 8 characters + - purely name, last 3 - extension, the short names and extensions are + supplemented by blanks), or in the format 8.3 characters + "FILE.EXT" / "FILE.EX" (name no more than 8 characters, point, + extension 3 characters supplemented if necessary by blanks). + Filename should be written by capital letters. The completing character + with the code 0 is not necessary (ASCIIZ-string). + +====================================================================== +=============== Function 33 - save file on ramdisk. ================== +====================================================================== +Parameters: + * eax = 33 - number of the function + * ebx = pointer on a filename + * ecx = pointer on data for save + * edx = number byte for save + * it is necessary to install esi=0 +Returned value: + * eax = 0 - successfully, differently error code of a file system +Remarks: + * This function is obsolete; the function 58 allows to fulfil the same + operations with the extended possibilities. + * If to specify non-zero value in esi and on ramdisk already there is an + indicated file, one more file with the same name will be created. + * Otherwise file is resave. + * The filename should be or in the format 8+3 characters (first 8 characters + - purely name, last 3 - extension, the short names and extensions are + supplemented by blanks), or in the format 8.3 characters + "FILE.EXT" / "FILE.EX" (name no more than 8 characters, point, + extension 3 characters supplemented if necessary by blanks). + Filename should be written by capital letters. The completing character + with the code 0 is not necessary (ASCIIZ-string). + +====================================================================== +======== Function 35 - read colour of a point on the screen. ========= +====================================================================== +Parameters: + * eax = 35 + * ebx = y*xsize+x, where + * (x,y) = coordinates of a point (considering from 0) + * xsize = size of the screen on a horizontal +Returned value: + * eax = colour 0x00RRGGBB +Remarks: + * Find out sizes of the screen it is possible by function call 14. + Pay attention, that it subtracts 1 of both sizes. + * To a video memory there is also direct access (without calls of system + functions) through the selector gs. Parameters of current videomode + it is possible to receive by the function 61. + +====================================================================== +=========== Function 37 - get coordinate/status of mouse. ============ +====================================================================== + +------------ Subfunction 0 - screen coordinates of mouse ------------- +Parameters: + * eax = 37 - number of the function + * ebx = 0 - number subfunction +Returned value: + * eax = x*65536 + y, (x,y)=coordinates of mouse pointer (considering from 0) + +------ Subfunction 1 - coordinates of mouse concerning window ------- +Parameters: + * eax = 37 - number of the function + * ebx = 1 - number subfunction +Returned value: + * eax = x*65536 + y, (x,y)=coordinates of mouse pointer concerning + an application window (considering from 0) +Remarks: + * Value is calculated under the formula (x-xwnd) *65536 + (y-ywnd). + If y > =ywnd, the low word nonnegatively also contains relative + y-coordinate, and high - relative x-coordinate (correct sign). + Otherwise low word negatively and all the same contains relative + y-coordinate, and to a high word it is necessary to add 1. + +---------------- Subfunction 2 - pressed mouse buttons ---------------- +Parameters: + * eax = 37 - number of the function + * ebx = 2 - number subfunction +Returned value: + * eax contains information on the pressed mouse buttons: + * Bit 0 installed = left button pressed + * Bit 1 installed = right button pressed + * Other bits are reset + +====================================================================== +====================== Function 38 - draw line. ====================== +====================================================================== +Parameters: + * eax = 38 - number of the function + * ebx = [coordinate began on axis x] *65536 + + [coordinate of the end on axis x] + * ecx = [coordinate began on axis y]*65536 + + [coordinate of the end on axis y] + * edx = 0x00RRGGBB - colour +Returned value: + * function does not return value +Remarks: + * Coordinates take concerning window. + * Finite point also is drawn. + +====================================================================== +===== Function 39, subfunction 1 - get size of background image. ===== +====================================================================== +Parameters: + * eax = 39 - number of the function + * ebx = 1 - number subfunction +Returned value: + * eax = [width]*65536 + [height] +Remarks: + * There is a pair command of installation of sizes of background image - + subfunction of 1 function 15. After which, certainly, it is necessary + anew to define image. + +====================================================================== +== Function 39, subfunction 2 - read a point from background image. == +====================================================================== +Parameters: + * eax = 39 - number of the function + * ebx = 2 - number subfunction + * ecx = offset +Returned value: + * eax = 0x00RRGGBB - colour of a point, if offset is valid (less 0x160000-16) + * eax = 2 - differently +Remarks: + * It is not necessary to rely on returned value in case of incorrect offset, + it can vary in the following versions of a kernel. + * Offset of a point with coordinates (x, y) is calculated as (x+y*xsize) *3. + * There is a pair function of installation of a point on background image - + subfunction 2 functions 15. + +====================================================================== +==== Function 39, subfunction 4 - get mode redraw of background. ===== +====================================================================== +Parameters: + * eax = 39 - number of the function + * ebx = 4 - number subfunction +Returned value: + * eax = 1 - tiled + * eax = 2 - stretched +Remarks: + * There is a pair function of installation of mode redraw of a background - + subfunction 4 functions 15. + +====================================================================== +========== Function 40 - install a mask for expected events. ========= +====================================================================== +Mask for expected events influences function of operation with events 10, +11, 23 - they inform only events allowed by this mask. +Parameters: + * eax = 40 - number of the function + * ebx = mask: bit i corresponds to event i+1 (see list of events) + (installed bit permits notice on event) +Returned value: + * function does not return value +Remarks: + * Mask by default (7=111b) permits notices about redraw, + pressings keys and buttons. + It is enough of it for the majority of the applications. + * The events prohibited in a mask, are all same saved, if come; + with events simply do not inform on them functions of operation. + * Functions of operation with events take into account a mask on moment + of function call, instead of on moment of arrival of message. + +====================================================================== +=============== Function 41 - find out the owner IRQ. ================ +====================================================================== +Parameters: + * eax = 41 - number of the function + * ebx = number IRQ, 0..15 +Returned value: + * eax = PID of owner + * eax = 0, if owner is not present + * eax = -1 for incorrect ebx + +====================================================================== +=============== Function 42 - read data obtained on IRQ. ============= +====================================================================== +At occurrence IRQ system can read out data from indicated earlier by +function 44 ports and to write these data in buffer. +Described function reads out on byte the data from this buffer. +Parameters: + * eax = 42 - number of the function + * ebx = number IRQ, 0..15 +Returned value: (situation can be distinguished on value ecx) + * if thread is not owner IRQ + (or number IRQ is given incorrectly): + * ecx = 2 + * if data is not present: + * eax = 0 + * ecx = 1 + * ebx fail + * if all in the order and data were: + * eax = size given, yet not read from the buffer (in bytes) + * ecx = 0 + * ebx = current byte +Remarks: + * Previously thread should reserve for itself indicated IRQ + by the function 45. + * Size of the buffer for the data - 4000 bytes, at overflow + the "fresh" data cease to be written in the buffer. + +====================================================================== +================ Function 43 - input/output in port. ================= +====================================================================== + +------------------------ Data output in port ------------------------- +Parameters: + * eax = 43 - number of the function + * bl = byte for output + * ecx = number of port 0xnnnn (from 0 up to 0xFFFF) +Returned value: + * eax = 0 - successfully + * eax = 1 - thread the indicated port has not reserved + +------------------------ Data input from a port ------------------------ +Parameters: + * eax = 43 - number of the function + * ebx ignored + * ecx = 0x8000nnnn, where nnnn = number of port (from 0 up to 0xFFFF) +Returned value: + * eax = 0 - successfully, thus ebx = entered byte + * eax = 1 - thread the given port has not reserved +Remarks: + * Previously thread should reserve behind itself the indicated port + by the function 46. + * For the reserved ports instead of call of these functions it is better + to use commands of the processor in/out is much faster both a little bit + more shortly and easier. From the non-reserved ports to read all the same + it is impossible. + +====================================================================== +=========== Function 44 - define operations at arrival IRQ. ========== +====================================================================== +At occurrence IRQ the system can read out the data from the ports, indicated +by this function, and to write these data in the buffer, whence they can be +read by the function 42. +Parameters: + * eax = 44 - number of the function + * ebx = pointer on the array of structures describing on one port: + * +0: word: 0 means the end of the array, differently number of a port + * +2: byte: reserved (ignored) + * +3: byte: 1 = read out byte from this port, 2 = read out a word + * ecx = number IRQ, 0..15 +Returned value: + * eax = 0 - successfully + * eax = 1 - thread is not owner indicated IRQ +Remarks: + * Previously thread should reserve behind itself indicated IRQ + by the function 45. + * First 16 ports are considered only. + * Current implementation considers incorrect value of a field +3 + as a signal of termination of processing IRQ. + +====================================================================== +============ Function 45 - reserve/free IRQ. ============ +====================================================================== +Parameters: + * eax = 45 - number of the function + * ebx = 0 - reserve, 1 = free + * ecx = number IRQ, 0..15 +Returned value: + * eax = 0 - successfully + * eax = 1 - error (incorrect number IRQ or attempt reserve not free IRQ + or to free IRQ, not reserved by current stream) +Remarks: + * Reserved IRQ is necessary for operation of functions 42 and 44. + * Only one thread can reserve selected IRQ. + * IRQ, processed by the system is independent, are reserved by + the system (stream 1) at loading. + * At completion thread are automatically released all reserved by it IRQ. + +====================================================================== +==== Function 46 - reserve/free group of ports of input/output. ====== +====================================================================== +It is possible to access to the reserved ports directly from the application by +commands in/out (recommended way) and function call 43 (not recommended way). +Parameters: + * eax = 46 - number of the function + * ebx = 0 - reserve, 1 - free + * ecx = number of a beginning of a range of ports + * edx = number of the end of a range of ports (inclusively) +Returned value: + * eax = 0 - successfully + * eax = 1 - error +Remarks: + * In case of backup of ports the error considers execution of one + of conditions: + * beginning address more than end address; + * indicated range contains incorrect number of a port + (correct - from 0 up to 0xFFFF); + * limitation on a total number of the reserved areas - + is exceeded the maximal 255 is admitted; + * indicated range is intersected with one of earlier reserved + * In case of release of ports the error considers attempt of release of + a range, which was not wholly reserved by same function (with the same + values ecx, edx) earlier. + * At detection of an error (in both cases) any operations is not does. + * At loading the system reserved behind itself ports 0.. 0xff, and at + detection of COM-mouse - in addition range of COM-ports 0x3f0.. 0x3ff + and/or 0x2f0.. 0x2ff. + * At completion thread all ports, reserved by it are automatically free. + +====================================================================== +============== Function 47 - draw number in window. ================== +====================================================================== +Parameters: + * eax = 47 - number of the function + * ebx = parameters of conversion of number in the text: + * bl = 0 - ecx contains number + * bl = 1 - ecx contains the pointer on dword-number + * bh = 0 - to display in a decimal number system + * bh = 1 - to display in the hexadecimal system + * bh = 2 - to display in the binary system + * Bits 16-21 = how many digits to display + * The bits 22-31 are reserved and should be installed in 0 + * ecx = number (at bl=0) or pointer (at bl=1) + * edx = [coordinate on axis x]*65536 + [coordinate on axis y] + * esi = 0xN0RRGGBB, RRGGBB=colour, N=font (0/1) +Returned value: + * function does not return value +Remarks: + * Indicated length should not exceed 60. + * The equally indicated amount of digits is output. If the number a little + also can be written by smaller amount of digits, it is supplemented by + leading zeroes; if the number is great and can not be written by such + amount of digits, the "superfluous" carrying on digits are not draw. + * Parameters of fonts are indicated in the description of the function 4 + (output of the text). + +====================================================================== +===== Function 48, subfunction 0 - apply adjustments of screen. ====== +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 0 - number subfunction + * ecx = 0 - reserved +Returned value: + * function does not return value +Remarks: + * Function redraw the screen after change of parameters + subfunctions 1 and 2. + * Function call without prior calls indicated subfunctions is ignored. + * Function call with non-zero ecx is ignored. + +====================================================================== +======= Function 48, subfunction 1 - install style of buttons. ======= +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 1 - number subfunction + * ecx = type of buttons: + * 0 = flat buttons + * 1 = 3d buttons +Returned value: + * function does not return value +Remarks: + * After call of the described function follows redraw + the screen subfunction 0. + * Type of buttons influences only their plotting by the function 8. + +======================================================================== +== Function 48, subfunction 2 - install standard colours of windows. === +======================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 2 - number subfunction + * ecx = pointer on the color table + * edx = size of the color table + (should be 40 bytes for the future compatibility) +Format of the color table is indicated in the description subfunction 3. +Returned value: + * function does not return value +Remarks: + * After call of the described function follows redraw + the screen subfunction 0. + * Table of standard colours influences only the applications, which receive + this table by an obvious way (subfunction 3) and use (specifying colours + from it by calls of functions of drawing). + * Table of standard colours enters in skin and is installed anew + at installation skin (subfunction 8). + * Color table can be viewed/changed online with the help of + the application desktop. + +====================================================================== +=== Function 48, subfunction 3 - get standard colours of windows. ==== +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 3 - number subfunction + * ecx = pointer on the buffer the size edx byte, where will write the table + * edx = size of the color table + (should be 40 bytes for the future compatibility) +Returned value: + * function does not return value +Format of the color table: each unit - +dword-value of colour 0x00RRGGBB + * +0: dword: frames - colour of frame + * +4: dword: grab - colour of header + * +8: dword: grab_button - colour of the button on a bar of header + * +12 = +0xC: dword: grab_button_text - colour of the text on the button + on a bar of header + * +16 = +0x10: dword: grab_text - colour of the text on header + * +20 = +0x14: dword: work - colour of a working area + * +24 = +0x18: dword: work_button - colour of the button in a working area + * +28 = +0x1C: dword: work_button_text - colour of the text on the button + in a working area + * +32 = +0x20: dword: work_text - colour of the text in a working area + * +36 = +0x24: dword: work_graph - colour of a graphics in a working area +Remarks: + * structure of the color table is described in the standard included file + macros.inc under the name system_colors; for example, it is possible + to write: + sc system_colors ; declaration of a variable + ... ; where it is necessary to call + ; described function with ecx=sc + mov ecx, [sc.work_button_text] ; read colour of the text + ; on the button in a working area + * Usage/non-use of these colours - business is exclusively of the program. + For usage it is necessary simply at call of functions of drawing to + specify colour, taken from this table. + * At change of the table of standard colours (subfunction 2 with the + subsequent application of changes subfunction 0 or at installation skin + subfunction 8) all windows the message on necessity redraw (event with + the code 1) is dispatched. + * Color table can be viewed/changed online with the help of + the application desktop. + +====================================================================== +========== Function 48, subfunction 4 - get height of skin. ========== +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 4 - number subfunction +Returned value: + * eax = height of skin +Remarks: + * Height skin on definition considers height of header + of windows using skin. + * See also common structure of the window in the description + of the function 0. + +====================================================================== +==== Function 48, subfunction 5 - get working area of the screen. ==== +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 5 - number subfunction +Returned value: + * eax = [left]*65536 + [right] + * ebx = [top]*65536 + [bottom] +Remarks: + * Working area of the screen defines a location and coordinates + of the maximized window. + * Working area of the screen by normal operation is all screen + minus the panel (@panel). + * (left,top) - coordinates of the left upper corner, + (right,bottom) - coordinates of the right lower corner. + Thus, the size of a working area on an axis x is defined by + the formula right-left+1, on an axis y - formula bottom-right+1. + * See also function 14, permitting to define sizes of all screen. + * There is a pair function of installation of a working area - + subfunction 6. + +====================================================================== +=== Function 48, subfunction 6 - install a working area of screen. === +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 6 - number subfunction + * ecx = [left]*65536 + [right] + * edx = [top]*65536 + [bottom] +Returned value: + * function does not return value +Remarks: + * Working area of the screen defines a location and coordinates + of the maximized window. + * This function is used only by application @panel, installing by + a working area all screen minus the panel. + * (left,top) - coordinates of the left upper corner, + (right,bottom) - coordinates of the right lower corner. + Thus, the size of a working area on an axis x is defined by + the formula right-left+1, on an axis y - formula bottom-right+1. + * If left > =right, the x-coordinates of a working area do not vary. + If left < 0, left is not installed. If right it is more or equally + width of the screen, right is not installed. Similarly on an axis y. + * See also function 14, permitting to define sizes of all screen. + * There is a pair function of get of a working area - subfunction 5. + * This function automatically redraw the screen, on a course of business + updates coordinates and rule(situation) of the maximized windows. + All windows are informed on necessity redraw (event 1). + +====================================================================== +====================== Function 48, subfunction 7 ==================== +================= Get skin area for the text of header. ============== +====================================================================== +Returns title bar of the window with skin, intended for output of the +text of header. +Parameters: + * eax = 48 - number of the function + * ebx = 7 - number subfunction +Returned value: + * eax = [left]*65536 + [right] + * ebx = [top]*65536 + [bottom] +Remarks: + * Usage/non-use of this function - personal business of the application. + * It is recommended to take into account values returned by this function, + at choice of a place for drawing the text of header (function 4) or any + of a substitute of the text of header (at the discretion of the + application). + +====================================================================== +===== Function 48, subfunction 8 - install used skin of windows. ===== +====================================================================== +Parameters: + * eax = 48 - number of the function + * ebx = 8 - number subfunction + * ecx = pointer on the block for the function 58, in which the field of + the intermediate buffer is placed(installed) and the filename is indicated +Returned value: + * eax = 0 - successfully + * differently eax = an error code of a file system; if the file does + not set skin, comes back error 3 (unknown file system). +Remarks: + * At successful loading skin all windows are informed on necessity + redraw (event 1). + * At loading the system reads out skin from the file default.skn on ramdisk. + * User can change skin statically, having created default.skn, + or dynamically with the help of the application desktop. + +====================================================================== +============ Function 49 - Advanced Power Management (APM). =========== +====================================================================== +Parameters: + * eax = 49 - number of the function + * dx = number of the function APM (clone ax in the specification) + * bx, cx = parameters of the function APM +Returned value: + * 16-bit registers ax, bx, cx, dx, si, di and flag CF are installed + according to the specification APM + * high halves of 32-bit registers eax, ebx, ecx, edx, esi, edi fail +Remarks: + * Specification APM 1.2 is described in document + "Advanced Power Management (APM) BIOS Specification " + (Revision 1.2), accessible on + http://www.microsoft.com/whdc/archive/amp_12.mspx; + besides it is included in known Interrupt List by Ralf Brown + (http://www.pobox.com/~ralf/files.html, + ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/). + +====================================================================== +=========== Function 50 - installation of form of window. ============ +====================================================================== +The usual windows represent rectangles. With the help of this function the +window can add the arbitrary form. The form sets by a set of points inside +a framing rectangle concerning to the window. Location and the sizes of +a framing rectangle are set by the function 0 and vary with the function 67. + +----------- Installation of data with information on form ------------ +Parameters: + * eax = 50 - number of the function + * ebx = 0 - number subfunction + * ecx = pointer on the given forms (array byte 0/1) +Returned value: + * function does not return value + +---------------- Installation of a scale of given form --------------- +Parameters: + * eax = 50 - number of the function + * ebx = 1 - number subfunction + * ecx sets a scale: each byte of the data defines + (2^scale) * (2^scale) of pixels +Returned value: + * function does not return value +Remarks: + * Scale is by default equal 0 (scaling factor 1). If in the given form + of one byte corresponds to one pixel, the scale is possible to not install. + * Let's designate xsize = width of the window (in pixels), ysize = height; + pay attention, that they on unit are more, than installed by + functions 0, 67. + * On definition of a scale xsize and ysize should be divided on 2^scale. + * Byte of the data on offset a should be 0/1 and defines an accessory to + the window of a square with the side 2^scale (at scale=0 we receive + a pixel) and coordinates of the left upper corner + (a mod (xsize shr scale), a div (xsize shr scale)) + * Size of the data: (xsize shr scale)*(ysize shr scale). + * Data should be present at memory and not vary after installation + of the form. + * System views the data on the form at everyone redraw of the window + by the function 0. + * Call subfunction 0 with the zero pointer results in return to the + rectangular form. + +====================================================================== +==================== Function 51 - create thread. ==================== +====================================================================== +Parameters: + * eax = 51 - number of the function + * ebx = 1 - sole subfunction + * ecx = address of an entry point thread (begin eip) + * edx = pointer of the stack thread (begin esp) +Returned value: + * eax = -1 - error (In the system it is too much threads) + * differently eax = TID - identifier thread + +====================================================================== +== Function 52, subfunction 0 - get configuration of network driver. = +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 0 - number subfunction +Returned value: + * eax = double word of the configuration +Remarks: + * Word of the configuration can be installed subfunction 2. + * Kernel does not use an appropriate variable. The value of this variable + and working with it(her) subfunctions 0 and 2 is represented doubtful. + +====================================================================== +========= Function 52, subfunction 1 - get local IP address. ========= +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 1 - number subfunction +Returned value: + * eax = IP-address (4 bytes) +Remarks: + * Local IP-address is installed subfunction 3. + +====================================================================== + Function 52, subfunction 2 - install configuration of network driver. +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 2 - number subfunction + * ecx = Double word of the configuration; if the low 7 bits will derivate + number 3, it is perceived as call about reinitialization + of a Ethernet-map, otherwise Ethernet is switched off +Returned value: + * if not the Ethernet-interface is requested, comes back eax=2, + but it can vary in the future versions of a kernel + * if the Ethernet-interface is requested, eax=0 means an error + (absence of a Ethernet-map), and non-zero value - success +Remarks: + * Word of the configuration can be read subfunction 0. + * Kernel does not use an appropriate variable. The value of this variable, + subfunction 0 and part subfunction 2, installing this variable, + is represented doubtful. + +====================================================================== +========= Function 52, subfunction 3 - set local IP-address. ========= +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 3 - number subfunction + * ecx = IP-address (4 bytes) +Returned value: + * Current realization returns eax=3, but it can be changed + in the future versions +Remarks: + * Local IP-address can be received subfunction 1. + +====================================================================== += Function 52, subfunction 6 - add data in stack of an input queue. == +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 6 - number subfunction + * edx = size of the data + * esi = pointer on the data +Returned value: + * eax = -1 - error + * eax = 0 - successfully +Remarks: + * This function is intended only for slow network drivers (PPP, SLIP). + * Size of the data should not exceed 1500 bytes, though checks + of a correctness is not done(made). + +====================================================================== +====================== Function 52, subfunction 8 ==================== +============== Read given from a network output queue. =============== +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 8 - number subfunction + * esi = pointer on the buffer by a size of 1500 bytes +Returned value: + * eax = Number read byte (in current implementation or + 0 = there are no data, or 1500) + * data are copied in the buffer +Remarks: + * This function is intended only for slow network drivers (PPP, SLIP). + +====================================================================== +=========== Function 52, subfunction 9 - get gateway IP. ========== +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 9 - number subfunction +Returned value: + * eax = gateway IP (4 bytes) + +====================================================================== +========= Function 52, subfunction 10 - get mask of a subnet. ======== +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 10 - number subfunction +Returned value: + * eax = mask of a subnet + +====================================================================== +========= Function 52, subfunction 11 - install gateway IP. ========= +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 11 - number subfunction + * ecx = gateway IP (4 bytes) +Returned value: + * current realization returns eax=11, but it can be changed in the + future realizations + +====================================================================== +====== Function 52, subfunction 12 - install mask of a subnet. ======= +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 12 - number subfunction + * ecx = mask of a subnet +Returned value: + * Current realization returns eax=12, but it can be changed + in the future versions + +====================================================================== +============ Function 52, subfunction 13 - get DNS IP. ============ +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 13 - number subfunction +Returned value: + * eax = DNS IP (4 bytes) + +====================================================================== +=========== Function 52, subfunction 14 - install DNS IP. ============ +====================================================================== +Parameters: + * eax = 52 - number of the function + * ebx = 14 - number subfunction + * ecx = DNS IP (4 bytes) +Returned value: + * Current realization returns eax=14, but it can be changed + in the future versions + +====================================================================== +============ Function 53, subfunction 0 - open UDP-socket. ============ +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 0 - number subfunction + * ecx = local port (is taken into account only low word) + * edx = remote port (is taken into account only low word) + * esi = remote IP +Returned value: + * eax = -1 = 0xFFFFFFFF - error; ebx fail + * eax = socket number (some number unambiguously identifying socket and + having sense only for the system) - successfully + ebx fail + +====================================================================== +============ Function 53, subfunction 1 - close UDP-socket. =========== +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 1 - number subfunction + * ecx = socket number +Returned value: + * eax = -1 - incorrect number + * eax = 0 - successfully + * ebx fail +Remarks: + * The current realization does not close automatically all sockets thread + at its completion. In particular, it is not necessary to kill thread + with a heap open sockets - there will be an outflow of resources. + * The current realization does not do checks on a correctness + (sole, to what the attempt comes back error, - to close not open socket + with correct number). + +====================================================================== +============== Function 53, subfunction 2 - poll socket. ============= +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 2 - number subfunction + * ecx = socket number +Returned value: + * eax = number getting bytes + * ebx fail +Remarks: + * Checks of a correctness is not done. + +====================================================================== +======== Function 53, subfunction 3 - read byte from socket. ========= +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 3 - number subfunction + * ecx = number socket +Returned value: + * if there are no accepted data: eax=0, bl=0, the other bits ebx fail + * If there were accepted data: eax = number stayed byte (is possible, 0), + bl = read byte, the other bits ebx fail +Remarks: + * Checks of a correctness is not done. + +====================================================================== +======== Function 53, subfunction 4 - write in UDP-socket. =========== +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 4 - number subfunction + * ecx = number socket + * edx = number bytes for writing + * esi = pointer on data for writing +Returned value: + * eax = 0xffffffff - incorrect number + * eax = 0xffff - lack of memory + * eax = 0 - successfully + * ebx fail +Remarks: + * Check on valid number is minimum - are eliminated only not so incorrect + not open numbers. + * Number bytes for writing can not exceed 1500-28, though appropriate + check is not done. + +====================================================================== +============ Function 53, subfunction 5 - open TCP-socket. =========== +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 5 - number subfunction + * ecx = local port (is taken into account only low word) + * edx = remote port (is taken into account only low word) + * esi = remote IP + * edi = mode of opening: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1 +Returned value: + * eax = -1 = 0xFFFFFFFF - error; ebx fail + * eax = number socket (some number unambiguously identifying socket + and having sense only for the system) - successfully; ebx fails + +====================================================================== +======== Function 53, subfunction 6 - get status TCP-socket. ========= +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 6 - number subfunction + * ecx = number socket +Returned value: + * eax = status socket: one of + * TCB_LISTEN = 1 + * TCB_SYN_SENT = 2 + * TCB_SYN_RECEIVED = 3 + * TCB_ESTABLISHED = 4 + * TCB_FIN_WAIT_1 = 5 + * TCB_FIN_WAIT_2 = 6 + * TCB_CLOSE_WAIT = 7 + * TCB_CLOSING = 8 + * TCB_LAST_ASK = 9 + * TCB_TIME_WAIT = 10 + * TCB_CLOSED = 11 + * ebx fail +Remarks: + * Checks of a correctness is not made. + +====================================================================== +========== Function 53, subfunction 7 - write in TCP-socket. ========= +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 7 - number subfunction + * ecx = number socket + * edx = number bytes for writing + * esi = pointer on data for writing +Returned value: + * eax = 0xffffffff - error + * eax = 0xffff - lack of memory + * eax = 0 - successfully + * ebx fail +Remarks: + * Check on valid number is minimum - are eliminated only not so incorrect + not open numbers. + * Number bytes for writing can not exceed 1500-40, though appropriate + check is not done. + +====================================================================== +============ Function 53, subfunction 8 - close TCP-socket. =========== +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 8 - number subfunction + * ecx = number socket +Returned value: + * eax = -1 - incorrect number + * eax = 0xffff - lack of memory for the package of closing socket + * eax = 0 - successfully + * in many cases eax fails (comes back the result of the function queue) - + probably , is an error, which will be corrected + * ebx fail +Remarks: + * The current realization does not close automatically all sockets thread + at its completion. In particular, it is not necessary to kill thread + with a heap open sockets - there will be an outflow of resources. + * The current realization does not do checks on a correctness + (sole, to what the attempt comes back error, - to close not open socket + with correct number). + +====================================================================== +======== Function 53, subfunction 9 - check - local port is free ===== +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 9 - number subfunction + * ecx = number of a local port (the low 16 bits are used only) +Returned value: + * eax = 0 - port is used + * eax = 1 - port is free + * ebx fail + +====================================================================== + Function 53, subfunction 255 - debug information of network driver. = +====================================================================== +Parameters: + * eax = 53 - number of the function + * ebx = 255 - number subfunction + * ecx = type of requested information (see below) +Returned value: + * eax = requested information + * ebx fail +Possible values ecx: + * 100: length of queue 0 (empty queue) + * 101: length of queue 1 (ip-out queue) + * 102: length of queue 2 (ip-in queue) + * 103: length of queue 3 (net1out queue) + * 200: number of units in the table ARP + * 201: a size of the table ARP (in units) (20 in the current version) + * 202: read a unit edx of the table ARP in the temporary buffer, + whence take the information 5 subsequent types; + in this case eax is not defined + * 203: IP-address saved by the type 202 + * 204: high dword of MAC-address saved by the type 202 + * 205: low word of MAC-address saved by the type 202 + * 206: a word of the status saved by the type 202 + * 207: a word ttl, saved by the type 202 + * 2: a total number of the obtained IP-packages + * 3: a total number of the transferred(handed) IP-packages + * 4: a total number dumps of the obtained packages + * 5: a total number of the obtained ARP-packages + * 6: the status of the driver of packages, 0 = is inactive, + non-zero value = is active + + +====================================================================== +========== Function 55, subfunction 0 - load data for SB16. ========== +====================================================================== +Parameters: + * eax = 55 - number of the function + * ebx = 0 - number subfunction + * ecx = pointer on the data (is copied 64 kilobytes, is used so much, + how many is installed subfunction 2) +Returned value: + * function does not return value +Remarks: + * Format and size of data are installed subfunction 2. + +====================================================================== +===== Function 55, subfunction 1 - begin to play data on SB16. ======= +====================================================================== +Parameters: + * eax = 55 - number of the function + * ebx = 1 - number subfunction +Returned value: + * function does not return value +Remarks: + * Previously data should be loaded subfunction 0 and their format + subfunction 2 is defined. + * Function returns handle, when playing the data began; after that the + playing goes irrespective of the application (and at all does not + require loading the processor). + * Previously should be defined a base port SB16 (subfunction 4 functions 21) + and channel DMA (subfunction 10 functions 21). + +====================================================================== +====== Function 55, subfunction 2 - install a data format SB16. ====== +====================================================================== +Parameters: + * eax = 55 - number of the function + * ebx = 2 - number subfunction + * ecx = 0 - install a digit capacity + * edx = 1 - 8 bits mono + * edx = 2 - 8 bits stereo + * ecx = 1 - install a size of data + * edx = size in bytes + * ecx = 2 - install frequency of playing + * edx = frequency +Returned value: + * function does not return value +Remarks: + * At loading the system the following default settings are installed: + a digit capacity - 8 bits mono, size - 64 KB, frequency 44100 Hz. + Nevertheless it is recommended obviously to install necessary values, + as they could be reinstalled by any program. + +====================================================================== +====================== Function 55, subfunction 55 =================== +=============== Begin to play data on built speaker. ================= +====================================================================== +Parameters: + * eax = 55 - number of the function + * ebx = 55 - number subfunction + * esi = pointer on the data +Returned value: + * eax = 0 - successfully + * eax = 55 - error (speaker is disconnected or occupied) +Data is an array of units of a variable length. +Format of each unit is defined in first byte: + * 0 = end of data + * 1..0x80 = sets duration of sounding in 1/100 of second of note + defined by direct value of frequency + * following word (2 bytes) is contained by a divider of frequency; + the frequency is defined as 1193180/divider + * 0x81 = invalid + * 0x82..0xFF = note defined by octave and number: + * duration in 1/100 of second = (first byte) - 0x81 + * there is one more byte; + * (second byte) = 0xFF - pause + * differently it looks like a*0x10+b, where b=number of the note + in an octave from 1 up to 12, a=number of an octave (beginning from 0) +Remarks: + * Speaker play can be disable /enable subfunction 8 functions 18. + * Function returns handle, having informed where follows the information + on play. Playing goes irrespective of the program. + * Data should be saved in memory at least up to the end of playing. + +====================================================================== +================ Function 56 - write file to hard disk. ============== +====================================================================== +Parameters: + * eax = 56 - number of the function + * ebx = pointer on a filename + * ecx = size data for writing (in bytes) + * edx = pointer on data for writing + * esi = pointer on path (ASCIIZ-string) +Returned value: + * eax = 0 - successfully, differently error code of a file system +Remarks: + * This function is obsolete; the function 70 allows to fulfil the same + operations with the extended possibilities. + * Given function assumes, that during its call one application any other + application does not work with the hard disk. + * Path to the file - ASCIIZ-string, which can be empty (if the file creates + in the root) or to have the format /d1/d2/ .../dn, where all names of + directories should have the format 8+3, i.e. 8 characters of a name + and 3 characters of the extension without a separator if necessary + supplemented by blanks; all characters should be capital. + * Name to the file also should have the format 8+3. + +====================================================================== +============== Function 58 - ЁрсюЄр ё Їрщыютющ ёшёЄхьющ. ============== +====================================================================== +Parameters: + * eax = 58 + * ebx = pointer on information structure +Returned value: + * eax = 0 - successfully; differently error code of a file system + * depending on subfunction the value and in other registers can come back +Common format of information structure: + * +0: dword: number subfunction + * +4: dword: number of block + * +8: dword: size + * +12 = +0xC: dword: pointer on data + * +16 = +0x10: dword: pointer on memory for system operation + (4096 bytes) + * +20 = +0x14: n db: ASCIIZ-string with a filename +Specifications - in documentation on appropriate subfunction. +Filename is insensitive to the register of latin characters, +russian characters should be capital. +Format of a filename: +/base/number/dir1/dir2/.../dirn/file, +where /base/number identifies the device, on which the file is searched: +one of + * /RD/1 = /RAMDISK/1 for access to ramdisk + * /FD/1 = /FLOPPYDISK/1 for access to first floppy - drive, + /FD/2 = /FLOPPYDISK/2 for second floppy - drive + * /HD/x = /HARDDISK/x - out-of-date variant of access to the hard disk + (in this case base is defined subfunction 7 functions 21), + x - number of partition (beginning from 1) + * /HD0/x, /HD1/x, /HD2/x, /HD3/x for access accordingly + to devices IDE0 (Primary Master), IDE1 (Primary Slave), + IDE2 (Secondary Master), IDE3 (Secondary Slave); + x - number of partition on selected hard disk, varies from 1 up to 255 + (on each of hard disks the indexing starts with 1) +Remarks: + * In first two cases usage FIRST instead of 1, SECOND instead of 2 is + admitted, but to use this possibility it is not recommended for + convenience of transition on the future extensions. + * Imposed limitation n<=39. + * Names of folders and file dir1..., dirn, file should be in the format 8.3: + a name no more than 8 characters, point, extension no more than 3 + characters. The tail blanks are ignored. Other blanks be does not owe. + If the name occupies equally 8 characters, the point can be omitted + (though to use it it is not recommended for convenience of transition + on the future extensions). +Examples: + * '/RAMDISK/FIRST/KERNEL.ASM',0 + '/rd/1/kernel.asm',0 + * '/HD0/1/kernel.asm',0 + * '/hd0/1/menuet/pics/tanzania.bmp',0 +Accessible subfunction: + * subfunction 0 - reading of a file/folder + * subfunction 1 - overwriting of the file + * subfunction 2 - deleting of a file/folder + * subfunction 3 - writing data in the existing file + * subfunction 4 - creation of a folder + * subfunction 5 - renaming/moving of a file/folder + * subfunction 8 - LBA-reading from the device + * subfunction 12 - definition of a file size + * subfunction 13 - definition of attributes of a file/folder + * subfunction 14 - definition of date/time of a file/folder + * subfunction 15 - obtaining of the information about a file system + * subfunction 16 - start of the application + + +====================================================================== +======= Function 58, subfunction 0 - reading of a file/folder. ======= +====================================================================== +Parameters: + * eax = 58 + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 0 = number subfunction + * +4: dword: number of block for reading (beginning from 0) + * +8: dword: щuantity blocks for reading + * +12 = +0xC: dword: pointer on the buffer, where the data will be written + * +16 = +0x10: dword: pointer on the buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx = file size (in bytes) or + -1=0xffffffff, if the file is not retrieved +Remarks: + * Size of block - 512 bytes. + * This function is obsolete, for reading files use subfunction 0 + functions 70, for reading folders - subfunction of 1 function 70. + * Function allows to read contents of a folder. From file systems is + supported only FAT. The format of a FAT-folder is described in any + documentation on FAT. + * Size of a folder is defined on a size of a chain of clusters in FAT. + * If the file was terminated earlier, than last requested block was read, + the function will read, how many can, then will return eax=6 (EOF). + * Function allows to read root folders /rd/1, /fd/x, /hd [n] /x, but + in first two cases the current implementation does not follow the + installed rules: + for /rd/1: + * if 0 blocks for reading are indicated, it is considered, + that is requested 1; + * if is requested more than 14 blocks or the initial block is not + less 14, comes back eax=5 (not found) and ebx =-1; + * size of the root ramdisk = 14 blocks, 0x1C00=7168 bytes; but comes + back ebx=0 (except for a case of the previous item); + * strangely enough, it is possible to read 14 block (there, generally + speaking, garbage - I remind, the score carries on with 0); + * if one block with number, not smaller 14 was requested even, + comes back eax=6 (EOF); differently eax=0. + for /fd/x: + * if the initial block is not less 14, comes back eax=5 (not found) + and ebx=0; + * by the way speaking, the format FAT12 admits diskettes with a size + of the root less or more than 14 blocks; + * checks of length is not done; + * if it was possible to read given with a diskette, comes back eax=0, + ebx=0; otherwise eax=10 (access denied), ebx =-1. + * Function handles reading special folders /, /rd, /fd, /hd [n]; but the + result does not correspond expected (on operation with usual + files/folders), does not follow the installed rules, can vary in the + following versions of a kernel and consequently is not described. + For obtaining the information about the equipment use subfunction 11 + functions 18 or read appropriate folders subfunction of 1 function 70. + +====================================================================== +======== Function 58, subfunction 1 - overwriting of the file. ======= +====================================================================== +If the file does not exist, it creates. +If the file exists, it is rewritten. +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 1 = number subfunction + * +4: dword: ignored (install in 0) + * +8: dword: number bytes for writing + * +12 = +0xC: dword: pointer on data for чряшёш + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of file, the rules of creation of names + are indicated in the common description +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +Remarks: + * This function is obsolete, use subfunction 2 functions 70. + +====================================================================== +====== Function 58, subfunction 2 - deleting of a file/folder. ======= +====================================================================== +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 2 = number subfunction + * +4: dword: ignored + * +8: dword: ignored + * +12 = +0xC: dword: ignored + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of file, the rules of creation of names + are indicated in the common description +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +Remarks: + * By operation with a diskette it is not necessary to delete a nonblank + folder. The code of operation with the hard disk nonblank folders + deletes correctly (i.e. recursively with all files and nested folders). + Ramdisk of folders does not support. + +====================================================================== +=== Function 58, subfunction 3 - writing data in the existing file === +====================================================================== +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 3 = number subfunction + * +4: dword: initial position in the file; -1 = to add in the end + * +8: dword: number bytes for writing + * +12 = +0xC: dword: pointer on data for writing + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of file, the rules of creation of names + are indicated in the common description +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +Remarks: + * Ramdisk and the diskettes do not support this function, + it only for hard disks. + * File should already exist (differently comes back 5, not found). + For creation of files use subfunction 1. + * If the initial position is more than a file size, comes back eax=6 (EOF). + If the finite position is more than a file size, the file extends. + * Code of processing of data writing for the hard disk interpretes zero + value of a field +8 as the instruction of a truncation of the file + up to a size indicated in a field +4. However code of processing of + 58-th function locks this possibility for the applications, at once + returning handle (with eax=0) in case of a zero size. + +====================================================================== +======== Function 58, subfunction 4 - creation of a folder. ========== +====================================================================== +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 4 = number subfunction + * +4: dword: ignored + * +8: dword: ignored + * +12 = +0xC: dword: ignored + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of file, the rules of creation of names + are indicated in the common description +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +Remarks: + * Ramdisk and the diskettes do not support this function, + it only for hard disks. + +====================================================================== +=== Function 58, subfunction 5 - renaming/moving of a file/folder. === +====================================================================== +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 5 = number subfunction + * +4: dword: ignored + * +8: dword: ignored + * +12 = +0xC: dword: ignored + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of file, the rules of creation of names + are indicated in the common description + * +20+n: (at once after a completing null character) new ASCIIZ-name, + should start with /hd/1, that is interpreted as the hard disk + indicated in the first name + (moving from one disk on another is not supported) +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +Remarks: + * Ramdisk and the diskettes do not support this function, + it only for hard disks. + * If new ASCIIZ-name strongly incorrect, i.e. does not start with /hd/1, + /hd/first, /harddisk/1, /harddisk/first or after that beginnings there + is a blank or character with the code 0, the function returns, strangely + enough, error code 4. Is the sole function, which in general returns + this code. + +====================================================================== +====== Function 58, subfunction 8 - LBA-reading from the device. ===== +====================================================================== +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 8 = number subfunction + * +4: dword: number of the block for reading (beginning from 0) + * +8: dword: ignored (install in 1) + * +12 = +0xC: dword: pointer on buffer, where data will be written + (512 bytes) + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of the device: is not sensitive to the register, + one of /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n, + 1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3. + Instead of digits is admitted, though usage 'first', 'second', 'third', + 'fourth' is not recommended for convenience of transition on the future + extensions. +Returned value: + * if device name /hd/xxx is indicated, where xxx is not in list above: + * eax = ebx = 1 + * if the incorrect device name is indicated + (except for the previous case): + * eax = 5 + * ebx does not vary + * if the LBA-access is prohibited subfunction 11 functions 21: + * eax = 2 + * ebx fail + * for ramdisk attempt of reading of the block outside ramdisk + (18*2*80 blocks) results to + * eax = 3 + * ebx = 0 + * at successful reading: + * eax = ebx = 0 +Remarks: + * Size of the block - 512 bytes; one block is read. + * It is not necessary to rely on returned value, it can vary in + the following versions. + * It is required, that the LBA-access to devices subfunction 11 functions 21 + should be allowed. Find out it it is possible by call + subfunction 11 functions 26. + * LBA-reading of a diskette is not supported. + * Function reads out the data of the physical hard disk; if for any reasons + the data of the concrete unit are necessary, will come to define initial + sector of this unit (or directly through MBR, or from the extended + structure returned same subfunction 11 functions 18). + * Function the error code of the hard disk does not check, so search of + nonexistent sector all the same something will read (more probably + everything, zero, but it is defined by the device) and it will be + considered as success (eax=0). + +============================================================================= += Function 58, subfunction 15 - obtaining of information about a file system. +============================================================================= +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 15 = number of the function + * +4: dword: ignored + * +8: dword: ignored + * +12 = +0xC: dword: ignored + * +16 = +0x10: dword: ignored + * +20 = +0x14: (second character is checked only, at once after /) + /rd=/RAMDISK or /hd=/HARDDISK +Returned value: + * If second character does not belong to set {'r','R','h','H'}: + * eax = 3 + * ebx = ecx = dword [fileinfo] = 0 + * for ramdisk: + * eax = 0 (success) + * ebx = total number of clusters = 2847 + * ecx = number of free clusters + * dword [fileinfo] = cluster size = 512 + * for the hard disk: base and partition are defined + subfunctions 7 and 8 functions 21: + * eax = 0 (success) + * ebx = total number of clusters + * ecx = number of free clusters + * dword [fileinfo] = cluster size (in bytes) +Remarks: + * Be not surprised to strange layout of 4-th returned parameter - when this + code was written, at system calls to the application the registers eax, + ebx, ecx (from pushad-structure transmitted as argument to the system + function) came back only. Now it is corrected, so, probably, it is + meaningful to return a cluster size in edx, while this function have + not begun to use + * Generally still exists subfunction 11 functions 18, returning the + information on a file system. Under the extended table of a disk + subsystem it is possible to define a cluster size (there it is stored + in sectors) and total number of clusters for hard disks. + +====================================================================== +======== Function 58, subfunction 16 - start of application. ========= +====================================================================== +Parameters: + * eax = 58 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 16 = number subfunction + * +4: dword: Field of flags: + * bit 0: to start the process as debugged + * other bits are reserved and should be installed in 0 + * +8: dword: 0 or pointer on ASCIIZ-string with parameters + * +12 = +0xC: dword: ignored + * +16 = +0x10: dword: pointer on buffer for system operation + (4096 bytes) + * +20 = +0x14: ASCIIZ-name of file, the rules of creation of names + are indicated in the common description +Returned value: + * eax > 0 - program is loaded, eax contains PID + * eax < 0 - has taken place error, -eax contains an error code + of a file system +Remarks: + * This function is obsolete, use subfunction 7 functions 70. + * Command line should be ended by the character with the code 0 + (ASCIIZ-strings); it are taken into account or all characters up to + completing zero inclusively, or the first 256 characters, that are less. + * If the process is started as debugged, it creates in the frozen status; + for start use subfunction 5 functions 69. + +====================================================================== +======== Function 59 - get information on last system calls. ========= +====================================================================== +Get data on all system calls of all processes. +Parameters: + * eax = 59 - number of the function + * ebx = 0 - sole subfunction + * ecx = pointer on buffer + * edx = size of buffer +Returned value: + * eax = total number of system calls made from moment + of loading system (modulo 2^32) + * ebx = 0 +Format of information about one call: (size = 0x40 = 64 bytes) + * +0: dword: PID process/thread + * +4: 7*dword: garbage + * +32 = +0x20: dword: value edi by call + * +36 = +0x24: dword: esi + * +40 = +0x28: dword: ebp + * +44 = +0x2C: dword: pointer of stack of kernel handler + * +48 = +0x30: dword: ebx + * +52 = +0x34: dword: edx + * +56 = +0x38: dword: ecx + * +60 = +0x3C: dword: eax (=number system function) +Remarks: + * Function is used only in the application systrace. It is rather difficult + to present a situation, in which this application or this function are + really useful, and all system calls for support of this function are a + little decelerated (though and not strongly)... + * In this connection there is a sentence support of this function from + a kernel to remove absolutely, together with the application systrace. + * Information on system calls is saved in system ring buffer + on 0x10 of inputs. + This function simply copies the indicated size given from the mentioned + buffer to the indicated address. + * To what from inputs in the buffer corresponds to last call, it is possible + to define on value eax, namely, + input (eax and 0xF) (on offset (eax and 0xF) *0x40). + * In current implementation the seldom meeting problems of + unsynchronization are possible, when about some calls the + information becomes outdated. + * Under the system buffer the page, 4 KB is allocated. + Size of an input = 64 bytes. + Why 16 inputs - not clearly are used only. + * Value esp at moment of system call by this function cannot be found out. + * Checks of a correctness edx in current implementation is not done. + +====================================================================== +=========== Function 60 - Inter Process Communication (IPC). ========== +====================================================================== +IPC is applied to sendings the messages from one process / thread to another. +Thus it is necessary previously to agree how to interpreted +the concrete message. + +-------- Subfunction 1 - install area for obtaining IPC --------- +Is called by the process - receiver. +Parameters: + * eax = 60 - number of the function + * ebx = 1 - number subfunction + * ecx = pointer on buffer + * edx = size of buffer +Returned value: + * eax = 0 - always successfully +╘юЁьрЄ IPC-сєЇхЁр: + * +0: dword: if here not 0, the buffer is considered disabled; lock/unblock + the buffer, when you with it actively work also to you it is necessary, + that the data of the buffer from the outside varied + (the new messages) not acted + * +4: dword: occupied place in the buffer (in bytes) + * +8: first message + * +8+n: second message + * ... +Format of message: + * +0: dword: PID of process / thread which has transmitted the message + * +4: dword: length of the message (not including this header) + * +8: n*byte: data messages + +--------------- Subfunction 2 - transmit message IPC. ---------------- +Is called by the process - initiator. +Parameters: + * eax = 60 - number of the function + * ebx = 2 - number subfunction + * ecx = PID of receiver + * edx = pointer on message data + * esi = length of message (in bytes) +Returned value: + * eax = 0 - successfully + * eax = 1 - receiver has not defined buffer for IPC-messages + (can be, was not in time yet, and there can be, it not that thread, + which is necessary) + * eax = 2 - receiver has blocked the IPC-buffer; try slightly to wait + * eax = 3 - overflow of IPC-buffer of receiver + * eax = 4 - process/thread with such PID does not exist +Remarks: + * System at once after writing the IPC-message in the buffer dispatches + to stream - receiver event with the code 7 (see codes of events). + +====================================================================== +==== Function 61 - get parameters for direct access to a graphics. === +====================================================================== +Data of graphics screen are accessible to program (area of memory, which purely +also displays contents of screen) directly without calls of system functions +through the selector gs: + mov eax, [gs:0] +will place in eax first dword of buffer containing information on colour +of left upper point (and, probably, colour of several following). + mov [gs:0], eax +by operation in modes VESA c LFB will install colour of left upper point +(and, probably, colour of several following). +Interpretations given of the graphics screen need knowledge of some parameters, +which come back by this function. +Remarks: + * Parameters of a graphics very seldom vary at system operation, namely, + only in cases, when the user works with the program VRR. + * At change of videomode the system redraw all windows + (event with the code 1) and redraw a background (event 5). + Same events occur and in other cases, which meet much more often, + than change of videomode. + * By operation in videomodes with LFB the selector gs specifies on purely + LFB, so reading / writing on gs result directly in change of contents of + the screen. By operation in videomodes without LFB gs specifies some area + of the given kernel, and all functions of output on the screen honesty + fulfil double operation on writing directly on the screen and on + writing in this buffer. In result at reading contents of this buffer the + results correspond to contents of the screen (with, generally speaking, + large colour permission), and writing ignored. + Exception is the mode 320*200, for which in main loop system thread the + upgrade of the screen is fulfilled according to movements + of a mouse pointer. + +------------------------- Screen resolution -------------------------- +Parameters: + * eax = 61 - number of the function + * ebx = 1 - number subfunction +Returned value: + * eax = [permission on axis x] *65536 + [permission on axis y] +Remarks: + * It is possible to use the function 14 that it returns sizes on 1 less. + It completely equivalent way. + +------------------------ Number bits on pixel ------------------------ +Parameters: + * eax = 61 - number of the function + * ebx = 2 - number subfunction +Returned value: + * eax = number bits on pixel (24 or 32) + +------------------------ Number bytes on string ------------------------ +Parameters: + * eax = 61 - number of the function + * ebx = 3 - number subfunction +Returned value: + * eax = number bytes, which is occupied by one string of the scanning + (horizontal line on the screen) + +====================================================================== +==== Function 62, subfunction 0 - get version of PCI-interface. ===== +====================================================================== +Parameters: + * eax = 62 - number of the function + * bl = 0 - number subfunction +Returned value: + * eax = -1 - access to PCI is prohibited; differently + * ah.al = version of PCI-interface (ah=version, al=subversion) + * high word eax contains a zero +Remarks: + * Low level access to PCI for applications subfunction 12 + functions 21 previously should be allowed. + * If PCI BIOS is not supported, the value ax is not defined. + +====================================================================== +==== Function 62, subfunction 1 - get number of last PCI-bus. === +====================================================================== +Parameters: + * eax = 62 - number of the function + * bl = 1 - number subfunction +Returned value: + * eax = -1 - access to PCI is prohibited; differently + * al = number of last PCI-bus; the stayed bits eax fail +Remarks: + * Low level access to PCI for applications subfunction 12 + functions 21 previously should be allowed. + * If PCI BIOS is not supported, the value al is not defined. + +====================================================================== +====================== Function 62, subfunction 2 ==================== +=========== Get mechanism of call to configuration space PCI. ======== +====================================================================== +Parameters: + * eax = 62 - number of the function + * bl = 2 - number subfunction +Returned value: + * eax = -1 - access to PCI is prohibited; differently + * al = mechanism (1 or 2); the other bits eax fail +Remarks: + * Low level access to PCI for applications subfunction 12 + functions 21 previously should be allowed. + * Mechanism of call is selected according to characteristics of equipment. + * Subfunctions of reading and writing automatically work with + selected mechanism. + +====================================================================== +========= Function 62, subfunction 4,5,6 - read PCI-register. ======== +====================================================================== +Parameters: + * eax = 62 - number of the function + * bl = 4 - read bytes + * bl = 5 - read a word + * bl = 6 - tread a double word + * bh = number of PCI-bus + * ch = dddddfff, where ddddd = number of device on bus, + fff = number of function of device + * cl = number of the register (should be even for bl=5, + be divided on 4 for bl=6) +Returned value: + * eax = -1 - error (prohibited access to PCI + or unsupported parameters); differently + * al/ax/eax (depending on the requested size) contains the data; + the rest of the register eax fail +Remarks: + * Low level access to PCI for applications subfunction 12 + functions 21 previously should be allowed. + * Access mechanism 2 supports only 16 devices on the bus and ignores number + of the function. To receive an access mechanism it is possible by call + subfunction 2. + * Some registers are standard and exist for all devices, some are defined + by the concrete device. The list first enters, for example, in known + Interrupt List by Ralf Brown + (http://www.pobox.com/~ralf/files.html, + ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/); + list second should be indicated in documentation on the device. + +====================================================================== +====== Function 62, subfunction 8,9,10 - write in PCI-register. ====== +====================================================================== +Parameters: + * eax = 62 - number of the function + * bl = 8 - write bytes + * bl = 9 - write a word + * bl = 10 - write a double word + * bh = number of PCI-bus + * ch = dddddfff, where ddddd = number of the device on bus, + fff = number of function of device + * cl = number of register (should be even for bl=9, + be divided on 4 for bl=10) + * dl/dx/edx (depending on requested size) contains given for writing +Returned value: + * eax = -1 - error (prohibited access to PCI or unsupported parameters) + * eax = 0 - successfully +Remarks: + * Low level access to PCI for applications subfunction 12 + functions 21 previously should be allowed. + * Access mechanism 2 supports only 16 devices on the bus and ignores number + of the function. To receive an access mechanism it is possible by call + subfunction 2. + * Some registers are standard and exist for all devices, some are defined + by the concrete device. The list first enters, for example, in known + Interrupt List by Ralf Brown; + list second should be indicated in documentation on the device. + +====================================================================== +============== Function 63 - work with debugging board. ============== +====================================================================== +Debugging board represents the system buffer (on 512 bytes), in which any +program can write (generally speaking, arbitrary) data and from which other +program can these data read. +There is an agreement, according to which written given - text strings +interpreted as of the debug message on a course of execution of the program. +The kernel in the defined situations also writes to board of debugging of the +item of information about execution of some functions; under the agreement of +the message of a kernel start with the prefix " K: ". +For review of board of debugging the application board is created which reads +out the data from the buffer and displays them in the window. board understands +a sequence of codes 13,10 as transition on new string +Character with the zero code at the end of string is not mandatory, +but also does not prevent. +As has appeared of the debugger necessity of board of debugging a little has +decreased, as the debugger allows completely to inspect a course of execution +of the program, and for this purpose it is not required of any efforts on the +part of the program. Nevertheless in many cases the board of debugging +continues to remain useful. + +---------------------------- Writing of byte ---------------------------- +Parameters: + * eax = 63 - number of the function + * ebx = 1 - number subfunction + * cl = bytes of data +Returned value: + * function does not return value +Remarks: + * Byte is written in buffer. Length of buffer - 512 bytes. + At overflow of the buffer all obtained data are lost also filling + starts again with zero. + * For output to board of debugging of more complex objects (strings, numbers) + this function called in cycle suffices. It is possible to not write + manually appropriate code, and to take advantage of the file debug.inc, + included in the distribution kit. + +---------------------------- Reading of byte ---------------------------- +Takes away bytes from the buffer. +Parameters: + * eax = 63 - number of the function + * ebx = 2 - number subfunction +Returned value: + * eax = ebx = 0 - buffer is empty + * eax = bytes, ebx = 1 - bytes successfully is read + +====================================================================== +========== Function 64 - reallocate memory of application. ========== +====================================================================== +Parameters: + * eax = 64 - number of the function + * ebx = 1 - sole subfunction + * ecx = new size of memory +Returned value: + * eax = 0 - successfully + * eax = 1 - not enough of memory +Remarks: + * At present this function is a sole resource for dynamic + allocation/free of memory for application. + +====================================================================== +================= Function 66 - work with keyboard. ================= +====================================================================== +Mode of input influences results of reading of keys by function 2. +At program loading for it ASCII-mode of input is installed. + +-------- Subfunction 1 - install a keyboard mode. --------- +Parameters: + * eax = 66 - number of the function + * ebx = 1 - number subfunction + * ecx = mode: + * 0 = normal (ASCII-characters) + * 1 = scancodes +Returned value: + * function does not return value + +--------- Subfunction 2 - get a keyboard mode. ---------- +Parameters: + * eax = 66 - number of the function + * ebx = 2 - number subfunction +Returned value: + * eax = current mode + +------- Subfunction 3 - get a status of direction keys. -------- +Parameters: + * eax = 66 - number of the function + * ebx = 3 - number subfunction +Returned value: + * eax = bit mask: + * Bit 0 (mask 1): left Shift is pressed + * Bit 1 (mask 2): right Shift is pressed + * Bit 2 (mask 4): left Ctrl is pressed + * Bit 3 (mask 8): right Ctrl is pressed + * Bit 4 (mask 0x10): left Alt is pressed + * Bit 5 (mask 0x20): right Alt is pressed + * Bit 6 (mask 0x40): CapsLock is included + * Bit 7 (mask 0x80): NumLock is included + * Bit 8 (mask 0x100): ScrollLock is included + * The other bits are reset + +----- Subfunction 4 - install common system "hotkey". ----- +Applications which have installed it are informed only on pressing "hotkey"; +the active application (to which acts all normal input) such keys does not get. +Notice consists in sending event with the code 2. +To read "hotkey" it is possible the same as also usual, - function 2. +Parameters: + * eax = 66 - number of the function + * ebx = 4 - number subfunction + * cl sets scancode of the key; + уse cl=0 for definition of combinations of a type Ctrl+Shift + * edx = 0xXYZ √ets possible statuses of direction keys: + * Z (low 4 bits) are set by a status of keys LShift and RShift: + * 0 = any of keys should not be pressed; + * 1 = only one of keys is should be pressed; + * 2 = both keys should be pressed; + * 3 = should be pressed LShift, but not RShift; + * 4 = should be pressed RShift, but not LShift + * Y - is similar for LCtrl and RCtrl; + * X - is similar for LAlt and RAlt +Returned value: + * eax=0 - successfully + * eax=1 - too much "hotkey" is admitted (maximal 256) +Remarks: + * Hotkey can work either at pressing, or at release. Scancode of release + of the key on 128 it is more, than scancode of pressing + (i.e. high bit is installed). + * Some applications can install the same combination; all such applications + will be informed on pressing such combination. + +------ Subfunction 5 - delete installed "hotkey". ------- +Parameters: + * eax = 66 - number of the function + * ebx = 5 - number subfunction + * cl = scancode of key and edx = 0xXYZ same, as well as in subfunction 4 +Returned value: + * eax = 0 - successfully + * eax = 1 - there is no such hotkey +Remarks: + * At completion of process / thread all hotkey, installed by it are deleted. + * Function call does not influence other applications. If other application + has defined same combination, it will receive still notices. + +====================================================================== +============ Function 67 - change location/sizes of window. =========== +====================================================================== +Parameters: + * eax = 67 - number of the function + * ebx = new x-coordinate of the window + * ecx = new y-coordinate of the window + * edx = new x-size of the window + * esi = new y-size of the window +Returned value: + * function does not return value +Remarks: + * Value -1 for the parameter means "to not change"; for example, for moving + the window without resizing it is possible to specify edx=esi =-1. + * Previously window should be defined by the function 0. + It sets initial coordinates and sizes of the window. + * Sizes of the window are understood in sense of the function 0, + i.e. on one pixel it is less, than real sizes. + * Function call for the maximized windows is simple ignored. + * For windows of appropriate styles a location and/or the sizes can be + changed by the user; current a location and the sizes can be obtained + by function call 9. + * Function dispatches to window event redraw (with the code 1). + +====================================================================== +== Function 68, subfunction 0 - get the counter of task switchings. == +====================================================================== +Parameters: + * eax = 68 - number of the function + * ebx = 0 - number subfunction +Returned value: + * eax = number of task switchings from the moment of loading the system + (modulo 2^32) + +====================================================================== +====================== Function 68, subfunction 1 ==================== +=========== To switch to the following thread of execution. ========== +====================================================================== +Function completes a current time slice allocated to stream, +and switches to the following.(What thread what process will be by the +following, to predict it is impossible). +Later, when up to current thread queue will reach, +the execution will be restored. +Parameters: + * eax = 68 - number of the function + * ebx = 1 - number subfunction +Returned value: + * function does not return value + +====================================================================== +============ Function 68, subfunction 2 - cache + rdpmc. ============= +====================================================================== +Parameters: + * eax = 68 - number of the function + * ebx = 2 - number subfunction + * ecx = required operation: + * ecx = 0 - to permit execution of the instruction rdpmc + (ReaD Performance-Monitoring Counters) + * ecx = 1 - find out, enabled/disabled cache + * ecx = 2 - enabled cache + * ecx = 3 - disabled cache +Returned value: + * for ecx=0: + * eax = value cr4 + * for ecx=1: + * eax = (cr0 and 0x60000000): + * eax = 0 - cache enabled + * eax <> 0 - cache disabled + * for ecx=2 and ecx=3: + * function does not return value + +====================================================================== +=========== Function 68, subfunction 3 - read MSR-register. ========== +====================================================================== +MSR = Model Specific Register; the complete list of the MSR-registers of the +processor contains in documentation on the processor (for example, IA-32 Intel +Architecture Software Developer's Manual, Volume 3, Appendix B); each set of +processors has the subset of the MSR-registers. +Parameters: + * eax = 68 - number of the function + * ebx = 3 - number subfunction + * ecx ignored + * edx = address MSR +Returned value: + * ebx:eax = high:low dword of result +Remarks: + * Instruction in ecx nonexistent or non-realized for of the given processor + MSR will entail exception in a kernel, which will kill thread. + * Previously it is necessary to define, whether are supported MSR as a whole, + command cpuid. Differently there will be already other exception in a + kernel, which all the same will kill thread. + +====================================================================== +========= Function 68, subfunction 4 - чряшёрЄ№ т MSR-ЁхушёЄЁ. ========= +====================================================================== +MSR = Model Specific Register; the complete list of the MSR-registers of the +processor contains in documentation on the processor (for example, IA-32 Intel +Architecture Software Developer's Manual, Volume 3, Appendix B); each set of +processors has the subset of the MSR-registers. +Parameters: + * eax = 68 - number of the function + * ebx = 4 - number subfunction + * ecx ignored + * edx = address MSR + * esi:edi = high:low dword of result +Returned value: + * ebx:eax = copy esi:edi +Remarks: + * Instruction in ecx nonexistent or non-realized for of the given processor + MSR will entail exception in a kernel, which will kill thread. + * Previously it is necessary to define, whether are supported MSR as a whole, + command cpuid. Differently there will be already other exception in a + kernel, which all the same will kill thread. + +====================================================================== +======= Function 68, subfunction 5 - allocate physical memory. ======= +====================================================================== +Parameters: + * eax = 68 - number of the function + * ebx = 5 - number subfunction + * ecx = size (in bytes) +Returned value: + * eax = physical address of allocated memory +Remarks: + * Usual applications should not use this function, it is intended for of a + case, when by operation with any device it is required to place the data + to the known physical address. (In effect, this function was developed for + AC97WAV.) + * Number of blocks of the actual storage is limited (constant 24, and this + constant includes and some memories for of needs of a kernel). + * Free allocated memory it is possible subfunction 6, in copying data + there/back are engaged subfunction 7 and 8. + +====================================================================== +========= Function 68, subfunction 6 - free physical memory. ========= +====================================================================== +Parameters: + * eax = 68 - number of the function + * ebx = 6 - number subfunction + * ecx = physical address of memory +Returned value: + * function does not return value +Remarks: + * Usual applications should not use this function, it is intended for of a + case, when by operation with any device it is required to place the data + to the known physical address. (In effect, this function was developed for + AC97WAV.) + * Memory should be earlier allocated subfunction 5. + +====================================================================== +==== Function 68, subfunction 7 - write data in physical memory. ===== +====================================================================== +Parameters: + * eax = 68 - number of the function + * ebx = 7 - number subfunction + * ecx = physical address + * edx = pointer on data (in application) + * esi = data size (in bytes) +Returned value: + * function does not return value +Remarks: + * Usual applications should not use this function, it is intended for of a + case, when by operation with any device it is required to place the data + to the known physical address. (In effect, this function was developed for + AC97WAV.) + * Range of physical addresses should lay inside allocated subfunction 5 + blocks of physical memory. + * Checks of a correctness is not made. + +====================================================================== +==== Function 68, subfunction 8 - read data from physical memory. ==== +====================================================================== +Parameters: + * eax = 68 - number of the function + * ebx = 8 - number subfunction + * ecx = physical address + * edx = pointer on buffer for data (in application) + * esi = data size (in bytes) +Returned value: + * function does not return value +Remarks: + * Usual applications should not use this function, it is intended for of a + case, when by operation with any device it is required to place the data + to the known physical address. (In effect, this function was developed for + AC97WAV.) + * Range of physical addresses should lay inside allocated subfunction 5 + blocks of physical memory. + * Checks of a correctness is not made. + +====================================================================== +====================== Function 69 - debugging. ====================== +====================================================================== +Process can load other process as debugged by installation of appropriate bit +by call subfunction 16 functions 58. Process can have only one debugger; +one process can debug some processes. System notifies the debugger on events +occurring to the debugged process. Messages are written in the buffer defined +subfunction 0. +╘юЁьрЄ ёююс∙хэш : + +0: dword: the code of the message + +4: dword: PID of the debugged process + +8: there can be additional data defined by the code of the message +Codes of messages: + * 1 = exception + * in addition transfers dword-number of exception + * process is paused + * 2 = process was completed + * comes at any completion: both through the system function -1, + and at "murder" by any other process (including debugger) + * 3 = debug exception int 1 = #DB + * in addition transfers a dword-image of the register DR6: + * Bits 0-3: the condition of appropriate breakpoint + (installed subfunction 9) is fulfilled + * Bit 14: the exception has taken place because of the mode of step + tracing (the flag TF is installed) + * process is paused +At completion of the debugger all debugged processes are killed. +If the debugger it does not want, it should previously be disabled +subfunction 3. + +All subfunction are applicable only to the processes/threads started from +current function 58 with a installed debugging flag. +Debugging of multithread programs is not supported yet. +Full list subfunctions: + * subfunction 0 - define area given for of debug messages + * subfunction 1 - get a status of the registers debugged thread + * subfunction 2 - install a status of the registers debugged thread + * subfunction 3 - disabled from the debugged process + * subfunction 4 - paused debugged thread + * subfunction 5 - restored execution debugged thread + * subfunction 6 - read from memory of the debugged process + * subfunction 7 - write in memory of the debugged process + * subfunction 8 - complete debugged thread + * subfunction 9 - place/remove the hardware point break + +====================================================================== +====================== Function 69, subfunction 0 ==================== +============= Define area given for of debug messages. =============== +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 0 - number subfunction + * ecx = pointer +Format of data area: + * +0: dword: N = size of buffer (not including this header) + * +4: dword: occupied in buffer + * +8: N*byte: buffer +Returned value: + * function does not return value +Remarks: + * If a field of a size negatively, the buffer is considered disabled and + at arrival of the new message the system will wait. + For synchronization frame all operation with the buffer by operations + of the locking/unlocking + neg [bufsize] + * Data in the buffer are treated as the array of units of a variable + length - messages. The format of the message is indicated in + the common description. + +====================================================================== +====================== Function 69, subfunction 1 ==================== +=========== Get a status of the registers debugged thread. =========== +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 1 - number subfunction + * ecx = thread identifier + * edx = length of structure of a context, should be 0x28=40 bytes +Returned value: + * function does not return value +Format of structure of a context: (FPU is not supported yet) + * +0: dword: eip + * +4: dword: eflags + * +8: dword: eax + * +12 = +0xC: dword: ecx + * +16 = +0x10: dword: edx + * +20 = +0x14: dword: ebx + * +24 = +0x18: dword: esp + * +28 = +0x1C: dword: ebp + * +32 = +0x20: dword: esi + * +36 = +0x24: dword: edi +Remarks: + * If thread fulfils the code of a ring-0, the status of the registers + of a ring-3 comes back. + * Process should be loaded for of debugging (as is indicated in + the common description). + +====================================================================== +====================== Function 69, subfunction 2 ====================== +======== Install a status of the registers debugged thread. ======== +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 2 - number subfunction + * ecx = thread identifier + * edx = length of structure of a context, should be 0x28=40 bytes +Returned value: + * function does not return value +Format of structure of a context is indicated in the description subfunction 1. +Remarks: + * If thread fulfils the code of a 0-ring, the status of the registers + of a 3-ring is installed. + * Process should be loaded for of debugging (as is indicated in + the common description). + +====================================================================== +== Function 69, subfunction 3 - disabled from the debugged process. == +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 3 - number subfunction + * ecx = identifier +Returned value: + * function does not return value +Remarks: + * If the process was paused, it restores execution. + +====================================================================== +======== Function 69, subfunction 4 - paused debugged thread. ======== +====================================================================== +Parameters: + * eax = 69 - number яЁюЎхёёр + * ebx = 4 - number subfunction + * ecx = identifier +Returned value: + * function does not return value +Remarks: + * Process should be loaded for of debugging (as is indicated in + the common description). + +====================================================================== +====================== Function 69, subfunction 5 ==================== +================ Restored execution debugged thread. ================= +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 5 - number subfunction + * ecx = identifier +Returned value: + * function does not return value +Remarks: + * Process should be loaded for of debugging (as is indicated in + the common description). + +====================================================================== +====================== Function 69, subfunction 6 ==================== +============= Read from memory of the debugged process. ============== +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 6 - number subfunction + * ecx = identifier + * edx = how many bytes to read + * esi = memory address of the debugged process + * edi = pointer on buffer for data +Returned value: + * eax = -1 error (incorrect PID or buffer) + * differently eax = the number read bytes + (is possible, 0, if in esi the too large value) +Remarks: + * Process should be loaded for of debugging (as is indicated in + the common description). + +====================================================================== + Function 69, subfunction 7 - write in memory of the debugged process. +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 7 - number subfunction + * ecx = identifier + * edx = how many bytes to write + * esi = memory address of the debugged process + * edi = pointer on data +Returned value: + * eax = -1 error (incorrect PID or buffer) + * differently eax = the number written bytes + (is possible, 0, if in esi the too large value) +Remarks: + * Process should be loaded for of debugging (as is indicated in + the common description). + +====================================================================== +======= Function 69, subfunction 8 - complete debugged thread. ======= +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 8 - number subfunction + * ecx = identifier +Returned value: + * function does not return value +Remarks: + * Process should be loaded for of debugging (as is indicated in + the common description). + * Function is similar subfunction 2 functions 18 with two differences: + the execution of the first remark is required and is accepted PID, + instead of number of the slot. + +====================================================================== +====================== Function 69, subfunction 9 ==================== +=============== Place/remove the hardware point break. =============== +====================================================================== +Parameters: + * eax = 69 - number of the function + * ebx = 9 - number subfunction + * ecx = thread identifier + * dl = index of breakpoint, from 0 up to 3 inclusively + * dh = flags: + * if high bit is reset - install breakpoint: + * bits 0-1 - condition: + * 00 = breakpoint on execution + * 01 = breakpoint on writing + * 11 = breakpoint on reading/writing + * bits 2-3 - length; for breakpoints on fulfilment should be 00, + otherwise one of + * 00 = bytes + * 01 = word + * 11 = double word + * esi = address of breakpoint; should be aligned according to length + (i.e. should be even for of breakpoints on a word, is multiple 4 for + of a double word) + * if high bit is installed - reset breakpoint +Returned value: + * eax = 0 - successfully + * eax = 1 - error in the input data + * eax = 2 - (reserved, never comes back in current realization) + with this index global breakpoint already is installed +Remarks: + * Process should be loaded for of debugging (as is indicated in + the common description). + * Hardware breakpoints are realized through the DRx-register of the + processor, from here all limitations. + * Function can reinstall the breakpoint, earlier installed to it + (in any way not informing about it). + Carry on the list of the installed breakpoints in the debugger. + * Operation of breakpoint consists in generation of debug exception #DB, + which the system informs to the debugger. + * Breakpoint on writing and reading/writing works after execution of + the instruction, which has called it. + +====================================================================== +== Function 70 - work with a file system with support of long names. = +====================================================================== +Parameters: + * eax = 70 + * ebx = pointer on information structure +Returned value: + * eax = 0 - successfully; differently error code of a file system + * depending on subfunction the value and in other registers can come back +Common format of information structure: + * +0: dword: number subfunction + * +4: dword: offset in the file + * +8: dword: high dword of offset (should be 0) or field of flags + * +12 = +0xC: dword: size + * +16 = +0x10: dword: pointer on data + * +20 = +0x14: n db: ASCIIZ-string with a filename + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Specifications - in documentation on appropriate subfunction. +Filename is insensitive to the register of characters. Russian characters should be written in the coding cp866 (DOS). +╘юЁьрЄ шьхэш Їрщыр: +/base/number/dir1/dir2/.../dirn/file, +where /base/number Identifies the device, on which the file is searched: +one of + * /RD/1 = /RAMDISK/1 for access to ramdisk + * /FD/1 = /FLOPPYDISK/1 for access to the first floppy-drive, + /FD/2 = /FLOPPYDISK/2 for access to the second floppy-drive + * /HD0/x, /HD1/x, /HD2/x, /HD3/x for access accordingly + to hard disks on IDE0 (Primary Master), IDE1 (Primary Slave), + IDE2 (Secondary Master), IDE3 (Secondary Slave); + x - number of partition on selected hard disk, varies from 1 up to 255 + (on each of hard disks partitions starts with 1) + * /CD0/1, /CD1/1, /CD2/1, /CD3/1 for access accordingly + to CD on IDE0 (Primary Master), IDE1 (Primary Slave), + IDE2 (Secondary Master), IDE3 (Secondary Slace) +Examples: + * '/rd/1/kernel.asm',0 + * '/HD0/1/kernel.asm',0 + * '/hd0/2/menuet/pics/tanzania.bmp',0 + * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0 +Accessible subfunctions: + * subfunction 0 - read file + * subfunction 1 - read folder + * subfunction 2 - create/rewrite file + * subfunction 5 - get file/directory attributes structure + * subfunction 6 - set file/directory attributes structure + * subfunction 7 - start application + +====================================================================== += Function 70, subfunction 0 - read file with support of long names. = +====================================================================== +Parameters: + * eax = 70 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 0 = number subfunction + * +4: dword: position in the file (in bytes) + * +8: dword: 0 (reserved for high dword of a position) + * +12 = +0xC: dword: how many bytes to read + * +16 = +0x10: dword: pointer on buffer, where the data will be written + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx = number read bytes or + -1=0xffffffff, if the file is not retrieved +Remarks: + * If the file was terminated earlier, than last requested block was read, + the function will read, how many can, then will return eax=6 (EOF). + * Function does not allow to read folders + (will return eax=10, access denied). + +======================================================================== += Function 70, subfunction 1 - read folder with support of long names. = +======================================================================== +Parameters: + * eax = 70 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 1 = number subfunction + * +4: dword: index of the initial block (beginning from 0) + * +8: dword: field of flags: + * bit 0 (mask 1): in what format to return names, + 0=ANSI, 1=UNICODE + * Other bits are reserved and should be installed in 0 + for of the future compatibility + * +12 = +0xC: dword: how many blocks to read + * +16 = +0x10: dword: pointer on buffer, where the data will be written, + size of buffer should be not less than 32 + [+12] *560 bytes + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx = number of files, the information about which was written + in the buffer, + or -1=0xffffffff, if the folder is not retrieved +Structure of the buffer: + * +0: 32*byte: header + * +32 = +0x20: n1*byte: block with information on file 1 + * +32+n1: n2*byte: block with information on file 2 2 + * ... +Structure of header: + * +0: dword: version of structure (current version = 1) + * +4: dword: amount of the placed blocks; it is no more, + than +12 information structures are requested in a field; + can be less, if in a folder the files (same, as in ebx) were terminated + * +8: dword: total number of files in a folder + * +12 = +0xC: 20*byte: reserved (zero) +Structure of data block of input of directory (DBID): + * +0: dword: file attributes: + * сшЄ 0 (ьрёър 1): file only for reading + * сшЄ 1 (ьрёър 2): file is hidden + * сшЄ 2 (ьрёър 4): file is system + * сшЄ 3 (ьрёър 8): it not file, it is volume label + (on given partition meets no more once and only in a root folder) + * сшЄ 4 (ьрёър 0x10): It is a folder + * сшЄ 5 (ьрёър 0x20): file was not archived - many programs of archiving + have an option, on which the files with installed this bit are archived + only, then this bit is dumped(reset) is it can be useful for of automatic + creation of backup-archives, for at recording bit is usually installed + * +4: byte: type of data of a name: + (coincides with bit 0 flags of information structure) + * 0 = ASCII = 1- byte performance of each character + * 1 = UNICODE = 2-byte performance of each character + * +5: 3*byte: reserved (zero) + * +8: 4*byte: time of creation of file + * +12 = +0xC: 4*byte: date of creation of file + * +16 = +0x10: 4*byte: time of last access (reading or writing) + * +20 = +0x14: 4*byte: date of last access + * +24 = +0x18: 4*byte: time of a last modification + * +28 = +0x1C: 4*byte: date of a last modification + * +32 = +0x20: qword: file size in bytes (up to 16777216 Tbytes) + * +40 = +0x28: name + * for of the format ASCII: maximum length of a name 263 characters + (263 bytes), bytes after a name matters 0 + * for of the format UNICODE: maximum length of a name 259 characters + (518 bytes), two bytes after a name matter 0 +Format of time: + * +0: byte: seconds + * +1: byte: minutes + * +2: byte: hours + * +3: byte: reserved (0) + * For example, 23.59.59 is written as (in hex) 3B 3B 17 00 +Format of date: + * +0: byte: day + * +1: byte: month + * +2: word: year + * For example, 25.11.1979 is written as (in hex) 19 0B BB 07 +Remarks: + * If in DBID there is a name in ASCII, length makes 304 bytes, + if in UNICODE - 560 bytes. Value of length aligned on whole + multiple 16 bytes (for of acceleration of processing in cache-memory CPU). + * First character after a name zero (ASCIIZ-string). + The further data contain garbage. + * If the files in a folder were terminated earlier, than the requested + amount was read, the function will read, how many can, + then will return eax=6 (EOF). + * Any folder on the disk, except for root, contains two special + inputs(entrances) "." And "..", identifying accordingly folder + and parent folder. + * Function allows also to read virtual folders "/", "/rd", "/fd", + "/hd [n] ", thus the attributes subfolders rely equal 0x10, and the times + and dates are unset. An alternate way of obtaining of the information + about the equipment - subfunction 11 functions 18 + +====================================================================== +====================== Function 70, subfunction 2 ==================== +========== Create/rewrite file with support of long names. =========== +====================================================================== +Parameters: + * eax = 70 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 2 = number subfunction + * +4: dword: 0 (reserved) + * +8: dword: 0 (reserved) + * +12 = +0xC: dword: how many bytes to write + * +16 = +0x10: dword: pointer on data + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx = number written bytes (is possible, 0) +Remarks: + * If the file with such name did not exist, it creates; if existed, + is rewritten. + * If it is not enough of free space on of the disk, the function will write, + how many can, then will return an error code 8. + +====================================================================== += Function 70, subfunction 5 - get file/directory attributes structure. +====================================================================== +Parameters: + * eax = 70 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 5 = number subfunction + * +4: dword: 0 (reserved) + * +8: dword: 0 (reserved) + * +12 = +0xC: dword: 0 (reserved) + * +16 = +0x10: dword: pointer on buffer, where data will be written (40 bytes) + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +Information on the file comes back in the format DBID +(data block of input of directory), indicated in the description subfunction 1, +but without a filename (only first 40 = 0x28 bytes). +Remarks: + * Function does not support virtual folders such as /, /rd + and root folders such as /rd/1. + +====================================================================== += Function 70, subfunction 6 - set file/directory attributes structure. +====================================================================== +Parameters: + * eax = 70 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 6 = number subfunction + * +4: dword: 0 (reserved) + * +8: dword: 0 (reserved) + * +12 = +0xC: dword: 0 (reserved) + * +16 = +0x10: dword: pointer on buffer with attributes (32 bytes) + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Returned value: + * eax = 0 - successfully, differently error code of a file system + * ebx fail +File attributes - first 32 bytes in DBID (data block of input of directory), +which format is indicated in the description subfunction 1 +(that is without a name and file size). Attribute the file/folder/volume label +(bits 3,4 in dword +0) does not vary. +Byte +4 (format of a name) ignored. +Remarks: + * Function does not support virtual folders such as /, /rd + and root folders such as /rd/1. + +====================================================================== +============ Function 70, subfunction 7 - start application. ============ +====================================================================== +Parameters: + * eax = 70 - number of the function + * ebx = pointer on information structure +Format of information structure: + * +0: dword: 7 = number subfunction + * +4: dword: field of flags: + * сшЄ 0: to start the process as debugged + * other bits are reserved and should be installed in 0 + * +8: dword: 0 or pointer on ASCIIZ-string with parameters + * +12 = +0xC: dword: 0 (reserved) + * +16 = +0x10: dword: 0 (reserved) + * +20 = +0x14: ASCIIZ-name of the file, the rules of creation of names + are indicated in the common description + or + * +20 = +0x14: db 0 + * +21 = +0x15: dd pointer on ASCIIZ-string with a filename +Returned value: + * eax > 0 - program is loaded, eax contains PID + * eax < 0 - has taken place error, + -eax contains an error code of a file system + * ebx fail +Remarks: + * Command line should be ended by the character with the code 0 + (ASCIIZ-strings); it are taken into account or all characters up to + completing zero inclusively, or the first 256 characters, that are less. + * If the process is started as debugged, it creates in the frozen status; + for of start use subfunction 5 functions 69. + +====================================================================== +=========== Function 71, subfunction 1 - set window caption ========== +====================================================================== +Parameters: + * eax = 71 - function number + * ebx = 1 - subfunction number + * eсx = caption string address +Returned value: + * eax = 0 - caption changed successfully + * eax = 1 - error occured +Remarks: + * String should be in ASCIIZ format. Disregarding real string length, + no more than 255 chars will be wrawn. + * Pass NULL in ecx to remove caption + +====================================================================== +========== Function -1 - complete execution of thread/proces ========= +====================================================================== +Parameters: + * eax = -1 - number of the function +Returned value: + * function does not return neither value, nor handle +Remarks: + * If the process obviously did not create streams, it has only one thread, + which completion results in completion of the process. + * If current thread - last in process, its completion also results + in completion of the process. + * This function completes current thread. Another thread + is possible kill by call subfunction 2 functions 18. + +====================================================================== +=========================== List of events =========================== +====================================================================== +Next event is possible get by call of one from functions 10 (to expect event), +11 (to check up without waiting), 23 (to expect during the given time). +These functions return only those events, which enter into a mask installed by +the function 40. By default it is first three, that there is enough for of many +applications of. +Codes of events: + * 1 = message about redraw (is reset at function call 0) + * 2 = key on keyboard is pressed (acts, only when the window is active) + or "hotkey" is pressed; is reset, when all keys from the buffer are read + out by the function 2 + * 3 = button is pressed, defined earlier by function 8(or buttons of closing, + created implicitly by function 0 is pressed; the button of minimization is + handled by the system and about it of the message does not come; acts, only + when the window is active; is reset, when all buttons from the buffer are + read out by the function 17) + * 4 = reserved (in current implementation never comes even at unmasking + by the function 40) + * 5 = redraw the background of a desktop (is reset automatically after + redraw, so if in time redraw of a background the program does not wait + and does not check event, this event it will not remark) + * 6 = event from the mouse (something happened - pressing a mouse button + or moving; is reset at reading) + * 7 = there was an event IPC (look the function 60 - Inter Process + Communication; is reset at reading) + * 8 = there was a network event (is reset at reading; look operation + with the network) + * 9 = there was a debug event (is reset at reading; look a debug subsystem) + * 16..31 = there was an event with appropriate IRQ + (16=IRQ0, 31=IRQ15) (is reset at reading all data IRQ) + +====================================================================== +==================== Error codes of a file system ==================== +====================================================================== + * 0 = successfully + * 1 = base and/or partition of the hard disk is not defined + (subfunctions 7, 8 functions 21) + * 2 = function is not supported for of the given file system + (comes back in case of attempt of LBA-reading at prohibited LBA) + * 3 = Unknown file system + * 4 = comes back only by function rename by transmission of the strongly + incorrect parameter and in any way does not correspond to the description + in sources of a kernel " partition not defined at hd " + * 5 = file is not retrieved + * 6 = file was completed + * 7 = pointer outside of memory of the application + * 8 = disk is filled + * 9 = table FAT is destroyed + * 10 = access denied + * 11 = error of the device +At start of the program the following error codes are possible also: + * 30 = 0x1E = not enough of memory + * 31 = 0x1F = file is not application + * 32 = 0x20 = too much processes + diff --git a/kernel/trunk/gui/button.inc b/kernel/trunk/gui/button.inc index fafea52529..7246b5da8a 100644 --- a/kernel/trunk/gui/button.inc +++ b/kernel/trunk/gui/button.inc @@ -163,14 +163,26 @@ button_dececx: sys_button: + push edi + mov edi,[0x3000] + shl edi,8 + rol eax,16 + add ax,word[edi+0x80000+APPDATA.wnd_clientbox.left] + rol eax,16 + rol ebx,16 + add bx,word[edi+0x80000+APPDATA.wnd_clientbox.top] + rol ebx,16 + pop edi + .forced: + test ecx,0x80000000 jnz remove_button push esi push edi - push eax - push ebx - push ecx + push eax ; + push ebx ; + push ecx ; push edx or ax,ax diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc index 2a958a39ab..31ff3a0492 100644 --- a/kernel/trunk/gui/skincode.inc +++ b/kernel/trunk/gui/skincode.inc @@ -191,9 +191,78 @@ parse_skin_data: sys_putimage_with_check: or ebx,ebx jz @f - call sys_putimage + call sys_putimage.forced @@: ret +drawwindow_IV_caption: + + mov ebp,skin_active + or al,al + jnz @f + mov ebp,skin_inactive + @@: + + mov esi,[esp+4] + mov eax,[esi+8] ; window width + mov edx,[ebp+SKIN_DATA.left.left] + shl edx,16 + mov ecx,[ebp+SKIN_DATA.left.width] + shl ecx,16 + add ecx,[_skinh] + + mov ebx, [ebp+SKIN_DATA.left.data] + call sys_putimage_with_check + + mov esi,[esp+4] + mov eax,[esi+8] + sub eax,[ebp+SKIN_DATA.left.width] + sub eax,[ebp+SKIN_DATA.oper.width] + cmp eax,[ebp+SKIN_DATA.base.left] + jng .non_base + xor edx,edx + mov ecx,[ebp+SKIN_DATA.base.width] + jecxz .non_base + div ecx + + inc eax + + mov ebx,[ebp+SKIN_DATA.base.data] + mov ecx,[ebp+SKIN_DATA.base.width] + shl ecx,16 + add ecx,[_skinh] + mov edx,[ebp+SKIN_DATA.base.left] + sub edx,[ebp+SKIN_DATA.base.width] + shl edx,16 + .baseskinloop: + shr edx,16 + add edx,[ebp+SKIN_DATA.base.width] + shl edx,16 + + push eax ebx ecx edx + call sys_putimage_with_check + pop edx ecx ebx eax + + dec eax + jnz .baseskinloop + .non_base: + + mov esi,[esp+4] + mov edx,[esi+8] + sub edx,[ebp+SKIN_DATA.oper.width] + inc edx + shl edx,16 + mov ebx,[ebp+SKIN_DATA.oper.data] + + mov ecx,[ebp+SKIN_DATA.oper.width] + shl ecx,16 + add ecx,[_skinh] + call sys_putimage_with_check + + ret + +;//mike.dld, 2006-08-02 ] + + drawwindow_IV: ;param1 - aw_yes @@ -256,61 +325,8 @@ drawwindow_IV: jmp draw_clientbar @@: - mov esi,[esp] - mov eax,[esi+8] ; window width - mov edx,[ebp+SKIN_DATA.left.left] - shl edx,16 - mov ecx,[ebp+SKIN_DATA.left.width] - shl ecx,16 - add ecx,[_skinh] - - mov ebx, [ebp+SKIN_DATA.left.data] - call sys_putimage_with_check - - mov esi,[esp] - mov eax,[esi+8] - sub eax,[ebp+SKIN_DATA.left.width] - sub eax,[ebp+SKIN_DATA.oper.width] - cmp eax,[ebp+SKIN_DATA.base.left] - jng non_base - xor edx,edx - mov ecx,[ebp+SKIN_DATA.base.width] - jecxz non_base - div ecx - - inc eax - - mov ebx,[ebp+SKIN_DATA.base.data] - mov ecx,[ebp+SKIN_DATA.base.width] - shl ecx,16 - add ecx,[_skinh] - mov edx,[ebp+SKIN_DATA.base.left] - sub edx,[ebp+SKIN_DATA.base.width] - shl edx,16 - baseskinloop: - shr edx,16 - add edx,[ebp+SKIN_DATA.base.width] - shl edx,16 - - push eax ebx ecx edx - call sys_putimage_with_check - pop edx ecx ebx eax - - dec eax - jnz baseskinloop - non_base: - - mov esi,[esp] - mov edx,[esi+8] - sub edx,[ebp+SKIN_DATA.oper.width] - inc edx - shl edx,16 - mov ebx,[ebp+SKIN_DATA.oper.data] - - mov ecx,[ebp+SKIN_DATA.oper.width] - shl ecx,16 - add ecx,[_skinh] - call sys_putimage_with_check + mov al,[esp+32+4+4] + call drawwindow_IV_caption draw_clientbar: diff --git a/kernel/trunk/gui/skindata.inc b/kernel/trunk/gui/skindata.inc index b7b7c39d55..5faffc1b88 100644 --- a/kernel/trunk/gui/skindata.inc +++ b/kernel/trunk/gui/skindata.inc @@ -35,7 +35,11 @@ align 4 skin_udata: _skinh dd ? - _skinmargins rw 4 + _skinmargins: ; rw 4 + .right dw ? + .left dw ? + .bottom dw ? + .top dw ? skin_btn_close SKIN_BUTTON skin_btn_minimize SKIN_BUTTON diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc index d8d5bd783d..915714d1f9 100644 --- a/kernel/trunk/gui/window.inc +++ b/kernel/trunk/gui/window.inc @@ -75,17 +75,17 @@ calculatescreen: test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED jnz .not_wnd - mov eax, [edi+WDATA.left] + mov eax,[edi+WDATA.box.left] cmp eax, [esp+RECT.right] ja .out_of_bounds - mov ebx, [edi+WDATA.top] + mov ebx,[edi+WDATA.box.top] cmp ebx, [esp+RECT.bottom] ja .out_of_bounds - mov ecx, [edi+WDATA.width] + mov ecx,[edi+WDATA.box.width] add ecx, eax cmp ecx, [esp+RECT.left] jb .out_of_bounds - mov edx, [edi+WDATA.height] + mov edx,[edi+WDATA.box.height] add edx, ebx cmp edx, [esp+RECT.top] jb .out_of_bounds @@ -239,9 +239,9 @@ pushad mov ecx, esi shl ecx, 5 - mov edx, [window_data+ecx+WDATA.top] - push [window_data+ecx+WDATA.width] ; for loop - width - mov ecx, [window_data+ecx+WDATA.left] + mov edx, [window_data+ecx+WDATA.box.top] + push [window_data+ecx+WDATA.box.width] ; for loop - width + mov ecx, [window_data+ecx+WDATA.box.left] sub ebx, edx sub eax, ecx push ebx eax ; for loop - x,y @@ -513,44 +513,44 @@ repos_windows: test [esi+WDATA.fl_wstate],WSTATE_MAXIMIZED jz .lp2 mov eax,[screen_workarea.left] - mov [esi+WDATA.left],eax + mov [esi+WDATA.box.left],eax sub eax,[screen_workarea.right] neg eax - mov [esi+WDATA.width],eax + mov [esi+WDATA.box.width],eax mov eax,[screen_workarea.top] - mov [esi+WDATA.top],eax + mov [esi+WDATA.box.top],eax test [esi+WDATA.fl_wstate],WSTATE_ROLLEDUP jnz .lp1 sub eax,[screen_workarea.bottom] neg eax - mov [esi+WDATA.height],eax + mov [esi+WDATA.box.height],eax .lp1: add esi,0x20 loop @b ret - .lp2: mov eax,[esi+WDATA.left] - add eax,[esi+WDATA.width] + .lp2: mov eax,[esi+WDATA.box.left] + add eax,[esi+WDATA.box.width] mov ebx,[0x0000fe00] ; inc ebx cmp eax,ebx jle .lp4 - mov eax,[esi+WDATA.width] + mov eax,[esi+WDATA.box.width] sub eax,ebx jle .lp3 - mov [esi+WDATA.width],ebx - .lp3: sub ebx,[esi+WDATA.width] - mov [esi+WDATA.left],ebx - .lp4: mov eax,[esi+WDATA.top] - add eax,[esi+WDATA.height] + mov [esi+WDATA.box.width],ebx + .lp3: sub ebx,[esi+WDATA.box.width] + mov [esi+WDATA.box.left],ebx + .lp4: mov eax,[esi+WDATA.box.top] + add eax,[esi+WDATA.box.height] mov ebx,[0x0000fe04] ; inc ebx cmp eax,ebx jle .lp6 - mov eax,[esi+WDATA.height] + mov eax,[esi+WDATA.box.height] sub eax,ebx jle .lp5 - mov [esi+WDATA.height],ebx - .lp5: sub ebx,[esi+WDATA.height] - mov [esi+WDATA.top],ebx + mov [esi+WDATA.box.height],ebx + .lp5: sub ebx,[esi+WDATA.box.height] + mov [esi+WDATA.box.top],ebx .lp6: add esi,0x20 loop @b ret @@ -633,6 +633,63 @@ sys_window_mouse: ret + + + +drawwindow_I_caption: + + mov ecx,[edx+20] ; grab bar + push ecx + mov esi,edx + mov edx,[esi+04] + add edx,1 + mov ebx,[esi+04] + add ebx,21 + mov eax,[esi+04] + add eax,[esi+12] + cmp ebx,eax + jb .wdsizeok + mov ebx,eax + .wdsizeok: + push ebx + .drwi: + mov ebx,edx + shl ebx,16 + add ebx,edx + mov eax,[esi+00] + inc eax + shl eax,16 + add eax,[esi+00] + add eax,[esi+8] + sub eax,1 + push edx + mov edx,0x80000000 + mov ecx,[esi+20] + and ecx,edx + cmp ecx,edx + jnz .nofa + mov ecx,[esi+20] + sub ecx,0x00040404 + mov [esi+20],ecx + and ecx,0x00ffffff + jmp .faj + .nofa: + mov ecx,[esi+20] + and ecx,0x00ffffff + .faj: + pop edx + mov edi,0 + call [draw_line] + inc edx + cmp edx,[esp] + jb .drwi + add esp,4 + pop ecx + mov [esi+20],ecx + + ret + + drawwindow_I: pushad @@ -648,54 +705,7 @@ drawwindow_I: add ebx,[edx+12] call draw_rectangle - mov ecx,[edx+20] ; grab bar - push ecx - mov esi,edx - mov edx,[esi+04] - add edx,1 - mov ebx,[esi+04] - add ebx,25 - mov eax,[esi+04] - add eax,[esi+12] - cmp ebx,eax - jb wdsizeok - mov ebx,eax - wdsizeok: - push ebx - drwi: - mov ebx,edx - shl ebx,16 - add ebx,edx - mov eax,[esi+00] - inc eax - shl eax,16 - add eax,[esi+00] - add eax,[esi+8] - sub eax,1 - push edx - mov edx,0x80000000 - mov ecx,[esi+20] - and ecx,edx - cmp ecx,edx - jnz nofa - mov ecx,[esi+20] - sub ecx,0x00040404 - mov [esi+20],ecx - and ecx,0x00ffffff - jmp faj - nofa: - mov ecx,[esi+20] - and ecx,0x00ffffff - faj: - pop edx - mov edi,0 - call [draw_line] - inc edx - cmp edx,[esp] - jb drwi - add esp,4 - pop ecx - mov [esi+20],ecx + call drawwindow_I_caption mov edx,[esi+04] ; inside work area add edx,21+5 @@ -759,6 +769,54 @@ r_bx equ [esp+18] ; y end ret +drawwindow_III_caption: + + mov ecx,[edx+20] ; GRAB BAR + push ecx + mov esi,edx + mov edx,[esi+04] + add edx,4 + mov ebx,[esi+04] + add ebx,20 + mov eax,[esi+04] + add eax,[esi+12] + cmp ebx,eax + jb .wdsizeok + mov ebx,eax + .wdsizeok: + push ebx + .drwi: + mov ebx,edx + shl ebx,16 + add ebx,edx + mov eax,[esi+00] + shl eax,16 + add eax,[esi+00] + add eax,[esi+8] + add eax,4*65536-4 + mov ecx,[esi+20] + test ecx,0x40000000 + jz .nofa + add ecx,0x040404 + .nofa: + test ecx,0x80000000 + jz .nofa2 + sub ecx,0x040404 + .nofa2: + mov [esi+20],ecx + and ecx,0xffffff + xor edi, edi + call [draw_line] + inc edx + cmp edx,[esp] + jb .drwi + add esp,4 + pop ecx + mov [esi+20],ecx + + ret + + drawwindow_III: pushad @@ -790,48 +848,7 @@ drawwindow_III: add ebx,1*65536-1 call draw_rectangle - mov ecx,[edx+20] ; GRAB BAR - push ecx - mov esi,edx - mov edx,[esi+04] - add edx,4 - mov ebx,[esi+04] - add ebx,20 - mov eax,[esi+04] - add eax,[esi+12] - cmp ebx,eax - jb wdsizeok2 - mov ebx,eax - wdsizeok2: - push ebx - drwi2: - mov ebx,edx - shl ebx,16 - add ebx,edx - mov eax,[esi+00] - shl eax,16 - add eax,[esi+00] - add eax,[esi+8] - add eax,4*65536-4 - mov ecx,[esi+20] - test ecx,0x40000000 - jz nofa3 - add ecx,0x040404 - nofa3: - test ecx,0x80000000 - jz nofa2 - sub ecx,0x040404 - nofa2: - mov [esi+20],ecx - and ecx,0xffffff - xor edi, edi - call [draw_line] - inc edx - cmp edx,[esp] - jb drwi2 - add esp,4 - pop ecx - mov [esi+20],ecx + call drawwindow_III_caption mov edx,[esi+04] ; WORK AREA add edx,21+5 @@ -1060,15 +1077,15 @@ minimize_window: or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED mov edi, eax ;call calculatescreen - mov eax, [edi+WDATA.left] + mov eax, [edi+WDATA.box.left] mov [dlx], eax mov ecx, eax - add ecx, [edi+WDATA.width] + add ecx, [edi+WDATA.box.width] mov [dlxe], ecx - mov ebx, [edi+WDATA.top] + mov ebx, [edi+WDATA.box.top] mov [dly], ebx mov edx, ebx - add edx, [edi+WDATA.height] + add edx, [edi+WDATA.box.height] mov [dlye], edx call calculatescreen xor esi, esi @@ -1093,21 +1110,21 @@ restore_minimized_window: and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED cmp eax, [0x3004] ; the uppermost window jnz .no_uppermost - mov eax, [edi+WDATA.left] - mov ebx, [edi+WDATA.top] + mov eax, [edi+WDATA.box.left] + mov ebx, [edi+WDATA.box.top] mov ecx, eax mov edx, ebx - add ecx, [edi+WDATA.width] - add edx, [edi+WDATA.height] + add ecx, [edi+WDATA.box.width] + add edx, [edi+WDATA.box.height] call setscreen jmp .done .no_uppermost: - mov eax, [edi+WDATA.left] - mov ebx, [edi+WDATA.top] + mov eax, [edi+WDATA.box.left] + mov ebx, [edi+WDATA.box.top] mov ecx, eax mov edx, ebx - add ecx, [edi+WDATA.width] - add edx, [edi+WDATA.height] + add ecx, [edi+WDATA.box.width] + add edx, [edi+WDATA.box.height] call calculatescreen .done: mov [0xfff4],byte 0 ; no mouse under @@ -1480,7 +1497,7 @@ checkwindows: jz @f mov eax,[screen_workarea.bottom] sub eax,[screen_workarea.top] - @@: mov [edi+WDATA.height],eax + @@: mov [edi+WDATA.box.height],eax no_window_shade: @@ -1493,22 +1510,22 @@ checkwindows: jnz restore_from_fullscreen or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED mov eax,[screen_workarea.left] - mov [edi+WDATA.left],eax + mov [edi+WDATA.box.left],eax sub eax,[screen_workarea.right] neg eax - mov [edi+WDATA.width],eax + mov [edi+WDATA.box.width],eax mov eax,[screen_workarea.top] - mov [edi+WDATA.top],eax + mov [edi+WDATA.box.top],eax test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP jnz @f sub eax,[screen_workarea.bottom] neg eax - mov [edi+WDATA.height],eax + mov [edi+WDATA.box.height],eax @@: jmp no_fullscreen_restore restore_from_fullscreen: and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED - push [edi+WDATA.height] + push [edi+WDATA.box.height] push edi ; restore lea esi, [edx + 0x90] mov ecx,4 @@ -1518,7 +1535,7 @@ checkwindows: pop eax test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP jz @f - mov [edi+WDATA.height],eax + mov [edi+WDATA.box.height],eax @@: no_fullscreen_restore: diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index c8ee938c28..4838e219c6 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -69,7 +69,10 @@ dd servetable-0x10000 draw_line dd __sys_draw_line disable_mouse dd __sys_disable_mouse draw_pointer dd __sys_draw_pointer -drawbar dd __sys_drawbar +;//mike.dld, 2006-08-02 [ +;drawbar dd __sys_drawbar +drawbar dd __sys_drawbar.forced +;//mike.dld, 2006-08-02 ] putpixel dd __sys_putpixel ; } mike.dld @@ -2856,9 +2859,10 @@ sys_drawwindow: call sys_set_window call [disable_mouse] call drawwindow_I - dec [mouse_pause] - call [draw_pointer] - ret + ;dec [mouse_pause] + ;call [draw_pointer] + ;ret + jmp draw_window_caption.2 nosyswI: cmp edi,1 ; type II - only reserve area, no draw @@ -2880,9 +2884,10 @@ sys_drawwindow: call sys_set_window call [disable_mouse] call drawwindow_III - dec [mouse_pause] - call [draw_pointer] - ret + ;dec [mouse_pause] + ;call [draw_pointer] + ;ret + jmp draw_window_caption.2 nosyswIII: cmp edi,3 ; type IV - skinned window @@ -2902,14 +2907,176 @@ sys_drawwindow: call sys_set_window call [disable_mouse] call drawwindow_IV - dec [mouse_pause] - call [draw_pointer] - ret + ;dec [mouse_pause] + ;call [draw_pointer] + ;ret + jmp draw_window_caption.2 nosyswIV: ret +draw_window_caption: + inc [mouse_pause] + call [disable_mouse] + + xor eax,eax + mov edx,[0x3004] + movzx edx,word[0xC400+edx*2] + cmp edx,[0x3000] + jne @f + inc eax + @@: mov edx,[0x3000] + shl edx,5 + add edx,window_data + movzx ebx,[edx+WDATA.fl_wstyle] + and bl,0x0F + cmp bl,3 + jne .not_style_3 + + push edx + call drawwindow_IV_caption + add esp,4 + jmp .2 + + .not_style_3: + cmp bl,2 + jne .not_style_2 + + call drawwindow_III_caption + jmp .2 + + .not_style_2: + cmp bl,0 + jne .2 + + call drawwindow_I_caption + +;-------------------------------------------------------------- + .2: ;jmp @f + mov edi,[0x3000] + shl edi,5 + test [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION + jz @f + mov ecx,[edi*8+0x80000+APPDATA.wnd_caption] + or ecx,ecx + jz @f + add ecx,[edi+twdw+0x10] + + movzx eax,[edi+window_data+WDATA.fl_wstyle] + and al,0x0F + cmp al,3 + jne .not_skinned + + mov ebp,[edi+window_data+WDATA.box.left-2] + mov bp,word[edi+window_data+WDATA.box.top] + movzx eax,word[edi+window_data+WDATA.box.width] + sub ax,[_skinmargins.left] + sub ax,[_skinmargins.right] + cwde + cdq + mov ebx,6 + idiv ebx + or eax,eax + js @f + mov edx,eax + mov eax,dword[_skinmargins.left-2] + mov ax,word[_skinh] + sub ax,[_skinmargins.bottom] + sub ax,[_skinmargins.top] + sar ax,1 + adc ax,0 + add ax,[_skinmargins.top] + add ax,-3 + add eax,ebp + mov ebx,[common_colours+16];0x00FFFFFF + xor edi,edi + call dtext + jmp @f + + .not_skinned: + cmp al,1 + je @f + + mov ebp,[edi+window_data+WDATA.box.left-2] + mov bp,word[edi+window_data+WDATA.box.top] + movzx eax,word[edi+window_data+WDATA.box.width] + sub eax,16 + cwde + cdq + mov ebx,6 + idiv ebx + or eax,eax + js @f + mov edx,eax + mov eax,0x00080007 + add eax,ebp + mov ebx,[common_colours+16];0x00FFFFFF + xor edi,edi + call dtext + jmp @f + + @@: +;-------------------------------------------------------------- + dec [mouse_pause] + call [draw_pointer] + ret + +iglobal +align 4 +window_topleft dd \ + 1, 21,\ + 0, 0,\ + 5, 20,\ + 5, ? +endg + +set_window_clientbox: + push eax ecx edi + + mov eax,[_skinh] + mov [window_topleft+4*7],eax + + mov ecx,edi + sub edi,window_data + shl edi,3 + test [ecx+WDATA.fl_wstyle],WSTYLE_CLIENTRELATIVE + jz @f + + movzx eax,[ecx+WDATA.fl_wstyle] + and eax,0x0F + mov eax,[eax*8+window_topleft+0] + mov [edi+0x80000+APPDATA.wnd_clientbox.left],eax + shl eax,1 + neg eax + add eax,[ecx+WDATA.box.width] + mov [edi+0x80000+APPDATA.wnd_clientbox.width],eax + + movzx eax,[ecx+WDATA.fl_wstyle] + and eax,0x0F + push [eax*8+window_topleft+0] + mov eax,[eax*8+window_topleft+4] + mov [edi+0x80000+APPDATA.wnd_clientbox.top],eax + neg eax + sub eax,[esp] + add eax,[ecx+WDATA.box.height] + mov [edi+0x80000+APPDATA.wnd_clientbox.height],eax + add esp,4 + + pop edi ecx eax + ret + @@: + xor eax,eax + mov [edi+0x80000+APPDATA.wnd_clientbox.left],eax + mov [edi+0x80000+APPDATA.wnd_clientbox.top],eax + mov eax,[ecx+WDATA.box.width] + mov [edi+0x80000+APPDATA.wnd_clientbox.width],eax + mov eax,[ecx+WDATA.box.height] + mov [edi+0x80000+APPDATA.wnd_clientbox.height],eax + + pop edi ecx eax + ret + sys_set_window: mov edi,[0x3000] @@ -2917,12 +3084,14 @@ sys_set_window: add edi,window_data ; colors - mov [edi+16],ecx - mov [edi+20],edx - mov [edi+24],esi + mov [edi+WDATA.cl_workarea],ecx + mov [edi+WDATA.cl_titlebar],edx + mov [edi+WDATA.cl_frames],esi + + call set_window_clientbox ; check flag (?) - cmp [edi+30],byte 1 + cmp [edi+WDATA.fl_wdrawn],1 jz newd push eax @@ -2931,23 +3100,33 @@ sys_set_window: mov [new_window_starting],eax pop eax - mov [edi+8],ax - mov [edi+12],bx - shr eax,16 - shr ebx,16 - mov [edi+00],ax - mov [edi+04],bx + mov word[edi+WDATA.box.width],ax + mov word[edi+WDATA.box.height],bx + sar eax,16 + sar ebx,16 + mov word[edi+WDATA.box.left],ax + mov word[edi+WDATA.box.top],bx call check_window_position push ecx esi edi ; save for window fullscreen/resize - mov esi,edi + ;mov esi,edi + + mov cl,[edi+WDATA.fl_wstyle] + sub edi,window_data - shr edi,5 - shl edi,8 + shl edi,3 add edi,0x80000+0x90 + + and cl,0x0F + mov [edi-0x90+APPDATA.wnd_caption],0 + cmp cl,3 + jne @f + mov [edi-0x90+APPDATA.wnd_caption],esi + @@: mov esi,[esp+0] + mov ecx,4 cld rep movsd @@ -2974,6 +3153,45 @@ sys_set_window: ret +syscall_windowsettings: + + .set_window_caption: + dec eax ; subfunction #1 - set window caption + jnz .get_window_caption + + ; NOTE: only window owner thread can set its caption, + ; so there's no parameter for PID/TID + + mov edi,[0x3000] + shl edi,5 + + ; have to check if caption is within application memory limit + ; check is trivial, and if application resizes its memory, + ; caption still can become over bounds + mov ecx,[edi*8+0x80000+APPDATA.mem_size] + add ecx,255 ; max caption length + cmp ebx,ecx + ja .exit_fail + + mov [edi*8+0x80000+APPDATA.wnd_caption],ebx + or [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION + + call draw_window_caption + + xor eax,eax ; eax = 0 (success) + ret + + .get_window_caption: + dec eax ; subfunction #2 - get window caption + jnz .exit_fail + + ; not implemented yet + + .exit_fail: + xor eax,eax + inc eax ; eax = 1 (fail) + ret + sys_window_move: @@ -3966,6 +4184,13 @@ sys_putimage: .exit: ret @@: + mov edi,[0x3000] + shl edi,8 + add dx,word[edi+0x80000+APPDATA.wnd_clientbox.top] + rol edx,16 + add dx,word[edi+0x80000+APPDATA.wnd_clientbox.left] + rol edx,16 + .forced: mov eax, vga_putimage cmp [0xfe0c], word 0x12 jz .doit @@ -3989,6 +4214,13 @@ sys_putimage: ; edi color __sys_drawbar: + mov esi,[0x3000] + shl esi,8 + add eax,[esi+0x80000+APPDATA.wnd_clientbox.left] + add ecx,[esi+0x80000+APPDATA.wnd_clientbox.left] + add ebx,[esi+0x80000+APPDATA.wnd_clientbox.top] + add edx,[esi+0x80000+APPDATA.wnd_clientbox.top] + .forced: inc [mouse_pause] cmp [0xfe0c],word 0x12 jne sdbv20 @@ -4667,8 +4899,12 @@ syscall_setpixel: ; SetPixel mov edx,[0x3010] add eax,[edx-twdw] add ebx,[edx-twdw+4] + mov edi,[0x3000] + shl edi,8 + add eax,[edi+0x80000+APPDATA.wnd_clientbox.left] + add ebx,[edi+0x80000+APPDATA.wnd_clientbox.top] xor edi,edi ; no force - ;mov edi,1 +; mov edi,1 call [disable_mouse] jmp [putpixel] @@ -4678,8 +4914,12 @@ syscall_writetext: ; WriteText mov edi,[0x3010] mov ebp,[edi-twdw] + mov esi,[0x3000] + shl esi,8 + add ebp,[esi+0x80000+APPDATA.wnd_clientbox.left] shl ebp,16 add ebp,[edi-twdw+4] + add bp,word[esi+0x80000+APPDATA.wnd_clientbox.top] add edi,0x10 add ecx,[edi] add eax,ebp @@ -4714,6 +4954,10 @@ syscall_drawrect: ; DrawRect shr eax,16 movzx edx,bx shr ebx,16 + mov esi,[0x3000] + shl esi,8 + add eax,[esi+0x80000+APPDATA.wnd_clientbox.left] + add ebx,[esi+0x80000+APPDATA.wnd_clientbox.top] add ecx,eax add edx,ebx jmp [drawbar] @@ -4838,11 +5082,17 @@ syscall_drawline: ; DrawLine mov edi,[0x3010] movzx edx,word[edi-twdw] mov ebp,edx + mov esi,[0x3000] + shl esi,8 + add ebp,[esi+0x80000+APPDATA.wnd_clientbox.left] + add dx,word[esi+0x80000+APPDATA.wnd_clientbox.left] shl edx,16 add ebp,edx movzx edx,word[edi-twdw+4] add eax,ebp mov ebp,edx + add ebp,[esi+0x80000+APPDATA.wnd_clientbox.top] + add dx,word[esi+0x80000+APPDATA.wnd_clientbox.top] shl edx,16 xor edi,edi add edx,ebp diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index 294970f3d7..bb097f2642 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -75,31 +75,6 @@ struc dt [a] { common . dt a display 'not used dt: ',`.,13,10 end if } -; constants definition -WSTATE_NORMAL = 00000000b -WSTATE_MAXIMIZED = 00000001b -WSTATE_MINIMIZED = 00000010b -WSTATE_ROLLEDUP = 00000100b - -; structures definition -struc WDATA { - .left dd ? - .top dd ? - .width dd ? - .height dd ? - .cl_workarea dd ? - .cl_titlebar dd ? - .cl_frames dd ? - .reserved db ? - .fl_wstate db ? - .fl_wdrawn db ? - .fl_redraw db ? -} -virtual at 0 - WDATA WDATA -end virtual -label WDATA.fl_wstyle byte at 0x13 ; WDATA.cl_workarea+3 - struc RECT { .left dd ? .top dd ? @@ -120,18 +95,97 @@ virtual at 0 BOX BOX end virtual +; constants definition +WSTATE_NORMAL = 00000000b +WSTATE_MAXIMIZED = 00000001b +WSTATE_MINIMIZED = 00000010b +WSTATE_ROLLEDUP = 00000100b + +WSTATE_REDRAW = 00000001b +WSTATE_WNDDRAWN = 00000010b + +WSTYLE_HASCAPTION = 00010000b +WSTYLE_CLIENTRELATIVE = 00100000b + +struc TASKLIST +{ + .event_mask dd ? + .pid dd ? + dw ? + .state dw ? + dw ? + .wnd_number db ? + db ? + .mem_start dd ? + .counter_sum dd ? + .counter_add dd ? + .cpu_usage dd ? +} +virtual at 0 + TASKLIST TASKLIST +end virtual + +; structures definition +struc WDATA { + .box BOX + .cl_workarea dd ? + .cl_titlebar dd ? + .cl_frames dd ? + .reserved db ? + .fl_wstate db ? + .fl_wdrawn db ? + .fl_redraw db ? +} +virtual at 0 + WDATA WDATA +end virtual +label WDATA.fl_wstyle byte at 0x13 + +struc APPDATA +{ + .app_name db 11 dup(?) + db 5 dup(?) + .fpu_save_area db 108 dup(?) + db 3 dup(?) + .is_fpu_saved db ? + .wnd_shape dd ? + .wnd_shape_scale dd ? + .gdt dd ? + .mem_size dd ? + .saved_box BOX + .ipc_start dd ? + .ipc_size dd ? + .event_mask dd ? + .debugger_slot dd ? + .int40_handler dd ? + .keyboard_mode db ? + db 3 dup(?) + .dir_table dd ? + .dbg_event_mem dd ? + .dbg_regs: + .dbg_regs.dr0 dd ? + .dbg_regs.dr1 dd ? + .dbg_regs.dr2 dd ? + .dbg_regs.dr3 dd ? + .dbg_regs.dr7 dd ? + .wnd_caption dd ? + .wnd_clientbox BOX +} +virtual at 0 + APPDATA APPDATA +end virtual + ;// mike.dld, 2006-29-01 ] ; Core functions -include "core/sync.inc" +include "core/sync.inc" ; macros for synhronization objects include "core/sys32.inc" ; process management include "core/sched.inc" ; process scheduling include "core/syscall.inc" ; system call include "core/mem.inc" ; high-level memory management include "core/newproce.inc" ;new process management include "core/physmem.inc" ; access to physical memory for applications -include "core/sync.inc" ; macros for synhronization objects ; GUI stuff include "gui/window.inc"