Compare commits

...

46 Commits

Author SHA1 Message Date
4ff3024108 Convert initial libunicode into library structure
Edit the example file to reflect the changes
2026-03-18 02:15:50 +05:30
8de745c811 Add initial libunicode for UTF-8 parsing and example
- Added libunicode.asm to parse UTF-8 strings.
- Implemented count_utf8_codepoints to skip continuation bytes.
- Implemented count_utf8_graphemes to handle ZWJ (E2 80 8D) and combining marks (CC/CD).
- Added console.asm to the examples folder to test and print the results.
- Submitted for GSoC qualification task.
2026-03-15 23:22:08 +05:30
4c359e42ce loaddrv: Updated error message on invalid args passed (#364)
Added a usage line and changed the wording slightly to be more clear in the expected arguments.

Co-authored-by: Aditya Yellapuntula Venkata <aditya.yellapuntulavenkata@doosan.com>
Reviewed-on: KolibriOS/kolibrios#364
Reviewed-by: Burer <burer@noreply.localhost>
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: Aditya Yellapuntula Venkata <adityayv802@gmail.com>
Co-committed-by: Aditya Yellapuntula Venkata <adityayv802@gmail.com>
2026-03-14 16:49:33 +00:00
3238f9f485 apps/cedit: use numeric version instead of date (fix #329) (#361)
Replace hardcoded date "CEdit (11-jan-2026)" with version "CEdit 1.0"

Add separate VERSION and APPNAME constants for better maintainability

Fixes issue [#329](KolibriOS/kolibrios#329)

Reviewed-on: KolibriOS/kolibrios#361
Reviewed-by: Burer <burer@noreply.localhost>
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: jaskaran-singh-77 <jassijatt951@gmail.com>
Co-committed-by: jaskaran-singh-77 <jassijatt951@gmail.com>
2026-03-14 10:46:08 +00:00
Igor Shutrov
289eabf8a4 cedit: add Shift+Tab shortcut (#318)
Add Shift+Tab shortcut to decrease indentation

Reviewed-on: KolibriOS/kolibrios#318
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: Igor Shutrov <kolibridev@inbox.ru>
Co-committed-by: Igor Shutrov <kolibridev@inbox.ru>
2026-03-12 13:47:42 +00:00
e818e2167f apps/reshare: rewrite to fasm (#305)
- Rewritten to FASM (rgimad);
- Refactored code;
- Tweaked UX/UI;
- Fit program RAM usage into 1 MB (#make_8mb_great_again):
  https://wiki.kolibrios.org/wiki/SystemRequirements;
- Fit program window with default skin into 800x600;
- Use proper prefixes for debug messages.

Reviewed-on: KolibriOS/kolibrios#305
Reviewed-by: Ivan B <dunkaist@noreply.localhost>
Co-authored-by: Burer <burer@kolibrios.org>
Co-authored-By: rgimad <rgimad@kolibrios.org>
Co-committed-by: Burer <burer@kolibrios.org>
2026-03-11 20:59:35 +03:00
Igor Shutrov
42c205be32 heed: Add exit by ESC (#345)
Reviewed-on: KolibriOS/kolibrios#345
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: Igor Shutrov <kolibridev@inbox.ru>
Co-committed-by: Igor Shutrov <kolibridev@inbox.ru>
2026-03-11 12:21:47 +00:00
0253ec8753 Rename icons16.png to icons18.png and update all refs (#350)
Fixed #349.

Reviewed-on: KolibriOS/kolibrios#350
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: hrigar <h4gar02@protonmail.com>
Co-committed-by: hrigar <h4gar02@protonmail.com>
2026-03-11 13:12:31 +03:00
91dc4d8cad libc.obj: Added strtok_r (#341)
Reviewed-on: KolibriOS/kolibrios#341
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: Egor00f <y.yarin@inbox.ru>
Co-committed-by: Egor00f <y.yarin@inbox.ru>
2026-03-08 00:36:53 +03:00
6f2a947deb Remove broken unused and unfinished apps and libs
- TEAtool: A useless utility for encryption with the TEA algorithm,
  written for fun by me during my school years;
- GameHack: not a working prototype of a program like Cheat Engine;
- microtar: port of a portable library with a reduced functionality
  for working with TAR in C that is not used

Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-03-07 20:19:00 +00:00
735b86c476 piano: refactoring and improvement (#302)
- Refactored source code;
- Added Spanish translation;
- Updated UX / UI;
- Updated keyboard layout (fix #25);
- Added keymap configuration via separate binary file.

Reviewed-on: KolibriOS/kolibrios#302
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: Burer <burer@kolibrios.org>
Co-authored-by: Doczom <mixa.frolov2003@gmail.com>
Co-authored-by: qullarwee <unknown@domain.local>
Co-committed-by: Burer <burer@kolibrios.org>
2026-03-07 23:13:08 +03:00
cc1034d849 fb2reader: add to oberon07 build system (#343)
Part of issue #328

Reviewed-on: KolibriOS/kolibrios#343
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: hrigar <h4gar02@protonmail.com>
Co-committed-by: hrigar <h4gar02@protonmail.com>
2026-02-26 20:55:58 +00:00
06c1497624 system/docs: update docs and SF constants to match actual kernel (#306)
- Update sysfuncs.txt and sysfuncr.txt to match actual kernel code:
  - Add missing SF's info
  - Add missing constants
  - Fix some mistakes
- Update KOSfuncs.inc to match actual kernel code:
  - Remove obsolete constants
  - Add missing constants
  - Rename some constants to match their names in docs

Reviewed-on: KolibriOS/kolibrios#306
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: Burer <burer@kolibrios.org>
Co-committed-by: Burer <burer@kolibrios.org>
2026-02-26 17:25:16 +00:00
b52da3e1c3 koldbg: use shared KOSfuncs definitions
Signed-off-by: hrigar <h4gar02@protonmail.com>
2026-02-25 01:05:45 +05:30
Igor Shutrov
f9425f5bd0 ftpd: Add help command 2026-02-23 21:18:26 +00:00
864210679c oberon07: Option -nochk a by default
This option disables runtime checks to reduce binary file size.

Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-02-21 19:22:11 +00:00
7f8e028ffd ci/cd: Added checkout of submodules
Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-02-21 19:22:11 +00:00
e9b6cf3fc9 cedit: Added to build system
Fixed installation of oberon07 compiler in ISO image

Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-02-21 19:22:11 +00:00
4658a928d4 oberon07: Added as a git submodule
Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-02-21 19:22:11 +00:00
b6a5171cd9 oberon07: Source code removed
Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-02-21 19:22:11 +00:00
Igor Shutrov
668fd4deeb ftpd: add ip to first message 2026-02-17 22:08:04 +05:00
dd9a7b92d8 libc.obj: Fixed build skip with TCC build enabled
Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-01-28 17:22:54 +03:00
Igor Shutrov
1173ca7b26 Cedit: Improve search panel (#313)
Улучшения для Cedit в Панели поиска:
- Добавлен поиск следующего фрагмента текста по нажатию Enter
- Добавлен обратный переход по полям ввода в Панели поиска по Shift-Tab

Co-authored-by: Igor Shutrov <igor@shutrov.ru>
Reviewed-on: KolibriOS/kolibrios#313
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: Igor Shutrov <kolibridev@inbox.ru>
Co-committed-by: Igor Shutrov <kolibridev@inbox.ru>
2026-01-18 16:28:46 +00:00
ccd0c183ec mtdbg: Backtrace implemented (#315)
Added support for backtrace/stacktrace output.
This is useful for high-level languages ​​like C and Oberon07.
If a debug file is provided, searches for the nearest debug symbol.

Reviewed-on: KolibriOS/kolibrios#315
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Burer <burer@noreply.localhost>
2026-01-18 13:08:02 +00:00
f065cc6e69 mtdbg: Fixed magic cmd flags
Signed-off-by: Max Logaev <maxlogaev@proton.me>
2026-01-11 13:35:58 +00:00
f1b99bad84 libc.obj: Added missing strpbrk() to EXPORTS (#310)
Reviewed-on: KolibriOS/kolibrios#310
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: Егор <velikiydolbayeb@gmail.com>
Co-committed-by: Егор <velikiydolbayeb@gmail.com>
2026-01-10 23:27:51 +00:00
igorsh
c580d4ac5b ftpd: Add XPWD and XCWD commands (#309)
Добавлены команды XPWD и XCWD, дублирующие PWD и CWD

Co-authored-by: Igor Shutrov <igor@shutrov.ru>
Co-authored-by: Burer <burer@kolibrios.org>
Reviewed-on: KolibriOS/kolibrios#309
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: igorsh <kolibridev@inbox.ru>
Co-committed-by: igorsh <kolibridev@inbox.ru>
2026-01-08 17:03:23 +00:00
Igor Shutrov
17c33521c3 ftpd: Fix typo 2026-01-07 19:41:28 +00:00
Igor Shutrov
f6395c9501 ftpd: Fix typo 2026-01-07 19:41:28 +00:00
Igor Shutrov
000288ce8b ftpd: Fix RETR for small and empty files 2026-01-06 18:20:39 +00:00
10d9e9f36f Info3ds: added resizing of the window with the figure (#241)
info3ds: added resizing of the window with the figure
and the list of vertices in the properties window,

info3ds, info3ds_u: files with menu icons are embedded into the program

Reviewed-on: KolibriOS/kolibrios#241
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: IgorA <aie85playm@gmail.com>
Co-committed-by: IgorA <aie85playm@gmail.com>
2025-12-31 07:34:00 +00:00
f4c4a7e29a apps/floppybird: rewrite to c (#284)
What was done:
- [x] Rewritten to C
- [x] Refactored some code
- [x] Fixed window resizing (#182)
- [x] Adaptation for different skin height
- [x] Fixed some tubes leftovers drawing
- [x] Changed tubes generation a little bit
- [x] Changed interface a little bit
- [x] Added Escape key for exit to main menu
- [x] Removed buttons from main menu (hotkeys left) :(

What needs to be done:
- [ ] ~~Fix rolled-up bug?~~
- [ ] ~~Fit it into 2048 bytes?~~
- [ ] ~~Add pause?~~
- [ ] ~~Use buffer for drawing without flickering?~~

P.S. There is no way game with all this changes will fit in 2560 bytes, as previous version, so I decided to skip them.

Reviewed-on: KolibriOS/kolibrios#284
Reviewed-by: Ivan B <dunkaist@noreply.localhost>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: Burer <burer@kolibrios.org>
Co-committed-by: Burer <burer@kolibrios.org>
2025-12-29 06:34:23 +00:00
Igor Shutrov
bc5b2f884a Remove redundant space before 220 code 2025-12-29 06:32:40 +00:00
manh-td
d0de275ab3 Use 64 bit for times in mpeg4_encode_gop_header() 2025-12-20 11:01:45 +00:00
manh-td
a83f6f7e4b Fix DoS due to lack of eof check 2025-12-20 11:00:16 +00:00
manh-td
d54c802297 Fixes out of array access 2025-12-20 10:59:41 +00:00
manh-td
29c42738b8 Add missing check for av_malloc 2025-12-20 10:37:35 +00:00
c17d1a57a3 Correcting typos in C_Layer libini (#289)
Change `int_get_color` to `int_get_shortcut` to `ini_get_color` and `ini_get_shortcut` to fix library initialization.

Reviewed-on: KolibriOS/kolibrios#289
Reviewed-by: Gleb Zaharov <risdeveau@codrs.ru>
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: Егор <egor00f@noreply.localhost>
Co-committed-by: Егор <egor00f@noreply.localhost>
2025-12-14 10:02:43 +00:00
7b0867a6cf [apps/cmm] add new proxy for https sources (#277)
Deployed new https proxy for WebView and Downloader.
Made it configurable through /sys/settings/app.ini.

Reviewed-on: KolibriOS/kolibrios#277
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: Burer <burer@kolibrios.org>
Co-committed-by: Burer <burer@kolibrios.org>
2025-10-17 11:04:08 +02:00
c65da0d96f programs: Add Uxn emulator (#272)
To build this, a zig compiler (tested: 0.14.1) is needed, run `zig build --release=fast`.
It will download https://github.com/chmod222/zuxn when building.

Co-authored-by: 宋文武 <iyzsong@member.fsf.org>
Reviewed-on: KolibriOS/kolibrios#272
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Burer <burer@kolibrios.org>
Co-authored-by: iyzsong <iyzsong@envs.net>
Co-committed-by: iyzsong <iyzsong@envs.net>
2025-10-13 11:52:24 +02:00
a0c01e204e Webview: Fix many typos with the English translation (#282)
- Fixes a few spelling mistakes and rewords things to sound more natural.
- Reworded to sound more natural in English.
- Fixes many typos on the English homepage of WebView.

Reviewed-on: KolibriOS/kolibrios#282
Reviewed-by: Gleb Zaharov <risdeveau@codrs.ru>
Reviewed-by: Burer <burer@noreply.localhost>
Co-authored-by: Talkashie <talkashie97@gmail.com>
Co-committed-by: Talkashie <talkashie97@gmail.com>
2025-10-08 00:12:15 +02:00
d50642ce1f general: Fix brand name to КолибриОС (#280)
- Ensure consistent brand name`КолибриОС`; update Docs and source code. Fixes #6.
- Minimal whitespace clean-up; remove some trailing space from end of lines.

Reviewed-on: KolibriOS/kolibrios#280
Reviewed-by: Burer <burer@noreply.localhost>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: Andrew <dent.ace@gmail.com>
Co-committed-by: Andrew <dent.ace@gmail.com>
2025-09-25 16:39:01 +02:00
8d235ce49b Libraries: fixed a bug in lib_init functions (#274)
added verification of the second initialization attempt

Reviewed-on: KolibriOS/kolibrios#274
2025-08-02 18:00:18 +02:00
e423bfb2d1 CtrlDemo: code cleaning, library import optimization (#242)
CtrlDemo, EditboxEx, TooltipDemo:
- code cleaning, library import optimization

Reviewed-on: KolibriOS/kolibrios#242
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Ivan B <dunkaist@noreply.localhost>
Co-authored-by: IgorA <aie85playm@gmail.com>
Co-committed-by: IgorA <aie85playm@gmail.com>
2025-07-14 08:49:18 +02:00
1483ec8462 Libraries (box_lib, buf2d, libimg, tinygl): optimize function import (#231)
Libraries (box_lib, buf2d, libimg, tinygl): optimize function import

Programs updated:
- gears, test3, test_glu1, test_glu2,
- test_array1, textures0, textures1, textures2,
- ctrldemo, editbox_ex, crypt_files, img_transform,
- scrshoot, t_edit, cnc_control, cnc_editor

Reviewed-on: KolibriOS/kolibrios#231
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Ivan B <dunkaist@noreply.localhost>
Co-authored-by: IgorA <aie85playm@gmail.com>
Co-committed-by: IgorA <aie85playm@gmail.com>
2025-07-14 08:20:32 +02:00
e8121c66f8 drivers/usb: add usbother driver and usbdrv.dat config (#253)
This driver loading usb drivers for class and for vendor and product id device.

Co-authored-by: Burer <burer@kolibrios.org>
Reviewed-on: KolibriOS/kolibrios#253
Reviewed-by: Ivan B <dunkaist@noreply.localhost>
Reviewed-by: Burer <burer@noreply.localhost>
2025-07-12 03:31:44 +02:00
244 changed files with 7333 additions and 42707 deletions

View File

@@ -29,6 +29,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Get describe

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "programs/develop/oberon07"]
path = programs/develop/oberon07
url = https://github.com/AntKrotov/oberon-07-compiler.git

View File

@@ -31,8 +31,8 @@ import lib_libini, \
LIBINI_enum_keys , 'ini_enum_keys' , \
LIBINI_get_str , 'ini_get_str' , \
LIBINI_get_int , 'ini_get_int' , \
LIBINI_get_color , 'int_get_color' , \
LIBINI_get_shortcut , 'int_get_shortcut' , \
LIBINI_get_color , 'ini_get_color' , \
LIBINI_get_shortcut , 'ini_get_shortcut' , \
LIBINI_set_str , 'ini_set_str' , \
LIBINI_set_int , 'ini_set_int' , \
LIBINI_set_color , 'ini_set_color'

View File

@@ -864,7 +864,7 @@ void ff_set_mpeg4_time(MpegEncContext * s){
}
static void mpeg4_encode_gop_header(MpegEncContext * s){
int hours, minutes, seconds;
int64_t hours, minutes, seconds;
int64_t time;
put_bits(&s->pb, 16, 0);

View File

@@ -2035,8 +2035,13 @@ static int vp3_decode_frame(AVCodecContext *avctx,
if (ff_thread_get_buffer(avctx, &s->current_frame, AV_GET_BUFFER_FLAG_REF) < 0)
goto error;
if (!s->edge_emu_buffer)
if (!s->edge_emu_buffer) {
s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.f->linesize[0]));
if (!s->edge_emu_buffer) {
ret = AVERROR(ENOMEM);
goto error;
}
}
if (s->keyframe) {
if (!s->theora)

View File

@@ -2580,8 +2580,10 @@ static int http_receive_data(HTTPContext *c)
} else if (c->buffer_ptr - c->buffer >= 2 &&
!memcmp(c->buffer_ptr - 1, "\r\n", 2)) {
c->chunk_size = strtol(c->buffer, 0, 16);
if (c->chunk_size == 0) // end of stream
if (c->chunk_size <= 0) { // end of stream or invalid chunk size
c->chunk_size = 0;
goto fail;
}
c->buffer_ptr = c->buffer;
break;
} else if (++loop_run > 10)
@@ -2603,6 +2605,7 @@ static int http_receive_data(HTTPContext *c)
/* end of connection : close it */
goto fail;
else {
av_assert0(len <= c->chunk_size);
c->chunk_size -= len;
c->buffer_ptr += len;
c->data_count += len;

View File

@@ -267,8 +267,12 @@ static int cine_read_header(AVFormatContext *avctx)
/* parse image offsets */
avio_seek(pb, offImageOffsets, SEEK_SET);
for (i = 0; i < st->duration; i++)
for (i = 0; i < st->duration; i++) {
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
av_add_index_entry(st, avio_rl64(pb), i, 0, 0, AVINDEX_KEYFRAME);
}
return 0;
}

View File

@@ -5,7 +5,7 @@ diamond'ом. Она используется в проектах xonix и fara
Kolibri-программу. Утилита всего лишь изменяет формат exe-шника, так что,
чтобы действительно получилась работающая программа, нужно выполнение
определённых условий. Понятно, что требуется, чтобы программа общалась
с внешним миром средствами Колибри (т.е. int 0x40) и не использовала
с внешним миром средствами КолибриОС (т.е. int 0x40) и не использовала
никаких Windows-библиотек. Помимо этого, требуется также, чтобы программа
размещалась по нулевому адресу (ключ линкера "/base:0"). Как писать такие
программы - смотрите в уже упомянутых проектах xonix и fara.

View File

@@ -25,11 +25,10 @@ img_files = {
{"MACROS.INC", SRC_PROGS .. "/macros.inc"},
-- {"CONFIG.INC", SRC_PROGS .. "/config.inc"},
{"STRUCT.INC", SRC_PROGS .. "/struct.inc"},
{"FB2READ", "common/fb2read"},
{"ALLGAMES", "common/allgames"},
{"HOME.PNG", "common/wallpapers/T_Home.png"},
{"ICONS32.PNG", "common/icons32.png"},
{"ICONS16.PNG", "common/icons16.png"},
{"ICONS18.PNG", "common/icons18.png"},
{"INDEX.HTM", "common/index_htm"},
{"KUZKINA.MID", "common/kuzkina.mid"},
{"SINE.MP3", "common/sine.mp3"},
@@ -38,7 +37,6 @@ img_files = {
{"UNIMG", SRC_PROGS .. "/fs/unimg/unimg"},
{"3D/HOUSE.3DS", "common/3d/house.3ds"},
{"File Managers/ICONS.INI", "common/File Managers/icons.ini"},
{"GAMES/FLPYBIRD", SRC_PROGS .. "/games/floppybird/Release/floppybird"},
{"FONTS/TAHOMA.KF", "common/fonts/tahoma.kf"},
-- {"LIB/ICONV.OBJ", "common/lib/iconv.obj"},
{"LIB/KMENU.OBJ", "common/lib/kmenu.obj"},
@@ -69,6 +67,7 @@ img_files = {
{"SETTINGS/SYSTEM.INI", "common/settings/system.ini"},
{"SETTINGS/TASKBAR.INI", "common/settings/taskbar.ini"},
{"SETTINGS/SYSTEM.ENV", "common/settings/system.env"},
{"SETTINGS/USBDRV.DAT",VAR_DRVS .. "/usb/usbother/usbdrv.dat"},
}
-- For russian build, add russian-only files.
@@ -152,9 +151,6 @@ extra_files = {
{"HD_Load/USB_boot_old/", SRC_PROGS .. "/hd_load/usb_boot_old/usb_boot_866.txt"},
{"HD_Load/USB_boot_old/", SRC_PROGS .. "/hd_load/usb_boot_old/usb_boot_1251.txt"},
{"kolibrios/3D/info3ds/INFO3DS.INI", SRC_PROGS .. "/develop/info3ds/info3ds.ini"},
{"kolibrios/3D/info3ds/OBJECTS.PNG", SRC_PROGS .. "/develop/info3ds/objects.png"},
{"kolibrios/3D/info3ds/TOOLBAR.PNG", SRC_PROGS .. "/develop/info3ds/toolbar.png"},
{"kolibrios/3D/info3ds/FONT8X9.BMP", SRC_PROGS .. "/fs/kfar/trunk/font8x9.bmp"},
{"kolibrios/3D/blocks/blocks.kex", "../programs/bcc32/games/blocks/bin/blocks.kex"},
{"kolibrios/3D/blocks/models/", "../programs/bcc32/games/blocks/models/*"},
{"kolibrios/3D/md2view/", "common/3d/md2view/*"},
@@ -179,10 +175,15 @@ extra_files = {
{"kolibrios/develop/c--/manual_c--.htm", SRC_PROGS .. "/cmm/c--/manual_c--.htm"},
{"kolibrios/develop/fpc/", "common/develop/fpc/*"},
{"kolibrios/develop/fpc/examples/", "../programs/develop/fp/examples/src/*"},
{"kolibrios/develop/oberon07/", "../programs/develop/oberon07/*"},
{"kolibrios/develop/oberon07/doc/", "../programs/develop/oberon07/doc/*"},
{"kolibrios/develop/oberon07/lib/KolibriOS/", "../programs/develop/oberon07/lib/KolibriOS/*"},
{"kolibrios/develop/oberon07/samples/", SRC_PROGS .. "/develop/oberon07/samples/*"},
{"kolibrios/develop/oberon07/compiler.kex", SRC_PROGS .. "/develop/oberon07/Compiler.kex"},
{"kolibrios/develop/oberon07/LICENSE", SRC_PROGS .. "/develop/oberon07/LICENSE"},
{"kolibrios/develop/oberon07/doc/CC.txt", SRC_PROGS .. "/develop/oberon07/doc/CC.txt"},
{"kolibrios/develop/oberon07/doc/KOSLib.txt", SRC_PROGS .. "/develop/oberon07/doc/KOSLib.txt"},
{"kolibrios/develop/oberon07/doc/x86.txt", SRC_PROGS .. "/develop/oberon07/doc/x86.txt"},
{"kolibrios/develop/oberon07/doc/Oberon07.Report_2016_05_03.pdf", SRC_PROGS .. "/develop/oberon07/doc/Oberon07.Report_2016_05_03.pdf"},
{"kolibrios/develop/oberon07/lib/KolibriOS/", SRC_PROGS .. "/develop/oberon07/lib/KolibriOS/*"},
{"kolibrios/develop/oberon07/lib/Math/", SRC_PROGS .. "/develop/oberon07/lib/Math/*"},
{"kolibrios/develop/oberon07/samples/", SRC_PROGS .. "/develop/oberon07/samples/KolibriOS/*"},
{"kolibrios/develop/tcc/lib/", SRC_PROGS .. "/develop/ktcc/trunk/bin/lib/*"},
{"kolibrios/develop/tcc/include/", SRC_PROGS .. "/develop/ktcc/trunk/libc.obj/include/*"},
{"kolibrios/develop/tcc/include/clayer/", SRC_PROGS .. "/develop/ktcc/trunk/libc.obj/include/clayer/*"},
@@ -204,6 +205,7 @@ extra_files = {
{"kolibrios/emul/chip8/roms/", SRC_PROGS .. "/emulator/chip8/roms/*"},
{"kolibrios/emul/kwine/kwine", SRC_PROGS .. "/emulator/kwine/bin/kwine"},
{"kolibrios/emul/kwine/lib/", SRC_PROGS .. "/emulator/kwine/bin/lib/*"},
{"kolibrios/emul/uxn", SRC_PROGS .. "/emulator/uxn/uxn"},
{"kolibrios/emul/uarm/", "common/emul/uarm/*"},
{"kolibrios/emul/zsnes/", "common/emul/zsnes/*"},
{"kolibrios/games/BabyPainter", "common/games/BabyPainter"},
@@ -403,8 +405,9 @@ tup.append_table(img_files, {
{"@MENU", VAR_PROGS .. "/system/menu/trunk/menu"},
{"@NOTIFY", VAR_PROGS .. "/system/notify3/notify"},
{"@OPEN", VAR_PROGS .. "/system/open/open"},
{"@TASKBAR", VAR_PROGS .. "/system/taskbar/trunk/TASKBAR"},
{"@RESHARE", VAR_PROGS .. "/system/reshare/reshare"},
{"@SS", VAR_PROGS .. "/system/scrsaver/scrsaver"},
{"@TASKBAR", VAR_PROGS .. "/system/taskbar/trunk/TASKBAR"},
{"@VOLUME", VAR_PROGS .. "/media/volume/volume"},
{"HACONFIG", VAR_PROGS .. "/other/ha/HACONFIG"},
{"ACLOCK", VAR_PROGS .. "/demos/aclock/aclock"},
@@ -469,7 +472,6 @@ tup.append_table(img_files, {
{"DEMOS/ZEROLINE", VAR_PROGS .. "/demos/zeroline/trunk/zeroline"},
{"DEVELOP/BOARD", VAR_PROGS .. "/system/board/trunk/board"},
{"DEVELOP/DBGBOARD", VAR_PROGS .. "/system/dbgboard/dbgboard"},
{"DEVELOP/CEDIT", SRC_PROGS .. "/develop/cedit/CEDIT"},
{"DEVELOP/CHARSETS", VAR_PROGS .. "/develop/charsets/charsets"},
{"DEVELOP/COBJ", VAR_PROGS .. "/develop/cObj/trunk/cObj"},
{"DEVELOP/ENTROPYV", VAR_PROGS .. "/develop/entropyview/entropyview"},
@@ -531,6 +533,7 @@ tup.append_table(img_files, {
{"MEDIA/MP3INFO", VAR_PROGS .. "/media/mp3info/mp3info"},
{"MEDIA/PALITRA", VAR_PROGS .. "/media/palitra/trunk/palitra"},
{"MEDIA/PIANO", VAR_PROGS .. "/media/piano/piano"},
{"MEDIA/PIANO.MAP", VAR_PROGS .. "/media/piano/piano.map"},
{"MEDIA/STARTMUS", VAR_PROGS .. "/media/startmus/trunk/STARTMUS"},
{"NETWORK/PING", VAR_PROGS .. "/network/ping/ping"},
{"NETWORK/NETCFG", VAR_PROGS .. "/network/netcfg/netcfg"},
@@ -567,6 +570,7 @@ tup.append_table(img_files, {
{"DRIVERS/OHCI.SYS", VAR_DRVS .. "/usb/ohci.sys"},
{"DRIVERS/EHCI.SYS", VAR_DRVS .. "/usb/ehci.sys"},
{"DRIVERS/USBHID.SYS", VAR_DRVS .. "/usb/usbhid/usbhid.sys"},
{"DRIVERS/USBOTHER.SYS",VAR_DRVS .. "/usb/usbother/usbother.sys"},
{"DRIVERS/USBSTOR.SYS", VAR_DRVS .. "/usb/usbstor.sys"},
{"DRIVERS/RDC.SYS", VAR_DRVS .. "/video/rdc.sys"},
{"DRIVERS/COMMOUSE.SYS", VAR_DRVS .. "/mouse/commouse.sys"},
@@ -662,7 +666,6 @@ end -- tup.getconfig('NO_JWASM') ~= 'full'
-- Programs that require C-- to compile.
if tup.getconfig('NO_CMM') ~= 'full' then
tup.append_table(img_files, {
{"@RESHARE", VAR_PROGS .. "/cmm/misc/reshare.com"},
{"APP_PLUS", VAR_PROGS .. "/cmm/app_plus/app_plus.com"},
{"EASYSHOT", VAR_PROGS .. "/cmm/misc/easyshot.com"},
{"MOUSECFG", VAR_PROGS .. "/cmm/mousecfg/mousecfg.com"},
@@ -722,6 +725,8 @@ tup.append_table(img_files, {
{"NETWORK/WHOIS", VAR_PROGS .. "/network/whois/whois"},
{"SHELL", VAR_PROGS .. "/system/shell/shell"},
{"GAMES/DINO", VAR_PROGS .. "/games/dino/dino"},
{"GAMES/FLPYBIRD", VAR_PROGS .. "/games/flpybird/flpybird"},
{"LIB/LIBC.OBJ", VAR_PROGS .. "/develop/ktcc/trunk/libc.obj/source/libc.obj"},
})
tup.append_table(extra_files, {
{"kolibrios/utils/thashview", VAR_PROGS .. "/other/TinyHashView/thashview"},
@@ -730,7 +735,6 @@ tup.append_table(extra_files, {
{"kolibrios/develop/TinyBasic/TinyBasic", VAR_PROGS .. "/develop/tinybasic-1.0.4/tinybasic"},
{"kolibrios/develop/TinyBasic/bas/", SRC_PROGS .. "/develop/tinybasic-1.0.4/bas/*"},
{"kolibrios/develop/TinyBasic/TinyBasic.man", SRC_PROGS .. "/develop/tinybasic-1.0.4/doc/tinybasic.man"},
-- {"kolibrios/utils/teatool", VAR_PROGS .. "/other/TEAtool/teatool"},
{"kolibrios/utils/passwordgen", VAR_PROGS .. "/other/PasswordGen/passwordgen"},
{"kolibrios/utils/kruler", VAR_PROGS .. "/other/kruler/kruler"},
{"kolibrios/media/qr_tool", SRC_PROGS .. "/media/qr_tool/qr_tool"},
@@ -740,14 +744,20 @@ tup.append_table(extra_files, {
})
end -- tup.getconfig('NO_TCC') ~= 'full'
-- Programs that require oberon07 compiler.
if tup.getconfig('NO_OB07') ~= 'full' then
tup.append_table(img_files, {
{"DEVELOP/CEDIT", VAR_PROGS .. "/develop/cedit/cedit"},
{"FB2READ", VAR_PROGS .. "/other/fb2reader/fb2read"},
})
end -- tup.getconfig('NO_OB07') ~= 'full'
-- Programs that require GCC to compile.
if tup.getconfig('NO_GCC') ~= 'full' then
tup.append_table(img_files, {
{"GAMES/REVERSI", VAR_PROGS .. "/games/reversi/reversi"},
{"LIB/BASE64.OBJ", VAR_PROGS .. "/develop/libraries/base64/base64.obj"},
{"LIB/LIBC.OBJ", VAR_PROGS .. "/develop/ktcc/trunk/libc.obj/source/libc.obj"},
{"LIB/ICONV.OBJ", VAR_PROGS .. "/develop/libraries/iconv/iconv.obj"},
-- {"LIB/MTAR.OBJ", VAR_PROGS .. "/develop/libraries/microtar/mtar.obj"},
})
tup.append_table(extra_files, {
-- {"kolibrios/3D/cubeline", VAR_PROGS .. "/demos/cubeline/trunk/cubeline"},

View File

@@ -1,4 +1,4 @@
[icons16]
[icons18]
<dir>=0
<up>=1
<lot>=20
@@ -162,6 +162,7 @@ min=23
nes=23
sna=23
snes=23
rom=23
bat=24
sh=24
sys=25

View File

@@ -68,6 +68,7 @@ sna=/kolibrios/emul/e80/e80
gb=/kolibrios/emul/gameboy
gbc=/kolibrios/emul/gameboy
min=/kolibrios/emul/pokemini
rom=/kolibrios/emul/uxn
nc=/kolibrios/utils/cnc_editor/cnc_editor
kf=/sys/KF_VIEW
csv=/sys/table

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -22,3 +22,5 @@ ToggleBar=Tab
path=/usbhd0/1/kolibri.img
autoclose=0
[WebView]
proxy=http://proxy.kolibrios.org:82/?site=

View File

@@ -192,6 +192,7 @@ nc=/kolibrios/utils/cnc_editor/cnc_editor
ch8=/kolibrios/emul/chip8/chip8
md=/kolibrios/emul/dgen/dgen
gen=/kolibrios/emul/dgen/dgen
rom=/kolibrios/emul/uxn
zip=$Unz
7z=$Unz

View File

@@ -9,15 +9,15 @@
pre {white-space: pre-wrap;}
h2 {margin-bottom:0;}
blockquote {
margin-bottom:0;
border-left: 5px solid #EFE8D5;
margin-bottom:0;
border-left: 5px solid #EFE8D5;
padding-left: 10px;}
</style>
</head>
<body bgcolor="#FDF6E3" link="#5551FF"><pre><h1>Решение проблем и часто задаваемые вопросы</h1>
<a href="guide.htm" param="d">&lt; Назад</a>
<b>Какие есть варианты загрузки Колибри?</b>
<b>Какие есть варианты загрузки КолибриОС?</b>
С флешки, жесткого диска, CD, дискеты. Смотрите папку /HD_Load в скачанном дистрибутиве.
При загрузке с флешки иногда может требоваться использование setmbr.exe, иногда нет. Вначале попробуйте загрузится без него, если не получится, то с ним.
@@ -27,7 +27,7 @@
2. Поменять настройки в BIOS: зайти в раздел с жесткими дисками и выставить режим совместимости с IDE или что-то похожее. (После всех эксперименов не забудьте поменять все обратно!)
3. Воспользоваться драйвером ACHI. Для этого зайдите в SYSPANEL &gt; <a href="/kolibrios/drivers/DRVINST.KEX">DriverInstall</a>.
<b>Как установить Колибри как основную ОС, скажем, на старенький ноутбук?</b>
<b>Как установить КолибриОС как основную ОС, скажем, на старенький ноутбук?</b>
Есть масса вариантов. Вот один из них.
Если на ноутбуке нет ОС, то ставим на него Windows 98. Если на нем уже стоит Windows 95/98/2k/XP, то они тоже подойдут.
Заходим в папку /HD_Load поставляемую в дистрибутиве. Там с помощью утилит устанавливаем Kolibri в дуалбут с Windows.
@@ -49,7 +49,7 @@
MTRRs (Memory type range registers — Диапазонные регистры типа памяти) — используются для назначения типа (политики кеширования) участкам памяти. Регистры MTRR предоставляют механизм, связывающий типы памяти с физическими адресными диапазонами системной памяти. Они позволяют процессору оптимизировать операции для разных типов памяти, таких как ПЗУ, ОЗУ, кадровый буфер и отображаемые в памяти устройства ввода-вывода. Они также упрощают разработку системного оборудования, уменьшая количество контактов управляющих памятью, которые использовались для этой цели в ранних процессорах и внешних логических устройствах.
<b>На каких ещё языках программирования, кроме ассемблера, можно разрабатывать приложения для Колибри?</b>
<b>На каких ещё языках программирования, кроме ассемблера, можно разрабатывать приложения для КолибриОС?</b>
Портированы:
&bull; Компилятор Oberon-07
@@ -68,7 +68,7 @@ MTRRs (Memory type range registers — Диапазонные регистры
Подробная статья по поддерживаемым компиляторам и их настройке <a href="http://kolibri-n.org/inf/hll/hll">здесь</a>.
<b>Wi-Fi работает?</b>
Нет ни драйверов ни подсистемы.
Нет ни драйверов ни подсистемы.
Если вы хотите разработать подсистему и драйвер(а) WiFi - напишите нам на форум или в группу ВК, есть возможность оплатить разработку. Для этого нужно весьма неплохо знать ассемблер.
<b>Не работает мышь, флешка, клавиатура</b>
@@ -79,28 +79,28 @@ MTRRs (Memory type range registers — Диапазонные регистры
&bull; Использовать PS/2 мышь...
&bull; Купить PCI карту на несколько USB 2.0 портов, благо стоит она копейки, часто продается на барахолках
<b>Можно ли в Колибри запускать EXE (приложения Windows)?</b>
<b>Можно ли в КолибриОС запускать EXE (приложения Windows)?</b>
Нет, это невозможно.
Есть эмулятор DOS и <a href="http://board.kolibrios.org/viewtopic.php?f=9&t=2318&p=48991">PELoad</a> эмулятор некоторых функций WIN32 (в зачаточном состоянии).
<b>Когда будет нормальный браузер?</b>
Браузер штука очень сложная, как в написании, так и в портировании. Есть наработки по портированию Netsurf, но пока все заглохло.
Что и когда будет не известно.
Что и когда будет не известно.
<b>У меня есть идея, давайте я вам ее напишу, а вы реализуете!</b>
Чаще всего эти идеи мало полезны. Дело в том, что у каждого человека уже вовлеченного в проект, тоже есть множество нереализованных идей, подчас более ценных, чем у новичков, за счет того, что участники лучше разбираются в системе, ее возможностях и ограничениях. Проблема, как всегда, или в мотивации, или в отсутствии времени. Пожалуйста, учитывайте это приходя в проект и не требуйте ничего от незнакомых вам людей. Участвуйте, как наблюдатель и комментатор; и со временем вы сможете генерировать хорошие идеи предметно.
К сожалению даже клевая идея не гарантирует ее скорейшей реализации, потому самый надежный шанс воплотить идею в жизнь - реализовать самому.
Чаще всего эти идеи мало полезны. Дело в том, что у каждого человека уже вовлеченного в проект, тоже есть множество нереализованных идей, подчас более ценных, чем у новичков, за счет того, что участники лучше разбираются в системе, ее возможностях и ограничениях. Проблема, как всегда, или в мотивации, или в отсутствии времени. Пожалуйста, учитывайте это приходя в проект и не требуйте ничего от незнакомых вам людей. Участвуйте, как наблюдатель и комментатор; и со временем вы сможете генерировать хорошие идеи предметно.
К сожалению даже клевая идея не гарантирует ее скорейшей реализации, потому самый надежный шанс воплотить идею в жизнь - реализовать самому.
<b>Почему в Колибри все еще нет ХХХ? Это же так важно!</b>
Потому что это ХХХ еще никто не сделал.
<b>Почему в КолибриОС все еще нет ХХХ? Это же так важно!</b>
Потому что это ХХХ еще никто не сделал.
См. предыдущий ответ.
<b>Какие у вас дальнейшие планы развития?</b>
Большинство путей развития упирается не в планы, а в свободные руки. Особенно в квалифицированные рабочие руки.
<b>Как насчет версии для ARM вместо Android?</b>
Нативно это невозможно. Абсолютно и полностью.
Дело в том, что Колибри ОС написана на ассемблере x86, тем самым овермаксимально оптимизирована под процессоры x86. На мобильных девайсах используется другой тип процессора и другая архитектура - arm, что делает портирование невозможным.
Нативно это невозможно. Абсолютно и полностью.
Дело в том, что КолибриОС написана на ассемблере x86, тем самым овермаксимально оптимизирована под процессоры x86. На мобильных девайсах используется другой тип процессора и другая архитектура - arm, что делает портирование невозможным.
Колибри - десктопная ОС для Пека, любите ее такой, какая она есть.
</body>
</html>

View File

@@ -0,0 +1,4 @@
if tup.getconfig("NO_FASM") ~= "" then return end
ROOT = "../../.."
tup.rule("usbother.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
tup.rule("usbdrv.asm", "fasm %f %o ", "%B.dat")

View File

@@ -0,0 +1,214 @@
;*****************************************************************************;
; Copyright (C) 2025, Mikhail Frolov aka Doczom . All rights reserved. ;
; Distributed under terms of the 3-Clause BSD License. ;
;*****************************************************************************;
; File of usb drivers
; base = 0
; offset | Size | Name | Description
;=======================|=======|===============|=============================
; base + 0 | 4 | ID_drv_table | offset to dev_ven drv array
; base + 4 | 4 | Class_table | offset to class drv array
;
; n = 0 .. count driver with ID table
; nt = count driver with ID table
; ID_drv_table + 0*(n-1)| 4 | ID_TABLE | offset from base to table VID:PID
; ID_drv_table + 4*(n-1)| 4 | DRV_NAME | offset from base to name of driver
; ID_drv_table + 8*nt | 8 | __ZERO | terminaror of list
; k = 0 .. count driver on class code
; kt = count driver on class code
; Class_table + 0*(k-1) | 1 | LENGTH_CLASS | length of class code 1..3
; Class_table + 1*(k-1) | 1 | USB_CLASS | main usb class code (M)
; Class_table + 2*(k-1) | 1 | USB_SUBCLASS | USB subclass code or zero(V)
; Class_table + 2*(k-1) | 1 | USB_PROTOCOL | USB protocol code or zero(V)
; Class_table + 4*(k-1) | 4 | DRV_NAME | offset from base to name of driver
; Class_table + 8*kt | 8 | __ZERO | terminaror of list
; i = 0 .. count VID:PID
; it = count VID:PID
; ID_TABLE + 0*(i-1) | 2 | VID | Vendor id
; ID_TABLE + 2*(i-1) | 2 | PID | Product id
; ID_TABLE + 4*it | 4 | __ZERO | terminaror of list
macro INIT_USBDRV_FILE {
local ..id_list, ..class_list
format binary as 'dat'
use32
org 0
dd ..id_list
dd ..class_list
macro ID_DRV_TABLE \{
dd 0, 0
\}
macro CLASS_TABLE \{
dd 0, 0
\}
macro ID_TABLE \{
\}
macro DRV_NAME_LIST \{
\}
postpone \{
..id_list: ID_DRV_TABLE
..class_list: CLASS_TABLE
ID_TABLE
DRV_NAME_LIST
\}
}
macro ADD_CLASS drv_name, class, subclass, protocol {
local ..length, ..class_code, ..drv_name
..length = 3
match =X, class \{
err 'Class is mandatory argument'
\}
match =X, protocol \{
..length = 2
\}
match =X, subclass \{
..length = 1
\}
..class_code = ..length or (class shl 8)
if ..length = 3
..class_code = ..class_code or (protocol shl 24)
end if
if ..length = 2
..class_code = ..class_code or (subclass shl 16)
end if
; add in list
macro DRV_NAME_LIST \{
..drv_name: db drv_name, 0
DRV_NAME_LIST
\}
macro CLASS_TABLE \{
dd ..class_code, ..drv_name
CLASS_TABLE
\}
}
macro ADD_ID drv_name, [device_id] {
common
local ..drv_name, ..id_table
macro ID_TABLE \{
ID_TABLE
..id_table:
\}
reverse
local vid_pid
match VID:PID, device_id \{
vid_pid = (PID shl 16) + VID
\}
macro ID_TABLE \{
ID_TABLE
dd vid_pid
\}
common
macro ID_TABLE \{
ID_TABLE
dd 0
\}
macro DRV_NAME_LIST \{
..drv_name: db drv_name, 0
DRV_NAME_LIST
\}
macro ID_DRV_TABLE \{
dd ..id_table, ..drv_name
ID_DRV_TABLE
\}
}
; ADD ID driver Linux
macro ADD_IDL drv_name, [vendor_id, device_id] {
common
local ..drv_name, ..id_table
macro ID_TABLE \{
ID_TABLE
..id_table:
\}
reverse
local vid_pid
vid_pid = (device_id shl 16) + vendor_id
macro ID_TABLE \{
ID_TABLE
dd vid_pid
\}
common
macro ID_TABLE \{
ID_TABLE
dd 0
\}
macro DRV_NAME_LIST \{
..drv_name: db drv_name, 0
DRV_NAME_LIST
\}
macro ID_DRV_TABLE \{
dd ..id_table, ..drv_name
ID_DRV_TABLE
\}
}
INIT_USBDRV_FILE
;ADD_CLASS 'usbcdc-ctrl' , 0x02, X , X
;ADD_CLASS 'usbimage' , 0x06, 1 , 1
;ADD_CLASS 'usbcdc-data' , 0x0A, X , X
;ADD_CLASS 'ccid' , 0x0B, X , X
;ADD_CLASS 'uvd' , 0x0E, X , X
;ADD_CLASS 'uvd_2' , 0x0E, 0x02, X
;ADD_CLASS 'usb_bluetooth' , 0xE0, 0x01, X
;ADD_CLASS 'usb_wifi' , 0xE0, 0x02, X
ADD_ID 'usbftdi',\
0x0403:0 ; Any FTDI device
;https://github.com/avrdudes/avrdude/blob/main/src/usbdevs.h#L51
;ADD_ID 'usbasp',\
; 0x16c0:0x05dc,\ ; VOTI Obdev's free shared PID
; 0x03e8:0xc7b4,\ ; ATMEL (unofficial) USBasp
; 0x16c0:0x092f ; VOTI NIBObee PID
;https://github.com/WCHSoftGroup/ch341par_linux/blob/main/driver/ch34x_pis.c
;ADD_IDL 'ch341par',\
; 0x1a86, 0x5512,\ ; ch341a default
; 0x1a86, 0x55db,\ ; CH347T Mode1 SPI+IIC+UART
; 0x1a86, 0x55dd,\ ; CH347T Mode3 JTAG+UART
; 0x1a86, 0x55de,\ ; CH347F
; 0x1a86, 0x55e7 ; CH339W
;https://github.com/openbsd/src/blob/master/sys/dev/usb/uchcom.c
;https://github.com/WCHSoftGroup/ch341ser_linux/blob/main/driver/ch341.c
;ADD_IDL 'ch341ser',\
; 0x1a86, 0x7523,\ ; ch340 chip
; 0x1a86, 0x7522,\ ; ch340k chip
; 0x1a86, 0x5523,\ ; ch341 chip
; 0x1a86, 0xe523,\ ; ch330 chip
; 0x4348, 0x5523 ; ch340 custom chip

View File

@@ -0,0 +1,523 @@
;*****************************************************************************;
; Copyright (C) 2025, Mikhail Frolov aka Doczom . All rights reserved. ;
; Distributed under terms of the 3-Clause BSD License. ;
; ;
; usbother is a driver for loading USB drivers of a certain class and vendor. ;
; ;
; Version 0.1.1, 24 May 2025 ;
; ;
;*****************************************************************************;
format PE native 0.05
entry START
; const
DRV_VERSION = 0x0101 ; 0.1.1
; struct
include '../../struct.inc'
; USB device descriptor
struct DEVICE_DESCR
bLength db ?
bDescriptorType db ?
bcdUSB dw ?
bDeviceClass db ?
bDeviceSubClass db ?
bDeviceProtocol db ?
bMaxPacketSize0 db ?
idVendor dw ?
idProduct dw ?
bcdDevice dw ?
iManufacturer db ?
iProduct db ?
iSerialNumber db ?
bNumConfigurations db ?
ends
struct INTERFACE_DESCR
bLength db ?
bDescriptorType db ?
bInterfaceNumber db ?
bAlternateSetting db ?
bNumEndpoints db ?
bInterfaceClass db ?
bInterfaceSubClass db ?
bInterfaceProtocol db ?
iInterface db ?
ends
struct SRV
srv_name rb 16 ;ASCIIZ string
magic dd ? ;+0x10 ;'SRV '
size dd ? ;+0x14 ;size of structure SRV
fd dd ? ;+0x18 ;next SRV descriptor
bk dd ? ;+0x1C ;prev SRV descriptor
base dd ? ;+0x20 ;service base address
entry dd ? ;+0x24 ;service START function
srv_proc dd ? ;+0x28 ;user mode service handler
srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
ends
struct USBSRV
srv SRV
usb_func dd ?
ends
struct USBFUNC
strucsize dd ?
add_device dd ?
device_disconnect dd ?
ends
USBDRV_TYPE_NOLOCK = 0 ; usb device not controlled (native driver
; not found and IOCTL not opened device)
USBDRV_TYPE_NATIVE = 1 ; native PE kernel driver for usb
USBDRV_TYPE_IOCTL = 2 ; usb device is controlled by IOCTL service
; (driver or userspace process/threads)
USBDRV_IOCTL_BLOCKED = 4 ; blocked IOCTL interface, device disconnected
struct DRV_CONTEXT
next dd ?
prev dd ?
drv_hand dd ?
drv_pdata dd ?
flags dd ?
config_descr dd ?
interface_descr dd ?
ep rd 64 ; 32 IN + 32 OUT endpoints' pipes
ends
DRV_CONTEXT.ep0 fix (DRV_CONTEXT.ep + 0)
section '.flat' code readable writable executable
include '../../proc32.inc'
include '../../peimport.inc'
include '../../macros.inc'
proc START c, state:dword, cmdline:dword
cmp [state], DRV_ENTRY
jne .end
; init
mov ecx, drv_list_lock
invoke MutexInit
mov ecx, interface_list_lock
invoke MutexInit
; load drv_list
stdcall load_drv_list, default_list
test eax, eax
jnz .end
; reg driver
invoke RegUSBDriver, drv_name, service_proc, usb_functions
ret
.end:
xor eax, eax
ret
endp
proc load_drv_list stdcall, .path:dword
push ebx
mov ecx, drv_list_lock
invoke MutexLock
; load file
invoke LoadFile, [.path]
test eax, eax
push eax
jnz @f
mov dword[esp], -1
jmp .exit
@@:
cmp [drv_list], 0
jz @f
invoke KernelFree, [drv_list]
@@:
mov eax,[esp]
mov [drv_list], eax
mov dword[esp], 0
.exit:
mov ecx, drv_list_lock
invoke MutexUnlock
pop eax
pop ebx
ret
endp
proc service_proc stdcall, .ioctl:dword
push esi
or eax, -1
mov esi, [.ioctl]
mov ecx, [esi + IOCTL.io_code]
cmp ecx, .count_ioctl_codes
jae .fail
jmp dword[.table_subfunction + ecx*4]
.table_subfunction:
dd .get_version
dd .update_list
dd .get_array_dev
dd .get_full_dev_data
dd .open_dev
dd .close_dev
dd .control_transfer
dd .bulk_transfer
dd .interrupt_transfer
;dd .control_transfer_async
;dd .bulk_transfer_async
;dd .interrupt_transfer_async
.count_ioctl_codes = ($ - .table_subfunction)/4
.get_version:
mov eax, [esi + IOCTL.output]
cmp [esi + IOCTL.out_size], 4
jne .fail
mov dword[eax], DRV_VERSION
xor eax, eax
jmp .exit
.update_list:
; update list
mov ecx, [esi + IOCTL.input]
cmp [esi + IOCTL.inp_size], 0
jnz @f
mov ecx, default_list
@@:
stdcall load_drv_list, ecx
.exit:
pop esi
ret
.get_array_dev:
.get_full_dev_data:
.open_dev:
.close_dev:
;
.control_transfer:
.bulk_transfer:
.interrupt_transfer:
.fail:
or eax, -1
jmp .exit
endp
proc AddDevice stdcall, .config_pipe:dword, \
.config_descr:dword,\
.interface:dword
push esi edi
mov eax, sizeof.DRV_CONTEXT
invoke Kmalloc
test eax, eax
jz .err_init
mov esi, eax
mov ecx, interface_list_lock
invoke MutexLock
mov edx, [usb_interface_list] ; next
mov [esi + DRV_CONTEXT.next], edx
mov [esi + DRV_CONTEXT.prev], usb_interface_list
mov [usb_interface_list], esi
mov [edx + DRV_CONTEXT.prev], esi
mov ecx, interface_list_lock
invoke MutexUnlock
and [esi + DRV_CONTEXT.drv_hand], 0
mov [esi + DRV_CONTEXT.flags], USBDRV_TYPE_NOLOCK
; lock mutex
mov ecx, drv_list_lock
invoke MutexLock
; save device context data
mov eax, [.config_pipe]
mov [esi + DRV_CONTEXT.ep0], eax
mov eax, [.config_descr]
mov [esi + DRV_CONTEXT.config_descr], eax
mov eax, [.interface]
mov [esi + DRV_CONTEXT.interface_descr], eax
; get pointer to list
mov edx, [drv_list]
test edx, edx
jz .err_exit
mov edi, edx
add edi, [edx]
; get in ecx VID:PID code
invoke USBGetParam, [.config_pipe], 0
mov ecx, dword[eax + DEVICE_DESCR.idVendor]
.loop_id_drv:
cmp dword[edi], 0
jz .end_loop_id_drv
mov edx, [drv_list]
add edx, [edi] ; ID_TABLE
.loop_id:
cmp dword[edx], 0
jz .end_loop_id
; check id
mov eax, ecx
test word[edx + 2], 0xffff
jne @f
; driver for all devices of VID
and eax, 0xffff
@@:
cmp [edx], eax ; check VID:PID
je @f
add edx, 4
jmp .loop_id
@@: ; found
call .load_drv
jnz .exit
add edx, 4
jmp .loop_id
.end_loop_id:
add edi, 8
jmp .loop_id_drv
.end_loop_id_drv:
push esi
mov esi, str_1
invoke SysMsgBoardStr
pop esi
; get in ecx class code
mov eax, [.interface]
mov ecx, dword[eax + INTERFACE_DESCR.bInterfaceClass] ; 24-31 bits
mov edi, [drv_list]
add edi, [edi + 4]
.loop_class:
cmp dword[edi], 0
jz .end_loop_class
; check class
movzx eax, byte[edi] ; length
and eax, 11b ; protect - max length = 3
lea eax, [eax*8] ; 1 = 8; 2 = 16; 3 = 24
xor edx, edx
bts edx, eax
dec edx ; bitmask
mov eax, [edi]
shr eax, 8
and eax, edx ; good class in list
and edx, ecx ; good class of device
cmp eax, edx
je @f
add edi, 8
jmp .loop_class
@@: ; found
call .load_drv
jnz .exit
add edi, 8
jmp .loop_class
; IN: edi - item list of driver
; esi - DRV_CONTEXT
; OUT: ZF - not found zF - found
; function save drv handl in DRV_CONTEXT.drv_hand
; and pdata in DRV_CONTEXT.drv_pdata
.load_drv:
push ecx edx
; load driver
push esi
mov esi, str_2
invoke SysMsgBoardStr
pop esi
mov ecx, [drv_list]
add ecx, [edi + 4]
pusha
mov esi, ecx
invoke SysMsgBoardStr
mov esi, str_newline
invoke SysMsgBoardStr
popa
invoke GetService, ecx
test eax, eax
jz @f
mov [esi + DRV_CONTEXT.drv_hand], eax
; get function list
mov ecx, [eax + USBSRV.usb_func]
; call AddDevice of driver
stdcall [ecx + USBFUNC.add_device], [.config_pipe], \
[.config_descr],\
[.interface]
mov [esi + DRV_CONTEXT.drv_pdata], eax
test eax, eax
jnz .load_drv.good
push esi
mov esi, str_4
invoke SysMsgBoardStr
pop esi
and [esi + DRV_CONTEXT.drv_hand], 0
@@:
pushf
push esi
mov esi, str_5
invoke SysMsgBoardStr
pop esi
popf
pop edx ecx
retn
.load_drv.good:
pushf
push esi
mov esi, str_3
invoke SysMsgBoardStr
pop esi
popf
mov [esi + DRV_CONTEXT.flags], USBDRV_TYPE_NATIVE
pop edx ecx
retn
.err_exit:
mov eax, esi
invoke Kfree
xor esi, esi
.end_loop_class:
.exit:
; driver not found - Added libusb driver
; unlock mutex
mov ecx, drv_list_lock
invoke MutexUnlock
mov eax, esi
pop edi esi
ret
.err_init:
xor eax, eax
pop edi esi
ret
endp
proc DeviceDisconnected stdcall, .pdata:dword
mov eax, [.pdata]
test [eax + DRV_CONTEXT.flags], USBDRV_TYPE_NATIVE
jz .no_native
cmp [eax + DRV_CONTEXT.drv_hand], 0
jz .free
; call device disconnected
mov ecx, [eax + DRV_CONTEXT.drv_hand]
mov edx, [ecx + USBSRV.usb_func]
cmp dword[edx], USBFUNC.device_disconnect
jbe .free ; TODO: check
stdcall [edx + USBFUNC.device_disconnect], [eax + DRV_CONTEXT.drv_pdata]
.free:
; clear list of DRV_CONTENT
mov ecx, interface_list_lock
invoke MutexLock
mov eax, [.pdata]
mov edx, [eax + DRV_CONTEXT.prev]
mov ecx, [eax + DRV_CONTEXT.next]
mov [edx + DRV_CONTEXT.next], ecx
mov [ecx + DRV_CONTEXT.prev], edx
mov ecx, interface_list_lock
invoke MutexUnlock
; free context
mov eax, [.pdata]
invoke Kfree
ret
.no_native:
test [eax + DRV_CONTEXT.flags], USBDRV_TYPE_IOCTL
jz .free
; set state for block user api and clear struct
or [eax + DRV_CONTEXT.flags], USBDRV_IOCTL_BLOCKED
xor ecx, ecx
;mov [eax + DRV_CONTEXT.drv_hand], ecx
;mov [eax + DRV_CONTEXT.drv_pdata], ecx
mov [eax + DRV_CONTEXT.config_descr], ecx
mov [eax + DRV_CONTEXT.interface_descr], ecx
mov [eax + DRV_CONTEXT.ep0], ecx
; TODO
jmp .free
endp
; data
drv_list_lock MUTEX
drv_list dd ?
interface_list_lock MUTEX
usb_interface_list:
dd usb_interface_list
dd usb_interface_list
usb_functions:
dd .end - usb_functions
dd AddDevice
dd DeviceDisconnected
.end:
drv_name db 'usbother', 0
default_list: db '/sys/settings/usbdrv.dat', 0
str_1: db 'USBOTHER: Driver for this ID not found', 13, 10, 0
str_2: db 'USBOTHER: Check found driver: ', 0, 13, 10, 0
str_3: db 'USBOTHER: Device driver is good', 13, 10, 0
str_4: db 'USBOTHER: Device driver fail prob', 13, 10, 0
str_5: db 'USBOTHER: Device driver load error', 13, 10, 0
str_newline: db 13,10,0
data fixups
end data

View File

@@ -5,7 +5,7 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Загрузочный сектор для ОС Колибри (FAT12, дискета)
Загрузочный сектор для КолибриОС (FAT12, дискета)
- Описание
Позволяет загружать KERNEL.MNT с дискет/образов

View File

@@ -5,7 +5,7 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Загрузочный сектор для ОС Колибри (FAT12, дискета)
Загрузочный сектор для КолибриОС (FAT12, дискета)
- Описание
Позволяет загружать KERNEL.MNT с дискет/образов

View File

@@ -5,7 +5,7 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Загрузочный сектор для ОС Колибри (FAT12, дискета)
Загрузочный сектор для КолибриОС (FAT12, дискета)
- Описание
Позволяет загружать KERNEL.MNT с дискет/образов

View File

@@ -5,7 +5,7 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Загрузочный сектор для ОС Колибри (FAT12, дискета)
Загрузочный сектор для КолибриОС (FAT12, дискета)
- Описание
Позволяет загружать KERNEL.MNT с дискет/образов

View File

@@ -1985,7 +1985,7 @@ path db 'HD0/1',0
подфункция 2 функции 15.
---------------------- Константы для регистров: ----------------------
eax - SF_BACKGROUND_GET_RECT (39)
eax - SF_BACKGROUND_GET (39)
======================================================================
== Функция 39, подфункция 3 - получить прямоугольную область фона =
======================================================================
@@ -2169,7 +2169,7 @@ path db 'HD0/1',0
* ebx = 2 - номер подфункции
* ecx = указатель на таблицу цветов
* edx = размер таблицы цветов
(должен быть 40 байт для будущей совместимости)
(до 192 байт; 40 байт для базовой структуры)
Формат таблицы цветов указан в описании подфункции 3.
Возвращаемое значение:
* функция не возвращает значения
@@ -2196,32 +2196,33 @@ path db 'HD0/1',0
* ecx = указатель на буфер размером edx байт,
куда будет записана таблица
* edx = размер таблицы цветов
(должен быть 40 байт для будущей совместимости)
(до 192 байт; 40 байт для базовой структуры)
Возвращаемое значение:
* функция не возвращает значения
Формат таблицы цветов: каждый элемент -
dword-значение цвета 0x00RRGGBB
* +0: dword: none - зарезервировано
* +4: dword: none - зарезервировано
* +0: dword: frame
* +4: dword: grab
* +8: dword: work_dark - темный цвет рабочей области для придания
объемна элементам интерфейса
* +12 = +0xC: dword: work_light - светлый цвет рабочей области для
придания объемна элементам интерфейса
* +16 = +0x10: dword: grab_text - цвет текста на заголовке
* +20 = +0x14: dword: work - цвет рабочей области
* +24 = +0x18: dword: button - цвет кнопки в рабочей области
* +28 = +0x1C: dword: button_text - цвет текста на кнопке
* +24 = +0x18: dword: work_button - цвет кнопки в рабочей области
* +28 = +0x1C: dword: work_button_text - цвет текста на кнопке
в рабочей области
* +32 = +0x20: dword: work_text - цвет текста в рабочей области
* +36 = +0x24: dword: graph - цвет графики в рабочей области
Замечания:
* Структура таблицы цветов описана в стандартном включаемом файле
macros.inc под названием system_colors; например, можно писать:
sc system_colors ; объявление переменной
... ; где-то надо вызвать
; описываемую функцию с ecx=sc
mov ecx, [sc.button_text] ; читаем цвет текста
; на кнопке в рабочей области
sc system_colors ; объявление переменной
... ; вызов описываемой функции с ecx = sc
mov ecx, [sc.work_button_text] ; устанавливаем цвет текста
; на кнопке в рабочей области
* Таблица может быть больше (до 192 байт); дополнительные поля
копируются как есть и интерпретируются скинами.
* Использование/неиспользование этих цветов - дело исключительно
самой программы. Для использования нужно просто при вызове функций
рисования указывать цвет, взятый из этой таблицы.
@@ -2491,6 +2492,7 @@ dword-значение цвета 0x00RRGGBB
---------------------- Константы для регистров: ----------------------
eax - SF_SET_WINDOW_SHAPE (50)
======================================================================
===================== Функция 51, подфункция 1 =======================
========================== Создать поток =============================
@@ -2505,16 +2507,19 @@ dword-значение цвета 0x00RRGGBB
* иначе eax = TID - идентификатор потока
---------------------- Константы для регистров: ----------------------
eax - SF_CREATE_THREAD (51)
eax - SF_CREATE_THREAD (51) /
ebx - SSF_CREATE_THREAD (1), SSF_GET_CURR_THREAD_SLOT (2),
SSF_GET_THREAD_PRIORITY (3), SSF_SET_THREAD_PRIORITY (4)
======================================================================
===================== Функция 51, подфункция 2 =======================
=================== Получить номер слота потока ======================
============= Получить номер слота текущего потока ===================
======================================================================
Параметры:
* eax = 51 - номер функции
* ebx = 2 - номер подфункции
Возвращаемое значение:
* eax = номер слота потока
* eax = номер слота текущего потока
======================================================================
===================== Функция 51, подфункция 3 =======================
@@ -2755,10 +2760,10 @@ IPC применяется для посылок сообщений от одн
Программе доступны данные графического экрана (область памяти, которая
собственно и отображает содержимое экрана) напрямую без вызовов
системных функций через селектор gs:
mov eax, [gs:0]
mov eax, [gs:0]
поместит в eax первый dword буфера, содержащий информацию о цвете
левой верхней точки (и, возможно, цвета нескольких следующих).
mov [gs:0], eax
mov [gs:0], eax
при работе в режимах VESA c LFB
установит цвет левой верхней точки
(и возможно, цвета нескольких следующих).
@@ -3356,6 +3361,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
---------------------- Константы для регистров: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_MEM_FREE (13)
======================================================================
====================== Функция 68, подфункция 14 =====================
====== Ожидать получения сигнала от других приложений/драйверов. =====
@@ -3368,12 +3374,16 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* eax разрушается
* буфер, на который указывает ecx, содержит следующую информацию:
* +0: dword: идентификатор последующих данных сигнала
* +4: данные принятого сигнала (20 байт), формат которых
* +4: 5 dword: данные принятого сигнала, формат которых
определяется первым dword-ом
Замечания:
* Бесконечно ожидает любое событие в очереди событий текущего потока.
* Сбрасывает байт приоритета в буфере.
---------------------- Константы для регистров: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_WAIT_SIGNAL (14)
======================================================================
=========== Функция 68, подфункция 16 - загрузить драйвер. ===========
======================================================================
@@ -3382,19 +3392,20 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ebx = 16 - номер подфункции
* ecx = указатель на ASCIIZ-строку с именем драйвера
Возвращаемое значение:
* eax = 0 - неудача
* иначе eax = хэндл драйвера
* eax = хэндл драйвера
0 при ошибке
Замечания:
* Если драйвер ещё не загружен, он загружается;
если драйвер уже загружен, ничего не меняется.
* Имя драйвера чувствительно к регистру символов.
Максимальная длина имени - 16 символов, включая завершающий
нулевой символ, остальные символы игнорируются.
* Драйвер с именем ABC загружается из файла /sys/drivers/ABC.sys.
* Драйвер с именем "ABC" загружается из файла /sys/drivers/ABC.sys.
---------------------- Константы для регистров: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_LOAD_DRIVER (16)
======================================================================
========== Функция 68, подфункция 17 - управление драйвером. =========
======================================================================
@@ -3405,19 +3416,21 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* +0: dword: хэндл драйвера
* +4: dword: код функции драйвера
* +8: dword: указатель на входные данные
* +12 = +0xC: dword: размер входных данных
* +12 = +0x0C: dword: размер входных данных
* +16 = +0x10: dword: указатель на выходные данные
* +20 = +0x14: dword: размер выходных данных
Возвращаемое значение:
* eax = определяется драйвером
-1 при ошибке
Замечания:
* Коды функций и структура входных/выходных данных
определяются драйвером.
* Предварительно должен быть получен хэндл драйвера подфункцией 16.
* Хэндл драйвера необходимо предварительно получить подфункцией 16.
---------------------- Константы для регистров: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_CONTROL_DRIVER (17)
======================================================================
== Функция 68, подфункция 18 - загрузить DLL с указанием кодировки. ==
======================================================================
@@ -3482,7 +3495,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
Параметры:
* eax = 68 - номер функции
* ebx = 21 - номер подфункции
* ecx = указатель на ASCIIZ-строку с именем драйвера
* ecx = указатель на ASCIIZ-строку с путем к файлу драйвера
* edx = указатель на командную строку
Возвращаемое значение:
* eax = 0 - неудача
@@ -3674,22 +3687,40 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* функция загружает и, при необходимости, распаковывает файл (kunpack)
======================================================================
======== Функция 68, подфункция 29 - allocate ring memory. =========
======= Функция 68, подфункция 29 - выделить кольцевую память. =======
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 29 - subfunction number
* ecx = required size in bytes
Returned value:
* eax = 0 - failed
* eax = pointer to the allocated ring
Remarks:
* The requested size must be an exact multiple of pagesize (4 Kb)
* The function allocates memory in such a way that you can read and
write beyond the size of the allocated memory and will reach the
beginning of the buffer again.
Параметры:
* eax = 68 - номер функции
* ebx = 29 - номер подфункции
* ecx = требуемый размер в байтах
Возвращаемое значение:
* eax = 0 - неудача
* eax = указатель на выделенную кольцевую память
Замечания:
* Запрошенный размер должен быть кратен размеру страницы (4 Кб).
* Память выделяется так, что доступ за пределами буфера приводит
к чтению/записи в его начало.
======================================================================
=========== Функция 68, подфункция 30 - выгрузить драйвер. ===========
======================================================================
Параметры:
* eax = 68 - номер функции
* ebx = 30 - номер подфункции
* ecx = указатель на структуру SRV (хэндл драйвера)
* edx = указатель на командную строку (может быть 0)
Возвращаемое значение:
* eax = -1 - неверные параметры
* eax = -2 - ошибка при освобождении памяти драйвера
* иначе eax = указатель на следующую структуру SRV (бывший SRV.fd)
Замечания:
* Перед выгрузкой вызывается точка входа драйвера с DRV_EXIT.
---------------------- Константы для регистров: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_UNLOAD_DRIVER (30)
======================================================================
======== Функция 68, подфункция 31 - получить данные драйвера. =======
======================================================================
@@ -3788,7 +3819,7 @@ Remarks:
и при поступлении нового сообщения система будет ждать.
Для синхронизации обрамляйте всю работу с буфером операциями
блокировки/разблокировки
neg [bufsize]
neg [bufsize]
* Данные в буфере трактуются как массив элементов переменной длины -
сообщений. Формат сообщения указан в общем описании.
@@ -4527,7 +4558,7 @@ Remarks:
---------------------- Константы для регистров: ----------------------
eax - SF_NETWORK_GET (74)
bl - SSF_DEVICE_COUNT (255)
bl - SSF_DEVICE_COUNT (-1)
======================================================================
==== Функция 74, подфункция 0, Получить тип сетевого устройства. =====
======================================================================
@@ -4723,10 +4754,11 @@ Remarks:
Возвращаемое значение:
* eax = число пакетов, полученных с ошибкой с момента запуска
устройства, -1 при ошибке
---------------------- Константы для регистров: ----------------------
eax - SF_NETWORK_GET (74)
bl - SSF_RX_PACKET_ERROR_COUNT (14)
======================================================================
== Функция 74.15, Получить число пакетов отброшенных при получении. ==
======================================================================
@@ -4740,7 +4772,7 @@ Remarks:
---------------------- Константы для регистров: ----------------------
eax - SF_NETWORK_GET (74)
bl - SSF_RX_PACKET_DROP_COUNT (12)
bl - SSF_RX_PACKET_DROP_COUNT (15)
======================================================================
=== Функция 74.16, Получить число пакетов утерянных при получении. ===
======================================================================
@@ -4990,13 +5022,39 @@ Remarks:
---------------------- Константы для регистров: ----------------------
eax - SF_NETWORK_PROTOCOL (76)
ebx - SSF_ETHERNET_READ_MAC (0x0000)
ebx - SSF_IP4_PACKETS_SENT (0x10000)
ebx - SSF_IP4_PACKETS_RECEIVED (0x10001)
ebx - SSF_IP4_READ_IP (0x10002)
ebx - SSF_IP4_WRITE_IP (0x10003)
ebx - SSF_IP4_READ_DNS (0x10004)
ebx - SSF_IP4_WRITE_DNS (0x10005)
ebx - SSF_IP4_READ_SUBNET (0x10006)
ebx - SSF_IP4_WRITE_SUBNET (0x10007)
ebx - SSF_IP4_READ_GATEWAY (0x10008)
ebx - SSF_IP4_WRITE_GATEWAY (0x10009)
ebx - SSF_ICMP_PACKETS_SENT (0x20000)
ebx - SSF_ICMP_PACKETS_RECEIVED (0x20001)
ebx - SSF_ICMP_ECHO_REPLY (0x20003)
ebx - SSF_UDP_PACKETS_SENT (0x30000)
ebx - SSF_UDP_PACKETS_RECEIVED (0x30001)
ebx - SSF_TCP_PACKETS_SENT (0x40000)
ebx - SSF_TCP_PACKETS_RECEIVED (0x40001)
ebx - SSF_ARP_PACKETS_SENT (0x50000)
ebx - SSF_ARP_PACKETS_RECEIVED (0x50001)
ebx - SSF_ARP_GET_ENTRY_COUNT (0x50002)
ebx - SSF_ARP_READ_ENTRY (0x50003)
ebx - SSF_ARP_ADD_STATIC_ENTRY (0x50004)
ebx - SSF_ARP_DEL_ENTRY (0x50005)
ebx - SSF_ARP_SEND_ANNOUNCE (0x50006)
ebx - SSF_ARP_CONFLICTS_COUNT (0x50007)
======================================================================
============= Функция 77, подфункция 0, Создать фьютекс. =============
======================================================================
Параметры:
* eax = 77 - номер функции
* ebx = 0 - номер подфункции
* ecx = указатель на контрольное значение фьютекса (dword)
* ecx = контрольное значение фьютекса (dword)
Возвращаемое значение:
* eax = дескриптор фьютекса, 0 при ошибке
@@ -5025,11 +5083,12 @@ Remarks:
* eax = 77 - номер функции
* ebx = 2 - номер подфункции
* ecx = дескриптор фьютекса
* edx = контрольное значение
* edx = контрольное значение фьютекса (dword)
* esi = таймаут в сотых секунды, 0 - ждать бесконечно
Возвращаемое значение:
* eax = 0 - успешно, -1 - таймаут,
-2 - контрольное значение не соответствует
* eax = 0 - успешно,
-1 - таймаут,
-2 - контрольное значение фьютекса не соответствует
---------------------- Константы для регистров: ----------------------
eax - SF_FUTEX (77)
@@ -5049,7 +5108,11 @@ Remarks:
eax - SF_FUTEX (77)
ebx - SSF_WAKE (3)
======================================================================
======= Функция 77, подфункция 10, Прочитать из файла в буфер. =======
Замечания:
* Подфункции 4-7 зарезервированы и сейчас возвращают -1.
* Подфункции 8, 9 и 12 не реализованы и возвращают -EBADF (-9).
======================================================================
=========== Функция 77, подфункция 10, Прочитать из файла. ===========
======================================================================
Параметры:
* eax = 77 - номер функции
@@ -5059,10 +5122,15 @@ Remarks:
* esi = сколько байт прочитать
Возвращаемое значение:
* eax = количество прочитанных байт
0 при EOF
-EBADF (-9) при ошибке
Замечания:
* Поддерживаются только pipe-дескрипторы.
---------------------- Константы для регистров: ----------------------
eax - SF_FUTEX (77)
ebx - ...
ebx - SSF_FILE_READ (10)
======================================================================
======== Функция 77, подфункция 11, Записать из буфера в файл. =======
======================================================================
@@ -5070,14 +5138,19 @@ Remarks:
* eax = 77 - номер функции
* ebx = 11 - номер подфункции
* ecx = дескриптор файла
* edx = указатель на буфер, откуда брать данные для записи
* edx = указатель на буфер, откуда брать данные для записи
* esi = сколько байт записать
Возвращаемое значение:
* eax = количество записанных байт
-EBADF (-9) при ошибке
-EPIPE (-32) если нет читателей
Замечания:
* Поддерживаются только pipe-дескрипторы.
---------------------- Константы для регистров: ----------------------
eax - SF_FUTEX (77)
ebx - ...
ebx - SSF_FILE_WRITE (11)
======================================================================
=========== Функция 77, подфункция 13, Создать новый pipe. ===========
======================================================================
@@ -5089,15 +5162,20 @@ Remarks:
* eax = 77 - номер функции
* ebx = 13 - номер подфункции
* ecx = адрес pipefd
* edx = флаги. На данный момент если поднят O_CLOEXEC (0x40000), то
сисфункция завершится с ошибкой. Поэтому в качестве флагов можно
передать просто 0.
* edx = флаги. Разрешен только O_CLOEXEC (0x40000).
Любые другие биты приводят к -EINVAL (-11).
Возвращаемое значение:
* eax = 0 если успех, иначе ошибка.
* eax = 0 если успех,
иначе отрицательный код ошибки:
-EINVAL (-11), -EFAULT (-14), -ENFILE (-23), -EMFILE (-24)
Примечания:
* В случае успеха pipefd[0] является дескриптором чтения, а pipefd[1]
- дескриптором записи.
---------------------- Константы для регистров: ----------------------
eax - SF_FUTEX (77)
ebx - ...
ebx - SSF_PIPE_CREATE (13)
======================================================================
========== Функция -1 - завершить выполнение потока/процесса =========
======================================================================
@@ -5115,6 +5193,7 @@ Remarks:
---------------------- Константы для регистров: ----------------------
eax - SF_TERMINATE_PROCESS (-1)
======================================================================
=== Функция 80 - работа с файловой системой с указанием кодировки. ===
======================================================================

View File

@@ -1972,7 +1972,7 @@ Remarks:
subfunction 2 of function 15.
---------------------- Constants for registers: ----------------------
eax - SF_BACKGROUND_GET_RECT (39)
eax - SF_BACKGROUND_GET (39)
======================================================================
== Function 39, subfunction 3 - get rect from the background image. =
======================================================================
@@ -2152,7 +2152,7 @@ Parameters:
* ebx = 2 - subfunction number
* ecx = pointer to the color table
* edx = size of the color table
(must be 40 bytes for future compatibility)
(up to 192 bytes; 40 bytes for the base structure)
Format of the color table is shown in description of subfunction 3.
Returned value:
* function does not return value
@@ -2179,21 +2179,21 @@ Parameters:
* ecx = pointer to the buffer with size edx bytes,
where table will be written
* edx = size of color table
(must be 40 bytes for future compatibility)
(up to 192 bytes; 40 bytes for the base structure)
Returned value:
* function does not return value
Format of the color table:
each item is dword-value for color 0x00RRGGBB
* +0: dword: none - reserved
* +4: dword: none - reserved
* +0: dword: frame
* +4: dword: grab
* +8: dword: work_dark - dark color of working area
used to give a user 3D-like feelings about interface elements
* +12 = +0xC: dword: work_light - light color of working area
used to give a user 3D-like feelings about interface elements
* +16 = +0x10: dword: grab_text - color of text on header
* +20 = +0x14: dword: work - color of working area
* +24 = +0x18: dword: button - color of button in working area
* +28 = +0x1C: dword: button_text - color of text on button
* +24 = +0x18: dword: work_button - color of button in working area
* +28 = +0x1C: dword: work_button_text - color of text on button
in working area
* +32 = +0x20: dword: work_text - color of text in working area
* +36 = +0x24: dword: graph - color of graphics in working area
@@ -2206,6 +2206,8 @@ Remarks:
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; button in working area
* The table may be longer (up to 192 bytes); extra fields are copied
as-is and are interpreted by skins.
* A program itself decides to use or not to use color table.
For usage program must simply at calls to drawing functions select
color taken from the table.
@@ -2478,11 +2480,11 @@ Remarks:
---------------------- Constants for registers: ----------------------
eax - SF_SET_WINDOW_SHAPE (50)
======================================================================
==================== Function 51 - create thread. ====================
============= Function 51, subfunction 1 - create thread. ============
======================================================================
Parameters:
* eax = 51 - function number
* ebx = 1 - unique subfunction
* ebx = 1 - subfunction number
* ecx = address of thread entry point (starting eip)
* edx = pointer to thread stack (starting esp)
Returned value:
@@ -2491,6 +2493,49 @@ Returned value:
---------------------- Constants for registers: ----------------------
eax - SF_CREATE_THREAD (51)
ebx - SSF_CREATE_THREAD (1), SSF_GET_CURR_THREAD_SLOT (2),
SSF_GET_THREAD_PRIORITY (3), SSF_SET_THREAD_PRIORITY (4)
======================================================================
================== Function 51, subfunction 2 ========================
================== Get current thread slot number ====================
======================================================================
Parameters:
* eax = 51 - function number
* ebx = 2 - subfunction number
Returned value:
* eax = slot number of the current thread
======================================================================
================== Function 51, subfunction 3 ========================
===================== Get thread priority ============================
======================================================================
Parameters:
* eax = 51 - function number
* ebx = 3 - subfunction number
* ecx = slot number of the thread or -1 (current thread)
Returned value:
* eax = -1 - error (invalid slot number or thread terminated)
* otherwise eax = thread priority
Remarks:
* Priority range is 0..255.
0 is the highest priority and is set by default at creation.
======================================================================
================== Function 51, subfunction 4 ========================
===================== Set thread priority ============================
======================================================================
Parameters:
* eax = 51 - function number
* ebx = 4 - subfunction number
* ecx = slot number of the thread or -1 (current thread)
* edx = new thread priority
Returned value:
* eax = -1 - error (invalid slot number or thread terminated)
* otherwise eax = previous thread priority
Remarks:
* Priority range is 0..255.
0 is the highest priority and is set by default at creation.
======================================================================
==================== Function 54, subfunction 0 ======================
============== Get the number of slots in the clipboard. =============
@@ -3289,61 +3334,63 @@ Remarks:
ebx - SSF_MEM_FREE (13)
======================================================================
===================== Function 68, subfunction 14 ====================
============ Wait for signal from another program/driver. ============
======= Wait for a signal from other applications/drivers. ===========
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 14 - subfunction number
* ecx = pointer to the buffer for information (24 bytes)
* ecx = pointer to data buffer (6 dword = 24 bytes)
Returned value:
* eax is destroyed
* buffer pointed to by ecx contains the following information:
* +0: dword: identifier for following data of signal
* +4: dword: data of signal (20 bytes), format of which is defined
by the first dword
* +0: dword: EVENT.code (identifier of following data)
* +4: 5 dword: EVENT.data, format depends on EVENT.code
Remarks:
* Waits indefinitely for any event in the current thread event queue.
* The priority byte in the buffer is cleared by the kernel.
---------------------- Constants for registers: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_WAIT_SIGNAL (14)
======================================================================
============= Function 68, subfunction 16 - load driver. =============
=========== Function 68, subfunction 16 - load driver. ===============
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 16 - subfunction number
* ecx = pointer to ASCIIZ-string with driver name
Returned value:
* eax = 0 - failed
* otherwise eax = driver handle
* eax = driver handle, 0 on error
Remarks:
* If the driver was not loaded yet, it is loaded;
if the driver was loaded yet, nothing happens.
* If the driver is not loaded yet, it is loaded;
if the driver is already loaded, nothing changes.
* Driver name is case-sensitive.
Maximum length of the name is 16 characters, including
terminating null character, the rest is ignored.
* Driver ABC is loaded from file /sys/drivers/ABC.sys.
* Driver with name "ABC" is loaded from /sys/drivers/ABC.sys.
---------------------- Constants for registers: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_LOAD_DRIVER (16)
======================================================================
============ Function 68, subfunction 17 - driver control. ===========
========== Function 68, subfunction 17 - control driver. =============
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 17 - subfunction number
* ecx = pointer to the control structure:
* +0: dword: handle of driver
* +4: dword: code of driver function
* +8: dword: pointer to input data
* +12 = +0xC: dword: size of input data
* +16 = +0x10: dword: pointer to output data
* +20 = +0x14: dword: size of output data
* +0: dword: driver handle
* +4: dword: driver function code
* +8: dword: pointer to input data
* +12: dword: size of input data
* +16: dword: pointer to output data
* +20: dword: size of output data
Returned value:
* eax = determined by driver
* eax = determined by driver, -1 on error
Remarks:
* Function codes and the structure of input/output data
are defined by driver.
* Previously one must obtain driver handle by subfunction 16.
are defined by the driver.
* Driver handle can be obtained by subfunction 16.
---------------------- Constants for registers: ----------------------
eax - SF_SYS_MISC (68)
@@ -3411,7 +3458,7 @@ Remarks:
Parameters:
* eax = 68 - function number
* ebx = 21 - subfunction number
* ecx = pointer to ASCIIZ-string with driver name
* ecx = pointer to ASCIIZ-string with path to driver file
* edx = pointer to command line
Returned value:
* eax = 0 - failed
@@ -3616,9 +3663,24 @@ Remarks:
write beyond the size of the allocated memory and will reach the
beginning of the buffer again.
======================================================================
=========== Function 68, subfunction 30 - unload driver. ============
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 30 - subfunction number
* ecx = pointer to SRV structure (driver handle)
* edx = pointer to command line (may be 0)
Returned value:
* eax = -1 - invalid parameters
* eax = -2 - error while freeing driver memory
* otherwise eax = pointer to the next SRV structure (former SRV.fd)
Remarks:
* The driver entry is called with DRV_EXIT before unloading.
---------------------- Constants for registers: ----------------------
eax - SF_SYS_MISC (68)
ebx - SSF_MEM_ALLOC_RING (29)
ebx - SSF_UNLOAD_DRIVER (30)
======================================================================
=========== Function 68, subfunction 31 - get driver data. ===========
@@ -3833,7 +3895,7 @@ Remarks:
eax - SF_DEBUG (69)
ebx - SSF_RESUME (5)
======================================================================
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
= Function 69, subfunction 6 - read from memory of debugged process. =
======================================================================
Parameters:
* eax = 69 - function number
@@ -4442,17 +4504,17 @@ Returned value:
---------------------- Constants for registers: ----------------------
eax - SF_BLITTER (73)
======================================================================
= Function 74, Subfunction 255, Get number of active network devices. =
= Function 74, Subfunction -1, Get number of active network devices. =
======================================================================
Parameters:
* eax = 74 - function number
* bl = 255 - subfunction number
* bl = -1 - subfunction number
Returned value:
* eax = number of active network devices
---------------------- Constants for registers: ----------------------
eax - SF_NETWORK_GET (74)
bl - SSF_DEVICE_COUNT (255)
bl - SSF_DEVICE_COUNT (-1)
======================================================================
======== Function 74, Subfunction 0, Get network device type. ========
======================================================================
@@ -4605,7 +4667,7 @@ Parameters:
* bl = 11 - subfunction number
* bh = device number
Returned value:
* eax = Number of erroneous packets received since device start, -1 on error
* eax = Number of erroneous packets transmitted since device start, -1 on error
---------------------- Constants for registers: ----------------------
eax - SF_NETWORK_GET (74)
@@ -4661,7 +4723,7 @@ Returned value:
---------------------- Constants for registers: ----------------------
eax - SF_NETWORK_GET (74)
bl - SSF_RX_PACKET_DROP_COUNT (12)
bl - SSF_RX_PACKET_DROP_COUNT (15)
======================================================================
==== Function 74, Subfunction 16, Get RX missed packets counter. =====
======================================================================
@@ -5174,19 +5236,41 @@ Returned value:
---------------------- Constants for registers: ----------------------
eax - SF_NETWORK_PROTOCOL (76)
ebx - SSF_ETHERNET_READ_MAC (0x0000)
ebx - SSF_IP4_PACKETS_SENT (0x10000)
ebx - SSF_IP4_PACKETS_RECEIVED (0x10001)
ebx - SSF_IP4_READ_IP (0x10002)
ebx - SSF_IP4_WRITE_IP (0x10003)
ebx - SSF_IP4_READ_DNS (0x10004)
ebx - SSF_IP4_WRITE_DNS (0x10005)
ebx - SSF_IP4_READ_SUBNET (0x10006)
ebx - SSF_IP4_WRITE_SUBNET (0x10007)
ebx - SSF_IP4_READ_GATEWAY (0x10008)
ebx - SSF_IP4_WRITE_GATEWAY (0x10009)
ebx - SSF_ICMP_PACKETS_SENT (0x20000)
ebx - SSF_ICMP_PACKETS_RECEIVED (0x20001)
ebx - SSF_ICMP_ECHO_REPLY (0x20003)
ebx - SSF_UDP_PACKETS_SENT (0x30000)
ebx - SSF_UDP_PACKETS_RECEIVED (0x30001)
ebx - SSF_TCP_PACKETS_SENT (0x40000)
ebx - SSF_TCP_PACKETS_RECEIVED (0x40001)
ebx - SSF_ARP_PACKETS_SENT (0x50000)
ebx - SSF_ARP_PACKETS_RECEIVED (0x50001)
ebx - SSF_ARP_GET_ENTRY_COUNT (0x50002)
ebx - SSF_ARP_READ_ENTRY (0x50003)
ebx - SSF_ARP_ADD_STATIC_ENTRY (0x50004)
ebx - SSF_ARP_DEL_ENTRY (0x50005)
ebx - SSF_ARP_SEND_ANNOUNCE (0x50006)
ebx - SSF_ARP_CONFLICTS_COUNT (0x50007)
======================================================================
========== Function 77, Subfunction 0, Create futex object ===========
======================================================================
Parameters:
* eax = 77 - function number
* ebx = 0 - subfunction number
* ecx = pointer to futex dword
* ecx = futex control value (dword)
Returned value:
* eax = futex handle, 0 on error
Remarks:
* Use subfunction 1 to destroy the futex.
The kernel destroys the futexes automatically when the process
terminates.
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
@@ -5201,7 +5285,8 @@ Parameters:
Returned value:
* eax = 0 - successfull, -1 on error
Remarks:
* The futex handle must have been created by subfunction 0
* The kernel destroys the futexes automatically when the process
terminates.
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
@@ -5213,17 +5298,12 @@ Parameters:
* eax = 77 - function number
* ebx = 2 - subfunction number
* ecx = futex handle
* edx = control value
* esi = timeout in system ticks or 0 for infinity
* edx = futex control value (dword)
* esi = timeout in hundredths of a second, 0 - wait forever
Returned value:
* eax = 0 - successfull
-1 - timeout
-2 - futex dword does not have the same value as edx
Remarks:
* This functionn tests that the value at the futex dword still
contains the expected control value, and if so, then sleeps
waiting for a wake operation on the futex.
* The futex handle must have been created by subfunction 0
-1 - timeout
-2 - futex control value doesn't match
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
@@ -5239,15 +5319,71 @@ Parameters:
Returned value:
* eax = number of waiters that were woken up
Remarks:
* This function wakes at most edx of the waiters that are
waiting (e.g., inside futex wait) on the futex dword
* The futex handle must have been created by subfunction 0
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
ebx - SSF_WAKE (3)
======================================================================
Remarks:
* Subfunctions 4-7 are reserved and currently return -1.
* Subfunctions 8-9 and 12 are not implemented and return -EBADF (-9).
======================================================================
============ Function 77, Subfunction 10, Read from file. ============
======================================================================
Parameters:
* eax = 77 - function number
* ebx = 10 - subfunction number
* ecx = file handle
* edx = pointer to destination buffer
* esi = number of bytes to read
Returned value:
* eax = number of bytes read,
0 on EOF,
-EBADF (-9) on error
Remarks:
* Only pipe descriptors are supported.
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
ebx - SSF_FILE_READ (10)
======================================================================
=========== Function 77, Subfunction 11, Write to file. =============
======================================================================
Parameters:
* eax = 77 - function number
* ebx = 11 - subfunction number
* ecx = file handle
* edx = pointer to source buffer
* esi = number of bytes to write
Returned value:
* eax = number of bytes written,
-EBADF (-9) on error,
-EPIPE (-32) if no readers
Remarks:
* Only pipe descriptors are supported.
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
ebx - SSF_FILE_WRITE (11)
======================================================================
========== Function 77, Subfunction 13, Create pipe. ================
======================================================================
Parameters:
* eax = 77 - function number
* ebx = 13 - subfunction number
* ecx = pointer to pipefd[2] array (two dword handles)
* edx = flags (only O_CLOEXEC is allowed)
Returned value:
* eax = 0 on success,
negative errno value on error:
-EINVAL (-11), -EFAULT (-14), -ENFILE (-23), -EMFILE (-24)
Remarks:
* On success, pipefd[0] is a read handle and pipefd[1] is a
write handle.
---------------------- Constants for registers: ----------------------
eax - SF_FUTEX (77)
ebx - SSF_PIPE_CREATE (13)
======================================================================
=== Function 80 - file system interface with parameter of encoding ===
======================================================================
Parameters:

View File

@@ -70,11 +70,11 @@ SF_SYSTEM=18
SSF_WINDOW_BEHAVIOR=25 ; window focus relation with other windows
SSSF_GET_WB=1
SSSF_SET_WB=2
SF_MIDI=20
SSF_RESET=1
SSF_OUTPUT=2
SF_MIDI=20 ; deprecated/undefined in current kernel
SSF_RESET=1 ; deprecated
SSF_OUTPUT=2 ; deprecated
SF_SYSTEM_SET=21
SSF_MPU_MIDI_BASE=1
SSF_MPU_MIDI_BASE=1 ; not used (reserved)
SSF_KEYBOARD_LAYOUT=2
SSF_SYS_LANG=5
SSF_ACCESS_HD_LBA=11 ; setting of low-level access to HD
@@ -112,7 +112,7 @@ SF_BACKGROUND_GET=39
;SSF_PIXEL_BG=2
;SSF_MODE_BG=4
SF_SET_EVENTS_MASK=40 ; turn on/off desired events
SF_PORT_IN_OUT=43 ; input/output to a port
SF_PORT_IN_OUT=43 ; deprecated/undefined in current kernel
SF_SET_PORTS=46 ; reserve/free a group of input/output ports
SF_DRAW_NUMBER=47 ; draw number to the window
SF_STYLE_SETTINGS=48
@@ -132,6 +132,10 @@ SF_STYLE_SETTINGS=48
SF_APM=49
SF_SET_WINDOW_SHAPE=50
SF_CREATE_THREAD=51
SSF_CREATE_THREAD=1
SSF_GET_CURR_THREAD_SLOT=2
SSF_GET_THREAD_PRIORITY=3
SSF_SET_THREAD_PRIORITY=4
SF_CLIPBOARD=54
SSF_GET_SLOT_COUNT=0 ; get the number of slots in the clipboard
SSF_READ_CB=1
@@ -184,7 +188,7 @@ SF_SYS_MISC=68
SSF_HEAP_INIT=11
SSF_MEM_ALLOC=12
SSF_MEM_FREE=13
SSF_WAIT_SIGNAL=14 ; wait for signal from another program/driver
SSF_WAIT_SIGNAL=14 ; wait for a signal from other process
SSF_LOAD_DRIVER=16
SSF_CONTROL_DRIVER=17
SSF_LOAD_DLL=19
@@ -196,6 +200,9 @@ SF_SYS_MISC=68
SSF_SET_EXCEPTION_STATE=25
SSF_MEM_FREE_EXT=26
SSF_LOAD_FILE=27
SSF_MEM_ALLOC_RING=29
SSF_UNLOAD_DRIVER=30
SSF_GET_DRIVER_DATA=31
SF_DEBUG=69
SSF_SET_MESSAGE_AREA=0
SSF_GET_REGISTERS=1
@@ -221,7 +228,7 @@ SF_FILE=70
SF_SET_CAPTION=71
SF_SEND_MESSAGE=72
SF_BLITTER=73
SF_NETWORK_DEVICE=74
SF_NETWORK_GET=74
SSF_DEVICE_COUNT=255 ; get number of active network devices
SSF_DEVICE_TYPE=0
SSF_DEVICE_NAME=1
@@ -250,7 +257,7 @@ SF_NETWORK_SOCKET=75
SSF_RECEIVE=7
SSF_SET_OPTIONS=8
SSF_GET_OPTIONS=9
SSF_SOCKET_PAIR=10
SSF_GET_PAIR=10
SF_NETWORK_PROTOCOL=76
SSF_ETHERNET_READ_MAC=0
SSF_IP4_PACKETS_SENT=10000h
@@ -283,6 +290,9 @@ SF_FUTEX=77
SSF_DESTROY=1
SSF_WAIT=2
SSF_WAKE=3
SSF_FILE_READ=10
SSF_FILE_WRITE=11
SSF_PIPE_CREATE=13
; File system errors:
FSERR_SUCCESS=0

View File

@@ -1,10 +1,9 @@
//Copyright 2007-2025 by Veliant & Leency
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr, Burer...
//BUGS
//if maximize a window on image load => crash
//issues with a long line
//add proxy settings
//===================================================//
// //
@@ -13,6 +12,7 @@
//===================================================//
#define MEMSIZE 1024 * 160
#include "..\lib\gui.h"
#include "..\lib\draw_buf.h"
#include "..\lib\list_box.h"
@@ -21,6 +21,7 @@
#include "..\lib\random.h"
#include "..\lib\clipboard.h"
#include "..\lib\obj\libini.h"
#include "..\lib\obj\box_lib.h"
#include "..\lib\obj\libimg.h"
#include "..\lib\obj\http.h"
@@ -67,6 +68,10 @@ _http http = 0;
progress_bar prbar;
proc_info Form;
char settings_file[256];
char proxy_address[768];
#include "settings.h"
#include "tabs.h"
dword cur_img_url;
@@ -90,6 +95,7 @@ edit_box omnibox_edit = {250, 0, 0, 0xffffff,
void LoadLibraries()
{
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
load_dll(libimg, #libimg_init,1);
load_dll(libHTTP, #http_lib_init,1);
@@ -130,6 +136,7 @@ void main()
TOOLBAR_H = PADDING+TSZE+PADDING+2;
LoadLibraries();
LoadIniConfig();
HandleParam();
omnibox_edit.left = PADDING+TSZE*2+PADDING+6;
@@ -517,14 +524,17 @@ bool GetLocalFileData(dword _path)
bool GetUrl(dword _http_url)
{
char new_url_full[URL_SIZE+1];
if (!strncmp(_http_url,"http:",5)) {
if (!strncmp(_http_url,"http://",7)) {
http.get(_http_url);
return true;
} else if (!strncmp(_http_url,"https://",8)) {
strcpy(#new_url_full, "http://gate.aspero.pro/?site=");
strncat(#new_url_full, _http_url, URL_SIZE);
http.get(#new_url_full);
return true;
if (#proxy_address) {
strcpy(#new_url_full, #proxy_address);
strncat(#new_url_full, _http_url, URL_SIZE);
http.get(#new_url_full);
return true;
}
return false;
}
return false;
}

View File

@@ -70,7 +70,7 @@ Copy link
Download link contents";
char loading_text[] = "Loading...";
char update_param[] = "-e http://builds.kolibrios.org/en_US/data/programs/cmm/browser/WebView.com";
char update_download_error[] = "'WebView\nError receiving an up to date information!' -tE";
char update_download_error[] = "'WebView\nError receiving update information!' -tE";
char update_ok[] = "'WebView\nThe browser has been updated!' -tO";
char update_is_current[] = "'WebView\nThe browser is up to date.' -tI";
char update_can_not_copy[] = "'WebView\nError copying a new version from Downloads folder!\nProbably too litle space on Ramdisk.' -tE";
@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.91";
char version[]="WebView 3.92";

View File

@@ -14,7 +14,7 @@
| || | | |
\_____||__|________|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatible
<font bg=#3CE7FF> </font></font></font></font>
<td>
@@ -26,9 +26,9 @@
By the way,
<font color="#555555">&bull; You can check for browser updates from the main menu.
&bull; To run a web search, type a text in the adress box and press Ctrl+Enter.
&bull; Pressing F6 moves a text cursor to the omnibox.
&bull; You can manually change the encoding of a page by clicking on a label in the bottom right corner.
&bull; To run a web search, type text in the address box and press Ctrl+Enter.
&bull; Pressing F6 moves the text cursor to the omnibox.
&bull; You can manually change the encoding of a page by clicking on the label in the bottom right corner.

View File

@@ -4,11 +4,11 @@
<h1>&nbsp;Webpage Not Available</h1>
<h2>&nbsp;What could be done:</h2>
<ul>
<li>Make sure that evetything fine with Internet connection.<br>
<li>Make sure that you have a working Internet connection.<br>
Open <a href="/sys/network/netcfg">Netcfg</a> network diagnostic tool.<br>
<li>Check page address, there may have been made a typo.<br>
<li>Check the page address for any typos.<br>
<li>Server is temporarily unavailable.<br>
Refresh the page.<br>
<li>Browser doesn't handled properly server's response.<br>
<li>Browser didn't properly handle the server's response.<br>
Please, report an error.<br>
</ul>

View File

@@ -0,0 +1,9 @@
_ini ini;
void LoadIniConfig()
{
ini.path = GetIni(#settings_file, "app.ini");
ini.section = "WebView";
ini.GetString("proxy", #proxy_address, sizeof(proxy_address), NULL);
}

View File

@@ -1,7 +1,12 @@
//Copyright 2020 - 2025 by Leency
//Burer...
#define MEMSIZE 1024 * 40
//Copyright 2020 - 2021 by Leency
#include "../lib/gui.h"
#include "../lib/random.h"
#include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/http.h"
@@ -21,6 +26,11 @@ char uEdit[URL_SIZE];
char filepath[4096];
char save_dir[4096];
char settings_file[256];
char proxy_address[768];
#include "settings.h"
char* active_status;
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,
@@ -32,9 +42,13 @@ progress_bar pb = {0, GAPX, 52, WIN_W - GAPX - GAPX, 17, 0, NULL, NULL,
void main()
{
dword shared_url;
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
load_dll(libHTTP, #http_lib_init,1);
LoadIniConfig();
strcpy(#save_dir, DEFAULT_SAVE_DIR);
if (!dir_exists(#save_dir)) CreateDir(#save_dir);
SetCurDir(#save_dir);
@@ -167,10 +181,8 @@ void StartDownloading()
if (http.transfer > 0) return;
ResetDownloadSpeed();
pb.back_color = 0xFFFfff;
if (!strncmp(#uEdit,"https:",6)) {
//miniprintf(#get_url, "http://gate.aspero.pro/?site=%s", #uEdit);
notify("'HTTPS for download temporary is not supported,\ntrying to download the file via HTTP' -W");
miniprintf(#uEdit, "http://%s", #uEdit+8);
if (!strncmp(#uEdit,"https://",8)) {
miniprintf(#get_url, "%s%s", #proxy_address, #uEdit);
}
strcpy(#get_url, #uEdit);

View File

@@ -0,0 +1,9 @@
_ini ini;
void LoadIniConfig()
{
ini.path = GetIni(#settings_file, "app.ini");
ini.section = "WebView";
ini.GetString("proxy", #proxy_address, sizeof(proxy_address), NULL);
}

View File

@@ -101,8 +101,8 @@ dword waves_pal[256];
collection_int selected0, selected1;
dword selected_count[PANES_COUNT]=0;
libimg_image icons16_default;
libimg_image icons16_selected;
libimg_image icons18_default;
libimg_image icons18_selected;
libimg_image icons32_default;
libimg_image icons32_selected;

View File

@@ -103,7 +103,7 @@ void CopyFilesListToClipboard(bool _cut_active)
if (cut_active) {
if (i>=files.first) && (i<files.first+files.visible)
PutShadow(files.x+4,i-files.first*files.item_h+files.y,icons16_default.w,files.item_h,1,-3);
PutShadow(files.x+4,i-files.first*files.item_h+files.y,icons18_default.w,files.item_h,1,-3);
}
}
}

View File

@@ -25,7 +25,7 @@ int ICONS_INI::get(dword _file_path, _ext, int size)
else if (size == 32) return i32.get(ext_pos);
} else {
exts.add(#ext);
icons_ini.section = "icons16";
icons_ini.section = "icons18";
i18.set(exts.count-1, icons_ini.GetInt(#ext, 2));
icons_ini.section = "icons32";
@@ -60,8 +60,8 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
selected_image = icons32_selected.image;
default_image = icons32_default.image;
} else {
selected_image = icons16_selected.image;
default_image = icons16_default.image;
selected_image = icons18_selected.image;
default_image = icons18_default.image;
}
if (fairing_color==col.selec) {

View File

@@ -184,11 +184,11 @@ void LoadIcons()
icons32_default.replace_color(0x00000000, col.list_bg);
icons32_selected.replace_color(0x00000000, col.selec);
} else {
icons16_default.load("/sys/icons16.png");
icons16_selected.load("/sys/icons16.png");
icons16_selected.replace_2colors(0xffFFFfff, col.selec, 0xffCACBD6, selected_shadow);
icons18_default.load("/sys/icons18.png");
icons18_selected.load("/sys/icons18.png");
icons18_selected.replace_2colors(0xffFFFfff, col.selec, 0xffCACBD6, selected_shadow);
if (col.list_bg!=0xFFFfff) {
icons16_default.replace_2colors(0xffFFFfff, col.list_bg, 0xffCACBD6, non_white_shadow);
icons18_default.replace_2colors(0xffFFFfff, col.list_bg, 0xffCACBD6, non_white_shadow);
}
}
@@ -260,7 +260,7 @@ void BigIconsSwitch()
icon_size = 32;
LoadIcons();
} else {
icon_size = icons16_default.w;
icon_size = icons18_default.w;
}
BigFontsChange();
}

View File

@@ -220,7 +220,7 @@ void SelectList_DrawLine(dword i)
} else {
strcpy(#tname, results.name.get(select_list.first + i));
strlwr(#tname);
icons_ini.section = "icons16";
icons_ini.section = "icons18";
icon = icons_ini.GetInt(#tname + strrchr(#tname, '.'), 2);
}

View File

@@ -160,7 +160,7 @@ _ActionsHistory actionsHistory;
// //
//===================================================//
libimg_image icons16;
libimg_image icons18;
void main()
{
@@ -170,18 +170,18 @@ void main()
load_dll(libimg, #libimg_init, 1);
load_dll(boxlib, #box_lib_init,0);
icons16.load("/sys/icons16.png");
leftbar_w = icons16.w + 16;
icons18.load("/sys/icons18.png");
leftbar_w = icons18.w + 16;
sc.get();
bg_dark = skin_is_dark();
semi_white = MixColors(sc.work, 0xFFFfff, bg_dark*90 + 96);
icons16.replace_color(0xffFFFfff, sc.work);
icons16.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200));
icons18.replace_color(0xffFFFfff, sc.work);
icons18.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200));
//fix line and rectandle color for dark skins
if (bg_dark) icons16.replace_color(0xff545454, 0xffD3D3D4);
if (bg_dark) icons18.replace_color(0xff545454, 0xffD3D3D4);
EventSetActiveColor(1, color1);
@@ -301,7 +301,7 @@ void DrawTopPanelButton1(dword _event, _hotkey, _x, _icon_n)
#define ISIZE 18
#define YPOS 6
DefineHiddenButton(_x-4, YPOS-4, ISIZE+7, ISIZE+7, button.add(_event));
img_draw stdcall(icons16.image, _x, YPOS, ISIZE, ISIZE, 0, _icon_n*ISIZE);
img_draw stdcall(icons18.image, _x, YPOS, ISIZE, ISIZE, 0, _icon_n*ISIZE);
if (_hotkey) key.add_n(_hotkey, _event);
}
@@ -323,10 +323,10 @@ int DrawFlatPanelButton(dword _id, _x, _y, _text)
void DrawLeftPanelButton(dword _event, _hotkey, _y, _icon_n)
{
int x = 5;
DrawRectangle(x, _y, icons16.w + 5, icons16.w + 5, sc.work);
DefineHiddenButton(x, _y, icons16.w + 5, icons16.w + 5, button.add(_event));
img_draw stdcall(icons16.image, x+3, _y+3, icons16.w,
icons16.w, 0, _icon_n*icons16.w);
DrawRectangle(x, _y, icons18.w + 5, icons18.w + 5, sc.work);
DefineHiddenButton(x, _y, icons18.w + 5, icons18.w + 5, button.add(_event));
img_draw stdcall(icons18.image, x+3, _y+3, icons18.w,
icons18.w, 0, _icon_n*icons18.w);
key.add_n(_hotkey, _event);
}
void DrawStatusBar()
@@ -419,8 +419,8 @@ void DrawWindow()
void DrawLeftPanelSelection()
{
if (previousTool!=-1) DrawRectangle3D(5, previousTool*GAPV+right_bar.y-2, icons16.w+5, icons16.w+5, sc.work, sc.work);
DrawRectangle3D(5, currentTool*GAPV+right_bar.y-2, icons16.w+5, icons16.w+5, 0x333333, 0x777777);
if (previousTool!=-1) DrawRectangle3D(5, previousTool*GAPV+right_bar.y-2, icons18.w+5, icons18.w+5, sc.work, sc.work);
DrawRectangle3D(5, currentTool*GAPV+right_bar.y-2, icons18.w+5, icons18.w+5, 0x333333, 0x777777);
}
void DrawEditArea()
@@ -429,7 +429,7 @@ void DrawEditArea()
int top_side;
int left_side;
wrapper.x = icons16.w + 16;
wrapper.x = icons18.w + 16;
wrapper.w = Form.cwidth - right_bar.w - 10 - wrapper.x;
wrapper.h = Form.cheight - TOPBAR_H - 35;

View File

@@ -44,9 +44,9 @@ void main()
OpenDialog_init stdcall (#o_dialog);
/* Init UI */
icons18.load("/sys/icons16.png");
icons18.load("/sys/icons18.png");
icons18.replace_2colors(0xffFFFfff, COL_LIGHT, 0xffCACBD6, COL_LIGHT-0x080808);
icons18a.load("/sys/icons16.png");
icons18a.load("/sys/icons18.png");
icons18a.replace_2colors(0xffFFFfff, COL_BUTTON, 0xffCACBD6, 0);
pixie_skin.load("/sys/media/pixieskn.png");
Form.width = screen.w/6*5;

View File

@@ -112,7 +112,6 @@ struct _http
dword _http::get(dword _url)
{
cur_url = _url;
if (streqrp(cur_url, "http://gate.aspero.pro/?site=")) cur_url += 29;
http_get stdcall (_url, 0, 0, #accept_language);
transfer = EAX;
return EAX;
@@ -138,7 +137,7 @@ bool _http::stop()
transfer=0;
*/
hfree();
return true;
return true;
}
return false;
}

View File

@@ -21,8 +21,8 @@
//===================================================//
libimg_image icons32;
libimg_image icons16;
libimg_image icons16w;
libimg_image icons18;
libimg_image icons18w;
unsigned int size32;
unsigned int size16;
@@ -73,7 +73,7 @@ void main()
load_dll(libimg, #libimg_init, 1);
icons32.load("/SYS/ICONS32.PNG"); size32 = icons32.h * 32 * 4;
icons16.load("/SYS/ICONS16.PNG"); size16 = icons16.h * 18 * 4;
icons18.load("/SYS/ICONS18.PNG"); size16 = icons18.h * 18 * 4;
if (GetProcessesCount("@RESHARE")>1) {
start_ui();
@@ -103,8 +103,8 @@ void start_daemon()
img_destroy stdcall(icons32.image);
shared_i16 = memopen("ICONS18", size16, SHM_CREATE + SHM_WRITE);
memmov(shared_i16, icons16.imgsrc, size16);
//img_destroy stdcall(icons16.image);
memmov(shared_i16, icons18.imgsrc, size16);
//img_destroy stdcall(icons18.image);
shared_i16w = memopen("ICONS18W", size16, SHM_CREATE + SHM_WRITE);
@@ -114,7 +114,7 @@ void start_daemon()
sc.get();
$pop eax
if (sc.work != EAX) {
memmov(shared_i16w, icons16.imgsrc, size16);
memmov(shared_i16w, icons18.imgsrc, size16);
replace_2cols(shared_i16w, size16, 0xffFFFfff, sc.work, 0xffCACBD6, sc.dark);
}
} while(WaitEvent()==evDesktop);
@@ -133,7 +133,7 @@ void start_daemon()
#define BTNH 24
#define RESY PAD+30+BTNH+BTNH
enum { ACTIVE_ICONS32=1, ACTIVE_ICONS16=2, ACTIVE_ICONS16W=4, ACTIVE_CHECKBOX=8 };
enum { ACTIVE_ICONS32=1, ACTIVE_ICONS18=2, ACTIVE_ICONS18W=4, ACTIVE_CHECKBOX=8 };
int active_tab = ACTIVE_ICONS32;
void start_ui()
@@ -190,8 +190,8 @@ void draw_tabs()
{
#define TABX WINW-BTNW-PAD-BTNW-PAD-BTNW-PAD-BTNW/2
DrawFlatButton( TABX, PAD+30, "ICONS32", 10+ACTIVE_ICONS32, active_tab & ACTIVE_ICONS32);
DrawFlatButton(PAD+BTNW*1+TABX, PAD+30, "ICONS16", 10+ACTIVE_ICONS16, active_tab & ACTIVE_ICONS16);
DrawFlatButton(PAD+BTNW*2+TABX, PAD+30, "ICONS16W", 10+ACTIVE_ICONS16W, active_tab & ACTIVE_ICONS16W);
DrawFlatButton(PAD+BTNW*1+TABX, PAD+30, "ICONS18", 10+ACTIVE_ICONS18, active_tab & ACTIVE_ICONS18);
DrawFlatButton(PAD+BTNW*2+TABX, PAD+30, "ICONS18W", 10+ACTIVE_ICONS18W, active_tab & ACTIVE_ICONS18W);
DrawFlatButton(PAD+BTNW*3+TABX, PAD+30, "CHECKBOX", 10+ACTIVE_CHECKBOX, active_tab & ACTIVE_CHECKBOX);
draw_tab_icons32();
}
@@ -209,14 +209,14 @@ void draw_tab_icons32()
iconimg = icons32.imgsrc;
iconw = 32;
iconh = icons32.h;
} else if (active_tab & ACTIVE_ICONS16) {
iconimg = icons16.imgsrc;
} else if (active_tab & ACTIVE_ICONS18) {
iconimg = icons18.imgsrc;
iconw = 18;
iconh = icons16.h;
} else if (active_tab & ACTIVE_ICONS16W) {
iconh = icons18.h;
} else if (active_tab & ACTIVE_ICONS18W) {
iconimg = memopen("ICONS18W", NULL, SHM_READ);
iconw = 18;
iconh = icons16.h;
iconh = icons18.h;
} else {
PutImage(WINW-13/2, WINH-RESY-13/2+RESY, 13, 13, #checkbox_flag);
return;

Binary file not shown.

View File

@@ -0,0 +1,55 @@
Keyboard Shortcuts:
ctrl+A Select all
ctrl+C Copy
ctrl+V Paste
ctrl+X Cut
ctrl+L Convert to lowercase
ctrl+U Convert to uppercase
ctrl+F,
ctrl+H Show search/replace panel
Esc Close search panel; Close menu
shift+Esc Hide (Minimize) search panel
F10 Open main menu
shift+F10 Open context menu
F3 Find next
shift+F3 Find previous
ctrl+Z Undo
ctrl+Y Redo
ctrl+G Go to line...
ctrl+Del Delete line
ctrl+D Duplicate line
ctrl+Up Move text up
ctrl+Down Move text down
ctrl+E Select word
Tab Increase indent for text
shift+
Backspace Decrease indent for selected text
shift+Tab Decrease indent for text
ctrl+F2 Set/Remove bookmark
F2 Go to next bookmark
shift+F2 Go to previous bookmark
ctrl+S Save
ctrl+O Open
ctrl+N,
ctrl+T Create new
ctrl+W Close File
ctrl+Tab Switch to Next Tab
ctrl+F9 Compile
F9 Run
ctrl+F8 Debug
shift+wheel Horizontal scrolling
Navigating text:
(ctrl+)Home, (ctrl+)End, (ctrl+)PageUp, (ctrl+)PageDown
ctrl+Left, ctrl+Right
Navigating in search panel:
Tab Move to next input field
shift+Tab Move to previous input field
Enter Find next occurrence

View File

@@ -1,49 +1,55 @@
Горячие клавиши:
ctrl+A выделить всё
ctrl+C копировать
ctrl+V вставить
ctrl+X вырезать
ctrl+L преобразовать в нижний регистр
ctrl+U преобразовать в верхний регистр
ctrl+F,
ctrl+H показать панель поиска/замены
Esc закрыть панель поиска; закрыть меню
shift+Esc скрыть (свернуть) панель поиска
F10 открыть главное меню
shift+F10 открыть контекстное меню
F3 найти следующий
shift+F3 найти предыдущий
ctrl+Z отменить
ctrl+Y вернуть
ctrl+G перейти на строку...
ctrl+Del удалить строку
ctrl+D дублировать строку
ctrl+Up переместить текст вверх
ctrl+Down переместить текст вниз
ctrl+E выделить слово
Tab увеличить отступ для выделенного текста
shift+
Backspace уменьшить отступ для выделенного текста
ctrl+F2 установить/снять метку
F2 перейти к метке ниже
shift+F2 перейти к метке выше
ctrl+S сохранить
ctrl+O открыть
ctrl+N,
ctrl+T создать новый
ctrl+W закрыть файл
ctrl+Tab переключиться на следующую вкладку
ctrl+F9 компилировать
F9 выполнить
ctrl+F8 отладка
shift+wheel горизонтальная прокрутка
перемещение по тексту:
(ctrl+)Home, (ctrl+)End, (ctrl+)PageUp, (ctrl+)PageDown
ctrl+Left, ctrl+Right
Горячие клавиши:
ctrl+A выделить всё
ctrl+C копировать
ctrl+V вставить
ctrl+X вырезать
ctrl+L преобразовать в нижний регистр
ctrl+U преобразовать в верхний регистр
ctrl+F,
ctrl+H показать панель поиска/замены
Esc закрыть панель поиска; закрыть меню
shift+Esc скрыть (свернуть) панель поиска
F10 открыть главное меню
shift+F10 открыть контекстное меню
F3 найти следующий
shift+F3 найти предыдущий
ctrl+Z отменить
ctrl+Y вернуть
ctrl+G перейти на строку...
ctrl+Del удалить строку
ctrl+D дублировать строку
ctrl+Up переместить текст вверх
ctrl+Down переместить текст вниз
ctrl+E выделить слово
Tab увеличить отступ для текста
shift+
Backspace уменьшить отступ для выделенного текста
shift+Tab уменьшить отступ для текста
ctrl+F2 установить/снять метку
F2 перейти к метке ниже
shift+F2 перейти к метке выше
ctrl+S сохранить
ctrl+O открыть
ctrl+N,
ctrl+T создать новый
ctrl+W закрыть файл
ctrl+Tab переключиться на следующую вкладку
ctrl+F9 компилировать
F9 выполнить
ctrl+F8 отладка
shift+wheel горизонтальная прокрутка
перемещение по тексту:
(ctrl+)Home, (ctrl+)End, (ctrl+)PageUp, (ctrl+)PageDown
ctrl+Left, ctrl+Right
перемещение в панели поиска:
Tab к следующему полю ввода
Shift-Tab к предыдущему полю ввода
Enter поиск следующего вхождения

View File

@@ -28,7 +28,9 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
CONST
HEADER = "CEdit (30-apr-2025)";
APPNAME = "CEdit";
VERSION = "1.0";
HEADER = APPNAME + " " + VERSION;
ShellFilter = "";
EditFilter = "sh|inc|txt|asm|ob07|c|cpp|h|pas|pp|lua|ini|json";
@@ -1575,7 +1577,7 @@ VAR
BEGIN
menu := List.create(NIL);
Menu.AddMenuItem(menu, menuIncInd, "increase Tab");
Menu.AddMenuItem(menu, menuDecInd, "decrease shift-Bksp");
Menu.AddMenuItem(menu, menuDecInd, "decrease shift-Tab");
RETURN Menu.create(menu, mainTID)
END CreateMenuIndent;
@@ -1686,6 +1688,8 @@ BEGIN
ELSE
IF keyCode = -1 THEN
key := -1
ELSIF (keyCode = 15) & shift THEN (* Shift-Tab *)
T.Indent(text, FALSE)
ELSIF keyCode = 61 THEN (* F3 *)
key := -1;
IF search & (searchText # "") THEN
@@ -1750,7 +1754,15 @@ BEGIN
ELSE
IF EditBox_Focus(FindEdit) THEN
IF keyCode = 15 THEN (* Tab *)
SetFocus(ReplaceEdit, TRUE)
IF shift THEN
SetFocus(GotoEdit, TRUE)
ELSE
SetFocus(ReplaceEdit, TRUE)
END
ELSIF keyCode = 28 THEN (* Enter *)
IF searchOpened & (searchText # "") THEN
notFound := ~T.findNext(text, BKW.value)
END
ELSE
EB.key(FindEdit, key);
EditBox_Get(FindEdit, new_searchText);
@@ -1761,14 +1773,26 @@ BEGIN
END
ELSIF EditBox_Focus(ReplaceEdit) THEN
IF keyCode = 15 THEN (* Tab *)
SetFocus(GotoEdit, TRUE)
IF shift THEN
SetFocus(FindEdit, TRUE)
ELSE
SetFocus(GotoEdit, TRUE)
END
ELSIF keyCode = 28 THEN (* Enter *)
IF searchOpened & (searchText # "") THEN
notFound := ~T.findNext(text, BKW.value)
END
ELSE
EB.key(ReplaceEdit, key);
EditBox_Get(ReplaceEdit, replaceText)
END
ELSIF EditBox_Focus(GotoEdit) THEN
IF keyCode = 15 THEN (* Tab *)
SetFocus(FindEdit, TRUE)
IF shift THEN
SetFocus(ReplaceEdit, TRUE)
ELSE
SetFocus(FindEdit, TRUE)
END
ELSE
IF (key DIV 256) MOD 256 = 13 THEN
goto

View File

@@ -23,7 +23,7 @@ IMPORT
Graph, File, SYSTEM, KOSAPI;
CONST
fileName = "/sys/Icons16.png";
fileName = "/sys/Icons18.png";
libName = "libimg.obj";
SIZE* = 18;

View File

@@ -0,0 +1,9 @@
if tup.getconfig("NO_OB07") ~= "" then return end
if tup.getconfig("HELPERDIR") == ""
then
HELPERDIR = "../../"
end
tup.include(HELPERDIR .. "/use_ob07.lua")
build_ob07({"SRC/CEdit.ob07"}, "cedit");

View File

@@ -24,7 +24,7 @@
; Ctrl+F - ¯®¨áª (+Tab ¤«ï OptionBox)
; Ctrl+G - ¯¥à¥å®¤ ­  ᬥ饭¨¥ (+Tab ¤«ï OptionBox)
; Ctrl+B - ¢ë¤¥«¨âì ¡«®ª
; ESC - á­ïâì ¢ë¤¥«¥­¨¥
; ESC - á­ïâì ¢ë¤¥«¥­¨¥/¢ë室
; Ctrl+C - ª®¯¨à®¢ âì ¡«®ª
; Ctrl+V - ¢áâ ¢¨âì ¢ ¢ë¤¥«¥­­ãî ®¡« áâì
; Ctrl+X - ¢ë१ âì ¢ë¤¥«¥­­ãî ®¡« áâì (¢ ¡ãä¥à)
@@ -2699,7 +2699,8 @@ Ctrl_END:
jmp red
;--------------------------------------------------------------------
ESC:
btr [flags],8
btr [flags], 8
jnc close_prog
jmp red
;--------------------------------------------------------------------
copy_to_buf:
@@ -3236,7 +3237,7 @@ if lang eq ru_RU
db 'Ctrl+F - ¯®¨áª '
db 'Ctrl+G - ¯¥à¥å®¤ ­  ᬥ饭¨¥ '
db 'Ctrl+B - ¢ë¤¥«¨âì ¡«®ª '
db 'ESC - á­ïâì ¢ë¤¥«¥­¨¥ '
db 'ESC - á­ïâì ¢ë¤¥«¥­¨¥/¢ë室 '
db 'Ctrl+C - ª®¯¨à®¢ âì ¡«®ª '
db 'Ctrl+V - ¢áâ ¢¨âì ¢ ¢ë¤¥«¥­­ãî ®¡« áâì'
db 'Ctrl+X - ¢ë१ âì ¢ ¡ãä¥à '
@@ -3258,7 +3259,7 @@ else ; Default to en_US
db 'Ctrl+F - find '
db 'Ctrl+G - go to offset '
db 'Ctrl+B - select area '
db 'ESC - deselect area '
db 'ESC - deselect area/exit '
db 'Ctrl+C - copy area '
db 'Ctrl+V - past into area from buf '
db 'Ctrl+X - cut area into buffer '

View File

@@ -1,10 +1,7 @@
if not exist bin mkdir bin
@erase lang.inc
@echo lang fix en_US >lang.inc
@copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@fasm.exe -m 16384 info3ds.asm bin\info3ds.kex
@kpack bin\info3ds.kex
@fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex

View File

@@ -1,10 +1,7 @@
if not exist bin mkdir bin
@erase lang.inc
@echo lang fix ru_RU >lang.inc
@copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@fasm.exe -m 16384 info3ds.asm bin\info3ds.kex
@kpack bin\info3ds.kex
@fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex

View File

@@ -1,6 +1,10 @@
; SPDX-License-Identifier: GPL-2.0-only
; Info3ds - is a program for viewing the structure of *.3ds files
; Copyright (C) 2011-2025 KolibriOS team
use32
org 0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
db 'MENUET01'
dd 1, start, i_end, mem, stacktop, file_name, sys_path
version_edit equ 1
@@ -22,36 +26,34 @@ include 'convert_stl_3ds.inc'
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
ID_ICON_CHUNK_MAIN equ 0 ;¨ª®­ª  £« ¢­®£® ¡«®ª 
ID_ICON_CHUNK_NOT_FOUND equ 1 ;¨ª®­ª  ­¥ ¨§¢¥áâ­®£® ¡«®ª 
ID_ICON_DATA equ 2 ;¨ª®­ª  ¤«ï ¤ ­­ëå ¡«®ª , ­¥ ®¯à¥¤¥«¥­­®© áâàãªâãàë
ID_ICON_CHUNK_MAIN equ 0 ;main block icon
ID_ICON_CHUNK_NOT_FOUND equ 1 ;unknown block icon
ID_ICON_DATA equ 2 ;icon for block data, undefined structure
ID_ICON_POINT equ 8
ID_ICON_POINT_SEL equ 9
FILE_ERROR_CHUNK_SIZE equ -3 ;®è¨¡ª  ¢ à §¬¥à¥ ¡«®ª 
FILE_ERROR_CHUNK_SIZE equ -3 ;block size error
include 'info_o3d.inc'
main_wnd_height equ 460 ;¢ëá®â  £« ¢­®£® ®ª­  ¯à®£à ¬¬ë
main_wnd_height equ 460 ;height of the main program window
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
align 4
fl255 dd 255.0
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢ 3ds
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
open_file_data dd 0 ;pointer to memory for opening 3ds files
open_file_size dd 0
image_data_toolbar dd 0
icon_tl_sys dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
icon_toolbar dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
fn_toolbar db 'toolbar.png',0
icon_tl_sys dd 0 ;pointer to memory for storing system icons
icon_toolbar dd 0 ;pointer to memory for storing object icons
align 4
level_stack dd 0
offs_last_timer dd 0 ;¯®á«¥¤­¨© ᤢ¨£ ¯®ª § ­ë© ¢ ä㭪樨 â ©¬¥à 
offs_last_timer dd 0 ;last shift shown in timer function
align 4
file_3ds: ;¯¥à¥¬¥­­ë¥ ¨á¯®«ì§ã¥¬ë¥ ¯à¨ ®âªàë⨨ ä ©« 
.offs: dd 0 ;+0 㪠§ â¥«ì ­  ­ ç «® ¡«®ª 
.size: dd 0 ;+4 à §¬¥à ¡«®ª  (¤«ï 1-£® ¯ à ¬¥âà  = à §¬¥à ä ©«  3ds)
file_3ds: ;variables used when opening a file
.offs: dd 0 ;+0 pointer to the beginning of the block
.size: dd 0 ;+4 block size (for 1st parameter = 3ds file size)
rb 8*MAX_FILE_LEVEL
size_one_list equ 42
@@ -81,7 +83,7 @@ start:
stosd
load_libraries l_libs_start,l_libs_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨«¨áì ¡¨¡«¨®â¥ª¨
;checking how successfully the libraries were loaded
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -94,7 +96,7 @@ start:
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0xC0000027
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
stdcall [OpenDialog_Init],OpenDialog_data ;preparation of dialogue
;kmenu initialisation
stdcall [kmenu_init],sc
@@ -143,70 +145,68 @@ start:
stdcall [tl_data_init], tree1
;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
include_image_file 'tl_sys_16.png', icon_tl_sys
;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
mov eax,dword[icon_tl_sys]
mov dword[tree1.data_img_sys],eax
mov eax,[icon_tl_sys]
mov [tree1.data_img_sys],eax
load_image_file 'objects.png', icon_toolbar
mov eax,dword[icon_toolbar]
mov dword[tree1.data_img],eax
include_image_file 'objects.png', icon_toolbar
mov eax,[icon_toolbar]
mov [tree1.data_img],eax
stdcall [buf2d_create], buf_0 ;á®§¤ ­¨¥ ¡ãä¥à 
load_image_file 'font8x9.bmp', image_data_toolbar
include_image_file '../../fs/kfar/trunk/font8x9.bmp', image_data_toolbar
stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;á®§¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file fn_toolbar, image_data_toolbar
include_image_file 'toolbar.png', image_data_toolbar
;à ¡®â  á ä ©«®¬ ­ áâ஥ª
copy_path ini_name,sys_path,file_name,0
mov dword[def_dr_mode],0
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1
stdcall [ini_get_int],file_name,ini_sec_w3d,key_dv,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_vertexes
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1
stdcall [ini_get_int],file_name,ini_sec_w3d,key_df,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_faces
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1
stdcall [ini_get_int],file_name,ini_sec_w3d,key_dff,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_faces_fill
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1
stdcall [ini_get_int],file_name,ini_sec_w3d,key_dl,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_light
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1
stdcall [ini_get_int],file_name,ini_sec_w3d,key_ds,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_smooth
@@:
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff
stdcall [ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff
mov [color_ox],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000
stdcall [ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000
mov [color_oy],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00
stdcall [ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00
mov [color_oz],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000
stdcall [ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000
mov [color_bk],eax
shr eax,8
mov [color_bk+4],eax
shr eax,8
mov [color_bk+8],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff
stdcall [ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff
mov [color_vert],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080
stdcall [ini_get_color],file_name,ini_sec_w3d,key_face,0x808080
mov [color_face],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00
stdcall [ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00
mov [color_select],eax
finit
fild dword[color_bk+8]
@@ -262,19 +262,19 @@ still:
or eax,eax
jz timer_funct
cmp al,1
cmp al,EV_REDRAW
jne @f
call draw_window
jmp still
@@:
cmp al,2
cmp al,EV_KEY
jz key
cmp al,3
cmp al,EV_BUTTON
jz button
cmp al,6
cmp al,EV_MOUSE
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo+4]
cmp ax,word[procinfo.window_stack_position]
jne @f ;®ª­® ­¥  ªâ¨¢­®
call mouse
@@:
@@ -282,7 +282,7 @@ still:
align 4
mouse:
stdcall [tl_mouse], dword tree1
stdcall [tl_mouse], tree1
ret
align 4
@@ -385,7 +385,7 @@ pushad
mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height
mcall SF_THREAD_INFO,procinfo,-1
mov eax,dword[procinfo.box.height]
mov eax,[procinfo.box.height]
cmp eax,250
jge @f
mov eax,250
@@ -393,13 +393,14 @@ pushad
sub eax,65
mov dword[tree1.box_height],eax
mov word[w_scr_t1.y_size],ax ;­®¢ë¥ à §¬¥àë áªà®««¨­£ 
cmp eax,dword[buf_0.h] ;㢥«¨ç¨¢ ¥¬ ¢ëá®âã ¡ãä¥à 
jle @f
cmp eax,dword[buf_0.h] ;change buffer height
je @f
stdcall [buf2d_resize],buf_0,0,eax,1
mov dword[offs_last_timer],0 ;¤«ï ®¡­®¢«¥­¨ï ¡ãä¥à  ¢ â ©¬¥à¥
stdcall [buf2d_clear], buf_0, [buf_0.color] ;background update
mov dword[offs_last_timer],0 ;for update buffer in the timer
@@:
mov eax,dword[procinfo.box.width]
mov eax,[procinfo.box.width]
cmp eax,400
jge @f
mov eax,400
@@ -457,7 +458,7 @@ popad
align 4
key:
mcall SF_GET_KEY
stdcall [tl_key], dword tree1
stdcall [tl_key], tree1
jmp still
@@ -1087,53 +1088,6 @@ l_libs_start:
lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
@@ -1146,122 +1100,9 @@ dd 0,0
aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_box_lib:
dd sz_init1
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
edit_box_set_text dd sz_edit_box_set_text
scrollbar_ver_draw dd sz_scrollbar_ver_draw
scrollbar_hor_draw dd sz_scrollbar_hor_draw
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_node_move_up dd sz_tl_node_move_up
tl_node_move_down dd sz_tl_node_move_down
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
tl_node_poi_get_info dd sz_tl_node_poi_get_info
tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info
tl_node_poi_get_data dd sz_tl_node_poi_get_data
dd 0,0
sz_init1 db 'lib_init',0
sz_edit_box_draw db 'edit_box_draw',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_node_move_up db 'tl_node_move_up',0
sz_tl_node_move_down db 'tl_node_move_down',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
include '../../develop/libraries/libs-dev/libimg/import.inc'
include '../../develop/libraries/box_lib/import.inc'
include '../../develop/libraries/buf2d/import.inc'
align 4
import_libkmenu:
@@ -1287,23 +1128,7 @@ dd 0,0
akmenuitem_delete db 'kmenuitem_delete',0
akmenuitem_draw db 'kmenuitem_draw',0
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
include '../../develop/libraries/TinyGL/asm_fork/import.inc'
align 4
import_libini:
@@ -1367,9 +1192,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru_RU
capt db 'info 3ds ¢¥àá¨ï 04.05.25',0 ;¯®¤¯¨áì ®ª­ 
capt db 'info 3ds ¢¥àá¨ï 22.10.25',0
else ; Default to en_US
capt db 'info 3ds version 04.05.25',0 ;window caption
capt db 'info 3ds version 22.10.25',0 ;window caption
end if
align 16

View File

@@ -1,3 +1,7 @@
; SPDX-License-Identifier: GPL-2.0-only
; Info3ds_u - is a program for viewing the structure of *.3ds files
; Copyright (C) 2015-2025 KolibriOS team
use32
org 0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
@@ -12,6 +16,7 @@ include '../../develop/libraries/libs-dev/libimg/libimg.inc'
include '../../load_img.inc'
include '../../load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/TinyGL/asm_fork/kosgl.inc'
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
include 'info_fun_float.inc'
@@ -21,8 +26,8 @@ include 'convert_stl_3ds.inc'
3d_wnd_l equ 205 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
3d_wnd_t equ 47 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
3d_wnd_w equ 344
3d_wnd_h equ 312
3d_wnd_w equ 345
3d_wnd_h equ 384
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@@ -43,13 +48,13 @@ list_offs_text equ 14+sizeof.obj_3d ;ᤢ
include 'info_o3d.inc'
align 4
fl180 dd 180.0
fl255 dd 255.0
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢ 3ds
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
;
main_wnd_height equ 460 ;¢ëá®â  £« ¢­®£® ®ª­  ¯à®£à ¬¬ë
fn_toolbar db 'toolbar.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
image_data_toolbar dd 0
;
@@ -140,17 +145,17 @@ start:
mov eax,dword[icon_tl_sys]
mov dword[tree1.data_img_sys],eax
load_image_file 'objects.png', icon_toolbar
include_image_file 'objects.png', icon_toolbar
mov eax,dword[icon_toolbar]
mov dword[tree1.data_img],eax
load_image_file 'font8x9.bmp', image_data_toolbar
include_image_file '../../fs/kfar/trunk/font8x9.bmp', image_data_toolbar
stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;á®§¤ ¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file fn_toolbar, image_data_toolbar
include_image_file 'toolbar.png', image_data_toolbar
;à ¡®â  á ä ©«®¬ ­ áâ஥ª
copy_path ini_name,sys_path,file_name,0
@@ -223,7 +228,7 @@ start:
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢
stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0
@@ -231,7 +236,7 @@ start:
call [gluNewQuadric]
mov [qObj],eax
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[ctx1.gl_context]
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -257,20 +262,20 @@ still:
or eax,eax
jz timer_funct
cmp al,1
cmp al,EV_REDRAW
jne @f
call draw_window
jmp still
@@:
cmp al,2
cmp al,EV_KEY
jz key
cmp al,3
cmp al,EV_BUTTON
jz button
cmp al,6
cmp al,EV_MOUSE
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo+4]
jne @f ;®ª­® ­¥  ªâ¨¢­®
cmp ax,word[procinfo.window_stack_position]
jne @f ;window is not active
call mouse
@@:
jmp still
@@ -301,9 +306,9 @@ mouse:
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
cmp ebx,[buf_ogl.w]
jle @f
mov ebx,3d_wnd_w
mov ebx,[buf_ogl.w]
@@:
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
@@ -311,9 +316,9 @@ mouse:
mov eax,3d_wnd_t
@@:
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
cmp eax,[buf_ogl.h]
jle @f
mov eax,3d_wnd_h
mov eax,[buf_ogl.h]
@@:
finit
fild dword[mouse_y]
@@ -351,13 +356,13 @@ mouse:
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
cmp ebx,[buf_ogl.w]
jg .end_d
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
jl .end_d
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
cmp eax,[buf_ogl.h]
jg .end_d
mov dword[mouse_drag],1
mov dword[mouse_x],ebx
@@ -440,16 +445,7 @@ pushad
or edx,0x33000000
mcall SF_CREATE_WINDOW, (20 shl 16)+560, (20 shl 16)+main_wnd_height,,, capt
mcall SF_THREAD_INFO,procinfo,-1
mov eax,dword[procinfo.box.height]
cmp eax,250
jge @f
mov eax,250
@@:
sub eax,30
sub eax,[tree1.box_top]
mov [tree1.box_height],eax
mov word[w_scr_t1.y_size],ax ;­®¢ë¥ à §¬¥àë áªà®««¨­£ 
call OnResize
stdcall [kmainmenu_draw], [main_menu]
@@ -493,6 +489,64 @@ pushad
popad
ret
align 4
OnResize:
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
push eax
mcall SF_THREAD_INFO,procinfo,-1
mov eax,[procinfo.box.height]
cmp eax,250
jge @f
mov eax,250
@@:
sub eax,[esp]
sub eax,5
sub eax,[tree1.box_top]
mov [tree1.box_height],eax
mov word[w_scr_t1.y_size],ax ;new scroll sizes
cmp [buf_ogl.h],eax
je @f
mov [buf_ogl.h],eax
mov dword[buf_ogl.w],0 ;reset width
@@:
pop eax
movzx eax,word[w_scr_t1.x_size]
add eax,[tree1.box_left]
add eax,[tree1.box_width]
add eax,15 ;5 px * 3 borders
sub eax,[procinfo.box.width]
neg eax
cmp eax,64
jge @f
mov eax,64
@@:
cmp [buf_ogl.w],eax
je .end
mov [buf_ogl.w],eax
fild dword[buf_ogl.w]
fld st0
fdiv dword[fl180]
fstp dword[angle_dxm]
fidiv dword[buf_ogl.h]
fstp dword[ratio]
stdcall [glViewport], 0,0, [buf_ogl.w], [buf_ogl.h]
mov eax,[ctx1.gl_context]
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
stdcall [tl_node_get_data],tree1
or eax,eax
jz .end
mov dword[offs_last_timer],0 ;for update buffer in the timer
add eax,list_offs_obj3d
stdcall obj_set_sizes, eax
stdcall draw_3d, eax
.end:
ret
align 4
key:
mcall SF_GET_KEY
@@ -1152,57 +1206,10 @@ l_libs_start:
lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib
lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d
lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_tinygl
lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
@@ -1215,122 +1222,9 @@ dd 0,0
aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_box_lib:
dd sz_init1
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
edit_box_set_text dd sz_edit_box_set_text
scrollbar_ver_draw dd sz_scrollbar_ver_draw
scrollbar_hor_draw dd sz_scrollbar_hor_draw
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_node_move_up dd sz_tl_node_move_up
tl_node_move_down dd sz_tl_node_move_down
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
tl_node_poi_get_info dd sz_tl_node_poi_get_info
tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info
tl_node_poi_get_data dd sz_tl_node_poi_get_data
dd 0,0
sz_init1 db 'lib_init',0
sz_edit_box_draw db 'edit_box_draw',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_node_move_up db 'tl_node_move_up',0
sz_tl_node_move_down db 'tl_node_move_down',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
include '../../develop/libraries/libs-dev/libimg/import.inc'
include '../../develop/libraries/box_lib/import.inc'
include '../../develop/libraries/buf2d/import.inc'
align 4
import_libkmenu:
@@ -1356,19 +1250,7 @@ dd 0,0
akmenuitem_delete db 'kmenuitem_delete',0
akmenuitem_draw db 'kmenuitem_draw',0
align 4
import_lib_tinygl:
macro E_LIB n
{
n dd sz_#n
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
dd 0,0
macro E_LIB n
{
sz_#n db `n,0
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
include '../../develop/libraries/TinyGL/asm_fork/import.inc'
align 4
import_libini:
@@ -1387,7 +1269,7 @@ mouse_dd dd 0
last_time dd 0
angle_dxm dd 1.9111 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
angle_dym dd 1.7333 ;~ 3d_wnd_h/180
ratio dd 1.1025 ;~ 3d_wnd_w/3d_wnd_h
ratio dd 0.8984375 ;~ 3d_wnd_w/3d_wnd_h
align 4
buf_ogl:
@@ -1427,14 +1309,14 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru_RU
capt db 'info 3ds [user] ¢¥àá¨ï 14.04.25',0 ; ¯®¤¯¨áì ®ª­ 
capt db 'info 3ds [user] ¢¥àá¨ï 24.10.25',0 ; ¯®¤¯¨áì ®ª­ 
else ; Default to en_US
capt db 'info 3ds [user] version 14.04.25',0 ; Window caption
capt db 'info 3ds [user] version 24.10.25',0 ; Window caption
end if
align 16
i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
ctx1 TinyGLContext
procinfo process_information
run_file_70 FileInfoBlock
sc system_colors

View File

@@ -802,7 +802,14 @@ align 4
proc draw_3d uses eax ebx ecx edi, o_data:dword
mov edi,[o_data]
cmp dword[edi+obj_3d.poi_count],2
if version_edit eq 0
jge @f
stdcall [buf2d_clear], buf_ogl, [buf_ogl.color]
jmp .end_f
@@:
else
jl .end_f
end if
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;®ç¨á⨬ ¡ãä¥à æ¢¥â  ¨ £«ã¡¨­ë
call [glPushMatrix]
bt dword[draw_mode],bit_light

View File

@@ -1,18 +1,19 @@
;
; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ­ã¦­ë¥ ¤«ï á®§¤ ­¨ï ¨
; à ¡®âë ®ª­  á ª®®à¤¨­ â ¬¨ ¢¥à設
; This file contains functions needed to create
; and operate a window with vertex coordinates
;
prop_wnd_width equ 340 ;è¨à¨­  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
prop_wnd_height equ 460 ;¢ëá®â  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
3d_wnd_l equ 5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
3d_wnd_t equ 23 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
3d_wnd_w equ 320
3d_wnd_l equ 5 ;tinygl buffer left indent
3d_wnd_t equ 23 ;tinygl buffer top indent
3d_wnd_w equ 396
3d_wnd_h equ 240
SIZE_ONE_FLOAT equ 14
MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1)
prop_wnd_run db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ᮠ᢮©á⢠¬¨ ®¤­®¢à¥¬¥­­®
align 4
fl180 dd 180.0
prop_wnd_run db 0 ;variable that ensures that no more than 1 window with properties is launched at the same time
txt_q db '?',0
txt_space:
@@ -173,20 +174,23 @@ prop_still:
jmp .end
@@:
cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
cmp al,EV_REDRAW
jne @f
call prop_red_win
jmp .end
@@:
cmp al,2
cmp al,EV_KEY
jne @f
call prop_key
jmp .end
@@:
cmp al,3
cmp al,EV_BUTTON
jz prop_button
cmp al,6
cmp al,EV_MOUSE
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo.window_stack_position]
jne @f ;window is not active
call prop_mouse
@@:
.end:
@@ -198,20 +202,65 @@ prop_red_win:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
xor eax,eax
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
push eax
mcall SF_THREAD_INFO,procinfo,-1
cmp dword[procinfo.box.height],0
je .resize_end
mov eax,[procinfo.box.height]
sub eax,[esp]
sub eax,[tree3.box_top]
sub eax,5
cmp eax,48
jge @f
mov eax,48 ;min size
@@:
mov dword[tree3.box_height],eax
mov word[w_scr_t3.y_size],ax
mov ebx,[procinfo.box.width]
sub ebx,37
cmp ebx,240
jge @f
mov ebx,240
@@:
mov [tree3.box_width],ebx
add ebx,[tree3.box_left]
mov word[w_scr_t3.x_pos],bx
;todo: resize scroll slider
mov eax,[tree3.box_width]
add eax,16
cmp [buf_ogl.w],eax
je .resize_end
mov [buf_ogl.w],eax
fild dword[buf_ogl.w]
fld st0
fdiv dword[fl180]
fstp dword[angle_dxm]
fidiv dword[buf_ogl.h]
fstp dword[ratio]
stdcall [glViewport], 0,0, [buf_ogl.w], 3d_wnd_h
stdcall obj_set_sizes, o3d
.resize_end:
mov edi,dword[capt_p] ;children window caption
mov bx,word[procinfo.box.left]
add bx,word[buf_0.l]
add bx,5 ;è¨à¨­  ¡®ª®¢®© à ¬ª¨
add bx,5 ;side frame width
shl ebx,16
mov bx,prop_wnd_width
mov bx,word[tree3.box_width]
add bx,37
mov cx,word[procinfo.box.top]
add cx,word[buf_0.t]
shl ecx,16
mov cx,prop_wnd_height
pop eax
add eax,[tree3.box_height]
add eax,[tree3.box_top]
add eax,5
mov cx,ax
mov edx,[sc.work]
or edx,0x33000000
int 0x40
mcall SF_CREATE_WINDOW
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 0x40000003
@@ -226,7 +275,7 @@ pushad
int 0x40
mov dword[w_scr_t3.all_redraw],1
stdcall [scrollbar_ver_draw],dword w_scr_t3
stdcall [scrollbar_v_draw], w_scr_t3
stdcall [tl_draw], tree3
stdcall [edit_box_draw], edit1
stdcall [edit_box_draw], edit2
@@ -316,9 +365,9 @@ prop_mouse:
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
cmp ebx,[buf_ogl.w]
jle @f
mov ebx,3d_wnd_w
mov ebx,[buf_ogl.w]
@@:
and eax,0xffff ;mouse.y
cmp eax,3d_wnd_t
@@ -334,14 +383,14 @@ prop_mouse:
fild dword[mouse_y]
mov [mouse_y],eax
fisub dword[mouse_y]
fdiv dword[angle_dxm] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ y (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ x
fdiv dword[angle_dym] ;if the cursor moves along the y axis
fadd dword[angle_x]
fstp dword[angle_x]
fild dword[mouse_x]
mov [mouse_x],ebx
fisub dword[mouse_x]
fdiv dword[angle_dym] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ x (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ y
fdiv dword[angle_dxm] ;if the cursor moves along the x axis
fadd dword[angle_y]
fstp dword[angle_y]
@@ -363,7 +412,7 @@ prop_mouse:
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
cmp ebx,[buf_ogl.w]
jg .end_d
and eax,0xffff ;mouse.y
cmp eax,3d_wnd_t
@@ -811,7 +860,7 @@ capt_p dd 0
;¤¥à¥¢® á ®¡ê¥ªâ ¬¨ ¢ ¯®«ì§®¢ â¥«ì᪮¬ ä ©«¥
tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\
16,16, 0xffffff,0xb0d0ff,0x10400040, 5,290,380,140, 16, 4,0, el_focus,\
w_scr_t3,get_point_coords
edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 32, string1, mouse_dd, 0

View File

@@ -172,7 +172,7 @@ else
end if
}
include 'kosfuncs.inc'
include '../../KOSfuncs.inc'
include '../../macros.inc'
include 'font.inc'

View File

@@ -1,298 +0,0 @@
; KolibriOS system functions:
SF_TERMINATE_PROCESS=-1
SF_CREATE_WINDOW=0 ; define and draw the window
SF_PUT_PIXEL=1 ; draw pixel to the window
SF_GET_KEY=2 ; get code of the pressed key
SF_GET_SYS_TIME=3
SF_DRAW_TEXT=4
SF_SLEEP=5 ; pause process
SF_PUT_IMAGE=7 ; draw image to the window
SF_DEFINE_BUTTON=8 ; define/delete the button
SF_THREAD_INFO=9 ; information on execution thread
SF_WAIT_EVENT=10 ; wait for event
SF_CHECK_EVENT=11 ; check for event and return
SF_REDRAW=12
SSF_BEGIN_DRAW=1
SSF_END_DRAW=2
SF_DRAW_RECT=13 ; draw rectangle to the window
SF_GET_SCREEN_SIZE=14 ; get screen resolution
SF_BACKGROUND_SET=15 ; work with desktop background graphics
SSF_SIZE_BG=1 ; set a size of the background image
SSF_PIXEL_BG=2 ; put pixel on the background image
SSF_REDRAW_BG=3 ; redraw background
SSF_MODE_BG=4 ; set drawing mode for the background
SSF_IMAGE_BG=5 ; put block of pixels on the background image
SSF_MAP_BG=6 ; map background image to the address space of the process
SSF_UNMAP_BG=7 ; close mapped background data
SSF_LAST_DRAW=8 ; get coordinates of the last draw to the background
SSF_REDRAW_RECT=9 ; redraws a rectangular part of the background
SF_RD_TO_FLOPPY=16 ; save ramdisk on the floppy
SF_GET_BUTTON=17 ; get ID of the pressed button
SF_SYSTEM=18
SSF_UNFOCUS_WINDOW=1 ; take focus from the window of the given thread
SSF_TERMINATE_THREAD=2 ; terminate process/thread by the slot number
SSF_FOCUS_WINDOW=3 ; give focus to the window of the given thread
SSF_GET_IDLE_COUNT=4 ; get counter of idle cycles per second
SSF_GET_CPU_FREQUENCY=5 ; get CPU clock rate
SSF_RD_TO_HDD=6 ; save ramdisk to the file on hard disk
SSF_GET_ACTIVE_WINDOW=7 ; get slot number of the active window
SSF_SPEAKER=8
SSSF_GET_STATE=1
SSSF_TOGGLE=2
SSF_SHUTDOWN=9 ; system shutdown/reboot
SSF_MINIMIZE_WINDOW=10 ; minimize active window
SSF_INFO_DISC_SYS=11 ; get disk subsystem information
SSF_KERNEL_VERSION=13 ; get kernel version
SSF_WAIT_RETRACE=14 ; wait for screen retrace
SSF_CURSOR_CENTER=15 ; center mouse cursor on the screen
SSF_GET_FREE_RAM=16 ; get size of free RAM
SSF_GET_TOTAL_RAM=17 ; get total amount of RAM
SSF_TERMINATE_THREAD_ID=18 ; Terminate process/thread by the ID
SSF_MOUSE_SETTINGS=19
SSSF_GET_SPEED=0
SSSF_SET_SPEED=1
SSSF_GET_SPEEDUP=2
SSSF_SET_SPEEDUP=3 ; set mouse acceleration
SSSF_SET_POS=4 ; set mouse pointer position
SSSF_SET_BUTTON=5 ; simulate state of mouse buttons
SSSF_GET_DOUBLE_CLICK_DELAY=6
SSSF_SET_DOUBLE_CLICK_DELAY=7
SSF_GET_RAM_INFO=20 ; get information on RAM
SSF_GET_THREAD_SLOT=21 ; get slot number of process/thread by the ID
SSF_FOREIGN_WINDOW=22 ; operations with window of another thread by slot/ID
SSSF_MINIMIZE=0
SSSF_MINIMIZE_ID=1
SSSF_RESTORE=2
SSSF_RESTORE_ID=3
SSF_MINIMIZE_ALL=23
SSF_SET_SCREEN_LIMITS=24
SSF_WINDOW_BEHAVIOR=25 ; window focus relation with other windows
SSSF_GET_WB=1
SSSF_SET_WB=2
SF_MIDI=20
SSF_RESET=1
SSF_OUTPUT=2
SF_SYSTEM_SET=21
SSF_MPU_MIDI_BASE=1
SSF_KEYBOARD_LAYOUT=2
SSF_SYS_LANG=5
SSF_ACCESS_HD_LBA=11 ; setting of low-level access to HD
SSF_ACCESS_PCI=12 ; setting of low-level access to PCI
SF_SET_TIME_DATE=22
SF_WAIT_EVENT_TIMEOUT=23; wait for event with timeout
SF_CD=24
SSF_EJECT_TRAY=4
SSF_INSERT_TRAY=5
SF_SCREEN_PUT_IMAGE=25 ; put image on the background layer
SF_SYSTEM_GET=26
; Same as SF_SYSTEM_SET, plus:
SSF_TIME_COUNT=9
SSF_TIME_COUNT_PRO=10 ; get value of the high precision time counter
SF_GET_SYS_DATE=29
SF_CURRENT_FOLDER=30
SSF_SET_CF=1 ; set current folder for the thread
SSF_GET_CF=2
SSF_ADD_SYS_FOLDER=3 ; install the add.system directory for the kernel
SF_GET_PIXEL_OWNER=34 ; get slot number of the screen pixel owner
SF_GET_PIXEL=35 ; read the screen pixel color
SF_GET_IMAGE=36 ; read the screen area
SF_MOUSE_GET=37
SSF_SCREEN_POSITION=0
SSF_WINDOW_POSITION=1
SSF_BUTTON=2 ; states of the mouse buttons
SSF_BUTTON_EXT=3 ; states and events of the mouse buttons
SSF_LOAD_CURSOR=4
SSF_SET_CURSOR=5
SSF_DEL_CURSOR=6
SSF_SCROLL_DATA=7
SF_DRAW_LINE=38
SF_BACKGROUND_GET=39
;SSF_SIZE_BG=1
;SSF_PIXEL_BG=2
;SSF_MODE_BG=4
SF_SET_EVENTS_MASK=40 ; turn on/off desired events
SF_PORT_IN_OUT=43 ; input/output to a port
SF_SET_PORTS=46 ; reserve/free a group of input/output ports
SF_DRAW_NUMBER=47 ; draw number to the window
SF_STYLE_SETTINGS=48
SSF_APPLY=0 ; apply screen settings
SSF_SET_BUTTON_STYLE=1
SSF_SET_COLORS=2
SSF_GET_COLORS=3 ; get standard window colors
SSF_GET_SKIN_HEIGHT=4
SSF_GET_SCREEN_AREA=5 ; get screen working area
SSF_SET_SCREEN_AREA=6
SSF_GET_SKIN_MARGINS=7
SSF_SET_SKIN=8
SSF_GET_FONT_SMOOTH=9
SSF_SET_FONT_SMOOTH=10
SSF_GET_FONT_SIZE=11
SSF_SET_FONT_SIZE=12
SF_APM=49
SF_SET_WINDOW_SHAPE=50
SF_CREATE_THREAD=51
SF_CLIPBOARD=54
SSF_GET_SLOT_COUNT=0 ; get the number of slots in the clipboard
SSF_READ_CB=1
SSF_WRITE_CB=2
SSF_DEL_SLOT=3 ; delete the last slot in the clipboard
SSF_UNLOCK_BUFFER=4 ; emergency buffer unlock
SF_SPEAKER_PLAY=55
SF_PCI_BIOS=57
SF_IPC=60 ; Inter Process Communication
SSF_SET_AREA=1 ; set area for IPC receiving
SSF_SEND_MESSAGE=2
SF_GET_GRAPHICAL_PARAMS=61
SSF_SCREEN_SIZE=1
SSF_BITS_PER_PIXEL=2
SSF_BYTES_PER_LINE=3
SF_PCI=62
SSF_GET_VERSION=0 ; get version of PCI-interface
SSF_GET_LAST_BUS=1 ; get number of the last PCI-bus
SSF_GET_ADRR_MODE=2 ; get addressing mode of the PCI configuration space
SSF_READ_BYTE=4
SSF_READ_WORD=5
SSF_READ_DWORD=6
SSF_WRITE_BYTE=8
SSF_WRITE_WORD=9
SSF_WRITE_DWORD=10
SF_BOARD=63
SSF_DEBUG_WRITE=1
SSF_DEBUG_READ=2
SF_MEMORY_RESIZE=64 ; resize total application memory
SF_PUT_IMAGE_EXT=65 ; draw image with palette to the window
SF_KEYBOARD=66
SSF_SET_INPUT_MODE=1
SSF_GET_INPUT_MODE=2
SSF_GET_CONTROL_KEYS=3; get status of control keys
SSF_SET_SYS_HOTKEY=4
SSF_DEL_SYS_HOTKEY=5
SSF_LOCK_INPUT=6 ; block normal input
SSF_UNLOCK_INPUT=7 ; restore normal input
SF_CHANGE_WINDOW=67 ; change position/sizes of the window
SF_SYS_MISC=68
SSF_GET_TASK_SWITCH_COUNT=0
SSF_SWITCH_TASK=1
SSF_PERFORMANCE=2
SSSF_ALLOW_RDPMC=0
SSSF_CACHE_STATUS=1
SSSF_CACHE_ON=2
SSSF_CACHE_OFF=3
SSF_READ_MSR=3
SSF_WRITE_MSR=4
SSF_HEAP_INIT=11
SSF_MEM_ALLOC=12
SSF_MEM_FREE=13
SSF_WAIT_SIGNAL=14 ; wait for signal from another program/driver
SSF_LOAD_DRIVER=16
SSF_CONTROL_DRIVER=17
SSF_LOAD_DLL=19
SSF_MEM_REALLOC=20
SSF_LOAD_DRIVER_PE=21
SSF_MEM_OPEN=22 ; open named memory area
SSF_MEM_CLOSE=23
SSF_SET_EXCEPTION_HANDLER=24
SSF_SET_EXCEPTION_STATE=25
SSF_MEM_FREE_EXT=26
SSF_LOAD_FILE=27
SF_DEBUG=69
SSF_SET_MESSAGE_AREA=0
SSF_GET_REGISTERS=1
SSF_SET_REGISTERS=2
SSF_DETACH=3
SSF_SUSPEND=4
SSF_RESUME=5
SSF_READ_MEMORY=6
SSF_WRITE_MEMORY=7
SSF_TERMINATE=8
SSF_DEFINE_BREAKPOINT=9
SF_FILE=70
SSF_READ_FILE=0
SSF_READ_FOLDER=1
SSF_CREATE_FILE=2
SSF_WRITE_FILE=3
SSF_SET_END=4
SSF_GET_INFO=5
SSF_SET_INFO=6
SSF_START_APP=7
SSF_DELETE=8
SSF_CREATE_FOLDER=9
SF_SET_CAPTION=71
SF_SEND_MESSAGE=72
SF_BLITTER=73
SF_NETWORK_DEVICE=74
SSF_DEVICE_COUNT=255 ; get number of active network devices
SSF_DEVICE_TYPE=0
SSF_DEVICE_NAME=1
SSF_RESET_DEVICE=2
SSF_STOP_DEVICE=3
SSF_DEVICE_POINTER=4
SSF_TX_PACKET_COUNT=6
SSF_RX_PACKET_COUNT=7
SSF_TX_BYTE_COUNT=8
SSF_RX_BYTE_COUNT=9
SSF_LINK_STATUS=10
SSF_TX_PACKET_ERROR_COUNT=11
SSF_TX_PACKET_DROP_COUNT=12
SSF_TX_PACKET_MISS_COUNT=13
SSF_RX_PACKET_ERROR_COUNT=14
SSF_RX_PACKET_DROP_COUNT=15
SSF_RX_PACKET_MISS_COUNT=16
SF_NETWORK_SOCKET=75
SSF_OPEN=0
SSF_CLOSE=1
SSF_BIND=2
SSF_LISTEN=3
SSF_CONNECT=4
SSF_ACCEPT=5
SSF_SEND=6
SSF_RECEIVE=7
SSF_SET_OPTIONS=8
SSF_GET_OPTIONS=9
SSF_SOCKET_PAIR=10
SF_NETWORK_PROTOCOL=76
SSF_ETHERNET_READ_MAC=0
SSF_IP4_PACKETS_SENT=10000h
SSF_IP4_PACKETS_RECEIVED=10001h
SSF_IP4_READ_IP=10002h
SSF_IP4_WRITE_IP=10003h
SSF_IP4_READ_DNS=10004h
SSF_IP4_WRITE_DNS=10005h
SSF_IP4_READ_SUBNET=10006h
SSF_IP4_WRITE_SUBNET=10007h
SSF_IP4_READ_GATEWAY=10008h
SSF_IP4_WRITE_GATEWAY=10009h
SSF_ICMP_PACKETS_SENT=20000h
SSF_ICMP_PACKETS_RECEIVED=20001h
SSF_ICMP_ECHO_REPLY=20003h
SSF_UDP_PACKETS_SENT=30000h
SSF_UDP_PACKETS_RECEIVED=30001h
SSF_TCP_PACKETS_SENT=40000h
SSF_TCP_PACKETS_RECEIVED=40001h
SSF_ARP_PACKETS_SENT=50000h
SSF_ARP_PACKETS_RECEIVED=50001h
SSF_ARP_GET_ENTRY_COUNT=50002h
SSF_ARP_READ_ENTRY=50003h
SSF_ARP_ADD_STATIC_ENTRY=50004h
SSF_ARP_DEL_ENTRY=50005h
SSF_ARP_SEND_ANNOUNCE=50006h
SSF_ARP_CONFLICTS_COUNT=50007h
SF_FUTEX=77
SSF_CREATE=0
SSF_DESTROY=1
SSF_WAIT=2
SSF_WAKE=3
; File system errors:
FSERR_SUCCESS=0
FSERR_UNSUPPORTED=2
FSERR_UNKNOWN=3
FSERR_FILE_NOT_FOUND=5
FSERR_END_OF_FILE=6
FSERR_INVALID_BUFFER=7
FSERR_DISK_FULL=8
FSERR_FAIL=9
FSERR_ACCESS_DENIED=10
FSERR_DEVICE_FAIL=11
FSERR_OUT_OF_MEMORY=12

View File

@@ -32,6 +32,7 @@ DLLAPI char* strrchr(const char* s, int c);
DLLAPI size_t strspn(const char* s1, const char* s2);
DLLAPI char* strstr(const char* s1, const char* s2);
DLLAPI char* strtok(char* s1, const char* s2);
DLLAPI char* strtok_r(char* s1, const char* s2, char** saveptr);
DLLAPI char* strerror(int errnum);
DLLAPI size_t strlen(const char* s);
DLLAPI char* strrev(char* str);

View File

@@ -203,7 +203,9 @@ ksys_dll_t EXPORTS[] = {
{ "strspn", &strspn },
{ "strstr", &strstr },
{ "strtok", &strtok },
{ "strtok_r", &strtok_r },
{ "strxfrm", &strxfrm },
{ "strpbrk", &strpbrk },
{ "__errno", &__errno },
{ "closedir", &closedir },
{ "opendir", &opendir },

View File

@@ -1,14 +1,12 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
char* strtok(char* s, const char* delim)
char* strtok_r(char* s, const char* delim, char** last)
{
const char* spanp;
char *spanp, *tok;
int c, sc;
char* tok;
static char* last;
if (s == NULL && (s = last) == NULL)
if (s == NULL && (s = *last) == NULL)
return (NULL);
/*
@@ -16,13 +14,13 @@ char* strtok(char* s, const char* delim)
*/
cont:
c = *s++;
for (spanp = delim; (sc = *spanp++) != 0;) {
for (spanp = (char*)delim; (sc = *spanp++) != 0;) {
if (c == sc)
goto cont;
}
if (c == 0) { /* no non-delimiter characters */
last = NULL;
*last = NULL;
return (NULL);
}
tok = s - 1;
@@ -33,17 +31,24 @@ cont:
*/
for (;;) {
c = *s++;
spanp = delim;
spanp = (char*)delim;
do {
if ((sc = *spanp++) == c) {
if (c == 0)
s = NULL;
else
s[-1] = 0;
last = s;
s[-1] = '\0';
*last = s;
return (tok);
}
} while (sc != 0);
}
/* NOTREACHED */
}
char *strtok(char *s, const char *delim)
{
static char *last;
return (strtok_r(s, delim, &last));
}

View File

@@ -23,12 +23,6 @@ macro matr_cell c_funct,c_param,funct,param, dia
dia dword[esp-4*(c_param*(c_funct-funct)+(1+c_param-param))]
}
;Macro for double type parameters (8 bytes)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4
start:
load_library name_tgl, library_path, system_path, import_tinygl
@@ -901,22 +895,8 @@ endp
;--------------------------------------------------
align 4
import_tinygl:
include '../import.inc'
macro E_LIB n
{
n dd sz_#n
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
sz_#n db `n,0
}
include '../export.inc'
;--------------------------------------------------
system_path db '/sys/lib/'
name_tgl db 'tinygl.obj',0
;--------------------------------------------------

View File

@@ -1,3 +1,7 @@
; SPDX-License-Identifier: GPL-2.0-only
; Test 3 - example of drawing triangles
; Copyright (C) 2014-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -8,13 +12,14 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_lib.mac'
include '../../../../../dll.inc'
include '../kosgl.inc'
include '../opengl_const.inc'
@use_library
align 4
start:
load_library name_tgl, library_path, system_path, import_lib_tinygl
load_library name_tgl, library_path, system_path, import_tinygl
cmp eax,SF_TERMINATE_PROCESS
jz button.exit
@@ -34,11 +39,11 @@ red_win:
align 16
still:
mcall SF_WAIT_EVENT
cmp al,1
cmp al,EV_REDRAW
jz red_win
cmp al,2
cmp al,EV_KEY
jz key
cmp al,3
cmp al,EV_BUTTON
jz button
jmp still
@@ -99,7 +104,7 @@ caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0
align 4
draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;clear the color and depth buffer
call [glPushMatrix]
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
@@ -136,30 +141,15 @@ angle_z dd 15.0
delt_size dd 3.0
;--------------------------------------------------
align 4
import_lib_tinygl:
include '../import.inc' ;tinygl
macro E_LIB n
{
n dd sz_#n
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
sz_#n db `n,0
}
include '../export.inc'
;--------------------------------------------------
system_path db '/sys/lib/'
name_tgl db 'tinygl.obj',0
;--------------------------------------------------
align 16
i_end:
ctx1 rb 28 ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
ctx1 TinyGLContext
cur_dir_path rb 4096
library_path rb 4096
rb 1024

View File

@@ -1,3 +1,7 @@
; SPDX-License-Identifier: GPL-2.0-only
; Test array1 - example of using vertex array functions
; Copyright (C) 2014-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -8,6 +12,7 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_lib.mac'
include '../../../../../dll.inc'
include '../kosgl.inc'
include '../opengl_const.inc'
@use_library
@@ -191,29 +196,15 @@ align 4
Indices rb FACES_COUNT*6 ;3 points per edge, point index 2 bytes
;--------------------------------------------------
align 4
import_tinygl:
include '../import.inc' ;tinygl
macro E_LIB n
{
n dd sz_#n
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
sz_#n db `n,0
}
include '../export.inc'
;--------------------------------------------------
system_path db '/sys/lib/'
name_tgl db 'tinygl.obj',0
;--------------------------------------------------
align 4
i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
ctx1 TinyGLContext
cur_dir_path rb 4096
library_path rb 4096
rb 4096

View File

@@ -490,127 +490,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ; Цвет и интенсивность ос
lmodel_ambient dd 0.2, 0.2, 0.2, 1.0 ; Параметры фонового освещения
;--------------------------------------------------
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_libimg:
dd alib_init1
; img_is_img dd aimg_is_img
; img_info dd aimg_info
; img_from_file dd aimg_from_file
; img_to_file dd aimg_to_file
; img_from_rgb dd aimg_from_rgb
; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
; img_encode dd aimg_encode
; img_create dd aimg_create
img_destroy dd aimg_destroy
; img_destroy_layer dd aimg_destroy_layer
; img_count dd aimg_count
; img_lock_bits dd aimg_lock_bits
; img_unlock_bits dd aimg_unlock_bits
; img_flip dd aimg_flip
; img_flip_layer dd aimg_flip_layer
; img_rotate dd aimg_rotate
; img_rotate_layer dd aimg_rotate_layer
; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0
alib_init1 db 'lib_init',0
; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
; aimg_info db 'img_info',0
; aimg_from_file db 'img_from_file',0
; aimg_to_file db 'img_to_file',0
; aimg_from_rgb db 'img_from_rgb',0
; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
; aimg_encode db 'img_encode',0
; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
; aimg_destroy_layer db 'img_destroy_layer',0
; aimg_count db 'img_count',0
; aimg_lock_bits db 'img_lock_bits',0
; aimg_unlock_bits db 'img_unlock_bits',0
; aimg_flip db 'img_flip',0
; aimg_flip_layer db 'img_flip_layer',0
; aimg_rotate db 'img_rotate',0
; aimg_rotate_layer db 'img_rotate_layer',0
; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
include '../import.inc' ;tinygl
include '../../../buf2d/import.inc'
include '../../../libs-dev/libimg/import.inc'
;--------------------------------------------------
system_dir_0 db '/sys/lib/'

View File

@@ -473,127 +473,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ; Цвет и интенсивность ос
lmodel_ambient dd 0.2, 0.2, 0.2, 1.0 ; Параметры фонового освещения
;--------------------------------------------------
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_libimg:
dd alib_init1
; img_is_img dd aimg_is_img
; img_info dd aimg_info
; img_from_file dd aimg_from_file
; img_to_file dd aimg_to_file
; img_from_rgb dd aimg_from_rgb
; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
; img_encode dd aimg_encode
; img_create dd aimg_create
img_destroy dd aimg_destroy
; img_destroy_layer dd aimg_destroy_layer
; img_count dd aimg_count
; img_lock_bits dd aimg_lock_bits
; img_unlock_bits dd aimg_unlock_bits
; img_flip dd aimg_flip
; img_flip_layer dd aimg_flip_layer
; img_rotate dd aimg_rotate
; img_rotate_layer dd aimg_rotate_layer
; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0
alib_init1 db 'lib_init',0
; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
; aimg_info db 'img_info',0
; aimg_from_file db 'img_from_file',0
; aimg_to_file db 'img_to_file',0
; aimg_from_rgb db 'img_from_rgb',0
; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
; aimg_encode db 'img_encode',0
; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
; aimg_destroy_layer db 'img_destroy_layer',0
; aimg_count db 'img_count',0
; aimg_lock_bits db 'img_lock_bits',0
; aimg_unlock_bits db 'img_unlock_bits',0
; aimg_flip db 'img_flip',0
; aimg_flip_layer db 'img_flip_layer',0
; aimg_rotate db 'img_rotate',0
; aimg_rotate_layer db 'img_rotate_layer',0
; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
include '../import.inc' ;tinygl
include '../../../buf2d/import.inc'
include '../../../libs-dev/libimg/import.inc'
;--------------------------------------------------
system_dir_0 db '/sys/lib/'

View File

@@ -433,127 +433,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ; Цвет и интенсивность ос
lmodel_ambient dd 0.2, 0.2, 0.2, 1.0 ; Параметры фонового освещения
;--------------------------------------------------
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_libimg:
dd alib_init1
; img_is_img dd aimg_is_img
; img_info dd aimg_info
; img_from_file dd aimg_from_file
; img_to_file dd aimg_to_file
; img_from_rgb dd aimg_from_rgb
; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
; img_encode dd aimg_encode
; img_create dd aimg_create
img_destroy dd aimg_destroy
; img_destroy_layer dd aimg_destroy_layer
; img_count dd aimg_count
; img_lock_bits dd aimg_lock_bits
; img_unlock_bits dd aimg_unlock_bits
; img_flip dd aimg_flip
; img_flip_layer dd aimg_flip_layer
; img_rotate dd aimg_rotate
; img_rotate_layer dd aimg_rotate_layer
; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0
alib_init1 db 'lib_init',0
; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
; aimg_info db 'img_info',0
; aimg_from_file db 'img_from_file',0
; aimg_to_file db 'img_to_file',0
; aimg_from_rgb db 'img_from_rgb',0
; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
; aimg_encode db 'img_encode',0
; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
; aimg_destroy_layer db 'img_destroy_layer',0
; aimg_count db 'img_count',0
; aimg_lock_bits db 'img_lock_bits',0
; aimg_unlock_bits db 'img_unlock_bits',0
; aimg_flip db 'img_flip',0
; aimg_flip_layer db 'img_flip_layer',0
; aimg_rotate db 'img_rotate',0
; aimg_rotate_layer db 'img_rotate_layer',0
; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
include '../import.inc' ;tinygl
include '../../../buf2d/import.inc'
include '../../../libs-dev/libimg/import.inc'
;--------------------------------------------------
system_dir_0 db '/sys/lib/'

View File

@@ -364,127 +364,9 @@ angle_y dd 0.0
delt_size dd 3.0
;--------------------------------------------------
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_libimg:
dd alib_init1
; img_is_img dd aimg_is_img
; img_info dd aimg_info
; img_from_file dd aimg_from_file
; img_to_file dd aimg_to_file
; img_from_rgb dd aimg_from_rgb
; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
; img_encode dd aimg_encode
; img_create dd aimg_create
img_destroy dd aimg_destroy
; img_destroy_layer dd aimg_destroy_layer
; img_count dd aimg_count
; img_lock_bits dd aimg_lock_bits
; img_unlock_bits dd aimg_unlock_bits
; img_flip dd aimg_flip
; img_flip_layer dd aimg_flip_layer
; img_rotate dd aimg_rotate
; img_rotate_layer dd aimg_rotate_layer
; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0
alib_init1 db 'lib_init',0
; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
; aimg_info db 'img_info',0
; aimg_from_file db 'img_from_file',0
; aimg_to_file db 'img_to_file',0
; aimg_from_rgb db 'img_from_rgb',0
; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
; aimg_encode db 'img_encode',0
; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
; aimg_destroy_layer db 'img_destroy_layer',0
; aimg_count db 'img_count',0
; aimg_lock_bits db 'img_lock_bits',0
; aimg_unlock_bits db 'img_unlock_bits',0
; aimg_flip db 'img_flip',0
; aimg_flip_layer db 'img_flip_layer',0
; aimg_rotate db 'img_rotate',0
; aimg_rotate_layer db 'img_rotate_layer',0
; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
include '../import.inc' ;tinygl
include '../../../buf2d/import.inc'
include '../../../libs-dev/libimg/import.inc'
;--------------------------------------------------
system_dir_0 db '/sys/lib/'

View File

@@ -315,127 +315,9 @@ angle_y dd 0.0
delt_size dd 3.0
;--------------------------------------------------
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_libimg:
dd alib_init1
; img_is_img dd aimg_is_img
; img_info dd aimg_info
; img_from_file dd aimg_from_file
; img_to_file dd aimg_to_file
; img_from_rgb dd aimg_from_rgb
; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
; img_encode dd aimg_encode
; img_create dd aimg_create
img_destroy dd aimg_destroy
; img_destroy_layer dd aimg_destroy_layer
; img_count dd aimg_count
; img_lock_bits dd aimg_lock_bits
; img_unlock_bits dd aimg_unlock_bits
; img_flip dd aimg_flip
; img_flip_layer dd aimg_flip_layer
; img_rotate dd aimg_rotate
; img_rotate_layer dd aimg_rotate_layer
; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0
alib_init1 db 'lib_init',0
; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
; aimg_info db 'img_info',0
; aimg_from_file db 'img_from_file',0
; aimg_to_file db 'img_to_file',0
; aimg_from_rgb db 'img_from_rgb',0
; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
; aimg_encode db 'img_encode',0
; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
; aimg_destroy_layer db 'img_destroy_layer',0
; aimg_count db 'img_count',0
; aimg_lock_bits db 'img_lock_bits',0
; aimg_unlock_bits db 'img_unlock_bits',0
; aimg_flip db 'img_flip',0
; aimg_flip_layer db 'img_flip_layer',0
; aimg_rotate db 'img_rotate',0
; aimg_rotate_layer db 'img_rotate_layer',0
; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
include '../import.inc' ;tinygl
include '../../../buf2d/import.inc'
include '../../../libs-dev/libimg/import.inc'
;--------------------------------------------------
system_dir_0 db '/sys/lib/'

View File

@@ -0,0 +1,18 @@
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include 'export.inc'

View File

@@ -49,9 +49,9 @@ include '../../../../../load_lib.mac'
;--- Start of program ----------------------------------------------
;---------------------------------------------------------------------
START:
mcall 68,11
mcall 66,1,1
mcall 40,0x27
mcall SF_SYS_MISC,SSF_HEAP_INIT
mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1
mcall SF_SET_EVENTS_MASK,0x27
;---------------------------------------------------------------------
load_libraries l_libs_start,end_l_libs
@@ -84,7 +84,7 @@ load_libraries l_libs_start,end_l_libs
copy_path icons_file_name,path,library_path,0
mcall 70,fileinfo
mcall SF_FILE,fileinfo
mov [fileinfo+0],dword 0
@@ -93,14 +93,14 @@ load_libraries l_libs_start,end_l_libs
mov [img_size],ecx
mcall 68,12
mcall SF_SYS_MISC,SSF_MEM_ALLOC
mov [fileinfo+16],eax
mov [image_file],eax
mcall 70,fileinfo
mcall SF_FILE,fileinfo
xor eax,eax
mov [return_code],eax
@@ -108,8 +108,7 @@ load_libraries l_libs_start,end_l_libs
push image_file
call [cnv_png_import.Start]
mov ecx,[image_file]
mcall 68,13,
mcall SF_SYS_MISC,SSF_MEM_FREE,[image_file]
cmp [return_code],dword 0
jne button.exit
@@ -151,28 +150,28 @@ load_libraries l_libs_start,end_l_libs
red:
call draw_window
still:
mcall 10
mcall SF_WAIT_EVENT
cmp eax,1
cmp eax,EV_REDRAW
je red
cmp eax,2
cmp eax,EV_KEY
je key
cmp eax,3
cmp eax,EV_BUTTON
je button
cmp eax,6
cmp eax,EV_MOUSE
je mouse
jmp still
;---------------------------------------------------------------------
key:
mcall 2
mcall SF_GET_KEY
jmp still
;---------------------------------------------------------------------
button:
mcall 17
mcall SF_GET_BUTTON
cmp ah,1
jne still
.exit:
mcall -1
mcall SF_TERMINATE_PROCESS
;---------------------------------------------------------------------
mouse:
;-----------------------------------------------
@@ -184,7 +183,7 @@ mouse:
jbe .horizontal
; mouse event for Vertical ScrollBar
push dword scroll_bar_data_vertical
call [scrollbar_ver_mouse]
call [scrollbar_v_mouse]
mov eax,scroll_bar_data_vertical.redraw
xor ebx,ebx
cmp [eax],ebx
@@ -200,7 +199,7 @@ mouse:
jbe .other
; mouse event for Horizontal ScrollBar
push dword scroll_bar_data_horizontal
call [scrollbar_hor_mouse]
call [scrollbar_h_mouse]
mov eax,scroll_bar_data_horizontal.redraw
xor ebx,ebx
cmp [eax],ebx
@@ -240,7 +239,7 @@ mouse:
.mouse_dinamic_button:
; mouse event for Dinamic Button 1
push dword dinamic_button_data_1
call [dinamic_button_mouse]
call [dbutton_mouse]
mov eax,dinamic_button_data_1.click
cmp [eax],dword 1
jne @f
@@ -249,7 +248,7 @@ mouse:
@@:
; mouse event for Dinamic Button 2
push dword dinamic_button_data_2
call [dinamic_button_mouse]
call [dbutton_mouse]
mov eax,dinamic_button_data_2.click
cmp [eax],dword 1
jne still ;@f
@@ -283,7 +282,7 @@ analyse_out_menu_2:
jmp still
;---------------------------------------------------------------------
about:
mcall 51,1,thread3,thread
mcall SF_CREATE_THREAD,1,thread3,thread
jmp still
;---------------------------------------------------------------------
OpenDialog_start_0:
@@ -320,9 +319,9 @@ OpenDialog_start:
;---------------------------------------------------------------------
;---------------------------------------------------------------------
draw_window:
mcall 12,1
mcall 0,<0,400>,<0,400>,0x03AABBCC,0x805080D0,0x005080D0
mcall 71,1,header_1
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_CREATE_WINDOW,<0,400>,<0,400>,0x03AABBCC,0x805080D0,0x005080D0
mcall SF_SET_CAPTION,1,header_1
;---------------------------------------------
; draw for Menu 1
push dword menu_data_1
@@ -333,15 +332,15 @@ draw_window:
;---------------------------------------------
; draw for Dinamic Button 1
push dword dinamic_button_data_1
call [dinamic_button_draw]
call [dbutton_draw]
; draw for Dinamic Button 2
push dword dinamic_button_data_2
call [dinamic_button_draw]
call [dbutton_draw]
;---------------------------------------------
mcall 13,<170,200>,<25,15>,0xffffb0
mcall SF_DRAW_RECT,<170,200>,<25,15>,0xffffb0
; mov bx,28
; add ebx,2 shl 16
; mcall 4,,0xC0000000,text_work_area,,0xffffb0
; mcall SF_DRAW_TEXT,,0xC0000000,text_work_area,,0xffffb0
; draw for PathShow
push dword PathShow_data_1
call [PathShow_draw]
@@ -357,21 +356,21 @@ draw_window:
; draw for Vertical ScrollBar
push dword scroll_bar_data_vertical
call [scrollbar_ver_draw]
call [scrollbar_v_draw]
; draw for Horizontal ScrollBar
push dword scroll_bar_data_horizontal
call [scrollbar_hor_draw]
call [scrollbar_h_draw]
; reset all_redraw flag
xor eax,eax
mov [scroll_bar_data_vertical.all_redraw],eax
mov [scroll_bar_data_horizontal.all_redraw],eax
;---------------------------------------------
call draw_cube
mcall 12,2
mcall SF_REDRAW,SSF_END_DRAW
ret
;---------------------------------------------------------------------
draw_cube:
mcall 13,<30,301>,<50,301>,0xafafaf
mcall SF_DRAW_RECT,<30,301>,<50,301>,0xafafaf
mov ecx,[scroll_bar_data_vertical.position]
add ecx,50
shl ecx,16
@@ -380,7 +379,7 @@ draw_cube:
add ebx,30
shl ebx,16
mov bx,30
mcall 13,,,0x0
mcall SF_DRAW_RECT,,,0x0
ret
;---------------------------------------------------------------------
include 'data.inc'

View File

@@ -30,7 +30,7 @@ system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
align 4
l_libs_start:
library01 l_libs system_dir_Boxlib+9, file_name, system_dir_Boxlib,\
Box_lib_import, plugins_directory
import_box_lib, plugins_directory
library02 l_libs system_dir_CnvPNG+9, file_name, system_dir_CnvPNG,\
cnv_png_import, plugins_directory
@@ -126,91 +126,7 @@ deflate_unpack dd 0
;---------------------------------------------------------------------
;---------------------------------------------------------------------
align 4
Box_lib_import:
;init_lib dd a_init
;version_lib dd a_version
;edit_box_draw dd aEdit_box_draw
;edit_box_key dd aEdit_box_key
;edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
;check_box_draw dd aCheck_box_draw
;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch
;option_box_draw dd aOption_box_draw
;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
scrollbar_ver_draw dd aScrollbar_ver_draw
scrollbar_ver_mouse dd aScrollbar_ver_mouse
scrollbar_hor_draw dd aScrollbar_hor_draw
scrollbar_hor_mouse dd aScrollbar_hor_mouse
;version_scrollbar dd aVersion_scrollbar
dinamic_button_draw dd aDbutton_draw
dinamic_button_mouse dd aDbutton_mouse
;version_dbutton dd aVersion_dbutton
menu_bar_draw dd aMenu_bar_draw
menu_bar_mouse dd aMenu_bar_mouse
menu_bar_activate dd aMenu_bar_activate
;version_menu_bar dd aVersion_menu_bar
;FileBrowser_draw dd aFileBrowser_draw
;FileBrowser_mouse dd aFileBrowser_mouse
;FileBrowser_key dd aFileBrowser_key
;Version_FileBrowser dd aVersion_FileBrowser
PathShow_prepare dd sz_PathShow_prepare
PathShow_draw dd sz_PathShow_draw
;Version_path_show dd szVersion_path_show
dd 0,0
;a_init db 'lib_init',0
;a_version db 'version',0
;aEdit_box_draw db 'edit_box_draw',0
;aEdit_box_key db 'edit_box_key',0
;aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0
;aCheck_box_draw db 'check_box_draw',0
;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0
;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
aScrollbar_hor_draw db 'scrollbar_h_draw',0
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aVersion_scrollbar db 'version_scrollbar',0
aDbutton_draw db 'dbutton_draw',0
aDbutton_mouse db 'dbutton_mouse',0
;aVersion_dbutton db 'version_dbutton',0
aMenu_bar_draw db 'menu_bar_draw',0
aMenu_bar_mouse db 'menu_bar_mouse',0
aMenu_bar_activate db 'menu_bar_activate',0
;aVersion_menu_bar db 'version_menu_bar',0
;aFileBrowser_draw db 'FileBrowser_draw',0
;aFileBrowser_mouse db 'FileBrowser_mouse',0
;aFileBrowser_key db 'FileBrowser_key',0
;aVersion_FileBrowser db 'version_FileBrowser',0
sz_PathShow_prepare db 'PathShow_prepare',0
sz_PathShow_draw db 'PathShow_draw',0
;szVersion_path_show db 'version_PathShow',0
;---------------------------------------------------------------------
include '../../import.inc' ;import_box_lib
;---------------------------------------------------------------------
align 4

View File

@@ -18,7 +18,7 @@ include '../../../../../load_lib.mac'
@use_library ;use load lib macros
start:
;universal load library/librarys
sys_load_library library_name, library_path, system_path, myimport
sys_load_library library_name, library_path, system_path, import_box_lib
;if return code =-1 then exit, else nornary work
cmp eax,-1
jz exit
@@ -116,37 +116,7 @@ library_name db 'box_lib.obj',0
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
myimport:
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
version_ed dd aVersion_ed
init_checkbox dd aInit_checkbox
check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
version_ch dd aVersion_ch
option_box_draw dd aOption_box_draw
option_box_mouse dd aOption_box_mouse
version_op dd aVersion_op
dd 0,0
aEdit_box_draw db 'edit_box_draw',0
aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
aVersion_ed db 'version_ed',0
aInit_checkbox db 'init_checkbox2',0
aCheck_box_draw db 'check_box_draw2',0
aCheck_box_mouse db 'check_box_mouse2',0
aVersion_ch db 'version_ch2',0
aOption_box_draw db 'option_box_draw',0
aOption_box_mouse db 'option_box_mouse',0
aVersion_op db 'version_op',0
include '../../import.inc' ;creating a function import table
check1 check_box2 (10 shl 16 + 12),(45 shl 16 + 12),5,0x80AABBCC,0,0,check_text1,ch_flag_en

View File

@@ -34,14 +34,14 @@ START:
;---------------------------------------------------------------------
;--- ˆ<>ˆˆˆ‡€ˆŸ ----------------------------------------
;---------------------------------------------------------------------
mcall 68, 11
mcall SF_SYS_MISC, SSF_HEAP_INIT
mcall 40, $C0000027 ; ¬ áª  ᮡë⨩ - ¬ëèì ⮫쪮 ¢  ªâ¨¢­®¬ ®ª­¥
mcall SF_SET_EVENTS_MASK, $C0000027 ; ¬ áª  ᮡë⨩ - ¬ëèì ⮫쪮 ¢  ªâ¨¢­®¬ ®ª­¥
sys_load_library lib_name, lib_path, sys_path, myimport
sys_load_library lib_name, lib_path, sys_path, import_box_lib
test eax,eax
jz @f
mcall -1 ; alarm exit
mcall SF_TERMINATE_PROCESS
@@:
@@ -56,16 +56,16 @@ call draw_window ;
;---------------------------------------------------------------------
still:
mcall 23, 5 ; äã­ªæ¨ï 23 - ¦¤ âì ᮡëâ¨ï <EFBFBD>¥ ¡®«¥¥ 祬 0.05á
mcall SF_WAIT_EVENT_TIMEOUT, 5 ; ¦¤ âì ᮡëâ¨ï ­¥ ¡®«¥¥ 祬 0.05á
test eax, eax ; ­¥â ᮡë⨩ - ¯à®¢¥à¨âì à¨á®¢ ­¨¥ âã«â¨¯®¢ ¯® â ©¬¥àã
je yield
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª­® ?
cmp eax,EV_REDRAW
je red ; ¥á«¨ ¤  - ­  ¬¥âªã red
cmp eax,2 ; ­ ¦ â  ª« ¢¨è  ?
cmp eax,EV_KEY
je key ; ¥á«¨ ¤  - ­  key
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
cmp eax,EV_BUTTON
je button ; ¥á«¨ ¤  - ­  button
cmp eax,6 ; ᮡë⨥ ¬ëè¨
cmp eax,EV_MOUSE
je mouse ; ¥á«¨ ¤  - ­  mouse
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
@@ -81,21 +81,21 @@ invoke tooltip_mouse, redbox_tt
jmp still ; ¢¥à­ãâìáï ª ­ ç «ã 横« 
key: ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
mcall 2 ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
mcall SF_GET_KEY ; áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
jmp still ; ¢¥à­ãâìáï ª ­ ç «ã 横« 
;---------------------------------------------------------------------
button:
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
mcall SF_GET_BUTTON ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
cmp ah, 1 ; ¥á«¨ <20>… ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
jne still ; ¢¥à­ãâìáï
pexit:
invoke tooltip_delete, redbox_tt ; ®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
mcall -1 ; ¨­ ç¥ ª®­¥æ ¯à®£à ¬¬ë
mcall SF_TERMINATE_PROCESS
;---------------------------------------------------------------------
@@ -104,20 +104,20 @@ mcall -1 ;
draw_window:
mcall 12, 1 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ® ­ ç «¥ ®âà¨á®¢ª¨
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall 48, 3, sc,sizeof.system_colors
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
mov edx, [sc.work] ; 梥â ä®­ 
or edx, 0x33000000 ; ¨ ⨯ ®ª­  3
mcall 0, <200,300>, <200,150>, , ,title
mcall SF_CREATE_WINDOW, <200,300>, <200,150>, , ,title
; ¢ë¢®¤ ª¢ ¤à â¨ª®¢
mcall 13, <60,50>, <50,50>, $FF0000
mcall 13, <140,50>, <50,50>, $FF
mcall SF_DRAW_RECT, <60,50>, <50,50>, $FF0000
mcall SF_DRAW_RECT, <140,50>, <50,50>, $FF
mcall 12, 2 ; äã­ªæ¨ï 12.2, § ª®­ç¨«¨ à¨á®¢ âì
mcall SF_REDRAW, SSF_END_DRAW
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
@@ -135,22 +135,7 @@ lib_name db 'box_lib.obj',0
cur_dir_path rb 4096
lib_path rb 4096
myimport:
dd sz_lib_init ;äã­ªæ¨ï § ¯ã᪠¥âáï ¬ ªà®á®¬ 1 à § ¯à¨ ¯®¤ª«î祭¨¨
;¡¨¡«¨®â¥ª¨, ¯®â®¬ã ¢ ¯à®£à ¬¬¥ ¬¥âª  ­  ­¥¥ ­¥ ­ã¦­ 
tooltip_init dd sz_tooltip_init
tooltip_delete dd sz_tooltip_delete
tooltip_test_show dd sz_tooltip_test_show
tooltip_mouse dd sz_tooltip_mouse
get_font_size dd sz_get_font_size
dd 0,0
sz_lib_init db 'lib_init',0
sz_tooltip_init db 'tooltip_init', 0
sz_tooltip_delete db 'tooltip_delete', 0
sz_tooltip_test_show db 'tooltip_test_show', 0
sz_tooltip_mouse db 'tooltip_mouse', 0
sz_get_font_size db 'get_font_size', 0
include '../../import.inc' ;import_box_lib
;tooltip txt, next, zone_x, zone_w, zone_y, zone_h, col_txt, col_bkg, tm_wait

View File

@@ -0,0 +1,117 @@
;
; Export functions
;
E_LIB lib_init
E_LIB version
E_LIB edit_box_draw
E_LIB edit_box_key
E_LIB edit_box_key_safe
E_LIB edit_box_mouse
E_LIB edit_box_set_text
E_LIB version_ed
E_LIB init_checkbox, init_checkbox2
E_LIB check_box_draw, check_box_draw2
E_LIB check_box_mouse, check_box_mouse2
E_LIB version_ch, version_ch2
E_LIB option_box_draw
E_LIB option_box_mouse
E_LIB version_op
E_LIB scrollbar_v_draw
E_LIB scrollbar_v_mouse
E_LIB scrollbar_h_draw
E_LIB scrollbar_h_mouse
E_LIB version_scrollbar
E_LIB dbutton_draw
E_LIB dbutton_mouse
E_LIB version_dbutton
E_LIB menu_bar_draw
E_LIB menu_bar_mouse
E_LIB menu_bar_activate
E_LIB version_menu_bar
E_LIB FileBrowser_draw
E_LIB FileBrowser_mouse
E_LIB FileBrowser_key
E_LIB version_FileBrowser
E_LIB tl_data_init
E_LIB tl_data_clear
E_LIB tl_info_clear
E_LIB tl_key
E_LIB tl_mouse
E_LIB tl_draw
E_LIB tl_info_undo
E_LIB tl_info_redo
E_LIB tl_node_add
E_LIB tl_node_set_data
E_LIB tl_node_get_data
E_LIB tl_node_delete
E_LIB tl_cur_beg
E_LIB tl_cur_next
E_LIB tl_cur_perv
E_LIB tl_node_close_open
E_LIB tl_node_lev_inc
E_LIB tl_node_lev_dec
E_LIB tl_node_move_up
E_LIB tl_node_move_down
E_LIB tl_node_poi_get_info
E_LIB tl_node_poi_get_next_info
E_LIB tl_node_poi_get_data
E_LIB tl_save_mem
E_LIB tl_load_mem
E_LIB tl_get_mem_size
E_LIB version_tree_list
E_LIB PathShow_prepare
E_LIB PathShow_draw
E_LIB version_PathShow
E_LIB ted_but_sumb_upper
E_LIB ted_but_sumb_lover
E_LIB ted_but_convert_by_table
E_LIB ted_can_save
E_LIB ted_clear
E_LIB ted_delete
E_LIB ted_draw
E_LIB ted_init
E_LIB ted_init_scroll_bars
E_LIB ted_init_syntax_file
E_LIB ted_is_select
E_LIB ted_key
E_LIB ted_mouse
E_LIB ted_open_file
E_LIB ted_save_file
E_LIB ted_text_add
E_LIB ted_but_select_word
E_LIB ted_but_cut
E_LIB ted_but_copy
E_LIB ted_but_paste
E_LIB ted_but_undo
E_LIB ted_but_redo
E_LIB ted_but_reverse
E_LIB ted_but_find
E_LIB ted_but_replace
E_LIB ted_text_colored
E_LIB ted_go_to_position
E_LIB version_text_edit
E_LIB frame_draw
E_LIB version_frame
E_LIB progressbar_draw
E_LIB progressbar_progress
E_LIB tooltip_init
E_LIB tooltip_delete
E_LIB tooltip_test_show
E_LIB tooltip_mouse
E_LIB get_font_size
purge E_LIB

View File

@@ -0,0 +1,24 @@
align 4
import_box_lib:
macro E_LIB n, lfn
{
if n eq lib_init
dd strz_#n
else if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n, lfn
{
if used n
if lfn eq
sz_#n db `n,0
else
sz_#n db `lfn,0
end if
end if
}
include 'export.inc'

View File

@@ -0,0 +1,48 @@
;
; Export functions
;
E_LIB lib_init
E_LIB buf2d_create
E_LIB buf2d_create_f_img
E_LIB buf2d_clear
E_LIB buf2d_draw
E_LIB buf2d_delete
E_LIB buf2d_resize
E_LIB buf2d_rotate
E_LIB buf2d_line
E_LIB buf2d_line_sm
E_LIB buf2d_rect_by_size
E_LIB buf2d_filled_rect_by_size
E_LIB buf2d_circle
E_LIB buf2d_img_hdiv2
E_LIB buf2d_img_wdiv2
E_LIB buf2d_conv_24_to_8
E_LIB buf2d_conv_24_to_32
E_LIB buf2d_bit_blt
E_LIB buf2d_bit_blt_transp
E_LIB buf2d_bit_blt_alpha
E_LIB buf2d_curve_bezier
E_LIB buf2d_convert_text_matrix
E_LIB buf2d_draw_text
E_LIB buf2d_crop_color
E_LIB buf2d_offset_h
E_LIB buf2d_flood_fill
E_LIB buf2d_set_pixel
E_LIB buf2d_get_pixel
E_LIB buf2d_flip_h
E_LIB buf2d_flip_v
E_LIB buf2d_filter_dither
E_LIB buf2d_vox_brush_create
E_LIB buf2d_vox_brush_delete
E_LIB buf2d_vox_obj_get_img_w_3g
E_LIB buf2d_vox_obj_get_img_h_3g
E_LIB buf2d_vox_obj_draw_1g
E_LIB buf2d_vox_obj_draw_3g
E_LIB buf2d_vox_obj_draw_3g_scaled
E_LIB buf2d_vox_obj_draw_pl
E_LIB buf2d_vox_obj_draw_pl_scaled
E_LIB buf2d_vox_obj_draw_3g_shadows
purge E_LIB

View File

@@ -0,0 +1,20 @@
align 4
import_buf2d:
macro E_LIB n
{
if n eq lib_init
dd strz_#n
else if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include 'export.inc'

View File

@@ -11,7 +11,7 @@ include '../../../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../../dll.inc'
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db '˜¨ä஢ ­¨¥  «£®à¨â¬®¬ DES 05.03.13',0 ;¯®¤¯¨áì ®ª­ 
caption db '˜¨ä஢ ­¨¥  «£®à¨â¬®¬ DES 21.05.25',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
@@ -112,13 +112,13 @@ align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
cmp al,EV_REDRAW
jz red_win
cmp al,2
cmp al,EV_KEY
jz key
cmp al,3
cmp al,EV_BUTTON
jz button
cmp al,6 ;¬ëèì
cmp al,EV_MOUSE
jne @f
jmp mouse
@@:
@@ -410,52 +410,7 @@ l_libs_start:
lib_4 l_libs lib_name_4, library_path, system_dir_4, import_box_lib
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
include '../../libs-dev/libimg/import.inc'
align 4
import_proclib: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
@@ -465,57 +420,7 @@ dd 0,0
aOpenDialog_Init db 'OpenDialog_init',0
aOpenDialog_Start db 'OpenDialog_start',0
align 4
import_buf2d:
init dd sz_init
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
;buf2d_line dd sz_buf2d_line
;buf2d_rect_by_size dd sz_buf2d_rect_by_size
;buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
;buf2d_circle dd sz_buf2d_circle
;buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
;buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
;buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
;buf2d_bit_blt dd sz_buf2d_bit_blt
;buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
;buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
;buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
;buf2d_crop_color dd sz_buf2d_crop_color
;buf2d_offset_h dd sz_buf2d_offset_h
;buf2d_flood_fill dd sz_buf2d_flood_fill
;buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
;sz_buf2d_line db 'buf2d_line',0
;sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
;sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
;sz_buf2d_circle db 'buf2d_circle',0
;sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
;sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
;sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
;sz_buf2d_bit_blt db 'buf2d_bit_blt',0
;sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
;sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
;sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
;sz_buf2d_crop_color db 'buf2d_crop_color',0
;sz_buf2d_offset_h db 'buf2d_offset_h',0
;sz_buf2d_flood_fill db 'buf2d_flood_fill',0
;sz_buf2d_set_pixel db 'buf2d_set_pixel',0
include '../../buf2d/import.inc'
align 4
import_des: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
@@ -525,22 +430,7 @@ dd 0,0
sz_des_encryption db 'des_encryption',0
sz_des_decryption db 'des_decryption',0
align 4
import_box_lib:
;dd sz_init1
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
;edit_box_set_text dd sz_edit_box_set_text
dd 0,0
;sz_init1 db 'lib_init',0
sz_edit_box_draw db 'edit_box_draw',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
;sz_edit_box_set_text db 'edit_box_set_text',0
mouse_dd dd 0x0
include '../../box_lib/import.inc'
align 4
buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
@@ -564,12 +454,13 @@ buf_1:
edit1 edit_box 58, 140,8, 0xffffff, 0xff, 0x80ff, 0, 0x8000, 8, txt_key, mouse_dd, ed_focus+ed_always_focus,8,8
txt_openfile db 'Žâªà®©â¥ ä ©« ¤«ï è¨ä஢ ­¨ï ¨«¨ ¤¥è¨ä஢ ­¨ï.',0
txt_buf rb 80
txt_key db 'des_0123',0
mem_key rb 120
align 16
i_end:
txt_buf rb 80
mem_key rb 120
mouse_dd rd 1
procinfo process_information
sc system_colors
rb 2048

View File

@@ -100,6 +100,10 @@ lib_init: ;//////////////////////////////////////////////////////////////////;;
mov [mem.alloc], eax
mov [mem.free], ebx
mov [mem.realloc], ecx
cmp [dll.load], edx
je .ok
mov [dll.load], edx
invoke dll.load, @IMPORT
@@ -115,6 +119,7 @@ lib_init: ;//////////////////////////////////////////////////////////////////;;
invoke ini.get_str, inifile, sec_proxy, key_password, proxyPassword, 256, proxyPassword
popa
.ok:
DEBUGF 1, "HTTP library: init OK\n"
xor eax, eax
ret

View File

@@ -0,0 +1,34 @@
;
; Export functions
;
E_LIB lib_init
E_LIB version
E_LIB img_is_img
E_LIB img_info
E_LIB img_from_file
E_LIB img_to_file
E_LIB img_from_rgb
E_LIB img_to_rgb
E_LIB img_to_rgb2
E_LIB img_decode
E_LIB img_encode ;supported formats: PNG 24 32, BMP 24 32, PNM 1 8g 24
E_LIB img_create
E_LIB img_destroy
E_LIB img_destroy_layer
E_LIB img_count
E_LIB img_lock_bits
E_LIB img_unlock_bits
E_LIB img_flip
E_LIB img_flip_layer
E_LIB img_rotate
E_LIB img_rotate_layer
E_LIB img_draw
E_LIB img_scale
E_LIB img_get_scaled_size
E_LIB img_convert
E_LIB img_blend
E_LIB img_resize_data
E_LIB img_formats_table
purge E_LIB

View File

@@ -0,0 +1,20 @@
align 4
import_libimg:
macro E_LIB n
{
if n eq lib_init
dd strz_#n
else if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include 'export.inc'

View File

@@ -78,6 +78,10 @@ proc lib_init ;///////////////////////////////////////////////////////////////;;
mov [mem.alloc], eax
mov [mem.free], ebx
mov [mem.realloc], ecx
cmp [dll.load], edx
je .ok
mov [dll.load], edx
or edx, edx

View File

@@ -34,21 +34,25 @@ proc libini._.init ;////////////////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< eax = 1 (fail) / 0 (ok) (library initialization result) ;;
;;================================================================================================;;
mov [mem.alloc], eax
mov [mem.free], ebx
mov [mem.realloc], ecx
mov [dll.load], edx
mov [mem.alloc], eax
mov [mem.free], ebx
mov [mem.realloc], ecx
invoke dll.load, @IMPORT
or eax, eax
jz .ok
cmp [dll.load], edx
je .ok
xor eax, eax
inc eax
ret
mov [dll.load], edx
.ok: xor eax,eax
ret
invoke dll.load, @IMPORT
or eax, eax
jz .ok
xor eax, eax
inc eax
ret
.ok: xor eax,eax
ret
endp
;;================================================================================================;;
@@ -60,16 +64,16 @@ proc libini._.unget_char _f ;///////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push eax ecx
mov ecx, [_f]
inc [ecx + IniFile.cnt]
dec esi
mov eax, [ecx + IniFile.bsize]
cmp [ecx + IniFile.cnt], eax
jle @f
stdcall libini._.unload_block, [_f]
@@: pop ecx eax
ret
push eax ecx
mov ecx, [_f]
inc [ecx + IniFile.cnt]
dec esi
mov eax, [ecx + IniFile.bsize]
cmp [ecx + IniFile.cnt], eax
jle @f
stdcall libini._.unload_block, [_f]
@@: pop ecx eax
ret
endp
;;================================================================================================;;
@@ -81,13 +85,13 @@ proc libini._.get_char _f ;/////////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
mov ecx, [_f]
dec [ecx + IniFile.cnt]
jns @f
stdcall libini._.preload_block, [_f]
dec [ecx + IniFile.cnt]
mov ecx, [_f]
dec [ecx + IniFile.cnt]
jns @f
stdcall libini._.preload_block, [_f]
dec [ecx + IniFile.cnt]
@@: lodsb
ret
ret
endp
;;================================================================================================;;
@@ -99,22 +103,22 @@ proc libini._.skip_nonblanks _f ;///////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
mov ecx, [_f]
mov ecx, [_f]
@@: stdcall libini._.get_char, [_f]
cmp al, 32
je @b
cmp al, 13
je @b
cmp al, 10
je @b
cmp al, 9
je @b
cmp al, ini.COMMENT_CHAR
jne @f
stdcall libini._.skip_line, [_f]
jmp @b
cmp al, 32
je @b
cmp al, 13
je @b
cmp al, 10
je @b
cmp al, 9
je @b
cmp al, ini.COMMENT_CHAR
jne @f
stdcall libini._.skip_line, [_f]
jmp @b
@@: stdcall libini._.unget_char, [_f]
ret
ret
endp
;;================================================================================================;;
@@ -126,14 +130,14 @@ proc libini._.skip_spaces _f ;//////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
mov ecx, [_f]
mov ecx, [_f]
@@: stdcall libini._.get_char, [_f]
cmp al, 32
je @b
cmp al, 9
je @b
cmp al, 32
je @b
cmp al, 9
je @b
@@: stdcall libini._.unget_char, [_f]
ret
ret
endp
;;================================================================================================;;
@@ -145,16 +149,16 @@ proc libini._.skip_line _f ;////////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
mov ecx, [_f]
mov ecx, [_f]
@@: stdcall libini._.get_char, [_f]
or al, al
jz @f
cmp al, 13
je @f
cmp al, 10
jne @b
or al, al
jz @f
cmp al, 13
je @f
cmp al, 10
jne @b
@@: stdcall libini._.unget_char, [_f]
ret
ret
endp
;;================================================================================================;;
@@ -166,16 +170,16 @@ proc libini._.unload_block _f ;/////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push eax ebx ecx
mov ebx, [_f]
mov eax, [ebx + IniFile.pos]
add eax, -ini.BLOCK_SIZE
invoke file.seek, [ebx + IniFile.fh], eax, SEEK_SET
stdcall libini._.preload_block, ebx
add esi, eax
mov [ebx + IniFile.cnt], 0
pop ecx ebx eax
ret
push eax ebx ecx
mov ebx, [_f]
mov eax, [ebx + IniFile.pos]
add eax, -ini.BLOCK_SIZE
invoke file.seek, [ebx + IniFile.fh], eax, SEEK_SET
stdcall libini._.preload_block, ebx
add esi, eax
mov [ebx + IniFile.cnt], 0
pop ecx ebx eax
ret
endp
;;================================================================================================;;
@@ -187,25 +191,25 @@ proc libini._.preload_block _f ;////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push eax ebx ecx
mov ebx, [_f]
@@: mov esi, [ebx + IniFile.buf]
push edi
mov edi, esi
mov ecx, ini.BLOCK_SIZE / 4
xor eax, eax
rep stosd
pop edi
invoke file.tell, [ebx + IniFile.fh]
mov [ebx + IniFile.pos], eax
invoke file.read, [ebx + IniFile.fh], esi, ini.BLOCK_SIZE
mov esi,[ebx + IniFile.buf]
cmp eax,ini.BLOCK_SIZE
jl @f
@@: mov [ebx + IniFile.cnt], eax
mov [ebx + IniFile.bsize], eax
pop ecx ebx eax
ret
push eax ebx ecx
mov ebx, [_f]
@@: mov esi, [ebx + IniFile.buf]
push edi
mov edi, esi
mov ecx, ini.BLOCK_SIZE / 4
xor eax, eax
rep stosd
pop edi
invoke file.tell, [ebx + IniFile.fh]
mov [ebx + IniFile.pos], eax
invoke file.read, [ebx + IniFile.fh], esi, ini.BLOCK_SIZE
mov esi,[ebx + IniFile.buf]
cmp eax,ini.BLOCK_SIZE
jl @f
@@: mov [ebx + IniFile.cnt], eax
mov [ebx + IniFile.bsize], eax
pop ecx ebx eax
ret
endp
;;================================================================================================;;
@@ -217,18 +221,18 @@ proc libini._.reload_block _f ;/////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push eax ebx ecx
mov ebx, [_f]
push [ebx + IniFile.bsize]
push esi [ebx + IniFile.cnt]
invoke file.seek, [ebx + IniFile.fh], [ebx + IniFile.pos], SEEK_SET
stdcall libini._.preload_block, ebx
pop [ebx + IniFile.cnt] esi
pop eax
sub eax,[ebx + IniFile.bsize]
sub [ebx + IniFile.cnt], eax
pop ecx ebx eax
ret
push eax ebx ecx
mov ebx, [_f]
push [ebx + IniFile.bsize]
push esi [ebx + IniFile.cnt]
invoke file.seek, [ebx + IniFile.fh], [ebx + IniFile.pos], SEEK_SET
stdcall libini._.preload_block, ebx
pop [ebx + IniFile.cnt] esi
pop eax
sub eax,[ebx + IniFile.bsize]
sub [ebx + IniFile.cnt], eax
pop ecx ebx eax
ret
endp
; f_info - contains current file block number
@@ -249,91 +253,91 @@ locals
buf dd ?
endl
xor eax, eax
cmp [_delta], 0
je .skip
xor eax, eax
cmp [_delta], 0
je .skip
push ebx ecx
invoke mem.alloc, ini.BLOCK_SIZE
or eax, eax
jz .fail
mov [buf], eax
push ebx ecx
invoke mem.alloc, ini.BLOCK_SIZE
or eax, eax
jz .fail
mov [buf], eax
cmp [_delta], 0
jl .down
cmp [_delta], 0
jl .down
mov ebx, [_f]
mov ecx, [ebx + IniFile.cnt]
mov ebx, [ebx + IniFile.fh]
invoke file.tell, ebx
sub eax, ecx
invoke file.seek, ebx, eax, SEEK_SET
@@: invoke file.seek, ebx, [_delta], SEEK_CUR
invoke file.eof?, ebx
or eax, eax
jnz .done
invoke file.read, ebx, [buf], ini.BLOCK_SIZE
mov ecx, eax
mov eax, [_delta]
neg eax
sub eax, ecx
invoke file.seek, ebx, eax, SEEK_CUR
push ecx
invoke file.write, ebx, [buf], ecx
pop ecx
cmp eax, ecx
jz @b
mov ebx, [_f]
mov ecx, [ebx + IniFile.cnt]
mov ebx, [ebx + IniFile.fh]
invoke file.tell, ebx
sub eax, ecx
invoke file.seek, ebx, eax, SEEK_SET
@@: invoke file.seek, ebx, [_delta], SEEK_CUR
invoke file.eof?, ebx
or eax, eax
jnz .done
invoke file.read, ebx, [buf], ini.BLOCK_SIZE
mov ecx, eax
mov eax, [_delta]
neg eax
sub eax, ecx
invoke file.seek, ebx, eax, SEEK_CUR
push ecx
invoke file.write, ebx, [buf], ecx
pop ecx
cmp eax, ecx
jz @b
.fail:
or eax, -1
pop ecx ebx
ret
or eax, -1
pop ecx ebx
ret
.done:
mov eax, [_delta]
neg eax
invoke file.seek, ebx, eax, SEEK_CUR
invoke file.seteof, ebx
stdcall libini._.reload_block, [_f]
invoke mem.free, [buf]
pop ecx ebx
mov eax, [_delta]
neg eax
invoke file.seek, ebx, eax, SEEK_CUR
invoke file.seteof, ebx
stdcall libini._.reload_block, [_f]
invoke mem.free, [buf]
pop ecx ebx
.skip:
ret
ret
.down:
neg [_delta]
neg [_delta]
mov ebx, [_f]
mov ecx, [ebx + IniFile.cnt]
mov ebx, [ebx + IniFile.fh]
invoke file.tell, ebx
sub eax, ecx
lea edx, [eax - 1]
push edx
@@: invoke file.seek, ebx, edx, SEEK_SET
invoke file.eof?, ebx
or eax, eax
jnz @f
add edx, ini.BLOCK_SIZE
jmp @b
@@: cmp edx, [esp]
je .skip.2
add edx, -ini.BLOCK_SIZE
cmp edx, [esp]
jl @f
invoke file.seek, ebx, edx, SEEK_SET
invoke file.read, ebx, [buf], ini.BLOCK_SIZE
mov ecx, eax
mov eax, [_delta]
sub eax, ecx
invoke file.seek, ebx, eax, SEEK_CUR
invoke file.write, ebx, [buf], ecx
jmp @b
mov ebx, [_f]
mov ecx, [ebx + IniFile.cnt]
mov ebx, [ebx + IniFile.fh]
invoke file.tell, ebx
sub eax, ecx
lea edx, [eax - 1]
push edx
@@: invoke file.seek, ebx, edx, SEEK_SET
invoke file.eof?, ebx
or eax, eax
jnz @f
add edx, ini.BLOCK_SIZE
jmp @b
@@: cmp edx, [esp]
je .skip.2
add edx, -ini.BLOCK_SIZE
cmp edx, [esp]
jl @f
invoke file.seek, ebx, edx, SEEK_SET
invoke file.read, ebx, [buf], ini.BLOCK_SIZE
mov ecx, eax
mov eax, [_delta]
sub eax, ecx
invoke file.seek, ebx, eax, SEEK_CUR
invoke file.write, ebx, [buf], ecx
jmp @b
@@:
.skip.2:
add esp, 4
stdcall libini._.reload_block, [_f]
invoke mem.free, [buf]
pop ecx ebx
ret
add esp, 4
stdcall libini._.reload_block, [_f]
invoke mem.free, [buf]
pop ecx ebx
ret
endp
;;================================================================================================;;
@@ -345,25 +349,25 @@ proc libini._.get_value_length _f ;/////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push ebx ecx edx eax
mov ebx, [_f]
invoke file.tell, [ebx + IniFile.fh]
push esi [ebx + IniFile.cnt] [ebx + IniFile.pos]
sub eax, [ebx + IniFile.cnt]
mov edx, eax
push ebx ecx edx eax
mov ebx, [_f]
invoke file.tell, [ebx + IniFile.fh]
push esi [ebx + IniFile.cnt] [ebx + IniFile.pos]
sub eax, [ebx + IniFile.cnt]
mov edx, eax
stdcall libini._.skip_line, [_f]
invoke file.tell, [ebx + IniFile.fh]
sub eax, [ebx + IniFile.cnt]
sub eax, edx
mov [esp + 4 * 3], eax
stdcall libini._.skip_line, [_f]
invoke file.tell, [ebx + IniFile.fh]
sub eax, [ebx + IniFile.cnt]
sub eax, edx
mov [esp + 4 * 3], eax
pop eax
invoke file.seek, [ebx + IniFile.fh], eax, SEEK_SET
stdcall libini._.preload_block, [_f]
pop [ebx + IniFile.cnt] esi
pop eax edx ecx ebx
ret
pop eax
invoke file.seek, [ebx + IniFile.fh], eax, SEEK_SET
stdcall libini._.preload_block, [_f]
pop [ebx + IniFile.cnt] esi
pop eax edx ecx ebx
ret
endp
;;================================================================================================;;
@@ -376,10 +380,10 @@ proc libini._.string_copy ;/////////////////////////////////////////////////////
;< --- TBD --- ;;
;;================================================================================================;;
@@: lodsb
or al, al
jz @f
stosb
jmp @b
or al, al
jz @f
stosb
jmp @b
@@: ret
endp
@@ -392,26 +396,26 @@ proc libini._.find_next_section _f ;////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push ebx edi
push ebx edi
@@: stdcall libini._.skip_nonblanks, [_f]
cmp al, '['
je @f
or al, al
jz .exit_error
stdcall libini._.skip_line, [_f]
or al, al
jz .exit_error
jmp @b
cmp al, '['
je @f
or al, al
jz .exit_error
stdcall libini._.skip_line, [_f]
or al, al
jz .exit_error
jmp @b
@@:
pop edi ebx
xor eax, eax
ret
pop edi ebx
xor eax, eax
ret
.exit_error:
pop edi ebx
or eax, -1
ret
pop edi ebx
or eax, -1
ret
endp
;;================================================================================================;;
@@ -425,50 +429,50 @@ proc libini._.find_section _f, _sec_name ;//////////////////////////////////////
;< eax = -1 (fail) / 0 (ok) ;;
;< [_f.pos] = new cursor position (right after ']' char if eax = 0, at the end of file otherwise) ;;
;;================================================================================================;;
push ebx edi
push ebx edi
mov ecx, [_f]
invoke file.seek, [ecx + IniFile.fh], 0, SEEK_SET
stdcall libini._.preload_block, [_f]
mov ecx, [_f]
invoke file.seek, [ecx + IniFile.fh], 0, SEEK_SET
stdcall libini._.preload_block, [_f]
.next_section:
stdcall libini._.find_next_section, [_f]
or eax, eax
jnz .exit_error
stdcall libini._.find_next_section, [_f]
or eax, eax
jnz .exit_error
stdcall libini._.get_char, [_f]
stdcall libini._.skip_spaces, [_f]
mov edi, [_sec_name]
stdcall libini._.get_char, [_f]
stdcall libini._.skip_spaces, [_f]
mov edi, [_sec_name]
@@: stdcall libini._.get_char, [_f]
cmp al, ']'
je @f
or al, al
jz .exit_error
cmp al, 13
je .next_section
cmp al, 10
je .next_section
scasb
je @b
cmp byte[edi - 1], 0
jne .next_section
dec edi
stdcall libini._.unget_char, [_f]
stdcall libini._.skip_spaces, [_f]
stdcall libini._.get_char, [_f]
cmp al, ']'
jne .next_section
cmp al, ']'
je @f
or al, al
jz .exit_error
cmp al, 13
je .next_section
cmp al, 10
je .next_section
scasb
je @b
cmp byte[edi - 1], 0
jne .next_section
dec edi
stdcall libini._.unget_char, [_f]
stdcall libini._.skip_spaces, [_f]
stdcall libini._.get_char, [_f]
cmp al, ']'
jne .next_section
@@:
cmp byte[edi], 0
jne .next_section
pop edi ebx
xor eax, eax
ret
cmp byte[edi], 0
jne .next_section
pop edi ebx
xor eax, eax
ret
.exit_error:
pop edi ebx
or eax, -1
ret
pop edi ebx
or eax, -1
ret
endp
;;================================================================================================;;
@@ -483,44 +487,44 @@ proc libini._.find_key _f, _key_name ;//////////////////////////////////////////
;< [_f.pos] = new cursor position (right after '=' char if eax = 0, at the end of file or right ;;
;< before '[' char otherwise) ;;
;;================================================================================================;;
push ebx edi
push ebx edi
.next_value:
mov edi, [_key_name]
stdcall libini._.skip_line, [_f]
stdcall libini._.skip_nonblanks, [_f]
or al, al
jz .exit_error
cmp al, '['
je .exit_error
mov edi, [_key_name]
stdcall libini._.skip_line, [_f]
stdcall libini._.skip_nonblanks, [_f]
or al, al
jz .exit_error
cmp al, '['
je .exit_error
@@: stdcall libini._.get_char, [_f]
or al, al
jz .exit_error
cmp al, '='
je @f
scasb
je @b
cmp byte[edi - 1], 0
jne .next_value
dec edi
stdcall libini._.unget_char, [_f]
stdcall libini._.skip_spaces, [_f]
stdcall libini._.get_char, [_f]
cmp al, '='
je @f
jmp .next_value
or al, al
jz .exit_error
cmp al, '='
je @f
scasb
je @b
cmp byte[edi - 1], 0
jne .next_value
dec edi
stdcall libini._.unget_char, [_f]
stdcall libini._.skip_spaces, [_f]
stdcall libini._.get_char, [_f]
cmp al, '='
je @f
jmp .next_value
@@:
cmp byte[edi], 0
jne .next_value
cmp byte[edi], 0
jne .next_value
pop edi ebx
xor eax, eax
ret
pop edi ebx
xor eax, eax
ret
.exit_error:
pop edi ebx
or eax, -1
ret
pop edi ebx
or eax, -1
ret
endp
;;================================================================================================;;
@@ -532,31 +536,31 @@ proc libini._.low.read_value _f_addr, _buffer, _buf_len ;///////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push edi eax
mov edi, [_buffer]
stdcall libini._.skip_spaces, [_f_addr]
@@: dec [_buf_len]
jz @f
stdcall libini._.get_char, [_f_addr]
cmp al, 13
je @f
cmp al, 10
je @f
stosb
or al, al
jnz @b
push edi eax
mov edi, [_buffer]
stdcall libini._.skip_spaces, [_f_addr]
@@: dec [_buf_len]
jz @f
stdcall libini._.get_char, [_f_addr]
cmp al, 13
je @f
cmp al, 10
je @f
stosb
or al, al
jnz @b
@@: stdcall libini._.unget_char, [_f_addr]
mov byte[edi], 0
dec edi
@@: cmp edi, [_buffer]
jb @f
cmp byte[edi], 32
ja @f
mov byte[edi], 0
dec edi
jmp @b
@@: pop eax edi
ret
mov byte[edi], 0
dec edi
@@: cmp edi, [_buffer]
jb @f
cmp byte[edi], 32
ja @f
mov byte[edi], 0
dec edi
jmp @b
@@: pop eax edi
ret
endp
;;================================================================================================;;
@@ -568,25 +572,25 @@ proc libini._.str_to_int ;//////////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< eax = binary number representation (no overflow checks made) ;;
;;================================================================================================;;
push edx
push edx
xor eax, eax
xor edx, edx
xor eax, eax
xor edx, edx
@@: lodsb
cmp al, '0'
jb @f
cmp al, '9'
ja @f
add eax, -'0'
imul edx, 10
add edx, eax
jmp @b
cmp al, '0'
jb @f
cmp al, '9'
ja @f
add eax, -'0'
imul edx, 10
add edx, eax
jmp @b
@@: dec esi
mov eax, edx
pop edx
ret
@@: dec esi
mov eax, edx
pop edx
ret
endp
;;================================================================================================;;
@@ -600,29 +604,29 @@ proc libini._.int_to_str ;//////////////////////////////////////////////////////
;;------------------------------------------------------------------------------------------------;;
;< --- TBD --- ;;
;;================================================================================================;;
push ecx edx
push ecx edx
or eax, eax
jns @f
mov byte[edi], '-'
inc edi
@@: call .recurse
pop edx ecx
ret
or eax, eax
jns @f
mov byte[edi], '-'
inc edi
@@: call .recurse
pop edx ecx
ret
.recurse:
cmp eax,ecx
jb @f
xor edx,edx
div ecx
push edx
call .recurse
pop eax
@@: cmp al,10
sbb al,0x69
das
stosb
retn
cmp eax,ecx
jb @f
xor edx,edx
div ecx
push edx
call .recurse
pop eax
@@: cmp al,10
sbb al,0x69
das
stosb
retn
endp
;;================================================================================================;;
@@ -635,50 +639,50 @@ proc libini._.ascii_to_scan ;_ascii_code ;//////////////////////////////////////
;< eax = 0 (error) / scancode (success) ;;
;;================================================================================================;;
; /sys/keymap.key
sub esp, 256
mov eax, esp
push ebx
push 'key'
push 'map.'
push '/key'
push '/sys'
push eax ; buffer in the stack
push 0x100 ; read 0x100 bytes
push 0
push 0 ; from position zero
push 0 ; subfunction: read
mov ebx, esp
push 70
pop eax
mcall
add esp, 36
pop ebx
test eax, eax
jnz .die
mov al, [esp+256+4] ; get ASCII code
push edi
sub esp, 256
mov eax, esp
push ebx
push 'key'
push 'map.'
push '/key'
push '/sys'
push eax ; buffer in the stack
push 0x100 ; read 0x100 bytes
push 0
push 0 ; from position zero
push 0 ; subfunction: read
mov ebx, esp
push 70
pop eax
mcall
add esp, 36
pop ebx
test eax, eax
jnz .die
mov al, [esp+256+4] ; get ASCII code
push edi
; first keytable - no modifiers pressed
; check scancodes from 1 to 36h (inclusive)
lea edi, [esp+4+1]
mov edx, edi
mov ecx, 36h
repnz scasb
jz .found
lea edi, [esp+4+1]
mov edx, edi
mov ecx, 36h
repnz scasb
jz .found
; second keytable - Shift pressed
lea edi, [esp+4+128+1]
mov edx, edi
mov ecx, 36h
repnz scasb
jz .found
pop edi
lea edi, [esp+4+128+1]
mov edx, edi
mov ecx, 36h
repnz scasb
jz .found
pop edi
.die:
xor eax, eax
jmp .ret
xor eax, eax
jmp .ret
.found:
mov eax, edi
sub eax, edx
pop edi
mov eax, edi
sub eax, edx
pop edi
.ret:
add esp, 256
ret 4
add esp, 256
ret 4
endp

View File

@@ -0,0 +1,90 @@
format binary as ""
use32
org 0x0
db 'MENUET01'
dd 0x01, START, I_END
dd 0x100000 ; 1MB Memory
dd 0x100000 ; Stack pointer
dd 0x0
dd 0x0
include '../proc32.inc'
include '../macros.inc'
include '../../../../dll.inc'
START:
stdcall dll.Load, import_table
test eax, eax
jnz EXIT ; If not 0, jump to exit
invoke con_init, -1, -1, -1, -1, window_title
invoke con_write_asciiz, greet_text
;------------ testing the [test_combo] --------------
mov eax, test_combo
invoke count_utf8_codepoints
invoke con_printf, fmt_codepoints, eax
mov eax, test_combo
invoke count_utf8_graphemes
invoke con_printf, fmt_graphemes, eax
;------------ testing ends for [test_combo] --------------
;------------ testing the [unitxt] --------------
mov eax, unitxt
invoke count_utf8_codepoints
invoke con_printf, fmt_codepoints, eax
mov eax, unitxt
invoke count_utf8_graphemes
invoke con_printf, fmt_graphemes, eax
;------------ testing ends for [unitxt] --------------
;------------ testing the [test_tech] --------------
mov eax, test_tech
invoke count_utf8_codepoints
invoke con_printf, fmt_codepoints, eax
mov eax, test_tech
invoke count_utf8_graphemes
invoke con_printf, fmt_graphemes, eax
;------------ testing ends for [test_tech] --------------
invoke con_exit, 0
EXIT:
mcall -1 ; Exit cleanly
; DATA SECTION
window_title db 'Debug Console', 0
greet_text db 'Console loaded successfully!', 10, 0
fmt_codepoints db "Total Codepoints: %d", 10, 0
fmt_graphemes db "Total Graphemes: %d", 10, 0
unitxt db 'AП👨👩👦qwerty', 0
test_tech db 'c', 'a', 'f', 'e', 0xCC, 0x81, 0
test_combo db 'A', 0xD0, 0x9F, 0xF0, 0x9F, 0x91, 0xA9, 0xE2, 0x80, 0x8D, 0xF0, 0x9F, 0x92, 0xBB, 'e', 0xCC, 0x81, 0
align 4
import_table:
library \
console, '/sys/lib/console.obj', \
unicode, '/cd1/1/libunicode.obj'
import console,\
con_init, 'con_init', con_write_asciiz, 'con_write_asciiz', \
con_exit, 'con_exit', con_printf, 'con_printf'
import unicode, \
count_utf8_codepoints, 'utf8.count_codepoints', \
count_utf8_graphemes, 'utf8.count_graphemes'
I_END:

View File

@@ -0,0 +1,122 @@
; libunicode -- KolibriOS Unicode Library
;
; Copyright (C) <2026> KolibriOS.org Team
; Author:
; 1. Swarnadeep Paul <swarnadeep@mail.com>
;
; This program is free software: you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free Software
; Foundation, either version 2 of the License, or (at your option) any later
; version.
;
; This program is distributed in the hope that it will be useful, but WITHOUT
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License along with
; this program. If not, see <http://www.gnu.org/licenses/>.
format MS COFF
public @EXPORT as 'EXPORTS'
include "macros.inc"
include "proc32.inc"
section '.flat' code readable align 16
;=============================================================
; CodePoint Counting function
; Parameters:
; eax = pointer to the memory address of the null
; terminated string
; Return values:
; eax = total codepoints
; -------PRIVATE--------
; ebx <- counter of codepoints
; ecx <- each byte
;
;=============================================================
proc count_utf8_codepoints
mov ebx, 0
.read_loop:
mov cl, byte [eax]
test cl, cl ; if it is an ending byte (0)
je .done
and cl, 0xC0
cmp cl, 0x80
je .skip_count
inc ebx
.skip_count:
inc eax
jmp .read_loop
.done:
mov eax, ebx
ret
endp
;=============================================================
; eax <- pointer to the memory address of the string
; * Do not use other register because it may be overwritten.
; -------PRIVATE--------
; ebx <- counter of grapheme
; ecx <- each byte
;
;=============================================================
proc count_utf8_graphemes
mov ebx, 0
.read_loop:
mov cl, byte [eax]
test cl, cl ; if it is an ending byte (0)
je .done
; Is this accent
cmp cl, 0xCC
je .skip_count
cmp cl, 0xCD
je .skip_count
; Check for not a zero width joint
cmp cl, 0xE2
jne .not_any_special
cmp byte [eax+1], 0x80
jne .not_any_special
cmp byte [eax+2], 0x8D
jne .not_any_special
dec ebx
add eax, 3
jmp .read_loop
.not_any_special:
and cl, 0xC0 ; Is this a continution byte
cmp cl, 0x80
je .skip_count
inc ebx
.skip_count:
inc eax
jmp .read_loop
.done:
mov eax, ebx
ret
endp
align 4
@EXPORT:
export \
count_utf8_codepoints, "utf8.count_codepoints", \
count_utf8_graphemes, "utf8.count_graphemes"

View File

@@ -0,0 +1,615 @@
@^ fix macro comment {
^@ fix }
; --------------------------
macro library [lname,fname]
{
forward
dd __#lname#_library_table__,__#lname#_library_name__
common
dd 0
forward
align 4
__#lname#_library_name__ db fname,0
}
macro import lname,[name,sname]
{
common
align 4
__#lname#_library_table__:
forward
if used name
name dd __#name#_import_name__
end if
common
dd 0
forward
if used name
align 4
__#name#_import_name__ db sname,0
end if
}
macro export [name,sname]
{
forward
dd __#name#_export_name__,name
common
dd 0
forward
align 4
__#name#_export_name__ db sname,0
}
; -------------------------
macro m2m dest,src {
push src
pop dest
}
macro iglobal {
IGlobals equ IGlobals,
macro __IGlobalBlock { }
macro uglobal {
UGlobals equ UGlobals,
macro __UGlobalBlock { }
endg fix } ; Use endg for ending iglobal and uglobal blocks.
macro IncludeIGlobals{
macro IGlobals dummy,[n] \{ __IGlobalBlock
purge __IGlobalBlock \}
match I, IGlobals \{ I \} }
macro IncludeUGlobals{
macro UGlobals dummy,[n] \{
\common
\local begin, size
begin = $
virtual at $
\forward
__UGlobalBlock
purge __UGlobalBlock
\common
size = $ - begin
end virtual
rb size
\}
match U, UGlobals \{ U \} }
uglobal
endg
iglobal
endg
; 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
KOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
IncludeIGlobals
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
IncludeUGlobals
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
KOS_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
}
; macro for defining multiline text data
struc mls [sstring]
{
forward
local ssize
virtual at 0
db sstring ; mod
ssize = $
end virtual
db ssize
db sstring
common
db -1 ; mod
}
; strings
macro sz name,[data] { ; [mike.dld]
common
if used name
name db data
.size = $-name
end if
}
macro szZ name,[data] { ; same as sz, but for zero terminated string [dunkaist]
common
if used name
name db data,0
.size = $-name-1
end if
}
sz0 fix szZ
macro lsz name,[lng,data] { ; [mike.dld]
common
if used name
label name
forward
if lang eq lng
db data
end if
common
.size = $-name
end if
}
macro szc name,elsz,[data] { ; [mike.dld]
common
local s,m
m = 0
if used name
label name
forward
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
common
.size = $-name
.maxl = m
end if
}
macro lszc name,elsz,[lng,data] { ; [mike.dld]
common
local s,m,c
m = 0
c = 0
if used name
label name
forward
if lang eq lng
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
c = c+1
end if
common
.size = $-name
.maxl = m
.count = c
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
;include 'config.inc'
__CPU_type equ p5
SYSENTER_VAR equ 0
macro mcall a,b,c,d,e,f,g { ; [mike.dld], [Ghost]
local ..ret_point
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
__mov ebp,g
if __CPU_type eq p5
int 0x40
else
if __CPU_type eq p6
push ebp
mov ebp, esp
push ..ret_point ; it may be 2 or 5 byte
sysenter
..ret_point:
pop edx
pop ecx
else
if __CPU_type eq k6
push ecx
syscall
pop ecx
else
display 'ERROR : unknown CPU type (set to p5)', 10, 13
__CPU_type equ p5
int 0x40
end if
end if
end if
}
; -------------------------
macro __header a,[b] {
common
use32
org 0
db 'MENUET',a
forward
if b eq
dd 0
else
dd b
end if
}
macro __section name {
align 16
label name
}
macro __func name {
if ~used name
display 'FUNC NOT USED: ',`name,13,10
else
align 4
name:
;diff16 `name,0,name
}
macro endf { end if }
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = '0' + s shr ((8-%) shl 2) and $0F
if d > '9'
d = d + 'A'-'9'-1
end if
display d
end repeat
display 13,10
}
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
macro movi arg1,arg2
{
if (arg1 in <eax,ebx,ecx,edx,esi,edi,ebp,esp>) & ((arg2 eqtype 0) | (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) <= 127
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro RGB [a] {
common
match (r=,g=,b),a \{
\dd ((r) shl 16) or ((g) shl 8) or (b)
\}
}
struc POINT _t,_dx,_dy {
.x _t _dx
.y _t _dy
}
; structure definition helper
include 'struct.inc'
macro define@lstruct name,[field]
{ local value
common struc name [value] \{
forward \.#field = value
common \} }
;usecase
define@lstruct RECT,X,Y,W,H
struct BOX
left dd ?
top dd ?
width dd ?
height dd ?
ends
; Thread states:
TSTATE_RUNNING = 0
TSTATE_RUN_SUSPENDED = 1
TSTATE_WAIT_SUSPENDED = 2
TSTATE_ZOMBIE = 3
TSTATE_TERMINATING = 4
TSTATE_WAITING = 5
TSTATE_FREE = 9
; structures used in KolibriOS
struct process_information
cpu_usage dd ? ; +0
window_stack_position dw ? ; +4
window_stack_value dw ? ; +6
dw ? ; +8
process_name rb 12 ; +10
memory_start dd ? ; +22
used_memory dd ? ; +26
PID dd ? ; +30
box BOX ; +34
slot_state dw ? ; +50 TSTATE_*
dw ? ; +52
client_box BOX ; +54
wnd_state db ? ; +70
event_mask dd ? ; +71
keyboard_mode db ? ; +75
rb (1024-76)
ends
struct system_colors
frame dd ? ;nonset1
grab dd ? ;nonset2
work_dark dd ?
work_light dd ?
grab_text dd ? ;window_title
work dd ?
work_button dd ?
work_button_text dd ?
work_text dd ?
work_graph dd ?
ends
struct FILEDATE
Second db ?
Minute db ?
Hour db ?
db ?
Day db ?
Month db ?
Year dw ?
ends
struct FILEINFO
Attributes dd ?
IsUnicode db ?
db 3 dup(?)
DateCreate FILEDATE
DateAccess FILEDATE
DateModify FILEDATE
Size dq ?
ends
cmove fix cmovz
macro cmovz reg1, reg2 {
local ..jumpaddr
if __CPU_type eq p5 ; CMOVcc is not supported on the P5
jnz ..jumpaddr
mov reg1, reg2
..jumpaddr:
else
cmovz reg1, reg2
end if
}
cmovne fix cmovnz
macro cmovnz reg1, reg2 {
local ..jumpaddr
if __CPU_type eq p5 ; CMOVcc is not supported on the P5
jz ..jumpaddr
mov reg1, reg2
..jumpaddr:
else
cmovnz reg1, reg2
end if
}
macro cmovg reg1, reg2 {
local ..jumpaddr
if __CPU_type eq p5 ; CMOVcc is not supported on the P5
jle ..jumpaddr
mov reg1, reg2
..jumpaddr:
else
cmovg reg1, reg2
end if
}
macro cmovl reg1, reg2 {
local ..jumpaddr
if __CPU_type eq p5 ; CMOVcc is not supported on the P5
jge ..jumpaddr
mov reg1, reg2
..jumpaddr:
else
cmovl reg1, reg2
end if
}
; replaces /programs/cmp.inc
irp cond, e, ne, g, ng, l, nl, ge, le {
macro cmp#cond a, b, c\{
cmp a, b
j#cond c
\}
}
; constants
; button flags
BT_DEL = 0x80000000
BT_HIDE = 0x40000000
BT_NOFRAME = 0x20000000
; 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
EVM_DEBUG = 100000000b
EVM_STACK2 = 1000000000b
EVM_MOUSE_FILTER = 0x80000000
EVM_CURSOR_FILTER = 0x40000000

View File

@@ -0,0 +1,301 @@
; Macroinstructions for defining and calling procedures
macro stdcall proc,[arg] ; directly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call proc }
macro invoke proc,[arg] ; indirectly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call [proc] }
macro ccall proc,[arg] ; directly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call proc
if size@ccall
add esp,size@ccall
end if }
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call [proc]
if size@ccall
add esp,size@ccall
end if }
macro proc [args] ; define procedure
{ common
match name params, args>
\{ define@proc name,<params \} }
prologue@proc equ prologuedef
macro prologuedef procname,flag,parmbytes,localbytes,reglist
{ local loc
loc = (localbytes+3) and (not 3)
parmbase@proc equ ebp+8
localbase@proc equ ebp-loc
if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
sub esp,loc
end if
end if
irps reg, reglist \{ push reg \} }
epilogue@proc equ epiloguedef
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
{ irps reg, reglist \{ reverse pop reg \}
if parmbytes | localbytes
leave
end if
if flag and 10000b
retn
else
retn parmbytes
end if }
close@proc equ
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name
name:
match =stdcall args, statement \{ params equ args
flag = 11b \}
match =stdcall, statement \{ params equ
flag = 11b \}
match =c args, statement \{ params equ args
flag = 10001b \}
match =c, statement \{ params equ
flag = 10001b \}
match =params, params \{ params equ statement
flag = 0 \}
match =uses reglist=,args, params \{ regs equ reglist
params equ args \}
match =regs =uses reglist, regs params \{ regs equ reglist
params equ \}
match =regs, regs \{ regs equ \}
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
virtual at parmbase@proc
match =,args, params \{ defargs@proc args \}
match =args@proc args, args@proc params \{ defargs@proc args \}
parmbytes = $-(parmbase@proc)
end virtual
name # % = parmbytes/4
all@vars equ
current = 0
macro locals
\{ virtual at localbase@proc+current
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
struc db [val] \\{ \common deflocal@proc .,db,val \\}
struc du [val] \\{ \common deflocal@proc .,du,val \\}
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
macro endl
\{ purge label
restruc db,du,dw,dp,dd,dt,dq
restruc rb,rw,rp,rd,rt,rq
current = $-(localbase@proc)
end virtual \}
macro ret operand
\{ match any, operand \\{ retn operand \\}
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
macro finish@proc
\{ localbytes = current
match close:reglist, close@proc:<regs> \\{ close name,flag,parmbytes,localbytes,reglist \\}
end if \} }
macro defargs@proc [arg]
{ common
if ~ arg eq
forward
local ..arg,current@arg
match argname:type, arg
\{ current@arg equ argname
label ..arg type
argname equ ..arg
if qqword eq type
dd ?,?,?,?,?,?,?,?
else if dqword eq type
dd ?,?,?,?
else if tbyte eq type
dd ?,?,?
else if qword eq type | pword eq type
dd ?,?
else
dd ?
end if \}
match =current@arg,current@arg
\{ current@arg equ arg
arg equ ..arg
..arg dd ? \}
common
args@proc equ current@arg
forward
restore current@arg
common
end if }
macro deflocal@proc name,def,[val] { name def val }
macro deflocal@proc name,def,[val]
{ common
match vars, all@vars \{ all@vars equ all@vars, \}
all@vars equ all@vars name
forward
local ..var,..tmp
..var def val
match =?, val \{ ..tmp equ \}
match any =?, val \{ ..tmp equ \}
match any (=?), val \{ ..tmp equ \}
match =label, def \{ ..tmp equ \}
match tmp : value, ..tmp : val
\{ tmp: end virtual
initlocal@proc ..var,def value
virtual at tmp\}
common
match first rest, ..var, \{ name equ first \} }
struc label type { label . type }
macro initlocal@proc name,def
{ virtual at name
def
size@initlocal = $ - name
end virtual
position@initlocal = 0
while size@initlocal > position@initlocal
virtual at name
def
if size@initlocal - position@initlocal < 2
current@initlocal = 1
load byte@initlocal byte from name+position@initlocal
else if size@initlocal - position@initlocal < 4
current@initlocal = 2
load word@initlocal word from name+position@initlocal
else
current@initlocal = 4
load dword@initlocal dword from name+position@initlocal
end if
end virtual
if current@initlocal = 1
mov byte [name+position@initlocal],byte@initlocal
else if current@initlocal = 2
mov word [name+position@initlocal],word@initlocal
else
mov dword [name+position@initlocal],dword@initlocal
end if
position@initlocal = position@initlocal + current@initlocal
end while }
macro endp
{ purge ret,locals,endl
finish@proc
purge finish@proc
restore regs@proc
match all,args@proc \{ restore all \}
restore args@proc
match all,all@vars \{ restore all \} }
macro local [var]
{ common
locals
forward done@local equ
match varname[count]:vartype, var
\{ match =BYTE, vartype \\{ varname rb count
restore done@local \\}
match =WORD, vartype \\{ varname rw count
restore done@local \\}
match =DWORD, vartype \\{ varname rd count
restore done@local \\}
match =PWORD, vartype \\{ varname rp count
restore done@local \\}
match =QWORD, vartype \\{ varname rq count
restore done@local \\}
match =TBYTE, vartype \\{ varname rt count
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
rq count*2
restore done@local \\}
match =QQWORD, vartype \\{ label varname qqword
rq count*4
restore done@local \\}
match =XWORD, vartype \\{ label varname xword
rq count*2
restore done@local \\}
match =YWORD, vartype \\{ label varname yword
rq count*4
restore done@local \\}
match , done@local \\{ virtual
varname vartype
end virtual
rb count*sizeof.\#vartype
restore done@local \\} \}
match :varname:vartype, done@local:var
\{ match =BYTE, vartype \\{ varname db ?
restore done@local \\}
match =WORD, vartype \\{ varname dw ?
restore done@local \\}
match =DWORD, vartype \\{ varname dd ?
restore done@local \\}
match =PWORD, vartype \\{ varname dp ?
restore done@local \\}
match =QWORD, vartype \\{ varname dq ?
restore done@local \\}
match =TBYTE, vartype \\{ varname dt ?
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
dq ?,?
restore done@local \\}
match =QQWORD, vartype \\{ label varname qqword
dq ?,?,?,?
restore done@local \\}
match =XWORD, vartype \\{ label varname xword
dq ?,?
restore done@local \\}
match =YWORD, vartype \\{ label varname yword
dq ?,?,?,?
restore done@local \\}
match , done@local \\{ varname vartype
restore done@local \\} \}
match ,done@local
\{ var
restore done@local \}
common
endl }

View File

@@ -0,0 +1,240 @@
; Macroinstructions for defining data structures
macro struct name
{ virtual at 0
fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common define field@struct .,db,<val>
fields@struct equ fields@struct,field@struct \}
struc dw [val] \{ \common define field@struct .,dw,<val>
fields@struct equ fields@struct,field@struct \}
struc du [val] \{ \common define field@struct .,du,<val>
fields@struct equ fields@struct,field@struct \}
struc dd [val] \{ \common define field@struct .,dd,<val>
fields@struct equ fields@struct,field@struct \}
struc dp [val] \{ \common define field@struct .,dp,<val>
fields@struct equ fields@struct,field@struct \}
struc dq [val] \{ \common define field@struct .,dq,<val>
fields@struct equ fields@struct,field@struct \}
struc dt [val] \{ \common define field@struct .,dt,<val>
fields@struct equ fields@struct,field@struct \}
struc rb count \{ define field@struct .,db,count dup (?)
fields@struct equ fields@struct,field@struct \}
struc rw count \{ define field@struct .,dw,count dup (?)
fields@struct equ fields@struct,field@struct \}
struc rd count \{ define field@struct .,dd,count dup (?)
fields@struct equ fields@struct,field@struct \}
struc rp count \{ define field@struct .,dp,count dup (?)
fields@struct equ fields@struct,field@struct \}
struc rq count \{ define field@struct .,dq,count dup (?)
fields@struct equ fields@struct,field@struct \}
struc rt count \{ define field@struct .,dt,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro db [val] \{ \common \local anonymous
define field@struct anonymous,db,<val>
fields@struct equ fields@struct,field@struct \}
macro dw [val] \{ \common \local anonymous
define field@struct anonymous,dw,<val>
fields@struct equ fields@struct,field@struct \}
macro du [val] \{ \common \local anonymous
define field@struct anonymous,du,<val>
fields@struct equ fields@struct,field@struct \}
macro dd [val] \{ \common \local anonymous
define field@struct anonymous,dd,<val>
fields@struct equ fields@struct,field@struct \}
macro dp [val] \{ \common \local anonymous
define field@struct anonymous,dp,<val>
fields@struct equ fields@struct,field@struct \}
macro dq [val] \{ \common \local anonymous
define field@struct anonymous,dq,<val>
fields@struct equ fields@struct,field@struct \}
macro dt [val] \{ \common \local anonymous
define field@struct anonymous,dt,<val>
fields@struct equ fields@struct,field@struct \}
macro rb count \{ \local anonymous
define field@struct anonymous,db,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro rw count \{ \local anonymous
define field@struct anonymous,dw,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro rd count \{ \local anonymous
define field@struct anonymous,dd,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro rp count \{ \local anonymous
define field@struct anonymous,dp,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro rq count \{ \local anonymous
define field@struct anonymous,dq,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro rt count \{ \local anonymous
define field@struct anonymous,dt,count dup (?)
fields@struct equ fields@struct,field@struct \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \} }
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name tail,fields@struct, \\{ if $
display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah
err
end if \\}
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
define fields@\\#name fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
macro make@struct name,[field,type,def]
{ common
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
macro define@struct name,[field,type,def]
{ common
virtual
db `name
load initial@struct byte from 0
if initial@struct = '.'
display 'Error: name of structure should not begin with a dot.',0Dh,0Ah
err
end if
end virtual
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
label name#.#type
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{ \\local \\..base
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label \\..base
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common label . at \\..base \\\}
\\}
macro name value \\{
match any, fields@struct \\\{ \\\local anonymous
fields@struct equ fields@struct,anonymous,name,<values> \\\}
match , fields@struct \\\{
forward
match , value \\\\{ type def \\\\}
match any, value \\\\{ \\\\local ..field
..field = $
type value
if ~ field eq .
rb sizeof.#name#field - ($-..field)
end if \\\\}
common \\\} \\} \} }
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,parent,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
enable@substruct
macro define@union parent,name,[field,type,def]
{ common
virtual at parent#.#name
forward
if ~ field eq .
virtual at parent#.#name
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $ - parent#.#name
rb sizeof.#parent#field - ($ - parent#.#name)
end if
else
virtual at parent#.#name
label parent#.#type
type def
end virtual
label name#.#type at parent#.#name
if sizeof.#type > $ - parent#.#name
rb sizeof.#type - ($ - parent#.#name)
end if
end if
common
sizeof.#name = $ - parent#.#name
end virtual
struc name [value] \{ \common
label .\#name
last@union equ
forward
match any, last@union \\{ virtual at .\#name
field type def
end virtual \\}
match , last@union \\{ match , value \\\{ field type def \\\}
match any, value \\\{ field type value \\\} \\}
last@union equ field
common rb sizeof.#name - ($ - .\#name) \}
macro name [value] \{ \common \local ..anonymous
..anonymous name value \} }
macro define@substruct parent,name,[field,type,def]
{ common
virtual at parent#.#name
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
label parent#.#type
rb sizeof.#type
end if
common
sizeof.#name = $ - parent#.#name
end virtual
struc name value \{
label .\#name
forward
match , value \\{ field type def \\}
match any, value \\{ field type value
if ~ field eq .
rb sizeof.#parent#field - ($-field)
end if \\}
common \}
macro name value \{ \local ..anonymous
..anonymous name \} }

View File

@@ -1,19 +0,0 @@
Copyright (c) 2017 rxi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,99 +0,0 @@
# microtar
A lightweight tar library written in ANSI C
## Basic Usage
The library consists of `microtar.c` and `microtar.h`. These two files can be
dropped into an existing project and compiled along with it.
#### Reading
```c
mtar_t tar;
mtar_header_t h;
char *p;
/* Open archive for reading */
mtar_open(&tar, "test.tar", "r");
/* Print all file names and sizes */
while ( (mtar_read_header(&tar, &h)) != MTAR_ENULLRECORD ) {
printf("%s (%d bytes)\n", h.name, h.size);
mtar_next(&tar);
}
/* Load and print contents of file "test.txt" */
mtar_find(&tar, "test.txt", &h);
p = calloc(1, h.size + 1);
mtar_read_data(&tar, p, h.size);
printf("%s", p);
free(p);
/* Close archive */
mtar_close(&tar);
```
#### Writing
```c
mtar_t tar;
const char *str1 = "Hello world";
const char *str2 = "Goodbye world";
/* Open archive for writing */
mtar_open(&tar, "test.tar", "w");
/* Write strings to files `test1.txt` and `test2.txt` */
mtar_write_file_header(&tar, "test1.txt", strlen(str1));
mtar_write_data(&tar, str1, strlen(str1));
mtar_write_file_header(&tar, "test2.txt", strlen(str2));
mtar_write_data(&tar, str2, strlen(str2));
/* Finalize -- this needs to be the last thing done before closing */
mtar_finalize(&tar);
/* Close archive */
mtar_close(&tar);
```
## Error handling
All functions which return an `int` will return `MTAR_ESUCCESS` if the operation
is successful. If an error occurs an error value less-than-zero will be
returned; this value can be passed to the function `mtar_strerror()` to get its
corresponding error string.
## Wrapping a stream
If you want to read or write from something other than a file, the `mtar_t`
struct can be manually initialized with your own callback functions and a
`stream` pointer.
All callback functions are passed a pointer to the `mtar_t` struct as their
first argument. They should return `MTAR_ESUCCESS` if the operation succeeds
without an error, or an integer below zero if an error occurs.
After the `stream` field has been set, all required callbacks have been set and
all unused fields have been zeroset the `mtar_t` struct can be safely used with
the microtar functions. `mtar_open` *should not* be called if the `mtar_t`
struct was initialized manually.
#### Reading
The following callbacks should be set for reading an archive from a stream:
Name | Arguments | Description
--------|------------------------------------------|---------------------------
`read` | `mtar_t *tar, void *data, unsigned size` | Read data from the stream
`seek` | `mtar_t *tar, unsigned pos` | Set the position indicator
`close` | `mtar_t *tar` | Close the stream
#### Writing
The following callbacks should be set for writing an archive to a stream:
Name | Arguments | Description
--------|------------------------------------------------|---------------------
`write` | `mtar_t *tar, const void *data, unsigned size` | Write data to the stream
## License
This library is free software; you can redistribute it and/or modify it under
the terms of the MIT license. See [LICENSE](LICENSE) for details.

View File

@@ -1,8 +0,0 @@
if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../" or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
CFLAGS = " -c -w -nostdinc -DGNUC -DMTAR_OBJ -Os -fno-common -fno-builtin -fno-leading-underscore -fno-pie"
INCLUDES = " -I../include -I../../ktcc/trunk/libc.obj/include"
tup.rule("microtar.c", "kos32-gcc" .. CFLAGS .. INCLUDES .. " -o %o %f " .. tup.getconfig("KPACK_CMD"), "mtar.obj")

View File

@@ -1,78 +0,0 @@
format binary as "kex"
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd MEM
dd MEM
dd 0
dd 0
include '../../../../macros.inc'
include '../../../../proc32.inc'
include '../../../../KOSfuncs.inc'
include '../../../../dll.inc'
include '../mtar.inc'
;include '../../../../debug-fdo.inc'
;__DEBUG__ = 1
;__DEBUG_LEVEL__ = 2
START:
stdcall dll.Load, @IMPORT ; Имортироуем функции из mtar.obj
test eax, eax
jnz exit
ccall [mtar_init] ; Инициализируем библиотеку (на самом деле подгружается libc.obj
ccall [mtar_open], tar, tar_fname, tar_fmode ; Открываем для чтения файл 'test.tar'
; DEBUGF 2, "%d", eax
print_next:
ccall [mtar_read_header], tar, header ; Читаем заголовок
cmp eax, MTAR_ENULLRECORD ; Если заголовок не был прочитан (return -7) выходим из цикла
je exit
ccall [printf], format_str, header+mtar_header_t.name, dword[header+mtar_header_t.size] ; Выводим в консоль имя файла и размер в байтах
ccall [mtar_next], tar ; Переходим к следующему заголовку
jmp print_next ; прыгаем в начало цикла
exit:
ccall [mtar_close], tar ; Закрываем 'test.tar'
mcall SF_TERMINATE_PROCESS ; Выходим из программы
; data
tar_fname db 'test.tar', 0
tar_fmode db 'r', 0
tar rb sizeof.mtar_t
header rb sizeof.mtar_header_t
format_str db '%-10s (%-4d bytes)', 0x0A,0
align 4
@IMPORT:
library mtar, 'mtar.obj', libc , 'libc.obj'
import mtar, \
mtar_init, 'mtar_init', \
mtar_open, 'mtar_open', \
mtar_next, 'mtar_next', \
mtar_strerror, 'mtar_strerror', \
mtar_read_header, 'mtar_read_header', \
mtar_write_data, 'mtar_write_data', \
mtar_finalize, 'mtar_finalize', \
mtar_close, 'mtar_close'
import libc, \
printf, 'printf'
IM_END:
align 4
rb 4096 ; stack
MEM:

View File

@@ -1,70 +0,0 @@
format binary as "kex"
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd MEM
dd MEM
dd 0
dd 0
include '../../../../macros.inc'
include '../../../../proc32.inc'
include '../../../../KOSfuncs.inc'
include '../../../../dll.inc'
include '../mtar.inc'
;include '../../../../debug-fdo.inc'
;__DEBUG__ = 1
;__DEBUG_LEVEL__ = 2
START:
stdcall dll.Load, @IMPORT ; Имортироуем функции из mtar.obj
test eax, eax
jnz exit
ccall [mtar_init] ; Инициализируем библиотеку (на самом деле подгружается libc.obj
ccall [mtar_open], tar, tar_fname, tar_fmode ; Создаём новый файл 'test.tar'
ccall [mtar_write_file_header], tar, test1_txt , str1_len ; Создаём внутри 'test.tar' пустрой файл 'test1.txt'
ccall [mtar_write_data], tar, str1, str1_len ; Записываем данныев в этот файл
ccall [mtar_finalize], tar ; Указываем что больше с tar работать не будем
ccall [mtar_close], tar ; Закрываем 'test.tar'
exit:
mcall SF_TERMINATE_PROCESS ; Выходим из программы
; data
str1 db 'Hello world!', 0
str1_len = $ - str1
str2 db 'Goodbye world!', 0
tar_fname db 'test.tar', 0
tar_fmode db 'w', 0
test1_txt db 'test1.txt', 0
tar rb 32
align 4
@IMPORT:
library mtar, 'mtar.obj'
import mtar, \
mtar_init, 'mtar_init', \
mtar_open, 'mtar_open', \
mtar_write_file_header, 'mtar_write_file_header', \
mtar_write_data, 'mtar_write_data', \
mtar_finalize, 'mtar_finalize', \
mtar_close, 'mtar_close'
IM_END:
align 4
rb 4096 ; stack
MEM:

View File

@@ -1,450 +0,0 @@
/*
* Copyright (c) 2017 rxi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <sys/ksys.h>
#include "microtar.h"
typedef struct {
char name[100];
char mode[8];
char owner[8];
char group[8];
char size[12];
char mtime[12];
char checksum[8];
char type;
char linkname[100];
char _padding[255];
} mtar_raw_header_t;
static void * mtar_memset( void * s, int c, size_t n ){
unsigned char * p = ( unsigned char * ) s;
while ( n-- ){
*p++ = ( unsigned char ) c;
}
return s;
}
#ifdef MTAR_OBJ
// All pointers was changed for compatible to latest version tcc and the libc.obj headers
size_t (*_fread)(void *restrict, size_t size, size_t count, FILE *restrict)=NULL;
size_t (*_fwrite)(const void *restrict, size_t size, size_t count, FILE *restrict)=NULL;
int (*_fclose)(FILE *)=NULL;
FILE* (*_fopen)(const char *restrict, const char *restrict)=NULL;
int (*_fseek)(FILE *, long, int)=NULL;
long (*_ftell)(FILE *)=NULL;
int (*_sprintf)(char* buffer, const char* format, ...)=NULL;
int (*_sscanf)(const char*, const char *restrict, ...)=NULL;
int (*_strcmp)(const char * s1, const char* s2)=NULL;
char* (*_strchr)(const char* s, int c)=NULL;
char* (*_strcpy)(char* s1, const char* s2)=NULL;
#endif
static unsigned round_up(unsigned n, unsigned incr) {
return n + (incr - n % incr) % incr;
}
static unsigned checksum(const mtar_raw_header_t* rh) {
unsigned i;
unsigned char *p = (unsigned char*) rh;
unsigned res = 256;
for (i = 0; i < offsetof(mtar_raw_header_t, checksum); i++) {
res += p[i];
}
for (i = offsetof(mtar_raw_header_t, type); i < sizeof(*rh); i++) {
res += p[i];
}
return res;
}
static int tread(mtar_t *tar, void *data, unsigned size) {
int err = tar->read(tar, data, size);
tar->pos += size;
return err;
}
static int twrite(mtar_t *tar, const void *data, unsigned size) {
int err = tar->write(tar, data, size);
tar->pos += size;
return err;
}
static int write_null_bytes(mtar_t *tar, int n) {
int i, err;
char nul = '\0';
for (i = 0; i < n; i++) {
err = twrite(tar, &nul, 1);
if (err) {
return err;
}
}
return MTAR_ESUCCESS;
}
static int raw_to_header(mtar_header_t *h, const mtar_raw_header_t *rh) {
unsigned chksum1, chksum2;
/* If the checksum starts with a null byte we assume the record is NULL */
if (*rh->checksum == '\0') {
return MTAR_ENULLRECORD;
}
/* Build and compare checksum */
chksum1 = checksum(rh);
_sscanf(rh->checksum, "%o", &chksum2);
if (chksum1 != chksum2) {
return MTAR_EBADCHKSUM;
}
/* Load raw header into header */
_sscanf(rh->mode, "%o", &h->mode);
_sscanf(rh->owner, "%o", &h->owner);
_sscanf(rh->size, "%o", &h->size);
_sscanf(rh->mtime, "%o", &h->mtime);
h->type = rh->type;
_strcpy(h->name, rh->name);
_strcpy(h->linkname, rh->linkname);
return MTAR_ESUCCESS;
}
static int header_to_raw(mtar_raw_header_t *rh, const mtar_header_t *h) {
unsigned chksum;
/* Load header into raw header */
mtar_memset(rh, 0, sizeof(*rh));
_sprintf(rh->mode, "%o", h->mode);
_sprintf(rh->owner, "%o", h->owner);
_sprintf(rh->size, "%o", h->size);
_sprintf(rh->mtime, "%o", h->mtime);
rh->type = h->type ? h->type : MTAR_TREG;
_strcpy(rh->name, h->name);
_strcpy(rh->linkname, h->linkname);
/* Calculate and write checksum */
chksum = checksum(rh);
_sprintf(rh->checksum, "%06o", chksum);
rh->checksum[7] = ' ';
return MTAR_ESUCCESS;
}
const char* mtar_strerror(int err) {
switch (err) {
case MTAR_ESUCCESS : return "success";
case MTAR_EFAILURE : return "failure";
case MTAR_EOPENFAIL : return "could not open";
case MTAR_EREADFAIL : return "could not read";
case MTAR_EWRITEFAIL : return "could not write";
case MTAR_ESEEKFAIL : return "could not seek";
case MTAR_EBADCHKSUM : return "bad checksum";
case MTAR_ENULLRECORD : return "null record";
case MTAR_ENOTFOUND : return "file not found";
}
return "unknown error";
}
static int file_write(mtar_t *tar, const void *data, unsigned size) {
unsigned res = _fwrite(data, 1, size, tar->stream);
return (res == size) ? MTAR_ESUCCESS : MTAR_EWRITEFAIL;
}
static int file_read(mtar_t *tar, void *data, unsigned size) {
unsigned res = _fread(data, 1, size, tar->stream);
return (res == size) ? MTAR_ESUCCESS : MTAR_EREADFAIL;
}
static int file_seek(mtar_t *tar, unsigned offset) {
int res = _fseek(tar->stream, offset, SEEK_SET);
return (res == 0) ? MTAR_ESUCCESS : MTAR_ESEEKFAIL;
}
static int file_close(mtar_t *tar) {
_fclose(tar->stream);
return MTAR_ESUCCESS;
}
int mtar_open(mtar_t *tar, const char *filename, const char *mode) {
int err;
mtar_header_t h;
/* Init tar struct and functions */
mtar_memset(tar, 0, sizeof(*tar));
tar->write = file_write;
tar->read = file_read;
tar->seek = file_seek;
tar->close = file_close;
/* Assure mode is always binary */
if ( _strchr(mode, 'r') ) mode = "rb";
if ( _strchr(mode, 'w') ) mode = "wb";
if ( _strchr(mode, 'a') ) mode = "ab";
/* Open file */
tar->stream = _fopen(filename, mode);
if (!tar->stream) {
return MTAR_EOPENFAIL;
}
/* Read first header to check it is valid if mode is `r` */
if (*mode == 'r') {
err = mtar_read_header(tar, &h);
if (err != MTAR_ESUCCESS) {
mtar_close(tar);
return err;
}
}
/* Return ok */
return MTAR_ESUCCESS;
}
int mtar_close(mtar_t *tar) {
return tar->close(tar);
}
int mtar_seek(mtar_t *tar, unsigned pos) {
int err = tar->seek(tar, pos);
tar->pos = pos;
return err;
}
int mtar_rewind(mtar_t *tar) {
tar->remaining_data = 0;
tar->last_header = 0;
return mtar_seek(tar, 0);
}
int mtar_next(mtar_t *tar) {
int err, n;
mtar_header_t h;
/* Load header */
err = mtar_read_header(tar, &h);
if (err) {
return err;
}
/* Seek to next record */
n = round_up(h.size, 512) + sizeof(mtar_raw_header_t);
return mtar_seek(tar, tar->pos + n);
}
int mtar_find(mtar_t *tar, const char *name, mtar_header_t *h) {
int err;
mtar_header_t header;
/* Start at beginning */
err = mtar_rewind(tar);
if (err) {
return err;
}
/* Iterate all files until we hit an error or find the file */
while ( (err = mtar_read_header(tar, &header)) == MTAR_ESUCCESS ) {
if ( !_strcmp(header.name, name) ) {
if (h) {
*h = header;
}
return MTAR_ESUCCESS;
}
mtar_next(tar);
}
/* Return error */
if (err == MTAR_ENULLRECORD) {
err = MTAR_ENOTFOUND;
}
return err;
}
int mtar_read_header(mtar_t *tar, mtar_header_t *h) {
int err;
mtar_raw_header_t rh;
/* Save header position */
tar->last_header = tar->pos;
/* Read raw header */
err = tread(tar, &rh, sizeof(rh));
if (err) {
return err;
}
/* Seek back to start of header */
err = mtar_seek(tar, tar->last_header);
if (err) {
return err;
}
/* Load raw header into header struct and return */
return raw_to_header(h, &rh);
}
int mtar_read_data(mtar_t *tar, void *ptr, unsigned size) {
int err;
/* If we have no remaining data then this is the first read, we get the size,
* set the remaining data and seek to the beginning of the data */
if (tar->remaining_data == 0) {
mtar_header_t h;
/* Read header */
err = mtar_read_header(tar, &h);
if (err) {
return err;
}
/* Seek past header and init remaining data */
err = mtar_seek(tar, tar->pos + sizeof(mtar_raw_header_t));
if (err) {
return err;
}
tar->remaining_data = h.size;
}
/* Read data */
err = tread(tar, ptr, size);
if (err) {
return err;
}
tar->remaining_data -= size;
/* If there is no remaining data we've finished reading and seek back to the
* header */
if (tar->remaining_data == 0) {
return mtar_seek(tar, tar->last_header);
}
return MTAR_ESUCCESS;
}
int mtar_write_header(mtar_t *tar, const mtar_header_t *h) {
mtar_raw_header_t rh;
/* Build raw header and write */
header_to_raw(&rh, h);
tar->remaining_data = h->size;
return twrite(tar, &rh, sizeof(rh));
}
int mtar_write_file_header(mtar_t *tar, const char *name, unsigned size) {
mtar_header_t h;
/* Build header */
mtar_memset(&h, 0, sizeof(h));
_strcpy(h.name, name);
h.size = size;
h.type = MTAR_TREG;
h.mode = 0664;
/* Write header */
return mtar_write_header(tar, &h);
}
int mtar_write_dir_header(mtar_t *tar, const char *name) {
mtar_header_t h;
/* Build header */
mtar_memset(&h, 0, sizeof(h));
_strcpy(h.name, name);
h.type = MTAR_TDIR;
h.mode = 0775;
/* Write header */
return mtar_write_header(tar, &h);
}
int mtar_write_data(mtar_t *tar, const void *data, unsigned size) {
int err;
/* Write data */
err = twrite(tar, data, size);
if (err) {
return err;
}
tar->remaining_data -= size;
/* Write padding if we've written all the data for this file */
if (tar->remaining_data == 0) {
return write_null_bytes(tar, round_up(tar->pos, 512) - tar->pos);
}
return MTAR_ESUCCESS;
}
int mtar_finalize(mtar_t *tar) {
/* Write two NULL records */
return write_null_bytes(tar, sizeof(mtar_raw_header_t) * 2);
}
/* Load libc.obj */
#ifdef MTAR_OBJ
#include <sys/ksys.h>
int mtar_init(){
ksys_dll_t *libc = _ksys_dlopen("/sys/lib/libc.obj");
if(!libc){
_ksys_debug_puts("mtar.obj: libc.obj not loaded!");
return 1;
}
_fread = _ksys_dlsym(libc, "fread");
_fwrite = _ksys_dlsym(libc, "fwrite");
_fclose = _ksys_dlsym(libc, "fclose");
_fopen = _ksys_dlsym(libc, "fopen");
_fseek = _ksys_dlsym(libc, "fseek");
_ftell = _ksys_dlsym(libc, "ftell");
_sprintf= _ksys_dlsym(libc, "sprintf");
_sscanf = _ksys_dlsym(libc, "sscanf");
_strcmp = _ksys_dlsym(libc, "strcmp");
_strchr = _ksys_dlsym(libc, "strchr");
_strcpy = _ksys_dlsym(libc, "strcpy");
return 0;
}
ksys_dll_t EXPORTS[] = {
{"mtar_init", mtar_init},
{"mtar_open", mtar_open},
{"mtar_close", mtar_close},
{"mtar_seek", mtar_seek},
{"mtar_rewind", mtar_rewind},
{"mtar_next", mtar_next},
{"mtar_find", mtar_find},
{"mtar_read_header", mtar_read_header},
{"mtar_read_data", mtar_read_data},
{"mtar_write_header", mtar_write_header},
{"mtar_write_file_header", mtar_write_file_header},
{"mtar_write_dir_header", mtar_write_dir_header},
{"mtar_write_data",mtar_write_data},
{"mtar_finalize", mtar_finalize},
{"mtar_strerror", mtar_strerror},
NULL
};
#endif

View File

@@ -1,91 +0,0 @@
/**
* Copyright (c) 2017 rxi
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MIT license. See `microtar.c` for details.
*/
#ifndef MICROTAR_H
#define MICROTAR_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdio.h>
#include <stdlib.h>
#define MTAR_VERSION "0.1.0"
enum {
MTAR_ESUCCESS = 0,
MTAR_EFAILURE = -1,
MTAR_EOPENFAIL = -2,
MTAR_EREADFAIL = -3,
MTAR_EWRITEFAIL = -4,
MTAR_ESEEKFAIL = -5,
MTAR_EBADCHKSUM = -6,
MTAR_ENULLRECORD = -7,
MTAR_ENOTFOUND = -8
};
enum {
MTAR_TREG = '0',
MTAR_TLNK = '1',
MTAR_TSYM = '2',
MTAR_TCHR = '3',
MTAR_TBLK = '4',
MTAR_TDIR = '5',
MTAR_TFIFO = '6'
};
typedef struct {
unsigned mode;
unsigned owner;
unsigned size;
unsigned mtime;
unsigned type;
char name[100];
char linkname[100];
} mtar_header_t;
typedef struct mtar_t mtar_t;
#pragma pack(push,1)
struct mtar_t {
int (*read)(mtar_t *tar, void *data, unsigned size);
int (*write)(mtar_t *tar, const void *data, unsigned size);
int (*seek)(mtar_t *tar, unsigned pos);
int (*close)(mtar_t *tar);
void *stream;
unsigned pos;
unsigned remaining_data;
unsigned last_header;
};
#pragma pack(pop)
const char* mtar_strerror(int err);
int mtar_open(mtar_t *tar, const char *filename, const char *mode);
int mtar_close(mtar_t *tar);
int mtar_seek(mtar_t *tar, unsigned pos);
int mtar_rewind(mtar_t *tar);
int mtar_next(mtar_t *tar);
int mtar_find(mtar_t *tar, const char *name, mtar_header_t *h);
int mtar_read_header(mtar_t *tar, mtar_header_t *h);
int mtar_read_data(mtar_t *tar, void *ptr, unsigned size);
int mtar_write_header(mtar_t *tar, const mtar_header_t *h);
int mtar_write_file_header(mtar_t *tar, const char *name, unsigned size);
int mtar_write_dir_header(mtar_t *tar, const char *name);
int mtar_write_data(mtar_t *tar, const void *data, unsigned size);
int mtar_finalize(mtar_t *tar);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,38 +0,0 @@
MTAR_ESUCCESS = 0
MTAR_EFAILURE = -1
MTAR_EOPENFAIL = -2
MTAR_EREADFAIL = -3
MTAR_EWRITEFAIL = -4
MTAR_ESEEKFAIL = -5
MTAR_EBADCHKSUM = -6
MTAR_ENULLRECORD = -7
MTAR_ENOTFOUND = -8
MTAR_TREG = '0'
MTAR_TLNK = '1'
MTAR_TSYM = '2'
MTAR_TCHR = '3'
MTAR_TBLK = '4'
MTAR_TDIR = '5'
MTAR_TFIFO = '6'
struct mtar_header_t
mode dd ?
owner dd ?
size dd ?
mtime dd ?
type dd ?
name rb 100
linkname rb 100
ends
struct mtar_t
read_func dd ?
write_func dd ?
seek_func dd ?
close_func dd ?
stream dd ?
pos dd ?
remaining_data dd ?
last_header dd ?
ends

View File

@@ -33,38 +33,39 @@ use_ColorDialog
;--------------------------------------------------
align 16
lib_init:
ret
xor eax, eax
ret
;--------------------------------------------------
align 16
EXPORTS:
dd sz_init, lib_init
dd sz_version, 0x00000001
dd sz_init, lib_init
dd sz_version, 0x00000001
dd sz_OpenDialog_init, OpenDialog.init
dd sz_OpenDialog_start, OpenDialog.start
dd sz_OpenDialog_set_file_name, OpenDialog.set_file_name
dd sz_OpenDialog_set_file_ext, OpenDialog.set_file_ext
dd szVersion_OpenDialog, 0x00010001
dd sz_OpenDialog_init, OpenDialog.init
dd sz_OpenDialog_start, OpenDialog.start
dd sz_OpenDialog_set_file_name, OpenDialog.set_file_name
dd sz_OpenDialog_set_file_ext, OpenDialog.set_file_ext
dd szVersion_OpenDialog, 0x00010001
dd sz_ColorDialog_init, ColorDialog.init
dd sz_ColorDialog_start, ColorDialog.start
dd szVersion_ColorDialog, 0x00010001
dd sz_ColorDialog_init, ColorDialog.init
dd sz_ColorDialog_start, ColorDialog.start
dd szVersion_ColorDialog, 0x00010001
dd 0,0
dd 0,0
;-----------------------------------------------------------------------------
sz_init db 'lib_init',0
sz_version db 'version',0
sz_init db 'lib_init',0
sz_version db 'version',0
sz_OpenDialog_init db 'OpenDialog_init',0
sz_OpenDialog_start db 'OpenDialog_start',0
sz_OpenDialog_set_file_name db 'OpenDialog_set_file_name',0
sz_OpenDialog_set_file_ext db 'OpenDialog_set_file_ext',0
szVersion_OpenDialog db 'Version_OpenDialog',0
sz_OpenDialog_init db 'OpenDialog_init',0
sz_OpenDialog_start db 'OpenDialog_start',0
sz_OpenDialog_set_file_name db 'OpenDialog_set_file_name',0
sz_OpenDialog_set_file_ext db 'OpenDialog_set_file_ext',0
szVersion_OpenDialog db 'Version_OpenDialog',0
sz_ColorDialog_init db 'ColorDialog_init',0
sz_ColorDialog_start db 'ColorDialog_start',0
szVersion_ColorDialog db 'Version_ColorDialog',0
sz_ColorDialog_init db 'ColorDialog_init',0
sz_ColorDialog_start db 'ColorDialog_start',0
szVersion_ColorDialog db 'Version_ColorDialog',0
;-----------------------------------------------------------------------------

View File

@@ -122,7 +122,13 @@ struc fpcvt
.sizeof:
}
;-----------------------------------------------------------------------------
; Command flags
CMD_WITHOUT_PARAM = 1b ; command may be called without parameters
CMD_WITH_PARAM = 10b ; command may be called with parameters
CMD_WITHOUT_LOADED_APP = 100b ; command may be called without loaded program
CMD_WITH_LOADED_APP = 1000b ; command may be called with loaded program
;-----------------------------------------------------------------------------
; Entry point
@@ -449,63 +455,56 @@ z1:
mov esi, commands
call find_cmd
mov eax, aUnknownCommand
jc .x11
; check command requirements
; flags field:
; &1: command may be called without parameters
; &2: command may be called with parameters
; &4: command may be called without loaded program
; &8: command may be called with loaded program
jc .cmd_procg
mov eax, [esi+8]
mov ecx, [curarg]
cmp byte [ecx], 0
jz .noargs
test byte [esi+16], 2
jz .x11
test byte [esi+16], CMD_WITH_PARAM
jz .cmd_procg
jmp @f
.noargs:
test byte [esi+16], 1
jz .x11
test byte [esi+16], CMD_WITHOUT_PARAM
jz .cmd_procg
@@:
cmp [debuggee_pid], 0
jz .nodebuggee
mov eax, aAlreadyLoaded
test byte [esi+16], 8
jz .x11
jmp .x9
test byte [esi+16], CMD_WITH_LOADED_APP
jz .cmd_procg
jmp .run_cmd
.nodebuggee:
mov eax, need_debuggee
test byte [esi+16], 4
jnz .x9
test byte [esi+16], CMD_WITHOUT_LOADED_APP
jnz .run_cmd
.x11:
.cmd_procg:
xchg esi, eax
call put_message
; store cmdline for repeating
.x10:
.cmd_procg_no_put_msg:
mov esi, cmdline
mov ecx, [cmdline_len]
@@:
cmp ecx, 0
jle .we
jle .wait_event
mov al, [esi + ecx]
mov [cmdline_prev + ecx], al
dec ecx
jmp @b
.we:
.wait_event:
mov [cmdline_len], 0
jmp waitevent
.x9:
.run_cmd:
call dword [esi+4]
jmp .x10
jmp .cmd_procg_no_put_msg
;-----------------------------------------------------------------------------
; Cmdline handling

View File

@@ -2,7 +2,10 @@
COLOR_THEME fix MOVIEOS
format binary as ""
include '../../macros.inc'
include '../../KOSfuncs.inc'
use32
db 'MENUET01'
dd 1
@@ -1145,6 +1148,105 @@ OnDump:
.ret:
ret
;-----------------------------------------------------------------------------
; Print Backtrace
struct STACK_FRAME
prev_frame rd 1
ret_addr rd 1
ends
OnBacktrace:
push ebp
; Set max depth counter
xor eax, eax
dec eax
mov esi, [curarg]
cmp byte [esi], 0
jz .save_depth
call get_hex_number
mov esi, aParseError
jc .exit
; If depth 0
test eax, eax
jz .done
.save_depth:
mov [bt_depth], eax
; Get start frame addres
mov ebp, [_ebp]
test ebp, ebp
jz .done
mov edi, stack_frame_dump
.next:
mcall SF_DEBUG, SSF_READ_MEMORY, [debuggee_pid], sizeof.STACK_FRAME, ebp
cmp eax, -1
mov esi, read_mem_err
jz .exit
; The address of the previous frame must be less than the current one
mov eax, [edi + STACK_FRAME.prev_frame]
test eax, eax
jz .done
; Save stack_frame_dump
push edi
; Save previous frame
push ebp
; Save return address
mov eax, [edi + STACK_FRAME.ret_addr]
push eax
; Print frame address and return address
push eax ; pop in put_message_nodraw
push ebp ; pop in put_message_nodraw
mov esi, aBacktraceFmt
call put_message_nodraw
; Restore return address
pop eax
; Find symbol by return address
call find_near_symbol
test esi, esi
jnz .print_sym
mov esi, aBacktraceSymStub
.print_sym:
call put_message_nodraw
mov esi, newline
call put_message_nodraw
; Restore previous frame
pop ebp
; Restore stack_frame_dump
pop edi
; The address of the previous frame must be greater than the current one.
cmp [edi + STACK_FRAME.prev_frame], ebp
jna .done
; Set previous frame
mov ebp, [edi + STACK_FRAME.prev_frame]
dec [bt_depth]
jnz .next
.done:
mov esi, newline
.exit:
call put_message
pop ebp
ret
;-----------------------------------------------------------------------------
; Dissassemble block of executable event
@@ -1864,7 +1966,7 @@ include 'disasm.inc'
caption_str db 'Kolibri Debugger',0
begin_str db 'Kolibri Debugger, version 0.35',10
begin_str db 'Kolibri Debugger, version 0.36',10
db 'Hint: type "help" for help, "quit" to quit'
newline db 10,0
prompt db '> ',0
@@ -1880,66 +1982,88 @@ help_groups:
;-----------------------------------------------------------------------------
; Commands format definitions
; TODO: make it with macros
; flags field:
; &1: command may be called without parameters
; &2: command may be called with parameters
; &4: command may be called without loaded program
; &8: command may be called with loaded program
commands:
dd _aH, OnHelp, HelpSyntax, HelpHelp
db 0Fh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
dd aHelp, OnHelp, HelpSyntax, HelpHelp
db 0Fh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
dd aQuit, OnQuit, QuitSyntax, QuitHelp
db 0Dh
db CMD_WITHOUT_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
dd aLoad, OnLoad, LoadSyntax, LoadHelp
db 6
db CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP
dd aReload, OnReload, ReloadSyntax, ReloadHelp
db 0Dh
db CMD_WITHOUT_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
dd aTerminate, OnTerminate, TerminateSyntax, TerminateHelp
db 9
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
dd aDetach, OnDetach, DetachSyntax, DetachHelp
db 9
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
dd aSuspend, OnSuspend, SuspendSyntax, SuspendHelp
db 9
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
dd aResume, OnResume, ResumeSyntax, ResumeHelp
db 0Bh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aStep, OnStepMultiple, StepSyntax, StepHelp
db 0Bh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aProceed, OnProceedMultiple, ProceedSyntax, ProceedHelp
db 0Bh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aCalc, OnCalc, CalcSyntax, CalcHelp
db 0Eh
db CMD_WITH_PARAM or CMD_WITHOUT_LOADED_APP or CMD_WITH_LOADED_APP
dd aDump, OnDump, DumpSyntax, DumpHelp
db 0Bh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBacktrace, OnBacktrace, BacktraceSyntax, BacktraceHelp
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aUnassemble, OnUnassemble, UnassembleSyntax, UnassembleHelp
db 0Bh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBp, OnBp, BpSyntax, BpHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBpm, OnBpmb, BpmSyntax, BpmHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBpmb, OnBpmb, BpmSyntax, BpmHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBpmw, OnBpmw, BpmSyntax, BpmHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBpmd, OnBpmd, BpmSyntax, BpmHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBl, OnBl, BlSyntax, BlHelp
db 0Bh
db CMD_WITHOUT_PARAM or CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBc, OnBc, BcSyntax, BcHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBd, OnBd, BdSyntax, BdHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aBe, OnBe, BeSyntax, BeHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aReg, OnReg, RSyntax, RHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd aUnpack, OnUnpack, UnpackSyntax, UnpackHelp
db 9
db CMD_WITHOUT_PARAM or CMD_WITH_LOADED_APP
dd aLoadSymbols, OnLoadSymbols, LoadSymbolsSyntax, LoadSymbolsHelp
db 0Ah
db CMD_WITH_PARAM or CMD_WITH_LOADED_APP
dd 0
;-----------------------------------------------------------------------------
@@ -1980,7 +2104,8 @@ help_data_msg db 'List of data commands:',10
db 'd [<expression>] - dump data at given address',10
db 'u [<expression>] - unassemble instructions at given address',10
db 'r <register> <expression> or',10
db 'r <register>=<expression> - set register value',10,0
db 'r <register>=<expression> - set register value',10
db 'bt [<number>] - display backtrace / stacktrace',10,0
; Breakpoints commands group
@@ -2038,6 +2163,11 @@ DumpHelp db 'Dump data of debugged program',10
DumpSyntax db 'Usage: d <expression> - dump data at specified address',10
db ' or: d - continue current dump',10,0
aBacktrace db 3,'bt',0
BacktraceHelp db 'Display backtrace / stacktrace',10
BacktraceSyntax db 'Usage: bt <number> - display backtrace with depth',10
db ' or: bt display all backtrace',10,0
aCalc db 2,'?',0
CalcHelp db 'Calculate value of expression',10
CalcSyntax db 'Usage: ? <expression>',10,0
@@ -2102,6 +2232,11 @@ LoadSymbolsSyntax db 'Usage: load-symbols <symbols-file-name>',10,0
aUnknownCommand db 'Unknown command',10,0
;-----------------------------------------------------------------------------
; Info messages
aBacktraceSymStub db '??',0
aBacktraceFmt db '[0x%8X] 0x%8X in ',0
;-----------------------------------------------------------------------------
; Error messages
@@ -2474,11 +2609,13 @@ disasm_cur_pos dd ?
disasm_cur_str dd ?
disasm_string rb 256
thread_info process_information
stack_frame_dump rb sizeof.STACK_FRAME
bt_depth rd 1
;-----------------------------------------------------------------------------
; Coordinates and sizes for GUI
thread_info process_information
data_x_size_dd dd ?, ?
messages_x_size_dd dd ?, ?
registers_x_pos_dd dd ?, ?

View File

@@ -4,6 +4,11 @@
include 'sort.inc'
struct DEBUG_SYMBOL
addr rd 1
string rd 0
ends
; compare proc for sorter
compare:
cmpsd
@@ -459,4 +464,69 @@ find_symbol_name:
@@:
pop esi
ret
ret
;-----------------------------------------------------------------------------
;
; Find the nearest symol using binary search
;
; in: eax - target addres
; out: esi - symbol name
; destroys: ebx, ecx, edx, edi, ebp
;
find_near_symbol:
mov edi, [symbols]
xor esi, esi ; Result
mov ecx, esi ; Left
mov edx, [num_symbols] ; Right
dec edx
js .end
; If the first address is already greater than the target
mov ebp, [edi + ecx * sizeof.DEBUG_SYMBOL]
cmp [ebp + DEBUG_SYMBOL.addr], eax
ja .end
; If the last address is less than or equal to the target
mov ebp, [edi + edx * sizeof.DEBUG_SYMBOL]
cmp [ebp + DEBUG_SYMBOL.addr], eax
jbe .found
.loop:
cmp ecx, edx
ja .end
; Calc middle:
mov ebx, edx ; Middle
sub ebx, ecx ; (right - left)
shr ebx, 1 ; / 2
add ebx, ecx ; + left
; Equal
mov ebp, [edi + ebx * sizeof.DEBUG_SYMBOL]
cmp [ebp + DEBUG_SYMBOL.addr], eax
jz .found
jb .update_left
; Update right
mov edx, ebx
dec edx
jmp .loop
.update_left:
; Save potential result
mov esi, ebp
add esi, DEBUG_SYMBOL.string
; Update left
mov ecx, ebx
inc ecx
jmp .loop
.found:
mov esi, ebp
add esi, DEBUG_SYMBOL.string
.end:
ret

Some files were not shown because too many files have changed in this diff Show More