From fca11d77001b34fd6999810bf43cd772f5306eeb Mon Sep 17 00:00:00 2001 From: heavyiron Date: Sat, 29 Jul 2006 07:27:24 +0000 Subject: [PATCH] Sorry for this commit: it is a part of previous one git-svn-id: svn://kolibrios.org@111 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../copy2/trunk/build_en.bat | 0 .../copy2/trunk/build_ru.bat | 0 .../{filemngrs => fs}/copy2/trunk/copy2.asm | 0 .../archer => fs/copy2}/trunk/macros.inc | 0 .../{filemngrs => fs}/copyr/trunk/ascl.inc | 0 .../copyr/trunk/build_en.bat | 0 .../copyr/trunk/build_ru.bat | 0 .../{filemngrs => fs}/copyr/trunk/copyr.asm | 0 .../copy2 => fs/copyr}/trunk/macros.inc | 0 .../hexhd/trunk/build_en.bat | 0 .../hexhd/trunk/build_ru.bat | 0 .../{filemngrs => fs}/hexhd/trunk/hexhd.asm | 0 .../{filemngrs => fs}/hexhd/trunk/macros.inc | 0 .../{filemngrs => fs}/mfar/trunk/build_en.bat | 0 .../{filemngrs => fs}/mfar/trunk/build_ru.bat | 0 .../{filemngrs => fs}/mfar/trunk/macros.inc | 0 .../{filemngrs => fs}/mfar/trunk/menuet.inc | 0 .../{filemngrs => fs}/mfar/trunk/mf-copy.inc | 0 .../{filemngrs => fs}/mfar/trunk/mf-lang.inc | 0 .../{filemngrs => fs}/mfar/trunk/mf-sort.inc | 0 .../{filemngrs => fs}/mfar/trunk/mfar.asm | 0 .../{filemngrs => fs}/mfar/trunk/mfar.inc | 0 .../{filemngrs => fs}/mfar/trunk/readme.txt | 0 .../rdfdel/trunk/build_en.bat | 0 .../rdfdel/trunk/build_ru.bat | 0 .../copyr => fs/rdfdel}/trunk/macros.inc | 0 .../{filemngrs => fs}/rdfdel/trunk/rdfdel.asm | 0 .../sysxtree/trunk/SYSTR12.GIF | Bin .../sysxtree/trunk/ascgl.inc | 0 .../{filemngrs => fs}/sysxtree/trunk/ascl.inc | 0 .../sysxtree/trunk/build_en.bat | 0 .../sysxtree/trunk/build_ru.bat | 0 .../sysxtree/trunk/macros.inc | 0 .../sysxtree/trunk/sysxtree.asm | 0 .../archer/trunk/@RCHER.ASM | 0 .../archer/trunk/archer.txt | 0 .../archer/trunk/arcmacro.inc | 0 .../archer/trunk/build_en.bat | 0 .../archer/trunk/build_ru.bat | 0 .../{develop => other}/archer/trunk/data.inc | 0 .../{develop => other}/archer/trunk/debug.inc | 0 .../archer/trunk/deflate.inc | 0 .../rdfdel => other/archer}/trunk/macros.inc | 0 .../archer/trunk/parser.inc | 0 .../{develop => other}/archer/trunk/sys.inc | 0 .../{develop => other}/mhc/trunk/build_en.bat | 0 .../{develop => other}/mhc/trunk/build_ru.bat | 0 .../{develop => other}/mhc/trunk/macros.inc | 0 programs/{develop => other}/mhc/trunk/mhc.asm | 0 programs/other/tinypad2/trunk/ReadMe.txt | 203 + programs/other/tinypad2/trunk/archive.txt | 8 + programs/other/tinypad2/trunk/ascl.inc | 933 ++++ programs/other/tinypad2/trunk/build_en.bat | 4 + programs/other/tinypad2/trunk/build_ru.bat | 4 + programs/other/tinypad2/trunk/dialogs1.inc | 597 +++ programs/other/tinypad2/trunk/macros.inc | 266 ++ programs/other/tinypad2/trunk/scroll.inc | 440 ++ programs/other/tinypad2/trunk/tinypad2.asm | 4001 +++++++++++++++++ 58 files changed, 6456 insertions(+) rename programs/{filemngrs => fs}/copy2/trunk/build_en.bat (100%) rename programs/{filemngrs => fs}/copy2/trunk/build_ru.bat (100%) rename programs/{filemngrs => fs}/copy2/trunk/copy2.asm (100%) rename programs/{develop/archer => fs/copy2}/trunk/macros.inc (100%) rename programs/{filemngrs => fs}/copyr/trunk/ascl.inc (100%) rename programs/{filemngrs => fs}/copyr/trunk/build_en.bat (100%) rename programs/{filemngrs => fs}/copyr/trunk/build_ru.bat (100%) rename programs/{filemngrs => fs}/copyr/trunk/copyr.asm (100%) rename programs/{filemngrs/copy2 => fs/copyr}/trunk/macros.inc (100%) rename programs/{filemngrs => fs}/hexhd/trunk/build_en.bat (100%) rename programs/{filemngrs => fs}/hexhd/trunk/build_ru.bat (100%) rename programs/{filemngrs => fs}/hexhd/trunk/hexhd.asm (100%) rename programs/{filemngrs => fs}/hexhd/trunk/macros.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/build_en.bat (100%) rename programs/{filemngrs => fs}/mfar/trunk/build_ru.bat (100%) rename programs/{filemngrs => fs}/mfar/trunk/macros.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/menuet.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/mf-copy.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/mf-lang.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/mf-sort.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/mfar.asm (100%) rename programs/{filemngrs => fs}/mfar/trunk/mfar.inc (100%) rename programs/{filemngrs => fs}/mfar/trunk/readme.txt (100%) rename programs/{filemngrs => fs}/rdfdel/trunk/build_en.bat (100%) rename programs/{filemngrs => fs}/rdfdel/trunk/build_ru.bat (100%) rename programs/{filemngrs/copyr => fs/rdfdel}/trunk/macros.inc (100%) rename programs/{filemngrs => fs}/rdfdel/trunk/rdfdel.asm (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/SYSTR12.GIF (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/ascgl.inc (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/ascl.inc (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/build_en.bat (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/build_ru.bat (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/macros.inc (100%) rename programs/{filemngrs => fs}/sysxtree/trunk/sysxtree.asm (100%) rename programs/{develop => other}/archer/trunk/@RCHER.ASM (100%) rename programs/{develop => other}/archer/trunk/archer.txt (100%) rename programs/{develop => other}/archer/trunk/arcmacro.inc (100%) rename programs/{develop => other}/archer/trunk/build_en.bat (100%) rename programs/{develop => other}/archer/trunk/build_ru.bat (100%) rename programs/{develop => other}/archer/trunk/data.inc (100%) rename programs/{develop => other}/archer/trunk/debug.inc (100%) rename programs/{develop => other}/archer/trunk/deflate.inc (100%) rename programs/{filemngrs/rdfdel => other/archer}/trunk/macros.inc (100%) rename programs/{develop => other}/archer/trunk/parser.inc (100%) rename programs/{develop => other}/archer/trunk/sys.inc (100%) rename programs/{develop => other}/mhc/trunk/build_en.bat (100%) rename programs/{develop => other}/mhc/trunk/build_ru.bat (100%) rename programs/{develop => other}/mhc/trunk/macros.inc (100%) rename programs/{develop => other}/mhc/trunk/mhc.asm (100%) create mode 100644 programs/other/tinypad2/trunk/ReadMe.txt create mode 100644 programs/other/tinypad2/trunk/archive.txt create mode 100644 programs/other/tinypad2/trunk/ascl.inc create mode 100644 programs/other/tinypad2/trunk/build_en.bat create mode 100644 programs/other/tinypad2/trunk/build_ru.bat create mode 100644 programs/other/tinypad2/trunk/dialogs1.inc create mode 100644 programs/other/tinypad2/trunk/macros.inc create mode 100644 programs/other/tinypad2/trunk/scroll.inc create mode 100644 programs/other/tinypad2/trunk/tinypad2.asm diff --git a/programs/filemngrs/copy2/trunk/build_en.bat b/programs/fs/copy2/trunk/build_en.bat similarity index 100% rename from programs/filemngrs/copy2/trunk/build_en.bat rename to programs/fs/copy2/trunk/build_en.bat diff --git a/programs/filemngrs/copy2/trunk/build_ru.bat b/programs/fs/copy2/trunk/build_ru.bat similarity index 100% rename from programs/filemngrs/copy2/trunk/build_ru.bat rename to programs/fs/copy2/trunk/build_ru.bat diff --git a/programs/filemngrs/copy2/trunk/copy2.asm b/programs/fs/copy2/trunk/copy2.asm similarity index 100% rename from programs/filemngrs/copy2/trunk/copy2.asm rename to programs/fs/copy2/trunk/copy2.asm diff --git a/programs/develop/archer/trunk/macros.inc b/programs/fs/copy2/trunk/macros.inc similarity index 100% rename from programs/develop/archer/trunk/macros.inc rename to programs/fs/copy2/trunk/macros.inc diff --git a/programs/filemngrs/copyr/trunk/ascl.inc b/programs/fs/copyr/trunk/ascl.inc similarity index 100% rename from programs/filemngrs/copyr/trunk/ascl.inc rename to programs/fs/copyr/trunk/ascl.inc diff --git a/programs/filemngrs/copyr/trunk/build_en.bat b/programs/fs/copyr/trunk/build_en.bat similarity index 100% rename from programs/filemngrs/copyr/trunk/build_en.bat rename to programs/fs/copyr/trunk/build_en.bat diff --git a/programs/filemngrs/copyr/trunk/build_ru.bat b/programs/fs/copyr/trunk/build_ru.bat similarity index 100% rename from programs/filemngrs/copyr/trunk/build_ru.bat rename to programs/fs/copyr/trunk/build_ru.bat diff --git a/programs/filemngrs/copyr/trunk/copyr.asm b/programs/fs/copyr/trunk/copyr.asm similarity index 100% rename from programs/filemngrs/copyr/trunk/copyr.asm rename to programs/fs/copyr/trunk/copyr.asm diff --git a/programs/filemngrs/copy2/trunk/macros.inc b/programs/fs/copyr/trunk/macros.inc similarity index 100% rename from programs/filemngrs/copy2/trunk/macros.inc rename to programs/fs/copyr/trunk/macros.inc diff --git a/programs/filemngrs/hexhd/trunk/build_en.bat b/programs/fs/hexhd/trunk/build_en.bat similarity index 100% rename from programs/filemngrs/hexhd/trunk/build_en.bat rename to programs/fs/hexhd/trunk/build_en.bat diff --git a/programs/filemngrs/hexhd/trunk/build_ru.bat b/programs/fs/hexhd/trunk/build_ru.bat similarity index 100% rename from programs/filemngrs/hexhd/trunk/build_ru.bat rename to programs/fs/hexhd/trunk/build_ru.bat diff --git a/programs/filemngrs/hexhd/trunk/hexhd.asm b/programs/fs/hexhd/trunk/hexhd.asm similarity index 100% rename from programs/filemngrs/hexhd/trunk/hexhd.asm rename to programs/fs/hexhd/trunk/hexhd.asm diff --git a/programs/filemngrs/hexhd/trunk/macros.inc b/programs/fs/hexhd/trunk/macros.inc similarity index 100% rename from programs/filemngrs/hexhd/trunk/macros.inc rename to programs/fs/hexhd/trunk/macros.inc diff --git a/programs/filemngrs/mfar/trunk/build_en.bat b/programs/fs/mfar/trunk/build_en.bat similarity index 100% rename from programs/filemngrs/mfar/trunk/build_en.bat rename to programs/fs/mfar/trunk/build_en.bat diff --git a/programs/filemngrs/mfar/trunk/build_ru.bat b/programs/fs/mfar/trunk/build_ru.bat similarity index 100% rename from programs/filemngrs/mfar/trunk/build_ru.bat rename to programs/fs/mfar/trunk/build_ru.bat diff --git a/programs/filemngrs/mfar/trunk/macros.inc b/programs/fs/mfar/trunk/macros.inc similarity index 100% rename from programs/filemngrs/mfar/trunk/macros.inc rename to programs/fs/mfar/trunk/macros.inc diff --git a/programs/filemngrs/mfar/trunk/menuet.inc b/programs/fs/mfar/trunk/menuet.inc similarity index 100% rename from programs/filemngrs/mfar/trunk/menuet.inc rename to programs/fs/mfar/trunk/menuet.inc diff --git a/programs/filemngrs/mfar/trunk/mf-copy.inc b/programs/fs/mfar/trunk/mf-copy.inc similarity index 100% rename from programs/filemngrs/mfar/trunk/mf-copy.inc rename to programs/fs/mfar/trunk/mf-copy.inc diff --git a/programs/filemngrs/mfar/trunk/mf-lang.inc b/programs/fs/mfar/trunk/mf-lang.inc similarity index 100% rename from programs/filemngrs/mfar/trunk/mf-lang.inc rename to programs/fs/mfar/trunk/mf-lang.inc diff --git a/programs/filemngrs/mfar/trunk/mf-sort.inc b/programs/fs/mfar/trunk/mf-sort.inc similarity index 100% rename from programs/filemngrs/mfar/trunk/mf-sort.inc rename to programs/fs/mfar/trunk/mf-sort.inc diff --git a/programs/filemngrs/mfar/trunk/mfar.asm b/programs/fs/mfar/trunk/mfar.asm similarity index 100% rename from programs/filemngrs/mfar/trunk/mfar.asm rename to programs/fs/mfar/trunk/mfar.asm diff --git a/programs/filemngrs/mfar/trunk/mfar.inc b/programs/fs/mfar/trunk/mfar.inc similarity index 100% rename from programs/filemngrs/mfar/trunk/mfar.inc rename to programs/fs/mfar/trunk/mfar.inc diff --git a/programs/filemngrs/mfar/trunk/readme.txt b/programs/fs/mfar/trunk/readme.txt similarity index 100% rename from programs/filemngrs/mfar/trunk/readme.txt rename to programs/fs/mfar/trunk/readme.txt diff --git a/programs/filemngrs/rdfdel/trunk/build_en.bat b/programs/fs/rdfdel/trunk/build_en.bat similarity index 100% rename from programs/filemngrs/rdfdel/trunk/build_en.bat rename to programs/fs/rdfdel/trunk/build_en.bat diff --git a/programs/filemngrs/rdfdel/trunk/build_ru.bat b/programs/fs/rdfdel/trunk/build_ru.bat similarity index 100% rename from programs/filemngrs/rdfdel/trunk/build_ru.bat rename to programs/fs/rdfdel/trunk/build_ru.bat diff --git a/programs/filemngrs/copyr/trunk/macros.inc b/programs/fs/rdfdel/trunk/macros.inc similarity index 100% rename from programs/filemngrs/copyr/trunk/macros.inc rename to programs/fs/rdfdel/trunk/macros.inc diff --git a/programs/filemngrs/rdfdel/trunk/rdfdel.asm b/programs/fs/rdfdel/trunk/rdfdel.asm similarity index 100% rename from programs/filemngrs/rdfdel/trunk/rdfdel.asm rename to programs/fs/rdfdel/trunk/rdfdel.asm diff --git a/programs/filemngrs/sysxtree/trunk/SYSTR12.GIF b/programs/fs/sysxtree/trunk/SYSTR12.GIF similarity index 100% rename from programs/filemngrs/sysxtree/trunk/SYSTR12.GIF rename to programs/fs/sysxtree/trunk/SYSTR12.GIF diff --git a/programs/filemngrs/sysxtree/trunk/ascgl.inc b/programs/fs/sysxtree/trunk/ascgl.inc similarity index 100% rename from programs/filemngrs/sysxtree/trunk/ascgl.inc rename to programs/fs/sysxtree/trunk/ascgl.inc diff --git a/programs/filemngrs/sysxtree/trunk/ascl.inc b/programs/fs/sysxtree/trunk/ascl.inc similarity index 100% rename from programs/filemngrs/sysxtree/trunk/ascl.inc rename to programs/fs/sysxtree/trunk/ascl.inc diff --git a/programs/filemngrs/sysxtree/trunk/build_en.bat b/programs/fs/sysxtree/trunk/build_en.bat similarity index 100% rename from programs/filemngrs/sysxtree/trunk/build_en.bat rename to programs/fs/sysxtree/trunk/build_en.bat diff --git a/programs/filemngrs/sysxtree/trunk/build_ru.bat b/programs/fs/sysxtree/trunk/build_ru.bat similarity index 100% rename from programs/filemngrs/sysxtree/trunk/build_ru.bat rename to programs/fs/sysxtree/trunk/build_ru.bat diff --git a/programs/filemngrs/sysxtree/trunk/macros.inc b/programs/fs/sysxtree/trunk/macros.inc similarity index 100% rename from programs/filemngrs/sysxtree/trunk/macros.inc rename to programs/fs/sysxtree/trunk/macros.inc diff --git a/programs/filemngrs/sysxtree/trunk/sysxtree.asm b/programs/fs/sysxtree/trunk/sysxtree.asm similarity index 100% rename from programs/filemngrs/sysxtree/trunk/sysxtree.asm rename to programs/fs/sysxtree/trunk/sysxtree.asm diff --git a/programs/develop/archer/trunk/@RCHER.ASM b/programs/other/archer/trunk/@RCHER.ASM similarity index 100% rename from programs/develop/archer/trunk/@RCHER.ASM rename to programs/other/archer/trunk/@RCHER.ASM diff --git a/programs/develop/archer/trunk/archer.txt b/programs/other/archer/trunk/archer.txt similarity index 100% rename from programs/develop/archer/trunk/archer.txt rename to programs/other/archer/trunk/archer.txt diff --git a/programs/develop/archer/trunk/arcmacro.inc b/programs/other/archer/trunk/arcmacro.inc similarity index 100% rename from programs/develop/archer/trunk/arcmacro.inc rename to programs/other/archer/trunk/arcmacro.inc diff --git a/programs/develop/archer/trunk/build_en.bat b/programs/other/archer/trunk/build_en.bat similarity index 100% rename from programs/develop/archer/trunk/build_en.bat rename to programs/other/archer/trunk/build_en.bat diff --git a/programs/develop/archer/trunk/build_ru.bat b/programs/other/archer/trunk/build_ru.bat similarity index 100% rename from programs/develop/archer/trunk/build_ru.bat rename to programs/other/archer/trunk/build_ru.bat diff --git a/programs/develop/archer/trunk/data.inc b/programs/other/archer/trunk/data.inc similarity index 100% rename from programs/develop/archer/trunk/data.inc rename to programs/other/archer/trunk/data.inc diff --git a/programs/develop/archer/trunk/debug.inc b/programs/other/archer/trunk/debug.inc similarity index 100% rename from programs/develop/archer/trunk/debug.inc rename to programs/other/archer/trunk/debug.inc diff --git a/programs/develop/archer/trunk/deflate.inc b/programs/other/archer/trunk/deflate.inc similarity index 100% rename from programs/develop/archer/trunk/deflate.inc rename to programs/other/archer/trunk/deflate.inc diff --git a/programs/filemngrs/rdfdel/trunk/macros.inc b/programs/other/archer/trunk/macros.inc similarity index 100% rename from programs/filemngrs/rdfdel/trunk/macros.inc rename to programs/other/archer/trunk/macros.inc diff --git a/programs/develop/archer/trunk/parser.inc b/programs/other/archer/trunk/parser.inc similarity index 100% rename from programs/develop/archer/trunk/parser.inc rename to programs/other/archer/trunk/parser.inc diff --git a/programs/develop/archer/trunk/sys.inc b/programs/other/archer/trunk/sys.inc similarity index 100% rename from programs/develop/archer/trunk/sys.inc rename to programs/other/archer/trunk/sys.inc diff --git a/programs/develop/mhc/trunk/build_en.bat b/programs/other/mhc/trunk/build_en.bat similarity index 100% rename from programs/develop/mhc/trunk/build_en.bat rename to programs/other/mhc/trunk/build_en.bat diff --git a/programs/develop/mhc/trunk/build_ru.bat b/programs/other/mhc/trunk/build_ru.bat similarity index 100% rename from programs/develop/mhc/trunk/build_ru.bat rename to programs/other/mhc/trunk/build_ru.bat diff --git a/programs/develop/mhc/trunk/macros.inc b/programs/other/mhc/trunk/macros.inc similarity index 100% rename from programs/develop/mhc/trunk/macros.inc rename to programs/other/mhc/trunk/macros.inc diff --git a/programs/develop/mhc/trunk/mhc.asm b/programs/other/mhc/trunk/mhc.asm similarity index 100% rename from programs/develop/mhc/trunk/mhc.asm rename to programs/other/mhc/trunk/mhc.asm diff --git a/programs/other/tinypad2/trunk/ReadMe.txt b/programs/other/tinypad2/trunk/ReadMe.txt new file mode 100644 index 0000000000..7dd8aec40f --- /dev/null +++ b/programs/other/tinypad2/trunk/ReadMe.txt @@ -0,0 +1,203 @@ +-= [v 3.78b] =- +Версия была сделана сразу после того как я выложил пред., но я её не выкладывал, +так как надеялся ещё доработать. + +Новое: +- поиск спрятан в меню, горячая клавиша ctrl+F7, поиск далее - ctrl+F8 +- более длинная строка открытия файлов, не желательно открывать пути + >71 символа, так как могут возникнуть ошибки при работе с окном "быстрого с/з" + + +это просто дополнение к предыдущему выпуску. дальше будет исправлено: +- глюк с неактивными окнами. + +-= [v 3.78a] =- + +Вроде работает.. :) + +Новое: +- Скролл взят с "Scroll.inc",автор которого Jason Delozier. + принцип движения по документу полностью изменён (по сравнению + с прошлой версией). +- Курсор двигается кликом мышки. +- Добавлена функция Goto Line #. + (enter-goto; esc - cancel) + достаточно полезная функция, когда фасм(на доске отладки) пишет что ошибка + в такой-то строке... +- Исправлен баг с заданием имени нового файла +- Исправлен баг со строкой поиска (при "поиске" последней строки) +- Исправлен баг после вызова диалогов открытия/сохранения. + теперь скролл после них продолжает работать ;) +- Мелкие исправления в работе меню. + +Появился: + глюк, как в LC - при нажатии в области окна, даже если окно не активно, + курсов и скролл бар всё равно реагируют на мышку. + +Работаю над: +-списком последних файлов +-загрузкой "color table'a" + +так же, надо посмотреть исходники HeEd'a, а точнее функции перекодировки. + +------------------------------------------------- + +-= [v 3.77a] =- + +Ещё одна альфа. + +На этот раз: +- добавлена полоса прокутки +- исправлено окно вопроса "сохранить документ", так как я заметил + что оно жрало много процессорного времени. +- обновление экрана после диалогов сохранения и открытия + +На заметку: скролл полностью сделан мной и поэтому, возможно, есть глюки. +так как я не нашёл более хорошей формулы, скролл всегда немного не доезжает до +верха, зато никогда не пересекает нижнюю кнопку (вроде бы) + +кнопки скролла "вверх" и "вниз" эквивалентны pg.up и pg.down + +Размер скролла жестко закреплён, так как скоро будет заперщено +изменять размены окна. + + +Не получится: +Убрать ограничение в 80 символов и присобачить поддержку BGI шрифтов. +Проблема в слишком извращённом алгоритме вывода символов (по крайней +мере мне так показалось), проще будет переделать всё по новой, +взяв некоторые функции отсюда. + +В следующей версии планируется: +- функция "goto string #" +- изменение цвета текста (и спец. символов) и рабочей области. +- сохранение небольшого списка "последних редактируемых файлов" +постараюсь, но всё же ничего не обещаю.... + + +-= [v 3.76 ] =- + +Повторный ремейк тайнипада :) Клавиатура рулит. + +Что нового? + +- "Окно быстрого сохранения и загрузки" для прописывания пути + к файлу "вручную". В этом же окне горячие клавиши - + ctrl+s - сохранить, ctrl+o - открыть, esc - отмена + +- Горячие клавиши для компиляции(CTRL+F9), + компиляции и запуска (CTRL+F10), и доски отладки(F12) + +- главное окно остаётся активным после запуска доски отладки + и окна быстрого сохранения (только горячими клавишами) + +- Исправлен глюк вылетания при попытке поиска в пустом + документе + +- облагорожен писк из спикера, теперь похож на писк Колибри 3 + +- Кнопки выровнены для использования скина + +- по непонятным мне причинам файлы сохранённые в нижнем регистре + абсолютно не принимались sysxtree и нужно было их открывать + вручную прописывая путь. исправлено обычным переводом в верхний + регистр. + +- окна сообщения при переполненном диске (та же процедура, что и для erroff у + savedialog) + +- исправлен мой баг - при невозможности сохранения теперь остаётся старый путь + к файлу (и имя). + +- исправлено ещё парочка мелких недочётов (моих?!). + +Что не сделано? + + Всё ещё нет поддержки шрифтов BGI и + изменения цвета фона/текста. Хотя я сомневаюсь, что BGI шрифты прямо "необходим +ы" + в асм-блокноте. + Пока ещё не обрабатывается ошибка "fat12 заполнен" - вроде бы даже функции в яд +ре нет... + Хочу перейти на скан-коды, а то в аски повторяются коды. +-------------------------------------------- +и ещё: о ошибках и критике - мне (не "меня") на мыло или на форум. +-------------------------------------------- + +История... + +-= [ v 3.75b ] =- + +О.... +Ремейк :) Tinypad'a : +Тулбар теперь спрятан в меню. Для сохранения и открытия используются +диалоги из ASCL Павлюшина Евгения. Исправлен "жуткий" баг - когда +сохраняешь документ под другим именем, в строке заголовка оставалось +старое название. +Добавлены диалоговые окна при ошибках и выходе. Добавлена кнопка +"новый", при нажатии на которую задаётся вопрос о сохранении файла, затем +создаётся документ с новым именем. Максимально 99 новых документов. Кнопка +"новое окно" открывает новое окно Тайнипада (запускает новый процесс). + +О грустном... +Обо всех ошибках мне на мыло, попробую исправить. +Диалог "сохранить как" сохраняет только на готовые файлы (то есть поверх них, +нельзя создать новый). +При попытке поиска строки в пустом документе прога вылетает :( +При выходе, когда вылазит окошко с вопросом "сохранить файл?" - да - сохраняет + документ и закрывает окно, нет - не сохраняет и выходит, Щелчёк по рабочей обла +сти +тайнипада эквивалентен кнопке отмена, которой нету ;), правда если окно сообщени +я + переместить, главное окно не обновляется. Это вызванно "специфическим" кодом, т +ак + как более простого решения я не нашёл. + +О спасибках... +Всем спасиба! Павлюшину за ASCL, Халявину, Willow и всем с нашего форума помощь. + +О будущем... +если получится, можно будет реализовать поддержку BGI шрифтов... ещё не смотрел +их код -- страшно! + +Кто, бл%? +DoomEd Archangel +archangel@mail.kz / meos-wall.narod.ru + + + +-= [ v 3.75a ------> v 3.6 ] =- + +;****************************************************************************** +; project name: TINYPAD +; compiler: flat assmebler 1.52 alpha 3 +; version: 3.75a +; last update: 24/03/2004 +; maintained by: Ivan Poddubny +; e-mail: ivan-yar@bk.ru +;****************************************************************************** +; HISTORY: +; 3.75a +; fixed converting char to upper case in read_string +; 3.75 +; rewrote save_file from scratch; bugfix in loadfile; +; 3.74 +; optimisation +; 3.73 +; completly new load_file function +; 3.72 +; speed++ +; 3.71 +; error beep +; 3.6,3.7: +; many bugs fixed +; simple toolbar +; compile, run applications from TINYPAD, all fasm output is in debug board +; TAB button +; auto-indent +; Ctrl+L - insert comment string +;****************************************************************************** +; Memory 0x300000: +; stack 0x00eff0 - стэк +; stack for help 0x00fff0 - +; stack for help 0x00fff0 \ No newline at end of file diff --git a/programs/other/tinypad2/trunk/archive.txt b/programs/other/tinypad2/trunk/archive.txt new file mode 100644 index 0000000000..c88ca52626 --- /dev/null +++ b/programs/other/tinypad2/trunk/archive.txt @@ -0,0 +1,8 @@ +Для начинающих работать с MeOS - описание файлов в этом архиве: + +tinypad - скомпилированный исполняемый файл MeOS +tinypad.asm - исходный код +ascl.inc - assembler small code library от Павлюшина Евгения + (функция label заменена на putlabel) +dialogs1.inc - диалоговые окна, messagebox'ы и не очень хорошее меню. +macros.inc - тоже замечательный набор макросов. \ No newline at end of file diff --git a/programs/other/tinypad2/trunk/ascl.inc b/programs/other/tinypad2/trunk/ascl.inc new file mode 100644 index 0000000000..a1e2f25859 --- /dev/null +++ b/programs/other/tinypad2/trunk/ascl.inc @@ -0,0 +1,933 @@ +lang equ ru ; ru en fr ge fi + +; +; Assembler +; SMALL +; CODE +; Libary +; +; Ver 0.14 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;Please compile aplications on FASM ver1.54 or higer!!! + +;InfoList +;0.01 scank,putpix,puttxt +;0.02 label,random,colors +;0.03 window,startwd,endwd,attributes +;0.04 close,delay,scevent ~30.04.2004 +;0.05 small random, ~04.05.2004 +;0.06 wtevent ~09.05.2004 +;0.07 timeevent ~23.05.2004 +;0.08 txtput ~14.06.2004 +;0.09 opendialog,savedialog ~20.06.2004 +;0.10 wordstoreg by halyavin, add at ~30.08.2004 +; random bug deleted eax is use. +;0.11 loadfile from me +puttxt bug del ~07.09.2004 +;0.12 open/save dialog ~13.09.2004 +;0.13 dialogs bugs deleted +;0.14 drawlbut ~03.10.2004 +;0.15 extendet label! + +; LOADFILE +; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area +; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area + + +macro loadfile file_name,file_load_area,file_temp_area +{ +local open,fileinfo,string + jmp open +fileinfo: + dd 0 + dd 0 + dd 1 + dd file_load_area + dd file_temp_area +string: + db file_name,0 +open: + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + int 0x40 + mov eax,[file_load_area+2] + shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 +} + + +;*********************************************************** +macro savefile file_name,file_save_area,file_temp_area,fsize +{ +local save,fileinfo,string ;,counter00 + jmp save +;counter00 dd 0 +fileinfo: + dd 1 + dd 0 + dd fsize ;counter00 + dd file_save_area + dd file_temp_area +string: + db file_name,0 +save: +;xor edi,edi +; sub edi,file_save_area ; calculate dump size +; mov edx,edi +;mov [counter00],edi +; mov dword [fileinfo+8],1 ; how many blocks to write (1) +; mov eax,58 +; mov ebx,fileinfo +; int 0x40 +; mov eax,[file_load_area+2] +; shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков +; inc eax +; mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 +} +;*********************************************************** + + +;macro wordstoreg reg,hiword,loword +;{ +;if hiword eqtype 0 & loword eqtype 0 +; mov reg,dword hiword*65536+loword +;else if hiword eqtype 12 & loword eqtype eax +; mov reg,dword hiword*65536 +; add reg,dword loword +;else if hiword eqtype 12 & loword eqtype [123] +; mov reg,dword hiword*65536 +; add reg,dword loword +;else +; mov reg,dword hiword +; shl reg,16 +; add reg,dword loword +;end if +;} + +macro dword2reg reg,doubleword +{ +if doubleword eq + ; not changes +else + mov reg,dword doubleword +end if +} + +macro words2reg reg,hiword,lowword +{ +if hiword eq + if lowword eq + ; not changes + else + if lowword eqtype 12 + and reg,dword 0xffff0000 + add reg,dword lowword + else + and reg,dword 0xffff0000 + add reg,dword lowword + end if + end if +else + if lowword eq + if hiword eqtype 12 + and reg,dword 0x0000ffff + add reg,dword hiword*65536 + else + shl reg,16 + add reg,dword hiword + ror reg,16 + end if + else + if lowword eqtype 12 & hiword eqtype 12 + if lowword eq 0 & hiword eq 0 + xor reg,reg + else + mov reg,dword hiword*65536+lowword + end if + else + mov reg,dword hiword + shl reg,16 + add reg,dword lowword + end if + end if +end if +} + + + + +; DRAW BUTTON with label + +macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor +{ +local asd,lab + jmp asd +lab db text ;arg label +asd: + words2reg ebx,x,xs + words2reg ecx,y,ys + mov edx,id + mov esi,bcolor + mov eax,8 + int 0x40 + + mov eax,asd-lab ;calc size + mov ebx,6 + mul ebx + mov esi,eax + + mov eax,xs + sub eax,esi + shr eax,1 + add eax,x + + mov edx,ys + sub edx,7 + shr edx,1 + add edx,y + + mov ebx,eax + shl ebx,16 + add ebx,edx + + mov ecx,tcolor ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + + +macro opendialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo ; 0x10000 +;run_filepath + db '/RD/1/SYSXTREE',0 + +procinfo: +times 1024 db 0 +} + + +macro savedialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, run_filepath, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo +;run_filepath: + db '/RD/1/SYSXTREE',0 + +procinfo: +times 1024 db 0 +} + + + + +; RANDOM - generate random count (small) +; (SYNTAX) RANDOM MaxCount,OutArgument +; (SAMPLE) RANDOM 10000,eax +; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations + +randomuse = 0 + +macro random arg1,arg2 +{ +local rxproc +randomuse = randomuse + 1 + + jmp rxproc + +if defined randomuse & randomuse = 1 +randomproc: + jmp rnj +rsx1 dw 0x4321 +rsx2 dw 0x1234 +rnj: +; mov eax,arg1 + push bx + push cx + push dx + push si + push di + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop di + pop si + pop dx + pop cx + pop bx + and eax,0000ffffh +; mov arg2,0 +; mov arg2,eax + ret +end if + +rxproc: + mov eax,arg1 + call randomproc + mov arg2,eax +} + +macro scank +{ + mov eax,10 + int 0x40 +} + +macro putpix x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + int 0x40 +} + +macro puttxt x,y,offs,size,color +{ +; mov ebx,x +; shl ebx,16 +; add ebx,y + words2reg ebx,x,y + + dword2reg ecx,color + dword2reg edx,offs + dword2reg esi,size + +; mov ecx,color +; mov edx,offs +; mov esi,size + mov eax,4 + int 0x40 +} + +macro outcount data, x, y, color, numtype +{ + mov ecx,data + mov ebx,numtype + mov bl,0 +; mov edx,x*65536+y + words2reg edx,x,y + mov esi,color + mov eax,47 + int 0x40 +} + +; SCEVENT - Scan event + +macro scevent red,key,but +{ + mov eax,11 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; WTEVENT - Wait event + +macro wtevent red,key,but +{ + mov eax,10 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; TIMEEVENT - Wite for event with timeout + +macro timeevent xfps,noevent,red,key,but +{ + mov eax,23 + mov ebx,xfps + int 0x40 + cmp eax,0 + je noevent + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + + +; CLOSE - Close program + +macro close +{ + mov eax,-1 + int 0x40 +} + +; DELAY - Create delay 1/100 sec +; (SYNTAX) Delay time +; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + int 0x40 +} + +; WINDOW - Draw window +; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color +; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ +; mov ebx,arg1*65536+arg3 +; mov ecx,arg2*65536+arg4 + words2reg ebx,arg1,arg3 + words2reg ecx,arg2,arg4 + mov edx,arg5 + mov eax,0 + int 0x40 +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ +; mov ebx,arg1*65536+arg3 +; mov ecx,arg2*65536+arg4 + words2reg ebx,arg1,arg3 + words2reg ecx,arg2,arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + int 0x40 +} + + +; STARTWD - Start of window draw + +macro startwd +{ + mov eax,12 + mov ebx,1 + int 0x40 +} + +; ENDWD - End window draw + +macro endwd +{ + mov eax,12 + mov ebx,2 + int 0x40 +} + +; LABEL - Put text to frame +; (SYNTAX) LABEL Xstart,Ystart,'Text',Color +; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big + +macro putlabel arg1,arg2,arg3,arg4 +{ +local asd,lab + jmp asd +lab db arg3 ;arg label +asd: +; mov ebx,arg1 ;arg1=y arg2=x +; shl ebx,16 +; add ebx,arg2 + + words2reg ebx,arg1,arg2 + + dword2reg ecx,arg4 + + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + +;Key's +key_Up equ 178 +key_Down equ 177 +key_Right equ 179 +key_Left equ 176 +key_Esc equ 27 +key_Space equ 32 +key_Enter equ 13 +key_Bspace equ 8 +key_F1 equ 50 +key_F2 equ 51 +key_F3 equ 52 +key_F4 equ 53 +key_F5 equ 54 +key_F6 equ 55 +key_F7 equ 56 +key_F8 equ 57 +key_F9 equ 48 +key_F10 equ 49 +key_F11 equ 68 +key_F12 equ 255 +key_Home equ 180 +key_End equ 181 +key_PgUp equ 184 +key_PgDown equ 183 + +;Attributes + +;Window Attributes +window_Skinned equ 0x03000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Font Attributes +font_Big equ 0x10000000 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040ff +cl_Cyan equ 0x0040e0ff diff --git a/programs/other/tinypad2/trunk/build_en.bat b/programs/other/tinypad2/trunk/build_en.bat new file mode 100644 index 0000000000..52f91e6cfc --- /dev/null +++ b/programs/other/tinypad2/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm tinypad2.asm tinypad2 +@pause \ No newline at end of file diff --git a/programs/other/tinypad2/trunk/build_ru.bat b/programs/other/tinypad2/trunk/build_ru.bat new file mode 100644 index 0000000000..a33d1e5906 --- /dev/null +++ b/programs/other/tinypad2/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm tinypad2.asm tinypad2 +@pause \ No newline at end of file diff --git a/programs/other/tinypad2/trunk/dialogs1.inc b/programs/other/tinypad2/trunk/dialogs1.inc new file mode 100644 index 0000000000..d4e3abb482 --- /dev/null +++ b/programs/other/tinypad2/trunk/dialogs1.inc @@ -0,0 +1,597 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; DIALOGS1.INC ; +; ; +; COMPILE WITH FASM for MENUET ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +menus dd 3 ; number of menus +m_x dd 0x5 ; x start +m_y dd 20 ; y start +m_xs dd 290 ; x size +m_ys dd 14 ; y size +g_stack dd 0xf000 ; thread stack - required + + +menu:; AB C D E F G + + db '*D FILE +Save File +Load File +- +Quit ' + db '*B EDIT +Copy +Paste ' + db '*B HELP +Setup +About.. ' + db '@' ; end mark + +; A : Data type '*' -> New menu , '+' -> menu selection +; B : Number of selections in menu (A+) +; C : Menu header text +; D-G : Menu selection text + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; DATA BELOW IS FOR DIALOGS1.INC INTERNALS + +menu_action dd '----' + +window_on db 0 + +g_n dd -1 +g_x dd 0x0 +g_t dd 0x0 +g_1 dd 0x0 +g_l dd 0x0 +closet db 0 + +table: times 1024 db 0 + +last_mouse dd 0x0 + +mo_x dd 0x0 +mo_y dd 0x0 + + +check_mouse: + + pusha + + cmp [window_on],1 + je no_open + + mov eax,37 + mov ebx,2 + int 0x40 + + cmp [window_on],0 + jne openw2 + + cmp eax,0 + je no_open + + openw2: + + waitformouse: + + mov eax,23 + mov ebx,2 + int 0x40 + + cmp eax,0 + jne no_open + + mov eax,37 + mov ebx,2 + int 0x40 + + cmp eax,0 + jne waitformouse + + + mov eax,37 + mov ebx,1 + int 0x40 + + mov esi,eax + + shr eax,16 + xor edx,edx + mov ebx,50 + div ebx + mov edx,eax + cmp edx,[g_n] + je no_open + cmp edx,[menus] + jge no_open + mov eax,esi + + and eax,0xffff + + mov ebx,[m_y] + cmp eax,ebx + jbe no_open + add ebx,[m_ys] + cmp eax,ebx + jge no_open + + cmp [window_on],0 + je noww + + mov [closet],1 + mov ecx,100 + waitm: + mov eax,5 + mov ebx,1 + int 0x40 + dec ecx + jz no_open + cmp [window_on],0 + jne waitm + noww: + + mov eax,edx + jmp cll + + no_open: + + mov [last_mouse],esi + + popa + + ret + + cll: + + mov [window_on],2 + + mov [g_n],eax + mov [g_x],96 + mov [g_t],0 + mov [g_1],1 + + mov eax,9 + mov ebx,table + mov ecx,-1 + int 0x40 + + mov eax,[table+34] + mov [mo_x],eax + mov eax,[table+38] + mov [mo_y],eax + + mov eax,51 + mov ebx,1 + mov ecx,alert_entry + mov edx,[g_stack] + int 0x40 + + mov [esp+28],dword 0 ; clear button entry + + mov [menu_action],'MD ' + + check_gr: + + popa + + ret + + +draw_menu: + + mov eax,9 + mov ebx,table + mov ecx,-1 + int 0x40 + + cmp [table+46],dword 30 + jb drmr + + mov eax,13 ; white background + mov ebx,[m_x] + shl ebx,16 + add ebx,[m_xs] + inc ebx + mov ecx,[m_y] + shl ecx,16 + add ecx,[m_ys] + mov edx,0xf0f8ff + int 0x40 + + mov eax,38 ; egde lines + mov ebx,[m_x] + shl ebx,16 + add ebx,[m_x] + add ebx,[m_xs] + mov ecx,[m_y] + shl ecx,16 + add ecx,[m_y] + mov edx,0x000000 + int 0x40 + mov eax,38 + mov ecx,[m_y] + add ecx,[m_ys] + shl ecx,16 + add ecx,[m_y] + add ecx,[m_ys] + int 0x40 + + mov esi,menu-1 + mov edi,[m_x] + mov ebp,1 + new_menu: + inc esi + + cmp [esi],byte '*' + jne drmnl1 + push esi + mov eax,4 + mov ebx,edi + shl ebx,16 + add ebx,[m_y] + add ebx,0x00050004 + mov ecx,0x000000 + mov edx,esi + add edx,3 + mov esi,12 + int 0x40 ; draw text + pop esi + add esi,2 + add edi,50 + inc ebp + + drmnl1: + cmp [esi],byte '@' + jne new_menu + + drmr: + + ret + +alert_box: + + ; eax : x size - min 200 + ; ebx : pointer to ASCIIZ - max 128 character text + ; ecx : button 1 id ( OK or YES ) + ; edx : button 2 id or zero ( NO ) + + + cmp [window_on],0 + jne alert_box_return + + mov [window_on],1 + + cmp eax,100 + jg size_ok + mov eax,100 + size_ok: + + mov [g_x],eax + mov [g_t],ebx + mov [g_1],ecx + + mov ecx,0 + new_search: + cmp [ebx],byte 0 + je found_len + inc ebx + inc ecx + cmp ecx,128 + jbe new_search + found_len: + mov [g_l],ecx + + mov eax,51 + mov ebx,1 + mov ecx,alert_entry + mov edx,[g_stack] + int 0x40 + + mov [menu_action],'MA ' + + alert_box_return: + + ret + +alert_entry: + + call alert_draw_window + +alert_still: + + mov eax,23 ; wait here for event + mov ebx,1 + int 0x40 + + cmp eax,1 ; redraw request ? + je alert_red + cmp eax,2 ; key in buffer ? + je alert_key + cmp eax,3 ; button in buffer ? + je alert_button + + cmp [closet],0 + jne ccc + + mov eax,9 + mov ebx,table + mov ecx,-1 + int 0x40 + + cmp ax,[table+4] + je no_close + ccc: + mov [closet],0 + mov [g_n],-1 + mov [menu_action],'----' + mov [window_on],0 + mov eax,-1 + int 0x40 + no_close: + + jmp alert_still + + alert_red: ; redraw + call alert_draw_window + jmp alert_still + + alert_key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp alert_still + + alert_button: ; button + mov eax,17 ; get id + int 0x40 + + shr eax,8 + cmp eax,3 + jg no_action1 + dec eax + shl eax,2 + mov eax,dword [eax+rtext] + mov [menu_action],eax + jmp action_done + no_action1: + sub eax,16 + add eax,65 + shl eax,8 + mov ebx,[g_n] + add ebx,65 + add eax,ebx + mov [menu_action],eax + + action_done: + + mov [closet],0 + mov [g_n],-1 + mov [window_on],0 + mov eax,-1 ; close this program + int 0x40 + + rtext db 'NO YES OK ' + + jmp alert_still + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +alert_draw_window: + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + cmp [window_on],2 + jne no_win_type_2 + + mov edx,menu-1 + mov ecx,[g_n] + add ecx,1 + find_menu: + inc edx + cmp [edx],byte '*' + je menu_loop + jmp find_menu + menu_loop: + loop find_menu + movzx ebp,byte [edx+1] + sub ebp,64 + push edx + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,[g_n] + imul ebx,50 + add ebx,[mo_x] + add ebx,[m_x] + shl ebx,16 + add ebx,[g_x] + mov ecx,[mo_y] + add ecx,[m_y] + add ecx,[m_ys] + shl ecx,16 + mov edx,14 + imul edx,ebp + add edx,7 + add ecx,edx + mov edx,0x00ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x00ffffff ; color of grab bar RRGGBB,8->color gl + mov edi,0x000000cc ; color of frames RRGGBB + int 0x40 + + pop edx + + mov ebx,5*65536+7 ; draw info text with function 4 + mov ecx,0x10000000 + mov esi,12 + mov ebp,16 + no_d_found: + inc edx + cmp [edx],byte '*' + je d_drawed + cmp [edx],byte '@' + je d_drawed + cmp [edx],byte '+' + jne no_d_found + inc edx + pusha ; draw button + mov eax,8 + mov ecx,ebx + mov ebx,[g_x] + add ebx,0x0000fffe + shl ecx,16 + add ecx,0xfffc0000+14 + mov edx,0x40000000 + add edx,ebp + mov esi,0 + int 0x40 + popa + mov eax,4 ; draw text + int 0x40 + inc ebp + add ebx,14 + jmp no_d_found + d_drawed: + + no_win_type_2: + + + cmp [window_on],1 + jne no_win_1 + + mov eax,14 ; to middle of screen + int 0x40 + mov ecx,eax + and ecx,0xffff + shr ecx,1 + shr eax,1 + mov ebx,[g_x] + shr ebx,1 + shl ebx,16 + sub eax,ebx + mov ebx,eax + + mov eax,0 ; function 0 : define and draw window + mov bx,word [g_x] + sub ecx,80 + shl ecx,16 + mov cx,110 ; [y start] *65536 + [y size] + mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x80d05050 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00d05050 ; color of frames RRGGBB + int 0x40 + + + mov eax,4 ; label + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,alert_labelt1 + mov esi,alert_label1len-alert_labelt1 + int 0x40 + + mov eax,4 + mov ebx,10*65536+43 + mov ecx,0x10000000 + mov edx,[g_t] + mov esi,[g_l] + int 0x40 + + cmp [g_1],1 + jne gadgets_no_1 + + mov eax,8 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,30*65536+40 + mov ecx,75*65536+16 + mov edx,3 + mov esi,0x446688 + int 0x40 + + mov eax,4 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,31*65536+80 + mov ecx,0x10ffffff + mov edx,alert_t2 + mov esi,alert_t2len-alert_t2 + int 0x40 + + gadgets_no_1: + + cmp [g_1],2 + jne gadgets_no_2 + + mov eax,8 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,0*65536+40 + mov ecx,75*65536+16 + mov edx,1 + mov esi,0x446688 + int 0x40 + + mov eax,8 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,57*65536+40 + mov ecx,75*65536+16 + mov edx,2 + mov esi,0x446688 + int 0x40 + + mov eax,4 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,1*65536+80 + mov ecx,0x10ffffff + mov edx,alert_t1 + mov esi,alert_t1len-alert_t1 + int 0x40 + + gadgets_no_2: + + no_win_1: + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + + +alert_t1: + db ' No Yes' +alert_t1len: + + +alert_t2: + db ' OK' +alert_t2len: + + +alert_labelt1: + db 'ALERT' +alert_label1len: + + + + + + + + diff --git a/programs/other/tinypad2/trunk/macros.inc b/programs/other/tinypad2/trunk/macros.inc new file mode 100644 index 0000000000..58209dc4c9 --- /dev/null +++ b/programs/other/tinypad2/trunk/macros.inc @@ -0,0 +1,266 @@ +; new application structure +macro meos_app_start + { + use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd __start + dd __end + dd __memory + dd __stack + + if used __params & ~defined __params + dd __params + else + dd 0x0 + end if + + dd 0x0 + } +MEOS_APP_START fix meos_app_start + +macro code + { + __start: + } +CODE fix code + +macro data + { + __data: + } +DATA fix data + +macro udata + { + if used __params & ~defined __params + __params: + db 0 + __end: + rb 255 + else + __end: + end if + __udata: + } +UDATA fix udata + +macro meos_app_end + { + align 32 + rb 2048 + __stack: + __memory: + } +MEOS_APP_END fix meos_app_end + + +; macro for defining multiline text data +struc mstr [sstring] + { + forward + local ssize + virtual at 0 + db sstring + ssize = $ + end virtual + dd ssize + db sstring + common + dd -1 + } + + +; strings +macro sz name,[data] { ; from MFAR [mike.dld] + common + if used name + label name + end if + forward + if used name + db data + end if + common + if used name + .size = $-name + end if +} + +macro lsz name,[lng,data] { ; from MFAR [mike.dld] + common + if used name + label name + end if + forward + if (used name)&(lang eq lng) + db data + end if + common + if used name + .size = $-name + end if +} + + + +; easy system call macro +macro mpack dest, hsrc, lsrc +{ + if (hsrc eqtype 0) & (lsrc eqtype 0) + mov dest, (hsrc) shl 16 + lsrc + else + if (hsrc eqtype 0) & (~lsrc eqtype 0) + mov dest, (hsrc) shl 16 + add dest, lsrc + else + mov dest, hsrc + shl dest, 16 + add dest, lsrc + end if + end if +} + +macro __mov reg,a { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + +; language for programs +lang fix ru ; ru en fr ge fi + + + +; optimize the code for size +__regs fix + +macro add arg1,arg2 + { + if (arg2 eqtype 0) + if (arg2) = 1 + inc arg1 + else + add arg1,arg2 + end if + else + add arg1,arg2 + end if + } + +macro sub arg1,arg2 + { + if (arg2 eqtype 0) + if (arg2) = 1 + dec arg1 + else + sub arg1,arg2 + end if + else + sub arg1,arg2 + end if + } + +macro mov arg1,arg2 + { + if (arg1 in __regs) & (arg2 eqtype 0) + if (arg2) = 0 + xor arg1,arg1 + else if (arg2) = 1 + xor arg1,arg1 + inc arg1 + else if (arg2) = -1 + or arg1,-1 + else if (arg2) > -128 & (arg2) < 128 + push arg2 + pop arg1 + else + mov arg1,arg2 + end if + else + mov arg1,arg2 + end if + } + + +macro struct name + { + virtual at 0 + name name + sizeof.#name = $ - name + end virtual + } + +; structures used in MeOS +struc process_information + { + .cpu_usage dd ? ; +0 + .window_stack_position dw ? ; +4 + .window_stack_value dw ? ; +6 + .not_used1 dw ? ; +8 + .process_name rb 12 ; +10 + .memory_start dd ? ; +22 + .used_memory dd ? ; +26 + .PID dd ? ; +30 + .x_start dd ? ; +34 + .y_start dd ? ; +38 + .x_size dd ? ; +42 + .y_size dd ? ; +46 + .slot_state dw ? ; +50 + rb (1024-52) + } +struct process_information + +struc system_colors + { + .frame dd ? + .grab dd ? + .grab_button dd ? + .grab_button_text dd ? + .grab_text dd ? + .work dd ? + .work_button dd ? + .work_button_text dd ? + .work_text dd ? + .work_graph dd ? + } +struct system_colors + + +; constants + +; events +EV_IDLE = 0 +EV_TIMER = 0 +EV_REDRAW = 1 +EV_KEY = 2 +EV_BUTTON = 3 +EV_EXIT = 4 +EV_BACKGROUND = 5 +EV_MOUSE = 6 +EV_IPC = 7 +EV_STACK = 8 + +; event mask bits for function 40 +EVM_REDRAW = 1b +EVM_KEY = 10b +EVM_BUTTON = 100b +EVM_EXIT = 1000b +EVM_BACKGROUND = 10000b +EVM_MOUSE = 100000b +EVM_IPC = 1000000b +EVM_STACK = 10000000b \ No newline at end of file diff --git a/programs/other/tinypad2/trunk/scroll.inc b/programs/other/tinypad2/trunk/scroll.inc new file mode 100644 index 0000000000..addaf67228 --- /dev/null +++ b/programs/other/tinypad2/trunk/scroll.inc @@ -0,0 +1,440 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ; +;; Scroll.inc ; +;; ; +;; Vertical Scroll Bar Example for MenuetOS ; +;; ; +;; Version 0.2 27 February 2005 ; +;; ; +;; ; +;; GNU GENERAL PUBLIC LICENSE ; +;; Version 2, June 1991 ; +;; ; +;; Copyright 2005 Jason Delozier, ; +;; cordata51@hotmail.com ; +;; ; +;; See file COPYING for details ; +;; ; +;; Updates: ; +;; - FPU not longer used for calculations -Feb 27, 2005 ; +;; ; +;; ; +;; TODO: ; +;; - Create Message Handler and only allow runtime arguments ; +;; to be processed through the message handler ; +;; - Remove all local varibles and only allow working varible to ; +;; reside in scroll bar structure. ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + + + +;***************************************************************************** +;* +;* VScroll Structure Equates +;* +;***************************************************************************** + +VScroll_width equ 0 +VScroll_x equ 2 +VScroll_height equ 4 +VScroll_y equ 6 +VScroll_min equ 8 +VScroll_max equ 12 +VScroll_current equ 16 +VScroll_s_change equ 20 +VScroll_b_change equ 24 + +;Example VScroll Structure +;VScroll_1: +; dw 16 ;width +0 +; dw 100 ;x +2 +; dw 200 ;height +4 +; dw 40 ;y +6 +; dd 0 ;min +8 +; dd 1000;max +12 +; dd 1 ;current +16 +; dd 1 ;small change +20 +; dd 10 ;big change +24 + +VScroll_Min_Height dw 16 ;scroll box +Vscroll_Fixed_Height dw 16 ;height of scroll buttons (up and down) + +;************************************** +;* +;* Mouse Over VScroll +;* +;************************************** +vsm1 dd 0 +vstoff dd 0 + +VScroll_mouse_over: + cmp [mouseb], 1 + je VScroll_Mouse_Has_Mouse + cmp [mouseb], 0 + jne VScroll_mouse_over_done2 + mov [vsm1], 0 + jmp VScroll_mouse_over_done2 +VScroll_Mouse_Has_Mouse: + push ecx + mov ecx, [vsm1] + shl ecx,2 + call dword [VScroll_Mouse_Jumptable+ecx] +VScroll_mouse_over_done: + pop ecx +VScroll_mouse_over_done2: + ret + +VScroll_Mouse_Jumptable: + dd VScroll_Mouse_Find + dd VScroll_Mouse_On_Up + dd VScroll_Mouse_On_Down + dd VScroll_Mouse_Above_Thumb + dd VScroll_Mouse_Below_Thumb + dd VScroll_Mouse_On_Thumb + +VScroll_Mouse_Find: + inc ecx + call dword [VScroll_Mouse_Jumptable+ecx*4] + cmp [vsm1], 0 + jne VScroll_mouse_over_done2 + cmp ecx, 5 + je VScroll_mouse_over_done2 + jmp VScroll_Mouse_Find + + +;************************************** +;Is Mouse at Up button +VScroll_Mouse_On_Up: + push eax + movzx eax, word [ebp+VScroll_y] + add ax, word [Vscroll_Fixed_Height] + cmp [mousey], ax + pop eax + ja VScroll_Mouse_On_Up2 + mov [vsm1], 1 + call VScroll_Small_Up +VScroll_Mouse_On_Up2: + ret + +;************************************** +;Is Mouse at Down button +VScroll_Mouse_On_Down: + push eax + movzx eax,word [ebp+VScroll_y] + add ax, word [ebp+VScroll_height] + sub ax, word [Vscroll_Fixed_Height] + cmp [mousey], ax + pop eax + jb VScroll_Mouse_On_Down2 + mov [vsm1], 2 + call VScroll_Small_Down +VScroll_Mouse_On_Down2: + ret + +;************************************** +;Is Mouse above Scroll Thumb +VScroll_Mouse_Above_Thumb: + push eax + push ecx + push edx + call Vscroll_SBox_Area + add cx, word [ebp+VScroll_y] + add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button + cmp cx, [mousey] + pop edx + pop ecx + pop eax + jb VScroll_Mouse_Above_Thumb2 + mov [vsm1], 3 + call VScroll_Big_Up +VScroll_Mouse_Above_Thumb2: + ret + +;************************************** +;Is Mouse below scroll thumb +VScroll_Mouse_Below_Thumb: + push eax + push ecx + push edx + call Vscroll_SBox_Area + add cx, word [ebp+VScroll_y] + add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button + add cx, ax + cmp cx, [mousey] + pop edx + pop ecx + pop eax + ja VScroll_Mouse_Below_Thumb2 + mov [vsm1], 4 + call VScroll_Big_Down +VScroll_Mouse_Below_Thumb2: + ret + +;************************************** +;Mouse is on Scroll Thumb +VScroll_Mouse_On_Thumb: + + pusha + cmp [vsm1], 5 ;first time moving since we clicked? + je VScroll_Mouse_On_Thumb1 ;if not jump.. we already have offset + mov [vsm1], 5 ;determine offset between mouse pointer and top of thumb + call Vscroll_SBox_Area ;get top of thumb coordinate + add cx, word [ebp+VScroll_y] ;make screen coordinate + add cx, word [Vscroll_Fixed_Height] ;plus height of scroll button and top + movzx esi,word [mousey] ;get mouse position + sub esi, ecx ;make offset between top of thumb + mov [vstoff], esi ;and mouse pointer then save it +VScroll_Mouse_On_Thumb1: ; + movzx esi, [mousey] ;get mouse y value + sub si, word [ebp+VScroll_y] ;get y starting value of scroll bar + sub si, [Vscroll_Fixed_Height] + sub esi, [vstoff] ; + call Vscroll_SBox_Area ; +VScroll_Mouse_On_Thumb2: ; + cmp [ebp+VScroll_current], edx ;only redraw if change occured + je VScroll_Mouse_On_Thumb3 ; + mov [ebp+VScroll_current], edx ;new current value + call drawvscrolla ;redraw scroll background and thumb +VScroll_Mouse_On_Thumb3: ; + popa ; + ret +;************************************** + + + + +;***************************************************************************** +;* +;* Vscroll_SBox_Area +;* +;* Purpose: To determine the area of the Scroll Bar Thumb and the current +;* value of scroll based on top pixel of thumb. +;* +;* Inputs: +;* EBP - Structure of scroll bar +;* ESI - Top of Thumb - optional +;* +;* Outputs: +;* EAX - Thumb Height +;* ECX - Top of thumb +;* EDX - Current Value based on top pixel of thumb. Valid when ESI +;* is given as input. +;* +;* This procedure is divided up into 5 specific functions. +;* 1. ((Vmax-VMin)/Small Change)= Total Changes +;* 2. Height - (2* Fixed Button Height) = Total Pixels +;* 3. Total Pixels - Total Changes = Thumb Height (must be >= 16) +;* Minimum Height of 16 is varible [VScroll_Min_Height] +;* 4. (((Tot Pixels - Thumb Height)* Current)/Max-min)=Top Pixel of Thumb +;* 5. ((Mouse Top * (max-Min))/(Total Pix - Thumb Height)) = Current +;* Step 5 is only valid if ESI is supplied as an input. +;* +;* +;***************************************************************************** + +Vscroll_SBox_Area: + push ebx + push esi + push edi + ;Step 1. Determine Total Changes + mov eax, dword [ebp+VScroll_max] ;get max scroll + sub eax, dword [ebp+VScroll_min] ;sub minmum scroll for total scro + xor edx,edx + push eax + div dword [ebp+VScroll_s_change] ; + ;eax = total changes ((max-min)/Small Change) + + ;Step 2. Determine Total Pixels + movzx ecx, word [ebp+VScroll_height] ;height of entire scroll bar + mov bx, word [Vscroll_Fixed_Height] ;minus height of both scroll button + shl bx, 1 + sub cx, bx + push ecx + ;ecx = total pixels (Total Height - (2*Fixed Button Height) + + ;Step 3. Determine Thumb Height + cmp ecx, eax + jbe vs1 + sub ecx, eax + cmp cx, word [VScroll_Min_Height] + jb vs1 + jmp vs2 +vs1: + movzx ecx, word [VScroll_Min_Height] +vs2: + ;ecx = Thumb Height (Total Pixels - Total Changes) >=16 + + ;Step 4. Determine Top Pixel of Thumb + pop edi ;Total Pixels + sub edi, ecx ; + ;edi = Total Pixels - thumb Height + mov eax, edi ; + mul dword [ebp+VScroll_current] ;get current scroll value + pop ebx ;max scroll + push ecx ; + div ebx ; + mov ecx, eax ; + ;ecx = top pixel of thumb + + ;Step 5. Determine Current Value based on Mouse Position + cmp si,0 + jge vss4 + mov eax, dword [ebp+VScroll_min] + jmp vsdone1 +vss4: + cmp esi, edi + jbe vss3 + mov eax, dword [ebp+VScroll_max] + jmp vsdone1 +vss3: + mov eax,ebx ;max scroll + mul esi ;Top Pixel of mouse + div edi ;Total Pixels - Thumb Height + ;eax = Current Value + +vsdone1: + mov edx, eax ;Current Value + pop eax ;Thumb Height + pop edi + pop esi + pop ebx +ret + +;***************************************************************************** +;* +;***************************************************************************** +;ebp is structure +drawvscroll: +pusha + ;up button + mov eax, 13 ;button system function + mov edx,0x00777777 ;0x6677cc ;color + mov ebx, [ebp+VScroll_width] ;x-start/width + mov cx, word [ebp+VScroll_y] ;get bottom of scroll bar + shl ecx, 16 + mov cx, [Vscroll_Fixed_Height] ;fixed height + int 0x40 + + ;down button + mov ebx, [ebp+VScroll_width] ;x-start/width + mov cx, word [ebp+VScroll_y] ;get bottom of scroll bar + add cx, word [ebp+VScroll_height] ; + sub cx, [Vscroll_Fixed_Height] ;y-start is 12 pixel from bottom + shl ecx, 16 ; + mov cx, [Vscroll_Fixed_Height] ;fixed height + int 0x40 +;------- 'ASCL.INC' needs to be included to use this -- + putlabel 493,46,'',cl_Black + putlabel 493,372,'',cl_Black +;------------------------------------------------------ + +popa +drawvscrolla: +pusha + + mov eax, 13 ;Draw Scroll Box Background + mov edx, 0x00999999;0 ;color + push edx + movzx edx, word [Vscroll_Fixed_Height] + mov ebx, [ebp+VScroll_width] ;x-start/width + movzx ecx,word [ebp+VScroll_y] ;y-start + add ecx, edx ;add fixed height button + shl ecx, 16 ;do height next + mov cx,word [ebp+VScroll_height] ;y-start + sub cx, dx ;subtract fixed height of up button + sub cx, dx ;subtract fixed height of down button + pop edx + int 0x40 ;tell system to draw it + +;determine height of scroll box (thumb) + + call Vscroll_SBox_Area + add cx, [ebp+VScroll_y] + add cx, 16 + shl ecx, 16 + mov cx, ax + + mov eax, 13 ;draw scroll box + mov ebx, [ebp+VScroll_width] ;x-start/width + mov edx, 0x00bbbbbb ;0x999999 + int 0x40 +;call Draw_Scroll_info +popa +ret +;***************************************************************************** + +;***************************************************************************** +;* VScroll_Big_Up +;* VScroll_Small_Up +;***************************************************************************** +;need to update for signed values +VScroll_Big_Up: + push eax + push ebx + mov eax, dword [ebp+VScroll_b_change] + jmp VScroll_Up +VScroll_Small_Up: + push eax + push ebx + mov eax, dword [ebp+VScroll_s_change] +VScroll_Up: + mov ebx, dword [ebp+VScroll_min] ;get minimum value + cmp [ebp+VScroll_current], ebx ;are we at minimum already? + je VScroll_Up_exit ;if so leave + sub [ebp+VScroll_current], eax ; + jnc VScroll_Up_done + mov [ebp+VScroll_current], ebx +VScroll_Up_done: + cmp [ebp+VScroll_current], ebx ;if current is greater then max + jae VScroll_Up_done2 + mov [ebp+VScroll_current], ebx +VScroll_Up_done2: +;redraw + call drawvscroll ;temp? +VScroll_Up_exit: + pop ebx + pop eax + +ret +;***************************************************************************** + + +;***************************************************************************** +;* VScroll_Big_Down +;* VScroll_Small_Down +;***************************************************************************** +;need to update for signed values +VScroll_Big_Down: + push eax + push ebx + mov eax, dword [ebp+VScroll_b_change];get big change value + jmp VScroll_Down +VScroll_Small_Down: + push eax + push ebx + mov eax, dword [ebp+VScroll_s_change];get small change value +VScroll_Down: + mov ebx, dword [ebp+VScroll_max] ;get maximum scroll value + cmp [ebp+VScroll_current], ebx ;are we at max already? + je VScroll_Down_exit ;if so leave + add [ebp+VScroll_current], eax ;add change to current + jno VScroll_Down_done ;dont go beyond bounds of register + mov [ebp+VScroll_current], ebx ;if we did then we at max +VScroll_Down_done: ; + cmp [ebp+VScroll_current], ebx ;if current is greater then max + jbe VScroll_Down_done2 ; + mov [ebp+VScroll_current], ebx ;then we at max +VScroll_Down_done2: ; +;redraw + call drawvscroll ;temp? +VScroll_Down_exit: + pop ebx + pop eax +ret +;***************************************************************************** + + + + diff --git a/programs/other/tinypad2/trunk/tinypad2.asm b/programs/other/tinypad2/trunk/tinypad2.asm new file mode 100644 index 0000000000..3d31bbe6b7 --- /dev/null +++ b/programs/other/tinypad2/trunk/tinypad2.asm @@ -0,0 +1,4001 @@ +; SYSTEM HAEDER: + use32 + org 0x0 + db 'MENUET01' ; identifier + dd 0x01 ; version + dd START ; pointer to start + dd TINYPAD_END ; size of file + dd 0x300f00 ;0x500000; 0x3fff00;0x300000 ; size of memory + dd 0xeff0 ;0x4fffff ;0x3ff000;0xeff0 ; esp + dd I_PARAM ; parameters + dd 0 ; reserved +include 'lang.inc' +include 'ascl.inc' +include 'macros.inc' ; useful stuff +include 'dialogs1.inc' +include 'scroll.inc' +;include 'debug.inc' +purge mov ;  SPEED +;****************************************************************************** +; INITIALIZING +START: +;debug_print_hex TINYPAD_END +call mask_events + + cmp [I_PARAM],byte 0 + jz noparams + + ; parameters are at I_PARAM + mov esi,I_PARAM + mov edi,filename + mov ecx,50 + cld + rep movsb + + mov edi,filename + mov ecx,50 + xor eax,eax + repne scasb + sub edi,filename + dec edi + mov [filename_len],edi + jmp do_load_file + noparams: + jmp newfile +;****************************************************************************** +; MAIN LOOP +still: + call writepos ; write current position & number of strings + call mouse_info + + mov eax,10 ; wait here until event + int 0x40 + + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + cmp eax,6 + je mouse + jmp still +;****************************************************************************** +; ********************************* +; * MOUSE * +; ********************************* +mouse: +mov eax,37 ;mouse click +mov ebx,2 +int 0x40 +cmp eax,0 +je .leave_now +;if exit window is on +cmp [exit_wnd_on],1 +jne @f +mov [exit_wnd_on],0 +jmp red +;else +@@: +cmp eax,1 ;mouse 1 +jne .leave_now + +mov eax,37 ;mouse position +mov ebx,1 +int 0x40 + +mov word[mouse_y],ax +shr eax,16 +mov word[mouse_x],ax + + +cmp [mouse_x],7 +jb .leave_now ;.leave_now ;if < +cmp [mouse_x],485;487 +ja .leave_now ;.leave_now ;if > + +cmp [mouse_y],45 +jb .leave_now ;.leave_now ;if < +cmp [mouse_y],342 ;345 +ja .leave_now ;.leave_now ;if > + +call main_cursor_move + +.leave_now: +jmp still + +; ********************************* +; * BUTTON HANDLER * +; ********************************* + + button: + + mov eax,17 + int 0x40 +;;;;;;;;;;;;;;;exit dialog box check;;;;;;;;;;;;; +cmp ah,49 +je save_and_exit +cmp ah,48 +je exit_now +cmp ah,47 +mov [exit_wnd_on],0 +je red +cmp ah,46 +jne @f + + call save_file + jmp newfile +@@: +cmp ah,45 +je newfile +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;MENU CHECK;;;;;;;;;;;;;;;;;;;;;;; +cmp ah,15 +jne no_d_w +call draw_window_for_dialogs +jmp still +no_d_w: +cmp ah,97 +je draw_win_menu_file +cmp ah,98 +je draw_win_menu_code +cmp ah,96 +je draw_win_menu_text +cmp ah,95 +je goto_string +cmp ah,92 +je search_window +cmp ah,94 +je red +cmp ah,99 + je help_wnd +cmp ah,100 + je new_pad_wnd +cmp ah,101 + je doyouwannasave +cmp ah,102 + jne nosavenow + for_key_save: + savedialog draw_window_for_dialogs,copy_fpath_s,saveerror,mypath +nosavenow: +cmp ah,103 + jne noopennow + for_key_open: + opendialog draw_window_for_dialogs,copy_fpath,openerror,mypath +noopennow: +cmp ah,104 +je exit +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + shr eax,8 + + cmp al,50 + jne no_search + +; SEARCH { + search: + + cmp [lines],1 ;something like bug fix + je red ;still + + xor esi,esi + mov edi,[post] + add edi,80 + imul ecx,[lines],80 + sub ecx,edi ; ecx (loop counter) = lines*80-(post+80) + news: + push edi + news2: + + ; 1) LOAD BYTES + mov al,[esi+search_string] + mov bl,[edi+0x80000] + + ; 2) COMPARE BYTES + cmp al,bl + je yes_char + + ; 3) LETTER? + cmp al,'A' + jb notequal + cmp al,'z' + ja notequal + + ; 4) A->a OR a->A + cmp al,'a' + jb @f + add al,-32 + jmp compare_bytes + @@: + cmp al,'Z' + ja notequal + add al,32 + + compare_bytes: + cmp al,bl + jne notequal + + yes_char: + inc edi + inc esi + cmp esi,[search_len] + jge sfound + jmp news2 + + notequal: + pop edi + xor esi,esi + inc edi + loop news + call string_not_found + jmp still + + sfound: + mov eax,edi + cdq ; edx = 0; + mov ebx,80 + div ebx +;;;;; imul eax,80 +; lea eax,[eax+eax*4] ; eax *= 5; +; shl eax,4 ; eax *= 16; + +; mov [post],eax + mov [posy],0 +;--------------- +; mov ebx,80 +; div ebx + call goto_pos + call draw_vertical_scroll + jmp still +; SEARCH } + + no_search: + +; TOOLBAR { + cmp eax,10000 + jb no_toolbar + + add eax,-10000 + jne @f +lbl_compile_file: + mov [run_outfile],0 + call start_fasm + jmp still + @@: + dec eax + jnz @f +lbl_run_outfile: + mov [run_outfile],1 + call start_fasm + jmp still + @@: + dec eax + jnz @f + call open_debug_board + jmp still + @@: + dec eax + jnz still + call open_sysfuncs_txt + jmp still +; TOOLBAR } + + no_toolbar: + + cmp al,4 + jne noid4 + +; LOAD_FILE { + do_load_file: + mov [modified],0 + + call empty_work_space + + + cmp [filename],'/' + jne @f + + call loadhdfile + jmp .restorecursor + @@: + call loadfile1 + .restorecursor: + mov edi,0x78000 + mov ecx,80*80/4 + mov eax,0x01010101 + cld + rep stosd + xor eax,eax + mov [post],eax + mov [posx],eax + mov [posy],eax + +; enable color syntax for ASM and INC files: + mov [asm_mode], 0 + + mov eax, [filename_len] + add eax, filename + cmp word [eax-3],'AS' + jne @f + cmp byte [eax-1],'M' + jne @f + mov [asm_mode], 1 + jmp .nocol + @@: + cmp word [eax-3],'IN' + jne @f + cmp byte [eax-1],'C' + jne @f + mov [asm_mode], 1 + @@: + .nocol: + +; if the header is the same as the previous, +; just redraw the text area +; else redraw the window + +;------pos00=filename_len + mov eax,[filename_len] + mov [pos00],eax +;------------------------- + mov ecx, [filename_len] + add ecx, 10 ; strlen(" - TINYPAD"); + cmp ecx, [headlen] + jne @f + add ecx, -10 + mov esi, filename ; strcmp(filename,header); + mov edi, header + rep cmpsb + jne @f + call drawfile + call draw_window_for_dialogs ;redraw, because it's needed + cmp [to_return],0 + je still + ret + ;jmp still + @@: +call set_title +cmp [to_return],0 +je still +ret +; jmp still +; LOAD_FILE } + + noid4: + + cmp al, 2 + jz yessave + + dec al ; close if butid == 0 + jnz nosave +; EXIT: +exit: +cmp [modified],0 +je exit_now + + mov eax,55 ; beep + mov ebx,eax + mov esi,save_beep1 + int 0x40 + delay 4 + mov eax,55 ; beep + mov ebx,eax + mov esi,save_beep2 + int 0x40 + + ;---------"EXIT" dialog box + + mov eax,13 + mov ebx,150*65536+200 + mov ecx,100*65536+70 + mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 + int 0x40 + + +mov eax,38 +mov ebx,150*65536+350 +mov ecx,100*65536+100 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,150*65536+350 +mov ecx,170*65536+170 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,150*65536+150 +mov ecx,100*65536+170 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,350*65536+350 +mov ecx,100*65536+170 +mov edx,cl_White +int 0x40 + + + + putlabel 190,120,'Сохранить документ?',cl_White + + drawlbut 170,140,30,15,'Да',49,[sc.work_button],cl_White + drawlbut 230,140,30,15,'Нет',48,[sc.work_button],cl_White + drawlbut 290,140,45,15,'Отмена',47,[sc.work_button],cl_White + + mov [exit_wnd_on],1 +;---------------- + +jmp still + + exit_now: + mov [MainWndClosed], 1 + or eax, -1 + int 0x40 + + save_and_exit: + call save_file + jmp exit_now +; mov [MainWndClosed], 1 +; or eax, -1 +; int 0x40 + +; SAVE_FILE { + yessave: + call clear_screen + call drawwindow + call save_file +; call clear_screen +; call drawwindow + mov [modified],0 + + jmp still +; SAVE_FILE } + + nosave: + + inc al + call read_string + + jmp still + +;********************************** +;* REDRAW HANDLER * +;********************************** + +red: +; перерисовка окна + call clear_screen + call drawwindow + jmp still + + + +;********************************** +;* KEY HANDLER * +;********************************** + + key: + mov eax, 2 ; GET KEY + int 0x40 + + cmp [exit_wnd_on],1 ;exit window is ON? + jne no_exit_wnd ; no - goto other checks + +; cmp eax,13 ;enter - save n exit +; je save_and_exit + +; cmp eax,173 ;ctrl+enter - exit +; je exit_now + mov [exit_wnd_on],0 ;other keys - cancel +; call draw_window_for_dialogs + + jmp red ;redraw and still + + + no_exit_wnd: + shr eax, 8 + +; HELP_TEXT { + cmp al, 210 ; Ctrl + F1 + jne no_help_text +help_wnd: +call clear_screen +call drawwindow + mov eax, 51 + mov ebx, 1 + mov ecx, help_thread_start + mov edx, 0xfff0 + int 0x40 + jmp still + +help_thread_start: + call draw_help_wnd + + still_hw: + cmp [MainWndClosed], 1 + je exit_hw + mov eax, 10 + int 0x40 + cmp eax, 1 + je red_hw + cmp eax, 2 + je key_hw + cmp eax, 3 + je button_hw + jmp still_hw + + red_hw: + call draw_help_wnd + jmp still_hw + + key_hw: +; mov eax, 2 + int 0x40 + cmp ah, 27 + jne still_hw + + button_hw: + mov eax, 17 + int 0x40 + exit_hw: + or eax, -1 + int 0x40 + +; draw help window + draw_help_wnd: + mov eax, 12 + mov ebx, 1 + int 0x40 + + xor eax, eax + mov ebx, 200 shl 16 + 320 + mov ecx, 200 shl 16 + 260 + mov edx, 0x03e0e0e0 ; work + mov esi, [sc.grab] + or esi, 0x80000000 ; grab + mov edi, [sc.frame] ; frame + int 0x40 + + mov eax, 4 + mov ebx, 8 shl 16 + 8 + mov ecx, 0xffffff + mov edx, help_wnd_header + mov esi, hlphead_len + int 0x40 + + mov eax, 4 + mov ebx, 8 shl 16 + 34 + xor ecx, ecx + mov esi, 51 + mov edx, help_text + .new_help_line: + int 0x40 + add ebx, 10 + add edx, esi + cmp [edx], byte 'x' + jne .new_help_line + + mov eax, 12 + mov ebx, 2 + int 0x40 + ret +; HELP_TEXT } + + no_help_text: +; LOAD_FILE { + cmp al, 211 ; Ctrl + F2 + je for_key_open ;do_load_file +; LOAD_FILE } + +; SEARCH { + cmp al, 212 ; Ctrl + F3 + je search +; SEARCH } + +; SAVE_FILE { + cmp al, 213 ; Ctrl + F4 + je yessave +; SAVE_FILE } + +; ENTER_FILENAME { + cmp al, 214 ; Ctrl + F5 + jne @f +jmp for_key_save + @@: +; ENTER_FILENAME } + +; ENTER_SEARCH { + cmp al, 215 ; Ctrl + F6 + jne @f +; mov al, 51 +; call read_string +; jmp still + jmp search_window + @@: +; ENTER_SEARCH } + +; CHANGE_LAYOUT { + cmp al, 217 ; Ctrl + F8 + jne @f + call layout + jmp still + @@: +; CHANGE_LAYOUT } + +; COMPILE_FILE { + cmp al, 208 + je lbl_compile_file +; COMPILE_FILE } + +; RUN_OUTFILE { + cmp al, 209 + je lbl_run_outfile + +; RUN_OUTFILE } + +;run debug board { ----- + cmp al,255 + jne @f + call open_debug_board + call activate_me + jmp still +;} + @@: +;open sysfuncR { ----- +; cmp al,228 +; jne @f +; call open_sysfuncs_txt +; jmp still +; @@: + +;fast_save_and_open { + cmp al,216 + jne @f + call make_fast_so + jmp still +;} + @@: +; 3 times english -> русский +; 2 times русский -> english + +; COPY START { + cmp al, 19 + jne no_copy_start + mov eax, [post] + imul ebx, [posy], 80 + add eax, ebx + mov [copy_start], eax + jmp still +; COPY START } + + no_copy_start: +; COPY END { + cmp al, 5 + jne no_copy_end + cmp [copy_start], 0 + je still + mov ecx, [post] + imul ebx, [posy], 80 + add ecx, ebx + add ecx, 80 + cmp ecx, [copy_count] + jb still + sub ecx, [copy_start] + mov [copy_count], ecx + mov esi, [copy_start] + add esi, 0x80000 + mov edi, 0x2f0000 + cld + rep movsb + jmp still +; COPY END } + + no_copy_end: + +; PASTE { + cmp al, 16 + jne no_copy_paste + cmp [copy_count], 0 + je still + mov eax,[copy_count] + cdq + mov ebx, 80 + div ebx + add [lines], eax + mov ecx, 0x2e0000 + mov eax, [post] + imul ebx, [posy], 80 + add eax, ebx + add eax, 0x80000 + sub ecx, eax + mov esi, 0x2e0000 + sub esi, [copy_count] + mov edi, 0x2e0000 + std + rep movsb + mov esi, 0x2f0000 + mov edi, [post] + imul eax, [posy], 80 + add edi, eax + add edi, 0x80000 + mov ecx, [copy_count] + cld + rep movsb + + call clear_screen + call drawfile +call draw_vertical_scroll + mov [modified],1 + + jmp still +; PASTE } + + + no_copy_paste: + + +; INSERT_SEPARATOR { + cmp al,0xc ; Ctrl+L + jne no_insert_separator + + imul eax,[posy],80 + add eax,[post] + add eax,0x80000 + mov ebx,eax + + imul eax,[lines],80 + add eax,0x80000 ; теперь указывает на конец файла + + mov ecx,eax ; size + sub ecx,ebx + inc ecx + + mov esi,eax ; from + mov edi,eax + add edi,80 ; to + + std + rep movsb + + mov ecx,80/4 + mov esi,comment_string + mov edi,ebx + cld + rep movsd + + inc [lines] + + call clear_screen + call drawfile +;call calc_scroll_size_and_pos +call draw_vertical_scroll + mov [modified],1 + + jmp still +; INSERT_SEPARATOR } + + + no_insert_separator: + + +; DEL_LINE { + cmp al,4 + jne no_delete_line + mov eax,[post] + cdq + mov ebx,80 + div ebx + add eax,[posy] + inc eax + cmp eax,[lines] + jge still + dec dword [lines] + imul edi,[posy],80 + add edi,[post] + add edi,0x80000 + mov esi,edi + add esi,80 + mov ecx,0x2e0000 + sub ecx,esi + shr ecx,4 + cld + rep movsd + call clear_screen + call drawfile +;call calc_scroll_size_and_pos +call draw_vertical_scroll + mov [modified],1 + + jmp still +; DEL_LINE } + + no_delete_line: + +; ENTER { + cmp al,13 + jnz noenter + + ; lines down + mov eax,[posy] + inc eax +; imul eax,80 + lea eax,[eax+eax*4] ; eax *= 5 + shl eax,4 ; eax *= 16 + add eax,0x80000 + add eax,[post] + mov ebx,eax + + ; ebx = ([posy]+1)*80 + 0x80000 + [post] + ; ebx -> first byte of next string + + imul eax,[lines],80 + add eax,0x80000 + mov ecx,eax + + ; ecx = [lines]*80 + 0x80000 + ; ecx -> end of the document + + cmp ebx,ecx + jz .bug_fixed + + @@: + dec ecx + mov dl,[ecx] + mov [ecx+80],dl + + cmp ecx,ebx + jnz @b + + .bug_fixed: + + ; save for later + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + mov ebx,eax + add eax,[posx] + ; eax = 0x80000 + [post] + [posy]*80 + [posx] + + push eax + + dec ebx + xor ecx,ecx + @@: + cmp ecx,80 + je @f + inc ecx + inc ebx + cmp byte [ebx],' ' + je @b + @@: + dec ecx + + cmp ecx,80-1 + jne @f +; mov [posx],0 + jmp .lbl + @@: + + cmp [posx],ecx + jbe @f + mov [posx],ecx + jmp .lbl + @@: + mov [posx],0 + + .lbl: + inc [posy] + + ;clear line + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + + mov edi,eax + mov eax,' ' + mov ecx,80/4 + cld + rep stosd + + + ; end of line to next line beginning + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] +; add eax,[posx] + mov ebx,eax + ; ebx -> beginning of this line + + pop esi + mov edi,eax + + @@: + mov al,[esi] + mov [ebx],al + mov [esi],byte ' ' + + inc esi + inc ebx + + cmp esi,edi + jb @b + + inc [lines] + + mov ecx,[posy] + cmp ecx,[slines] + jne @f + + dec [posy] + add [post],80 + + @@: + call clear_screen + call drawfile +;call calc_scroll_size_and_pos + + call draw_vertical_scroll + mov [modified],1 + + jmp still +; ENTER } + + + noenter: + + +; UP { + cmp al,130+48 + jnz noup + mov ecx,[posy] + test ecx,ecx + jnz .up1 + mov ecx,[post] + test ecx,ecx + jz still + add ecx,-80 + mov [post],ecx + call clear_screen + jmp .finish + .up1: + dec ecx + mov [posy],ecx + .finish: + call drawfile + call draw_vertical_scroll +;call calc_scroll_size_and_pos + + jmp still +; UP } + + noup: + +; DOWN { + cmp al,129+48 + jnz nodown + + mov ecx,[posy] + mov eax,[slines] + dec eax + cmp ecx,eax + jb .do1 ; goto do1 if [posy] < [slines]-1 + + mov eax,[lines] + sub eax,[slines] + dec eax + jb still ; goto still if [lines] < [slines]-1 +; imul eax,80 + lea eax,[eax+eax*4] + shl eax,4 + cmp [post],eax + jg still ; goto still if [post] > ([lines]-[slines]-1)*80 + + add [post],80 + call clear_screen + call drawfile + call draw_vertical_scroll +;call calc_scroll_size_and_pos + + jmp still + + .do1: + pusha + mov eax,[post] + cdq + mov ebx,80 + div ebx + add eax,[posy] + inc eax + cmp eax,[lines] + jb .do10 + popa + jmp still + + .do10: + popa + inc ecx + mov [posy],ecx + call drawfile + call draw_vertical_scroll +;call calc_scroll_size_and_pos + + jmp still +; DOWN } + + + nodown: + + +; LEFT { + cmp al,128+48 + jnz noleft + cmp [posx],0 + je still + dec [posx] + call drawfile + jmp still +; LEFT } + + + noleft: + + +; RIGHT { + cmp al,131+48 + jnz noright + cmp [posx],79 + je still + inc [posx] + call drawfile + jmp still +; RIGHT } + + + noright: + + +; PAGE_UP { + page_up: + cmp al,136+48 + jnz nopu +scrl_up: + mov eax,[slines] + dec eax +; imul eax,80 + lea eax,[eax+eax*4] + shl eax,4 + mov ecx,[post] + cmp eax,ecx + jbe pu1 + mov ecx,eax + pu1: + sub ecx,eax + mov [post],ecx + + call clear_screen + call drawfile + call draw_vertical_scroll +;call calc_scroll_size_and_pos + jmp still +; PAGE_UP } + + + nopu: + + +; PAGE_DOWN { + page_down: + cmp al,135+48 + jnz nopd +scrl_down: + mov eax,[lines] + cmp eax,[slines] + jb still + + mov eax,[post] ; eax = offset + cdq + mov ebx,80 + div ebx ; eax /= 80 + mov ecx,[lines] ; ecx = lines in the file + cmp eax,ecx ; if eax < ecx goto pfok + jnb still + mov eax,[slines] ; eax = lines on the screen + dec eax ; eax-- +; imul eax,80 ; eax *= 80 + lea eax,[eax+eax*4] + shl eax,4 + add [post],eax ; offset += eax + + mov eax,[lines] ; eax = lines in the file + sub eax,[slines] ; eax -= lines on the screen +; imul eax,80 ; eax *= 80 + lea eax,[eax+eax*4] + shl eax,4 + cmp [post],eax + jb @f + mov [post],eax + @@: + + call clear_screen + call drawfile + call draw_vertical_scroll +;call calc_scroll_size_and_pos + + jmp still +; PAGE_DOWN } + + nopd: + +; HOME { + cmp al,132+48 + jnz nohome + + push 0 + pop [posx] + + call drawfile + jmp still +; HOME } + + + nohome: + + +; END { + end_key: + cmp al,133+48 + jnz noend + + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + + mov esi,eax + add eax,80+1 + +@@: dec eax + cmp eax,esi + je @f + cmp byte [eax-1],' ' + jbe @b +@@: + sub eax,esi + cmp eax,80-1 + jbe @f + dec eax +@@: + mov [posx],eax + + call drawfile + jmp still +; END } + + + noend: + + +; GO_START { + cmp al,251 ; Ctrl + [ + jnz no_go_to_start + + push 0 + pop [post] ; offset = 0 + + call clear_screen + call drawfile ; draw file + call draw_vertical_scroll +;call calc_scroll_size_and_pos + jmp still ; go to still +; GO_START } + + + no_go_to_start: + + +; GO_END { + cmp al,253 ; Ctrl + ] + jnz no_go_to_end + cmp [lines],30 ;to fix ctrl+] bug + jb @f + mov eax,[lines] ; eax = lines in the file + sub eax,[slines] ; eax -= lines on the screen +; imul eax,80 ; eax *= 80 (length of line) + lea eax,[eax+eax*4] + shl eax,4 + mov [post],eax ; offset in the file + + call clear_screen + call drawfile ; draw file + call draw_vertical_scroll + @@: + jmp still ; go to still +; GO_END } + + + no_go_to_end: + + +; DELETE { + cmp al,134+48 + jne nodel + + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + add eax,[posx] + mov ecx,eax + + imul eax,[posy],80 + add eax,0x80000+79 + add eax,[post] + mov ebx,eax + + push ebx + + dec ecx + dec ebx + + + push ecx ebx + + push ebx + + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + mov ecx,eax + + xor eax,eax + cdq + + pop ebx + + dec ecx + @@: + inc ecx + mov dh,[ecx] + cmp dh,33 + jb .nok + xor eax,eax + inc eax + .nok: + cmp ecx,ebx + jb @b + + pop ebx ecx + + @@: + inc ecx + mov dl,[ecx+1] + mov [ecx],dl + cmp ecx,ebx + jb @b + + + pop ebx + mov [ebx],byte 32 + + test eax,eax + jz dellinesup + + call clear_screen + call drawfile + mov [modified],1 + + jmp still + + dellinesup: + + ; lines -1 + + pusha + + mov eax,[post] + cdq + mov ebx,80 + div ebx + add eax,[posy] + inc eax + + cmp eax,[lines] + jb @f + + popa + mov [modified],1 + + jmp still + + @@: + + popa + + dec [lines] + + ; lines up + + mov [posx],dword 0 + + imul eax,[posy],80 + add eax,0x80000-1 + add eax,[post] + mov ebx,eax + + push ebx + + imul eax,[lines],80 + add eax,0x80000-1 + add eax,[post] + mov ecx,eax + + pop ebx + + @@: + mov dl,[ebx+80] + mov [ebx],dl + inc ebx + + cmp ecx,ebx + jnz @b + + call clear_screen + call drawfile + mov [modified],1 + + jmp still +; DELETE } + + + nodel: + + +; INSERT { + cmp al,137+48 + jnz noins + + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + add eax,[posx] + mov ecx,eax + ; ecx = [posy]*80+0x80000+[post]+[posx] + + imul eax,[posy],80 + add eax,0x80000+79 + add eax,[post] + mov ebx,eax + ; ebx = [posy]*80+0x80000+79+[post] + + .movstr: + dec ebx + mov dl,[ebx] + mov [ebx+1],dl + cmp ecx,ebx + jb .movstr + + mov [ecx],byte ' ' + + call invalidate_string + call drawfile + mov [modified],1 + + jmp still +; INSERT } + + + noins: + + +; BACKSPACE { + cmp al,8 + jnz nobs + mov ecx,[posx] + test ecx,ecx + jz still + dec ecx + mov [posx],ecx + + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + add eax,[posx] + mov ebx,eax + + push ebx + + imul eax,[posy],80 + add eax,0x80000+79 + add eax,[post] + mov ebx,eax + + pop ecx + + push ebx + + dec ecx + .movleft: + inc ecx + mov dl,[ecx+1] + mov [ecx],dl + cmp ecx,ebx + jb .movleft + + pop ebx + mov [ebx],byte ' ' + + call invalidate_string + call drawfile + mov [modified],1 + + jmp still +; BACKSPACE } + + + nobs: + + +; TAB { + cmp eax,9 ; Tab + jne notab + + mov eax,[posx] + cmp eax,80-1 + jae still + add eax,5 ; 9 5 3 + and eax,11111100b ; ...1000b, ...100b, ...10b + dec eax + mov [posx], eax + + call drawfile + mov [modified],1 + + jmp still +; TAB } + + + notab: + + +; ADD_KEY { + push eax ; add key + + imul eax,[posy],80 + add eax,0x80000 + add eax,[post] + add eax,[posx] + mov ecx,eax + + push ecx + + imul eax,[posy],80 + add eax,0x80000+79 + add eax,[post] + mov ebx,eax + + .movright: + dec ebx + mov al,[ebx] + mov [ebx+1],al + cmp ecx,ebx + jbe .movright + + pop ebx + + pop eax + + mov [ebx],al + mov edx,78 + mov ecx,[posx] + cmp edx,ecx + jb noxp + inc ecx + mov [posx],ecx + noxp: + + call invalidate_string + call drawfile + mov [modified],1 +; call draw_vertical_scroll + jmp still +; ADD_KEY } + + +;****************************************************************************** + +start_fasm: + cmp [asm_mode],1 + je @f + ret + @@: + mov esi,filename + mov edi,fasm_parameters + + cmp byte [esi],'/' + je .yes_systree + + mov ecx,[filename_len] + rep movsb + + mov al,',' + stosb + + mov ecx,[filename_len] + add ecx,-4 + mov esi,filename + rep movsb + + mov al,',' + stosb + + mov [edi],dword '/RD/' + add edi,4 + mov [edi],word '1/' + inc edi + inc edi + + mov al,0 + stosb + + jmp .run + + .yes_systree: + add esi,[filename_len] + dec esi + + xor ecx,ecx + mov al,'/' + @@: + cmp [esi],al + je @f + dec esi + inc ecx + jmp @b + @@: + inc esi + + push esi + push esi + push ecx + + rep movsb + + mov al,',' + stosb + + pop ecx + pop esi + + add ecx,-4 + rep movsb + + mov al,',' + stosb + + pop ecx + sub ecx,filename + mov esi,filename + + rep movsb + + mov al,0 + stosb + + .run: + cmp [run_outfile],1 + jne @f + dec edi + mov eax,',run' + stosd + mov al,0 + stosb + @@: + + mov eax,19 + mov ebx,fasm_filename + mov ecx,fasm_parameters + int 0x40 +ret + +open_debug_board: + mov eax,19 + mov ebx,debug_filename + xor ecx,ecx + int 0x40 +ret + +open_sysfuncs_txt: + mov eax,19 + mov ebx,tinypad_filename + mov ecx,sysfuncs_filename + int 0x40 +ret + + +empty_work_space: +; очистить все + mov eax,' ' + mov edi,0x80000 + mov ecx,(0x300000-0x90000)/4 + cld + rep stosd + mov edi,0x10000 + mov ecx,0x60000/4 + rep stosd +ret + + +clear_screen: +; очистить экран + mov ecx,80*40 + mov edi,0x78000 + xor eax,eax + @@: + mov [edi],eax + add edi,4 + dec ecx + jnz @b +ret + +invalidate_string: + imul eax,[posy],80 + add eax,0x78000 + mov edi,eax + mov al,1 + mov ecx,80/4 + rep stosd +ret + +layout: +; сменить раскладку клавиатуры + mov eax,19 + mov ebx,setup + mov ecx,param_setup + int 0x40 + mov eax,5 + mov ebx,eax + int 0x40 + call activate_me +ret + + +activate_me: +; 1) get info about me + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + ; eax = number of processes + +; save process counter + inc eax + inc eax + mov [proccount],eax + + mov eax,[procinfo.PID] + mov [PID],eax + +; 2) get my process number + mov eax,9 + mov ebx,procinfo + mov ecx,[proccount] + @@: + dec ecx + jz @f ; counter=0 => not found? => return + mov eax,9 + int 0x40 + mov edx,[procinfo.PID] + cmp edx,[PID] + jne @b + + ;found: ecx = process_number + mov eax,18 + mov ebx,3 + int 0x40 + + mov eax,5 + mov ebx,eax + int 0x40 + + @@: +ret + + + + +; ******************************************************************* +; ************************** DRAW WINDOW ************************** +; ******************************************************************* + +align 4 +drawwindow: + + mov eax,12 ; WINDOW DRAW START + mov ebx,1 + int 0x40 + mov [menu_is_on],0 + mov eax,48 ; get system colors + mov ebx,3 + mov ecx,sc + mov edx,sizeof.system_colors + int 0x40 + + mov [sc.work],0xe0e0e0 + + xor eax,eax ; DEFINE WINDOW + mov ebx,100*65536+506 ; 496 + mov ecx,75*65536+400 ;385;400 ; sum < 480 for 640x480 + mov edx,[sc.work] + add edx,0x03000000 + mov esi,[sc.grab] + or esi,0x80000000 + mov edi,[sc.frame] + int 0x40 + +; header string + mov eax,4 + mov ebx,10*65536+8 + mov ecx,[sc.grab_text] + mov edx,header + mov esi,[headlen] + int 0x40 + + mov eax,9 ; get info about me + mov ebx,procinfo + or ecx,-1 + int 0x40 + + mov eax,[procinfo.y_size] + + mov [do_not_draw],1 ; do_not_draw = true + cmp eax,100 + jb .no_draw ; do not draw text & buttons if height < 100 + mov [do_not_draw],0 ; do_not_draw = false + add eax,-(46+47) ; 46 = y offs + cdq + mov ebx,10 + div ebx + mov [slines],eax + + cmp eax,[posy] + jnb @f + dec eax + mov [posy],eax + @@: + + mov eax,[procinfo.y_size] ; calculate buttons position + add eax,-47 + mov [dstart],eax + +; mov eax,8 ; STRING BUTTON +; mov ebx,5*65536+57 +; mov ecx,[dstart] +; add ecx,29 +; shl ecx,16 +; add ecx,13 +; mov edx,51 ;;;;;-----string button ID=51 +; mov esi,[sc.work_button] +; int 0x40 + ; SEARCH BUTTON +; mov ebx,(505-129)*65536+125 +; mov edx,50 +; mov esi,[sc.work_button] +; int 0x40 + +; mov eax,4 ; SEARCH TEXT +; mov ebx,[dstart] +; add ebx,7*65536+32 +; mov ecx,[sc.work_button_text] +; mov edx,searcht +; mov esi,searchtl-searcht +; int 0x40 + + + mov eax,13 ; BAR STRIPE + mov ebx,5*65536+497 + mov ecx,[dstart] + shl ecx,16 + add ecx,30 ;15 + + mov edx,0x00aaaaaa + int 0x40 + +; mov eax,4 ; FIRST TEXT LINE (POSITION...) +; mov ebx,12*65536 +; add ebx,[dstart] +; add ebx,38 ;18 +; mov ecx,[sc.work_button_text] +; mov edx,htext2 +; mov esi,htextlen2-htext2 +; int 0x40 + + + call drawfile + +; mov eax,[dstart] + +; add eax,31 +; mov [ya],eax +; mov [addr],search_string +; call print_text + + .no_draw: + call draw_win_menu + + call draw_vertical_scroll + + mov eax,12 ; WINDOW DRAW END + mov ebx,2 + int 0x40 + + ret + + + + +; ********************************** +; *********** DRAWFILE *********** +; ********************************** + +drawfile: +;--------------- +cmp [menu_is_on],1 +jne .ff +call drawwindow +.ff: +;--------------- + mov [next_not_quote],1 + mov [next_not_quote2],1 + + mov eax,[post] ; print from position + + pusha + + mov edi,[post] + mov [posl],edi + + mov ebx,8*65536+46 ; letters (46 = y offs) + xor ecx,ecx + + mov edx,0x80000 + add edx,eax + mov edi,edx + + imul esi,[slines],80 + add edi,esi + + + nd: + + pusha + + mov edx,ebx + mov edi,ebx + add edi,(6*65536)*80 + + wi1: + + + ; draw ? + + + pusha + + push ecx + + imul eax,[posx],6 + add eax,8 + shl eax,16 + mov ecx,eax + +;  ecx = ([posx]*6+8)<<16 + + imul eax,[posy],10 + add eax,46 ; y offs + add eax,ecx + +;  eax = [posy]*10+46+ecx + + pop ecx + + cmp edx,eax + jnz drwa + + mov eax,0x7ffff + call check_pos + jmp drlet + + drwa: + + popa + + + pusha + + imul eax,[posxm],6 + add eax,8 + shl eax,16 + mov ecx,eax + + imul eax,[posym],10 + add eax,46 ; y offs + add eax,ecx + + cmp edx,eax + jnz drwa2 + + mov eax,0x7ffff + call check_pos + jmp drlet + + drwa2: + + popa + + pusha + + mov eax,0x78000 ; screen + add eax,[posl] ; screen+abs + sub eax,[post] ; eax = screen+abs-base = y*80+x + screen + + mov edx,0x80000 ; file + add edx,[posl] ; edx = absolute + mov bl,[edx] ; in the file + + call check_pos + + mov cl,[eax] ; on the screen + cmp bl,cl + jnz drlet + + popa + + jmp nodraw + + + ; draw letter + + + drlet: + + mov [eax],bl ; mov byte to the screen + mov [tmpabc],bl + popa ; restore regs + +;!!!!!!!!!!!! + + cmp [tmpabc],' ' + je @f + call draw_letter + jmp nodraw + @@: + call clear_char + + nodraw: + + inc [posl] + + add edx,6*65536 + cmp edx,edi + jz wi3 + jmp wi1 + + wi3: + + popa + + add ebx,10 + add edx,80 + cmp edi,edx + jbe nde + jmp nd + + nde: + + mov eax,[posx] + mov ebx,[posy] + + mov [posxm],eax + mov [posym],ebx + + popa + + ret + + stText = 0 + stInstr = 1 + stReg = 2 + stNum = 3 + stQuote = 4 + stComment = 5 + stSymbol = 6 + +align 4 + +clear_char: + + pusha + mov ebx,[sc.work] + + push ecx + + imul eax,[posx],6 + add eax,8 + shl eax,16 + mov ecx,eax + + imul eax,[posy],10 + add eax,46 ; 26 + add eax,ecx + + pop ecx + cmp edx,eax + jnz @f + mov ebx,0xffffff ; light blue 0x00ffff + @@: + + ; draw bar + push ebx + mov eax,13 + mov ebx,edx + mov bx,6 + mov ecx,edx + shl ecx,16 + add ecx,10 + pop edx + int 0x40 + popa + ret + +align 4 + +; CHECK_POSITION { +check_pos: + cmp [asm_mode],1 + je @f + + mov [d_status],stText + ret + + @@: + pushad + +; COMMENT TERMINATOR + cmp [d_status],stComment + jnz @f + mov eax,[posl] + sub eax,[post] + cdq + mov ebx,80 + div ebx + test edx,edx + jnz end_check_pos + mov [d_status],stText + @@: + +; QUOTE TERMINATOR B + cmp [next_not_quote],1 + jne @f + mov [d_status],stText + @@: + + mov eax,[posl] + add eax,0x80000 + mov edx,eax + mov al,[eax] + +; QUOTE TERMINATOR A + cmp [d_status],stQuote + jnz @f + cmp al,[quote] + jne end_check_pos + mov [next_not_quote],1 + jmp end_check_pos + @@: + mov [next_not_quote],0 + +; START QUOTE 1 + cmp al,"'" + jne @f + mov [d_status],stQuote + mov [quote],al + jmp end_check_pos + @@: + +; START QUOTE 2 + cmp al,'"' + jne @f + mov [d_status],stQuote + mov [quote],al + jmp end_check_pos + @@: + +; START COMMENT + cmp al,';' + jne @f + mov [d_status],stComment + jmp end_check_pos + @@: + +; NUMBER TERMINATOR + cmp [d_status],stNum + jne nonumt + mov ecx,23 + @@: + dec ecx + jz nonumt + cmp al,[symbols+ecx] + jne @b + + nonumt1: + mov [d_status],stText + nonumt: + +; START NUMBER + cmp [d_status],stNum + je end_check_pos + cmp al,'0' + jb nonum + cmp al,'9' + ja nonum + mov bl,[edx-1] + mov ecx,23 + @@: + dec ecx + jz nonum + cmp bl,[symbols+ecx] + jne @b + @@: + mov [d_status],stNum + jmp end_check_pos + nonum: + +; SYMBOL + mov esi,symbols + mov ecx,21 + @@: + cmp byte [esi],al + je @f + dec ecx + jz nosymbol + inc esi + jmp @b + @@: + mov [d_status],stSymbol + jmp end_check_pos + + nosymbol: + mov [d_status],stText + + end_check_pos: + popad + ret +; CHECK_POSITION } + + +;;;;;;;;;;;;;;;;; +;; DRAW LETTER ;; +;;;;;;;;;;;;;;;;; +draw_letter: + + call clear_char + + pusha + + mov ebx,edx ; x & y + + mov eax,[d_status] + mov ecx,[eax*4+color_tbl] + mov eax,4 + + xor esi,esi + inc esi + mov edx,0x80000 + mov edi,[posl] + add edx,edi + int 0x40 + + popa + + ret + + +; ******************************************** +; **************** SAVEFILE **************** +; ******************************************** +save_file: + mov esi,0x80000 + mov edi,0x10000 + or ecx,-1 + .new_string: + inc ecx + call save_string + cmp ecx,[lines] + jb .new_string + + sub edi,0x10004 ; why??? + mov [filelen],edi + + cmp byte [filename],'/' + je .systree_save + + mov eax,33 + mov ebx,filename + mov ecx,0x10000 + mov edx,[filelen] + xor esi,esi + int 0x40 + + test eax,eax + je .finish +; call file_not_found + call disk_is_full +;============================== + jmp .finish + + .systree_save: + mov eax,[filelen] + mov [fileinfo_write+8],eax + + mov esi,filename + mov edi,pathfile_write + mov ecx,50 + cld + rep movsb + + mov eax,58 + mov ebx,fileinfo_write + int 0x40 + cmp eax,0 + je .finish + call disk_is_full + .finish: +call draw_window_for_dialogs + mov [modified],0 +ret + +save_string: + push ecx + push esi + mov eax,esi + mov ebx,eax + add ebx,79 + .countlen: + cmp ebx,eax + jb .endcount + cmp byte [ebx],' ' + jne .endcount + dec ebx + jmp .countlen + .endcount: + inc ebx + sub ebx,eax + + mov ecx,ebx + jecxz .endcopy + .copystr: + mov al,[esi] + mov [edi],al + inc esi + inc edi + dec ecx + jnz .copystr + .endcopy: + + mov eax,0x0a0d + stosw + + pop esi + add esi,80 + pop ecx +ret + + + +; ******************************************** +; **************** LOADFILE **************** +; ******************************************** + +loadhdfile: + + mov esi,filename + mov edi,pathfile_read + mov ecx,250 ;50 + cld + rep movsb + + mov eax,58 + mov ebx,fileinfo_read + int 0x40 + + xchg eax,ebx + inc eax + test ebx,ebx ;errorcode=0 - ok + je file_found + cmp ebx,6 ;errorcode=5 - ok + je file_found + call file_not_found + ret + + +loadfile1: + + mov eax,6 ; 6 = open file + mov ebx,filename + xor ecx,ecx + mov edx,16800 + mov esi,0x10000 + int 0x40 + + inc eax ; eax = -1 -> file not found + jnz file_found ;strannaya proverka (Ed) + + call file_not_found + ret + + + file_found: + dec eax +; eax = file size + jz .finish + mov [filesize],eax + + mov edi,0x80000 ; clear all + @@: + mov [edi],byte ' ' + inc edi + cmp edi,0x2effff + jnz @b + + mov [lines],0 + mov edi,0x10000 + mov ebx,0x80000 + +; edi = from +; ebx = to +; eax = filesize + + .new_char: + mov cl,[edi] ; get_char(); + cmp cl,13 ; if (char==13) + je .new_str1 ; goto .new_str1; + cmp cl,10 ; if (char==10) + je .new_str2 ; goto .new_str2; + mov [ebx],cl ; store_char(); + inc ebx ; dest++; + .back: + inc edi ; src++; + dec eax ; counter--; + jnz .new_char ; if (counter!=0) goto .new_char; + + .finish: + inc [lines] ; [lines]++; + ret + + .new_str1: + pusha + mov eax,ebx ; eax = destination + add eax,-0x80000 ; eax = offset + cdq + mov ecx,80 + div ecx ; offset /= 80; + test edx,edx ; if not the first char in the string + jne @f ; go forward + test eax,eax ; if first line + je @f ; go forward + cmp [edi-1],byte 10; if previous char != 10 continue without line feed + jne .contin + @@: + inc eax ; offset++; + imul eax,80 ; offset *= 80; + add eax,0x80000 + mov [esp+4*4],eax ; to ebx + .contin: + popa + inc edi ; do not look on the next char (10) + dec eax ; counter--; + inc [lines] ; [lines]++; + jmp .back + + + .new_str2: + pusha + mov eax,ebx + add eax,-0x80000 + cdq + mov ecx,80 + div ecx + inc eax + imul eax,80 + add eax,0x80000 + mov [esp+4*4],eax ; to ebx + popa + inc [lines] + jmp .back + + +file_not_found: + mov eax,55 ; beep + mov ebx,eax + mov esi,error_beep + int 0x40 + mov [lines],1 ; open empty document + + mov [to_return2],1 + call openerror + + ret + +disk_is_full: + mov eax,55 ; beep + mov ebx,eax + mov esi,error_beep + int 0x40 + mov [to_return2],1 + call saveerror + mov [error2_found],1 +ret + + +; ***************************** +; ****** WRITE POSITION ****** +; ***************************** + +writepos: + + cmp [do_not_draw],1 ; return if drawing is not permitted + jne @f + ret + @@: + + pusha + + mov eax,[posx] + inc eax + cdq + mov ebx,10 + div ebx + add al,'0' + add dl,'0' + mov [htext2+ 9],al + mov [htext2+10],dl + + mov eax,[post] + cdq + mov ebx,80 + div ebx + mov [real_posy],eax ;=====!!!!!!!!! + + add eax,[posy] + inc eax + mov ebx,10 + cdq + div ebx + add dl,'0' + mov [htext2+16],dl ; 00001 + cdq + div ebx + add dl,'0' + mov [htext2+15],dl ; 00010 + cdq + div ebx + add dl,'0' + mov [htext2+14],dl ; 00100 + cdq + div ebx + add dl,'0' + add al,'0' + mov [htext2+13],dl ; 01000 + mov [htext2+12],al ; 10000 + + + mov eax,[lines] ; number of lines + cdq + mov ebx,10 + div ebx + add dl,'0' + mov [htext2+31],dl ; 0001 + cdq + div ebx + add dl,'0' + mov [htext2+30],dl ; 0010 + cdq + div ebx + add dl,'0' + mov [htext2+29],dl ; 0100 + cdq + div ebx + add dl,'0' + add al,'0' + mov [htext2+28],dl + mov [htext2+27],al ; 10000 + +; НАДО БЫ ОТОБРАЖАТЬ РАСКЛАДКУ КЛАВИАТУРЫ! +; mov [htext2+42], word 'RU' + +; mov eax,13 ; draw bar +; mov ebx,5*65536+38*6 +; mov ecx,[dstart] +; shl ecx,16 +; add ecx,15 +; mov edx,[sc.work_graph] +; int 0x40 + + mov eax,13 ; BAR STRIPE + mov ebx,5*65536+497 + mov ecx,[dstart] + add ecx,29;30 ;15 + shl ecx,16 + add ecx,14 + mov edx,[sc.work_graph] + int 0x40 + + mov eax,4 ; write position + mov ebx,12*65536 + mov bx,word [dstart] + add ebx,33 ;18 + mov ecx,[sc.work_button_text] + mov edx,htext2 + mov esi,38 + int 0x40 + + cmp [modified],1 + jne no_mod + putlabel 270,386,'ИЗМЕНЕН',[sc.work_button_text] + no_mod: + popa + + ret + +;----------------------------- +; search window +;----------------------------- +search_window: + +mov eax,13 +mov ebx,55*65536+380 +mov ecx,100*65536+60 +mov edx,[sc.work_graph] +int 0x40 + +mov eax,38 +mov ebx,55*65536+435 +mov ecx,100*65536+100 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,55*65536+55 +mov ecx,100*65536+160 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,435*65536+435 +mov ecx,100*65536+160 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,55*65536+435 +mov ecx,160*65536+160 +mov edx,cl_White +int 0x40 + + +drawlbut 375,110,50,15,'Поиск',50,[sc.work_button],[sc.work_button_text] +drawlbut 375,130,50,15,'Отмена',94,[sc.work_button],[sc.work_button_text] + +call read_string + +; add eax,31 +; mov [ya],eax +; mov [addr],search_string +; call print_text + + + +jmp search + +string_not_found: + mov eax,13 + mov ebx,150*65536+200 + mov ecx,100*65536+70 + mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 + int 0x40 + +mov eax,38 +mov ebx,150*65536+350 +mov ecx,100*65536+100 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,150*65536+350 +mov ecx,170*65536+170 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,150*65536+150 +mov ecx,100*65536+170 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,350*65536+350 +mov ecx,100*65536+170 +mov edx,cl_White +int 0x40 + + + putlabel 195,120,'Строка не найденна!',cl_White + + drawlbut 235,140,30,15,'Ок',94,[sc.work_button],cl_White + +ret + +read_string: + +push eax +;---------------- +mov eax,40 +mov ebx,00000000000000000000000000000111b +int 0x40 +;---------------- +pop eax + +; cmp al,51 +; jz .f2 +; ret + + .f2: + mov [addr],dword search_string + mov eax,[dstart] + add eax,17+14 + mov [ya],eax + mov [case_sens],1 + + .rk: + + mov edi,[addr] + + mov eax,[addr] + mov eax,[eax-4] + mov [temp],eax + + add edi,eax + + call print_text + + .waitev: + mov eax, 10 + int 0x40 + cmp eax, 2 + jne .read_done + int 0x40 + shr eax, 8 + + cmp al, 13 ; enter + je .read_done + + cmp al,27 + jne ._f + jmp red + ._f: + cmp al, 192 ; Ctrl + space + jne .noclear + + xor eax, eax + mov [temp], eax + mov edi, [addr] + mov [edi-4], eax + mov ecx, 49 + cld + rep stosb + mov edi, [addr] + call print_text + jmp .waitev + + .noclear: + + cmp al, 8 ; backspace + jnz .nobsl + cmp [temp], 0 + jz .waitev + dec [temp] + mov edi, [addr] + add edi, [temp] + mov [edi], byte 0 + + mov eax,[addr] + dec dword [eax-4] + + call print_text + jmp .waitev + + .nobsl: + cmp [temp],50 + jae .read_done + +; CONVERT CHAR TO UPPER CASE: + cmp al, ' ' ; below "space" - ignore + jb .waitev + cmp [case_sens], 1 ; case sensitive? + je .keyok + cmp al, 'a' + jb .keyok + cmp al, 'z' + ja .keyok + sub al, 32 + .keyok: + + mov edi,[addr] + add edi,[temp] + mov [edi],al + + inc [temp] + + mov eax,[addr] + inc dword [eax-4] + call print_text + + cmp [temp],50 + jbe .waitev + + .read_done: + mov ecx,50 + sub ecx,[temp] + mov edi,[addr] + add edi,[temp] + xor eax,eax + cld + rep stosb + + mov [temp],987 + + call print_text + call mask_events + ret + + +print_text: + + pusha + + mov eax,13 + mov ebx,64*65536+50*6+2 +; mov ecx,[ya] +; shl ecx,16 +; add ecx,12 + mov ecx,110*65536+12 + mov edx,[sc.work] + int 0x40 + + mov edx,[addr] + mov esi,[edx-4] + mov eax,4 + mov ebx,65*65536+112 ;2 +; add ebx,[ya] + mov ecx,[color_tbl+0] + int 0x40 + + cmp [temp],50 + ja @f + +; draw cursor +; { +; mov eax,[ya] + mov eax,18*65536+102 ;65 + mov ebx,eax + shl eax,16 + add eax,ebx + add eax,10 + mov ecx,eax + + mov eax,[temp] +; imul eax,6 + lea eax,[eax+eax*2] + shl eax,1 + add eax,65 + mov ebx,eax + shl eax,16 + add ebx,eax + + mov eax,38 + mov edx,[color_tbl+0] + int 0x40 +; } + +@@: + popa + + ret + + + +; mov eax,8 ; STRING BUTTON +; mov ebx,5*65536+57 +; mov ecx,[dstart] +; add ecx,29 +; shl ecx,16 +; add ecx,13 +; mov edx,51 ;;;;;-----string button ID=51 +; mov esi,[sc.work_button] +; int 0x40 + ; SEARCH BUTTON +; mov ebx,(505-129)*65536+125 +; mov edx,50 +; mov esi,[sc.work_button] +; int 0x40 + +; mov eax,4 ; SEARCH TEXT +; mov ebx,[dstart] +; add ebx,7*65536+32 +; mov ecx,[sc.work_button_text] +; mov edx,searcht +; mov esi,searchtl-searcht +; int 0x40 + + + +; **************************** +; ******* READ STRING ******** +; **************************** +goto_string: + +mov [num_goto_string],0 +call read_str_num +mov eax,[num_goto_string] +cmp eax,[lines] +ja .leave + +;--------------- +mov [posy],0 +call goto_pos + +.leave: +call draw_window_for_dialogs +call mask_events + +jmp still + + +read_str_num: +push eax +;---------------- +mov eax,40 +mov ebx,00000000000000000000000000000111b +int 0x40 +;---------------- +pop eax + +mov eax,13 +mov ebx,100*65536+100 +mov ecx,70*65536+60 +mov edx,[sc.work_button] +int 0x40 + + +mov eax,38 +mov ebx,100*65536+200 +mov ecx,70*65536+70 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,100*65536+200 +mov ecx,130*65536+130 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,100*65536+100 +mov ecx,70*65536+130 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,200*65536+200 +mov ecx,70*65536+130 +mov edx,cl_White +int 0x40 + + + +putlabel 105,75,'GoTo Line #',cl_White + mov eax,13 + mov ebx,110*65536+40 + mov ecx,90*65536+12;[ya] + mov edx,[sc.work] + int 0x40 + +outcount [num_goto_string],112,92,cl_Black,6*65536 +drawlbut 110,105,40,15,'GoTo',93,cl_Grey,cl_Black +drawlbut 153,105,40,15,'Cancel',94,cl_Grey,cl_Black + .waitev: + mov eax, 10 + int 0x40 +; cmp eax,6 +; je .mouse + cmp eax,3 + je .but + cmp eax, 2 +; jne .read_done + jne .waitev + int 0x40 + shr eax, 8 + + cmp al, 13 ; enter + je .read_done + cmp al,27 + je goto_string.leave + cmp al, 8 ; backspace + jnz .nobsl + +xor edx,edx + +mov eax,[num_goto_string] +mov ebx,dword 10 +div ebx +mov [num_goto_string],eax +call print_text2 +jmp .waitev + +;.mouse: +;mov eax,37 +;mov ebx,2 +;int 0x40 +;cmp eax,2 +;je goto_string.leave +;jmp .waitev + +.but: +mov eax,17 +int 0x40 +cmp ah,94 +je goto_string.leave +cmp ah,93 +je .read_done +jmp .waitev + + + .nobsl: +xor ecx,ecx +xor edx,edx + +sub al,48 +mov cl,al + +mov eax,[num_goto_string] +cmp eax,99999 +ja .read_done +mov ebx,10 +mul ebx +add eax,ecx +mov [num_goto_string],eax + +call print_text2 +jmp .waitev + + .read_done: +mov eax,[num_goto_string] +dec eax +mov [num_goto_string],eax + call print_text2 + ret + + +print_text2: + + pusha + + mov eax,13 + mov ebx,110*65536+40 + mov ecx,90*65536+12;[ya] + mov edx,[sc.work] + int 0x40 + +outcount [num_goto_string],112,92,cl_Black,6*65536 + popa + + ret + +;****************************************************************************** +calc_scroll_size_and_pos: + +;cmp [menu_is_on],0 +;je ._ff +;call drawwindow +;mov [menu_is_on],0 +;._ff: + +cmp [lines],30 +jbe .lines_less_30 + +xor edx,edx +mov eax,[post] +mov ebx,80 +div ebx +add eax,[posy] +;add eax,[slines] + +;checking for bug +mov ebx,[lines] +sub ebx,30 + +cmp eax,ebx +ja .f +mov [VScroll_1+16],eax +jmp .ff +.f: +mov [VScroll_1+16],ebx + +.ff: +;--------------------- +mov eax,[lines] +sub eax,30 ;---max=lines-30 +mov [VScroll_1+12],eax +jmp .leave + +.lines_less_30: + +mov [VScroll_1+16],dword 0 +mov [VScroll_1+12],dword 1 + +.leave: + +ret +;============Draw vertical scroll bar========= +draw_vertical_scroll: +call calc_scroll_size_and_pos +;======================== + xor ecx,ecx ;start at top of controls list +Draw_Controls_Loop: ;Redraw Controls Loop + mov ebp, [App_Controls+ecx] ;get controls data location + or ebp,ebp ;is this the last control? + jz Draw_Controls_Done ; + call dword [App_Controls+ecx+4] ;call controls draw function + add ecx, 12 ;get next control + jmp Draw_Controls_Loop ;loop till done +Draw_Controls_Done: ;all done +;======================== + +mov eax,38 +mov ebx,488*65536+488 +mov ecx,43*65536+388 +mov edx,0x00000000 +int 0x40 +ret + +mouse_info: +;call + mov eax, 37 ;get mouse cordinates + mov ebx, 1 ; + int 0x40 ; + mov ecx, eax ; + push ecx ; + mov eax, 37 ;get mouse buttons + mov ebx, 2 ; + int 0x40 ; +;------------------ +; if menu is on - then we need to redraw window before continue +cmp eax,1 +jne ._f1 + +pusha +cmp [menu_is_on],0 +je ._ff +call drawwindow +mov [menu_is_on],0 +._ff: +popa + +._f1: +;------------------ + cmp [mouseb], eax ;compare old mouse states to new states + jne redraw_mouse_info ; + cmp [mousey], cx ; + jne redraw_mouse_info ; + shr ecx, 16 ; + cmp [mousex], cx ; + jne redraw_mouse_info ; + pop ecx ; +ret ;return if no change in states +redraw_mouse_info: + pop ecx + mov [mouseb], eax ;save new mouse states + mov dword [mousey], ecx + xor ecx, ecx +Check_Mouse_Over_Controls_Loop: + mov ebp, [App_Controls+ecx] + or ebp, ebp + jz Check_Mouse_Over_Controls_Loop_done + + movzx eax,word [ebp+2] + cmp ax, [mousex] + ja mouse_not_on_control + movzx eax,word [ebp+6] + cmp ax, [mousey] + ja mouse_not_on_control + movzx eax,word [ebp] + add ax, [ebp+2] + cmp ax, [mousex] + jb mouse_not_on_control + movzx eax,word [ebp+4] + add ax, [ebp+6] + cmp ax, [mousey] + jb mouse_not_on_control + call dword [App_Controls+ecx+8] + ;------------------------------ + cmp [mouseb],1 + jne mouse_not_on_control + mov eax,[VScroll_1+16] + call goto_pos + ;------------------------------ + +mouse_not_on_control: + add ecx, 12 + jmp Check_Mouse_Over_Controls_Loop +Check_Mouse_Over_Controls_Loop_done: + +ret +;****************************************************************************** +goto_pos: +;pusha + +mov ecx,eax ;save new position number in ecx for future + +cmp [lines],30 ;check for 'cursor' bug +jbe .lines_less_30 +;--------------- + +mov edx,[lines] ;if new pos is > than (lines-30) +sub edx,30 + +cmp eax,edx +ja .f1 +jmp .ff + +.f1: +mov eax,edx ;than newpos is = (lines-30) + +sub ecx,edx ;and posY=newpos-(lines-30) +mov [posy],ecx + +.ff: + +;----------------------- + ;in eax must be string number + mov ecx,80 + mul ecx + +; add eax,[slines] +; sub +;------------------------ + mov [post],eax + +.lines_less_30: + call clear_screen + call drawfile +;popa +ret +;****************************************************************************** +mask_events: +mov eax,40 +mov ebx,00100111b +int 0x40 +ret +;****************************************************************************** +main_cursor_move: +;call drawwindow +sub [mouse_x],7 +sub [mouse_y],45 + +xor edx,edx +mov eax,[mouse_x] +mov ebx,6 +div ebx ;eax=result +mov [posx],eax + +xor edx,edx +mov eax,dword [mouse_y] +mov ebx,dword 10 +div ebx ;eax=result=new posY + +;error checking ------ +cmp [lines],dword 1 ;for "1st line" bug +je ._do_nothing + +mov ebx,[lines] +sub ebx,dword 1 + +cmp eax,ebx ;[lines] +ja ._do_nothing + +;---------------------- +mov [posy],eax + +._do_nothing: +call clear_screen +call drawfile +call draw_vertical_scroll +ret + +;****************************************************************************** +make_fast_so: +;=========================== +; 1) get info about me + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + ; eax = number of processes + +; save process counter + inc eax + inc eax + mov [proccount],eax + + mov eax,[procinfo.PID] + mov [PID],eax +;========================== + + +mov eax,51 +mov ebx,1 +mov ecx,fast_so_thread_start +mov edx,so_stack +int 0x40 +ret +;****************************************************************************** + +;fast save & fast open +draw_fastso_window: +startwd +colorwindow 120,100,454,70,window_Type1+0x00cccccc,0x00cccccc,cl_Black + +call draw_string00 +drawlbut 10,40,30,20,'Save',17,cl_Grey,cl_Black + +drawlbut 50,40,30,20,'Open',18,cl_Grey,cl_Black + +drawlbut 90,40,37,20,'Close',19,cl_Grey,cl_Black +endwd +ret + +draw_string00: +mov ebx,10*65536+433 +mov ecx,10*65536+20 +mov edx,0x00ffffff +mov eax,13 +int 0x40 + +push eax +mov eax,6*65536 +mul dword [pos00] +add eax,10*65536+6 +mov ebx,eax +pop eax +mov edx,0x6a73d0 +int 0x40 + +mov eax,4 +mov ebx,12*65536+17 +mov ecx,cl_Black ;0x00000000 +mov edx,mypath ;filename ;path +mov esi,71 ;200 +int 0x40 +ret + +fast_so_thread_start: +;copy filename to mypath + cld + mov esi,filename + mov edi,mypath + mov ecx,71 ;200 + rep movsb + mov edi,mypath + mov ecx,71 ;200 + xor eax,eax + repne scasb +;end copy +call draw_fastso_window + +fastso_still: + wtevent fred,fkey,fbut +jmp fastso_still + +fred: +call draw_fastso_window +jmp fastso_still + +;====KEY +fkey: + +mov eax,2 +int 0x40 + +cmp ah,179 +jne noright00 +mov eax,[pos00] +cmp eax,70 ;41 +ja fastso_still +inc eax +mov [pos00],eax +call draw_string00 +jmp fastso_still +noright00: +cmp ah,176 +jne noleft00 +mov eax,[pos00] +test eax,eax +je fastso_still +dec eax +mov [pos00],eax +call draw_string00 +jmp fastso_still +noleft00: +cmp ah,182 +jne nodelete00 +call shiftback00 +call draw_string00 +jmp fastso_still +nodelete00: +cmp ah,8 +jne noback00 +mov eax,[pos00] +test eax,eax +je fastso_still +dec eax +mov [pos00],eax +call shiftback00 +call draw_string00 +jmp fastso_still +noback00: +enter00: + +cmp ah,19 ;ctrl+s +je fast_save +cmp ah,15 ;ctrl+o +je fast_open + +cmp ah,27 ;esli escape +jne noesc00 +jmp closethis ;to zakrivaem okno i nifiga ne delayem + +noesc00: +cmp dword [pos00],71 ;200 ;42 +jae fastso_still ;if pos>71 then jump to still + +;============letters================== +;~~~~~~~TEST CODE~~~~~~~~~ +; upper case +shr eax,8 + cmp eax,dword 31 + jbe no_lit + cmp eax,dword 95 + jb capital + sub eax,32 + capital: +;~~~~~~~~~~~~~~~~~~~~~~~~~ +mov edi,mypath ;filename ;mypath ;**************PATHNAME +add edi,71 ;200 ;count of letters +mov esi,edi +dec esi +mov ecx,71 ;200 ;again??? +sub ecx,[pos00] +std +rep movsb + +;shr eax,8 +mov esi,mypath ;filename ;*************PATH AGAIN +add esi,[pos00] +mov byte [esi],al +inc dword [pos00] +call draw_string00 + +no_lit: +jmp fastso_still +;=============================== +shiftback00: +mov edi,mypath ;filename ;******PATH +add edi,[pos00] +mov esi,edi +inc esi +mov ecx,71 ;200 ; count??? +sub ecx,[pos00] +cld +rep movsb +ret + +;****************************************************************************** + +;====button +fbut: +mov eax,17 +int 0x40 +cmp ah,17 +je fast_save +cmp ah,18 +je fast_open +cmp ah,19 +je closethis +jmp fastso_still +;****************************************************************************** +;****************************************************************************** + +fast_open: +call path_copy +call set_title +mov [to_return],1 +call do_load_file +jmp closethis +fast_save: +call path_copy +call save_file +call set_title +;call copy_fpath_s +closethis: +mov [to_return],0 +cmp [error_found],1 +je @f +call activate_main +@@: +mov [error_found],0 +close + + +activate_main: + mov eax,9 + mov ebx,procinfo + mov ecx,[proccount] + @@: + dec ecx + jz @f ; counter=0 => not found? => return + mov eax,9 + int 0x40 + mov edx,[procinfo.PID] + cmp edx,[PID] + jne @b + + ;found: ecx = process_number + mov eax,18 + mov ebx,3 + int 0x40 + + mov eax,5 + mov ebx,eax + int 0x40 + + @@: +ret + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +doyouwannasave: +;****************************************************************************** +cmp [modified],0 +je newfile + mov eax,55 ; beep + mov ebx,eax + mov esi,save_beep1 + int 0x40 + delay 4 + mov eax,55 ; beep + mov ebx,eax + mov esi,save_beep2 + int 0x40 + + mov eax,13 + mov ebx,150*65536+200 + mov ecx,100*65536+70 + mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 + int 0x40 + +mov eax,38 +mov ebx,150*65536+350 +mov ecx,100*65536+100 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,150*65536+350 +mov ecx,170*65536+170 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,150*65536+150 +mov ecx,100*65536+170 +mov edx,cl_White +int 0x40 +mov eax,38 +mov ebx,350*65536+350 +mov ecx,100*65536+170 +mov edx,cl_White +int 0x40 + + + putlabel 190,120,'Сохранить документ?',cl_White + + drawlbut 170,140,30,15,'Да',46,[sc.work_button],cl_White + drawlbut 230,140,30,15,'Нет',45,[sc.work_button],cl_White + drawlbut 290,140,45,15,'Отмена',47,[sc.work_button],cl_White + + mov [exit_wnd_on],1 + jmp still +;------------- +newfile: +;if filename is not NEWDOC## than change it to it! +mov eax,dword [orig_filename] +cmp dword [filename],eax ;[orig_filename] +je @f + cld + mov esi,orig_filename + mov edi,filename + mov ecx,71 ;50 + rep movsb + mov edi,filename + mov ecx,71 ;50 + xor eax,eax + repne scasb + sub edi,filename + dec edi + mov [filename_len],edi + +@@: + +call change_fname +call set_title +call draw_window_for_dialogs +call empty_work_space +mov [lines],1 +jmp do_load_file.restorecursor + +change_fname: +cmp [filename+7],'9' +jne addfname +cmp [filename+6],'9' +je error_creating_new_file +mov [filename+7],'0' +add [filename+6],0x1 +jmp leavenow +addfname: +add [filename+7],0x1 +leavenow: +ret + +set_title: + cmp [error2_found],1 + je no_set_title + mov esi, filename + mov edi, header + mov ecx, [filename_len] + mov eax, ecx + add eax, 10 + mov [headlen], eax + cld + rep movsb + + mov [edi], dword ' - ' + add edi, 3 + mov esi, htext + mov ecx, htext.size + rep movsb + + call drawwindow +no_set_title: +mov [error2_found],0 +ret + +draw_window_for_dialogs: +call clear_screen +call drawwindow +ret + +copy_fpath: +call mask_events +call path_copy +call set_title +call draw_window_for_dialogs +jmp do_load_file + +copy_fpath_s: +call mask_events +call path_copy +call save_file +call set_title +call draw_window_for_dialogs +jmp still + +path_copy: + cld + mov esi,mypath + mov edi,filename + mov ecx,250 ;71 ;50 + rep movsb + mov edi,filename + mov ecx,250 ;71 ;50 + xor eax,eax + repne scasb + sub edi,filename + dec edi + mov [filename_len],edi +ret + +openerror: +mov eax,360 +mov ebx,openerrtext +mov ecx,1 +call alert_box + +cmp [to_return2],1 +jne jmp_to_still +mov [to_return2],0 +mov [error_found],1 +call mask_events + +ret + +saveerror: +mov eax,390 +mov ebx,saveerrtext +mov ecx,1 +call alert_box +cmp [to_return2],0 +je jmp_to_still +mov [to_return2],0 +mov [error_found],1 +call mask_events +ret +;jmp still +jmp_to_still: +call mask_events +jmp still + +error_creating_new_file: +mov eax,200 +mov ebx,newfileerror +mov ecx,1 +call alert_box +jmp still + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;MENU;;;;;;;;;;;;;;;;;;;;;; +draw_win_menu: + +;mov eax,8 +;mov ebx,145*65536+276 +;mov ecx,22*65536+15 +;mov edx,00100000000000000000000000001111b +;mov esi,0x00aaaaaa +;int 0x40 + +mov eax,13 +mov ebx,5*65536+497 +mov ecx,22*65536+17 +mov edx,[sc.work_graph] ;0x00999999 +int 0x40 +mov ecx,39*65536+5 +mov edx,0x00aaaaaa +int 0x40 + +drawlbut 5,22,70,15,'Файл',97,[sc.work_button],[sc.work_button_text] +drawlbut 75,22,70,15,'Код',98,[sc.work_button],[sc.work_button_text] +drawlbut 145,22,70,15,'Текст',96,[sc.work_button],[sc.work_button_text] +drawlbut 431,22,70,15,'Справка',99,[sc.work_button],[sc.work_button_text] + +ret + +draw_win_menu_file: +call clear_screen +call drawwindow +;mov eax,13 +;mov ebx,5*65536+71 +;mov ecx,35*65536+90 +;mov edx,[sc.grab_button];0x00999999 +;int 0x40 +;mov eax,38 +;mov ebx,5*65536+35 +;mov ecx,40*65536+47 +;mov edx,0x00ff0000 +;int 0x40 +mov [menu_is_on],1 + +drawlbut 5,38,70,15,'Новое окно',100,[sc.grab_button],[sc.grab_button_text] +drawlbut 5,53,70,15,'Новый',101,[sc.grab_button],[sc.grab_button_text] +drawlbut 5,68,70,15,'Сохранить',2,[sc.grab_button],[sc.grab_button_text] +drawlbut 5,83,70,15,'Сохр. как',102,[sc.grab_button],[sc.grab_button_text] +drawlbut 5,98,70,15,'Открыть',103,[sc.grab_button],[sc.grab_button_text] +drawlbut 5,113,70,15,'Выход',104,[sc.grab_button],[sc.grab_button_text] +jmp still + +draw_win_menu_code: +call clear_screen +call drawwindow +drawlbut 75,38,70,15,'Компил.',10000,[sc.grab_button],[sc.grab_button_text] +drawlbut 75,53,70,15,'Запустить',10001,[sc.grab_button],[sc.grab_button_text] +drawlbut 75,68,70,15,'Доска отл.',10002,[sc.grab_button],[sc.grab_button_text] +drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text] +mov [menu_is_on],1 +jmp still + +draw_win_menu_text: +call clear_screen +call drawwindow +drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text] +drawlbut 145,53,70,15,'Найти',92,[sc.grab_button],[sc.grab_button_text] +drawlbut 145,68,70,15,'Найти далее',50,[sc.grab_button],[sc.grab_button_text] +mov [menu_is_on],1 +jmp still + +new_pad_wnd: +mov eax,19 +mov ebx,tinypad_filename +mov ecx,0 +int 0x40 +jmp still + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +openerrtext db 'Ошибка открытия файла или открытие отменено!',0 +saveerrtext db 'Ошибка сохранения файла или сохранение отменено!',0 +newfileerror db 'Невозможно сохдать новый файл',0 +; ******************** +; ****** DATA ****** +; ******************** +sz fasm_filename, 'FASM ' +sz debug_filename, 'BOARD ' +sz tinypad_filename, 'TINYPAD ' + +lsz sysfuncs_filename,\ + ru, <'SYSFUNCR.TXT',0>,\ + en, <'SYSFUNCS.TXT',0> + +sz setup, 'SETUP ' ; we need to run SETUP to change keyboard layout +param_setup db 'LANG',0 ; parameter for SETUP + + +addr dd filename ; address of input string + +filename_len dd 12 +filename db 'NEWDOC00.TXT' +times 256 db 0;51-12 db 0 +;times db 0 ; я не знаю почему Вилл не поставил эту строчку +orig_filename db 'NEWDOC00.TXT' +rb 256 +search_len dd 5 +search_string db 'still' +times 51-5 db 0 + +case_sens db 0 ; for search function + +align 4 +comment_string: +db ';***************************************' +db '*************************************** ' + + + +; INTERFACE DATA: + + +sz htext, 'TINYPAD' +;sz toolbar_btn_text, 'COMPILE RUN BOARD SYSFUNC' + + +searcht: +if lang eq ru + db ' СТРОКА > ' + db ' ПОИСК ' +else + db ' STRING > ' + db ' SEARCH ' +end if +searchtl: + + +htext2: +if lang eq ru + db ' ПОЗИЦИЯ 00:00000 ДЛИНА 00000 СТРОК ' +else + db 'POSITION 00:00000 LENGTH 00000 LINES ' +end if +htextlen2: + +help_text: +if lang eq ru + db ' КОМАНДЫ: ' + db ' ' + db ' CTRL+F1 : Это окно ' + db ' CTRL+S : Первая строка для копирования ' + db ' CTRL+E : Последняя строка для копирования ' + db ' CTRL+P : Вставить выбранное на текущую позицию ' + db ' CTRL+D : Удалить строку ' + db ' CTRL+L : Вставить строку-разделитель ' + db ' CTRL+[ : Перейти в начало файла ' + db ' CTRL+] : Перейти в конец файла ' + db ' CTRL+F2 : Загрузить файл ' + db ' CTRL+F3 : Поиск ' + db ' CTRL+F4 : Сохранить файл ' + db ' CTRL+F5 : Сохранить файл как... ' + db ' CTRL+F6 : Ввести строку для поиска ' + db ' CTRL+F7 : "Окно быстрого сохранения и загрузки" ' + db ' CTRL+F8 : Сменить раскладку клавиатуры ' + db ' CTRL+F9 : Компилировать файл ' + db ' CTRL+F10 : Компилировать и запустить ' + db ' F12 : Запустить доску отладки ' + db 'x' +else + db ' COMMANDS: ' + db ' ' + db ' CTRL+F1 : SHOW THIS WINDOW ' + db ' CTRL+S : SELECT FIRST STRING TO COPY ' + db ' CTRL+E : SELECT LAST STRING TO COPY ' + db ' CTRL+P : PASTE SELECTED TO CURRENT POSITION ' + db ' CTRL+D : DELETE CURRENT LINE ' + db ' CTRL+L : INSERT SEPARATOR LINE ' + db ' CTRL+[ : GO TO THE BEGINNING OF FILE ' + db ' CTRL+] : GO TO THE END OF FILE ' + db ' CTRL+F2 : LOAD FILE ' + db ' CTRL+F3 : SEARCH ' + db ' CTRL+F4 : SAVE FILE ' + db ' CTRL+F5 : SAVE FILE AS... ' + db ' CTRL+F6 : ENTER SEARCH STRING ' + db ' CTRL+F7 : DRAW "FAST SAVE AND OPEN" WINDOW ' + db ' CTRL+F8 : CHANGE KEYBOARD LAYOUT ' + db ' CTRL+F9 : COMPILE FILE ' + db ' CTRL+F10 : RUN OUTFILE ' + db ' F12 : OPEN DEBUG BOARD ' + db 'x' +end if + +help_wnd_header: +if lang eq ru + db 'ПОМОЩЬ',0 +else + db 'TINYPAD HELP',0 +end if + +hlphead_len = $ - help_wnd_header + +save_yes_no: +if lang eq ru + db 'Сохранить файл перед выходом?',0 +else + db 'Save file before exit?',0 +end if + +VScroll_1: + dw 13 ;width +0 + dw 489 ;x +2 + dw 341 ;326 ;height +4 + dw 43 ;y +6 + dd 0 ;min +8 + dd 100 ;scrl_max ;lines ;max +12 + dd 0 ;cur_pos ;current +16 + dd 1 ;small change +20 + dd 10 ;big change +24 + +App_Controls: + dd VScroll_1 , drawvscroll, VScroll_mouse_over ; + dd 0,0,0 ;last control do not delete + +; END OF INTERFACE DATA + +symbols db '%#&*\:/<>|{}()[]=+-,. ' + +error_beep: + db 0xA0,0x30,0 +save_beep1: + db 0x84,0x43,0 +save_beep2: + db 0x84,0x48,0 + + +align 4 +fileinfo_read: + dd 0 + dd 0 + dd 300000/512 + dd 0x10000 + dd 0x70000 +pathfile_read: + times 250 db 0 ;51 db 0 + +align 4 +fileinfo_write: + dd 1 + dd 0 + dd 0 + dd 0x10000 + dd 0x70000 +pathfile_write: + times 250 db 0 ; 51 db 0 + +align 4 + +temp dd 0xabc ; used in read_string +d_status dd 0 + +color_tbl: + dd 0x00000000 ; text + dd 0x00000000 ; instruction + dd 0x00000000 ; register + dd 0x00009000 ; number + dd 0x00a00000 ; quote + dd 0x00909090 ; comment + dd 0x003030f0 ; symbol + + +next_not_quote2 db 0 ; " +next_not_quote db 0 ; ' +quote db 0 +asm_mode db 0 ; ASM highlight? +tmpabc db 0 + + +I_PARAM db 0 ; parameters are HERE - параметры будут начинаться ЗДЕСЬ! +TINYPAD_END: ; end of file + + +; Uninitialised data +; Неинициализированные данные +align 4 + +posx dd ? ; x на экране (on the screen) +posy dd ? ; y на экране +post dd ? ; смещение от начала - offset +posl dd ? +lines dd ? ; количество строк в документе +posxm dd ? +posym dd ? + +dstart dd ? ; смещение по оси y для отрисовки кнопок и др. + +filelen dd ? ; длина файла + +PID dd ? ; идентификатор процесса +proccount dd ? ; количество процессов + +filesize dd ? ; размер файла +ya dd ? ; для read_string +slines dd ? ; number of strings on the screen - количество строк на экране + +run_outfile dd ? ; for FASM +copy_start dd ? ; Ctrl+S +copy_count dd ? ; Ctrl+E +headlen dd ? ; header length +do_not_draw dd ? ; to draw or not to draw - this is a serious question ;) + +MainWndClosed dd ? +sc system_colors + +to_return db 0 +to_return2 db 0 +error_found db 0 +error2_found db 0 + +header: ; window header - заголовок окна +rb 256 + +; информация о процессе записывается в эту структуру +procinfo process_information + +virtual at procinfo +fasm_parameters rb 256 +end virtual +pos00 dd 0 +newdoc db ? +mypath: +times 258 db 0 +real_posy dd 0 +vscroll_size dd 0 +vscroll_pos dd 0 +cur_pos dd 0 +scrl_max dd 100 + +mouse_x dd 0 +mouse_y dd 0 +mousey dw 0 +mousex dw 0 +mouseb dd 0 + +num_goto_string dd 0 + +menu_is_on db 0 +exit_wnd_on db 0 +modified db 0 +;fast save n open stack +rb 1024 +so_stack: +;growing down +; the end! + +