Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ed8821346 | ||
|
|
7c9ad9dde9 | ||
|
|
c8cf7a834f | ||
|
|
3b8dc9662d | ||
|
|
a8412100b4 |
No files matched your search
@@ -54,27 +54,3 @@
|
||||
src: "{{ stable_artifact_path }}/"
|
||||
dest: "{{ storage_path }}/../"
|
||||
mode: preserve
|
||||
|
||||
# older builds shrink to compressed images and lose their unpacked tree; the newest few keep both
|
||||
- name: Looking for zstd on the storage server
|
||||
ansible.builtin.shell: command -v zstd
|
||||
register: zstd_present
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Requiring zstd for compaction
|
||||
ansible.builtin.assert:
|
||||
that: zstd_present.rc == 0
|
||||
fail_msg: >-
|
||||
zstd is not installed on the storage server, so older builds cannot
|
||||
be compacted. Install it and re-run this build.
|
||||
|
||||
- name: Compacting older builds
|
||||
ansible.builtin.script:
|
||||
cmd: >-
|
||||
../../utils/compact-builds.sh
|
||||
{{ storage_path | quote }}
|
||||
{{ compact_keep | default(5) | int }}
|
||||
{{ compact_max | default(10) | int }}
|
||||
register: compaction
|
||||
changed_when: "'compacted 0 of' not in compaction.stdout"
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: 2026 KolibriOS team
|
||||
|
||||
# Shrink older builds on the storage server: compress their images and drop
|
||||
# their unpacked tree, which is rebuildable from the commit. sha256sums.txt
|
||||
# keeps naming the bare images, so a compacted build has to be decompressed
|
||||
# before it can be verified.
|
||||
#
|
||||
# Layout: <root>/<version>/<lang>/kolibrios-<descr>-<lang>.{img,iso,raw} -> .zst
|
||||
# <root>/<version>/<lang>/data/ -> removed
|
||||
#
|
||||
# Usage: compact-builds.sh <storage-root> [keep] [max-per-run]
|
||||
# DRY_RUN=1 walks the same selection and changes nothing
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
root=${1:?storage root required}
|
||||
# the build just published is always among these, so an upload in flight is safe
|
||||
keep=${2:-5}
|
||||
# a build is hundreds of MiB to re-compress: cap the first pass over the backlog
|
||||
max=${3:-10}
|
||||
dry=${DRY_RUN:-0}
|
||||
verb=compacted
|
||||
[ "$dry" = 1 ] && verb="would compact"
|
||||
|
||||
# --rm drops the source only once the archive is written; the box serves the
|
||||
# site over NFS, so compaction yields to it
|
||||
compress_image() {
|
||||
nice -n 10 ionice -c3 zstd -12 -T1 -q --rm "$1"
|
||||
}
|
||||
export -f compress_image
|
||||
|
||||
leftovers() {
|
||||
local build=$1
|
||||
find "$build" -mindepth 2 -maxdepth 2 \
|
||||
\( -type d -name data \
|
||||
-o -type f \( -name '*.img' -o -name '*.iso' -o -name '*.raw' \) \) \
|
||||
-print -quit
|
||||
}
|
||||
|
||||
compacted=0
|
||||
pending=0
|
||||
|
||||
while IFS= read -r version; do
|
||||
dir="$root/$version"
|
||||
[ -n "$(leftovers "$dir")" ] || continue
|
||||
|
||||
pending=$((pending + 1))
|
||||
[ "$compacted" -lt "$max" ] || continue
|
||||
|
||||
if [ "$dry" = 1 ]; then
|
||||
compacted=$((compacted + 1))
|
||||
echo "$verb $version"
|
||||
continue
|
||||
fi
|
||||
|
||||
# a build holds nine images: one per core, each zstd kept to one thread so
|
||||
# the two levels of parallelism do not fight. Archive before dropping the
|
||||
# tree, so a failure here leaves the build merely uncompacted and the next
|
||||
# run picks it up again
|
||||
find "$dir" -mindepth 2 -maxdepth 2 -type f \
|
||||
\( -name '*.img' -o -name '*.iso' -o -name '*.raw' \) -print0 \
|
||||
| xargs -0 -r -P "$(nproc)" -I{} bash -c 'compress_image "$@"' _ {}
|
||||
|
||||
find "$dir" -mindepth 2 -maxdepth 2 -type d -name data -exec rm -rf {} +
|
||||
|
||||
compacted=$((compacted + 1))
|
||||
echo "$verb $version"
|
||||
# <tag>-<commit count>-g<sha>: order by the count, never by mtime
|
||||
done < <(find "$root" -mindepth 1 -maxdepth 1 -type d -name '*-*-g*' -printf '%f\n' \
|
||||
| sort -t- -k2,2n | head -n "-$keep")
|
||||
|
||||
echo "$verb $compacted of $pending older build(s), $((pending - compacted)) left for the next run"
|
||||
@@ -128,8 +128,7 @@ jobs:
|
||||
fi
|
||||
|
||||
# cache restore resets ctimes; realign tup DB to skip a full rebuild,
|
||||
# but keep files changed since the cache's commit dirty so tup rebuilds them.
|
||||
# A submodule bump diffs as a bare gitlink, so expand it to its whole subtree
|
||||
# but keep files changed since the cache's commit dirty so tup rebuilds them
|
||||
- name: Sync tup DB with filesystem ctime
|
||||
if: steps.check-tup-cache.outputs.cache_restored == 'true'
|
||||
run: |
|
||||
@@ -137,10 +136,6 @@ jobs:
|
||||
BASE=$(cat .tup/build-commit 2>/dev/null || true)
|
||||
if [ -n "$BASE" ] && git cat-file -e "${BASE}^{commit}" 2>/dev/null; then
|
||||
git -c core.quotePath=false diff --name-only "$BASE" HEAD > "$DIRTY"
|
||||
git diff --raw "$BASE" HEAD | awk '$2 == "160000" { print $NF }' |
|
||||
while read -r sub; do
|
||||
git -C "$sub" -c core.quotePath=false ls-files | sed "s|^|$sub/|"
|
||||
done >> "$DIRTY"
|
||||
echo "Cache built at $BASE; $(wc -l < "$DIRTY") changed files kept dirty"
|
||||
python3 .gitea/utils/sync-tup-ctime.py .tup/db "$DIRTY"
|
||||
else
|
||||
|
||||
@@ -34,11 +34,10 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: Bump ${{ matrix.name }} and open PR
|
||||
env:
|
||||
TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
API: ${{ github.api_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
NAME: ${{ matrix.name }}
|
||||
|
||||
+18
-21
@@ -41,6 +41,10 @@ img_files = {
|
||||
{"LIB/KMENU.OBJ", "common/lib/kmenu.obj"},
|
||||
{"LIB/PIXLIB.OBJ", "common/lib/pixlib.obj"},
|
||||
{"MEDIA/AC97SND", "common/media/ac97snd"},
|
||||
{"MEDIA/IMGF/IMGF", "common/media/ImgF/ImgF"},
|
||||
{"MEDIA/IMGF/CEDG.OBJ", "common/media/ImgF/cEdg.obj"},
|
||||
{"MEDIA/IMGF/DITHER.OBJ", "common/media/ImgF/dither.obj"},
|
||||
{"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"},
|
||||
{"NETWORK/FTPC.INI", SRC_PROGS .. "/network/ftpc/ftpc.ini"},
|
||||
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
|
||||
{"NETWORK/KNMAP", "common/network/knmap"},
|
||||
@@ -54,7 +58,8 @@ img_files = {
|
||||
{"SETTINGS/FB2READ.INI", "common/settings/fb2read.ini"},
|
||||
{"SETTINGS/HA.CFG", SRC_PROGS .. "/other/ha/SETTINGS/HA.CFG"},
|
||||
{"SETTINGS/ICON.INI", build_type .. "/settings/icon.ini"},
|
||||
{"SETTINGS/KEYMAP.KEY", VAR_PROGS .. "/system/taskbar/keymap.key.kpack"},
|
||||
{"SETTINGS/KEYMAP.KEY", SRC_PROGS .. "/system/taskbar/KEYMAP.KEY"},
|
||||
{"SETTINGS/KOLIBRI.LBL", build_type .. "/settings/kolibri.lbl"},
|
||||
{"SETTINGS/LANG.INI", build_type .. "/settings/lang.ini"},
|
||||
{"SETTINGS/MENU.DAT", build_type .. "/settings/menu.dat"},
|
||||
{"SETTINGS/NETWORK.INI", "common/settings/network.ini"},
|
||||
@@ -268,10 +273,6 @@ extra_files = {
|
||||
{"kolibrios/lib/i915_dri.drv", "common/lib/i915_dri.drv"},
|
||||
{"kolibrios/media/fplay", "common/media/fplay"},
|
||||
{"kolibrios/media/fplay_run", "common/media/fplay_run"},
|
||||
{"kolibrios/media/ImgF/ImgF", "common/media/ImgF/ImgF"},
|
||||
{"kolibrios/media/ImgF/cEdg.obj", "common/media/ImgF/cEdg.obj"},
|
||||
{"kolibrios/media/ImgF/dither.obj", "common/media/ImgF/dither.obj"},
|
||||
{"kolibrios/media/ImgF/invSol.obj", "common/media/ImgF/invSol.obj"},
|
||||
{"kolibrios/media/minimp3", "common/media/minimp3"},
|
||||
{"kolibrios/media/updf", SRC .. "/contrib/media/updf/build/uPDF"},
|
||||
{"kolibrios/media/vttf", "common/media/vttf"},
|
||||
@@ -486,6 +487,11 @@ tup.append_table(img_files, {
|
||||
{"DEVELOP/MTDBG", VAR_PROGS .. "/develop/mtdbg/mtdbg"},
|
||||
{"DEVELOP/MSTATE", VAR_PROGS .. "/develop/mstate/mstate"},
|
||||
{"DEVELOP/SCANCODE", VAR_PROGS .. "/develop/scancode/scancode"},
|
||||
{"DEVELOP/EXAMPLES/CIRCLE", VAR_PROGS .. "/develop/examples/circle/circle"},
|
||||
{"DEVELOP/EXAMPLES/COLORREF", VAR_PROGS .. "/demos/colorref/colorref"},
|
||||
{"DEVELOP/EXAMPLES/CONGET", VAR_PROGS .. "/develop/libraries/console_coff/examples/test_gets"},
|
||||
{"DEVELOP/EXAMPLES/CSLIDE", VAR_PROGS .. "/demos/cslide/cslide"},
|
||||
{"DEVELOP/EXAMPLES/THREAD", VAR_PROGS .. "/develop/examples/thread/thread"},
|
||||
{"File Managers/KFAR", VAR_PROGS .. "/fs/kfar/kfar"},
|
||||
{"File Managers/OPENDIAL", VAR_PROGS .. "/fs/opendial/opendial"},
|
||||
{"LOD", VAR_PROGS .. "/fs/lod/lod"},
|
||||
@@ -592,7 +598,6 @@ tup.append_table(img_files, {
|
||||
{"DRIVERS/VT823X.SYS", VAR_DRVS .. "/audio/vt823x.sys"},
|
||||
{"DRIVERS/SIS.SYS", VAR_DRVS .. "/audio/sis.sys"},
|
||||
{"DRIVERS/SDHCI.SYS", "../drivers/sdhci/sdhci.sys"},
|
||||
{"DRIVERS/I2CHID.SYS", VAR_DRVS .. "/i2chid/i2chid.sys"},
|
||||
})
|
||||
tup.append_table(extra_files, {
|
||||
{"HD_Load/9x2klbr/", VAR_PROGS .. "/hd_load/9x2klbr/9x2klbr.exe"},
|
||||
@@ -646,28 +651,20 @@ tup.append_table(extra_files, {
|
||||
{"kolibrios/3D/blocks/block.bin", VAR_PROGS .. "/bcc32/games/blocks/block.bin"},
|
||||
{"kolibrios/develop/tcc/lib/crt0.o", VAR_PROGS .. "/develop/ktcc/bin/lib/crt0.o", group = "../programs/develop/ktcc/<crt0.o>"},
|
||||
{"kolibrios/develop/tcc/lib/tiny.o", VAR_PROGS .. "/develop/ktcc/bin/lib/tiny.o", group = "../programs/develop/ktcc/<tiny.o>"},
|
||||
{"kolibrios/develop/tcc/lib/libsound.a", VAR_PROGS .. "/develop/ktcc/bin/lib/libsound.a", group = "../programs/develop/ktcc/<libsound.a>"},
|
||||
{"kolibrios/develop/examples/circle", VAR_PROGS .. "/develop/examples/circle/circle"},
|
||||
{"kolibrios/develop/examples/colorref", VAR_PROGS .. "/demos/colorref/colorref"},
|
||||
{"kolibrios/develop/examples/conget", VAR_PROGS .. "/develop/libraries/console_coff/examples/test_gets"},
|
||||
{"kolibrios/develop/examples/cslide", VAR_PROGS .. "/demos/cslide/cslide"},
|
||||
{"kolibrios/develop/examples/thread", VAR_PROGS .. "/develop/examples/thread/thread"}
|
||||
{"kolibrios/develop/tcc/lib/libsound.a", VAR_PROGS .. "/develop/ktcc/bin/lib/libsound.a", group = "../programs/develop/ktcc/<libsound.a>"}
|
||||
})
|
||||
-- -- For russian build, add russian-only programs.
|
||||
-- if build_type == "ru_RU" then tup.append_table(img_files, {
|
||||
-- {"DEVELOP/EXAMPLES/TESTCON2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_rus"},
|
||||
-- }) else tup.append_table(img_files, {
|
||||
-- {"DEVELOP/EXAMPLES/TESTCON2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_eng"},
|
||||
-- }) end
|
||||
-- For russian build, add russian-only programs.
|
||||
if build_type == "ru_RU" then tup.append_table(img_files, {
|
||||
{"DEVELOP/EXAMPLES/TESTCON2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_rus"},
|
||||
}) else tup.append_table(img_files, {
|
||||
{"DEVELOP/EXAMPLES/TESTCON2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_eng"},
|
||||
}) end
|
||||
|
||||
if build_type == "ru_RU" then tup.append_table(extra_files, {
|
||||
{"kolibrios/develop/examples/testcon2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_rus"},
|
||||
{"kolibrios/utils/period", VAR_PROGS .. "/other/period/period"},
|
||||
{"kolibrios/games/Dungeons/Dungeons", VAR_PROGS .. "/games/Dungeons/Dungeons"},
|
||||
{"kolibrios/games/klavisha/klavisha", VAR_PROGS .. "/games/klavisha/klavisha"},
|
||||
{"kolibrios/games/klavisha/basekurs.kla", "ru_RU/games/basekurs.kla"},
|
||||
}) else tup.append_table(extra_files, {
|
||||
{"kolibrios/develop/examples/testcon2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_eng"},
|
||||
}) end
|
||||
|
||||
end -- tup.getconfig('NO_FASM') ~= 'full'
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
|
||||
#/SYS/LOADDRV COMMOUSE 1 # serial mouse driver
|
||||
#/SYS/DEVELOP/BOARD "" 0 # Load DEBUG board
|
||||
#/SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012
|
||||
/SYS/SETUP BOOT 0 # Load device settings
|
||||
/SYS/LOADDRV I2CHID 0 # Start I2C touchpad driver
|
||||
/SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012
|
||||
/SYS/@TASKBAR "" 0 # Start taskbar
|
||||
/SYS/ESKIN "" 0 # Set style
|
||||
/SYS/@ICON "" 0 # Multithread desktop icons
|
||||
|
||||
@@ -5,22 +5,6 @@ font smoothing=sbp
|
||||
font height=9
|
||||
speaker mute=off
|
||||
|
||||
[touchpad]
|
||||
speed=100
|
||||
; how far a finger must move before the pointer follows, in pad units;
|
||||
; larger is steadier under a pressing finger, 0 turns the filter off
|
||||
jitter=1
|
||||
; the same, for a finger that landed on the button strip: it is pressing
|
||||
; rather than steering there, so it needs a stricter margin
|
||||
jitter_buttons=45
|
||||
scroll_step=64
|
||||
scroll_invert=0
|
||||
tap_enable=1
|
||||
tap_drag=1
|
||||
right_click=1
|
||||
button_zone=15
|
||||
right_split=50
|
||||
|
||||
[mouse]
|
||||
speed=4
|
||||
acceleration=3
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
06 zSea Image Viewer * |/kolibrios/media/zsea/zsea
|
||||
38 Animage |media/animage
|
||||
38 IconEdit |media/iconedit
|
||||
40 Image Filtering * |/kolibrios/media/ImgF/ImgF
|
||||
40 Image Filtering |media/imgf/imgf
|
||||
52 Palitra |media/palitra
|
||||
39 Pipet |develop/pipet
|
||||
#4 **** MULTIMEDIA
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
16 Image viewer KIV |media/kiv
|
||||
16 Image viewer zSea * |/kolibrios/media/zsea/zsea
|
||||
16 Animage |media/animage
|
||||
16 Efectos de imаgenes * |/kolibrios/media/ImgF/ImgF
|
||||
16 Efectos de imаgenes |media/imgf/imgf
|
||||
16 Palitra |media/palitra
|
||||
#4 **** MULTIMEDIA
|
||||
16 Pixie Audioplayer |media/pixie
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
06 Image viewer zSea * |/kolibrios/media/zsea/zsea
|
||||
38 Animage |media/animage
|
||||
38 IconEdit |media/iconedit
|
||||
16 Image Filtering * |/kolibrios/media/ImgF/ImgF
|
||||
16 Image Filtering |media/imgf/imgf
|
||||
52 Palitra |media/palitra
|
||||
39 Pipet |develop/pipet
|
||||
#4 **** MULTIMEDIA ****
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
06 Image viewer zSea * |/kolibrios/media/zsea/zsea
|
||||
38 Animage |media/animage
|
||||
38 IconEdit |media/iconedit
|
||||
40 Image Filtering * |/kolibrios/media/ImgF/ImgF
|
||||
40 Image Filtering |media/imgf/imgf
|
||||
52 Palitra |media/palitra
|
||||
39 Pipet |develop/pipet
|
||||
#4 **** MULTIMEDIA
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
06 Просмотр фото zSea |/kolibrios/media/zsea/zsea
|
||||
38 Редактор Animage |media/animage
|
||||
38 Редактор иконок |media/iconedit
|
||||
40 Наложение фильтров * |/kolibrios/media/ImgF/ImgF
|
||||
40 Наложение фильтров |media/imgf/imgf
|
||||
52 Палитра |media/palitra
|
||||
39 Пипетка |develop/pipet
|
||||
#4 **** Звук и видео
|
||||
|
||||
@@ -273,8 +273,8 @@ RIRB_INT_RESPONSE equ 0x01
|
||||
RIRB_INT_OVERRUN equ 0x04
|
||||
RIRB_INT_MASK equ 0x05
|
||||
|
||||
; STATESTS int mask: SDIWAKE[14:0], a 16-bit register
|
||||
STATESTS_INT_MASK equ 0x7FFF
|
||||
; STATESTS int mask: SD2,SD1,SD0
|
||||
STATESTS_INT_MASK equ 0x07
|
||||
AZX_MAX_CODECS equ 4
|
||||
|
||||
; SD_CTL bits
|
||||
@@ -402,7 +402,6 @@ struc AC_CNTRL ;AC controller base class
|
||||
.response_reset dd 0
|
||||
.polling_mode db 0
|
||||
.poll_count db 0
|
||||
.no_irq db 0 ; no interrupt line: a thread runs hda_irq
|
||||
.posbuf dd ?
|
||||
.start_wallclk dd ? ; start + minimum wallclk
|
||||
.period_wallclk dd ? ; wallclk for period
|
||||
@@ -506,6 +505,8 @@ macro spin_unlock
|
||||
pop ebx eax
|
||||
}
|
||||
|
||||
data fixups
|
||||
end data
|
||||
|
||||
include '../../struct.inc'
|
||||
include '../../macros.inc'
|
||||
@@ -606,6 +607,9 @@ if IRQ_REMAP
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
|
||||
mov ebx, [ctrl.int_line]
|
||||
invoke AttachIntHandler, ebx, hda_irq, dword 0
|
||||
|
||||
;Asper This part is from "azx_probe" proc. [
|
||||
call azx_codec_create
|
||||
cmp eax, 0
|
||||
@@ -854,13 +858,13 @@ end if
|
||||
|
||||
mov edx, ICH6_REG_SD_STS + SDO_OFS
|
||||
call azx_readb
|
||||
mov cl, al
|
||||
mov bl, al
|
||||
|
||||
mov al, SD_INT_MASK
|
||||
mov edx, ICH6_REG_SD_STS + SDO_OFS
|
||||
call azx_writeb
|
||||
|
||||
test cl, SD_INT_COMPLETE
|
||||
test bl, SD_INT_COMPLETE
|
||||
jz @f
|
||||
|
||||
mov eax, [ctrl.civ_val]
|
||||
@@ -897,13 +901,13 @@ end if
|
||||
;if 0
|
||||
; clear state status int
|
||||
mov edx, ICH6_REG_STATESTS
|
||||
call azx_readw
|
||||
and eax, STATESTS_INT_MASK
|
||||
call azx_readb
|
||||
test al, 0x04
|
||||
jz @f
|
||||
|
||||
; ack all state-change bits, else the level IRQ line stays asserted
|
||||
mov al, 0x04
|
||||
mov edx, ICH6_REG_STATESTS
|
||||
call azx_writew
|
||||
call azx_writeb
|
||||
@@:
|
||||
;end if
|
||||
or eax, 1
|
||||
@@ -911,24 +915,6 @@ end if
|
||||
ret
|
||||
endp
|
||||
|
||||
; Stand-in for the interrupt when no interrupt line is available. A thread,
|
||||
; not a TimerHS callback: the kernel calls timer callbacks with the global
|
||||
; timer list lock held, and hda_irq may stall and refill the audio buffer.
|
||||
; hda_irq runs with interrupts off, as it would in IRQ context: it holds
|
||||
; aspinlock, which azx_rirb_get_response waits for with interrupts off, so
|
||||
; a holder that could be preempted would hang the machine.
|
||||
proc hda_poll_thread
|
||||
.loop:
|
||||
pushfd
|
||||
cli
|
||||
call hda_irq
|
||||
popfd
|
||||
mov eax, 5 ; delay, sleeping instead of spinning
|
||||
mov ebx, 1 ; 10 ms; a 16 KB period is ~85 ms at 48 kHz
|
||||
int 0x40
|
||||
jmp .loop
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc create_primary_buff
|
||||
@@ -1217,26 +1203,6 @@ end if
|
||||
; allocate CORB/RIRB
|
||||
call azx_alloc_cmd_io
|
||||
|
||||
; attach the IRQ handler BEFORE the controller may raise interrupts:
|
||||
; azx_init_chip enables GIE/CIE and a codec state-change can fire
|
||||
; right away; an unclaimed level IRQ makes the
|
||||
; kernel poll foreign handlers and relink their IRQH nodes onto our
|
||||
; line (see irq_serv .try_other_irqs), corrupting the dispatch list
|
||||
; a warm reboot can leave GIE and a stale completion bit behind, and
|
||||
; civ_val is never resynced, so silence the controller before attaching
|
||||
call azx_int_disable
|
||||
mov ebx, [ctrl.int_line]
|
||||
invoke AttachIntHandler, ebx, hda_irq, dword 0
|
||||
test eax, eax
|
||||
jnz @f
|
||||
; No usable interrupt line (INTLINE=0xFF on boards that route INTx only
|
||||
; through ACPI _PRT or MSI, which the kernel does not parse). The
|
||||
; controller still latches INTSTS/SD_STS, we only lose the wakeup - so
|
||||
; poll the RIRB for codec replies and run the interrupt handler from a
|
||||
; thread. A flag of its own: polling_mode is the timeout recovery state.
|
||||
mov [ctrl.no_irq], 1
|
||||
@@:
|
||||
|
||||
; initialize chip
|
||||
call azx_init_pci
|
||||
|
||||
@@ -1244,32 +1210,6 @@ end if
|
||||
call azx_init_chip
|
||||
;] Asper
|
||||
|
||||
; no IRQ line: let a polling thread stand in for the interrupt.
|
||||
; Started only now - earlier, hda_irq could ack STATESTS in the window
|
||||
; before reset_controller reads it into codec_mask
|
||||
cmp [ctrl.no_irq], 0
|
||||
je @f
|
||||
push esi edi ; CreateThread clobbers them, START needs esi
|
||||
mov ebx, 1
|
||||
mov ecx, hda_poll_thread
|
||||
xor edx, edx
|
||||
invoke CreateThread
|
||||
pop edi esi
|
||||
test eax, eax
|
||||
jns .thread_ok
|
||||
; nothing would ever complete a period and playback would stall,
|
||||
; so fail the init rather than register a service that hangs
|
||||
mov esi, msgNoIrqThread
|
||||
invoke SysMsgBoardStr
|
||||
xor eax, eax
|
||||
ret
|
||||
.thread_ok:
|
||||
if DEBUG
|
||||
mov esi, msgNoIrqPoll
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
@@:
|
||||
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
@@ -1303,7 +1243,7 @@ endl
|
||||
; clear STATESTS
|
||||
mov eax, STATESTS_INT_MASK
|
||||
mov edx, ICH6_REG_STATESTS
|
||||
call azx_writew
|
||||
call azx_writeb
|
||||
|
||||
; reset controller
|
||||
mov edx, ICH6_REG_GCTL
|
||||
@@ -1514,12 +1454,6 @@ endp
|
||||
|
||||
proc azx_alloc_cmd_io
|
||||
push eax ecx edx
|
||||
; the unsolicited-event ring lives in reserved storage, so its
|
||||
; pointers hold garbage until we clear them here - do it before
|
||||
; reset_controller enables unsolicited responses in GCTL
|
||||
mov [unsol_events.rp], 0
|
||||
mov [unsol_events.wp], 0
|
||||
|
||||
; single page (at least 4096 bytes) must suffice for both ringbuffers
|
||||
invoke KernelAlloc, 4096
|
||||
mov [ctrl.rb], eax
|
||||
@@ -1720,24 +1654,14 @@ endl
|
||||
mov ecx, 1000;+1000
|
||||
.next_try:
|
||||
mov al, [ctrl.polling_mode]
|
||||
or al, [ctrl.no_irq]
|
||||
test al, al
|
||||
jnz .poll
|
||||
mov ah, [do_poll]
|
||||
test ah, ah
|
||||
jz @f
|
||||
.poll:
|
||||
spin_lock_irq
|
||||
; take the lock hda_irq holds so two RIRB readers never overlap
|
||||
push eax ebx
|
||||
mov eax, aspinlock
|
||||
.poll_lock:
|
||||
mov ebx, SPINLOCK_BUSY
|
||||
lock xchg [eax], ebx
|
||||
cmp ebx, SPINLOCK_FREE
|
||||
jnz .poll_lock
|
||||
pop ebx eax
|
||||
call azx_update_rirb
|
||||
mov [aspinlock], SPINLOCK_FREE
|
||||
spin_unlock_irq
|
||||
@@:
|
||||
mov eax, [ctrl.rirb_cmd]
|
||||
@@ -2018,7 +1942,6 @@ proc azx_int_disable
|
||||
mov ebx, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN
|
||||
xor ebx, -1
|
||||
and eax, ebx
|
||||
mov edx, ICH6_REG_INTCTL ; azx_readl turned edx into the absolute address
|
||||
call azx_writel
|
||||
pop edx ebx eax
|
||||
ret
|
||||
@@ -2034,9 +1957,9 @@ proc azx_int_clear
|
||||
call azx_writeb
|
||||
|
||||
; clear STATESTS
|
||||
mov ax, STATESTS_INT_MASK
|
||||
mov al, STATESTS_INT_MASK
|
||||
mov edx, ICH6_REG_STATESTS
|
||||
call azx_writew
|
||||
call azx_writeb
|
||||
|
||||
; clear rirb status
|
||||
mov al, RIRB_INT_MASK
|
||||
@@ -2773,7 +2696,6 @@ proc snd_hda_queue_unsol_event stdcall, res:dword, res_ex:dword
|
||||
; only carries EBX across iterations and reloads the rest, and TimerHS
|
||||
; preserves EBX too - so by using scratch regs only we need no saves.
|
||||
mov eax, [unsol_events.wp]
|
||||
and eax, HDA_UNSOL_QUEUE_SIZE - 1 ; never index the ring wild
|
||||
lea edx, [eax+1]
|
||||
and edx, HDA_UNSOL_QUEUE_SIZE - 1 ; next write pos (size must be 2^n)
|
||||
cmp edx, [unsol_events.rp]
|
||||
@@ -3076,7 +2998,6 @@ sz_sound_srv db 'SOUND',0
|
||||
|
||||
msgInit db 'detect hardware...',13,10,0
|
||||
msgFail db 'device not found',13,10,0
|
||||
msgNoIrqThread db 'no IRQ line: cannot create polling thread',13,10,0
|
||||
msgAttchIRQ db 'IRQ line not supported', 13,10,0
|
||||
msgInvIRQ db 'IRQ line not assigned or invalid', 13,10,0
|
||||
msgPlay db 'start play', 13,10,0
|
||||
@@ -3146,7 +3067,6 @@ if DEBUG
|
||||
msgTCSEL db 'PCI TCSEL ',0
|
||||
msgTV db 'HDA test version ',TEST_VERSION_NUMBER,13,10,0
|
||||
msgGCap db 'GCAP = ',0
|
||||
msgNoIrqPoll db 'no IRQ line: polling thread',13,10,0
|
||||
end if
|
||||
|
||||
if USE_SINGLE_MODE
|
||||
@@ -3181,11 +3101,6 @@ end if
|
||||
|
||||
;] Asper
|
||||
|
||||
; relocation table lives after all code and initialized data: placed before the
|
||||
; code its size feeds back into every relocation site and fasm may never converge
|
||||
data fixups
|
||||
end data
|
||||
|
||||
aspinlock dd SPINLOCK_FREE
|
||||
|
||||
codec CODEC
|
||||
|
||||
+14
-100
@@ -130,8 +130,6 @@ RU_STATUS_IDLE = 0000b shl 2
|
||||
RU_STATUS_SUSPENDED = 0001b shl 2
|
||||
RU_STATUS_NO_RESOURCES = 0010b shl 2
|
||||
RU_STATUS_READY = 0100b shl 2
|
||||
SCB_STATUS_CUS = 11000000b ; CU Status
|
||||
CU_STATUS_ACTIVE = 10b shl 6
|
||||
SCB_STATUS_FCP = 1 shl 8 ; Flow Control Pause
|
||||
SCB_STATUS_SWI = 1 shl 10 ; Software Interrupt
|
||||
SCB_STATUS_MDI = 1 shl 11 ; MDI read/write complete
|
||||
@@ -185,8 +183,6 @@ struct txfd
|
||||
|
||||
ends
|
||||
|
||||
TXFD_STATUS_C = 1 shl 15
|
||||
|
||||
TXFD_CMD_IA = 1 shl 0
|
||||
TXFD_CMD_CFG = 1 shl 1
|
||||
TXFD_CMD_TX = 1 shl 2
|
||||
@@ -632,9 +628,6 @@ reset:
|
||||
mov ax, CU_START or INT_MASK
|
||||
out dx, ax
|
||||
call cmd_wait
|
||||
; cmd_wait only means the SCB accepted the command. The Configure below
|
||||
; reuses confcmd, so a slow chip would read it instead of our MAC.
|
||||
call confcmd_wait
|
||||
|
||||
;-------------
|
||||
; Configure CU
|
||||
@@ -659,7 +652,6 @@ reset:
|
||||
mov ax, CU_START ; expect Interrupts from now on
|
||||
out dx, ax
|
||||
call cmd_wait
|
||||
call confcmd_wait
|
||||
|
||||
; Start media check timer
|
||||
mov [ebx + device.state], ETH_LINK_DOWN
|
||||
@@ -686,11 +678,6 @@ init_rx_ring:
|
||||
;---------------------
|
||||
; build rxfd structure
|
||||
|
||||
cmp [ebx + device.rx_desc], 0 ; the RFD of an earlier reset
|
||||
je @f
|
||||
invoke NetFree, [ebx + device.rx_desc]
|
||||
mov [ebx + device.rx_desc], 0
|
||||
@@:
|
||||
invoke NetAlloc, 2000
|
||||
test eax, eax
|
||||
jz .out_of_mem
|
||||
@@ -702,7 +689,6 @@ init_rx_ring:
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.command], RXFD_CMD_EL or RXFD_CMD_SUSPEND
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.link], eax
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.count], 0
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.rx_buf_addr], 0xffffffff ; simplified mode, no RBD
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.size], 1528
|
||||
|
||||
ret
|
||||
@@ -723,15 +709,6 @@ init_tx_ring:
|
||||
invoke GetPhysAddr
|
||||
mov ecx, TX_RING_SIZE
|
||||
.next_desc:
|
||||
; after a reset with frames still unreclaimed: free them, or transmit sees the
|
||||
; descriptor busy (virt_addr) and reports TX overrun forever
|
||||
cmp [esi + txfd.virt_addr], 0
|
||||
je @f
|
||||
push eax ecx
|
||||
invoke NetFree, [esi + txfd.virt_addr]
|
||||
pop ecx eax
|
||||
mov [esi + txfd.virt_addr], 0
|
||||
@@:
|
||||
mov [esi + txfd.status], 0
|
||||
mov [esi + txfd.command], 0
|
||||
lea edx, [eax + txfd.buf_addr]
|
||||
@@ -786,7 +763,7 @@ proc transmit stdcall bufferptr
|
||||
lea edi, [ebx + device.tx_ring + eax]
|
||||
|
||||
; Check if current descriptor is free or still in use
|
||||
cmp [edi + txfd.virt_addr], 0 ; buffer not reclaimed yet
|
||||
cmp [edi + txfd.status], 0
|
||||
jne .overrun
|
||||
|
||||
; Fill in status and command values
|
||||
@@ -809,22 +786,6 @@ proc transmit stdcall bufferptr
|
||||
mov eax, edi
|
||||
invoke GetPhysAddr
|
||||
set_io [ebx + device.io_addr], 0
|
||||
|
||||
; CU_START is only valid while the CU is idle or suspended:
|
||||
; wait for the previous frame to leave (1.2 ms at 10 Mbit)
|
||||
push eax ecx
|
||||
set_io [ebx + device.io_addr], REG_SCB_STATUS
|
||||
mov ecx, 100000
|
||||
.cu_busy:
|
||||
in al, dx
|
||||
and al, SCB_STATUS_CUS
|
||||
cmp al, CU_STATUS_ACTIVE
|
||||
jne .cu_free
|
||||
dec ecx
|
||||
jnz .cu_busy
|
||||
DEBUGF 2, "CU still active, starting anyway\n"
|
||||
.cu_free:
|
||||
pop ecx eax
|
||||
set_io [ebx + device.io_addr], REG_SCB_PTR
|
||||
out dx, eax
|
||||
|
||||
@@ -893,7 +854,7 @@ int_handler:
|
||||
|
||||
DEBUGF 1,"Status: %x\n", ax
|
||||
|
||||
test ax, SCB_STATUS_FR or SCB_STATUS_RNR ; frame received or receiver stopped?
|
||||
test ax, SCB_STATUS_FR ; did we receive a frame?
|
||||
jz .no_rx
|
||||
|
||||
push ax
|
||||
@@ -940,7 +901,6 @@ int_handler:
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.command], RXFD_CMD_EL or RXFD_CMD_SUSPEND
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.link], eax
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.count], 0
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.rx_buf_addr], 0xffffffff ; simplified mode, no RBD
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.size], 1528
|
||||
|
||||
; restart RX
|
||||
@@ -956,22 +916,11 @@ int_handler:
|
||||
mov ax, RX_START
|
||||
out dx, ax
|
||||
call cmd_wait
|
||||
.out_of_mem:
|
||||
|
||||
; Hand the frame over to the kernel
|
||||
jmp [EthInput]
|
||||
|
||||
.out_of_mem:
|
||||
; The buffer is still our only RFD: drop the frame and reuse it
|
||||
mov esi, [esp] ; the buffer
|
||||
mov ecx, [esi + NET_BUFF.length]
|
||||
dec [ebx + device.packets_rx] ; counted above, before the allocation
|
||||
sub dword [ebx + device.bytes_rx], ecx
|
||||
sbb dword [ebx + device.bytes_rx + 4], 0
|
||||
inc [ebx + device.packets_rx_drop]
|
||||
add esp, 12 ; buffer, .rx_loop, ebx
|
||||
mov esi, [ebx + device.rx_desc]
|
||||
jmp .not_ok
|
||||
|
||||
.not_ok:
|
||||
; Reset the FD
|
||||
mov [esi + sizeof.NET_BUFF + rxfd.status], 0
|
||||
@@ -996,27 +945,6 @@ int_handler:
|
||||
|
||||
.no_rx_:
|
||||
DEBUGF 1, "no more data\n"
|
||||
|
||||
; With a single RFD the receiver sits in No Resources/Suspended whenever a
|
||||
; frame arrived before we re-armed it. Nothing restarts it but us.
|
||||
set_io [ebx + device.io_addr], 0
|
||||
set_io [ebx + device.io_addr], REG_SCB_STATUS
|
||||
in al, dx
|
||||
and al, SCB_STATUS_RUS
|
||||
cmp al, RU_STATUS_READY
|
||||
je .ru_ready
|
||||
test byte[esp], 1 ; bit 0 of the saved status is reserved,
|
||||
jnz .ru_ready ; we mark it: one restart per IRQ
|
||||
or byte[esp], 1
|
||||
movzx eax, al
|
||||
DEBUGF 1, "Restarting receiver, RU status %x\n", eax:2
|
||||
mov esi, [ebx + device.rx_desc]
|
||||
push ebx
|
||||
test [esi + sizeof.NET_BUFF + rxfd.status], RXFD_STATUS_C
|
||||
jnz .rx_loop ; a frame completed meanwhile
|
||||
add esp, 4
|
||||
jmp .not_ok ; re-arm the empty RFD
|
||||
.ru_ready:
|
||||
pop ax
|
||||
|
||||
.no_rx:
|
||||
@@ -1027,13 +955,13 @@ int_handler:
|
||||
|
||||
push eax
|
||||
.loop_tx:
|
||||
mov eax, [ebx + device.last_tx]
|
||||
mov edx, sizeof.txfd
|
||||
mul edx
|
||||
mov edi, [ebx + device.last_tx]
|
||||
mov eax, sizeof.txfd
|
||||
mul eax
|
||||
lea edi, [ebx + device.tx_ring + eax]
|
||||
|
||||
test [edi + txfd.status], TXFD_STATUS_C ; sent by the device?
|
||||
jz .tx_done
|
||||
cmp [edi + txfd.status], 0
|
||||
je .tx_done
|
||||
|
||||
cmp [edi + txfd.virt_addr], 0
|
||||
je .tx_done
|
||||
@@ -1042,7 +970,6 @@ int_handler:
|
||||
|
||||
push [edi + txfd.virt_addr]
|
||||
mov [edi + txfd.virt_addr], 0
|
||||
mov [edi + txfd.status], 0 ; free for transmit again
|
||||
invoke NetFree
|
||||
|
||||
inc [ebx + device.last_tx]
|
||||
@@ -1053,6 +980,12 @@ int_handler:
|
||||
pop eax
|
||||
.no_tx:
|
||||
|
||||
test ax, RU_STATUS_NO_RESOURCES
|
||||
jz .not_out_of_resources
|
||||
|
||||
DEBUGF 2, "Out of resources!\n"
|
||||
|
||||
.not_out_of_resources:
|
||||
pop edi esi ebx
|
||||
xor eax, eax
|
||||
inc eax
|
||||
@@ -1146,25 +1079,6 @@ proc check_media_mii stdcall dev:dword
|
||||
endp
|
||||
|
||||
|
||||
; Wait (up to 1 s) until the device has executed the command in confcmd.
|
||||
align 4
|
||||
confcmd_wait:
|
||||
mov ecx, 1000 ; udelay = Sleep(1), 1 ms
|
||||
.loop:
|
||||
test [ebx + device.confcmd.status], TXFD_STATUS_C
|
||||
jnz .done
|
||||
call udelay
|
||||
dec ecx
|
||||
jnz .loop
|
||||
movzx eax, [ebx + device.confcmd.command]
|
||||
DEBUGF 2, "Command 0x%x not completed\n", eax:4
|
||||
ret
|
||||
.done:
|
||||
movzx eax, [ebx + device.confcmd.command]
|
||||
movzx ecx, [ebx + device.confcmd.status]
|
||||
DEBUGF 1, "Command 0x%x done, status 0x%x\n", eax:4, ecx:4
|
||||
ret
|
||||
|
||||
align 4
|
||||
cmd_wait:
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
ROOT = "../.."
|
||||
tup.rule("i2chid.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
|
||||
@@ -1,438 +0,0 @@
|
||||
; Synopsys DesignWare I2C master, polled (PIO) mode only.
|
||||
; This is the controller inside Intel LPSS blocks (Skylake and newer, plus
|
||||
; Atom-derived SoCs); the same IP is used by many other vendors.
|
||||
;
|
||||
; The register file is always accessed as dwords. The controller must be
|
||||
; disabled to change IC_TAR, so every transfer disables it, programs the
|
||||
; target address, enables it back and feeds the TX FIFO by hand.
|
||||
|
||||
; ------------------------------ Registers ------------------------------------
|
||||
DwIcCon = 0x00
|
||||
DwIcTar = 0x04
|
||||
DwIcDataCmd = 0x10
|
||||
DwIcSsSclHcnt = 0x14
|
||||
DwIcSsSclLcnt = 0x18
|
||||
DwIcFsSclHcnt = 0x1C
|
||||
DwIcFsSclLcnt = 0x20
|
||||
DwIcIntrStat = 0x2C
|
||||
DwIcIntrMask = 0x30
|
||||
DwIcRawIntrStat = 0x34
|
||||
DwIcRxTl = 0x38
|
||||
DwIcTxTl = 0x3C
|
||||
DwIcClrIntr = 0x40
|
||||
DwIcClrTxAbrt = 0x54
|
||||
DwIcEnable = 0x6C
|
||||
DwIcStatus = 0x70
|
||||
DwIcTxflr = 0x74
|
||||
DwIcRxflr = 0x78
|
||||
DwIcSdaHold = 0x7C
|
||||
DwIcTxAbrtSource = 0x80
|
||||
DwIcEnableStatus = 0x9C
|
||||
DwIcCompParam1 = 0xF4
|
||||
DwIcCompVersion = 0xF8
|
||||
DwIcCompType = 0xFC
|
||||
|
||||
; "DW_apb_i2c" component signature ('DW' + 0x0140).
|
||||
DW_COMP_TYPE_VALUE = 0x44570140
|
||||
|
||||
; IC_CON: master, standard speed (100 kHz), restarts allowed, slave disabled.
|
||||
DW_CON_MASTER = 1 shl 0
|
||||
DW_CON_SPEED_STD = 1 shl 1
|
||||
DW_CON_SPEED_FAST = 2 shl 1
|
||||
DW_CON_RESTART_EN = 1 shl 5
|
||||
DW_CON_SLAVE_DIS = 1 shl 6
|
||||
|
||||
; IC_DATA_CMD bits above the data byte.
|
||||
DW_CMD_READ = 1 shl 8
|
||||
DW_CMD_STOP = 1 shl 9
|
||||
DW_CMD_RESTART = 1 shl 10
|
||||
|
||||
; IC_STATUS bits
|
||||
DW_STAT_TFNF = 1 shl 1 ; TX FIFO not full
|
||||
DW_STAT_TFE = 1 shl 2 ; TX FIFO empty
|
||||
DW_STAT_RFNE = 1 shl 3 ; RX FIFO not empty
|
||||
DW_STAT_MST_ACT = 1 shl 5 ; master FSM busy
|
||||
|
||||
; IC_RAW_INTR_STAT bits
|
||||
DW_INT_TX_ABRT = 1 shl 6
|
||||
|
||||
; SCL timing for standard mode. The LPSS input clock is 100 MHz on the PCH
|
||||
; parts and 133 MHz on the Atom-derived SoCs (Apollo Lake, Gemini Lake), and
|
||||
; nothing in PCI config space says which one this is, so the counts are
|
||||
; picked to satisfy the fast-mode minimums at the fastest of them: at
|
||||
; 133 MHz that is tHIGH = 0.98 us and tLOW = 1.5 us, 400 kHz. On a 100 MHz
|
||||
; part the same counts run the bus at 300 kHz, which is just as legal.
|
||||
; Fast mode rather than standard: HID over I2C requires every device to
|
||||
; support it, that is what Windows drives them at, and a polled host pays
|
||||
; for every byte with busy-waiting - at 100 kHz a 64-byte input read costs
|
||||
; 6 ms, more than a fast pad takes to produce the next report, and the
|
||||
; backlog that builds up plays back as the cursor coasting after the finger
|
||||
; has stopped. SDA hold stays well below tLOW.
|
||||
DW_FS_HCNT = 130
|
||||
DW_FS_LCNT = 200
|
||||
DW_SDA_HOLD = 28
|
||||
; The AMD FCH feeds its DesignWare masters from a 150 MHz reference, so
|
||||
; the same minimums need more counts there: 145/225 give tHIGH = 0.97 us,
|
||||
; tLOW = 1.5 us, again 400 kHz; SDA hold 45 = 300 ns.
|
||||
DW_AMD_FS_HCNT = 145
|
||||
DW_AMD_FS_LCNT = 225
|
||||
DW_AMD_SDA_HOLD = 45
|
||||
|
||||
; A transfer gives up after [XferTimeout] hundredths of a second. The init
|
||||
; value must cover a full report descriptor read: descriptors run up to 2 KB
|
||||
; and the bus may be as slow as 77 kHz, so at 9 SCL cycles per byte a single
|
||||
; transfer takes ~240 ms of wall-clock time. Polling is generous too now that it runs in its own thread
|
||||
; rather than in a timer callback - a wedged bus costs this thread its slice
|
||||
; and nothing else.
|
||||
DW_TIMEOUT_INIT = 60
|
||||
DW_TIMEOUT_POLL = 20
|
||||
|
||||
; Disables the controller and waits until it reports itself disabled.
|
||||
; in: ebx = MMIO base. Clobbers eax, ecx.
|
||||
proc dw_ctrl_disable
|
||||
mov dword [ebx+DwIcEnable], 0
|
||||
mov ecx, 100000
|
||||
@@:
|
||||
test dword [ebx+DwIcEnableStatus], 1
|
||||
jz .done
|
||||
pause
|
||||
loop @b
|
||||
.done:
|
||||
ret
|
||||
endp
|
||||
|
||||
; Aborts a stuck transfer cleanly: the ABORT bit makes the master issue STOP,
|
||||
; flush the TX FIFO and raise TX_ABRT, which releases a slave that is holding
|
||||
; the bus (a clock-stretching touchpad, for instance). Simply disabling the
|
||||
; controller in the middle of a byte would leave SDA held low and every
|
||||
; following transfer would time out too. Older cores without the ABORT bit
|
||||
; just ignore the write and fall through after the wait.
|
||||
; in: ebx = MMIO base. Clobbers eax, ecx.
|
||||
proc dw_ctrl_abort
|
||||
mov dword [ebx+DwIcEnable], 3
|
||||
mov ecx, 100000
|
||||
@@:
|
||||
test dword [ebx+DwIcRawIntrStat], DW_INT_TX_ABRT
|
||||
jnz @f
|
||||
pause
|
||||
loop @b
|
||||
@@:
|
||||
mov eax, [ebx+DwIcClrTxAbrt]
|
||||
call dw_ctrl_disable
|
||||
ret
|
||||
endp
|
||||
|
||||
; One idle step of a transfer wait loop.
|
||||
; A healthy transfer is over within a few milliseconds, well inside the
|
||||
; first two timer ticks, and spins through them: a transfer that yields
|
||||
; its slice is at the scheduler's mercy for the rest of it. Past that the
|
||||
; bus is stuck or crawling, and the wait gives up the CPU a tick at a time
|
||||
; instead of burning a core until XferTimeout.
|
||||
; in: eax = ticks elapsed since the transfer began. Preserves all but eax.
|
||||
DW_SPIN_TICKS = 2
|
||||
|
||||
proc dw_wait_step
|
||||
cmp eax, DW_SPIN_TICKS
|
||||
jae .yield
|
||||
pause
|
||||
ret
|
||||
.yield:
|
||||
push ebx
|
||||
movi ebx, 1
|
||||
invoke Delay ; preserves every register
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; One-time controller setup after mapping.
|
||||
; in: ebx = MMIO base.
|
||||
proc dw_ctrl_init
|
||||
push eax ecx
|
||||
call dw_ctrl_disable
|
||||
mov dword [ebx+DwIcCon], DW_CON_MASTER + DW_CON_SPEED_FAST + \
|
||||
DW_CON_RESTART_EN + DW_CON_SLAVE_DIS
|
||||
; The counts come from variables: they depend on the reference clock, which
|
||||
; is decided by whoever found the controller (PCI LPSS or AMD FCH). The
|
||||
; standard-mode registers get the same values scaled up so that they are
|
||||
; sane should anything ever switch the speed bits back.
|
||||
mov eax, [DwHcnt]
|
||||
mov [ebx+DwIcFsSclHcnt], eax
|
||||
lea eax, [eax*4]
|
||||
mov [ebx+DwIcSsSclHcnt], eax
|
||||
mov eax, [DwLcnt]
|
||||
mov [ebx+DwIcFsSclLcnt], eax
|
||||
lea eax, [eax*4]
|
||||
mov [ebx+DwIcSsSclLcnt], eax
|
||||
mov eax, [DwSdaHold]
|
||||
mov [ebx+DwIcSdaHold], eax
|
||||
mov dword [ebx+DwIcIntrMask], 0
|
||||
mov dword [ebx+DwIcRxTl], 0
|
||||
mov dword [ebx+DwIcTxTl], 0
|
||||
mov eax, [ebx+DwIcClrIntr]
|
||||
pop ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; One combined I2C transaction: optional write phase, then optional read phase
|
||||
; with a repeated START between them. Fully polled.
|
||||
; out: eax = 0 on success, IC_TX_ABRT_SOURCE value on NAK/abort, -1 on timeout.
|
||||
proc dw_xfer stdcall uses ebx esi edi, addr:dword, wbuf:dword, wlen:dword, \
|
||||
rbuf:dword, rlen:dword
|
||||
locals
|
||||
wsent dd ?
|
||||
rqueued dd ?
|
||||
rgot dd ?
|
||||
t0 dd ?
|
||||
endl
|
||||
mov ebx, [I2cMmio]
|
||||
call dw_ctrl_disable
|
||||
mov eax, [addr]
|
||||
mov [ebx+DwIcTar], eax
|
||||
mov eax, [ebx+DwIcClrIntr]
|
||||
mov dword [ebx+DwIcEnable], 1
|
||||
xor eax, eax
|
||||
mov [wsent], eax
|
||||
mov [rqueued], eax
|
||||
mov [rgot], eax
|
||||
invoke GetTimerTicks
|
||||
mov [t0], eax
|
||||
.loop:
|
||||
; Abort (NAK and friends) ends the transfer immediately.
|
||||
test dword [ebx+DwIcRawIntrStat], DW_INT_TX_ABRT
|
||||
jnz .abort
|
||||
; Drain the RX FIFO first so it can never overflow.
|
||||
test dword [ebx+DwIcStatus], DW_STAT_RFNE
|
||||
jz .no_rx
|
||||
mov edx, [rgot]
|
||||
cmp edx, [rlen]
|
||||
jae .no_rx
|
||||
mov eax, [ebx+DwIcDataCmd]
|
||||
mov edi, [rbuf]
|
||||
mov [edi+edx], al
|
||||
inc edx
|
||||
mov [rgot], edx
|
||||
jmp .loop
|
||||
.no_rx:
|
||||
; Feed the write phase.
|
||||
mov eax, [wsent]
|
||||
cmp eax, [wlen]
|
||||
jae .push_reads
|
||||
test dword [ebx+DwIcStatus], DW_STAT_TFNF
|
||||
jz .check_done
|
||||
mov esi, [wbuf]
|
||||
movzx edx, byte [esi+eax]
|
||||
inc eax
|
||||
cmp eax, [wlen]
|
||||
jne @f
|
||||
cmp [rlen], 0
|
||||
jne @f
|
||||
or edx, DW_CMD_STOP ; last byte of a write-only transfer
|
||||
@@:
|
||||
mov [ebx+DwIcDataCmd], edx
|
||||
mov [wsent], eax
|
||||
jmp .loop
|
||||
.push_reads:
|
||||
; Feed read commands, at most 8 outstanding so the RX FIFO keeps up.
|
||||
mov eax, [rqueued]
|
||||
cmp eax, [rlen]
|
||||
jae .check_done
|
||||
mov edx, eax
|
||||
sub edx, [rgot]
|
||||
cmp edx, 8
|
||||
jae .check_done
|
||||
test dword [ebx+DwIcStatus], DW_STAT_TFNF
|
||||
jz .check_done
|
||||
mov edx, DW_CMD_READ
|
||||
test eax, eax
|
||||
jnz @f
|
||||
cmp [wlen], 0
|
||||
je @f
|
||||
or edx, DW_CMD_RESTART ; repeated START after the write phase
|
||||
@@:
|
||||
mov ecx, [rlen]
|
||||
dec ecx
|
||||
cmp eax, ecx
|
||||
jne @f
|
||||
or edx, DW_CMD_STOP
|
||||
@@:
|
||||
mov [ebx+DwIcDataCmd], edx
|
||||
inc eax
|
||||
mov [rqueued], eax
|
||||
jmp .loop
|
||||
.check_done:
|
||||
mov eax, [rgot]
|
||||
cmp eax, [rlen]
|
||||
jne .not_done
|
||||
mov eax, [wsent]
|
||||
cmp eax, [wlen]
|
||||
jne .not_done
|
||||
mov eax, [ebx+DwIcStatus]
|
||||
test eax, DW_STAT_TFE
|
||||
jz .not_done
|
||||
test eax, DW_STAT_MST_ACT
|
||||
jnz .not_done
|
||||
call dw_ctrl_disable
|
||||
xor eax, eax
|
||||
ret
|
||||
.not_done:
|
||||
invoke GetTimerTicks
|
||||
sub eax, [t0]
|
||||
cmp eax, [XferTimeout]
|
||||
jae .timeout
|
||||
call dw_wait_step
|
||||
jmp .loop
|
||||
.abort:
|
||||
mov esi, [ebx+DwIcTxAbrtSource]
|
||||
mov eax, [ebx+DwIcClrTxAbrt]
|
||||
call dw_ctrl_disable
|
||||
mov eax, esi
|
||||
test eax, eax
|
||||
jnz @f
|
||||
or eax, 0x80000000
|
||||
@@:
|
||||
ret
|
||||
.timeout:
|
||||
call dw_ctrl_abort
|
||||
or eax, -1
|
||||
ret
|
||||
endp
|
||||
|
||||
; Reads one HID input report as a single continuous bus transaction, the way
|
||||
; interrupt-driven hosts (Windows, Linux) do it: the optional register-address
|
||||
; write and every read command are queued into the TX FIFO before the bytes
|
||||
; start flowing, so nothing on the wire depends on how fast the host loop
|
||||
; runs. The previous adaptive read (fetch 2 length bytes, decide, fetch the
|
||||
; rest, stop short) was cut down on the wire to 3 bytes for an empty poll -
|
||||
; and the SIPODEV/Hantick touchpad firmwares are exactly the kind of thing
|
||||
; that wedges when an input read is shorter than the frame they prepared.
|
||||
; rlen should not exceed the TX FIFO depth (IC_COMP_PARAM_1 bits 23:16, plus
|
||||
; one) or the queue loop degrades to feeding the FIFO on the fly, which
|
||||
; reintroduces pauses.
|
||||
; in: addr = slave, wlen bytes at wbuf written first (0 = plain read),
|
||||
; rlen bytes read into buf.
|
||||
; out: eax = 0 ok, IC_TX_ABRT_SOURCE on NAK/abort, -1 on timeout.
|
||||
; Timeout check for the dw_read_block wait spots; expands inside the proc so
|
||||
; [t0] and [XferTimeout] resolve in the caller's own frame.
|
||||
macro BLOCK_TICK fail_label {
|
||||
invoke GetTimerTicks
|
||||
sub eax, [t0]
|
||||
cmp eax, [XferTimeout]
|
||||
jae fail_label
|
||||
call dw_wait_step
|
||||
}
|
||||
|
||||
proc dw_read_block stdcall uses ebx esi edi, addr:dword, wbuf:dword, wlen:dword, buf:dword, rlen:dword
|
||||
locals
|
||||
rgot dd ?
|
||||
t0 dd ?
|
||||
endl
|
||||
mov ebx, [I2cMmio]
|
||||
call dw_ctrl_disable
|
||||
mov eax, [addr]
|
||||
mov [ebx+DwIcTar], eax
|
||||
mov eax, [ebx+DwIcClrIntr]
|
||||
mov dword [ebx+DwIcEnable], 1
|
||||
invoke GetTimerTicks
|
||||
mov [t0], eax
|
||||
mov [rgot], 0
|
||||
; Write phase: the register address bytes, no STOP - the read continues the
|
||||
; same transaction after a repeated START.
|
||||
xor ecx, ecx
|
||||
.wr:
|
||||
cmp ecx, [wlen]
|
||||
jae .queue_reads
|
||||
test dword [ebx+DwIcRawIntrStat], DW_INT_TX_ABRT
|
||||
jnz .abort
|
||||
test dword [ebx+DwIcStatus], DW_STAT_TFNF
|
||||
jz .wr_wait
|
||||
mov esi, [wbuf]
|
||||
movzx edx, byte [esi+ecx]
|
||||
mov [ebx+DwIcDataCmd], edx
|
||||
inc ecx
|
||||
jmp .wr
|
||||
.wr_wait:
|
||||
BLOCK_TICK .timeout
|
||||
jmp .wr
|
||||
.queue_reads:
|
||||
xor ecx, ecx
|
||||
.rq:
|
||||
cmp ecx, [rlen]
|
||||
jae .drain
|
||||
test dword [ebx+DwIcRawIntrStat], DW_INT_TX_ABRT
|
||||
jnz .abort
|
||||
test dword [ebx+DwIcStatus], DW_STAT_TFNF
|
||||
jz .rq_wait
|
||||
mov edx, DW_CMD_READ
|
||||
test ecx, ecx
|
||||
jnz .not_first
|
||||
cmp [wlen], 0
|
||||
je .not_first
|
||||
or edx, DW_CMD_RESTART
|
||||
.not_first:
|
||||
mov eax, [rlen]
|
||||
dec eax
|
||||
cmp ecx, eax
|
||||
jne @f
|
||||
or edx, DW_CMD_STOP
|
||||
@@:
|
||||
mov [ebx+DwIcDataCmd], edx
|
||||
inc ecx
|
||||
; Drain opportunistically so a FIFO shallower than rlen cannot deadlock the
|
||||
; queue loop (the RX side fills while the TX side is full).
|
||||
test dword [ebx+DwIcStatus], DW_STAT_RFNE
|
||||
jz .rq
|
||||
call .take_byte
|
||||
jmp .rq
|
||||
.rq_wait:
|
||||
BLOCK_TICK .timeout
|
||||
jmp .rq
|
||||
.drain:
|
||||
test dword [ebx+DwIcRawIntrStat], DW_INT_TX_ABRT
|
||||
jnz .abort
|
||||
test dword [ebx+DwIcStatus], DW_STAT_RFNE
|
||||
jz .chk
|
||||
call .take_byte
|
||||
jmp .drain
|
||||
; Moves one byte from the RX FIFO into the caller's buffer. Exactly rlen
|
||||
; reads are queued into freshly flushed FIFOs, so a byte beyond rlen should
|
||||
; never arrive; if one does anyway it is still taken off the FIFO, so the
|
||||
; drain loop cannot stall on it, but it is dropped rather than written
|
||||
; past the end of the buffer.
|
||||
.take_byte:
|
||||
mov edx, [rgot]
|
||||
mov eax, [ebx+DwIcDataCmd]
|
||||
cmp edx, [rlen]
|
||||
jae @f
|
||||
mov edi, [buf]
|
||||
mov [edi+edx], al
|
||||
inc edx
|
||||
mov [rgot], edx
|
||||
@@:
|
||||
retn
|
||||
.chk:
|
||||
mov eax, [rgot]
|
||||
cmp eax, [rlen]
|
||||
jne .wait
|
||||
test dword [ebx+DwIcStatus], DW_STAT_MST_ACT
|
||||
jnz .wait
|
||||
call dw_ctrl_disable
|
||||
xor eax, eax
|
||||
ret
|
||||
.wait:
|
||||
BLOCK_TICK .timeout
|
||||
jmp .drain
|
||||
.abort:
|
||||
mov esi, [ebx+DwIcTxAbrtSource]
|
||||
mov eax, [ebx+DwIcClrTxAbrt]
|
||||
call dw_ctrl_disable
|
||||
mov eax, esi
|
||||
test eax, eax
|
||||
jnz @f
|
||||
or eax, 0x80000000
|
||||
@@:
|
||||
ret
|
||||
.timeout:
|
||||
call dw_ctrl_abort
|
||||
or eax, -1
|
||||
ret
|
||||
endp
|
||||
@@ -1,646 +0,0 @@
|
||||
; Minimal HID report descriptor parser.
|
||||
;
|
||||
; The goal is not a full HID implementation: the parser walks the descriptor
|
||||
; once and remembers the bit layout of the first input report that contains
|
||||
; relative X and relative Y (Generic Desktop / X, Y) - i.e. the mouse
|
||||
; compatibility collection that every I2C mouse and every Windows Precision
|
||||
; Touchpad exposes. Buttons (Usage Page 9) and a relative wheel found in the
|
||||
; same report are picked up too. Absolute (digitizer) reports are advanced
|
||||
; over but otherwise ignored.
|
||||
;
|
||||
; Report IDs are honoured: bit positions are counted separately per report ID
|
||||
; and the chosen ID is checked in every incoming packet.
|
||||
;
|
||||
; Alongside the mouse report, the parser also maps the touchpad (Windows
|
||||
; Precision Touchpad) report: the report that carries Tip Switch usages.
|
||||
; Each Tip Switch opens a new finger block; the absolute X and Y that follow
|
||||
; it belong to that finger; Contact Count and the Button-page fields of the
|
||||
; same report are recorded too. Once the pad is switched into touchpad mode
|
||||
; those offsets are what the frame decoder reads - every vendor lays the
|
||||
; frame out differently, and only the descriptor knows how.
|
||||
HID_MAX_FINGERS = 5
|
||||
|
||||
HID_MAX_USAGES = 16
|
||||
HID_MAX_REPIDS = 16
|
||||
|
||||
; Returns the pointer to the input bit counter of the current report ID,
|
||||
; allocating a new slot on first use.
|
||||
; out: ebx -> dword bit counter. Clobbers eax, ecx.
|
||||
proc hid_get_bits_slot
|
||||
mov eax, [p_report_id]
|
||||
xor ecx, ecx
|
||||
.scan:
|
||||
cmp ecx, [p_idcnt]
|
||||
jae .add
|
||||
cmp eax, [p_ids+ecx*4]
|
||||
jz .found
|
||||
inc ecx
|
||||
jmp .scan
|
||||
.add:
|
||||
cmp ecx, HID_MAX_REPIDS
|
||||
jb @f
|
||||
dec ecx ; table full: reuse the last slot
|
||||
jmp .found
|
||||
@@:
|
||||
mov [p_ids+ecx*4], eax
|
||||
mov dword [p_bits+ecx*4], 0
|
||||
mov dword [p_fbits+ecx*4], 0
|
||||
inc [p_idcnt]
|
||||
.found:
|
||||
lea ebx, [p_bits+ecx*4]
|
||||
ret
|
||||
endp
|
||||
|
||||
; Handles one Input main item. v_flags = item data (bit 2 = relative).
|
||||
proc hid_process_input
|
||||
push eax ebx ecx edx
|
||||
call hid_get_bits_slot
|
||||
mov eax, [ebx]
|
||||
mov [v_base], eax
|
||||
; Advance the counter over this field right away.
|
||||
mov eax, [p_report_size]
|
||||
imul eax, [p_report_count]
|
||||
add [ebx], eax
|
||||
; Remember the largest logical maximum ever attached to Generic Desktop X
|
||||
; and Y. The mouse collection declares a tiny relative range there while
|
||||
; the touchpad collection declares the real surface extents, so the
|
||||
; maximum over the whole descriptor is the size of the pad - which is what
|
||||
; the button zones are measured against, and it differs per model.
|
||||
cmp [p_usage_cnt], 0
|
||||
je .no_extent
|
||||
xor ecx, ecx
|
||||
.ext_loop:
|
||||
cmp ecx, [p_usage_cnt]
|
||||
jae .no_extent
|
||||
mov eax, [p_usages+ecx*4]
|
||||
cmp eax, 0x00010030
|
||||
jne .ext_y
|
||||
mov eax, [p_log_max]
|
||||
cmp eax, [t_padmaxx]
|
||||
jbe .ext_next
|
||||
mov [t_padmaxx], eax
|
||||
jmp .ext_next
|
||||
.ext_y:
|
||||
cmp eax, 0x00010031
|
||||
jne .ext_next
|
||||
mov eax, [p_log_max]
|
||||
cmp eax, [t_padmaxy]
|
||||
jbe .ext_next
|
||||
mov [t_padmaxy], eax
|
||||
.ext_next:
|
||||
inc ecx
|
||||
jmp .ext_loop
|
||||
.no_extent:
|
||||
; Button-style field: Usage Minimum/Maximum on the Button page.
|
||||
cmp [p_usage_min], -1
|
||||
je .not_buttons
|
||||
cmp [p_usage_max], -1
|
||||
je .not_buttons
|
||||
cmp [p_usage_page], 9
|
||||
jne .not_buttons
|
||||
cmp [p_report_size], 1 ; buttons are always 1-bit fields
|
||||
jne .done
|
||||
mov eax, [v_base]
|
||||
mov ecx, [p_report_count]
|
||||
call hid_note_buttons
|
||||
jmp .done
|
||||
.not_buttons:
|
||||
cmp [p_usage_cnt], 0
|
||||
je .done
|
||||
call hid_note_touchpad
|
||||
; Usage-list field: look for GD/X, GD/Y, GD/Wheel among the usages.
|
||||
test [v_flags], 4 ; only relative fields are interesting
|
||||
jz .done
|
||||
xor ecx, ecx
|
||||
.usage_loop:
|
||||
cmp ecx, [p_report_count]
|
||||
jae .done
|
||||
; usage index = min(field index, usage count - 1): a short usage list
|
||||
; applies its last usage to the remaining fields.
|
||||
mov edx, [p_usage_cnt]
|
||||
dec edx
|
||||
mov eax, ecx
|
||||
cmp eax, edx
|
||||
jbe @f
|
||||
mov eax, edx
|
||||
@@:
|
||||
mov eax, [p_usages+eax*4]
|
||||
cmp eax, 0x00010030
|
||||
je .is_x
|
||||
cmp eax, 0x00010031
|
||||
je .is_y
|
||||
cmp eax, 0x00010038
|
||||
je .is_wheel
|
||||
.next_usage:
|
||||
inc ecx
|
||||
jmp .usage_loop
|
||||
.is_x:
|
||||
test [t_have], 1
|
||||
jnz .next_usage
|
||||
call hid_claim_report_id
|
||||
jc .next_usage
|
||||
call hid_field_offset
|
||||
mov [t_xoff], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_xsize], eax
|
||||
or [t_have], 1
|
||||
jmp .next_usage
|
||||
.is_y:
|
||||
test [t_have], 2
|
||||
jnz .next_usage
|
||||
call hid_claim_report_id
|
||||
jc .next_usage
|
||||
call hid_field_offset
|
||||
mov [t_yoff], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_ysize], eax
|
||||
or [t_have], 2
|
||||
jmp .next_usage
|
||||
.is_wheel:
|
||||
test [t_have], 8
|
||||
jnz .next_usage
|
||||
mov eax, [t_id]
|
||||
cmp eax, -1 ; wheel never claims a report on its own
|
||||
je .next_usage
|
||||
cmp eax, [p_report_id]
|
||||
jne .next_usage
|
||||
call hid_field_offset
|
||||
mov [t_woff], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_wsize], eax
|
||||
or [t_have], 8
|
||||
jmp .next_usage
|
||||
.done:
|
||||
pop edx ecx ebx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Records a run of 1-bit Button-page fields starting at bit eax, ecx of them.
|
||||
; The mouse decoder wants the buttons of ITS report: an item from some other
|
||||
; report is kept only until a better one turns up, and .eof drops it if it
|
||||
; still does not match. The touchpad report keeps its own copy.
|
||||
proc hid_note_buttons
|
||||
push eax ecx edx
|
||||
cmp ecx, 8
|
||||
jbe @f
|
||||
mov ecx, 8
|
||||
@@:
|
||||
mov edx, [p_report_id]
|
||||
cmp edx, [t_ptp_id]
|
||||
jne .mouse
|
||||
cmp [t_pbtn_cnt], 0
|
||||
jne .mouse
|
||||
mov [t_pbtn_off], eax
|
||||
mov [t_pbtn_cnt], ecx
|
||||
.mouse:
|
||||
cmp [t_btncnt], 0
|
||||
je .take
|
||||
mov edx, [t_btnid]
|
||||
cmp edx, [t_id] ; already the chosen report's: keep
|
||||
je .done
|
||||
mov edx, [p_report_id]
|
||||
cmp edx, [t_btnid] ; a second run in the same report: keep the first
|
||||
je .done
|
||||
.take:
|
||||
mov [t_btnoff], eax
|
||||
mov [t_btncnt], ecx
|
||||
mov eax, [p_report_id]
|
||||
mov [t_btnid], eax
|
||||
.done:
|
||||
pop edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Walks the usages of the current input item looking for the touchpad
|
||||
; fields. Field k takes usage min(k, count-1), as in the mouse search.
|
||||
proc hid_note_touchpad
|
||||
push eax ebx ecx edx
|
||||
xor ecx, ecx
|
||||
.field:
|
||||
cmp ecx, [p_report_count]
|
||||
jae .done
|
||||
mov edx, [p_usage_cnt]
|
||||
dec edx
|
||||
mov eax, ecx
|
||||
cmp eax, edx
|
||||
jbe @f
|
||||
mov eax, edx
|
||||
@@:
|
||||
mov ebx, [p_usages+eax*4] ; ebx = usage of field ecx
|
||||
call hid_field_offset ; eax = its bit offset
|
||||
cmp ebx, 0x000D0042 ; Tip Switch: a new finger
|
||||
je .tip
|
||||
cmp ebx, 0x000D0054 ; Contact Count
|
||||
je .count
|
||||
cmp ebx, 0x000D0051 ; Contact Identifier
|
||||
je .cid
|
||||
cmp ebx, 0x00010030
|
||||
je .x
|
||||
cmp ebx, 0x00010031
|
||||
je .y
|
||||
shr ebx, 16
|
||||
cmp ebx, 9 ; buttons written as a usage list
|
||||
jne .next
|
||||
push ecx
|
||||
neg ecx
|
||||
add ecx, [p_report_count] ; the fields from here to the end
|
||||
call hid_note_buttons
|
||||
pop ecx
|
||||
jmp .done ; one run per item is enough
|
||||
.tip:
|
||||
cmp [t_ptp_id], -1
|
||||
jne @f
|
||||
mov edx, [p_report_id]
|
||||
mov [t_ptp_id], edx ; the first report with fingers is the one
|
||||
@@:
|
||||
call hid_in_ptp
|
||||
jne .next
|
||||
mov edx, [t_fcount]
|
||||
cmp edx, HID_MAX_FINGERS
|
||||
jae .next
|
||||
mov [t_ftip+edx*4], eax
|
||||
mov dword [t_fxs+edx*4], 0
|
||||
mov dword [t_fys+edx*4], 0
|
||||
mov dword [t_fcids+edx*4], 0
|
||||
inc [t_fcount]
|
||||
jmp .next
|
||||
.cid:
|
||||
call hid_in_ptp
|
||||
jne .next
|
||||
mov edx, [t_fcount]
|
||||
test edx, edx
|
||||
jz .next
|
||||
dec edx
|
||||
cmp dword [t_fcids+edx*4], 0
|
||||
jne .next
|
||||
mov [t_fcid+edx*4], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_fcids+edx*4], eax
|
||||
jmp .next
|
||||
.count:
|
||||
call hid_in_ptp
|
||||
jne .next
|
||||
mov [t_ccnt_off], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_ccnt_size], eax
|
||||
jmp .next
|
||||
.x:
|
||||
test [v_flags], 4 ; absolute only; relative is the mouse
|
||||
jnz .next
|
||||
call hid_in_ptp
|
||||
jne .next
|
||||
mov edx, [t_fcount]
|
||||
test edx, edx
|
||||
jz .next
|
||||
dec edx
|
||||
cmp dword [t_fxs+edx*4], 0
|
||||
jne .next
|
||||
mov [t_fx+edx*4], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_fxs+edx*4], eax
|
||||
jmp .next
|
||||
.y:
|
||||
test [v_flags], 4
|
||||
jnz .next
|
||||
call hid_in_ptp
|
||||
jne .next
|
||||
mov edx, [t_fcount]
|
||||
test edx, edx
|
||||
jz .next
|
||||
dec edx
|
||||
cmp dword [t_fys+edx*4], 0
|
||||
jne .next
|
||||
mov [t_fy+edx*4], eax
|
||||
mov eax, [p_report_size]
|
||||
mov [t_fys+edx*4], eax
|
||||
.next:
|
||||
inc ecx
|
||||
jmp .field
|
||||
.done:
|
||||
pop edx ecx ebx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; ZF set when the current item belongs to the touchpad report.
|
||||
proc hid_in_ptp
|
||||
push eax
|
||||
mov eax, [p_report_id]
|
||||
cmp eax, [t_ptp_id]
|
||||
pop eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Size in bytes of the feature report with id eax; 0 when the descriptor
|
||||
; never mentioned one.
|
||||
proc hid_feature_bytes
|
||||
push ecx
|
||||
xor ecx, ecx
|
||||
@@:
|
||||
cmp ecx, [p_idcnt]
|
||||
jae .none
|
||||
cmp eax, [p_ids+ecx*4]
|
||||
je .found
|
||||
inc ecx
|
||||
jmp @b
|
||||
.found:
|
||||
mov eax, [p_fbits+ecx*4]
|
||||
add eax, 7
|
||||
shr eax, 3
|
||||
pop ecx
|
||||
ret
|
||||
.none:
|
||||
xor eax, eax
|
||||
pop ecx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Locks the candidate report ID to the current one, or fails (CF=1) when a
|
||||
; different report already holds X/Y.
|
||||
proc hid_claim_report_id
|
||||
mov eax, [t_id]
|
||||
cmp eax, -1
|
||||
jne @f
|
||||
mov eax, [p_report_id]
|
||||
mov [t_id], eax
|
||||
clc
|
||||
ret
|
||||
@@:
|
||||
cmp eax, [p_report_id]
|
||||
jne .taken
|
||||
clc
|
||||
ret
|
||||
.taken:
|
||||
stc
|
||||
ret
|
||||
endp
|
||||
|
||||
; Bit offset of field #ecx of the current item.
|
||||
; in: ecx = field index. out: eax = v_base + ecx * report_size.
|
||||
proc hid_field_offset
|
||||
mov eax, [p_report_size]
|
||||
imul eax, ecx
|
||||
add eax, [v_base]
|
||||
ret
|
||||
endp
|
||||
|
||||
; Parses the report descriptor.
|
||||
; in: esi -> descriptor, ecx = length.
|
||||
; out: eax = 1 and f_* variables filled if a usable report was found.
|
||||
proc hid_parse_report_desc uses ebx esi edi
|
||||
lea edi, [esi+ecx]
|
||||
xor eax, eax
|
||||
mov [p_usage_page], eax
|
||||
mov [p_report_size], eax
|
||||
mov [p_report_count], eax
|
||||
mov [p_report_id], eax
|
||||
mov [p_uses_repid], eax
|
||||
mov [p_usage_cnt], eax
|
||||
mov [p_idcnt], eax
|
||||
mov [p_log_max], eax
|
||||
mov [t_padmaxx], eax
|
||||
mov [t_padmaxy], eax
|
||||
mov [t_have], eax
|
||||
mov [t_btncnt], eax
|
||||
mov [t_wsize], eax
|
||||
mov [p_usage_min], -1
|
||||
mov [p_usage_max], -1
|
||||
mov [t_id], -1
|
||||
mov [t_btnid], -2
|
||||
mov [t_ptp_id], -1
|
||||
mov [t_fcount], eax
|
||||
mov [t_ccnt_size], eax
|
||||
mov [t_pbtn_cnt], eax
|
||||
mov [t_ptp_bytes], eax
|
||||
.loop:
|
||||
cmp esi, edi
|
||||
jae .eof
|
||||
movzx eax, byte [esi]
|
||||
inc esi
|
||||
cmp al, 0xFE
|
||||
je .long_item
|
||||
mov ecx, eax
|
||||
and ecx, 3
|
||||
cmp ecx, 3
|
||||
jne @f
|
||||
inc ecx ; size code 3 means 4 bytes
|
||||
@@:
|
||||
lea ebx, [esi+ecx]
|
||||
cmp ebx, edi
|
||||
ja .eof
|
||||
xor edx, edx
|
||||
jecxz .no_data
|
||||
cmp ecx, 1
|
||||
jne @f
|
||||
movzx edx, byte [esi]
|
||||
jmp .have_data
|
||||
@@:
|
||||
cmp ecx, 2
|
||||
jne @f
|
||||
movzx edx, word [esi]
|
||||
jmp .have_data
|
||||
@@:
|
||||
mov edx, [esi]
|
||||
.have_data:
|
||||
add esi, ecx
|
||||
.no_data:
|
||||
and eax, 0xFC
|
||||
; Global items
|
||||
cmp al, 0x04
|
||||
je .g_usage_page
|
||||
cmp al, 0x84
|
||||
je .g_report_id
|
||||
cmp al, 0x74
|
||||
je .g_report_size
|
||||
cmp al, 0x94
|
||||
je .g_report_count
|
||||
cmp al, 0x24
|
||||
je .g_log_max
|
||||
; Local items
|
||||
cmp al, 0x08
|
||||
je .l_usage
|
||||
cmp al, 0x18
|
||||
je .l_usage_min
|
||||
cmp al, 0x28
|
||||
je .l_usage_max
|
||||
; Main items
|
||||
cmp al, 0x80
|
||||
je .m_input
|
||||
cmp al, 0x90
|
||||
je .m_clear_locals
|
||||
cmp al, 0xB0
|
||||
je .m_feature
|
||||
cmp al, 0xA0
|
||||
je .m_clear_locals
|
||||
cmp al, 0xC0
|
||||
je .m_clear_locals
|
||||
jmp .loop
|
||||
.g_usage_page:
|
||||
and edx, 0xFFFF
|
||||
mov [p_usage_page], edx
|
||||
jmp .loop
|
||||
.g_report_id:
|
||||
mov [p_report_id], edx
|
||||
mov [p_uses_repid], 1
|
||||
jmp .loop
|
||||
.g_report_size:
|
||||
mov [p_report_size], edx
|
||||
jmp .loop
|
||||
.g_report_count:
|
||||
mov [p_report_count], edx
|
||||
jmp .loop
|
||||
.g_log_max:
|
||||
mov [p_log_max], edx
|
||||
jmp .loop
|
||||
.l_usage:
|
||||
mov ebx, [p_usage_cnt]
|
||||
cmp ebx, HID_MAX_USAGES
|
||||
jae .loop
|
||||
cmp ecx, 4 ; 4-byte usage carries its own page
|
||||
je @f
|
||||
mov eax, [p_usage_page]
|
||||
shl eax, 16
|
||||
or edx, eax
|
||||
@@:
|
||||
mov [p_usages+ebx*4], edx
|
||||
inc [p_usage_cnt]
|
||||
jmp .loop
|
||||
.l_usage_min:
|
||||
mov [p_usage_min], edx
|
||||
jmp .loop
|
||||
.l_usage_max:
|
||||
mov [p_usage_max], edx
|
||||
jmp .loop
|
||||
.m_input:
|
||||
mov [v_flags], edx
|
||||
call hid_process_input
|
||||
jmp .m_clear_locals ; input bits are not feature bits
|
||||
.m_feature:
|
||||
; Feature reports are only ever written, never decoded, but writing one
|
||||
; needs its exact size: a SET_REPORT shorter than the report is ignored by
|
||||
; some firmwares (the Elan Input Mode report has two bytes, mode and the
|
||||
; selective-reporting switches - one byte does nothing there).
|
||||
call hid_get_bits_slot
|
||||
mov eax, [p_report_size]
|
||||
imul eax, [p_report_count]
|
||||
add [p_fbits+ecx*4], eax
|
||||
.m_clear_locals:
|
||||
xor eax, eax
|
||||
mov [p_usage_cnt], eax
|
||||
mov [p_usage_min], -1
|
||||
mov [p_usage_max], -1
|
||||
jmp .loop
|
||||
.long_item:
|
||||
cmp esi, edi
|
||||
jae .eof
|
||||
movzx ecx, byte [esi]
|
||||
lea esi, [esi+ecx+2]
|
||||
jmp .loop
|
||||
.eof:
|
||||
; Size of the touchpad report, when there is one.
|
||||
mov eax, [t_ptp_id]
|
||||
cmp eax, -1
|
||||
je .no_ptp
|
||||
xor ecx, ecx
|
||||
@@:
|
||||
cmp ecx, [p_idcnt]
|
||||
jae .no_ptp
|
||||
cmp eax, [p_ids+ecx*4]
|
||||
je @f
|
||||
inc ecx
|
||||
jmp @b
|
||||
@@:
|
||||
mov eax, [p_bits+ecx*4]
|
||||
add eax, 7
|
||||
shr eax, 3
|
||||
mov [t_ptp_bytes], eax
|
||||
.no_ptp:
|
||||
; Success needs relative X and Y in the same report - or, failing that, a
|
||||
; touchpad report with at least one complete finger, which is then the only
|
||||
; thing the device will be driven through.
|
||||
mov eax, [t_have]
|
||||
and eax, 3
|
||||
cmp eax, 3
|
||||
je .have_mouse
|
||||
cmp [t_fcount], 0
|
||||
je .fail
|
||||
cmp dword [t_fxs], 0
|
||||
je .fail
|
||||
cmp dword [t_fys], 0
|
||||
je .fail
|
||||
mov [f_repid], -1 ; no mouse report to match
|
||||
mov [f_bytes], 0
|
||||
mov [t_btncnt], 0
|
||||
movi eax, 1
|
||||
ret
|
||||
.have_mouse:
|
||||
; Keep buttons/wheel only when they live in the chosen report.
|
||||
mov eax, [t_btnid]
|
||||
cmp eax, [t_id]
|
||||
je @f
|
||||
mov [t_btncnt], 0
|
||||
@@:
|
||||
; Final layout.
|
||||
mov eax, [t_id]
|
||||
mov [f_repid], eax
|
||||
xor ecx, ecx
|
||||
@@:
|
||||
cmp ecx, [p_idcnt]
|
||||
jae .no_bits
|
||||
cmp eax, [p_ids+ecx*4]
|
||||
je .got_bits
|
||||
inc ecx
|
||||
jmp @b
|
||||
.got_bits:
|
||||
mov eax, [p_bits+ecx*4]
|
||||
add eax, 7
|
||||
shr eax, 3
|
||||
mov [f_bytes], eax
|
||||
movi eax, 1
|
||||
ret
|
||||
.no_bits:
|
||||
.fail:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Extracts an unsigned field from an input report.
|
||||
; in: esi -> report data, eax = bit offset, ecx = bit count (1..24).
|
||||
; out: eax = value.
|
||||
proc hid_extract_u
|
||||
push ebx ecx edx
|
||||
mov edx, eax
|
||||
shr edx, 3
|
||||
mov ebx, [esi+edx] ; buffer has spare bytes at the end
|
||||
and eax, 7
|
||||
push ecx
|
||||
mov ecx, eax
|
||||
shr ebx, cl
|
||||
pop ecx
|
||||
neg ecx
|
||||
add ecx, 32
|
||||
shl ebx, cl
|
||||
shr ebx, cl
|
||||
mov eax, ebx
|
||||
pop edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Same, sign-extended.
|
||||
proc hid_extract_s
|
||||
push ebx ecx edx
|
||||
mov edx, eax
|
||||
shr edx, 3
|
||||
mov ebx, [esi+edx]
|
||||
and eax, 7
|
||||
push ecx
|
||||
mov ecx, eax
|
||||
shr ebx, cl
|
||||
pop ecx
|
||||
neg ecx
|
||||
add ecx, 32
|
||||
shl ebx, cl
|
||||
sar ebx, cl
|
||||
mov eax, ebx
|
||||
pop edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,26 +0,0 @@
|
||||
[touchpad]
|
||||
; pointer speed in percent of the driver's default (on top of the [mouse]
|
||||
; speed above; pads differ in resolution)
|
||||
speed=100
|
||||
; how far a finger must move before the pointer follows, in pad units;
|
||||
; larger is steadier under a pressing finger, 0 turns the filter off
|
||||
jitter=1
|
||||
; the same, for a finger that landed on the button strip: it is pressing
|
||||
; rather than steering there, so it needs a stricter margin
|
||||
jitter_buttons=45
|
||||
; pad units of two-finger travel per wheel step, and the direction
|
||||
scroll_step=64
|
||||
scroll_invert=0
|
||||
; turn a short, still touch into a click: one finger left, two right,
|
||||
; three middle
|
||||
tap_enable=1
|
||||
; tap, then touch again at once and move: the button stays down for that
|
||||
; second touch - this is how text is selected and how one draws
|
||||
tap_drag=1
|
||||
; right click: 0 never, 1 bottom-right corner, 2 by finger count (two
|
||||
; fingers right, three middle), 3 either
|
||||
right_click=1
|
||||
; button strip along the bottom edge, in percent of the surface: its
|
||||
; height, and where its left half ends
|
||||
button_zone=15
|
||||
right_split=50
|
||||
@@ -1,72 +0,0 @@
|
||||
; Asks the I2C touchpad driver to read its settings again.
|
||||
;
|
||||
; The driver takes everything it can be tuned with from the [touchpad] section
|
||||
; of /sys/settings/system.ini, and it reads that file once while loading. This
|
||||
; tells it to read the file again, so editing a setting takes effect straight
|
||||
; away instead of at the next boot.
|
||||
;
|
||||
; There is no window: the outcome goes to the debug board, the way the driver
|
||||
; reports everything else.
|
||||
|
||||
format binary as ""
|
||||
use32
|
||||
db 'MENUET01'
|
||||
dd 1, start, i_end, mem, mem, 0, 0
|
||||
|
||||
include '../../programs/macros.inc'
|
||||
|
||||
SRV_RELOAD_CONF = 1
|
||||
|
||||
start:
|
||||
; 1. Find the driver's service by name.
|
||||
mcall 68, 16, srv_name
|
||||
test eax, eax
|
||||
jz .no_driver
|
||||
mov [ioctl.handle], eax
|
||||
; 2. Ask it to reload. No data travels either way: the driver reads the file
|
||||
; itself, so the settings file stays the only place they are written down.
|
||||
mcall 68, 17, ioctl
|
||||
test eax, eax
|
||||
jnz .refused
|
||||
mov esi, msg_ok
|
||||
jmp .say
|
||||
.no_driver:
|
||||
mov esi, msg_no_driver
|
||||
jmp .say
|
||||
.refused:
|
||||
mov esi, msg_refused
|
||||
.say:
|
||||
call board_str
|
||||
or eax, -1
|
||||
mcall
|
||||
|
||||
; Writes a zero-terminated string to the debug board.
|
||||
; in: esi -> string
|
||||
board_str:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .done
|
||||
mov cl, al
|
||||
mcall 63, 1
|
||||
jmp board_str
|
||||
.done:
|
||||
ret
|
||||
|
||||
srv_name db 'I2CHID', 0
|
||||
|
||||
align 4
|
||||
ioctl:
|
||||
.handle dd 0
|
||||
.io_code dd SRV_RELOAD_CONF
|
||||
.input dd 0
|
||||
.inp_size dd 0
|
||||
.output dd 0
|
||||
.out_size dd 0
|
||||
|
||||
msg_ok db 'tpreload: touchpad settings reloaded', 13, 10, 0
|
||||
msg_no_driver db 'tpreload: the I2C touchpad driver is not loaded', 13, 10, 0
|
||||
msg_refused db 'tpreload: the driver refused the request', 13, 10, 0
|
||||
|
||||
i_end:
|
||||
rb 1024
|
||||
mem:
|
||||
@@ -139,7 +139,6 @@ import core,\
|
||||
RegKeyboard,\
|
||||
DelKeyboard,\
|
||||
Sleep,\
|
||||
Delay,\
|
||||
GetTimerTicks,\
|
||||
\
|
||||
strncat,\
|
||||
|
||||
+104
-969
File diff suppressed because it is too large.
Load diff
@@ -842,7 +842,8 @@ disk_scan_partitions:
|
||||
cmp ebx, mbr_buffer
|
||||
jz .release_partition_buffer
|
||||
; 15b. If we have allocated it, free it.
|
||||
stdcall kernel_free, ebx
|
||||
xchg eax, ebx
|
||||
call free
|
||||
jmp .nothing
|
||||
; 15c. Otherwise, release reference.
|
||||
.release_partition_buffer:
|
||||
|
||||
@@ -183,8 +183,6 @@ EFLAGS_ID = 0x200000 ; id flag
|
||||
IRQ_PIC = 0
|
||||
IRQ_APIC = 1
|
||||
|
||||
IO_MAP_SIZE = 65536/8 ; 8192 or 2 PAGE_SIZE
|
||||
|
||||
struct TSS
|
||||
_back rw 2
|
||||
_esp0 rd 1
|
||||
@@ -292,9 +290,6 @@ sys_proc = OS_BASE + 0x008E000
|
||||
|
||||
SLOT_BASE = OS_BASE + 0x0090000
|
||||
|
||||
APPDATA_IDLE_THREAD = SLOT_BASE + sizeof.APPDATA*1 ; poiner to IDLE thread
|
||||
APPDATA_OS_THREAD = SLOT_BASE + sizeof.APPDATA*2 ; poiner to OS thread
|
||||
|
||||
VGABasePtr = OS_BASE + 0x00A0000
|
||||
|
||||
virtual at OS_BASE + 0x05FFF80
|
||||
@@ -575,7 +570,7 @@ struct APPDATA
|
||||
ipc_start dd ? ;+160
|
||||
ipc_size dd ? ;+164
|
||||
occurred_events dd ? ;+168 ; mask which accumulates occurred events
|
||||
debugger_thread dd ? ;+172 ; pointer to APPDATA or 0
|
||||
debugger_slot dd ? ;+172 ; index in SLOT_BASE array
|
||||
terminate_protection dd ? ;+176
|
||||
keyboard_mode db ? ;+180
|
||||
rb 3
|
||||
|
||||
+77
-41
@@ -8,8 +8,8 @@
|
||||
|
||||
; diamond, 2006
|
||||
sys_debug_services:
|
||||
cmp ebx, sys_debug_services_table.count
|
||||
jae @f
|
||||
cmp ebx, 9
|
||||
ja @f
|
||||
jmp dword [sys_debug_services_table + ebx*4]
|
||||
@@:
|
||||
ret
|
||||
@@ -26,9 +26,7 @@ sys_debug_services_table:
|
||||
dd debug_write_process_memory
|
||||
dd debug_terminate
|
||||
dd debug_set_drx
|
||||
.count = ($ - sys_debug_services_table)/4
|
||||
endg
|
||||
|
||||
debug_set_event_data:
|
||||
; in: ecx = pointer
|
||||
; destroys eax
|
||||
@@ -36,20 +34,22 @@ debug_set_event_data:
|
||||
mov [eax + APPDATA.dbg_event_mem], ecx
|
||||
ret
|
||||
|
||||
get_debuggee_thread:
|
||||
get_debuggee_slot:
|
||||
; in: ecx=PID
|
||||
; out: CF=1 if error
|
||||
; CF=0 and eax = pointer to APPDATA if ok
|
||||
; CF=0 and eax=slot*0x20 if ok
|
||||
; out: interrupts disabled
|
||||
cli
|
||||
mov eax, ecx
|
||||
call pid_to_thread
|
||||
call pid_to_slot
|
||||
;call pid_to_appdata
|
||||
test eax, eax
|
||||
jz .ret_bad
|
||||
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
push ebx
|
||||
mov ebx, [current_slot]
|
||||
cmp [eax + APPDATA.debugger_thread], ebx
|
||||
mov ebx, [current_slot_idx]
|
||||
cmp [SLOT_BASE + eax + APPDATA.debugger_slot], ebx
|
||||
;cmp [eax + APPDATA.debugger_slot], ebx
|
||||
pop ebx
|
||||
jnz .ret_bad
|
||||
; clc ; automatically
|
||||
@@ -61,9 +61,10 @@ get_debuggee_thread:
|
||||
debug_detach:
|
||||
; in: ecx=pid
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
and dword [eax + APPDATA.debugger_thread], 0
|
||||
and dword [eax + SLOT_BASE + APPDATA.debugger_slot], 0
|
||||
;and dword [eax + APPDATA.debugger_slot], 0
|
||||
call do_resume
|
||||
.ret:
|
||||
sti
|
||||
@@ -71,27 +72,40 @@ debug_detach:
|
||||
|
||||
debug_terminate:
|
||||
; in: ecx=pid
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc debug_detach.ret
|
||||
mov ecx, eax
|
||||
|
||||
movzx ecx, ch ; del when sysfn_term... will using APPDATA
|
||||
shr ecx, BSF sizeof.APPDATA
|
||||
;movzx ecx, ch ; del when sysfn_term... will using APPDATA
|
||||
|
||||
; push 2
|
||||
; pop ebx
|
||||
mov edx, esi ; what?
|
||||
jmp sysfn_terminate
|
||||
|
||||
debug_suspend:
|
||||
; in: ecx=pid
|
||||
; destroys eax,ecx
|
||||
call get_debuggee_thread
|
||||
; { Patch by Coldy (rev. 7125), reason: http://board.kolibrios.org/viewtopic.php?f=1&t=1712&p=75957#p75957
|
||||
; cli
|
||||
; mov eax, ecx
|
||||
; call pid_to_slot
|
||||
; shl eax, 5
|
||||
; jz .ret
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
|
||||
mov cl, [eax + APPDATA.state] ; process state
|
||||
; } End patch
|
||||
mov cl, [SLOT_BASE + eax + APPDATA.state] ; process state
|
||||
;mov cl, [eax + APPDATA.state] ; process state
|
||||
test cl, cl
|
||||
jz .1
|
||||
cmp cl, TSTATE_WAITING
|
||||
jnz .ret
|
||||
mov cl, TSTATE_WAIT_SUSPENDED
|
||||
.2:
|
||||
mov [eax + APPDATA.state], cl
|
||||
mov [SLOT_BASE + eax + APPDATA.state], cl
|
||||
;mov [eax + APPDATA.state], cl
|
||||
.ret:
|
||||
sti
|
||||
ret
|
||||
@@ -100,14 +114,16 @@ debug_suspend:
|
||||
jmp .2
|
||||
|
||||
do_resume:
|
||||
mov cl, [eax + APPDATA.state]
|
||||
mov cl, [SLOT_BASE + eax + APPDATA.state]
|
||||
;mov cl, [eax + APPDATA.state]
|
||||
cmp cl, TSTATE_RUN_SUSPENDED
|
||||
jz .1
|
||||
cmp cl, TSTATE_WAIT_SUSPENDED
|
||||
jnz .ret
|
||||
mov cl, TSTATE_WAITING
|
||||
.2:
|
||||
mov [eax + APPDATA.state], cl
|
||||
mov [SLOT_BASE + eax + APPDATA.state], cl
|
||||
;mov [eax + APPDATA.state], cl
|
||||
.ret:
|
||||
ret
|
||||
.1:
|
||||
@@ -117,9 +133,11 @@ do_resume:
|
||||
debug_resume:
|
||||
; in: ecx=pid
|
||||
; destroys eax,ebx
|
||||
call get_debuggee_thread
|
||||
jc .ret
|
||||
|
||||
cli
|
||||
mov eax, ecx
|
||||
call pid_to_slot
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
jz .ret
|
||||
call do_resume
|
||||
.ret:
|
||||
sti
|
||||
@@ -142,15 +160,21 @@ debug_getcontext:
|
||||
inc ebx ; 1 - get sse context
|
||||
; TODO legacy 32-bit FPU/MMX context
|
||||
.std_ctx:
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc .ret
|
||||
|
||||
shr eax, BSF sizeof.APPDATA
|
||||
;movzx ebp, ah
|
||||
|
||||
cmp eax, [fpu_owner]
|
||||
;cmp ebp, [fpu_owner]
|
||||
jne @f
|
||||
inc bh ; set swap context flag
|
||||
@@:
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov edi, esi
|
||||
mov eax, [eax + APPDATA.pl0_stack]
|
||||
mov eax, [SLOT_BASE + eax + APPDATA.pl0_stack]
|
||||
;mov eax, [eax + APPDATA.pl0_stack]
|
||||
lea esi, [eax + RING0_STACK_SIZE]
|
||||
|
||||
.ring0:
|
||||
@@ -216,10 +240,11 @@ debug_setcontext:
|
||||
cmp edx, 28h
|
||||
jnz .ret
|
||||
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc .stiret
|
||||
|
||||
mov eax, [eax + APPDATA.pl0_stack]
|
||||
; mov esi, edx
|
||||
mov eax, [eax + SLOT_BASE+APPDATA.pl0_stack]
|
||||
;mov eax, [eax + APPDATA.pl0_stack]
|
||||
lea edi, [eax + RING0_STACK_SIZE]
|
||||
|
||||
.ring0:
|
||||
@@ -252,16 +277,15 @@ debug_setcontext:
|
||||
ret
|
||||
|
||||
debug_set_drx:
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc .errret
|
||||
|
||||
mov ebp, eax
|
||||
lea eax, [eax + APPDATA.dbg_regs]
|
||||
lea eax, [eax + SLOT_BASE + APPDATA.dbg_regs]
|
||||
;lea eax, [eax + APPDATA.dbg_regs]
|
||||
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
||||
; [eax+10]=dr7
|
||||
cmp esi, OS_BASE
|
||||
jae .errret
|
||||
|
||||
cmp dl, 3
|
||||
ja .errret
|
||||
mov ecx, dr7
|
||||
@@ -282,7 +306,10 @@ debug_set_drx:
|
||||
btr dword [eax + 10h], edx ; clear L<i> bit
|
||||
test byte [eax + 10h], 55h
|
||||
jnz .okret
|
||||
and [ebp + APPDATA.dbg_state], not 1
|
||||
; imul eax, ebp, tss_step/32
|
||||
; and byte [eax + tss_data + TSS._trap], not 1
|
||||
and [SLOT_BASE + ebp + APPDATA.dbg_state], not 1
|
||||
;and [ebp + APPDATA.dbg_state], not 1
|
||||
.okret:
|
||||
and dword [esp + SYSCALL_STACK.eax], 0
|
||||
sti
|
||||
@@ -327,7 +354,10 @@ debug_set_drx:
|
||||
not ebx
|
||||
and [eax + 10h+2], bx
|
||||
or [eax + 10h+2], dx ; set R/W and LEN fields
|
||||
or [ebp + APPDATA.dbg_state], 1
|
||||
; imul eax, ebp, tss_step/32
|
||||
; or byte [eax + tss_data + TSS._trap], 1
|
||||
or [SLOT_BASE + ebp + APPDATA.dbg_state], 1
|
||||
;or [ebp + APPDATA.dbg_state], 1
|
||||
jmp .okret
|
||||
|
||||
debug_read_process_memory:
|
||||
@@ -338,9 +368,10 @@ debug_read_process_memory:
|
||||
; esi=address in debuggee
|
||||
; out: [esp+36]=sizeof(read)
|
||||
; destroys all
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc .err
|
||||
|
||||
shr eax, BSF sizeof.APPDATA
|
||||
;movzx eax,ah
|
||||
mov ecx, edi
|
||||
call read_process_memory
|
||||
sti
|
||||
@@ -358,9 +389,10 @@ debug_write_process_memory:
|
||||
; esi=address in debuggee
|
||||
; out: [esp+36]=sizeof(write)
|
||||
; destroys all
|
||||
call get_debuggee_thread
|
||||
call get_debuggee_slot
|
||||
jc debug_read_process_memory.err
|
||||
|
||||
shr eax, BSF sizeof.APPDATA
|
||||
;movzx eax,ah
|
||||
mov ecx, edi
|
||||
call write_process_memory
|
||||
sti
|
||||
@@ -368,7 +400,7 @@ debug_write_process_memory:
|
||||
ret
|
||||
|
||||
debugger_notify:
|
||||
; in: eax=debugger thread
|
||||
; in: eax=debugger slot
|
||||
; ecx=size of debug message
|
||||
; [esp+4]..[esp+4+ecx]=message
|
||||
; interrupts must be disabled!
|
||||
@@ -378,7 +410,9 @@ debugger_notify:
|
||||
mov edi, [timer_ticks]
|
||||
add edi, 500 ; 5 sec timeout
|
||||
.1:
|
||||
mov esi, [ebp + APPDATA.dbg_event_mem]
|
||||
mov eax, ebp
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov esi, [SLOT_BASE + eax + APPDATA.dbg_event_mem]
|
||||
test esi, esi
|
||||
jz .ret
|
||||
; read buffer header
|
||||
@@ -432,6 +466,8 @@ debugger_notify:
|
||||
pop edx
|
||||
call write_process_memory
|
||||
; new debug event
|
||||
or [ebp + APPDATA.occurred_events], EVENT_DEBUG
|
||||
mov eax, ebp
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
or [SLOT_BASE + eax + APPDATA.occurred_events], EVENT_DEBUG
|
||||
.ret:
|
||||
ret
|
||||
+37
-49
@@ -150,10 +150,10 @@ init_avx512:
|
||||
|
||||
ret
|
||||
|
||||
; param
|
||||
; eax= 512 bytes memory area aligned on a 16-byte boundary
|
||||
|
||||
align 4
|
||||
; @brief Export function - Save FPU context in buffer
|
||||
; @param eax - 512 bytes memory area aligned on a 16-byte boundary
|
||||
; @return not return
|
||||
fpu_save:
|
||||
push ecx
|
||||
push esi
|
||||
@@ -166,7 +166,7 @@ fpu_save:
|
||||
mov edi, eax
|
||||
|
||||
mov ecx, [fpu_owner]
|
||||
mov esi, [current_slot]
|
||||
mov esi, [current_slot_idx]
|
||||
cmp ecx, esi
|
||||
jne .save
|
||||
|
||||
@@ -175,11 +175,14 @@ fpu_save:
|
||||
.save:
|
||||
mov [fpu_owner], esi
|
||||
|
||||
mov eax, [ecx + APPDATA.fpu_state]
|
||||
shl ecx, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state]
|
||||
|
||||
call save_context
|
||||
|
||||
; first 512 bytes of XSAVE area have the same format as FXSAVE
|
||||
mov esi, [esi + APPDATA.fpu_state]
|
||||
shl esi, BSF sizeof.APPDATA
|
||||
mov esi, [SLOT_BASE + esi + APPDATA.fpu_state]
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
@@ -191,16 +194,14 @@ fpu_save:
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
; @brief Export function - Get size from AVX context
|
||||
; @return size of buffer
|
||||
avx_save_size:
|
||||
mov eax, [xsave_area_size]
|
||||
ret
|
||||
|
||||
; param
|
||||
; eax= avx_save_size() bytes memory area aligned on a 64-byte boundary
|
||||
|
||||
align 4
|
||||
; @brief Export function - Save AVX context in buffer
|
||||
; @param eax - avx_save_size() bytes memory area aligned on a 64-byte boundary
|
||||
; @return not return
|
||||
avx_save:
|
||||
push ecx
|
||||
push esi
|
||||
@@ -213,7 +214,7 @@ avx_save:
|
||||
mov edi, eax
|
||||
|
||||
mov ecx, [fpu_owner]
|
||||
mov esi, [current_slot]
|
||||
mov esi, [current_slot_idx]
|
||||
cmp ecx, esi
|
||||
jne .save
|
||||
|
||||
@@ -222,10 +223,13 @@ avx_save:
|
||||
.save:
|
||||
mov [fpu_owner], esi
|
||||
|
||||
mov eax, [ecx + APPDATA.fpu_state]
|
||||
shl ecx, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state]
|
||||
|
||||
call save_context
|
||||
|
||||
mov esi, [esi + APPDATA.fpu_state]
|
||||
shl esi, BSF sizeof.APPDATA
|
||||
mov esi, [SLOT_BASE + esi + APPDATA.fpu_state]
|
||||
mov ecx, [xsave_area_size]
|
||||
add ecx, 3
|
||||
shr ecx, 2
|
||||
@@ -260,13 +264,9 @@ save_fpu_context:
|
||||
|
||||
|
||||
align 4
|
||||
; @brief Export function - Restore FPU context
|
||||
; @param eax - 512 bytes memory area aligned on a 16-byte boundary
|
||||
; @return not return
|
||||
fpu_restore:
|
||||
push ecx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov esi, eax
|
||||
|
||||
@@ -274,7 +274,7 @@ fpu_restore:
|
||||
cli
|
||||
|
||||
mov ecx, [fpu_owner]
|
||||
mov eax, [current_slot]
|
||||
mov eax, [current_slot_idx]
|
||||
cmp ecx, eax
|
||||
jne .copy
|
||||
|
||||
@@ -284,8 +284,6 @@ fpu_restore:
|
||||
|
||||
fxrstor [esi]
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
@@ -293,31 +291,24 @@ fpu_restore:
|
||||
fnclex ;fix possible problems
|
||||
frstor [esi]
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
.copy:
|
||||
mov edi, [eax + APPDATA.fpu_state]
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov edi, [SLOT_BASE + eax + APPDATA.fpu_state]
|
||||
mov ecx, 512/4
|
||||
cld
|
||||
rep movsd
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
align 4
|
||||
; @brief Export function - Restore AVX context
|
||||
; @param eax - avx_save_size() bytes memory area aligned on a 64-byte boundary
|
||||
; @return not return
|
||||
avx_restore:
|
||||
push ecx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov esi, eax
|
||||
|
||||
@@ -325,7 +316,7 @@ avx_restore:
|
||||
cli
|
||||
|
||||
mov ecx, [fpu_owner]
|
||||
mov eax, [current_slot]
|
||||
mov eax, [current_slot_idx]
|
||||
cmp ecx, eax
|
||||
jne .copy
|
||||
|
||||
@@ -338,8 +329,6 @@ avx_restore:
|
||||
xrstor [esi]
|
||||
pop edx
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
@@ -349,8 +338,6 @@ avx_restore:
|
||||
|
||||
fxrstor [esi]
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
@@ -358,21 +345,18 @@ avx_restore:
|
||||
fnclex ;fix possible problems
|
||||
frstor [esi]
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
.copy:
|
||||
mov edi, [eax + APPDATA.fpu_state]
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov edi, [SLOT_BASE + eax + APPDATA.fpu_state]
|
||||
mov ecx, [xsave_area_size]
|
||||
add ecx, 3
|
||||
shr ecx, 2
|
||||
cld
|
||||
rep movsd
|
||||
popfd
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ecx
|
||||
ret
|
||||
@@ -386,19 +370,21 @@ except_7: ;#NM exception handler
|
||||
mov es, ax
|
||||
|
||||
mov ebx, [fpu_owner]
|
||||
cmp ebx, [current_slot]
|
||||
cmp ebx, [current_slot_idx]
|
||||
je .exit
|
||||
|
||||
mov eax, [ebx + APPDATA.fpu_state]
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||
bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
||||
jnc .no_xsave
|
||||
mov ecx, eax
|
||||
mov eax, [xsave_eax]
|
||||
mov edx, [xsave_edx]
|
||||
xsave [ecx]
|
||||
mov ebx, [current_slot]
|
||||
mov ebx, [current_slot_idx]
|
||||
mov [fpu_owner], ebx
|
||||
mov ecx, [ebx + APPDATA.fpu_state]
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
mov ecx, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||
xrstor [ecx]
|
||||
.exit:
|
||||
restore_ring3_context
|
||||
@@ -408,22 +394,24 @@ except_7: ;#NM exception handler
|
||||
jnc .no_SSE
|
||||
|
||||
fxsave [eax]
|
||||
mov ebx, [current_slot]
|
||||
mov ebx, [current_slot_idx]
|
||||
mov [fpu_owner], ebx
|
||||
mov eax, [ebx + APPDATA.fpu_state]
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||
fxrstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
.no_SSE:
|
||||
fnsave [eax]
|
||||
mov ebx, [current_slot]
|
||||
mov ebx, [current_slot_idx]
|
||||
mov [fpu_owner], ebx
|
||||
mov eax, [ebx + APPDATA.fpu_state]
|
||||
shl ebx, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||
frstor [eax]
|
||||
restore_ring3_context
|
||||
iret
|
||||
|
||||
iglobal
|
||||
fpu_owner dd APPDATA_OS_THREAD
|
||||
fpu_owner dd 2
|
||||
endg
|
||||
@@ -463,7 +463,7 @@ proc kernel_alloc stdcall, size:dword
|
||||
and eax, -PAGE_SIZE;
|
||||
mov [size], eax
|
||||
and eax, eax
|
||||
jz .err0
|
||||
jz .err
|
||||
mov ebx, eax
|
||||
shr ebx, 12
|
||||
mov [pages_count], ebx
|
||||
@@ -509,13 +509,6 @@ proc kernel_alloc stdcall, size:dword
|
||||
pop ebx
|
||||
ret
|
||||
.err:
|
||||
mov eax, [lin_addr]
|
||||
test eax, eax
|
||||
jz .err0
|
||||
mov ecx, [pages_count]
|
||||
call release_pages
|
||||
stdcall free_kernel_space, [lin_addr]
|
||||
.err0:
|
||||
xor eax, eax
|
||||
pop edi
|
||||
pop ebx
|
||||
|
||||
@@ -605,7 +605,7 @@ proc page_fault_handler
|
||||
|
||||
mov edi, [.err_addr]
|
||||
and edi, -PAGE_SIZE
|
||||
mov ecx, PAGE_SIZE/4
|
||||
mov ecx, 1024
|
||||
xor eax, eax
|
||||
;cld ;caller is duty for this
|
||||
rep stosd
|
||||
@@ -664,7 +664,7 @@ proc page_fault_handler
|
||||
cmp ebx, tss._io_map_0
|
||||
jb .fail
|
||||
|
||||
cmp ebx, tss._io_map_0 + IO_MAP_SIZE
|
||||
cmp ebx, tss._io_map_0+8192
|
||||
jae .fail
|
||||
|
||||
; io permission map
|
||||
@@ -695,7 +695,7 @@ proc page_fault_handler
|
||||
endp
|
||||
|
||||
; returns number of mapped bytes
|
||||
proc map_mem_ipc stdcall, lin_addr:dword,thread:dword,\
|
||||
proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
|
||||
ofs:dword,buf_size:dword,req_access:dword
|
||||
locals
|
||||
count dd ?
|
||||
@@ -706,8 +706,9 @@ proc map_mem_ipc stdcall, lin_addr:dword,thread:dword,\
|
||||
cmp [buf_size], 0
|
||||
jz .exit
|
||||
|
||||
mov eax, [thread]
|
||||
mov eax, [eax + APPDATA.process]
|
||||
mov eax, [slot]
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + eax + APPDATA.process]
|
||||
test eax, eax
|
||||
jz .exit
|
||||
|
||||
@@ -731,7 +732,7 @@ proc map_mem_ipc stdcall, lin_addr:dword,thread:dword,\
|
||||
shr edx, 12
|
||||
and edx, 0x3FF
|
||||
.map:
|
||||
stdcall safe_map_page, [process], [req_access], [ofs]
|
||||
stdcall safe_map_page, [slot], [req_access], [ofs]
|
||||
jnc .exit
|
||||
add [count], PAGE_SIZE
|
||||
add [ofs], PAGE_SIZE
|
||||
@@ -757,7 +758,7 @@ proc map_mem_ipc stdcall, lin_addr:dword,thread:dword,\
|
||||
ret
|
||||
endp
|
||||
|
||||
proc map_memEx stdcall, lin_addr:dword,thread:dword,\
|
||||
proc map_memEx stdcall, lin_addr:dword,slot:dword,\
|
||||
ofs:dword,buf_size:dword,req_access:dword
|
||||
locals
|
||||
count dd ?
|
||||
@@ -768,8 +769,9 @@ proc map_memEx stdcall, lin_addr:dword,thread:dword,\
|
||||
cmp [buf_size], 0
|
||||
jz .exit
|
||||
|
||||
mov eax, [thread]
|
||||
mov eax, [eax + APPDATA.process]
|
||||
mov eax, [slot]
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + eax + APPDATA.process]
|
||||
test eax, eax
|
||||
jz .exit
|
||||
|
||||
@@ -793,7 +795,7 @@ proc map_memEx stdcall, lin_addr:dword,thread:dword,\
|
||||
shr edx, 12
|
||||
and edx, 0x3FF
|
||||
.map:
|
||||
stdcall safe_map_page, [process], [req_access], [ofs]
|
||||
stdcall safe_map_page, [slot], [req_access], [ofs]
|
||||
jnc .exit
|
||||
add [count], PAGE_SIZE
|
||||
add [ofs], PAGE_SIZE
|
||||
@@ -824,7 +826,7 @@ endp
|
||||
; in: edi = linear address to map
|
||||
; out: CF cleared <=> failed
|
||||
; destroys: only eax
|
||||
proc safe_map_page stdcall, process:dword, req_access:dword, ofs:dword
|
||||
proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
||||
mov eax, [esi + edx*4]
|
||||
test al, PG_READ
|
||||
jz .not_present
|
||||
@@ -859,7 +861,9 @@ proc safe_map_page stdcall, process:dword, req_access:dword, ofs:dword
|
||||
cli
|
||||
cld
|
||||
push ebx ecx
|
||||
mov eax, [process]
|
||||
mov eax, [slot]
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + eax + APPDATA.process]
|
||||
mov eax, [eax + PROC.dlls_list_ptr]
|
||||
test eax, eax
|
||||
jz .no_hdll
|
||||
@@ -949,7 +953,7 @@ sys_IPC:
|
||||
|
||||
proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
||||
locals
|
||||
dst_thread dd ?
|
||||
dst_slot dd ?
|
||||
dst_offset dd ?
|
||||
buf_size dd ?
|
||||
used_buf dd ?
|
||||
@@ -959,12 +963,13 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
||||
cli
|
||||
|
||||
mov eax, [PID]
|
||||
call pid_to_thread
|
||||
call pid_to_slot
|
||||
test eax, eax
|
||||
jz .no_pid
|
||||
|
||||
mov [dst_thread], eax
|
||||
mov edi, [eax + APPDATA.ipc_start] ;is ipc area defined?
|
||||
mov [dst_slot], eax
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
mov edi, [SLOT_BASE + eax + APPDATA.ipc_start] ;is ipc area defined?
|
||||
test edi, edi
|
||||
jz .no_ipc_area
|
||||
|
||||
@@ -972,7 +977,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
||||
and ebx, 0xFFF
|
||||
mov [dst_offset], ebx
|
||||
|
||||
mov esi, [eax + APPDATA.ipc_size]
|
||||
mov esi, [SLOT_BASE + eax + APPDATA.ipc_size]
|
||||
mov [buf_size], esi
|
||||
|
||||
mov ecx, [ipc_tmp]
|
||||
@@ -985,7 +990,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
||||
pop edi esi
|
||||
@@:
|
||||
mov [used_buf], ecx
|
||||
stdcall map_mem_ipc, ecx, [dst_thread], \
|
||||
stdcall map_mem_ipc, ecx, [dst_slot], \
|
||||
edi, esi, PG_SWR
|
||||
|
||||
mov edi, [dst_offset]
|
||||
@@ -1034,8 +1039,9 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
||||
mov [page_tabs + ebx*4], eax
|
||||
invlpg [edx]
|
||||
|
||||
mov eax, [dst_thread]
|
||||
or [eax + APPDATA.occurred_events], EVENT_IPC
|
||||
mov eax, [dst_slot]
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
or [SLOT_BASE + eax + APPDATA.occurred_events], EVENT_IPC
|
||||
push 0
|
||||
jmp .ret
|
||||
.no_pid:
|
||||
@@ -1397,9 +1403,7 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
||||
mov [page_tabs + edi], eax
|
||||
mov [page_tabs + edi + edx], eax
|
||||
invlpg [ebx]
|
||||
add ebx, [size]
|
||||
invlpg [ebx] ; the mirror half
|
||||
sub ebx, [size]
|
||||
invlpg [ebx+0x10000]
|
||||
add eax, 0x1000
|
||||
add ebx, 0x1000
|
||||
add edi, 4
|
||||
@@ -1418,62 +1422,6 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
; Same as create_ring_buffer, but from non-contiguous pages.
|
||||
; Not for DMA. Free with kernel_free.
|
||||
align 4
|
||||
proc create_ring_buffer_sparse stdcall, size:dword, flags:dword
|
||||
locals
|
||||
buf_ptr dd ?
|
||||
endl
|
||||
|
||||
mov eax, [size]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
add eax, eax
|
||||
stdcall alloc_kernel_space, eax
|
||||
test eax, eax
|
||||
jz .fail
|
||||
mov [buf_ptr], eax
|
||||
|
||||
push ebx esi edi
|
||||
mov ebx, eax ; page being mapped
|
||||
mov esi, [size] ; distance to its mirror
|
||||
mov edi, esi
|
||||
shr edi, 12 ; pages left
|
||||
.page:
|
||||
call alloc_page
|
||||
test eax, eax
|
||||
jz .mm_fail
|
||||
or eax, [flags]
|
||||
mov edx, ebx
|
||||
shr edx, 12
|
||||
mov [page_tabs + edx*4], eax
|
||||
invlpg [ebx]
|
||||
lea edx, [ebx + esi]
|
||||
shr edx, 12
|
||||
mov [page_tabs + edx*4], eax
|
||||
invlpg [ebx + esi]
|
||||
add ebx, PAGE_SIZE
|
||||
dec edi
|
||||
jnz .page
|
||||
|
||||
mov eax, [buf_ptr]
|
||||
pop edi esi ebx
|
||||
ret
|
||||
|
||||
.mm_fail:
|
||||
mov eax, [buf_ptr]
|
||||
mov ecx, [size]
|
||||
shr ecx, 11 ; both halves, in pages
|
||||
call release_pages
|
||||
stdcall free_kernel_space, [buf_ptr]
|
||||
pop edi esi ebx
|
||||
xor eax, eax
|
||||
.fail:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc print_mem
|
||||
|
||||
@@ -139,13 +139,14 @@ do_change_task:
|
||||
mov eax, [xsave_eax]
|
||||
mov edx, [xsave_edx]
|
||||
xsave [ecx]
|
||||
mov ecx, [current_slot]
|
||||
mov ecx, [current_slot_idx]
|
||||
mov [fpu_owner], ecx
|
||||
mov ecx, [current_slot]
|
||||
mov ecx, [ecx + APPDATA.fpu_state]
|
||||
xrstor [ecx]
|
||||
.no_xsave:
|
||||
; set CR0.TS
|
||||
cmp ebx, [fpu_owner] ;ebx == incoming task (new)
|
||||
cmp bh, byte[fpu_owner] ;bh == incoming task (new)
|
||||
clts ;clear a task switch flag
|
||||
je @f
|
||||
mov eax, cr0 ;and set it again if the owner
|
||||
|
||||
+16
-19
@@ -165,7 +165,7 @@ exc_c: ; exceptions (all but 7th - #NM)
|
||||
jnz IRetToUserHook
|
||||
@@:
|
||||
cli
|
||||
mov eax, [esi + APPDATA.debugger_thread]
|
||||
mov eax, [esi + APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jnz .debug
|
||||
; not debuggee => say error and terminate
|
||||
@@ -514,30 +514,28 @@ destroy_thread:
|
||||
@@:
|
||||
mov eax, [esi + APPOBJ.fd]
|
||||
test eax, eax
|
||||
jz @f
|
||||
jz @F
|
||||
|
||||
cmp eax, esi
|
||||
je @f
|
||||
je @F
|
||||
|
||||
push esi
|
||||
call [eax + APPOBJ.destroy]
|
||||
DEBUGF 1,"%s",msg_obj_destroy
|
||||
pop esi
|
||||
jmp @b
|
||||
jmp @B
|
||||
@@:
|
||||
mov esi, [.slot]
|
||||
shl esi, BSF sizeof.APPDATA
|
||||
add esi, SLOT_BASE
|
||||
cmp [fpu_owner], esi ; if user fpu last -> fpu user = 2
|
||||
jne @f
|
||||
jne @F
|
||||
|
||||
mov [fpu_owner], APPDATA_OS_THREAD
|
||||
mov eax, [APPDATA_OS_THREAD + APPDATA.fpu_state]
|
||||
mov [fpu_owner], 2
|
||||
mov eax, [SLOT_BASE + sizeof.APPDATA*2 + APPDATA.fpu_state]
|
||||
clts
|
||||
bt [cpu_caps], CAPS_SSE
|
||||
jnc .no_SSE
|
||||
fxrstor [eax]
|
||||
jmp @f
|
||||
jmp @F
|
||||
.no_SSE:
|
||||
fnclex
|
||||
frstor [eax]
|
||||
@@ -546,8 +544,8 @@ destroy_thread:
|
||||
mov [KEY_COUNT], byte 0 ; empty keyboard buffer
|
||||
mov [BTN_COUNT], byte 0 ; empty button buffer
|
||||
|
||||
|
||||
; remove defined hotkeys
|
||||
mov esi, [.slot]
|
||||
mov eax, hotkey_list
|
||||
.loop:
|
||||
cmp [eax+8], esi
|
||||
@@ -640,7 +638,7 @@ destroy_thread:
|
||||
pushad
|
||||
mov edi, esi
|
||||
shl edi, BSF sizeof.APPDATA
|
||||
mov eax, [SLOT_BASE + edi + APPDATA.debugger_thread]
|
||||
mov eax, [SLOT_BASE + edi + APPDATA.debugger_slot]
|
||||
test eax, eax
|
||||
jz .nodebug
|
||||
movi ecx, 8
|
||||
@@ -668,12 +666,12 @@ destroy_thread:
|
||||
add edi, SLOT_BASE
|
||||
|
||||
mov eax, [edi + APPDATA.io_map]
|
||||
cmp eax, [APPDATA_IDLE_THREAD + APPDATA.io_map]
|
||||
cmp eax, [SLOT_BASE + sizeof.APPDATA+APPDATA.io_map]
|
||||
je @F
|
||||
call free_page
|
||||
@@:
|
||||
mov eax, [edi+APPDATA.io_map+4]
|
||||
cmp eax, [APPDATA_IDLE_THREAD + APPDATA.io_map+4]
|
||||
cmp eax, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4]
|
||||
je @F
|
||||
call free_page
|
||||
@@:
|
||||
@@ -714,12 +712,12 @@ destroy_thread:
|
||||
call free_cd_channel
|
||||
and [cd_status], 0
|
||||
@@:
|
||||
pop esi
|
||||
cmp [bgrlockpid], esi
|
||||
jnz @f
|
||||
and [bgrlockpid], 0
|
||||
and [bgrlock], 0
|
||||
@@:
|
||||
pop esi
|
||||
|
||||
pusha ; remove all port reservations
|
||||
mov edx, esi
|
||||
@@ -780,15 +778,14 @@ destroy_thread:
|
||||
|
||||
mov edi, esi ; do not run this process slot
|
||||
shl edi, BSF sizeof.APPDATA
|
||||
add edi, SLOT_BASE
|
||||
mov [edi + APPDATA.state], TSTATE_FREE
|
||||
mov [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE
|
||||
; debugger test - terminate all debuggees
|
||||
mov eax, 2
|
||||
mov ecx, APPDATA_OS_THREAD + APPDATA.debugger_thread
|
||||
mov ecx, SLOT_BASE + 2*sizeof.APPDATA + APPDATA.debugger_slot
|
||||
.xd0:
|
||||
cmp eax, [thread_count]
|
||||
ja .xd1
|
||||
cmp dword [ecx], edi
|
||||
cmp dword [ecx], esi
|
||||
jnz @f
|
||||
and dword [ecx], 0
|
||||
pushad
|
||||
|
||||
@@ -537,21 +537,21 @@ pid_to_slot:
|
||||
align 4
|
||||
proc read_process_memory
|
||||
;Input:
|
||||
; eax - process thread
|
||||
; eax - process slot
|
||||
; ecx - buffer address
|
||||
; edx - buffer size
|
||||
; esi - start address in other process
|
||||
;Output:
|
||||
; eax - number of bytes read.
|
||||
locals
|
||||
thread dd ?
|
||||
slot dd ?
|
||||
buff dd ?
|
||||
r_count dd ?
|
||||
offset dd ?
|
||||
tmp_r_cnt dd ?
|
||||
endl
|
||||
|
||||
mov [thread], eax
|
||||
mov [slot], eax
|
||||
mov [buff], ecx
|
||||
and [r_count], 0
|
||||
mov [tmp_r_cnt], edx
|
||||
@@ -577,7 +577,7 @@ proc read_process_memory
|
||||
|
||||
push ecx
|
||||
stdcall map_memEx, [proc_mem_map], \
|
||||
[thread], ebx, ecx, PG_READ
|
||||
[slot], ebx, ecx, PG_READ
|
||||
pop ecx
|
||||
|
||||
mov esi, [offset]
|
||||
@@ -607,7 +607,7 @@ endp
|
||||
align 4
|
||||
proc write_process_memory
|
||||
;Input:
|
||||
; eax - process thread
|
||||
; eax - process slot
|
||||
; ecx - buffer address
|
||||
; edx - buffer size
|
||||
; esi - start address in other process
|
||||
@@ -615,14 +615,14 @@ proc write_process_memory
|
||||
; eax - number of bytes written
|
||||
|
||||
locals
|
||||
thread dd ?
|
||||
slot dd ?
|
||||
buff dd ?
|
||||
w_count dd ?
|
||||
offset dd ?
|
||||
tmp_w_cnt dd ?
|
||||
endl
|
||||
|
||||
mov [thread], eax
|
||||
mov [slot], eax
|
||||
mov [buff], ecx
|
||||
and [w_count], 0
|
||||
mov [tmp_w_cnt], edx
|
||||
@@ -647,7 +647,7 @@ proc write_process_memory
|
||||
mov ebx, [offset]
|
||||
push ecx
|
||||
stdcall map_memEx, [proc_mem_map], \
|
||||
[thread], ebx, ecx, PG_SWR
|
||||
[slot], ebx, ecx, PG_SWR
|
||||
pop ecx
|
||||
|
||||
mov edi, [offset]
|
||||
@@ -906,7 +906,7 @@ common_app_entry:
|
||||
stdcall free_kernel_space, [ebp+APP_HDR.img_base]
|
||||
stdcall kernel_free, ebp
|
||||
mov ebx, [current_slot]
|
||||
cmp [ebx + APPDATA.debugger_thread], 0
|
||||
cmp [ebx + APPDATA.debugger_slot], 0
|
||||
je .exit
|
||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||
@@ -1054,8 +1054,8 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
||||
; set if debuggee
|
||||
test byte [flags], 1
|
||||
jz .no_debug
|
||||
mov eax, [current_slot]
|
||||
mov [SLOT_BASE + ebx + APPDATA.debugger_thread], eax
|
||||
mov eax, [current_slot_idx]
|
||||
mov [SLOT_BASE + ebx + APPDATA.debugger_slot], eax
|
||||
.no_debug:
|
||||
mov [SLOT_BASE + ebx + APPDATA.state], dl
|
||||
lea edx, [SLOT_BASE + ebx]
|
||||
@@ -1074,24 +1074,27 @@ get_curr_slot:
|
||||
mov eax, [current_slot]
|
||||
ret
|
||||
|
||||
; @brief Get pointer to APPDATA by PID
|
||||
; @param eax - TID of thread
|
||||
; @return eax - 0 - not found or pointer on APPDATA
|
||||
pid_to_thread:
|
||||
pid_to_appdata:
|
||||
;Input:
|
||||
; eax - pid of process
|
||||
;Output:
|
||||
; eax - 0 - not found or pointer on APPDATA
|
||||
push ebx
|
||||
push ecx
|
||||
mov ebx, [thread_count]
|
||||
shl ebx, BSF sizeof.APPDATA ; multiply by size
|
||||
; skip first process in the task table
|
||||
mov ecx, APPDATA_IDLE_THREAD
|
||||
mov ecx, SLOT_BASE
|
||||
add ebx, ecx
|
||||
.loop:
|
||||
add ecx, sizeof.APPDATA
|
||||
cmp [ecx + APPDATA.state], TSTATE_FREE
|
||||
jz @f ;skip empty slots
|
||||
cmp [ecx + APPDATA.tid], eax
|
||||
jz .pid_found
|
||||
@@:
|
||||
add ecx, sizeof.APPDATA
|
||||
dec ebx
|
||||
jnz .loop
|
||||
cmp ecx, ebx
|
||||
jb .loop
|
||||
|
||||
pop ecx
|
||||
pop ebx
|
||||
|
||||
@@ -48,7 +48,7 @@ endg
|
||||
|
||||
; This internal function acquires the lock for the global list.
|
||||
lock_timer_list:
|
||||
mov edx, [current_slot]
|
||||
mov edx, [current_slot_idx]
|
||||
@@:
|
||||
xor eax, eax
|
||||
lock cmpxchg [timer_list_owner], edx
|
||||
|
||||
@@ -4148,7 +4148,6 @@ Structure of block of data for folder entry (BDFE):
|
||||
and after archiving this bit is cleared - it can be useful
|
||||
for automatically creating of backup-archives as at writing
|
||||
this bit is usually set
|
||||
* bit 6 (mask 0x40): this is a symbolic link (currently only set by the ext driver).
|
||||
* +4: dword: encoding, equals to field +8 in the information structure
|
||||
* +8: 4*byte: time of file creation
|
||||
* +12 = +0xC: 4*byte: date of file creation
|
||||
|
||||
@@ -212,7 +212,6 @@ DIR_DIRECTORY = 2
|
||||
DIR_SYMLINK = 7
|
||||
KOS_HIDDEN = 2
|
||||
KOS_DIRECTORY = 10h
|
||||
KOS_SYMLINK = 40h
|
||||
READ_ONLY = 1
|
||||
SYMLINK_MAX_DEPTH = 40
|
||||
FAST_SYMLINK_MAX_SIZE = 60
|
||||
@@ -3393,11 +3392,6 @@ ext_ReadFolder:
|
||||
stosd
|
||||
mov eax, [esi+INODE.fileSizeHigh]
|
||||
stosd
|
||||
movzx eax, [esi+INODE.accessMode]
|
||||
and eax, TYPE_MASK
|
||||
cmp eax, FLAG_SYMLINK
|
||||
jne @f
|
||||
or dword [edx], KOS_SYMLINK
|
||||
@@:
|
||||
mov esi, [esp+12]
|
||||
movzx ecx, [esi+DIRENTRY.nameLength]
|
||||
|
||||
@@ -193,8 +193,7 @@ align 4
|
||||
;--------------------------------------
|
||||
align 4
|
||||
@@:
|
||||
mov eax, [current_slot]
|
||||
mov eax, [eax + APPDATA.tid]
|
||||
mov eax, [current_slot_idx]
|
||||
mov [bgrlockpid], eax
|
||||
cmp [img_background], static_background_data
|
||||
jz .nomem
|
||||
@@ -242,8 +241,7 @@ nosb6:
|
||||
jnz nosb7
|
||||
cmp [bgrlock], 0
|
||||
jz .err
|
||||
mov eax, [current_slot]
|
||||
mov eax, [eax + APPDATA.tid]
|
||||
mov eax, [current_slot_idx]
|
||||
cmp [bgrlockpid], eax
|
||||
jnz .err
|
||||
mov eax, ecx
|
||||
|
||||
@@ -1997,8 +1997,6 @@ align 4
|
||||
; esi - slot
|
||||
push eax ecx edx esi
|
||||
xchg eax, esi
|
||||
shl eax, BSF sizeof.APPDATA
|
||||
add eax, SLOT_BASE
|
||||
lea ecx, [esp + 12]
|
||||
mov edx, 1
|
||||
call read_process_memory
|
||||
|
||||
+18
-17
@@ -55,6 +55,7 @@ launcher_start db 1
|
||||
endg
|
||||
|
||||
max_processes = 255
|
||||
tss_step = 128 + 8192 ; tss & i/o - 65535 ports, * 256=557056*4
|
||||
|
||||
os_stack = os_data_l - gdts ; GDTs
|
||||
os_code = os_code_l - gdts
|
||||
@@ -388,7 +389,7 @@ high_code:
|
||||
mov edi, tss._io_map_0
|
||||
xor eax, eax
|
||||
not eax
|
||||
mov ecx, IO_MAP_SIZE/4
|
||||
mov ecx, 8192/4
|
||||
rep stosd ; access to 4096*8=65536 ports
|
||||
|
||||
mov ax, tss0
|
||||
@@ -409,7 +410,7 @@ high_code:
|
||||
stdcall alloc_kernel_space, 0x50000 ; FIXME check size
|
||||
mov [default_io_map], eax
|
||||
|
||||
add eax, IO_MAP_SIZE
|
||||
add eax, 0x2000
|
||||
mov [ipc_tmp], eax
|
||||
mov ebx, 0x1000
|
||||
|
||||
@@ -534,7 +535,7 @@ high_code:
|
||||
dec ecx
|
||||
jns @b
|
||||
|
||||
mov edx, APPDATA_IDLE_THREAD
|
||||
mov edx, SLOT_BASE + sizeof.APPDATA*1
|
||||
mov ebx, [os_stack_seg]
|
||||
add ebx, RING0_STACK_SIZE
|
||||
add ebx, [xsave_area_size]
|
||||
@@ -546,7 +547,7 @@ high_code:
|
||||
mov ecx, IDLE_PRIORITY
|
||||
call scheduler_add_thread
|
||||
|
||||
mov edx, APPDATA_OS_THREAD
|
||||
mov edx, SLOT_BASE + sizeof.APPDATA*2
|
||||
mov ebx, [os_stack_seg]
|
||||
call setup_os_slot
|
||||
mov dword [edx], 'OS'
|
||||
@@ -555,7 +556,7 @@ high_code:
|
||||
|
||||
mov [current_slot_idx], 2
|
||||
mov [thread_count], 2
|
||||
mov [current_slot], APPDATA_OS_THREAD
|
||||
mov [current_slot], SLOT_BASE + sizeof.APPDATA*2
|
||||
|
||||
; Move other CPUs to deep sleep, if it is useful
|
||||
uglobal
|
||||
@@ -847,15 +848,15 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
||||
call reserve_irqs_ports
|
||||
|
||||
mov [SLOT_BASE + APPDATA.window], window_data
|
||||
mov [APPDATA_IDLE_THREAD + APPDATA.window], background_window
|
||||
mov [APPDATA_OS_THREAD + APPDATA.window], window_data + sizeof.WDATA*2
|
||||
mov [SLOT_BASE + sizeof.APPDATA + APPDATA.window], window_data + sizeof.WDATA
|
||||
mov [SLOT_BASE + sizeof.APPDATA*2 + APPDATA.window], window_data + sizeof.WDATA*2
|
||||
mov [window_data + WDATA.thread], SLOT_BASE
|
||||
mov [background_window + WDATA.thread], APPDATA_IDLE_THREAD
|
||||
mov [window_data + sizeof.WDATA*2 + WDATA.thread], APPDATA_OS_THREAD
|
||||
mov [window_data + sizeof.WDATA + WDATA.thread], SLOT_BASE + sizeof.APPDATA
|
||||
mov [window_data + sizeof.WDATA*2 + WDATA.thread], SLOT_BASE + sizeof.APPDATA*2
|
||||
|
||||
call init_display
|
||||
mov eax, [def_cursor]
|
||||
mov [background_window + WDATA.cursor], eax
|
||||
mov [window_data + sizeof.WDATA + WDATA.cursor], eax
|
||||
mov [window_data + sizeof.WDATA*2 + WDATA.cursor], eax
|
||||
|
||||
; PRINT CPU FREQUENCY
|
||||
@@ -952,14 +953,14 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
||||
; Protect I/O permission map
|
||||
|
||||
mov esi, [default_io_map]
|
||||
stdcall map_page, esi, [APPDATA_IDLE_THREAD + APPDATA.io_map], PG_READ
|
||||
stdcall map_page, esi, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map], PG_READ
|
||||
add esi, 0x1000
|
||||
stdcall map_page, esi, [APPDATA_IDLE_THREAD + APPDATA.io_map + 4], PG_READ
|
||||
stdcall map_page, esi, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4], PG_READ
|
||||
|
||||
stdcall map_page, tss._io_map_0, \
|
||||
[APPDATA_IDLE_THREAD + APPDATA.io_map], PG_READ
|
||||
[SLOT_BASE + sizeof.APPDATA + APPDATA.io_map], PG_READ
|
||||
stdcall map_page, tss._io_map_1, \
|
||||
[APPDATA_IDLE_THREAD + APPDATA.io_map + 4], PG_READ
|
||||
[SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4], PG_READ
|
||||
|
||||
; SET KEYBOARD PARAMETERS
|
||||
mov al, 0xf6 ; reset keyboard, scan enabled
|
||||
@@ -1864,7 +1865,7 @@ sysfn_shutdown: ; 18.9 = system shutdown
|
||||
; out: Z/z -- is/not kernel thread
|
||||
is_kernel_thread:
|
||||
mov eax, [eax + APPDATA.process]
|
||||
cmp eax, [APPDATA_OS_THREAD + APPDATA.process] ; OS
|
||||
cmp eax, [SLOT_BASE + 2*sizeof.APPDATA + APPDATA.process] ; OS
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
sysfn_terminate: ; 18.2 = TERMINATE
|
||||
@@ -2064,7 +2065,7 @@ sysfn_zmodif:
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
sysfn_getidletime: ; 18.4 = GET IDLETIME
|
||||
mov eax, [APPDATA_IDLE_THREAD + APPDATA.cpu_usage]
|
||||
mov eax, [SLOT_BASE + sizeof.APPDATA + APPDATA.cpu_usage]
|
||||
mov [esp + SYSCALL_STACK.eax], eax
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
@@ -2824,7 +2825,7 @@ no_mark_system_shutdown:
|
||||
align 4
|
||||
noshutdown:
|
||||
mov eax, [thread_count] ; termination
|
||||
mov ebx, APPDATA_IDLE_THREAD + APPDATA.state
|
||||
mov ebx, SLOT_BASE + sizeof.APPDATA + APPDATA.state
|
||||
mov esi, 1
|
||||
;--------------------------------------
|
||||
align 4
|
||||
|
||||
@@ -83,31 +83,6 @@ macro arp_init {
|
||||
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------------;
|
||||
; ;
|
||||
; arp_clear_device: Empty the ARP table and counters of a removed ;
|
||||
; device. ;
|
||||
; ;
|
||||
; IN: edi = device number * 4 ;
|
||||
; ;
|
||||
;-----------------------------------------------------------------;
|
||||
macro arp_clear_device {
|
||||
|
||||
xor eax, eax
|
||||
mov [ARP_entries + edi], eax
|
||||
mov [ARP_packets_tx + edi], eax
|
||||
mov [ARP_packets_rx + edi], eax
|
||||
mov [ARP_conflicts + edi], eax
|
||||
|
||||
push edi
|
||||
imul edi, (ARP_TABLE_SIZE * sizeof.ARP_entry)/4
|
||||
add edi, ARP_table
|
||||
mov ecx, (ARP_TABLE_SIZE * sizeof.ARP_entry)/2
|
||||
rep stosw
|
||||
pop edi
|
||||
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------------;
|
||||
; ;
|
||||
; arp_decrease_entry_ttls ;
|
||||
@@ -338,9 +313,6 @@ arp_output_request:
|
||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_output_request: ip=%u.%u.%u.%u device=0x%x\n",\
|
||||
[esp]:1, [esp + 1]:1, [esp + 2]:1, [esp + 3]:1, ebx
|
||||
|
||||
test ebx, ebx ; device is gone
|
||||
jz .exit
|
||||
|
||||
mov ax, ETHER_PROTO_ARP
|
||||
mov ecx, sizeof.ARP_header
|
||||
mov edx, ETH_BROADCAST ; broadcast mac
|
||||
|
||||
@@ -105,29 +105,6 @@ macro ipv4_init {
|
||||
}
|
||||
|
||||
|
||||
;-----------------------------------------------------------------;
|
||||
; ;
|
||||
; ipv4_clear_device: Reset the IPv4 settings of a removed device, ;
|
||||
; so no route points to it anymore. ;
|
||||
; ;
|
||||
; IN: edi = device number * 4 ;
|
||||
; ;
|
||||
;-----------------------------------------------------------------;
|
||||
macro ipv4_clear_device {
|
||||
|
||||
xor eax, eax
|
||||
mov [IPv4_address + edi], eax
|
||||
mov [IPv4_subnet + edi], eax
|
||||
mov [IPv4_nameserver + edi], eax
|
||||
mov [IPv4_gateway + edi], eax
|
||||
mov [IPv4_broadcast + edi], eax
|
||||
mov [IPv4_packets_tx + edi], eax
|
||||
mov [IPv4_packets_rx + edi], eax
|
||||
mov [IPv4_packets_dumped + edi], eax
|
||||
|
||||
}
|
||||
|
||||
|
||||
;-----------------------------------------------------------------;
|
||||
; ;
|
||||
; Decrease TimeToLive of all fragment slots ;
|
||||
@@ -780,8 +757,6 @@ ipv4_output_raw:
|
||||
push esi eax
|
||||
|
||||
call ipv4_route
|
||||
test eax, eax
|
||||
jz .arp_error
|
||||
call arp_ip_to_mac
|
||||
|
||||
test eax, 0xffff0000 ; error bits
|
||||
@@ -992,8 +967,6 @@ ipv4_route:
|
||||
; Check for on-link
|
||||
xor edi, edi
|
||||
.loop:
|
||||
cmp [net_device_list + edi], 0 ; skip slots without a device
|
||||
je .next
|
||||
mov ebx, [IPv4_address + edi]
|
||||
and ebx, [IPv4_subnet + edi]
|
||||
jz .next
|
||||
@@ -1010,10 +983,7 @@ ipv4_route:
|
||||
mov edi, 4 ; skip loopback device
|
||||
.loop_gw:
|
||||
cmp [IPv4_gateway + edi], 0
|
||||
je .next_gw
|
||||
cmp [net_device_list + edi], 0
|
||||
jne .found_gw
|
||||
.next_gw:
|
||||
add edi, 4
|
||||
cmp edi, 4*NET_DEVICES_MAX
|
||||
jb .loop_gw
|
||||
@@ -1079,23 +1049,14 @@ ipv4_route:
|
||||
cmp eax, 0xffffffff
|
||||
je @f
|
||||
|
||||
; An interface without an address (DHCP not done yet, or the lease
|
||||
; dropped when the link went down) can send nothing but broadcasts: with
|
||||
; address and mask both zero every destination compared as on-link, and
|
||||
; the stack went asking ARP for internet addresses on behalf of 0.0.0.0.
|
||||
test edx, edx
|
||||
jz .fail
|
||||
|
||||
; Check if we should route to gateway or not
|
||||
mov ebx, edx
|
||||
mov ebx, [IPv4_address + edi]
|
||||
and ebx, [IPv4_subnet + edi]
|
||||
mov ecx, eax
|
||||
and ecx, [IPv4_subnet + edi]
|
||||
cmp ecx, ebx
|
||||
je @f
|
||||
mov eax, [IPv4_gateway + edi]
|
||||
test eax, eax
|
||||
jz .fail ; off-link and no gateway
|
||||
@@:
|
||||
DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_route: %u\n", edi
|
||||
ret
|
||||
|
||||
@@ -61,41 +61,6 @@ macro eth_init {
|
||||
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------------;
|
||||
; ;
|
||||
; eth_clear_device: Drop the frames of a removed device that are ;
|
||||
; still waiting in the input queue, their ;
|
||||
; NET_BUFF.device will not be valid anymore. ;
|
||||
; ;
|
||||
; IN: ebx = device ptr ;
|
||||
; ;
|
||||
;-----------------------------------------------------------------;
|
||||
macro eth_clear_device {
|
||||
|
||||
local .loop, .done
|
||||
|
||||
spin_lock_irqsave
|
||||
mov esi, [ETH_frame_head]
|
||||
.loop:
|
||||
cmp esi, ETH_frame_head
|
||||
je .done
|
||||
mov eax, esi
|
||||
mov esi, [esi + NET_BUFF.NextPtr]
|
||||
cmp [eax + NET_BUFF.device], ebx
|
||||
jne .loop
|
||||
|
||||
; unlink it, ETH_frame_head/tail double as the NextPtr/PrevPtr of the list head
|
||||
mov ecx, [eax + NET_BUFF.PrevPtr]
|
||||
mov [ecx + NET_BUFF.NextPtr], esi
|
||||
mov [esi + NET_BUFF.PrevPtr], ecx
|
||||
dec [ETH_frame_queued]
|
||||
stdcall net_buff_free, eax
|
||||
jmp .loop
|
||||
.done:
|
||||
spin_unlock_irqrestore
|
||||
|
||||
}
|
||||
|
||||
align 4
|
||||
; This function is called by ethernet drivers.
|
||||
; Push the received ethernet packet onto the ethernet input queue.
|
||||
@@ -280,9 +245,6 @@ eth_output:
|
||||
|
||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx
|
||||
|
||||
test ebx, ebx
|
||||
jz .no_device
|
||||
|
||||
cmp ecx, [ebx + ETH_DEVICE.mtu]
|
||||
ja .too_large
|
||||
|
||||
@@ -333,16 +295,11 @@ eth_output:
|
||||
ret
|
||||
|
||||
.too_large:
|
||||
inc [ebx + NET_DEVICE.packets_tx_err]
|
||||
inc [eax + NET_DEVICE.packets_tx_err]
|
||||
DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: Packet too large!\n"
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
.no_device:
|
||||
DEBUGF DEBUG_NETWORK_ERROR, "ETH_output: no device!\n"
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;-----------------------------------------------------------------;
|
||||
|
||||
@@ -198,10 +198,6 @@ ends
|
||||
|
||||
SOCKET_STRUCT_SIZE = 4096 ; in bytes
|
||||
|
||||
if sizeof.STREAM_SOCKET > SOCKET_STRUCT_SIZE
|
||||
err "STREAM_SOCKET does not fit in SOCKET_STRUCT_SIZE"
|
||||
end if
|
||||
|
||||
SOCKET_QUEUE_SIZE = 10 ; maximum number of incoming packets queued for 1 socket
|
||||
; the incoming packet queue for sockets is placed in the socket struct itself, at this location from start
|
||||
SOCKET_QUEUE_LOCATION = (SOCKET_STRUCT_SIZE - SOCKET_QUEUE_SIZE*sizeof.socket_queue_entry - sizeof.queue)
|
||||
@@ -1651,7 +1647,7 @@ socket_ring_create:
|
||||
mov esi, eax
|
||||
|
||||
push edx
|
||||
stdcall create_ring_buffer_sparse, SOCKET_BUFFER_SIZE, PG_SWR
|
||||
stdcall create_ring_buffer, SOCKET_BUFFER_SIZE, PG_SWR
|
||||
pop edx
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
@@ -597,16 +597,6 @@ net_remove_device:
|
||||
mov dword [edi-4], eax
|
||||
dec [net_device_count]
|
||||
|
||||
;-----------------------------------------------------------------
|
||||
; Forget everything the protocols still know about this interface.
|
||||
; Otherwise its IP address keeps matching in ipv4_route, and output
|
||||
; ends up calling through the now empty net_device_list slot.
|
||||
|
||||
sub edi, net_device_list + 4 ; device number * 4
|
||||
ipv4_clear_device
|
||||
arp_clear_device
|
||||
eth_clear_device
|
||||
|
||||
call net_send_event
|
||||
|
||||
xor eax, eax
|
||||
|
||||
@@ -1422,14 +1422,10 @@ endl
|
||||
test [edx + TCP_header.Flags], TH_ACK
|
||||
jz .drop
|
||||
|
||||
push ebx
|
||||
lea ecx, [ebx + SOCKET.mutex]
|
||||
call mutex_unlock
|
||||
pop eax
|
||||
|
||||
mov eax, ebx
|
||||
mov ebx, ECONNREFUSED
|
||||
call tcp_drop
|
||||
jmp .drop_no_socket
|
||||
jmp .drop
|
||||
@@:
|
||||
|
||||
;-----------------------------------------------------------------------------------
|
||||
|
||||
@@ -234,25 +234,23 @@ endl
|
||||
mov ebx, TCP_max_win
|
||||
shl ebx, cl
|
||||
pop ecx
|
||||
|
||||
; Clamp to available window first, then subtract what the peer already knows (as in BSD)
|
||||
|
||||
cmp ebx, ecx
|
||||
jbe @f
|
||||
mov ebx, ecx
|
||||
@@:
|
||||
sub ebx, [eax + TCP_SOCKET.RCV_ADV]
|
||||
add ebx, [eax + TCP_SOCKET.RCV_NXT]
|
||||
|
||||
cmp ebx, ecx
|
||||
jl @f
|
||||
mov ebx, ecx
|
||||
@@:
|
||||
|
||||
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: we can increase window by %d bytes\n", ebx
|
||||
|
||||
mov edi, [eax + TCP_SOCKET.t_maxseg]
|
||||
shl edi, 1
|
||||
cmp ebx, edi ; signed: may be negative if window shrank
|
||||
jge .send
|
||||
cmp ebx, edi
|
||||
jae .send
|
||||
|
||||
cmp ebx, SOCKET_BUFFER_SIZE/2
|
||||
jge .send
|
||||
jae .send
|
||||
|
||||
.no_window:
|
||||
|
||||
|
||||
@@ -180,8 +180,6 @@ tcp_connect:
|
||||
|
||||
.nomem:
|
||||
pop edx eax
|
||||
lea ecx, [eax + SOCKET.mutex]
|
||||
call mutex_unlock
|
||||
xor eax, eax
|
||||
dec eax
|
||||
mov ebx, ENOMEM
|
||||
@@ -196,8 +194,6 @@ tcp_connect:
|
||||
.enoroute:
|
||||
pop eax
|
||||
popa
|
||||
lea ecx, [eax + SOCKET.mutex]
|
||||
call mutex_unlock
|
||||
xor eax, eax
|
||||
dec eax
|
||||
mov ebx, EADDRNOTAVAIL
|
||||
|
||||
@@ -148,10 +148,9 @@ ReadNoteByte:
|
||||
push esi
|
||||
|
||||
mov eax, [pidProcessNote]
|
||||
call pid_to_thread
|
||||
call pid_to_slot
|
||||
test eax, eax
|
||||
jz .failed
|
||||
|
||||
lea ecx, [esp+12]
|
||||
mov edx, 1
|
||||
mov esi, [memAdrNote]
|
||||
|
||||
+1
-1
Submodule programs/cmm updated: 86b0211da7...4678e1605d.
@@ -238,6 +238,7 @@ BEGIN
|
||||
m.active := FALSE;
|
||||
resetTimer;
|
||||
m.tid := 0;
|
||||
G.destroy(m.canvas);
|
||||
K.Exit
|
||||
END exit;
|
||||
|
||||
@@ -249,6 +250,7 @@ BEGIN
|
||||
resetTimer
|
||||
END;
|
||||
m.tid := 0;
|
||||
G.destroy(m.canvas);
|
||||
K.Exit
|
||||
END escape;
|
||||
|
||||
@@ -354,6 +356,7 @@ BEGIN
|
||||
END;
|
||||
temp := m.tid;
|
||||
m.tid := 0;
|
||||
G.destroy(m.canvas);
|
||||
K.ExitID(temp);
|
||||
m.active := FALSE
|
||||
END
|
||||
@@ -509,6 +512,7 @@ BEGIN
|
||||
IF m.parent # NIL THEN
|
||||
temp := m.parent.tid;
|
||||
m.parent.tid := 0;
|
||||
G.destroy(m.parent.canvas);
|
||||
K.ExitID(temp)
|
||||
END;
|
||||
exit(m)
|
||||
|
||||
+1
-1
Submodule programs/develop/cmm updated: 4aeaee3386...84fdec8562.
@@ -1,6 +1,6 @@
|
||||
#include <shell_api.h>
|
||||
|
||||
int shell_getc()
|
||||
char shell_getc()
|
||||
{
|
||||
__shell_init();
|
||||
|
||||
@@ -9,7 +9,7 @@ int shell_getc()
|
||||
__shell_shm->cmd = SHELL_GETC;
|
||||
__SHELL_WAIT();
|
||||
|
||||
return *((int*)__shell_shm->data);
|
||||
return __shell_shm->data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
#include <shell_api.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *shell_gets(char *str, int n)
|
||||
void shell_gets(char *str, int n)
|
||||
{
|
||||
__shell_init();
|
||||
|
||||
char *ptr = NULL;
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->cmd = SHELL_GETS;
|
||||
__SHELL_WAIT();
|
||||
|
||||
strncpy(str, __shell_shm->data, n);
|
||||
|
||||
if (__shell_shm->return_value.str == EOF || !__shell_shm->return_value.str)
|
||||
{
|
||||
ptr = __shell_shm->return_value.str;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = str;
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
#include <shell_api.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int shell_printf(const char *format, ...)
|
||||
void shell_printf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
int val = vsnprintf(__shell_shm->data, sizeof(__shell_shm->data), format, ap);
|
||||
vsnprintf(__shell_shm->data, sizeof(__shell_shm->data), format, ap);
|
||||
__shell_shm->cmd = SHELL_PUTS;
|
||||
va_end(ap);
|
||||
__SHELL_WAIT();
|
||||
return val;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <shell_api.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t shell_puts(const char *str)
|
||||
void shell_puts(const char *str)
|
||||
{
|
||||
return shell_write_string(str, strlen(str));
|
||||
shell_write_string(str, strlen(str));
|
||||
}
|
||||
@@ -1,27 +1,22 @@
|
||||
#include <shell_api.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t shell_write_string(const char *s, size_t len)
|
||||
void shell_write_string(const char *s, size_t len)
|
||||
{
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
size_t written_bytes = 0;
|
||||
if (len > sizeof(__shell_shm->data) - 1)
|
||||
{
|
||||
written_bytes += shell_write_string(s, sizeof(__shell_shm->data) - 1); // Outputs as much as it can.
|
||||
written_bytes += shell_write_string(s + (sizeof(__shell_shm->data) - 1), len - (sizeof(__shell_shm->data) - 1)); // Outputs the rest.
|
||||
shell_write_string(s, sizeof(__shell_shm->data) - 1); // Outputs as much as it can.
|
||||
shell_write_string(s + (sizeof(__shell_shm->data) - 1), len - (sizeof(__shell_shm->data) - 1)); // Outputs the rest.
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(__shell_shm->data, 0, sizeof(__shell_shm->data)); // without int shell show \t, \n, lose chars and other trash
|
||||
memcpy(__shell_shm->data, s, len);
|
||||
memset(__shell_shm->data, 0, sizeof(__shell_shm->data)); // without int shell show \t, \n, lose chars and other trash
|
||||
memcpy(__shell_shm->data, s, len);
|
||||
__shell_shm->cmd = SHELL_PUTS;
|
||||
__SHELL_WAIT();
|
||||
written_bytes += __shell_shm->return_value.written_bytes;
|
||||
}
|
||||
|
||||
return written_bytes;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -31,15 +31,9 @@ enum __SHELL_INIT_STATE {
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct return_value {
|
||||
size_t written_bytes;
|
||||
char* str;
|
||||
};
|
||||
|
||||
struct shell_shm_buffer {
|
||||
uint8_t cmd;
|
||||
char data[SHELL_SHM_MAX - sizeof(((struct shell_shm_buffer*)NULL)->cmd) - sizeof(struct return_value)];
|
||||
struct return_value return_value;
|
||||
char data[SHELL_SHM_MAX - sizeof(((struct shell_shm_buffer*)NULL)->cmd)];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -57,14 +51,14 @@ __EXTERN int shell_ping();
|
||||
__EXTERN unsigned shell_get_pid();
|
||||
__EXTERN void shell_exit();
|
||||
|
||||
__EXTERN int shell_getc();
|
||||
__EXTERN char* shell_gets(char* str, int n);
|
||||
__EXTERN char shell_getc();
|
||||
__EXTERN void shell_gets(char* str, int n);
|
||||
|
||||
__EXTERN void shell_putc(char c);
|
||||
__EXTERN size_t shell_puts(const char* str);
|
||||
__EXTERN int shell_printf(const char* format, ...);
|
||||
__EXTERN void shell_puts(const char* str);
|
||||
__EXTERN void shell_printf(const char* format, ...);
|
||||
|
||||
__EXTERN size_t shell_write_string(const char* s, size_t len);
|
||||
__EXTERN void shell_write_string(const char* s, size_t len);
|
||||
|
||||
__EXTERN void shell_cls();
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
DLLAPI int puts(const char* str);
|
||||
DLLAPI int printf(const char* format, ...);
|
||||
@@ -52,23 +50,15 @@ typedef size_t fpos_t;
|
||||
#define _FILEMODE_R 1 << 0 // Read
|
||||
#define _FILEMODE_W 1 << 1 // Write
|
||||
#define _FILEMODE_A 1 << 2 // Append
|
||||
#define _FILEFLAG_ERR 1 << 3 // Error
|
||||
#define _FILEFLAG_EOF 1 << 4 // EOF
|
||||
#define _FILEMODE_PLUS 1 << 3 // Plus
|
||||
|
||||
typedef struct FILE_s {
|
||||
char* name;
|
||||
fpos_t position;
|
||||
int error;
|
||||
int eof;
|
||||
int mode; // flags _FILEMODE_*
|
||||
int __ungetc_emu_buff; // Uses __ungetc_emu (temporary solution!)
|
||||
union {
|
||||
struct {
|
||||
bool read : 1;
|
||||
bool write : 1;
|
||||
bool append : 1;
|
||||
bool error : 1;
|
||||
bool eof : 1;
|
||||
};
|
||||
uint32_t val; // exist just because tcc won't optimize bitfields
|
||||
} flags;
|
||||
} FILE;
|
||||
|
||||
#define _IOFBF 0
|
||||
@@ -92,7 +82,7 @@ typedef struct FILE_s {
|
||||
#define TMP_MAX FOPEN_MAX
|
||||
|
||||
#define stderr (FILE*)3
|
||||
#define stdin (FILE*)1
|
||||
#define stdin (FILE*)1
|
||||
#define stdout (FILE*)2
|
||||
|
||||
DLLAPI int fgetc(FILE*);
|
||||
|
||||
@@ -61,8 +61,6 @@
|
||||
/* strntold() is used by vsscanf() below; include its definition first */
|
||||
#include "stdlib/strntold.c"
|
||||
#include "stdio/vsscanf.c"
|
||||
#include "stdio/fclose_r.c"
|
||||
#include "stdio/fopen_r.c"
|
||||
|
||||
#include "string/memccpy.c"
|
||||
#include "string/memchr.c"
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef __LIBC_STDIO_H
|
||||
#define __LIBC_STDIO_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int fclose_r(FILE* stream);
|
||||
FILE* fopen_r(const char* restrict name, const char* restrict mode, FILE* restrict stream);
|
||||
|
||||
#endif // __LIBC_STDIO_H
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void clearerr(FILE* stream)
|
||||
{
|
||||
stream->flags.val &= ~(_FILEFLAG_ERR | _FILEFLAG_EOF);
|
||||
void clearerr(FILE *stream) {
|
||||
stream->error = 0;
|
||||
stream->eof = 0;
|
||||
}
|
||||
@@ -1,15 +1,8 @@
|
||||
#include "_stdio.h"
|
||||
#include "stddef.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int fclose(FILE* stream)
|
||||
{
|
||||
int err = fclose_r(stream);
|
||||
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
int fclose(FILE *stream) {
|
||||
free(stream);
|
||||
stream = NULL;
|
||||
return 0;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#include "_stdio.h"
|
||||
|
||||
int fclose_r(FILE* stream)
|
||||
{
|
||||
if (stream->name) {
|
||||
free(stream->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int feof(FILE* stream)
|
||||
{
|
||||
return stream->flags.eof;
|
||||
int feof(FILE *stream) {
|
||||
return stream->eof;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int ferror(FILE* stream)
|
||||
{
|
||||
return stream->flags.error;
|
||||
int ferror(FILE *stream) {
|
||||
return stream->error;
|
||||
}
|
||||
@@ -1,22 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "_stdio.h"
|
||||
|
||||
FILE* fopen(const char* restrict _name, const char* restrict _mode)
|
||||
{
|
||||
FILE* stream = malloc(sizeof(FILE));
|
||||
|
||||
if (stream == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FILE* out = fopen_r(_name, _mode, stream);
|
||||
|
||||
if (out == NULL) {
|
||||
free(stream);
|
||||
}
|
||||
|
||||
return out;
|
||||
FILE *fopen(const char *restrict _name, const char *restrict _mode) {
|
||||
FILE *out = malloc(sizeof(FILE));
|
||||
return freopen(_name, _mode, out);
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#include "_stdio.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
/*
|
||||
Open new file
|
||||
*/
|
||||
FILE* fopen_r(const char* restrict _name, const char* restrict _mode, FILE* restrict out)
|
||||
{
|
||||
if (!_name || !_mode || !out) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool file_not_exits = false;
|
||||
ksys_bdfe_t info;
|
||||
{
|
||||
int err = _ksys_file_get_info(_name, &info);
|
||||
|
||||
switch (err) {
|
||||
case KSYS_FS_ERR_SUCCESS:
|
||||
|
||||
if (info.attributes & IS_FOLDER) {
|
||||
errno = EISDIR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
case KSYS_FS_ERR_5:
|
||||
file_not_exits = true;
|
||||
break;
|
||||
default:
|
||||
errno = err;
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out->flags.val = 0;
|
||||
out->position = 0;
|
||||
out->name = strdup(_name);
|
||||
|
||||
if (strchr(_mode, 'r')) {
|
||||
out->flags.read = true;
|
||||
|
||||
if (file_not_exits) {
|
||||
errno = ENOENT;
|
||||
free(out->name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (strchr(_mode, 'w')) {
|
||||
out->flags.write = true;
|
||||
}
|
||||
if (strchr(_mode, 'a')) {
|
||||
out->flags.val |= _FILEMODE_W | _FILEMODE_A;
|
||||
}
|
||||
if (strchr(_mode, '+')) {
|
||||
out->flags.val |= _FILEMODE_R | _FILEMODE_W;
|
||||
}
|
||||
|
||||
if (out->flags.write) {
|
||||
if (file_not_exits) {
|
||||
int err = _ksys_file_create(_name);
|
||||
if (err != KSYS_FS_ERR_SUCCESS) {
|
||||
errno = err;
|
||||
free(out->name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (out->flags.append) {
|
||||
out->position = info.size;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -14,7 +14,7 @@ size_t fread(void *restrict ptr, size_t size, size_t nmemb, FILE *restrict strea
|
||||
|
||||
if(size<=0 || nmemb<=0){
|
||||
errno = EINVAL;
|
||||
stream->flags.error = true;
|
||||
stream->error=errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ size_t fread(void *restrict ptr, size_t size, size_t nmemb, FILE *restrict strea
|
||||
return nmemb;
|
||||
}
|
||||
|
||||
if(stream->flags.read){
|
||||
if(stream->mode != _FILEMODE_W && stream->mode != _FILEMODE_A){
|
||||
if(!stream->__ungetc_emu_buff){
|
||||
((char*) ptr)[0]=(char)stream->__ungetc_emu_buff;
|
||||
//debug_printf("Ungetc: %x\n", ((char*) ptr)[0]);
|
||||
@@ -31,10 +31,10 @@ size_t fread(void *restrict ptr, size_t size, size_t nmemb, FILE *restrict strea
|
||||
unsigned status = _ksys_file_read_file(stream->name, stream->position, bytes_count, ptr , &bytes_read);
|
||||
if (status != KSYS_FS_ERR_SUCCESS) {
|
||||
if(status == KSYS_FS_ERR_EOF){
|
||||
stream->flags.eof = true;
|
||||
stream->eof=1;
|
||||
}else{
|
||||
errno = EIO;
|
||||
stream->flags.error = true;
|
||||
stream->error = errno;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,62 @@
|
||||
#include <stddef.h>
|
||||
#include <sys/ksys.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "_stdio.h"
|
||||
#include <string.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
FILE* freopen(const char* restrict _name, const char* restrict _mode, FILE* restrict out)
|
||||
{
|
||||
fclose_r(out);
|
||||
|
||||
if (_name == NULL) {
|
||||
_name = out->name;
|
||||
static FILE* _set_errno(FILE *out, int err){
|
||||
errno = err;
|
||||
if(out){
|
||||
free(out->name);
|
||||
free(out);
|
||||
}
|
||||
out = NULL;
|
||||
return out;
|
||||
}
|
||||
|
||||
static void _create_file(char *name, FILE *out){
|
||||
if(_ksys_file_create(name)){
|
||||
_set_errno(out, EIO);
|
||||
}
|
||||
}
|
||||
|
||||
FILE *freopen(const char *restrict _name, const char *restrict _mode, FILE *restrict out) {
|
||||
if(!_name || !_mode || !out){
|
||||
return _set_errno(out, EINVAL);
|
||||
}
|
||||
|
||||
return fopen_r(_name, _mode, out);
|
||||
}
|
||||
ksys_bdfe_t info;
|
||||
int no_file = _ksys_file_get_info(_name, &info);
|
||||
if(!no_file && info.attributes & IS_FOLDER){
|
||||
return _set_errno(out, EISDIR);
|
||||
}
|
||||
|
||||
out->eof=0;
|
||||
out->error=0;
|
||||
out->position=0;
|
||||
out->name = strdup(_name);
|
||||
|
||||
if (strchr(_mode, 'r')) { out->mode = _FILEMODE_R; }
|
||||
if (strchr(_mode, 'w')) { out->mode = _FILEMODE_W; }
|
||||
if (strchr(_mode, 'a')) { out->mode = _FILEMODE_A; }
|
||||
if (strchr(_mode, '+')) { out->mode |= _FILEMODE_PLUS; }
|
||||
|
||||
if(out->mode & _FILEMODE_A){
|
||||
if(no_file){
|
||||
_create_file(out->name, out);
|
||||
}
|
||||
out->position = info.size;
|
||||
}else if(out->mode & _FILEMODE_W){
|
||||
_create_file(out->name, out);
|
||||
}else if((out->mode & _FILEMODE_R)){
|
||||
if(no_file){
|
||||
_set_errno(out, ENOENT);
|
||||
}
|
||||
}else{
|
||||
_set_errno(out, EINVAL);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
int fseek(FILE* stream, long int offset, int whence)
|
||||
{
|
||||
if (whence == SEEK_SET) {
|
||||
stream->position = offset;
|
||||
} else if (whence == SEEK_CUR) {
|
||||
stream->position += offset;
|
||||
} else if (whence == SEEK_END) {
|
||||
ksys_bdfe_t info;
|
||||
if (_ksys_file_get_info(stream->name, &info)) {
|
||||
return -1;
|
||||
}
|
||||
stream->position = info.size + offset;
|
||||
}
|
||||
stream->flags.eof = false;
|
||||
int fseek(FILE *stream, long int offset, int whence) {
|
||||
if (whence == SEEK_SET) {
|
||||
stream->position = offset;
|
||||
} else if (whence == SEEK_CUR) {
|
||||
stream->position += offset;
|
||||
} else if (whence == SEEK_END) {
|
||||
ksys_bdfe_t info;
|
||||
if (_ksys_file_get_info(stream->name, &info)) {
|
||||
return -1;
|
||||
}
|
||||
stream->position = info.size + offset;
|
||||
}
|
||||
stream->eof = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int fsetpos(FILE* stream, const fpos_t* pos)
|
||||
{
|
||||
int fsetpos(FILE *stream, const fpos_t *pos) {
|
||||
stream->position = *pos;
|
||||
stream->flags.eof = false;
|
||||
stream->eof = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb, FILE* restric
|
||||
|
||||
if (size <= 0 || nmemb <= 0) {
|
||||
errno = EINVAL;
|
||||
stream->flags.error = true;
|
||||
stream->error = errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb, FILE* restric
|
||||
return nmemb;
|
||||
}
|
||||
|
||||
if (stream->flags.write) {
|
||||
if (stream->mode != _FILEMODE_R) {
|
||||
unsigned status = _ksys_file_write_file(stream->name, stream->position, bytes_count, ptr, &bytes_written);
|
||||
if (status != KSYS_FS_ERR_SUCCESS) {
|
||||
errno = EIO;
|
||||
stream->flags.error = true;
|
||||
stream->error = errno;
|
||||
return 0;
|
||||
}
|
||||
stream->position += bytes_written;
|
||||
|
||||
@@ -6,21 +6,22 @@ int ungetc(int c, FILE* file)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (!file) {
|
||||
errno = EBADF;
|
||||
if(!file){
|
||||
errno = EBADF;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (file->mode != _FILEMODE_R){
|
||||
errno = EACCES;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (file->position == 0 || c == EOF)
|
||||
{
|
||||
errno = EOF;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (!file->flags.read) {
|
||||
errno = EACCES;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (file->position == 0 || c == EOF) {
|
||||
errno = EOF;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
|
||||
file->__ungetc_emu_buff = c;
|
||||
file->position--;
|
||||
return c;
|
||||
|
||||
@@ -170,9 +170,6 @@ fb_draw_panel_selection:
|
||||
mov eax,fb_folder_block
|
||||
test eax,eax
|
||||
jz .end
|
||||
xor eax,eax
|
||||
cmp fb_select_panel_counter,eax
|
||||
je .end
|
||||
mov eax,fb_folder_block
|
||||
sub eax,fb_start_draw_line
|
||||
mov cx,fb_start_draw_cursor_line
|
||||
@@ -199,7 +196,29 @@ fb_draw_panel_selection:
|
||||
shl eax,16
|
||||
push eax
|
||||
add ebx,eax
|
||||
mcall SF_DRAW_RECT
|
||||
cmp fb_select_panel_counter,0 ; is the cursor in an inactive state?
|
||||
jne @f
|
||||
push ecx
|
||||
mov cx,2
|
||||
mcall SF_DRAW_RECT ; display the cursor in the inactive state
|
||||
ror ecx,16
|
||||
add cx,fb_line_size_y
|
||||
sub cx,2
|
||||
ror ecx,16
|
||||
mcall
|
||||
pop ecx
|
||||
mov bx,2
|
||||
mcall
|
||||
ror ebx,16
|
||||
add bx,fb_size_x
|
||||
sub bx,fb_icon_size_x
|
||||
sub bx,2+2 ; cursor border + text margin
|
||||
ror ebx,16
|
||||
mcall
|
||||
jmp .no_frame
|
||||
@@:
|
||||
mcall SF_DRAW_RECT ; display the cursor in the active state
|
||||
.no_frame:
|
||||
pop ebx
|
||||
cmp fb_all_redraw,0
|
||||
je .end
|
||||
@@ -286,7 +305,7 @@ fb_draw_folder_data:
|
||||
xor edx,edx
|
||||
div ebx
|
||||
pop edx ebx
|
||||
sub eax,23+2+2+2
|
||||
sub eax,25+2+2+2
|
||||
mov esi,fb_file_name_length
|
||||
mov fb_temp_counter,0
|
||||
mov fb_display_name_max_length,eax
|
||||
@@ -323,13 +342,14 @@ fb_draw_folder_data:
|
||||
xor eax,eax
|
||||
mov ax,fb_font_size_x
|
||||
imul eax,fb_display_name_max_length
|
||||
inc eax
|
||||
shl eax,16
|
||||
push edx
|
||||
add ebx,eax
|
||||
mov esi,2
|
||||
mov ecx,fb_reduct_text_color
|
||||
mov edx,dword fb_truncated_filename_char
|
||||
mcall SF_DRAW_TEXT
|
||||
mcall SF_DRAW_TEXT ; .. two dots
|
||||
pop edx
|
||||
.continue:
|
||||
pop ebx
|
||||
@@ -375,7 +395,8 @@ align 4
|
||||
mov eax,fb_select_color
|
||||
@@:
|
||||
mov edi,eax
|
||||
mcall SF_DRAW_TEXT
|
||||
add ebx,1 shl 16
|
||||
mcall SF_DRAW_TEXT ; file name
|
||||
popa
|
||||
ret
|
||||
;--------------------------------------
|
||||
@@ -432,6 +453,19 @@ fb_clear_line:
|
||||
sub bx,fb_icon_size_x
|
||||
sub bx,3
|
||||
rol ebx,16
|
||||
cmp fb_select_panel_counter,0 ; is the cursor in an inactive state?
|
||||
jne @f
|
||||
mov ax,fb_start_draw_cursor_line
|
||||
add ax,fb_start_y
|
||||
shl eax,16
|
||||
mov ax,fb_line_size_y
|
||||
cmp ecx,eax
|
||||
jne @f
|
||||
add ebx,2 shl 16
|
||||
sub ebx,4
|
||||
add ecx,2 shl 16
|
||||
sub ecx,4
|
||||
@@:
|
||||
mcall SF_DRAW_RECT,,,fb_background_color
|
||||
.end:
|
||||
popa
|
||||
@@ -444,13 +478,13 @@ fb_draw_type_size_date:
|
||||
test [edx-40],byte 0x10
|
||||
jz .copy_type
|
||||
mov [eax],dword '<DIR'
|
||||
mov [eax+4],word '> '
|
||||
mov [eax+4],dword '> '
|
||||
mov fb_file_name_length,0
|
||||
mov fb_extension_size,0
|
||||
jmp .start
|
||||
.copy_type:
|
||||
mov [eax],dword ' '
|
||||
mov [eax+4],word ' '
|
||||
mov [eax+4],dword ' '
|
||||
.start:
|
||||
mov esi,edx
|
||||
xor eax,eax
|
||||
@@ -505,16 +539,16 @@ fb_draw_type_size_date:
|
||||
mov eax,fb_type_table
|
||||
test [edx-40],byte 0x10
|
||||
jz .copy_size
|
||||
mov [eax+6],dword '----'
|
||||
mov [eax+6+4],word '- '
|
||||
mov [eax+7],dword '----'
|
||||
mov [eax+7+4],dword '-- '
|
||||
jmp .date
|
||||
;-----------------------------------------
|
||||
align 4
|
||||
.call_decimal_string:
|
||||
mov ebx,fb_type_table
|
||||
add ebx,9
|
||||
add ebx,10
|
||||
call fb_decimal_string
|
||||
mov [ebx+1],dl
|
||||
mov [ebx+1],dx
|
||||
jmp .size_convert_end
|
||||
;-----------------------------------------
|
||||
.qword_div:
|
||||
@@ -548,7 +582,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'E' ; Exa Byte
|
||||
mov dx,'E ' ; Exa Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
push ecx
|
||||
@@ -556,7 +590,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'P' ; Peta Byte
|
||||
mov dx,'P ' ; Peta Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
push ecx
|
||||
@@ -564,7 +598,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'T' ; Tera Byte
|
||||
mov dx,'T ' ; Tera Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
push ecx
|
||||
@@ -572,7 +606,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'G' ; Giga Byte
|
||||
mov dx,'G ' ; Giga Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
mov eax,[edx-40+32]
|
||||
@@ -580,19 +614,20 @@ align 4
|
||||
shr eax,20 ; /(1024*1024)
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov dl,byte 'M' ; Mega Byte
|
||||
mov dx,'M ' ; Mega Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
mov eax,ebx
|
||||
shr eax,10 ; /1024
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov dl,byte 'K' ; Kilo Byte
|
||||
mov dx,'K ' ; Kilo Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
mov eax,ebx
|
||||
mov ebx,fb_type_table
|
||||
add ebx,10
|
||||
mov dword[ebx+1],' ' ; clear K, M, ..., E
|
||||
call fb_decimal_string
|
||||
.size_convert_end:
|
||||
pop edx ebx
|
||||
@@ -608,22 +643,22 @@ align 4
|
||||
mov al,[edx-40+28]
|
||||
push ebx
|
||||
mov ebx,fb_type_table
|
||||
add ebx,12
|
||||
add ebx,14
|
||||
call fb_decimal_string_2 ; day
|
||||
mov al,[edx-40+29]
|
||||
mov ebx,fb_type_table
|
||||
add ebx,12+3
|
||||
add ebx,14+3
|
||||
call fb_decimal_string_2 ; month
|
||||
mov ax,[edx-40+30]
|
||||
mov ebx,fb_type_table
|
||||
add ebx,12+9
|
||||
add ebx,14+9
|
||||
mov [ebx-3], dword '0000'
|
||||
call fb_decimal_string ; year
|
||||
pop ebx
|
||||
;-----------------------------------------
|
||||
ror ebx,16
|
||||
add bx,fb_size_x
|
||||
sub ebx,161 ; 122+12+15
|
||||
sub ebx,173 ; 122+18+21
|
||||
rol ebx,16
|
||||
mov ecx,fb_text_color
|
||||
cmp fb_marked_file,0
|
||||
@@ -631,7 +666,7 @@ align 4
|
||||
mov ecx,fb_reduct_text_color
|
||||
@@:
|
||||
mov edx,fb_type_table
|
||||
mov esi,22
|
||||
mov esi,24 ; text length
|
||||
mov ax,fb_line_size_y
|
||||
sub ax,fb_font_size_y
|
||||
push ebx
|
||||
@@ -650,14 +685,41 @@ align 4
|
||||
mov eax,fb_select_color
|
||||
@@:
|
||||
mov edi,eax
|
||||
mcall SF_DRAW_TEXT
|
||||
mcall SF_DRAW_TEXT ; type size date
|
||||
.not_show_date:
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
fb_draw_icon:
|
||||
pusha
|
||||
pushad
|
||||
cmp fb_icon_raw_area,0
|
||||
jne .not_draw_null
|
||||
mov bx,[esp+18] ;coord x
|
||||
sub bx,2
|
||||
sub bx,fb_icon_size_x
|
||||
shl ebx,16
|
||||
mov bx,fb_icon_size_x
|
||||
mov cx,[esp+16] ;coord y
|
||||
shl ecx,16
|
||||
mov cx,fb_icon_size_y
|
||||
test [edx-40],byte 0x10
|
||||
jz @f
|
||||
mov edx,fb_select_color
|
||||
jmp .draw_r
|
||||
@@:
|
||||
mov edx,fb_background_color
|
||||
.draw_r:
|
||||
mcall SF_DRAW_RECT
|
||||
shr ebx,16
|
||||
shr ecx,16
|
||||
movzx eax,fb_icon_size_x
|
||||
movzx edx,fb_icon_size_y
|
||||
stdcall draw_edge, ebx, ecx, eax, edx,\
|
||||
fb_background_color, fb_select_color, fb_text_color
|
||||
popad
|
||||
ret
|
||||
.not_draw_null:
|
||||
xor eax,eax
|
||||
mov ax,fb_icon_size_y
|
||||
mov ebx,fb_resolution_raw
|
||||
@@ -698,11 +760,9 @@ fb_draw_icon:
|
||||
add dx,ax
|
||||
mov esi,fb_resolution_raw
|
||||
xor ebp,ebp
|
||||
push edi
|
||||
mov edi,fb_palette_raw
|
||||
mcall SF_PUT_IMAGE_EXT
|
||||
pop edi
|
||||
popa
|
||||
popad
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
; Convert of a binary number in decimal string form
|
||||
|
||||
@@ -1618,23 +1618,21 @@ endl
|
||||
|
||||
; Open a new TCP socket
|
||||
mcall socket, AF_INET4, SOCK_STREAM, 0
|
||||
cmp eax, -1
|
||||
je .error3
|
||||
test eax, eax
|
||||
jz .error3
|
||||
mov [socketnum], eax
|
||||
DEBUGF 1, "Socket: 0x%x\n", eax
|
||||
|
||||
; Connect to the server
|
||||
mcall connect, [socketnum], [sockaddr], 18
|
||||
test eax, eax
|
||||
jnz .error4
|
||||
jnz .error3
|
||||
DEBUGF 1, "Socket is now connected.\n"
|
||||
|
||||
invoke freeaddrinfo ; Free allocated memory
|
||||
mov eax, [socketnum]
|
||||
ret
|
||||
|
||||
.error4:
|
||||
mcall close, [socketnum]
|
||||
.error3:
|
||||
DEBUGF 2, "Could not connect to the remote server\n"
|
||||
invoke freeaddrinfo ; Free allocated memory
|
||||
|
||||
@@ -501,8 +501,7 @@ img.decode.jpg:
|
||||
jnz .no_create_palette
|
||||
push ecx edi
|
||||
mov edi, [eax + Image.Palette]
|
||||
mov eax, 0xFF000000 ; opaque, like the palettes of the other decoders:
|
||||
; converted to 32 bpp, alpha 0 made the picture invisible
|
||||
xor eax, eax
|
||||
mov ecx, 256
|
||||
@@:
|
||||
stosd
|
||||
|
||||
@@ -3,7 +3,6 @@ public EXPORTS
|
||||
section '.flat' code readable align 16
|
||||
|
||||
include '../../../macros.inc'
|
||||
include '../../../KOSfuncs.inc'
|
||||
include 'strlen.inc'
|
||||
|
||||
MB_FIRST_BUT_ID equ 3 ;идентификатор 1-й кнопки на сообщении
|
||||
@@ -19,8 +18,14 @@ MB_TEXT_OFFSET equ 2 ;ᬥ饭
|
||||
|
||||
align 4
|
||||
start:
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
mcall SF_SET_EVENTS_MASK, EVM_MOUSE + EVM_BUTTON + EVM_KEY + EVM_REDRAW
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
mov eax,40
|
||||
mov ebx,0x27
|
||||
mcall
|
||||
|
||||
;-- clear id pressed button ---
|
||||
mov ebx,[mb_text]
|
||||
@@ -34,7 +39,9 @@ start:
|
||||
|
||||
align 4
|
||||
red_win:
|
||||
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov bx,word[mb_left]
|
||||
@@ -49,7 +56,7 @@ red_win:
|
||||
add edi,MB_TEXT_OFFSET ;Caption
|
||||
mcall
|
||||
|
||||
mcall SF_THREAD_INFO,mb_procinfo,-1
|
||||
mcall 9,mb_procinfo,-1
|
||||
mov eax,dword[mb_procinfo.client_box.width]
|
||||
|
||||
sub eax,[but_width]
|
||||
@@ -57,6 +64,7 @@ red_win:
|
||||
add eax,MB_BUT_OTX_1
|
||||
mov [ot_left],eax
|
||||
|
||||
mov eax,4 ;рисование текста
|
||||
mov bx,MB_BUT_OTX_1
|
||||
shl ebx,16
|
||||
mov bx,MB_BUT_OTY_1
|
||||
@@ -68,12 +76,13 @@ red_win:
|
||||
call strlen
|
||||
call linlen
|
||||
|
||||
or eax,eax
|
||||
jz @f
|
||||
cmp eax,0
|
||||
je @f
|
||||
|
||||
mov esi,eax
|
||||
push eax
|
||||
mcall SF_DRAW_TEXT
|
||||
mov eax,4
|
||||
int 0x40
|
||||
pop eax
|
||||
|
||||
add edx,eax
|
||||
@@ -86,24 +95,25 @@ red_win:
|
||||
@@:
|
||||
|
||||
call MsgBoxDrawAllBut
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
mcall 12,2
|
||||
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
mov eax,10
|
||||
mcall
|
||||
|
||||
cmp al,EV_REDRAW
|
||||
cmp al,1 ;изм. положение окна
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
cmp al,3
|
||||
jz button
|
||||
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
key:
|
||||
mcall SF_GET_KEY
|
||||
mcall 2
|
||||
cmp ah,13
|
||||
jne @f
|
||||
mov ah,[mb_key_foc]
|
||||
@@ -143,7 +153,7 @@ key:
|
||||
|
||||
align 4
|
||||
button:
|
||||
mcall SF_GET_BUTTON
|
||||
mcall 17 ;получить код нажатой кнопки
|
||||
cmp ah,MB_FIRST_BUT_ID
|
||||
jge close
|
||||
cmp ah,1
|
||||
@@ -159,8 +169,8 @@ close:
|
||||
mov byte[ebx],ah
|
||||
|
||||
;*** call msgbox functions ***
|
||||
or ah,ah
|
||||
jz @f
|
||||
cmp ah,0
|
||||
je @f
|
||||
cmp dword[mb_funct],0
|
||||
je @f
|
||||
xor ebx,ebx
|
||||
@@ -172,7 +182,7 @@ close:
|
||||
je @f
|
||||
call dword[ebx]
|
||||
@@:
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
mcall -1 ;выход из программы
|
||||
|
||||
align 4
|
||||
MsgBoxDrawAllBut:
|
||||
@@ -192,8 +202,8 @@ MsgBoxDrawAllBut:
|
||||
mov esi,edx
|
||||
call strlen
|
||||
|
||||
or eax,eax
|
||||
jz @f
|
||||
cmp eax,0
|
||||
je @f
|
||||
|
||||
call MsgBoxDrawButton
|
||||
inc ecx
|
||||
@@ -243,7 +253,8 @@ MsgBoxDrawButton:
|
||||
ror ebx,16
|
||||
mov bx,ax
|
||||
|
||||
mcall SF_DEFINE_BUTTON
|
||||
mov eax,8
|
||||
int 0x40
|
||||
pop edx ebx eax
|
||||
|
||||
;caption
|
||||
@@ -253,7 +264,8 @@ MsgBoxDrawButton:
|
||||
mov ecx,[sc.work_button]
|
||||
@@:
|
||||
mov esi,eax
|
||||
mcall SF_DRAW_TEXT
|
||||
mov eax,4
|
||||
int 0x40
|
||||
|
||||
pop ecx
|
||||
ret
|
||||
@@ -272,25 +284,6 @@ MsgBoxReInit:
|
||||
add esi,eax ;add len of caption
|
||||
mov [txtMsg],esi
|
||||
|
||||
;--- calc window width ---
|
||||
push eax ebx esi
|
||||
.cycle:
|
||||
call strlen
|
||||
mov ebx,eax
|
||||
call linlen
|
||||
add esi,eax
|
||||
sub ebx,eax
|
||||
imul eax,6
|
||||
add eax,10+2*SF_DRAW_TEXT
|
||||
cmp [mb_width],ax
|
||||
jge @f
|
||||
mov [mb_width],ax
|
||||
@@:
|
||||
inc esi
|
||||
cmp ebx,5 ;length of the remaining text
|
||||
jg .cycle
|
||||
pop esi ebx eax
|
||||
|
||||
;--- go to first button text --- buttons 1...MB_MAX_BUT
|
||||
mov ebx,txtBut
|
||||
mov cx,MB_MAX_BUT
|
||||
@@ -327,11 +320,12 @@ MsgBoxReInit:
|
||||
add eax,MB_BUT_HEIGHT
|
||||
add ax,5 ;height of border
|
||||
mov [mb_height],ax
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
|
||||
mcall 48,4 ;skin height
|
||||
add [mb_height],ax
|
||||
|
||||
;--- calc window top ---
|
||||
mcall SF_GET_SCREEN_SIZE
|
||||
mov eax,14
|
||||
int 0x40
|
||||
mov word[mb_top],ax
|
||||
mov ax,word[mb_height]
|
||||
sub word[mb_top],ax
|
||||
@@ -373,7 +367,6 @@ MsgBoxReInit:
|
||||
|
||||
;input:
|
||||
; [esp+8] = pointer to msgbox text
|
||||
; [esp+12] = thread stack
|
||||
align 4
|
||||
MsgBoxCreate:
|
||||
push ebp
|
||||
@@ -381,7 +374,11 @@ MsgBoxCreate:
|
||||
m2m dword[mb_text],dword[ebp+8]
|
||||
push eax ebx ecx edx
|
||||
|
||||
mcall SF_THREAD_CONTROL,SSF_CREATE_THREAD,start,[ebp+12]
|
||||
mov eax,51
|
||||
mov ebx,1
|
||||
mov ecx,start
|
||||
mov edx,dword[ebp+12];thread
|
||||
int 0x40
|
||||
|
||||
mov dword[mb_funct],0
|
||||
pop edx ecx ebx eax
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
|
||||
HISTORY:
|
||||
|
||||
4.1.1 (18/09/2026, Leency)
|
||||
bug-fixes:
|
||||
- fixed crash on deleting the whole text (Ctrl+A, Del)
|
||||
|
||||
4.1 (17/07/2015, Pathoswithin)
|
||||
- various fixes
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
; project name: TINYPAD
|
||||
; compiler: flat assembler 1.67.21
|
||||
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
|
||||
; version: SVN (4.1.1)
|
||||
; last update: 2026-09-18 (Sep 18, 2026)
|
||||
; version: SVN (4.1)
|
||||
; last update: 2015-07-17 (Jul 17, 2015)
|
||||
; minimal kernel: revision #4199 (https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/kernel/trunk)
|
||||
;-----------------------------------------------------------------------------
|
||||
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
|
||||
@@ -40,7 +40,7 @@ include 'tinypad.inc'
|
||||
|
||||
__header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,ini_path
|
||||
|
||||
APP_VERSION equ '4.1.1'
|
||||
APP_VERSION equ '4.1'
|
||||
|
||||
TRUE = 1
|
||||
FALSE = 0
|
||||
|
||||
@@ -355,7 +355,7 @@ proc line_add_spaces ;////////////////////////////////////////////////////////
|
||||
; ESI = line offset
|
||||
; ECX = needed line length
|
||||
; Output:
|
||||
; EAX = delta, CF = 1 on failure
|
||||
; EAX = delta
|
||||
;-----------------------------------------------------------------------------
|
||||
xor eax,eax
|
||||
pushad
|
||||
@@ -365,7 +365,6 @@ proc line_add_spaces ;////////////////////////////////////////////////////////
|
||||
sub ecx,edx
|
||||
lea eax,[ecx+sizeof.EDITOR_LINE_DATA]
|
||||
call editor_realloc_lines
|
||||
jc .failed
|
||||
mov [esp+4*7],eax
|
||||
add esi,eax
|
||||
push ecx
|
||||
@@ -389,26 +388,6 @@ proc line_add_spaces ;////////////////////////////////////////////////////////
|
||||
rep stosb
|
||||
.exit:
|
||||
popad
|
||||
clc
|
||||
ret
|
||||
.failed:
|
||||
popad
|
||||
stc
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
proc set_lines_terminator ;///////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; Lines buffer is terminated by a line header with zero Size, restore it after
|
||||
; the data has been compacted (line count decreased)
|
||||
;-----------------------------------------------------------------------------
|
||||
push ecx esi
|
||||
mov ecx,[cur_editor.Lines.Count]
|
||||
call get_line_offset
|
||||
mov [esi+EDITOR_LINE_DATA.Size],0
|
||||
mov [esi+EDITOR_LINE_DATA.Flags],0
|
||||
pop esi ecx
|
||||
ret
|
||||
endp
|
||||
|
||||
@@ -429,7 +408,6 @@ proc delete_selection ;///////////////////////////////////////////////////////
|
||||
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
||||
mov ecx,[sel.begin.x]
|
||||
call line_add_spaces
|
||||
jc .abort
|
||||
add esi,eax
|
||||
lea edi,[esi+sizeof.EDITOR_LINE_DATA]
|
||||
mov ecx,[sel.end.y]
|
||||
@@ -478,8 +456,6 @@ proc delete_selection ;///////////////////////////////////////////////////////
|
||||
rep movsb
|
||||
|
||||
.exit:
|
||||
call set_lines_terminator
|
||||
|
||||
mov eax,[sel.begin.x]
|
||||
mov [cur_editor.Caret.X],eax
|
||||
mov [cur_editor.SelStart.X],eax
|
||||
@@ -502,11 +478,6 @@ proc delete_selection ;///////////////////////////////////////////////////////
|
||||
clc
|
||||
ret
|
||||
|
||||
.abort:
|
||||
popad
|
||||
clc
|
||||
ret
|
||||
|
||||
.exit.2:
|
||||
stc
|
||||
ret
|
||||
|
||||
@@ -993,30 +993,17 @@ endp
|
||||
proc editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; EAX = delta
|
||||
; Output:
|
||||
; EAX = buffer displacement, CF = 1 on failure (buffer left untouched)
|
||||
;-----------------------------------------------------------------------------
|
||||
push ebx ecx
|
||||
mov ebx,[cur_editor.Lines.Size]
|
||||
push ebx
|
||||
add ebx,eax
|
||||
mov eax,[cur_editor.Lines]
|
||||
mov [cur_editor.Lines.Size],ebx
|
||||
mov ecx,eax
|
||||
stdcall mem.ReAlloc,eax,ebx
|
||||
test eax,eax
|
||||
jz .failed
|
||||
add esp,4
|
||||
mov [cur_editor.Lines],eax
|
||||
sub eax,ecx
|
||||
pop ecx ebx
|
||||
clc
|
||||
ret
|
||||
.failed:
|
||||
pop [cur_editor.Lines.Size]
|
||||
xor eax,eax
|
||||
pop ecx ebx
|
||||
stc
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
@@ -237,7 +237,6 @@ proc load_from_memory ;///////////////////////////////////////////////////////
|
||||
lea edx,[ebx+ecx]
|
||||
imul ebx,eax,16
|
||||
add ebx,edx
|
||||
add ebx,sizeof.EDITOR_LINE_DATA
|
||||
mov [ebp+EDITOR.Lines.Size],ebx
|
||||
stdcall mem.ReAlloc,[ebp+EDITOR.Lines],ebx
|
||||
mov [ebp+EDITOR.Lines],eax
|
||||
|
||||
@@ -591,12 +591,10 @@ proc key.ctrl_v ;///// PASTE ///////////////////////////////////
|
||||
mov eax,[copy_size]
|
||||
sub eax,sizeof.EDITOR_LINE_DATA
|
||||
call editor_realloc_lines
|
||||
jc .exit_1
|
||||
mov ecx,[cur_editor.Caret.Y]
|
||||
call get_line_offset
|
||||
mov ecx,[cur_editor.Caret.X]
|
||||
call line_add_spaces
|
||||
jc .exit_1
|
||||
pushd [esi+EDITOR_LINE_DATA.Size]
|
||||
push esi
|
||||
lea eax,[esi+ecx+sizeof.EDITOR_LINE_DATA]
|
||||
@@ -694,7 +692,6 @@ proc key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////
|
||||
;---------------------------------------------------------------
|
||||
mov eax,90+sizeof.EDITOR_LINE_DATA
|
||||
call editor_realloc_lines
|
||||
jc .exit
|
||||
|
||||
mov ecx,[cur_editor.Caret.Y]
|
||||
call get_line_offset
|
||||
@@ -751,7 +748,6 @@ proc key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////
|
||||
shr ecx,2
|
||||
cld
|
||||
rep movsd
|
||||
call set_lines_terminator
|
||||
|
||||
pop eax
|
||||
add eax,sizeof.EDITOR_LINE_DATA
|
||||
@@ -1155,7 +1151,6 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////
|
||||
|
||||
.ok.dec.lines:
|
||||
dec [cur_editor.Lines.Count]
|
||||
call set_lines_terminator
|
||||
mov eax,[cur_editor.Lines.Count]
|
||||
cmp [cur_editor.Caret.Y],eax
|
||||
jb @f
|
||||
@@ -1269,7 +1264,6 @@ proc key.tab ;///// TABULATE ///////////////////////////////////
|
||||
push eax
|
||||
call editor_realloc_lines
|
||||
pop eax
|
||||
jc .failed
|
||||
mov ecx,[cur_editor.Caret.Y]
|
||||
call get_line_offset
|
||||
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
|
||||
@@ -1288,7 +1282,6 @@ proc key.tab ;///// TABULATE ///////////////////////////////////
|
||||
push eax
|
||||
mov eax,10
|
||||
call editor_realloc_lines
|
||||
jc .failed.1
|
||||
add esi,eax
|
||||
pop eax
|
||||
pushad
|
||||
@@ -1339,12 +1332,6 @@ proc key.tab ;///// TABULATE ///////////////////////////////////
|
||||
|
||||
.exit:
|
||||
ret
|
||||
|
||||
.failed.1:
|
||||
pop eax
|
||||
.failed:
|
||||
add esp,4*2
|
||||
ret
|
||||
endp
|
||||
|
||||
;---------------------------------------------------------------
|
||||
@@ -1355,7 +1342,6 @@ proc key.return ;///// CARRIAGE RETURN /////////////////////////
|
||||
; so you should do a little more value
|
||||
mov eax,14*100
|
||||
call editor_realloc_lines
|
||||
jc .exit
|
||||
|
||||
mov ecx,[cur_editor.Caret.Y]
|
||||
call get_line_offset
|
||||
|
||||
+53
-32
@@ -1,6 +1,7 @@
|
||||
;------------------------------------------------------------------------------
|
||||
align 16
|
||||
button:
|
||||
mcall 17
|
||||
mcall SF_GET_BUTTON
|
||||
;--------------------------------------
|
||||
.1:
|
||||
cmp ah,101
|
||||
@@ -46,8 +47,8 @@ button:
|
||||
add eax,retrieved_devices_table+1
|
||||
mov esi,eax ; selected path
|
||||
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
|
||||
call copy_folder_name
|
||||
jmp left_panel_read_folder
|
||||
@@ -105,22 +106,32 @@ button:
|
||||
cmp ah,157
|
||||
je delete_file
|
||||
|
||||
cmp ah,170
|
||||
je key_insert.1
|
||||
|
||||
cmp ah,171
|
||||
je symbol_a_up.ctrl
|
||||
|
||||
cmp ah,172
|
||||
je NumPad_minus_Up.ctrl
|
||||
|
||||
cmp ah,173
|
||||
je NumPad_sneg_Up.ctrl
|
||||
|
||||
cmp ah, 1
|
||||
jne still
|
||||
;--------------------------------------
|
||||
.exit:
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;---------------------------------------------------------------------
|
||||
reload_dir:
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
call proc_read_left_folder
|
||||
; mov [left_panel_clear_all],1
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
@@:
|
||||
call proc_read_right_folder
|
||||
; mov [right_panel_clear_all],1
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
@@ -134,38 +145,43 @@ exit_dir_1:
|
||||
jmp key_28.1
|
||||
;---------------------------------------------------------------------
|
||||
left_panel_read_folder:
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
jmp proc_read_folder
|
||||
;---------------------------------------------------------------------
|
||||
right_panel_read_folder:
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
jmp proc_read_folder_1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_name:
|
||||
xor eax,eax
|
||||
cmp [left_sort_flag],eax
|
||||
je still
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],eax
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_type:
|
||||
cmp [left_sort_flag],1
|
||||
je still
|
||||
mov [left_sort_flag],1
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_size:
|
||||
cmp [left_sort_flag],2
|
||||
je still
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],2
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_size:
|
||||
cmp [left_sort_flag],6
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],6
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_date:
|
||||
cmp [left_sort_flag],3
|
||||
je still
|
||||
mov [left_sort_flag],3
|
||||
cmp [left_sort_flag],4
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],4
|
||||
jmp left_sort_date.1
|
||||
.2:
|
||||
xor [left_sort_flag],1
|
||||
.1:
|
||||
call draw_left_select_disk_button
|
||||
mov edx,0x80000000+142
|
||||
call clear_sort_buttons
|
||||
call draw_left_sort_button
|
||||
call left_sort_files
|
||||
call draw_left_panel
|
||||
@@ -174,28 +190,33 @@ left_sort_date:
|
||||
right_sort_name:
|
||||
xor eax,eax
|
||||
cmp [right_sort_flag],eax
|
||||
je still
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],eax
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_type:
|
||||
cmp [right_sort_flag],1
|
||||
je still
|
||||
mov [right_sort_flag],1
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_size:
|
||||
cmp [right_sort_flag],2
|
||||
je still
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],2
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_size:
|
||||
cmp [right_sort_flag],6
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],6
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_date:
|
||||
cmp [right_sort_flag],3
|
||||
je still
|
||||
mov [right_sort_flag],3
|
||||
cmp [right_sort_flag],4
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],4
|
||||
jmp right_sort_date.1
|
||||
.2:
|
||||
xor [right_sort_flag],1
|
||||
.1:
|
||||
call draw_right_select_disk_button
|
||||
mov edx,0x80000000+146
|
||||
call clear_sort_buttons
|
||||
call draw_right_sort_button
|
||||
call right_sort_files
|
||||
call draw_right_panel
|
||||
|
||||
+14
-12
@@ -12,17 +12,17 @@ confirmation_action:
|
||||
call draw_confirmation_menu
|
||||
;--------------------------------------
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je key_menu_confirmation
|
||||
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
jne .still
|
||||
|
||||
mcall 17
|
||||
mcall SF_GET_BUTTON
|
||||
cmp ah,161
|
||||
je .no_del
|
||||
|
||||
@@ -32,7 +32,7 @@ confirmation_action:
|
||||
cmp ah,1
|
||||
jne .still
|
||||
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;--------------------------------------
|
||||
.del:
|
||||
mov [work_confirmation_yes],1
|
||||
@@ -47,13 +47,14 @@ draw_confirmation_button:
|
||||
mov ecx,[window_high]
|
||||
mov ebx,[window_width]
|
||||
shr ecx,1
|
||||
sub ecx,[skin_high]
|
||||
shr ebx,1
|
||||
sub ebx,45
|
||||
sub ebx,50
|
||||
shl ecx,16
|
||||
shl ebx,16
|
||||
mov cx,15
|
||||
mov bx,40
|
||||
mcall 8,,,0x40000000+160,0xffffff
|
||||
mcall SF_DEFINE_BUTTON, ,,0x40000000+160,0xffffff
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -65,12 +66,13 @@ draw_confirmation_menu:
|
||||
shr ecx,1
|
||||
shr ebx,1
|
||||
sub ecx,22
|
||||
sub ebx,60
|
||||
sub ecx,[skin_high]
|
||||
sub ebx,65
|
||||
shl ecx,16
|
||||
shl ebx,16
|
||||
mov cx,44
|
||||
mov bx,120
|
||||
mcall 13,,,0x6060ff
|
||||
mcall SF_DRAW_RECT, ,,0x6060ff
|
||||
push ebx ecx
|
||||
add ebx,15 shl 16
|
||||
add ecx,22 shl 16
|
||||
@@ -104,7 +106,7 @@ draw_confirmation_menu:
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,7 shl 16+2
|
||||
mcall 4,,0x90ffffff,[confirmation_type]
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,[confirmation_type]
|
||||
add ebx,15 shl 16+20
|
||||
mcall ,,,type_yes
|
||||
add ebx,56 shl 16
|
||||
@@ -112,7 +114,7 @@ draw_confirmation_menu:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
key_menu_confirmation:
|
||||
mcall 2
|
||||
mcall SF_GET_KEY
|
||||
cmp [extended_key],1
|
||||
je .extended_key
|
||||
|
||||
|
||||
+101
-74
@@ -8,30 +8,30 @@ copy_file_f5:
|
||||
; mov byte [copy_many_files],al
|
||||
mov [current_progress_value],eax
|
||||
mov [current_progress_value_1],eax
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
cmp [left_marked_counter],eax
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
cmp [fb_left.marked_counter],eax
|
||||
jne .confirmation_action
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[left_start_draw_line]
|
||||
mov ebx,[fb_left.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
call prepare_data_7
|
||||
call .copy_name
|
||||
jmp editbox_copy_name
|
||||
.right_1:
|
||||
cmp [right_marked_counter],eax
|
||||
cmp [fb_right.marked_counter],eax
|
||||
jne .confirmation_action
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[right_start_draw_line]
|
||||
mov ebx,[fb_right.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
call prepare_data_7
|
||||
call .copy_name
|
||||
jmp editbox_copy_name
|
||||
@@ -65,9 +65,9 @@ copy_file_f5:
|
||||
mov edi, edit1
|
||||
mov ed_size, eax
|
||||
mov ed_pos, eax
|
||||
default_box
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_2
|
||||
and word ed_flags,ed_shift_cl
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_2
|
||||
mov esi,read_folder_name
|
||||
jmp @f
|
||||
.right_2:
|
||||
@@ -78,26 +78,29 @@ default_box
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
editbox_copy_name:
|
||||
mcall 66, 1, 0
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 0
|
||||
jmp .red
|
||||
.red_1:
|
||||
call draw_window
|
||||
.red:
|
||||
call draw_editbox_copy_name
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key_copy
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button_copy
|
||||
mouse_edit_box copy_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_mouse], copy_editboxes
|
||||
else
|
||||
stdcall edit_box_mouse, copy_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
.button_copy:
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
test ah,ah
|
||||
jz .still
|
||||
cmp ah,160
|
||||
@@ -106,7 +109,7 @@ editbox_copy_name:
|
||||
je .exit_without_copy
|
||||
cmp ah,1
|
||||
jne .still
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
.exit_with_copy:
|
||||
mov [max_progress_value],1
|
||||
mov [draw_all_progressbar],1
|
||||
@@ -121,18 +124,21 @@ editbox_copy_name:
|
||||
call proc_read_left_folder
|
||||
call proc_read_right_folder
|
||||
.exit_without_copy:
|
||||
mcall 66, 1, 1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
mov [move_file_flag],0
|
||||
jmp red
|
||||
;-------------------------------------------------------------
|
||||
.key_copy:
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
cmp ah,13
|
||||
je .exit_with_copy
|
||||
cmp ah,27
|
||||
je .exit_without_copy
|
||||
key_edit_box copy_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_key], copy_editboxes
|
||||
else
|
||||
stdcall edit_box_key, copy_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
draw_editbox_copy_name:
|
||||
@@ -146,7 +152,7 @@ draw_editbox_copy_name:
|
||||
shl ebx,16
|
||||
mov cx,60
|
||||
mov bx,174
|
||||
mcall 13, , ,0x6060ff ;0xff
|
||||
mcall SF_DRAW_RECT, , ,0x6060ff ;0xff
|
||||
pusha
|
||||
shr ebx,16
|
||||
add ebx,10
|
||||
@@ -155,7 +161,11 @@ draw_editbox_copy_name:
|
||||
mov eax,copy_editboxes
|
||||
mov dword [eax+4],ebx
|
||||
mov dword [eax+8],ecx
|
||||
draw_edit_box copy_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_draw], copy_editboxes
|
||||
else
|
||||
stdcall edit_box_draw, copy_editboxes
|
||||
end if
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
@@ -164,8 +174,7 @@ draw_editbox_copy_name:
|
||||
mov bx,40
|
||||
mov esi,0xffffff
|
||||
mov edx,0x40000000+160
|
||||
mov eax,8
|
||||
mcall
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -176,7 +185,7 @@ draw_editbox_copy_name:
|
||||
add ecx,37 shl 16
|
||||
mov bx,40
|
||||
mov cx,15
|
||||
mov edx,0
|
||||
xor edx,edx
|
||||
push ebx ecx
|
||||
sub ecx,1 shl 16
|
||||
sub ebx,1 shl 16
|
||||
@@ -198,12 +207,12 @@ draw_editbox_copy_name:
|
||||
add ebx,60 shl 16+1
|
||||
cmp [move_file_flag],0
|
||||
je .copy
|
||||
mov edx,move_type_1
|
||||
mov edx,sz_Move_file
|
||||
jmp @f
|
||||
.copy:
|
||||
mov edx,copy_type_1
|
||||
mov edx,sz_Copy_file
|
||||
@@:
|
||||
mcall 4, ,0x90ffffff
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff
|
||||
add ebx,18 shl 16+36
|
||||
mov edx,type_yes
|
||||
mcall
|
||||
@@ -215,31 +224,31 @@ draw_editbox_copy_name:
|
||||
copy_file_1:
|
||||
mov ebx,create_dir_name
|
||||
.1:
|
||||
mov [error_pointer],ebx
|
||||
cmp [select_panel_counter],0
|
||||
je .right_2
|
||||
mov esi,read_folder_name
|
||||
mov [error_pointer],ebx
|
||||
cmp [fb_left.select_panel_counter],1
|
||||
je .right_2
|
||||
mov esi,read_folder_name
|
||||
jmp @f
|
||||
.right_2:
|
||||
mov esi,read_folder_1_name
|
||||
mov esi,read_folder_1_name
|
||||
@@:
|
||||
mov edi,start_parameter
|
||||
call copy_path_1
|
||||
call get_file_size
|
||||
mov edi,start_parameter
|
||||
call copy_path_1
|
||||
call get_file_size
|
||||
test eax,eax
|
||||
jnz .error
|
||||
mov [read_file.Offset],eax
|
||||
mov [add_save_file.Offset],eax
|
||||
mov eax,[appl_memory]
|
||||
xor eax,eax
|
||||
mov [read_file.return],eax
|
||||
mov [save_file.pointer],eax
|
||||
mov [add_save_file.pointer],eax
|
||||
mcall 18,16
|
||||
mcall SF_SYSTEM, SSF_GET_FREE_RAM
|
||||
mov ebx,[file_features_temp_area+32]
|
||||
shr ebx,10
|
||||
shr eax,2
|
||||
cmp ebx,eax
|
||||
jb .copy_for_one
|
||||
jb .copy_for_one
|
||||
shl eax,10
|
||||
mov ecx,eax
|
||||
mov [read_file.size],eax
|
||||
@@ -263,10 +272,16 @@ copy_file_1:
|
||||
popa
|
||||
.continue_5:
|
||||
call progress_bar_copy ;_1
|
||||
call add_application_memory.1
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
mov [read_file.return],eax
|
||||
mov [save_file.pointer],eax
|
||||
mov [add_save_file.pointer],eax
|
||||
cmp [copy_many_files],byte 0
|
||||
jne @f
|
||||
inc [current_progress_value]
|
||||
inc [current_progress_value]
|
||||
call progress_bar_copy ;_1
|
||||
@@:
|
||||
call load_file
|
||||
@@ -274,7 +289,7 @@ copy_file_1:
|
||||
jnz .error
|
||||
cmp [copy_many_files],byte 0
|
||||
jne @f
|
||||
inc [current_progress_value_1]
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy ;_1
|
||||
@@:
|
||||
call write_file
|
||||
@@ -302,7 +317,7 @@ copy_file_1:
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy ;_1
|
||||
@@:
|
||||
call add_write_file
|
||||
mcall SF_FILE, add_save_file
|
||||
test eax,eax
|
||||
jnz .error_1
|
||||
jmp .continue
|
||||
@@ -319,66 +334,78 @@ copy_file_1:
|
||||
jnz .error_1
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy
|
||||
call add_write_file
|
||||
mcall SF_FILE, add_save_file
|
||||
test eax,eax
|
||||
jnz .error_1
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[save_file.size]
|
||||
call sub_application_memory.1
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
.exit:
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
.copy_for_one:
|
||||
call add_application_memory
|
||||
mov ecx,[file_features_temp_area+32]
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
mov [read_file.return],eax
|
||||
mov [save_file.pointer],eax
|
||||
mov [add_save_file.pointer],eax
|
||||
mov eax,[file_features_temp_area+32]
|
||||
mov [read_file.size],eax
|
||||
inc [current_progress_value]
|
||||
inc [current_progress_value]
|
||||
call progress_bar_copy
|
||||
call load_file
|
||||
test eax,eax
|
||||
jnz .error
|
||||
mov [save_file.size],ebx
|
||||
inc [current_progress_value_1]
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy
|
||||
call write_file
|
||||
test eax,eax
|
||||
jnz .error
|
||||
call sub_application_memory
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
ret
|
||||
|
||||
.error:
|
||||
call start_error_window_thread
|
||||
call sub_application_memory
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
add esp,4
|
||||
mov [move_file_flag],0
|
||||
jmp editbox_copy_name.exit_without_copy
|
||||
|
||||
.error_1:
|
||||
call start_error_window_thread
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[save_file.size]
|
||||
call sub_application_memory.1
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
add esp,4
|
||||
mov [move_file_flag],0
|
||||
jmp editbox_copy_name.exit_without_copy
|
||||
;-------------------------------------------------------------
|
||||
align 4
|
||||
copy_marked_files:
|
||||
mov [copy_many_files],byte 1
|
||||
mov [draw_all_progressbar],1
|
||||
xor eax,eax
|
||||
mov [current_progress_value],eax
|
||||
mov [current_progress_value_1],eax
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
mov eax,[left_marked_counter]
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov eax,[fb_left.marked_counter]
|
||||
mov [max_progress_value],eax
|
||||
mov ebp,[left_folder_block]
|
||||
mov ebp,[fb_left.folder_block]
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
add ebx,32+40
|
||||
test [ebx-40],byte 0x10
|
||||
jnz @f
|
||||
@@ -409,20 +436,20 @@ copy_marked_files:
|
||||
jnz .start
|
||||
cmp [move_file_flag],0
|
||||
je reload_dir_all
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [move_file_flag],0
|
||||
mov [copy_many_files],byte 0
|
||||
jmp reload_dir_all
|
||||
|
||||
.right_1:
|
||||
mov eax,[right_marked_counter]
|
||||
mov eax,[fb_right.marked_counter]
|
||||
mov [max_progress_value],eax
|
||||
mov ebp,[right_folder_block]
|
||||
mov ebp,[fb_right.folder_block]
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
add ebx,32+40
|
||||
test [ebx-40],byte 0x10
|
||||
jnz @f
|
||||
@@ -453,7 +480,7 @@ copy_marked_files:
|
||||
jnz .start_1
|
||||
cmp [move_file_flag],0
|
||||
je reload_dir_all
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [move_file_flag],0
|
||||
mov [copy_many_files],byte 0
|
||||
jmp reload_dir_all
|
||||
|
||||
@@ -4,28 +4,31 @@ create_directory:
|
||||
mov edi, edit1
|
||||
mov ed_size, dword 0
|
||||
mov ed_pos, dword 0
|
||||
default_box
|
||||
and word ed_flags,ed_shift_cl
|
||||
mov [create_dir_name],byte 0
|
||||
mcall 66, 1, 0
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 0
|
||||
jmp .red
|
||||
.red_1:
|
||||
call draw_window
|
||||
.red:
|
||||
call draw_create_dir
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key_create
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button_create
|
||||
mouse_edit_box create_editboxes
|
||||
jmp .still
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_mouse], create_editboxes
|
||||
else
|
||||
stdcall edit_box_mouse, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
.button_create:
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
test ah,ah
|
||||
jz .still
|
||||
cmp ah,160
|
||||
@@ -34,27 +37,30 @@ default_box
|
||||
je .exit_without_create
|
||||
cmp ah,1
|
||||
jne .still
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
.exit_with_create:
|
||||
call create_directory_1
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
call proc_read_left_folder
|
||||
jmp .exit_without_create
|
||||
@@:
|
||||
call proc_read_right_folder
|
||||
.exit_without_create:
|
||||
mcall 66, 1, 1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
jmp red
|
||||
;-------------------------------------------------------------
|
||||
.key_create:
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
cmp ah,13
|
||||
je .exit_with_create
|
||||
cmp ah,27
|
||||
je .exit_without_create
|
||||
key_edit_box create_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_key], create_editboxes
|
||||
else
|
||||
stdcall edit_box_key, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
draw_create_dir:
|
||||
@@ -68,7 +74,7 @@ draw_create_dir:
|
||||
shl ebx,16
|
||||
mov cx,60
|
||||
mov bx,174
|
||||
mcall 13, , ,0x6060ff ;0xff
|
||||
mcall SF_DRAW_RECT, , ,0x6060ff ;0xff
|
||||
pusha
|
||||
shr ebx,16
|
||||
add ebx,10
|
||||
@@ -77,7 +83,11 @@ draw_create_dir:
|
||||
mov eax,create_editboxes
|
||||
mov dword [eax+4],ebx
|
||||
mov dword [eax+8],ecx
|
||||
draw_edit_box create_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_draw], create_editboxes
|
||||
else
|
||||
stdcall edit_box_draw, create_editboxes
|
||||
end if
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
@@ -86,8 +96,7 @@ draw_create_dir:
|
||||
mov bx,40
|
||||
mov esi,0xffffff
|
||||
mov edx,0x40000000+160
|
||||
mov eax,8
|
||||
mcall
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -98,7 +107,7 @@ draw_create_dir:
|
||||
add ecx,37 shl 16
|
||||
mov bx,40
|
||||
mov cx,15
|
||||
mov edx,0
|
||||
xor edx,edx
|
||||
push ebx ecx
|
||||
sub ecx,1 shl 16
|
||||
sub ebx,1 shl 16
|
||||
@@ -118,7 +127,7 @@ draw_create_dir:
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,30 shl 16+1
|
||||
mcall 4, ,0x90ffffff,create_dir ;[confirmation_type]
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,sz_Create_dir ;[confirmation_type]
|
||||
add ebx,48 shl 16+36
|
||||
mov edx,type_yes
|
||||
mcall
|
||||
@@ -129,8 +138,8 @@ draw_create_dir:
|
||||
;-------------------------------------------------------------
|
||||
create_directory_1:
|
||||
mov edx,create_dir_name
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov esi,read_folder_name
|
||||
jmp .start
|
||||
@@:
|
||||
@@ -153,15 +162,11 @@ create_directory_1:
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
call create_directory_f70
|
||||
mcall SF_FILE, create_dir_file_data
|
||||
cmp eax,0
|
||||
je @f
|
||||
; mov ebx,0
|
||||
; sub ebx,eax
|
||||
; mov eax,ebx
|
||||
call start_error_window_thread
|
||||
@@:
|
||||
; call create_directory_f70
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
clear_file_buffer:
|
||||
|
||||
@@ -4,28 +4,31 @@ create_new_file:
|
||||
mov edi, edit1
|
||||
mov ed_size, dword 0
|
||||
mov ed_pos, dword 0
|
||||
default_box
|
||||
and word ed_flags,ed_shift_cl
|
||||
mov [create_dir_name],byte 0
|
||||
mcall 66, 1, 0
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 0
|
||||
jmp .red
|
||||
.red_1:
|
||||
call draw_window
|
||||
.red:
|
||||
call draw_create_file
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key_create
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button_create
|
||||
mouse_edit_box create_editboxes
|
||||
jmp .still
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_mouse], create_editboxes
|
||||
else
|
||||
stdcall edit_box_mouse, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
.button_create:
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
test ah,ah
|
||||
jz .still
|
||||
cmp ah,160
|
||||
@@ -34,27 +37,30 @@ default_box
|
||||
je .exit_without_create
|
||||
cmp ah,1
|
||||
jne .still
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
.exit_with_create:
|
||||
call create_new_file_1
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
call proc_read_left_folder
|
||||
jmp .exit_without_create
|
||||
@@:
|
||||
call proc_read_right_folder
|
||||
.exit_without_create:
|
||||
mcall 66, 1, 1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
jmp red
|
||||
;-------------------------------------------------------------
|
||||
.key_create:
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
cmp ah,13
|
||||
je .exit_with_create
|
||||
cmp ah,27
|
||||
je .exit_without_create
|
||||
key_edit_box create_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_key], create_editboxes
|
||||
else
|
||||
stdcall edit_box_key, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
draw_create_file:
|
||||
@@ -68,7 +74,7 @@ draw_create_file:
|
||||
shl ebx,16
|
||||
mov cx,60
|
||||
mov bx,174
|
||||
mcall 13, , ,0x6060ff ;0xff
|
||||
mcall SF_DRAW_RECT, , ,0x6060ff ;0xff
|
||||
pusha
|
||||
shr ebx,16
|
||||
add ebx,10
|
||||
@@ -77,17 +83,20 @@ draw_create_file:
|
||||
mov eax,create_editboxes
|
||||
mov dword [eax+4],ebx
|
||||
mov dword [eax+8],ecx
|
||||
draw_edit_box create_editboxes
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
add ecx,37 shl 16
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_draw], create_editboxes
|
||||
else
|
||||
stdcall edit_box_draw, create_editboxes
|
||||
end if
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
add ecx,37 shl 16
|
||||
mov cx,15
|
||||
mov bx,40
|
||||
mov esi,0xffffff
|
||||
mov edx,0x40000000+160
|
||||
mov eax,8
|
||||
mcall
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -98,7 +107,7 @@ draw_create_file:
|
||||
add ecx,37 shl 16
|
||||
mov bx,40
|
||||
mov cx,15
|
||||
mov edx,0
|
||||
xor edx,edx
|
||||
push ebx ecx
|
||||
sub ecx,1 shl 16
|
||||
sub ebx,1 shl 16
|
||||
@@ -118,7 +127,7 @@ draw_create_file:
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,30 shl 16+1
|
||||
mcall 4, ,0x90ffffff,create_file ;[confirmation_type]
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,sz_Create_file ;[confirmation_type]
|
||||
add ebx,48 shl 16+36
|
||||
mov edx,type_yes
|
||||
mcall
|
||||
@@ -129,8 +138,8 @@ draw_create_file:
|
||||
;-------------------------------------------------------------
|
||||
create_new_file_1:
|
||||
mov edx,create_dir_name
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov esi,read_folder_name
|
||||
jmp .start
|
||||
@@:
|
||||
@@ -156,12 +165,8 @@ create_new_file_1:
|
||||
call write_file
|
||||
cmp eax,0
|
||||
je @f
|
||||
; mov ebx,0
|
||||
; sub ebx,eax
|
||||
; mov eax,ebx
|
||||
call start_error_window_thread
|
||||
@@:
|
||||
; call create_directory_f70
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
;clear_file_buffer:
|
||||
|
||||
+24
-69
@@ -1,4 +1,11 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
if USE_STATIC_LIBS eq 0
|
||||
icons_max_size dd 0
|
||||
buttons_file_data:
|
||||
rb ICON_SIZE*numimages
|
||||
end if
|
||||
|
||||
align 4
|
||||
files_counter rd 1
|
||||
directories_counter rd 1
|
||||
@@ -35,53 +42,21 @@ date:
|
||||
open_param rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
PID rd 1
|
||||
active_process rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
window_high rd 1
|
||||
window_width rd 1
|
||||
window_status rd 1
|
||||
skin_high rd 1
|
||||
fbutton_width rd 1
|
||||
|
||||
left_panel_x:
|
||||
.size_x rw 1
|
||||
.start_x rw 1
|
||||
|
||||
left_panel_y:
|
||||
.size_y rw 1
|
||||
.start_y rw 1
|
||||
|
||||
right_panel_x:
|
||||
.size_x rw 1
|
||||
.start_x rw 1
|
||||
|
||||
right_panel_y:
|
||||
.size_y rw 1
|
||||
.start_y rw 1
|
||||
|
||||
left_panel_y_correct_size_y rw 1
|
||||
right_panel_y_correct_size_y rw 1
|
||||
|
||||
drawing_panel_folder rb 1 ; 1-left, 2 right
|
||||
window_status rb 1
|
||||
m_lost rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
mouse_position:
|
||||
.y rw 1
|
||||
.x rw 1
|
||||
mouse_keys rd 1
|
||||
mouse_keys_tick rd 1
|
||||
mouse_scroll_data:
|
||||
.vertical rw 1
|
||||
.horizontal rw 1
|
||||
left_scroll_compens rd 1
|
||||
right_scroll_compens rd 1
|
||||
mouse_keys_delta rb 1
|
||||
mouse_keys_delta_1 rb 1
|
||||
scroll_bar_event rb 1
|
||||
scroll_pointer rb 1
|
||||
scroll_pointer_1 rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
max_progress_value rd 1
|
||||
@@ -95,39 +70,15 @@ copy_many_files:
|
||||
rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
max_panel_line rd 1
|
||||
temp_panel_end rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
left_start_draw_line rd 1
|
||||
left_folder_block rd 1
|
||||
left_start_draw_cursor_line rw 1
|
||||
left_folder_block_1 rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
right_start_draw_line rd 1
|
||||
right_folder_block rd 1
|
||||
right_start_draw_cursor_line rw 1
|
||||
right_folder_block_1 rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sort_counter rd 1
|
||||
sorting_low_limit rd 1
|
||||
sorting_high_limit rd 1
|
||||
dir_temp_counter rd 1
|
||||
dir_temp_counter_1 rd 1
|
||||
draw_scroll_character rb 1
|
||||
nesting_direction rb 1
|
||||
dir_or_file rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
left_marked_counter rd 1
|
||||
right_marked_counter rd 1
|
||||
confirmation_type rd 1
|
||||
recursive_pointer rd 1
|
||||
marked_file rb 1
|
||||
marked_action rb 1
|
||||
mark_action_counter rb 1
|
||||
work_confirmation rb 1
|
||||
work_confirmation_yes rb 1
|
||||
delete_marked_yes rb 1
|
||||
@@ -137,8 +88,6 @@ move_file_flag rb 1
|
||||
align 4
|
||||
start_draw_menu_cursor_line rd 1
|
||||
search_pre_folder rb 1
|
||||
not_clear_lines rb 1
|
||||
select_panel_counter rb 1
|
||||
extended_key rb 1
|
||||
press_enter_menu rb 1
|
||||
close_menu rb 1
|
||||
@@ -150,19 +99,17 @@ file_name_length rd 1
|
||||
temp_counter_dword rd 1
|
||||
error_pointer rd 1
|
||||
file_system_error rd 1
|
||||
end_tag rd 1
|
||||
icons_end_tag rd 1
|
||||
exit_to_dir rb 1
|
||||
exit_dir rb 1
|
||||
use_patch rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
appl_memory rd 1
|
||||
appl_memory_old rd 1
|
||||
buttons_img_start rd 1
|
||||
ini_file_start rd 1
|
||||
left_folder_data rd 1
|
||||
right_folder_data rd 1
|
||||
ini_size rd 1
|
||||
lfd_size rd 1
|
||||
rfd_size rd 1
|
||||
tmp_memory rd 1
|
||||
tm_size rd 1
|
||||
;---------------------------------------------------------------------
|
||||
shift_flag rb 1
|
||||
ctrl_flag rb 1
|
||||
@@ -198,9 +145,13 @@ align 4
|
||||
retrieved_devices_table:
|
||||
rb 10*100
|
||||
;---------------------------------------------------------------------
|
||||
converted_ini_buffer:
|
||||
rb 8192
|
||||
ini_src_end:
|
||||
rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
procinfo:
|
||||
rb 1024
|
||||
procinfo process_information
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
type_name:
|
||||
@@ -221,6 +172,8 @@ delete_dir_data:
|
||||
align 4
|
||||
extension_temp_storage:
|
||||
rb 256
|
||||
name_temp_area rb 256
|
||||
keymap_area rb 128
|
||||
;---------------------------------------------------------------------
|
||||
;stack
|
||||
align 4
|
||||
@@ -267,3 +220,5 @@ align 4
|
||||
read_folder_3_name:
|
||||
rb 64
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sc system_colors
|
||||
+71
-77
@@ -1,8 +1,9 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_file:
|
||||
; call progress_bar
|
||||
; jmp still
|
||||
mov [confirmation_type],delete_type
|
||||
mov [confirmation_type],sz_Delete_files
|
||||
call confirmation_action
|
||||
cmp [work_confirmation_yes],1
|
||||
jne red ;reload_dir
|
||||
@@ -16,30 +17,30 @@ delete_file:
|
||||
|
||||
call delete_marked_files
|
||||
cmp [delete_marked_yes],1
|
||||
je .end_1 ;reload_dir_all
|
||||
je .end_1 ;reload_dir_all
|
||||
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[left_start_draw_line]
|
||||
mov ebx,[fb_left.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
call prepare_data_7
|
||||
mov esi,read_folder_name ;read_folder.name
|
||||
jmp .end
|
||||
.right_1:
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[right_start_draw_line]
|
||||
mov ebx,[fb_right.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
call prepare_data_7
|
||||
mov esi,read_folder_1_name ;read_folder_1.name
|
||||
.end:
|
||||
@@ -47,7 +48,7 @@ delete_file:
|
||||
mov edi,file_name ;delete_file_data.name
|
||||
call copy_path_1
|
||||
test [ebx-40],byte 0x10
|
||||
jz @f
|
||||
jz @f
|
||||
push eax ebx
|
||||
xor eax,eax
|
||||
mov [current_progress_value],eax
|
||||
@@ -63,14 +64,15 @@ delete_file:
|
||||
call start_error_window_thread
|
||||
jmp reload_dir_all
|
||||
.end_1:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right
|
||||
call proc_read_left_folder
|
||||
jmp red
|
||||
.right:
|
||||
call proc_read_right_folder
|
||||
jmp red
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_marked_files:
|
||||
mov eax,[directories_counter]
|
||||
add eax,[files_counter]
|
||||
@@ -81,16 +83,14 @@ delete_marked_files:
|
||||
mov [delete_marked_yes],al
|
||||
mov [draw_all_progressbar],1
|
||||
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
; mov eax,[left_marked_counter]
|
||||
; mov [max_progress_value],eax
|
||||
mov ebp,[left_folder_block]
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov ebp,[fb_left.folder_block]
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -108,18 +108,16 @@ delete_marked_files:
|
||||
jnz .start
|
||||
cmp [delete_marked_yes],0
|
||||
je @f
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
@@:
|
||||
ret
|
||||
.right_1:
|
||||
; mov eax,[right_marked_counter]
|
||||
; mov [max_progress_value],eax
|
||||
mov ebp,[right_folder_block]
|
||||
mov ebp,[fb_right.folder_block]
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -137,10 +135,11 @@ delete_marked_files:
|
||||
jnz .start_1
|
||||
cmp [delete_marked_yes],0
|
||||
je @f
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
prepare_data_6:
|
||||
mov [error_pointer],ebx
|
||||
mov edi,file_name ;delete_file_data.name
|
||||
@@ -162,6 +161,7 @@ prepare_data_6:
|
||||
.continue:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
prepare_data_7:
|
||||
add ebx,32+40
|
||||
cmp [ebx],word '..'
|
||||
@@ -173,88 +173,82 @@ prepare_data_7:
|
||||
.continue:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_dir:
|
||||
pusha
|
||||
mov [recursive_pointer],0
|
||||
mov eax,[appl_memory]
|
||||
mov [appl_memory_old],eax
|
||||
.1:
|
||||
mov [read_delete_dir_data.size],0
|
||||
mov [read_delete_dir_data.return],delete_dir_data
|
||||
call read_delete_dir
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov [read_delete_dir_data.size],0
|
||||
mov [read_delete_dir_data.return],delete_dir_data
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov [error_pointer],file_name
|
||||
call start_error_window_thread
|
||||
call start_error_window_thread
|
||||
popa
|
||||
add esp,8+4
|
||||
jmp still
|
||||
add esp,8+4
|
||||
jmp still
|
||||
@@:
|
||||
mov eax,[delete_dir_data+8]
|
||||
test eax,eax
|
||||
jnz @f
|
||||
inc [current_progress_value]
|
||||
call progress_bar_delete
|
||||
call del_file
|
||||
test eax,eax
|
||||
jz .end
|
||||
mov eax,[delete_dir_data+8]
|
||||
test eax,eax
|
||||
jnz @f
|
||||
inc [current_progress_value]
|
||||
call progress_bar_delete
|
||||
call del_file
|
||||
test eax,eax
|
||||
jz .end
|
||||
mov [error_pointer],file_name
|
||||
call start_error_window_thread
|
||||
call start_error_window_thread
|
||||
popa
|
||||
add esp,8+4
|
||||
jmp still
|
||||
add esp,8+4
|
||||
jmp still
|
||||
@@:
|
||||
imul eax,304
|
||||
add eax,32
|
||||
mov ebx,eax
|
||||
add ebx,[appl_memory_old]
|
||||
cmp ebx,[appl_memory]
|
||||
jbe @f
|
||||
mov ecx,[appl_memory]
|
||||
mov ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
@@:
|
||||
mov eax,[delete_dir_data+8]
|
||||
mov [read_delete_dir_data.size],eax
|
||||
mov eax,[appl_memory_old]
|
||||
mov [read_delete_dir_data.return],eax
|
||||
call read_delete_dir
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov ecx,eax
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
|
||||
mov [read_delete_dir_data.return],eax
|
||||
mov eax,[delete_dir_data+8]
|
||||
mov [read_delete_dir_data.size],eax
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov [error_pointer],file_name
|
||||
call start_error_window_thread
|
||||
call start_error_window_thread
|
||||
popa
|
||||
add esp,8+4
|
||||
jmp still
|
||||
add esp,8+4
|
||||
jmp still
|
||||
@@:
|
||||
call delete_dir_1
|
||||
jc .1
|
||||
call delete_dir_1
|
||||
jc .1
|
||||
.end:
|
||||
call return_delete_path
|
||||
dec [recursive_pointer]
|
||||
cmp [recursive_pointer],0
|
||||
jge .1
|
||||
@@:
|
||||
mov ecx,[appl_memory_old]
|
||||
cmp [appl_memory],ecx
|
||||
je @f
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
@@:
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_dir_1:
|
||||
mov ebp,[appl_memory_old]
|
||||
mov ebp,[tmp_memory]
|
||||
mov ebp,[ebp+8]
|
||||
align 4
|
||||
.start:
|
||||
test ebp,ebp
|
||||
jz .continue_4
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[appl_memory_old]
|
||||
add ebx,[tmp_memory]
|
||||
add ebx,32+40
|
||||
cmp [ebx],byte '.'
|
||||
jne @f
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
device_detect_f70:
|
||||
mov ax,[select_disk_char]
|
||||
mov [read_folder_2_name],ax
|
||||
mov [read_folder_3_name],ax
|
||||
; mov eax,left_folder_data_1
|
||||
; mov [read_folder_2.return],eax
|
||||
mcall 70, read_folder_2
|
||||
mcall SF_FILE, read_folder_2
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
@@ -21,7 +22,7 @@ device_detect_f70:
|
||||
call copy_folder_name_3
|
||||
; mov eax,right_folder_data_1
|
||||
; mov [read_folder_3.return],eax
|
||||
mcall 70, read_folder_3
|
||||
mcall SF_FILE, read_folder_3
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
@@ -56,7 +57,8 @@ device_detect_f70:
|
||||
cmp eax,[left_folder_block_1]
|
||||
jb .start_temp_counter_1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
select_starting_directories:
|
||||
mov esi,retrieved_devices_table+1
|
||||
call copy_folder_name
|
||||
@@ -84,6 +86,7 @@ select_starting_directories:
|
||||
; mov [read_folder_1_name+6],byte 0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
proc_copy_patch:
|
||||
@@:
|
||||
cld
|
||||
|
||||
+233
-759
File diff suppressed because it is too large.
Load diff
@@ -1,10 +1,11 @@
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
draw_device_button:
|
||||
call device_detect_f70
|
||||
mov edi,[retrieved_devices_table_counter]
|
||||
mov edx,120
|
||||
mov bx,[left_panel_x.start_x]
|
||||
mov cx,[left_panel_y.start_y]
|
||||
mov bx,[fb_left.start_x]
|
||||
mov cx,[fb_left.start_y]
|
||||
shl ebx,16
|
||||
sub cx,30
|
||||
shl ecx,16
|
||||
@@ -22,12 +23,11 @@ draw_device_button:
|
||||
jnz @b
|
||||
|
||||
sub esi,ebp
|
||||
lea esi,[esi*3]
|
||||
shl esi,1
|
||||
shl esi,3
|
||||
mov bx,si
|
||||
pop esi
|
||||
|
||||
mcall 8
|
||||
mcall SF_DEFINE_BUTTON
|
||||
|
||||
pusha
|
||||
mov eax,ebx
|
||||
@@ -36,7 +36,7 @@ draw_device_button:
|
||||
add ebx,eax
|
||||
mov bx,2
|
||||
inc ecx
|
||||
mcall 13,,,0xcccccc
|
||||
mcall SF_DRAW_RECT, ,,[sc.work]
|
||||
popa
|
||||
|
||||
pusha
|
||||
@@ -44,8 +44,8 @@ draw_device_button:
|
||||
inc edx
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,4 shl 16
|
||||
mcall 4,,0x90000000
|
||||
add ebx,8 shl 16
|
||||
mcall SF_DRAW_TEXT, ,0x90000000
|
||||
sub ebx,1 shl 16 + 1
|
||||
mcall ,,0x90ffffff
|
||||
popa
|
||||
@@ -60,17 +60,16 @@ draw_device_button:
|
||||
dec edi
|
||||
jnz .loop
|
||||
|
||||
xor eax,eax
|
||||
mov ax,[right_panel_x.start_x]
|
||||
add ax,[right_panel_x.size_x]
|
||||
movzx eax,[fb_right.start_x]
|
||||
add ax,[fb_right.size_x]
|
||||
add ax,[sb_right.x_size]
|
||||
ror ebx,16
|
||||
sub ax,bx
|
||||
rol ebx,16
|
||||
inc ax
|
||||
mov bx,ax
|
||||
|
||||
add ecx,1
|
||||
add ebx,1
|
||||
mcall 13,,,0xcccccc
|
||||
mcall SF_DRAW_RECT, ,,[sc.work]
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
@@ -1,278 +0,0 @@
|
||||
; SEE YOU File FAQ.txt and HISTORY. Good Like!
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
include 'editbox.mac' ;макрос который должен облегчить жизнь :) специально для editbox
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
macro use_edit_box procinfo,scr_h,scr_w
|
||||
{
|
||||
edit_box:
|
||||
ed_width equ [edi] ;ширина компонента
|
||||
ed_left equ [edi+4] ;положение по оси х
|
||||
ed_top equ [edi+8] ;положение по оси у
|
||||
ed_color equ [edi+12] ;цвет фона компонента
|
||||
shift_color equ [edi+16] ;=0x6a9480
|
||||
ed_focus_border_color equ [edi+20] ;цвет рамки компонента
|
||||
ed_blur_border_color equ [edi+24] ;цвет не активного компонента
|
||||
ed_text_color equ [edi+28] ;цвет текста
|
||||
ed_max equ [edi+32] ;кол-во символов которые можно максимально ввести
|
||||
ed_text equ [edi+36] ;указатель на буфер
|
||||
ed_flags equ [edi+40] ;флаги
|
||||
ed_size equ [edi+42] ;кол-во символов
|
||||
ed_pos equ [edi+46] ;позиция курсора
|
||||
ed_offset equ [edi+50] ;смещение
|
||||
cl_curs_x equ [edi+54] ;предыдущее координата курсора по х
|
||||
cl_curs_y equ [edi+58] ;предыдущее координата курсора по у
|
||||
ed_shift_pos equ [edi+62] ;положение курсора
|
||||
ed_shift_pos_old equ [edi+66] ;старое положение курсора
|
||||
;==========================================================
|
||||
;=== процедура прорисовки =================================
|
||||
;==========================================================
|
||||
.draw:
|
||||
pusha
|
||||
;--- рисуем рамку ---
|
||||
call .draw_border ; Функция стабильна
|
||||
.draw_bg_cursor_text:
|
||||
;--- изменяем смещение, если надо ---
|
||||
call .check_offset ;вычисление позиции курсора стабильна
|
||||
;--- рисуем внутреннюю область ---
|
||||
call .draw_bg ;нарисовать прямоугольник рабочей области
|
||||
;---- рисуем выделение, по shift если есть
|
||||
call .draw_shift
|
||||
.draw_cursor_text:
|
||||
;--- рисуем курсор ---
|
||||
;--- может его не надо рисовать ----
|
||||
test word ed_flags,ed_focus
|
||||
je @f
|
||||
call .draw_cursor
|
||||
@@:
|
||||
call .draw_text
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Общий выход из editbox для всех функций и пост обработчиков
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.editbox_exit:
|
||||
edit_ex
|
||||
;==========================================================
|
||||
;=== обработка клавиатуры =================================
|
||||
;==========================================================
|
||||
.key:
|
||||
pusha
|
||||
test word ed_flags,ed_focus ; если не в фокусе, выходим
|
||||
je .editbox_exit
|
||||
test word ed_flags,ed_mouse_on
|
||||
jne .editbox_exit
|
||||
|
||||
;Проверка нажат shift ?
|
||||
call .check_shift
|
||||
;----------------------------------------------------------
|
||||
;--- проверяем, что нажато --------------------------------
|
||||
;----------------------------------------------------------
|
||||
use_key_process backspase,delete,left,right,home,end,insert
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Заглушка на обработку клавиш вверх и вниз т.е. при обнаружении этих кодов происходит выход из обработчика
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_no_process up,down,esc
|
||||
;--- нажата другая клавиша ---
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Проверка установлен ли флаг при котором нужно выводить только цифры в нужном боксе если такойнеобходимости нет нужно закоментировать макрос
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_figures_only
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;проверка на shift был ли нажат
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
are_key_shift_press
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; проверяем, находится ли курсор в конце + дальнейшая обработка
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
are_key_cur_end
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Обработка клавиш insert,delete.backspase,home,end,left,right
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_work_key
|
||||
;==========================================================
|
||||
;=== обработка мыши =======================================
|
||||
;==========================================================
|
||||
.mouse:
|
||||
pusha
|
||||
;debug
|
||||
;----------------------------------------------------------
|
||||
;--- получаем состояние кнопок мыши -----------------------
|
||||
;----------------------------------------------------------
|
||||
mcall 37,2
|
||||
;----------------------------------------------------------
|
||||
;--- проверяем состояние ----------------------------------
|
||||
;----------------------------------------------------------
|
||||
test eax,1
|
||||
jnz .mouse_left_button
|
||||
and word ed_flags,ed_mouse_on_off
|
||||
xor ebx,ebx
|
||||
mov dword [mouse_flag],ebx
|
||||
jmp .editbox_exit
|
||||
.mouse_left_button:
|
||||
;----------------------------------------------------------
|
||||
;--- блокировка от фокусировки в других боксах при попадании на них курсора
|
||||
;----------------------------------------------------------
|
||||
mov eax,dword [mouse_flag]
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,edi
|
||||
je @f
|
||||
jmp ._blur
|
||||
;----------------------------------------------------------
|
||||
;--- получаем координаты мыши относительно 0 т.е всей области экрана
|
||||
;----------------------------------------------------------
|
||||
@@: mcall 37,0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Функция обработки мышки получение координат и проверка их + выделения
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_work_mause scr_h,scr_w
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Общие функции обработки
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_general_func
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Функции для работы с key
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_func
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Функции для работы с mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_mouse_func scr_w
|
||||
}
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Bit mask from editbox
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ed_figure_only= 1000000000000000b ;одни символы
|
||||
ed_always_focus= 100000000000000b
|
||||
ed_focus= 10b ;фокус приложения
|
||||
ed_shift_on= 1000b ;если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая shift
|
||||
ed_shift_on_off=1111111111110111b
|
||||
ed_shift= 100b ;включается при нажатии на shift т.е. если нажимаю
|
||||
ed_shift_off= 1111111111111011b
|
||||
ed_shift_bac= 10000b ;бит для очистки выделеного shift т.е. при установке говорит что есть выделение
|
||||
ed_shift_bac_cl=1111111111101111b ;очистка при удалении выделения
|
||||
ed_shift_cl= 1111111111100011b
|
||||
ed_shift_mcl= 1111111111111011b
|
||||
ed_left_fl= 100000b
|
||||
ed_right_fl= 1111111111011111b
|
||||
ed_offset_fl= 1000000b
|
||||
ed_offset_cl= 1111111110111111b
|
||||
ed_insert= 10000000b
|
||||
ed_insert_cl= 1111111101111111b
|
||||
ed_mouse_on = 100000000b
|
||||
ed_mous_adn_b= 100011000b
|
||||
ed_mouse_on_off=1111111011111111b
|
||||
ed_height=14 ; высота
|
||||
macro draw_edit_boxes start,_end,use_f9,procinfo
|
||||
{
|
||||
if use_f9 eq
|
||||
else
|
||||
mcall 9,procinfo,-1
|
||||
end if
|
||||
mov edi,start
|
||||
mov ecx,((_end-start)/ed_struc_size)
|
||||
@@:
|
||||
call edit_box.draw
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
|
||||
macro mouse_edit_boxes start,_end
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((_end-start)/ed_struc_size)
|
||||
@@:
|
||||
call edit_box.mouse
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
|
||||
macro key_edit_boxes start,end
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((end-start)/ed_struc_size)
|
||||
@@:
|
||||
call edit_box.key
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
ed_struc_size=70
|
||||
struc edit_box width,left,top,color,shift_color,focus_border_color,\
|
||||
blur_border_color,text_color,max,text,flags,size,pos
|
||||
{
|
||||
.width dd width
|
||||
.left dd left
|
||||
.top dd top
|
||||
.color dd color
|
||||
.shift_color dd shift_color
|
||||
.focus_border_color dd focus_border_color
|
||||
.blur_border_color dd blur_border_color
|
||||
.text_color dd text_color
|
||||
.max dd max
|
||||
.text dd text
|
||||
.flags dw flags+0
|
||||
.size dd size+0
|
||||
.pos dd pos+0
|
||||
.offset dd 0
|
||||
.cl_curs_x dd 0
|
||||
.cl_curs_y dd 0
|
||||
.shift dd 0
|
||||
.shift_old dd 0
|
||||
}
|
||||
|
||||
|
||||
macro edit_boxes_set_sys_color start,end,color_table
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((end-start)/ed_struc_size)
|
||||
mov esi,color_table
|
||||
@@:
|
||||
mov eax,[esi+36]
|
||||
mov ebx,[esi+20]
|
||||
mov ed_focus_border_color,eax
|
||||
shr bh,1
|
||||
shr bl,1
|
||||
shr ah,1
|
||||
shr al,1
|
||||
add ah,bh
|
||||
add al,bl
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
shr bl,1
|
||||
shr al,1
|
||||
add al,bl
|
||||
ror eax,16
|
||||
mov ed_blur_border_color,eax
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
|
||||
macro draw_edit_box ed_ptr,use_f9,procinfo
|
||||
{
|
||||
if use_f9 eq
|
||||
else
|
||||
mcall 9,procinfo,-1
|
||||
end if
|
||||
mov edi,ed_ptr
|
||||
call edit_box.draw
|
||||
}
|
||||
|
||||
macro mouse_edit_box ed_ptr
|
||||
{
|
||||
mov edi,ed_ptr
|
||||
call edit_box.mouse
|
||||
}
|
||||
|
||||
macro key_edit_box ed_ptr
|
||||
{
|
||||
mov edi,ed_ptr
|
||||
call edit_box.key
|
||||
}
|
||||
macro default_box ed_ptr
|
||||
{
|
||||
pusha
|
||||
; xor eax,eax
|
||||
; mov ed_shift_pos,eax
|
||||
; mov ed_shift_pos_old,eax
|
||||
and word ed_flags,ed_shift_cl
|
||||
; mov ed_offset,eax
|
||||
popa
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -4,36 +4,33 @@ read_folder_error:
|
||||
read_folder_1_error:
|
||||
mov [error_pointer],read_folder_1_name ;read_folder_1.name
|
||||
jmp error_window
|
||||
initiation_error:
|
||||
mov [error_pointer],ini_file_name
|
||||
jmp error_window
|
||||
error_window:
|
||||
mov [file_system_error],eax
|
||||
.red:
|
||||
call draw_error_window
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button
|
||||
jmp .still
|
||||
.button:
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
jmp .still
|
||||
;---------------------------------------------------------------------
|
||||
draw_error_window:
|
||||
mcall 12, 1
|
||||
mcall 0,[error_window_x] ,[error_window_y], 0x03D22F36
|
||||
mcall 4,<10,30>,0x90ffffff,[error_pointer]
|
||||
mcall 4,<10,50>, ,error_type
|
||||
mcall 47,0xa0000,[file_system_error],<148,50>,0x10ffffff
|
||||
mcall 12, 2
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
mcall SF_CREATE_WINDOW, [error_window_x] ,[error_window_y], 0x03D22F36
|
||||
mcall SF_DRAW_TEXT, <10,30>,0x90ffffff,[error_pointer]
|
||||
mcall SF_DRAW_TEXT, <10,50>, ,error_type
|
||||
mcall SF_DRAW_NUMBER, 0x800a0000,[file_system_error],<154,50>,0x10ffffff
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
start_error_window_thread:
|
||||
mov [file_system_error],eax
|
||||
mcall 9, procinfo, -1
|
||||
mcall SF_THREAD_INFO, procinfo, -1
|
||||
mov eax,[ebx+46]
|
||||
shr eax,1
|
||||
add eax,[ebx+38]
|
||||
@@ -44,7 +41,7 @@ start_error_window_thread:
|
||||
add eax,[ebx+34]
|
||||
sub eax,ERR_WINW/2
|
||||
mov [error_window_x+2],ax
|
||||
mcall 51,1,thread_start,thread_stack
|
||||
mcall SF_THREAD_CONTROL, SSF_CREATE_THREAD,thread_start,thread_stack
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
thread_start:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
align 4
|
||||
files_information:
|
||||
xor eax,eax
|
||||
mov [alt_flag],al
|
||||
@@ -10,23 +11,23 @@ files_information:
|
||||
jmp still
|
||||
;------------------------------------------------------------------------------
|
||||
start_files_information_thread:
|
||||
mcall 9,procinfo,-1
|
||||
mov eax,[ebx+46]
|
||||
mcall SF_THREAD_INFO, procinfo,-1
|
||||
mov eax,[procinfo.box.height]
|
||||
shr eax,1
|
||||
add eax,[ebx+38]
|
||||
add eax,[procinfo.box.top]
|
||||
sub eax,INF_WINH/2
|
||||
mov [files_information_window_y+2],ax
|
||||
mov eax,[ebx+42]
|
||||
mov eax,[procinfo.box.width]
|
||||
shr eax,1
|
||||
add eax,[ebx+34]
|
||||
add eax,[procinfo.box.left]
|
||||
sub eax,INF_WINW/2
|
||||
mov [files_information_window_x+2],ax
|
||||
mcall 51,1,thread_files_information_start,thread_stack
|
||||
mcall SF_THREAD_CONTROL, SSF_CREATE_THREAD,thread_files_information_start,thread_stack
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
draw_files_information_window:
|
||||
mcall 12,1
|
||||
mcall 0,[files_information_window_x],[files_information_window_y],0x33ffffcc,,infowin_title
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
mcall SF_CREATE_WINDOW, [files_information_window_x],[files_information_window_y],0x33ffffcc,,infowin_title
|
||||
mov edx,INF_DATAX shl 16+INF_DATAY+INF_LINEH
|
||||
mov ebx,0x800a0000
|
||||
mov esi,0x10000000
|
||||
@@ -40,7 +41,7 @@ draw_files_information_window:
|
||||
;--------------------------------------
|
||||
.continue_4:
|
||||
; show files counter
|
||||
mcall 47,,[files_counter]
|
||||
mcall SF_DRAW_NUMBER, ,[files_counter]
|
||||
;--------------------------------------
|
||||
@@:
|
||||
cmp [inf_marked_yes],1
|
||||
@@ -60,7 +61,7 @@ draw_files_information_window:
|
||||
@@:
|
||||
; show file or directory size
|
||||
add edx,INF_LINEH
|
||||
mcall 47,0xc0140001,files_size
|
||||
mcall SF_DRAW_NUMBER, 0xc0140001,files_size
|
||||
;--------------------------------------
|
||||
mov ebp,date.create
|
||||
call show_date_and_time_of_files_information
|
||||
@@ -71,8 +72,8 @@ draw_files_information_window:
|
||||
mov ebp,date.access
|
||||
call show_date_and_time_of_files_information
|
||||
;--------------------------------------
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
|
||||
mov edx,read_folder_name
|
||||
jmp @f
|
||||
@@ -81,7 +82,7 @@ draw_files_information_window:
|
||||
mov edx,read_folder_1_name
|
||||
;--------------------------------------
|
||||
@@:
|
||||
mcall 4,<INF_DATAX,INF_DATAY>,0x90000000, ;file_name
|
||||
mcall SF_DRAW_TEXT, <INF_DATAX,INF_DATAY>,0x90000000, ;file_name
|
||||
mcall ,<10,INF_DATAY>,0x90000000,type_location
|
||||
cmp [inf_marked_yes],1
|
||||
je .continue
|
||||
@@ -139,7 +140,7 @@ draw_files_information_window:
|
||||
add ebx,INF_LINEH
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
show_date_and_time_of_files_information:
|
||||
@@ -173,28 +174,29 @@ thread_files_information_start:
|
||||
call draw_files_information_window
|
||||
;--------------------------------------
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red
|
||||
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key
|
||||
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button
|
||||
|
||||
jmp .still
|
||||
;--------------------------------------
|
||||
.key:
|
||||
mcall 2
|
||||
mcall SF_GET_KEY
|
||||
;--------------------------------------
|
||||
.button:
|
||||
mcall -1
|
||||
jmp .still
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;jmp .still
|
||||
;------------------------------------------------------------------------------
|
||||
; фхыхэшх 64-сшЄэюую ўшёыр divident эр 16-сшЄэюх ўшёыю divisor.
|
||||
; ╫рёЄэюх яюьх∙рхЄё т 64-сшЄэє■ яхЁхьхээє■ quotent,
|
||||
; р юёЄрЄюъ - т 16-сшЄэє■ яхЁхьхээє■ modulo
|
||||
align 4
|
||||
Division_64bit:
|
||||
mov ax,[ebp+6]
|
||||
xor dx,dx
|
||||
@@ -222,6 +224,7 @@ quotent:
|
||||
;modulo:
|
||||
; rb 2
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
copy_type_name:
|
||||
push esi
|
||||
mov esi,ebx
|
||||
@@ -237,6 +240,7 @@ copy_type_name:
|
||||
pop esi
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
get_files_information:
|
||||
call get_information_marked_files
|
||||
cmp [inf_marked_yes],1
|
||||
@@ -244,28 +248,28 @@ get_files_information:
|
||||
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[left_start_draw_line]
|
||||
mov ebx,[fb_left.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
call prepare_data_8
|
||||
mov esi,read_folder_name
|
||||
jmp .end
|
||||
;--------------------------------------
|
||||
.right_1:
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[right_start_draw_line]
|
||||
mov ebx,[fb_right.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
call prepare_data_8
|
||||
mov esi,read_folder_1_name
|
||||
;--------------------------------------
|
||||
@@ -327,19 +331,20 @@ get_files_information:
|
||||
.end_2:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
get_information_marked_files:
|
||||
xor eax,eax
|
||||
mov [inf_marked_yes],al
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
|
||||
mov ebp,[left_folder_block]
|
||||
mov ebp,[fb_left.folder_block]
|
||||
;--------------------------------------
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -363,14 +368,15 @@ get_information_marked_files:
|
||||
|
||||
ret
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.right_1:
|
||||
mov ebp,[right_folder_block]
|
||||
mov ebp,[fb_right.folder_block]
|
||||
;--------------------------------------
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -394,6 +400,9 @@ get_information_marked_files:
|
||||
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
; in:
|
||||
; ebp = ..._folder_block
|
||||
align 4
|
||||
prepare_data_9:
|
||||
mov [error_pointer],ebx
|
||||
mov edi,file_name
|
||||
@@ -423,6 +432,7 @@ prepare_data_9:
|
||||
.continue_1:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
prepare_data_8:
|
||||
add ebx,32+40
|
||||
cmp [ebx],word '..'
|
||||
@@ -432,8 +442,8 @@ prepare_data_8:
|
||||
jne .continue
|
||||
|
||||
add esp,4+4
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
|
||||
call proc_read_left_folder
|
||||
jmp red
|
||||
@@ -445,17 +455,18 @@ prepare_data_8:
|
||||
.continue:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
; in:
|
||||
; ebp = ..._folder_block
|
||||
align 4
|
||||
get_inf_dir:
|
||||
mov [nesting_direction],0
|
||||
pusha
|
||||
mov [recursive_pointer],0
|
||||
mov eax,[appl_memory]
|
||||
mov [appl_memory_old],eax
|
||||
;--------------------------------------
|
||||
.1:
|
||||
mov [read_delete_dir_data.size],0
|
||||
mov [read_delete_dir_data.return],delete_dir_data
|
||||
call read_delete_dir
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
@@ -469,22 +480,17 @@ get_inf_dir:
|
||||
mov eax,[delete_dir_data+8]
|
||||
imul eax,304
|
||||
add eax,32
|
||||
mov ebx,eax
|
||||
add ebx,[appl_memory_old]
|
||||
cmp ebx,[appl_memory]
|
||||
jbe @f
|
||||
|
||||
mov ecx,[appl_memory]
|
||||
mov ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
;--------------------------------------
|
||||
@@:
|
||||
mov ecx,eax
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
|
||||
mov [read_delete_dir_data.return],eax
|
||||
mov eax,[delete_dir_data+8]
|
||||
mov [read_delete_dir_data.size],eax
|
||||
mov eax,[appl_memory_old]
|
||||
mov [read_delete_dir_data.return],eax
|
||||
call read_delete_dir
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
@@ -498,7 +504,8 @@ get_inf_dir:
|
||||
cmp [nesting_direction],0
|
||||
je @f
|
||||
|
||||
call get_inf_dir_2
|
||||
pop ebp
|
||||
call get_inf_dir_1.start
|
||||
jnc .end
|
||||
|
||||
dec ebp
|
||||
@@ -518,26 +525,16 @@ get_inf_dir:
|
||||
cmp [recursive_pointer],0
|
||||
jge .1
|
||||
|
||||
mov ecx,[appl_memory_old]
|
||||
cmp [appl_memory],ecx
|
||||
je @f
|
||||
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
;--------------------------------------
|
||||
@@:
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
popa
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
get_inf_dir_2:
|
||||
pop eax
|
||||
pop ebp
|
||||
push eax
|
||||
jmp get_inf_dir_1.start
|
||||
;--------------------------------------
|
||||
align 4
|
||||
get_inf_dir_1:
|
||||
inc [directories_counter]
|
||||
mov ebp,[appl_memory_old]
|
||||
mov ebp,[tmp_memory]
|
||||
mov ebp,[ebp+8]
|
||||
;--------------------------------------
|
||||
.start:
|
||||
@@ -546,7 +543,7 @@ get_inf_dir_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[appl_memory_old]
|
||||
add ebx,[tmp_memory]
|
||||
add ebx,32+40
|
||||
cmp [ebx],byte '.'
|
||||
jne @f
|
||||
@@ -591,19 +588,3 @@ get_inf_dir_1:
|
||||
mov [nesting_direction],0
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
;type_patch_test:
|
||||
; pusha
|
||||
; mcall 5,200
|
||||
; mcall 13,<290,300>,<3,13>,0x0
|
||||
; mcall 4,<300,5>,0x80FFFFFF,file_name ;[error_pointer]
|
||||
; mcall 47,0x160100,[recursive_pointer],<300,5>,0xffffff
|
||||
; mcall 47,0x160100,ebp,<300,5>,0xffffff
|
||||
; mcall 5,1
|
||||
; popa
|
||||
; ret
|
||||
;temp_value_1 db '1',0
|
||||
;temp_value_2 db '2',0
|
||||
;temp_value_3 db '3',0
|
||||
;temp_value_4 db '4',0
|
||||
;temp_value_5 db '5',0
|
||||
;------------------------------------------------------------------------------
|
||||
+138
-250
@@ -1,130 +1,86 @@
|
||||
read_delete_dir:
|
||||
mcall 70, read_delete_dir_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
create_directory_f70:
|
||||
mcall 70, create_dir_file_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
del_file:
|
||||
mcall 70, delete_file_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
start_appl:
|
||||
mcall 70, start_file_data
|
||||
mcall SF_FILE, delete_file_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
get_file_size:
|
||||
mcall 70, read_file_features
|
||||
mcall SF_FILE, read_file_features
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
load_file:
|
||||
mcall 70, read_file
|
||||
mcall SF_FILE, read_file
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
write_file:
|
||||
mcall 70, save_file
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
add_write_file:
|
||||
mcall 70, add_save_file
|
||||
mcall SF_FILE, save_file
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
; out:
|
||||
; eax - 0 or error code
|
||||
align 4
|
||||
proc_read_left_folder:
|
||||
mov ebx,304
|
||||
push ebx ecx
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,ebx
|
||||
mov [esp],ebx
|
||||
mov ebx,[appl_memory]
|
||||
mov [esp+4],ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
call move_up_right_table
|
||||
pop ecx ebx
|
||||
push ebx ecx edx
|
||||
mov ecx,[lfd_size]
|
||||
add ecx,304
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_left.folder_data]
|
||||
mov [fb_left.folder_data],eax
|
||||
mov [lfd_size],ecx
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx ecx ebx
|
||||
|
||||
xor eax,eax
|
||||
mov [left_marked_counter],eax
|
||||
mov [fb_left.marked_counter],eax
|
||||
mov [read_folder.start],eax ;dword 0
|
||||
inc eax
|
||||
mov [read_folder.size],eax ;dword 1
|
||||
mov eax,[left_folder_data]
|
||||
push eax
|
||||
mov eax,[fb_left.folder_data]
|
||||
mov [read_folder.return],eax
|
||||
mcall 70, read_folder
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error_1
|
||||
@@:
|
||||
mov eax,[esp]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder.start],dword 1
|
||||
@@:
|
||||
mov ebx,[eax+8]
|
||||
mov [read_folder.size],ebx ;dword 10 ;5000
|
||||
imul ebx,304
|
||||
add ebx,32
|
||||
mov ecx,[right_folder_data]
|
||||
sub ecx,[left_folder_data]
|
||||
push ebx ecx
|
||||
cmp ebx,ecx
|
||||
je .continue
|
||||
sub ebx,ecx
|
||||
js .sub_mem
|
||||
.add_mem:
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,ebx
|
||||
mov [esp],ebx
|
||||
mov ebx,[appl_memory]
|
||||
mov [esp+4],ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
call move_up_right_table
|
||||
; mov [temp_znak],1
|
||||
jmp .continue
|
||||
.sub_mem:
|
||||
mov ebx,[esp]
|
||||
mov ecx,[esp+4]
|
||||
sub ebx,ecx
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,ebx
|
||||
mov [esp],ebx
|
||||
mov ebx,[appl_memory]
|
||||
mov [esp+4],ebx
|
||||
mov [appl_memory],ecx
|
||||
call move_down_right_table
|
||||
mcall 64,1
|
||||
; mov [temp_znak],2
|
||||
.continue:
|
||||
; mov edi,eax ;folder_data
|
||||
; call clear_folder_data_area
|
||||
mcall 70, read_folder
|
||||
mov [left_folder_block],ebx
|
||||
add esp,4*3
|
||||
|
||||
mcall SF_FILE, read_folder
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
@@:
|
||||
mov eax,[fb_left.folder_data]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder.start],dword 1
|
||||
@@:
|
||||
mov ecx,[eax+8] ; число файлов и папок
|
||||
mov [read_folder.size],ecx
|
||||
mov [sb_left.max_area],ecx
|
||||
imul ecx,304
|
||||
add ecx,32
|
||||
|
||||
push edx
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_left.folder_data]
|
||||
mov [fb_left.folder_data],eax
|
||||
mov [lfd_size],ecx
|
||||
mov [read_folder.return],eax
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx
|
||||
|
||||
mcall SF_FILE, read_folder
|
||||
mov [fb_left.folder_block],ebx
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
align 4
|
||||
@@:
|
||||
push eax
|
||||
; call left_files_name_normalize
|
||||
call left_prepare_extension_start
|
||||
call left_sort_files
|
||||
pop eax
|
||||
; pusha
|
||||
; call draw_window
|
||||
; popa
|
||||
ret
|
||||
.error_1:
|
||||
add esp,4
|
||||
align 4
|
||||
.error:
|
||||
mov [left_folder_block],dword 2
|
||||
mov edi,[left_folder_data]
|
||||
mov [fb_left.folder_block],dword 2
|
||||
mov edi,[fb_left.folder_data]
|
||||
call error_handler
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
error_handler:
|
||||
push eax
|
||||
xor eax,eax
|
||||
@@ -154,193 +110,132 @@ error_handler:
|
||||
pop eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
; out:
|
||||
; eax - 0 or error code
|
||||
proc_read_right_folder:
|
||||
mov ecx,[appl_memory]
|
||||
push ebx ecx edx
|
||||
mov ecx,[rfd_size]
|
||||
add ecx,304
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_right.folder_data]
|
||||
mov [fb_right.folder_data],eax
|
||||
mov [rfd_size],ecx
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx ecx ebx
|
||||
|
||||
xor eax,eax
|
||||
mov [right_marked_counter],eax
|
||||
mov [fb_right.marked_counter],eax
|
||||
mov [read_folder_1.start],eax ;dword 0
|
||||
inc eax
|
||||
mov [read_folder_1.size],eax ;dword 1
|
||||
mov eax,[right_folder_data]
|
||||
push eax
|
||||
mov eax,[fb_right.folder_data]
|
||||
mov [read_folder_1.return],eax
|
||||
mcall 70, read_folder_1
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error_1
|
||||
@@:
|
||||
mov eax,[esp]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder_1.start],dword 1
|
||||
@@:
|
||||
mov ebx,[eax+8]
|
||||
mov [read_folder_1.size],ebx ;dword 10 ;5000
|
||||
imul ebx,304
|
||||
add ebx,32
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[right_folder_data]
|
||||
push ebx ecx
|
||||
cmp ebx,ecx
|
||||
je .continue
|
||||
sub ebx,ecx
|
||||
js .sub_mem
|
||||
.add_mem:
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
; mov [temp_znak],1
|
||||
jmp .continue
|
||||
.sub_mem:
|
||||
mov ebx,[esp]
|
||||
mov ecx,[esp+4]
|
||||
sub ebx,ecx
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
; mov [temp_znak],2
|
||||
.continue:
|
||||
; mov edi,eax ;folder_data_1
|
||||
; call clear_folder_data_area
|
||||
mcall 70, read_folder_1
|
||||
mov [right_folder_block],ebx
|
||||
add esp,4*3
|
||||
mcall SF_FILE, read_folder_1
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
@@:
|
||||
mov eax,[fb_right.folder_data]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder_1.start],dword 1
|
||||
@@:
|
||||
mov ecx,[eax+8] ; число файлов и папок
|
||||
mov [read_folder_1.size],ecx
|
||||
mov [sb_right.max_area],ecx
|
||||
imul ecx,304
|
||||
add ecx,32
|
||||
|
||||
push edx
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_right.folder_data]
|
||||
mov [fb_right.folder_data],eax
|
||||
mov [rfd_size],ecx
|
||||
mov [read_folder_1.return],eax
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx
|
||||
|
||||
mcall SF_FILE, read_folder_1
|
||||
mov [fb_right.folder_block],ebx
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
align 4
|
||||
@@:
|
||||
push eax
|
||||
; call right_files_name_normalize
|
||||
call right_prepare_extension_start
|
||||
call right_sort_files
|
||||
pop eax
|
||||
; pusha
|
||||
; call draw_window
|
||||
; popa
|
||||
ret
|
||||
.error_1:
|
||||
add esp,4
|
||||
align 4
|
||||
.error:
|
||||
mov [right_folder_block],dword 2
|
||||
mov edi,[right_folder_data]
|
||||
mov [fb_right.folder_block],dword 2
|
||||
mov edi,[fb_right.folder_data]
|
||||
call error_handler
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_up_right_table:
|
||||
mov esi,[esp+8]
|
||||
mov ecx,esi
|
||||
sub ecx,[right_folder_data]
|
||||
mov edi,esi
|
||||
add edi,[esp+4]
|
||||
shr ecx,2
|
||||
std
|
||||
; rep movsb
|
||||
rep movsd
|
||||
mov eax,[esp+4]
|
||||
add [right_folder_data],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_down_right_table:
|
||||
mov esi,[right_folder_data]
|
||||
mov edi,esi
|
||||
sub edi,[esp+4]
|
||||
push ecx
|
||||
mov ecx,[esp+12]
|
||||
sub ecx,[right_folder_data]
|
||||
shr ecx,2
|
||||
cld
|
||||
; rep movsb
|
||||
rep movsd
|
||||
pop ecx
|
||||
mov eax,[esp+4]
|
||||
sub [right_folder_data],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;clear_folder_data_area:
|
||||
; mov ecx,4096*10/4
|
||||
; xor eax,eax
|
||||
; cld
|
||||
; rep stosd
|
||||
; ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
proc_read_folder:
|
||||
call proc_read_left_folder
|
||||
; mov [left_panel_clear_all],1
|
||||
cmp [search_pre_folder],0
|
||||
jne @f
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [left_start_draw_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_line],0
|
||||
mov [sb_left.position],0
|
||||
jmp .continue
|
||||
@@:
|
||||
mov edi,[left_folder_data]
|
||||
mov edi,[fb_left.folder_data]
|
||||
add edi,32+40
|
||||
sub edi,304
|
||||
xor ebp,ebp
|
||||
.search_file:
|
||||
cmp [left_folder_block],ebp
|
||||
cmp [fb_left.folder_block],ebp
|
||||
jbe .end_folder
|
||||
mov esi,[temp_counter_dword]
|
||||
mov ecx,[extension_size]
|
||||
add edi,304
|
||||
inc ebp
|
||||
cld
|
||||
; mov [temp_counter_dword_1],edi
|
||||
push edi
|
||||
rep cmpsb
|
||||
pop edi
|
||||
jne .search_file
|
||||
dec ebp
|
||||
mov eax,[left_folder_block]
|
||||
cmp [max_panel_line],eax
|
||||
mov eax,[fb_left.folder_block]
|
||||
cmp [fb_left.max_panel_line],eax
|
||||
js @f
|
||||
mov eax,ebp
|
||||
imul eax,10
|
||||
mov [left_start_draw_cursor_line],ax
|
||||
mov [left_start_draw_line],0
|
||||
movzx eax,[fb_left.line_size_y]
|
||||
imul eax,ebp
|
||||
mov [fb_left.start_draw_cursor_line],ax
|
||||
mov [fb_left.start_draw_line],0
|
||||
mov [sb_left.position],0
|
||||
jmp .end_folder
|
||||
@@:
|
||||
; sub eax,ebp
|
||||
; push eax
|
||||
; sub eax,[max_panel_line]
|
||||
; jns @f
|
||||
; mov eax,[max_panel_line]
|
||||
; sub eax,[esp]
|
||||
; imul eax,10
|
||||
; mov [left_start_draw_cursor_line],ax
|
||||
;@@:
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [left_start_draw_line],ebp
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_line],ebp
|
||||
mov [sb_left.position],ebp
|
||||
.end_folder:
|
||||
mov [search_pre_folder],0
|
||||
.continue:
|
||||
call draw_left_panel
|
||||
call draw_left_select_disk_button
|
||||
; call draw_window
|
||||
; pop eax
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
proc_read_folder_1:
|
||||
call proc_read_right_folder
|
||||
; mov [right_panel_clear_all],1
|
||||
cmp [search_pre_folder],0
|
||||
jne @f
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [right_start_draw_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_line],0
|
||||
mov [sb_right.position],0
|
||||
jmp .continue
|
||||
@@:
|
||||
mov edi,[right_folder_data]
|
||||
mov edi,[fb_right.folder_data]
|
||||
add edi,32+40
|
||||
sub edi,304
|
||||
xor ebp,ebp
|
||||
.search_file:
|
||||
cmp [right_folder_block],ebp
|
||||
cmp [fb_right.folder_block],ebp
|
||||
jbe .end_folder
|
||||
mov esi,[temp_counter_dword]
|
||||
mov ecx,[extension_size]
|
||||
@@ -353,26 +248,19 @@ proc_read_folder_1:
|
||||
pop edi
|
||||
jne .search_file
|
||||
dec ebp
|
||||
mov eax,[right_folder_block]
|
||||
cmp [max_panel_line],eax
|
||||
mov eax,[fb_right.folder_block]
|
||||
cmp [fb_right.max_panel_line],eax
|
||||
js @f
|
||||
mov eax,ebp
|
||||
imul eax,10
|
||||
mov [right_start_draw_cursor_line],ax
|
||||
mov [right_start_draw_line],0
|
||||
movzx eax,[fb_right.line_size_y]
|
||||
imul eax,ebp
|
||||
mov [fb_right.start_draw_cursor_line],ax
|
||||
mov [fb_right.start_draw_line],0
|
||||
mov [sb_right.position],0
|
||||
jmp .end_folder
|
||||
@@:
|
||||
; sub eax,ebp
|
||||
; push eax
|
||||
; sub eax,[max_panel_line]
|
||||
; jns @f
|
||||
; mov eax,[max_panel_line]
|
||||
; sub eax,[esp]
|
||||
; imul eax,10
|
||||
; mov [right_start_draw_cursor_line],ax
|
||||
;@@:
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [right_start_draw_line],ebp
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_line],ebp
|
||||
mov [sb_right.position],ebp
|
||||
.end_folder:
|
||||
mov [search_pre_folder],0
|
||||
.continue:
|
||||
@@ -404,7 +292,7 @@ copy_folder_name_3:
|
||||
jmp copy_folder_name.1
|
||||
;---------------------------------------------------------------------
|
||||
read_folder:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -413,7 +301,7 @@ read_folder:
|
||||
.name: dd read_folder_name
|
||||
;---------------------------------------------------------------------
|
||||
read_folder_1:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -422,7 +310,7 @@ read_folder_1:
|
||||
.name: dd read_folder_1_name
|
||||
;---------------------------------------------------------------------
|
||||
read_folder_2:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -431,7 +319,7 @@ read_folder_2:
|
||||
.name: dd read_folder_2_name
|
||||
;---------------------------------------------------------------------
|
||||
read_folder_3:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -440,7 +328,7 @@ read_folder_3:
|
||||
.name: dd read_folder_3_name
|
||||
;---------------------------------------------------------------------
|
||||
read_file_features:
|
||||
.subfunction dd 5
|
||||
.subfunction dd SSF_GET_INFO
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -449,7 +337,7 @@ read_file_features:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
read_file:
|
||||
.subfunction dd 0
|
||||
.subfunction dd SSF_READ_FILE
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -458,7 +346,7 @@ read_file:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
save_file:
|
||||
.subfunction dd 2
|
||||
.subfunction dd SSF_CREATE_FILE
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -467,7 +355,7 @@ save_file:
|
||||
.name: dd start_parameter
|
||||
;---------------------------------------------------------------------
|
||||
add_save_file:
|
||||
.subfunction dd 3
|
||||
.subfunction dd SSF_WRITE_FILE
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -476,7 +364,7 @@ add_save_file:
|
||||
.name: dd start_parameter
|
||||
;---------------------------------------------------------------------
|
||||
create_dir_file_data:
|
||||
.subfunction dd 9
|
||||
.subfunction dd SSF_CREATE_FOLDER
|
||||
.flags dd 0
|
||||
.param dd 0
|
||||
.rezerv dd 0
|
||||
@@ -485,7 +373,7 @@ create_dir_file_data:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
start_file_data:
|
||||
.subfunction dd 7
|
||||
.subfunction dd SSF_START_APP
|
||||
.flags dd 0
|
||||
.param dd 0
|
||||
.rezerv dd 0
|
||||
@@ -494,7 +382,7 @@ start_file_data:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
delete_file_data:
|
||||
.subfunction dd 8
|
||||
.subfunction dd SSF_DELETE
|
||||
.flags dd 0
|
||||
.param dd 0
|
||||
.rezerv dd 0
|
||||
@@ -503,7 +391,7 @@ delete_file_data:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
read_delete_dir_data:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 0
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB |
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user