From 1842871f8fa2c7ef9274d5e26027787fb92346fa Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Thu, 21 Nov 2013 16:07:16 +0000 Subject: [PATCH] support for PnP disks, part 5: FAT12, ramdisk, floppies git-svn-id: svn://kolibrios.org@4273 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/eng/Makefile | 173 +- data/eng/settings/menu.dat | 1 - data/et/Makefile | 173 +- data/et/settings/menu.dat | 1 - data/it/Makefile | 163 +- data/it/settings/menu.dat | 1 - data/rus/Makefile | 173 +- data/rus/settings/menu.dat | 1 - data/sp/Makefile | 173 +- data/sp/settings/menu.dat | 1 - kernel/trunk/blkdev/disk.inc | 58 +- kernel/trunk/blkdev/fdc.inc | 38 +- kernel/trunk/blkdev/flp_drv.inc | 357 +++- kernel/trunk/blkdev/hd_drv.inc | 12 +- kernel/trunk/blkdev/rd.inc | 2433 ++---------------------- kernel/trunk/blkdev/rdsave.inc | 9 +- kernel/trunk/core/sys32.inc | 4 - kernel/trunk/core/syscall.inc | 36 +- kernel/trunk/data32.inc | 15 +- kernel/trunk/data32et.inc | 1 + kernel/trunk/data32sp.inc | 1 + kernel/trunk/detect/dev_fd.inc | 1 + kernel/trunk/fs/{fat32.inc => fat.inc} | 1122 ++++++++++- kernel/trunk/fs/fat12.inc | 2268 ---------------------- kernel/trunk/fs/fs-et.inc | 12 - kernel/trunk/fs/fs-sp.inc | 13 - kernel/trunk/fs/fs.inc | 682 ------- kernel/trunk/fs/fs_lfn.inc | 118 -- kernel/trunk/kernel.asm | 62 +- kernel/trunk/kernel32.inc | 6 +- kernel/trunk/memmap.inc | 3 +- 31 files changed, 2101 insertions(+), 6010 deletions(-) rename kernel/trunk/fs/{fat32.inc => fat.inc} (73%) delete mode 100644 kernel/trunk/fs/fat12.inc delete mode 100644 kernel/trunk/fs/fs-et.inc delete mode 100644 kernel/trunk/fs/fs-sp.inc delete mode 100644 kernel/trunk/fs/fs.inc diff --git a/data/eng/Makefile b/data/eng/Makefile index ff480067d0..70efb9aab0 100644 --- a/data/eng/Makefile +++ b/data/eng/Makefile @@ -290,7 +290,6 @@ CMM_PROGRAMS:=\ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ default.skn:DEFAULT.SKN \ graph:GRAPH \ - ../common/hdread:HDREAD \ settings/icon.ini:SETTINGS/ICON.INI \ ../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \ kernel.mnt:KERNEL.MNT \ @@ -339,7 +338,7 @@ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ # Generate skins list understandable by gnu make Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh - cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ + cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ include Makefile.skins # Extra targets for the distribution kit and LiveCD image in the syntax of mkisofs @@ -485,39 +484,39 @@ $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ $(BUILD_DIR)/boot_fat12.bin \ $(targets) # SYSXTREE - str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null - dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 - mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: - dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 - mmd -i $(BUILD_DIR)/kolibri.img ::3D - mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO - mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS - mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers - mmd -i $(BUILD_DIR)/kolibri.img ::FONTS - mmd -i $(BUILD_DIR)/kolibri.img ::GAMES - mmd -i $(BUILD_DIR)/kolibri.img ::LIB - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF - mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK - mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS - $(mcopy_all_items) + str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ + echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null + dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 + mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: + dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 + mmd -i $(BUILD_DIR)/kolibri.img ::3D + mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO + mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS + mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers + mmd -i $(BUILD_DIR)/kolibri.img ::FONTS + mmd -i $(BUILD_DIR)/kolibri.img ::GAMES + mmd -i $(BUILD_DIR)/kolibri.img ::LIB + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF + mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK + mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS + $(mcopy_all_items) # The second goal: LiveCD image. $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) - mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ - -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ - -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 + mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ + -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ + -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 # The third goal: distribution list. $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) - rm -rf distribution_kit - $(call respace,$(make_distribution_dirs)) - ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img - $(call respace,$(make_distribution_links)) - touch $(BUILD_DIR)/distr.lst + rm -rf distribution_kit + $(call respace,$(make_distribution_dirs)) + ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img + $(call respace,$(make_distribution_links)) + touch $(BUILD_DIR)/distr.lst # Special targets to modify behaviour of make. .DELETE_ON_ERROR: @@ -525,16 +524,16 @@ $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) # The floppy bootsector. $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc - fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin + fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \ games/.dir lib/.dir media/.dir network/.dir settings/.dir allskins/.dir distr_data/.dir .deps/.dir: - mkdir -p $(dir $@) - touch $@ + mkdir -p $(dir $@) + touch $@ develop/info/.dir: develop/.dir File\ Managers/.dir: - mkdir -p "File Managers" - touch "File Managers/.dir" + mkdir -p "File Managers" + touch "File Managers/.dir" # extra dependency for mtldr_install.exe distr_data/mtldr_install.exe: mtldr_for_installer @@ -551,7 +550,7 @@ include Makefile.copy # Special rules for copying sysfuncs.txt - it isn't directly included in the image. docpack: $(DOCDIR)SYSFUNCS.TXT $(DOCDIR)SYSFUNCS.TXT: $(KERNEL)/docs/sysfuncs.txt - cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT + cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT # Similar for C--. include Makefile.cmm @@ -564,21 +563,21 @@ include Makefile.msvc # Rules for table table: .obj.table/table.exe - $(msvc_final) + $(msvc_final) TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \ .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \ .obj.table/mcsmemm.obj .obj.table/parser.obj TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h) .obj.table/table.exe: $(TABLE_OBJECTS) - $(msvc_link) + $(msvc_link) $(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table - $(msvc_compile) + $(msvc_compile) .obj.table: - mkdir -p .obj.table + mkdir -p .obj.table # Rules for graph graph: .obj.graph/graph.exe - $(msvc_final) + $(msvc_final) GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \ .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \ .obj.graph/mcsmemm.obj .obj.graph/parser.obj @@ -586,34 +585,34 @@ GRAPH_C_OBJECTS:=.obj.graph/string.obj GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h) GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj .obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS) - $(msvc_link) + $(msvc_link) $(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph - fasm $< $@ + fasm $< $@ .obj.graph: - mkdir -p .obj.graph + mkdir -p .obj.graph # Rules for kosilka games/kosilka: .obj.kosilka/kosilka.exe - $(msvc_final) + $(msvc_final) KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h .obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS) - $(msvc_link) + $(msvc_link) $(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka - $(msvc_compile) + $(msvc_compile) .obj.kosilka: - mkdir -p .obj.kosilka + mkdir -p .obj.kosilka include Makefile.gcc # Rules for shell shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \ $(PROGS)/system/shell/kolibri.ld - $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) + $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \ $(PROGS)/system/shell/all.h \ $(PROGS)/system/shell/system/*.h \ @@ -621,77 +620,77 @@ shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/std $(PROGS)/system/shell/modules/*.c \ $(PROGS)/system/shell/locale/rus/globals.h \ Makefile.gcc | .obj.shell - $(gcc_compile) + $(gcc_compile) .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \ $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \ Makefile.gcc | .obj.shell - $(gcc_compile) - win32-gcc -c -Os -o $@ $< + $(gcc_compile) + win32-gcc -c -Os -o $@ $< .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell - fasm $< $@ + fasm $< $@ .obj.shell: - mkdir -p .obj.shell + mkdir -p .obj.shell # Rules for e80 E80DIR=$(PROGS)/emulator/e80/trunk e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o - $(call gcc_link,$(E80DIR)/kolibri.ld) + $(call gcc_link,$(E80DIR)/kolibri.ld) .obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \ $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \ $(E80DIR)/z80/z80.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \ $(E80DIR)/system/%.c $(E80DIR)/system/*.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/* - $(gcc_compile) + $(gcc_compile) .obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80 - fasm $< $@ + fasm $< $@ .obj.e80: - mkdir -p .obj.e80 + mkdir -p .obj.e80 # Rules for sdk/sound, used by media/ac97snd SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm)) SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc) .sdk/sound.lib: $(SOUND_OBJECTS) - win32-link /lib /out:$@ $^ + win32-link /lib /out:$@ $^ $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk - fasm $< $@ + fasm $< $@ .sdk: - mkdir -p .sdk + mkdir -p .sdk # Rules for media/ac97snd AC97DIR=$(PROGS)/media/ac97snd media/ac97snd: .obj.ac97snd/ac97snd.exe - $(msvc_final) + $(msvc_final) .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \ - .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj - $(msvc_link) + .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj + $(msvc_link) .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \ - $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ - $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ + $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd + $(msvc_compile) .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd - fasm $< $@ -s .deps/ac97snd-ufmod.fas - prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ - perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ - -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po + fasm $< $@ -s .deps/ac97snd-ufmod.fas + prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po -include .deps/ac97snd-ufmod.Po AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c) AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h) AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES)) .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj - win32-link /lib /ltcg /out:$@ $^ + win32-link /lib /ltcg /out:$@ $^ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd: - mkdir -p .obj.ac97snd + mkdir -p .obj.ac97snd # Rules for atikms.dll # Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon @@ -700,16 +699,16 @@ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_F # Note that we are going to write in the directory shared # between all Makefiles, so we need locked operations. drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir - kpack --nologo $< $@ + kpack --nologo $< $@ $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto - flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto + flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto $(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a $(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a # dependencies $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \ $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \ diff --git a/data/eng/settings/menu.dat b/data/eng/settings/menu.dat index 6b971a85c9..a77f55a494 100644 --- a/data/eng/settings/menu.dat +++ b/data/eng/settings/menu.dat @@ -112,7 +112,6 @@ CPUID /sys/cpuid Ghost Monitor /sys/gmon K. Bus disconnected /sys/kbd HDD informer /sys/hdd_info -Read HDD /sys/hdread #13 **** WORK WITH FILES **** KFAR /sys/File Managers/kfar KFM /sys/File Managers/kfm diff --git a/data/et/Makefile b/data/et/Makefile index 41d835d89a..94528a6e76 100644 --- a/data/et/Makefile +++ b/data/et/Makefile @@ -290,7 +290,6 @@ CMM_PROGRAMS:=\ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ default.skn:DEFAULT.SKN \ graph:GRAPH \ - ../common/hdread:HDREAD \ settings/icon.ini:SETTINGS/ICON.INI \ ../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \ kernel.mnt:KERNEL.MNT \ @@ -339,7 +338,7 @@ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ # Generate skins list understandable by gnu make Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh - cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ + cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ include Makefile.skins # Extra targets for the distribution kit and LiveCD image in the syntax of mkisofs @@ -485,39 +484,39 @@ $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ $(BUILD_DIR)/boot_fat12.bin \ $(targets) # SYSXTREE - str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null - dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 - mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: - dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 - mmd -i $(BUILD_DIR)/kolibri.img ::3D - mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO - mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS - mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers - mmd -i $(BUILD_DIR)/kolibri.img ::FONTS - mmd -i $(BUILD_DIR)/kolibri.img ::GAMES - mmd -i $(BUILD_DIR)/kolibri.img ::LIB - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF - mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK - mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS - $(mcopy_all_items) + str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ + echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null + dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 + mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: + dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 + mmd -i $(BUILD_DIR)/kolibri.img ::3D + mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO + mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS + mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers + mmd -i $(BUILD_DIR)/kolibri.img ::FONTS + mmd -i $(BUILD_DIR)/kolibri.img ::GAMES + mmd -i $(BUILD_DIR)/kolibri.img ::LIB + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF + mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK + mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS + $(mcopy_all_items) # The second goal: LiveCD image. $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) - mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ - -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ - -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 + mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ + -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ + -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 # The third goal: distribution list. $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) - rm -rf distribution_kit - $(call respace,$(make_distribution_dirs)) - ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img - $(call respace,$(make_distribution_links)) - touch $(BUILD_DIR)/distr.lst + rm -rf distribution_kit + $(call respace,$(make_distribution_dirs)) + ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img + $(call respace,$(make_distribution_links)) + touch $(BUILD_DIR)/distr.lst # Special targets to modify behaviour of make. .DELETE_ON_ERROR: @@ -525,16 +524,16 @@ $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) # The floppy bootsector. $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc - fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin + fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \ games/.dir lib/.dir media/.dir network/.dir settings/.dir allskins/.dir distr_data/.dir .deps/.dir: - mkdir -p $(dir $@) - touch $@ + mkdir -p $(dir $@) + touch $@ develop/info/.dir: develop/.dir File\ Managers/.dir: - mkdir -p "File Managers" - touch "File Managers/.dir" + mkdir -p "File Managers" + touch "File Managers/.dir" # extra dependency for mtldr_install.exe distr_data/mtldr_install.exe: mtldr_for_installer @@ -551,7 +550,7 @@ include Makefile.copy # Special rules for copying sysfuncs.txt - it isn't directly included in the image. docpack: $(DOCDIR)SYSFUNCS.TXT $(DOCDIR)SYSFUNCS.TXT: $(KERNEL)/docs/sysfuncs.txt - cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT + cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT # Similar for C--. include Makefile.cmm @@ -564,21 +563,21 @@ include Makefile.msvc # Rules for table table: .obj.table/table.exe - $(msvc_final) + $(msvc_final) TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \ .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \ .obj.table/mcsmemm.obj .obj.table/parser.obj TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h) .obj.table/table.exe: $(TABLE_OBJECTS) - $(msvc_link) + $(msvc_link) $(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table - $(msvc_compile) + $(msvc_compile) .obj.table: - mkdir -p .obj.table + mkdir -p .obj.table # Rules for graph graph: .obj.graph/graph.exe - $(msvc_final) + $(msvc_final) GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \ .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \ .obj.graph/mcsmemm.obj .obj.graph/parser.obj @@ -586,34 +585,34 @@ GRAPH_C_OBJECTS:=.obj.graph/string.obj GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h) GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj .obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS) - $(msvc_link) + $(msvc_link) $(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph - fasm $< $@ + fasm $< $@ .obj.graph: - mkdir -p .obj.graph + mkdir -p .obj.graph # Rules for kosilka games/kosilka: .obj.kosilka/kosilka.exe - $(msvc_final) + $(msvc_final) KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h .obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS) - $(msvc_link) + $(msvc_link) $(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka - $(msvc_compile) + $(msvc_compile) .obj.kosilka: - mkdir -p .obj.kosilka + mkdir -p .obj.kosilka include Makefile.gcc # Rules for shell shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \ $(PROGS)/system/shell/kolibri.ld - $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) + $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \ $(PROGS)/system/shell/all.h \ $(PROGS)/system/shell/system/*.h \ @@ -621,77 +620,77 @@ shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/std $(PROGS)/system/shell/modules/*.c \ $(PROGS)/system/shell/locale/rus/globals.h \ Makefile.gcc | .obj.shell - $(gcc_compile) + $(gcc_compile) .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \ $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \ Makefile.gcc | .obj.shell - $(gcc_compile) - win32-gcc -c -Os -o $@ $< + $(gcc_compile) + win32-gcc -c -Os -o $@ $< .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell - fasm $< $@ + fasm $< $@ .obj.shell: - mkdir -p .obj.shell + mkdir -p .obj.shell # Rules for e80 E80DIR=$(PROGS)/emulator/e80/trunk e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o - $(call gcc_link,$(E80DIR)/kolibri.ld) + $(call gcc_link,$(E80DIR)/kolibri.ld) .obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \ $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \ $(E80DIR)/z80/z80.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \ $(E80DIR)/system/%.c $(E80DIR)/system/*.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/* - $(gcc_compile) + $(gcc_compile) .obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80 - fasm $< $@ + fasm $< $@ .obj.e80: - mkdir -p .obj.e80 + mkdir -p .obj.e80 # Rules for sdk/sound, used by media/ac97snd SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm)) SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc) .sdk/sound.lib: $(SOUND_OBJECTS) - win32-link /lib /out:$@ $^ + win32-link /lib /out:$@ $^ $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk - fasm $< $@ + fasm $< $@ .sdk: - mkdir -p .sdk + mkdir -p .sdk # Rules for media/ac97snd AC97DIR=$(PROGS)/media/ac97snd media/ac97snd: .obj.ac97snd/ac97snd.exe - $(msvc_final) + $(msvc_final) .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \ - .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj - $(msvc_link) + .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj + $(msvc_link) .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \ - $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ - $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ + $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd + $(msvc_compile) .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd - fasm $< $@ -s .deps/ac97snd-ufmod.fas - prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ - perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ - -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po + fasm $< $@ -s .deps/ac97snd-ufmod.fas + prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po -include .deps/ac97snd-ufmod.Po AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c) AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h) AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES)) .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj - win32-link /lib /ltcg /out:$@ $^ + win32-link /lib /ltcg /out:$@ $^ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd: - mkdir -p .obj.ac97snd + mkdir -p .obj.ac97snd # Rules for atikms.dll # Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon @@ -700,16 +699,16 @@ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_F # Note that we are going to write in the directory shared # between all Makefiles, so we need locked operations. drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir - kpack --nologo $< $@ + kpack --nologo $< $@ $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto - flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto + flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto $(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a $(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a # dependencies $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \ $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \ diff --git a/data/et/settings/menu.dat b/data/et/settings/menu.dat index 651da5b9af..56ee41f3f4 100644 --- a/data/et/settings/menu.dat +++ b/data/et/settings/menu.dat @@ -112,7 +112,6 @@ CPUID /sys/cpuid Ghost Monitor /sys/gmon K. Bus disconnected /sys/kbd HDD info /sys/hdd_info -Read HDD /sys/hdread #13 **** WORK WITH FILES **** KFAR /sys/File Managers/kfar KFM /sys/File Managers/kfm diff --git a/data/it/Makefile b/data/it/Makefile index f992f993ac..61a12faefe 100644 --- a/data/it/Makefile +++ b/data/it/Makefile @@ -289,7 +289,6 @@ CMM_PROGRAMS:=\ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ default.skn:DEFAULT.SKN \ graph:GRAPH \ - ../common/hdread:HDREAD \ settings/icon.ini:SETTINGS/ICON.INI \ ../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \ kernel.mnt:KERNEL.MNT \ @@ -338,7 +337,7 @@ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ # Generate skins list understandable by gnu make Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh - cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ + cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ include Makefile.skins # Extra targets for LiveCD image in the syntax of mkisofs @@ -452,31 +451,31 @@ $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ Makefile \ $(BUILD_DIR)/boot_fat12.bin \ $(targets) - str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null - dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 - mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: - dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 - mmd -i $(BUILD_DIR)/kolibri.img ::3D - mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO - mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS - mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers - mmd -i $(BUILD_DIR)/kolibri.img ::FONTS - mmd -i $(BUILD_DIR)/kolibri.img ::GAMES - mmd -i $(BUILD_DIR)/kolibri.img ::LIB - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF - mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK - mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS - $(mcopy_all_items) + str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ + echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null + dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 + mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: + dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 + mmd -i $(BUILD_DIR)/kolibri.img ::3D + mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO + mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS + mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers + mmd -i $(BUILD_DIR)/kolibri.img ::FONTS + mmd -i $(BUILD_DIR)/kolibri.img ::GAMES + mmd -i $(BUILD_DIR)/kolibri.img ::LIB + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF + mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK + mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS + $(mcopy_all_items) # The second goal: LiveCD image. $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) - mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ - -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ - -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 + mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ + -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ + -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 # Special targets to modify behaviour of make. .DELETE_ON_ERROR: @@ -484,16 +483,16 @@ $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) # The floppy bootsector. $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc - fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin + fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \ games/.dir lib/.dir media/.dir network/.dir settings/.dir allskins/.dir distr_data/.dir .deps/.dir: - mkdir -p $(dir $@) - touch $@ + mkdir -p $(dir $@) + touch $@ develop/info/.dir: develop/.dir File\ Managers/.dir: - mkdir -p "File Managers" - touch "File Managers/.dir" + mkdir -p "File Managers" + touch "File Managers/.dir" # extra dependency for mtldr_install.exe distr_data/mtldr_install.exe: mtldr_for_installer @@ -510,7 +509,7 @@ include Makefile.copy # Special rules for copying sysfuncs.txt - it isn't directly included in the image. docpack: $(DOCDIR)SYSFUNCS.TXT $(DOCDIR)SYSFUNCS.TXT: $(KERNEL)/docs/sysfuncs.txt - cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT + cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT # Similar for C--. include Makefile.cmm @@ -523,21 +522,21 @@ include Makefile.msvc # Rules for table table: .obj.table/table.exe - $(msvc_final) + $(msvc_final) TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \ .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \ .obj.table/mcsmemm.obj .obj.table/parser.obj TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h) .obj.table/table.exe: $(TABLE_OBJECTS) - $(msvc_link) + $(msvc_link) $(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table - $(msvc_compile) + $(msvc_compile) .obj.table: - mkdir -p .obj.table + mkdir -p .obj.table # Rules for graph graph: .obj.graph/graph.exe - $(msvc_final) + $(msvc_final) GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \ .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \ .obj.graph/mcsmemm.obj .obj.graph/parser.obj @@ -545,34 +544,34 @@ GRAPH_C_OBJECTS:=.obj.graph/string.obj GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h) GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj .obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS) - $(msvc_link) + $(msvc_link) $(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph - fasm $< $@ + fasm $< $@ .obj.graph: - mkdir -p .obj.graph + mkdir -p .obj.graph # Rules for kosilka games/kosilka: .obj.kosilka/kosilka.exe - $(msvc_final) + $(msvc_final) KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h .obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS) - $(msvc_link) + $(msvc_link) $(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka - $(msvc_compile) + $(msvc_compile) .obj.kosilka: - mkdir -p .obj.kosilka + mkdir -p .obj.kosilka include Makefile.gcc # Rules for shell shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \ $(PROGS)/system/shell/kolibri.ld - $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) + $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \ $(PROGS)/system/shell/all.h \ $(PROGS)/system/shell/system/*.h \ @@ -580,77 +579,77 @@ shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/std $(PROGS)/system/shell/modules/*.c \ $(PROGS)/system/shell/locale/rus/globals.h \ Makefile.gcc | .obj.shell - $(gcc_compile) + $(gcc_compile) .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \ $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \ Makefile.gcc | .obj.shell - $(gcc_compile) - win32-gcc -c -Os -o $@ $< + $(gcc_compile) + win32-gcc -c -Os -o $@ $< .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell - fasm $< $@ + fasm $< $@ .obj.shell: - mkdir -p .obj.shell + mkdir -p .obj.shell # Rules for e80 E80DIR=$(PROGS)/emulator/e80/trunk e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o - $(call gcc_link,$(E80DIR)/kolibri.ld) + $(call gcc_link,$(E80DIR)/kolibri.ld) .obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \ $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \ $(E80DIR)/z80/z80.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \ $(E80DIR)/system/%.c $(E80DIR)/system/*.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/* - $(gcc_compile) + $(gcc_compile) .obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80 - fasm $< $@ + fasm $< $@ .obj.e80: - mkdir -p .obj.e80 + mkdir -p .obj.e80 # Rules for sdk/sound, used by media/ac97snd SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm)) SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc) .sdk/sound.lib: $(SOUND_OBJECTS) - win32-link /lib /out:$@ $^ + win32-link /lib /out:$@ $^ $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk - fasm $< $@ + fasm $< $@ .sdk: - mkdir -p .sdk + mkdir -p .sdk # Rules for media/ac97snd AC97DIR=$(PROGS)/media/ac97snd media/ac97snd: .obj.ac97snd/ac97snd.exe - $(msvc_final) + $(msvc_final) .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \ - .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj - $(msvc_link) + .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj + $(msvc_link) .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \ - $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ - $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ + $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd + $(msvc_compile) .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd - fasm $< $@ -s .deps/ac97snd-ufmod.fas - prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ - perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ - -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po + fasm $< $@ -s .deps/ac97snd-ufmod.fas + prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po -include .deps/ac97snd-ufmod.Po AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c) AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h) AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES)) .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj - win32-link /lib /ltcg /out:$@ $^ + win32-link /lib /ltcg /out:$@ $^ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd: - mkdir -p .obj.ac97snd + mkdir -p .obj.ac97snd # Rules for atikms.dll # Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon @@ -659,16 +658,16 @@ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_F # Note that we are going to write in the directory shared # between all Makefiles, so we need locked operations. drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir - kpack --nologo $< $@ + kpack --nologo $< $@ $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto - flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto + flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto $(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a $(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a # dependencies $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \ $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \ diff --git a/data/it/settings/menu.dat b/data/it/settings/menu.dat index 746c1019cc..58b34e31b5 100644 --- a/data/it/settings/menu.dat +++ b/data/it/settings/menu.dat @@ -111,7 +111,6 @@ CPUID /sys/cpuid Ghost Monitor /sys/gmon K. Bus disconnected /sys/kbd HDD informer /sys/hdd_info -Read HDD /sys/hdread #13 **** WORK WITH FILES **** KFAR /sys/File Managers/kfar KFM /sys/File Managers/kfm diff --git a/data/rus/Makefile b/data/rus/Makefile index fe822f6b03..c683cd54e0 100644 --- a/data/rus/Makefile +++ b/data/rus/Makefile @@ -283,7 +283,6 @@ CMM_PROGRAMS:=\ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ default.skn:DEFAULT.SKN \ graph:GRAPH \ - ../common/hdread:HDREAD \ settings/icon.ini:SETTINGS/ICON.INI \ ../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \ kernel.mnt:KERNEL.MNT \ @@ -335,7 +334,7 @@ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ # Generate skins list understandable by gnu make Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh - cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ + cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ include Makefile.skins # Extra targets for the distribution kit and LiveCD image in the syntax of mkisofs @@ -504,39 +503,39 @@ $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ Makefile \ $(BUILD_DIR)/boot_fat12.bin \ $(targets) - str=`LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, r$(REV)]"|iconv -f utf8 -t cp866`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null - dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 - mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: - dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 - mmd -i $(BUILD_DIR)/kolibri.img ::3D - mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO - mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS - mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers - mmd -i $(BUILD_DIR)/kolibri.img ::FONTS - mmd -i $(BUILD_DIR)/kolibri.img ::GAMES - mmd -i $(BUILD_DIR)/kolibri.img ::LIB - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF - mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK - mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS - $(mcopy_all_items) + str=`LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, r$(REV)]"|iconv -f utf8 -t cp866`; \ + echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null + dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 + mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: + dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 + mmd -i $(BUILD_DIR)/kolibri.img ::3D + mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO + mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS + mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers + mmd -i $(BUILD_DIR)/kolibri.img ::FONTS + mmd -i $(BUILD_DIR)/kolibri.img ::GAMES + mmd -i $(BUILD_DIR)/kolibri.img ::LIB + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF + mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK + mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS + $(mcopy_all_items) # The second goal: LiveCD image. $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) - mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ - -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ - -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 + mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ + -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ + -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 # The third goal: distribution list. $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) - rm -rf distribution_kit - $(call respace,$(make_distribution_dirs)) - ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img - $(call respace,$(make_distribution_links)) - touch $(BUILD_DIR)/distr.lst + rm -rf distribution_kit + $(call respace,$(make_distribution_dirs)) + ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img + $(call respace,$(make_distribution_links)) + touch $(BUILD_DIR)/distr.lst # Special targets to modify behaviour of make. .DELETE_ON_ERROR: @@ -544,16 +543,16 @@ $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) # The floppy bootsector. $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc - fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin + fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \ games/.dir lib/.dir media/.dir network/.dir settings/.dir allskins/.dir distr_data/.dir .deps/.dir: - mkdir -p $(dir $@) - touch $@ + mkdir -p $(dir $@) + touch $@ develop/info/.dir: develop/.dir File\ Managers/.dir: - mkdir -p "File Managers" - touch "File Managers/.dir" + mkdir -p "File Managers" + touch "File Managers/.dir" # extra dependency for mtldr_install.exe distr_data/mtldr_install.exe: mtldr_for_installer @@ -570,7 +569,7 @@ include Makefile.copy # Special rules for copying sysfuncr.txt - it isn't directly included in the image. docpack: $(DOCDIR)SYSFUNCR.TXT $(DOCDIR)SYSFUNCR.TXT: $(KERNEL)/docs/sysfuncr.txt - iconv -f utf-8 -t cp866 $(KERNEL)/docs/sysfuncr.txt > $(DOCDIR)SYSFUNCR.TXT + iconv -f utf-8 -t cp866 $(KERNEL)/docs/sysfuncr.txt > $(DOCDIR)SYSFUNCR.TXT # Similar for C--. include Makefile.cmm @@ -578,7 +577,7 @@ include Makefile.cmm # Recode some text files from native encoding aka cp866 to cp1251 define recode_meta_rule $(1): $(2) - iconv -f cp866 -t cp1251 "$$<" > "$$@" + iconv -f cp866 -t cp1251 "$$<" > "$$@" endef $(foreach f, $(RECODE_TEXT_FILES), $(eval $(call recode_meta_rule,$(fbinary),$(fimage)))) @@ -590,21 +589,21 @@ include Makefile.msvc # Rules for table table: .obj.table/table.exe - $(msvc_final) + $(msvc_final) TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \ .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \ .obj.table/mcsmemm.obj .obj.table/parser.obj TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h) .obj.table/table.exe: $(TABLE_OBJECTS) - $(msvc_link) + $(msvc_link) $(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table - $(msvc_compile) + $(msvc_compile) .obj.table: - mkdir -p .obj.table + mkdir -p .obj.table # Rules for graph graph: .obj.graph/graph.exe - $(msvc_final) + $(msvc_final) GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \ .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \ .obj.graph/mcsmemm.obj .obj.graph/parser.obj @@ -612,34 +611,34 @@ GRAPH_C_OBJECTS:=.obj.graph/string.obj GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h) GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj .obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS) - $(msvc_link) + $(msvc_link) $(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph - fasm $< $@ + fasm $< $@ .obj.graph: - mkdir -p .obj.graph + mkdir -p .obj.graph # Rules for kosilka games/kosilka: .obj.kosilka/kosilka.exe - $(msvc_final) + $(msvc_final) KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h .obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS) - $(msvc_link) + $(msvc_link) $(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka - $(msvc_compile) + $(msvc_compile) .obj.kosilka: - mkdir -p .obj.kosilka + mkdir -p .obj.kosilka include Makefile.gcc # Rules for shell shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \ $(PROGS)/system/shell/kolibri.ld - $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) + $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \ $(PROGS)/system/shell/all.h \ $(PROGS)/system/shell/system/*.h \ @@ -647,76 +646,76 @@ shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/std $(PROGS)/system/shell/modules/*.c \ $(PROGS)/system/shell/locale/rus/globals.h \ Makefile.gcc | .obj.shell - $(gcc_compile) + $(gcc_compile) .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \ $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \ Makefile.gcc | .obj.shell - $(gcc_compile) + $(gcc_compile) .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell - fasm $< $@ + fasm $< $@ .obj.shell: - mkdir -p .obj.shell + mkdir -p .obj.shell # Rules for e80 E80DIR=$(PROGS)/emulator/e80/trunk e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o - $(call gcc_link,$(E80DIR)/kolibri.ld) + $(call gcc_link,$(E80DIR)/kolibri.ld) .obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \ $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \ $(E80DIR)/z80/z80.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \ $(E80DIR)/system/%.c $(E80DIR)/system/*.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/* - $(gcc_compile) + $(gcc_compile) .obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80 - fasm $< $@ + fasm $< $@ .obj.e80: - mkdir -p .obj.e80 + mkdir -p .obj.e80 # Rules for sdk/sound, used by media/ac97snd SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm)) SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc) .sdk/sound.lib: $(SOUND_OBJECTS) - win32-link /lib /out:$@ $^ + win32-link /lib /out:$@ $^ $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk - fasm $< $@ + fasm $< $@ .sdk: - mkdir -p .sdk + mkdir -p .sdk # Rules for media/ac97snd AC97DIR=$(PROGS)/media/ac97snd media/ac97snd: .obj.ac97snd/ac97snd.exe - $(msvc_final) + $(msvc_final) .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \ - .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj - $(msvc_link) + .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj + $(msvc_link) .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \ - $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ - $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ + $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd + $(msvc_compile) .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd - fasm $< $@ -s .deps/ac97snd-ufmod.fas - prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ - perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ - -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po + fasm $< $@ -s .deps/ac97snd-ufmod.fas + prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po -include .deps/ac97snd-ufmod.Po AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c) AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h) AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES)) .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj - win32-link /lib /ltcg /out:$@ $^ + win32-link /lib /ltcg /out:$@ $^ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd: - mkdir -p .obj.ac97snd + mkdir -p .obj.ac97snd # Rules for atikms.dll # Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon @@ -725,16 +724,16 @@ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_F # Note that we are going to write in the directory shared # between all Makefiles, so we need locked operations. drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir - kpack --nologo $< $@ + kpack --nologo $< $@ $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto - flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto + flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto $(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a $(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a # dependencies $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \ $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \ diff --git a/data/rus/settings/menu.dat b/data/rus/settings/menu.dat index 3fc6d02a59..ded835a64e 100644 --- a/data/rus/settings/menu.dat +++ b/data/rus/settings/menu.dat @@ -116,7 +116,6 @@ CPUID /sys/cpuid GHOST Monitor /sys/gmon K. Bus disconnected /sys/kbd HDD ଥ /sys/hdd_info -⥭ HDD /sys/hdread #13 **** ⥬ -> 䠩 **** KFM /sys/File Managers/kfm KFAR /sys/File Managers/kfar diff --git a/data/sp/Makefile b/data/sp/Makefile index 820e5e6cdb..53f06c3e32 100644 --- a/data/sp/Makefile +++ b/data/sp/Makefile @@ -289,7 +289,6 @@ CMM_PROGRAMS:=\ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ default.skn:DEFAULT.SKN \ graph:GRAPH \ - ../common/hdread:HDREAD \ settings/icon.ini:SETTINGS/ICON.INI \ ../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \ kernel.mnt:KERNEL.MNT \ @@ -338,7 +337,7 @@ OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ # Generate skins list understandable by gnu make Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh - cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ + cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ include Makefile.skins # Extra targets for the distribution kit and LiveCD image in the syntax of mkisofs @@ -484,39 +483,39 @@ $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ $(BUILD_DIR)/boot_fat12.bin \ $(targets) # SYSXTREE - str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null - dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 - mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: - dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 - mmd -i $(BUILD_DIR)/kolibri.img ::3D - mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO - mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS - mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers - mmd -i $(BUILD_DIR)/kolibri.img ::FONTS - mmd -i $(BUILD_DIR)/kolibri.img ::GAMES - mmd -i $(BUILD_DIR)/kolibri.img ::LIB - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF - mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK - mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS - $(mcopy_all_items) + str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ + echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null + dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 + mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: + dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 + mmd -i $(BUILD_DIR)/kolibri.img ::3D + mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP + mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO + mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS + mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers + mmd -i $(BUILD_DIR)/kolibri.img ::FONTS + mmd -i $(BUILD_DIR)/kolibri.img ::GAMES + mmd -i $(BUILD_DIR)/kolibri.img ::LIB + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA + mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF + mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK + mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS + $(mcopy_all_items) # The second goal: LiveCD image. $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) - mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ - -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ - -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 + mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ + -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ + -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 # The third goal: distribution list. $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) - rm -rf distribution_kit - $(call respace,$(make_distribution_dirs)) - ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img - $(call respace,$(make_distribution_links)) - touch $(BUILD_DIR)/distr.lst + rm -rf distribution_kit + $(call respace,$(make_distribution_dirs)) + ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img + $(call respace,$(make_distribution_links)) + touch $(BUILD_DIR)/distr.lst # Special targets to modify behaviour of make. .DELETE_ON_ERROR: @@ -524,16 +523,16 @@ $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) # The floppy bootsector. $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc - fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin + fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \ games/.dir lib/.dir media/.dir network/.dir settings/.dir allskins/.dir distr_data/.dir .deps/.dir: - mkdir -p $(dir $@) - touch $@ + mkdir -p $(dir $@) + touch $@ develop/info/.dir: develop/.dir File\ Managers/.dir: - mkdir -p "File Managers" - touch "File Managers/.dir" + mkdir -p "File Managers" + touch "File Managers/.dir" # extra dependency for mtldr_install.exe distr_data/mtldr_install.exe: mtldr_for_installer @@ -550,7 +549,7 @@ include Makefile.copy # Special rules for copying sysfuncs.txt - it isn't directly included in the image. docpack: $(DOCDIR)SYSFUNCS.TXT $(DOCDIR)SYSFUNCS.TXT: $(KERNEL)/docs/sysfuncs.txt - cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT + cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT # Similar for C--. include Makefile.cmm @@ -563,21 +562,21 @@ include Makefile.msvc # Rules for table table: .obj.table/table.exe - $(msvc_final) + $(msvc_final) TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \ .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \ .obj.table/mcsmemm.obj .obj.table/parser.obj TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h) .obj.table/table.exe: $(TABLE_OBJECTS) - $(msvc_link) + $(msvc_link) $(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table - $(msvc_compile) + $(msvc_compile) .obj.table: - mkdir -p .obj.table + mkdir -p .obj.table # Rules for graph graph: .obj.graph/graph.exe - $(msvc_final) + $(msvc_final) GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \ .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \ .obj.graph/mcsmemm.obj .obj.graph/parser.obj @@ -585,34 +584,34 @@ GRAPH_C_OBJECTS:=.obj.graph/string.obj GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h) GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj .obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS) - $(msvc_link) + $(msvc_link) $(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph - $(msvc_compile) + $(msvc_compile) $(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph - fasm $< $@ + fasm $< $@ .obj.graph: - mkdir -p .obj.graph + mkdir -p .obj.graph # Rules for kosilka games/kosilka: .obj.kosilka/kosilka.exe - $(msvc_final) + $(msvc_final) KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h .obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS) - $(msvc_link) + $(msvc_link) $(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka - $(msvc_compile) + $(msvc_compile) .obj.kosilka: - mkdir -p .obj.kosilka + mkdir -p .obj.kosilka include Makefile.gcc # Rules for shell shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \ $(PROGS)/system/shell/kolibri.ld - $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) + $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \ $(PROGS)/system/shell/all.h \ $(PROGS)/system/shell/system/*.h \ @@ -620,77 +619,77 @@ shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/std $(PROGS)/system/shell/modules/*.c \ $(PROGS)/system/shell/locale/rus/globals.h \ Makefile.gcc | .obj.shell - $(gcc_compile) + $(gcc_compile) .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \ $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \ Makefile.gcc | .obj.shell - $(gcc_compile) - win32-gcc -c -Os -o $@ $< + $(gcc_compile) + win32-gcc -c -Os -o $@ $< .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell - fasm $< $@ + fasm $< $@ .obj.shell: - mkdir -p .obj.shell + mkdir -p .obj.shell # Rules for e80 E80DIR=$(PROGS)/emulator/e80/trunk e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o - $(call gcc_link,$(E80DIR)/kolibri.ld) + $(call gcc_link,$(E80DIR)/kolibri.ld) .obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \ $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \ $(E80DIR)/z80/z80.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \ $(E80DIR)/system/%.c $(E80DIR)/system/*.h Makefile.gcc | .obj.e80 - $(gcc_compile) + $(gcc_compile) .obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/* - $(gcc_compile) + $(gcc_compile) .obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80 - fasm $< $@ + fasm $< $@ .obj.e80: - mkdir -p .obj.e80 + mkdir -p .obj.e80 # Rules for sdk/sound, used by media/ac97snd SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm)) SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc) .sdk/sound.lib: $(SOUND_OBJECTS) - win32-link /lib /out:$@ $^ + win32-link /lib /out:$@ $^ $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk - fasm $< $@ + fasm $< $@ .sdk: - mkdir -p .sdk + mkdir -p .sdk # Rules for media/ac97snd AC97DIR=$(PROGS)/media/ac97snd media/ac97snd: .obj.ac97snd/ac97snd.exe - $(msvc_final) + $(msvc_final) .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \ - .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj - $(msvc_link) + .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj + $(msvc_link) .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \ - $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ - $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ + $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd + $(msvc_compile) .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd - fasm $< $@ -s .deps/ac97snd-ufmod.fas - prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ - perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ - -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po + fasm $< $@ -s .deps/ac97snd-ufmod.fas + prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ + perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ + -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po -include .deps/ac97snd-ufmod.Po AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c) AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h) AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES)) .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj - win32-link /lib /ltcg /out:$@ $^ + win32-link /lib /ltcg /out:$@ $^ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd - $(msvc_compile) + $(msvc_compile) .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd - fasm $< $@ + fasm $< $@ .obj.ac97snd: - mkdir -p .obj.ac97snd + mkdir -p .obj.ac97snd # Rules for atikms.dll # Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon @@ -699,16 +698,16 @@ $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_F # Note that we are going to write in the directory shared # between all Makefiles, so we need locked operations. drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir - kpack --nologo $< $@ + kpack --nologo $< $@ $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto - flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto + flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto $(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a $(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a + flock $(REPOSITORY)/drivers/ddk/.lock \ + $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a # dependencies $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \ $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \ diff --git a/data/sp/settings/menu.dat b/data/sp/settings/menu.dat index 080cbc11c9..ed9260743b 100644 --- a/data/sp/settings/menu.dat +++ b/data/sp/settings/menu.dat @@ -112,7 +112,6 @@ CPUID /sys/cpuid Ghost Monitor /sys/gmon K. Bus desconectado /sys/kbd Informacin de HDD /sys/hdd_info -Leer HDD /sys/hdread #13 **** ARCHIVOS **** KFAR /sys/File Managers/kfar KFM /sys/File Managers/kfm diff --git a/kernel/trunk/blkdev/disk.inc b/kernel/trunk/blkdev/disk.inc index 1f0f0d22cd..f371aab5f7 100644 --- a/kernel/trunk/blkdev/disk.inc +++ b/kernel/trunk/blkdev/disk.inc @@ -1213,7 +1213,39 @@ fs_dyndisk_next_nomedia: ; ecx = partition number, esi+ebp = ASCIIZ name fs_dyndisk: dec ecx ; convert to zero-based partition index - pop edx edx edx eax ; edx = pointer to DISK, eax = NULL or edx + pop edx edx edx ; edx = pointer to DISK, dword [esp] = NULL or edx +; If the driver does not support insert notifications and we are the only fs +; operation with this disk, ask the driver whether the media +; was inserted/removed/changed. Otherwise, assume that media status is valid. + test byte [edx+DISK.DriverFlags], DISK_NO_INSERT_NOTIFICATION + jz .media_accurate + push ecx esi + mov esi, edx + cmp dword [esp+8], 0 + jz .test_no_media + cmp [esi+DISK.MediaRefCount], 2 + jnz .media_accurate_pop + lea edx, [esi+DISK.MediaInfo] + and [edx+DISKMEDIAINFO.Flags], 0 + mov al, DISKFUNC.querymedia + stdcall disk_call_driver, edx + test eax, eax + jz .media_accurate_pop + stdcall disk_media_dereference ; drop our reference so that disk_media_changed could close the media + stdcall disk_media_changed, esi, 0 + and dword [esp+8], 0 ; no media +.test_no_media: + stdcall disk_media_changed, esi, 1 ; issue fake notification + ; if querymedia() inside disk_media_changed returns error, the notification is ignored + cmp [esi+DISK.MediaInserted], 0 + jz .media_accurate_pop + lock inc [esi+DISK.MediaRefCount] + mov dword [esp+8], esi +.media_accurate_pop: + mov edx, esi + pop esi ecx +.media_accurate: + pop eax test eax, eax jz .nomedia .main: @@ -1252,30 +1284,6 @@ fs_dyndisk: .nomedia: test ecx, ecx jnz .notfound - test byte [edx+DISK.DriverFlags], DISK_NO_INSERT_NOTIFICATION - jz .deverror -; if the driver does not support insert notifications and we are the only fs -; operation with this disk, issue the fake insert notification; if media is -; still not inserted, 'disk_media_changed' will detect this and do nothing - lea ecx, [edx+DISK.MediaLock] - call mutex_lock - cmp [edx+DISK.MediaRefCount], 1 - jnz .noluck - call mutex_unlock - push edx - stdcall disk_media_changed, edx, 1 - pop edx - lea ecx, [edx+DISK.MediaLock] - call mutex_lock - cmp [edx+DISK.MediaInserted], 0 - jz .noluck - lock inc [edx+DISK.MediaRefCount] - call mutex_unlock - xor ecx, ecx - jmp .main -.noluck: - call mutex_unlock -.deverror: mov dword [esp+32], ERROR_DEVICE mov esi, edx call disk_dereference diff --git a/kernel/trunk/blkdev/fdc.inc b/kernel/trunk/blkdev/fdc.inc index 83a41d5a4e..37cbc21d6f 100644 --- a/kernel/trunk/blkdev/fdc.inc +++ b/kernel/trunk/blkdev/fdc.inc @@ -21,40 +21,48 @@ fdc_init: ;start with clean tracks. ret save_image: - call reserve_flp - call restorefatchain + cmp [ramdisk_actual_size], FLOPPY_CAPACITY + jnz .fail pusha - call check_label + mov ecx, floppy_mutex + call mutex_lock + mov [flp_number], bl + call floppy_read_bootsector cmp [FDC_Status], 0 - jne unnecessary_save_image + jne .unnecessary_save_image mov [FDD_Track], 0; Цилиндр mov [FDD_Head], 0; Сторона mov [FDD_Sector], 1; Сектор mov esi, RAMDISK call SeekTrack -save_image_1: - push esi +.save_image_1: call take_data_from_application_1 - pop esi - add esi, 512 call WriteSectWithRetr ; call WriteSector cmp [FDC_Status], 0 - jne unnecessary_save_image + jne .unnecessary_save_image inc [FDD_Sector] cmp [FDD_Sector], 19 - jne save_image_1 + jne .save_image_1 mov [FDD_Sector], 1 inc [FDD_Head] cmp [FDD_Head], 2 - jne save_image_1 + jne .save_image_1 mov [FDD_Head], 0 inc [FDD_Track] call SeekTrack cmp [FDD_Track], 80 - jne save_image_1 -unnecessary_save_image: + jne .save_image_1 +.unnecessary_save_image: + cmp [FDC_Status], 0 + pushf + mov ecx, floppy_mutex + call mutex_unlock + popf popa - mov [flp_status], 0 + jnz .fail + xor eax, eax + ret +.fail: + movi eax, 1 ret - diff --git a/kernel/trunk/blkdev/flp_drv.inc b/kernel/trunk/blkdev/flp_drv.inc index 4fb0cd5af5..b9fc049a08 100644 --- a/kernel/trunk/blkdev/flp_drv.inc +++ b/kernel/trunk/blkdev/flp_drv.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -20,8 +20,7 @@ $Revision$ ; add edi,ecx give_back_application_data_1: mov esi, FDD_BUFF;FDD_DataBuffer ;0x40000 - xor ecx, ecx - mov cx, 128 + mov ecx, 128 cld rep movsd ret @@ -32,8 +31,7 @@ give_back_application_data_1: ; add esi,ecx take_data_from_application_1: mov edi, FDD_BUFF;FDD_DataBuffer ;0x40000 - xor ecx, ecx - mov cx, 128 + mov ecx, 128 cld rep movsd ret @@ -122,6 +120,7 @@ Init_FDC_DMA: ;* AL - выводимый байт. * ;*********************************** FDCDataOutput: +; DEBUGF 1,'K : FDCDataOutput(%x)',al ; pusha push eax ecx edx mov AH, AL ;запомнить байт в AH @@ -137,6 +136,7 @@ FDCDataOutput: je @@OutByteToFDC loop @@TestRS ; Ошибка тайм-аута +; DEBUGF 1,' timeout\n' mov [FDC_Status], FDC_TimeOut jmp @@End_5 ; Вывести байт в порт данных @@ -144,6 +144,7 @@ FDCDataOutput: inc DX mov AL, AH out DX, AL +; DEBUGF 1,' ok\n' @@End_5: ; popa pop edx ecx eax @@ -170,12 +171,14 @@ FDCDataInput: je @@GetByteFromFDC loop @@TestRS_1 ; Ошибка тайм-аута +; DEBUGF 1,'K : FDCDataInput: timeout\n' mov [FDC_Status], FDC_TimeOut jmp @@End_6 ; Ввести байт из порта данных @@GetByteFromFDC: inc DX in AL, DX +; DEBUGF 1,'K : FDCDataInput: %x\n',al @@End_6: pop DX pop ECX @@ -185,6 +188,7 @@ FDCDataInput: ;* ОБРАБОТЧИК ПРЕРЫВАНИЯ ОТ КОНТРОЛЛЕРА НГМД * ;********************************************* FDCInterrupt: +; dbgstr 'FDCInterrupt' ; Установить флаг прерывания mov [FDD_IntFlag], 1 mov al, 1 @@ -207,12 +211,12 @@ WaitFDCInterrupt: jnz @@End_7 ;прерывание произошло mov eax, [timer_ticks] sub eax, [TickCounter] - cmp eax, 50 ;25 ;5 ;ожидать 5 тиков + cmp eax, 200;50 ;25 ;5 ;ожидать 5 тиков jb @@TestRS_2 ; jl @@TestRS_2 ; Ошибка тайм-аута +; dbgstr 'WaitFDCInterrupt: timeout' mov [FDC_Status], FDC_TimeOut -; mov [flp_status],0 @@End_7: popa ret @@ -221,6 +225,7 @@ WaitFDCInterrupt: ;* ВКЛЮЧИТЬ МОТОР ДИСКОВОДА "A:" * ;********************************* FDDMotorON: +; dbgstr 'FDDMotorON' pusha ; cmp [fdd_motor_status],1 ; je fdd_motor_on @@ -252,6 +257,20 @@ FDDMotorON_1: sub eax, [TickCounter] cmp eax, 50 ;10 jb @@dT +; Read results of RESET command + push 4 +; DEBUGF 1,'K : floppy reset results:' +@@: + mov al, 8 + call FDCDataOutput + call FDCDataInput +; DEBUGF 1,' %x',al + call FDCDataInput +; DEBUGF 1,' %x',al + dec dword [esp] + jnz @b +; DEBUGF 1,'\n' + pop eax cmp [flp_number], 1 jne fdd_motor_on_B mov [fdd_motor_status], 1 @@ -275,8 +294,6 @@ save_timer_fdd_motor: ;* ПРОВЕРКА ЗАДЕРЖКИ ВЫКЛЮЧЕНИЯ МОТОРА * ;***************************************** proc check_fdd_motor_status_has_work? - cmp [flp_status], 0 - jnz .yes cmp [fdd_motor_status], 0 jz .no mov eax, [timer_ticks] @@ -303,7 +320,6 @@ check_fdd_motor_status: call FDDMotorOFF mov [fdd_motor_status], 0 end_check_fdd_motor_status_1: - mov [flp_status], 0 end_check_fdd_motor_status: ret @@ -311,6 +327,7 @@ end_check_fdd_motor_status: ;* ВЫКЛЮЧИТЬ МОТОР ДИСКОВОДА * ;********************************** FDDMotorOFF: +; dbgstr 'FDDMotorOFF' push AX push DX cmp [flp_number], 1 @@ -323,8 +340,8 @@ FDDMotorOFF_2: pop DX pop AX ; сброс флагов кеширования в связи с устареванием информации - mov [root_read], 0 - mov [flp_fat], 0 + or [floppy_media_flags+0], FLOPPY_MEDIA_NEED_RESCAN + or [floppy_media_flags+1], FLOPPY_MEDIA_NEED_RESCAN ret FDDMotorOFF_A: @@ -343,8 +360,11 @@ FDDMotorOFF_B: ;* РЕКАЛИБРОВКА ДИСКОВОДА "A:" * ;******************************* RecalibrateFDD: +; dbgstr 'RecalibrateFDD' pusha call save_timer_fdd_motor +; Сбросить флаг прерывания + mov [FDD_IntFlag], 0 ; Подать команду "Рекалибровка" mov AL, 07h call FDCDataOutput @@ -352,10 +372,18 @@ RecalibrateFDD: call FDCDataOutput ; Ожидать завершения операции call WaitFDCInterrupt -; cmp [FDC_Status],0 -; je no_fdc_status_error -; mov [flp_status],0 -;no_fdc_status_error: + cmp [FDC_Status], 0 + jne .fail +; Read results of RECALIBRATE command +; DEBUGF 1,'K : floppy recalibrate results:' + mov al, 8 + call FDCDataOutput + call FDCDataInput +; DEBUGF 1,' %x',al + call FDCDataInput +; DEBUGF 1,' %x',al +; DEBUGF 1,'\n' +.fail: call save_timer_fdd_motor popa ret @@ -368,6 +396,7 @@ RecalibrateFDD: ;* Результат операции заносится в FDC_Status. * ;***************************************************** SeekTrack: +; dbgstr 'SeekTrack' pusha call save_timer_fdd_motor ; Сбросить флаг прерывания @@ -402,17 +431,20 @@ SeekTrack: cmp AL, [FDD_Track] jne @@Err ; Номер головки совпадает с заданным? - mov AL, [FDC_ST0] - and AL, 100b - shr AL, 2 - cmp AL, [FDD_Head] - jne @@Err +; The H bit (Head Address) in ST0 will always return a "0" (c) 82077AA datasheet, +; description of SEEK command. So we can not verify the proper head. +; mov AL, [FDC_ST0] +; and AL, 100b +; shr AL, 2 +; cmp AL, [FDD_Head] +; jne @@Err ; Операция завершена успешно +; dbgstr 'SeekTrack: FDC_Normal' mov [FDC_Status], FDC_Normal jmp @@Exit @@Err: ; Трек не найден +; dbgstr 'SeekTrack: FDC_TrackNotFound' mov [FDC_Status], FDC_TrackNotFound -; mov [flp_status],0 @@Exit: call save_timer_fdd_motor popa @@ -429,6 +461,7 @@ SeekTrack: ;* содержимое сектора будет занесено в FDD_DataBuffer. * ;******************************************************* ReadSector: +; dbgstr 'ReadSector' pushad call save_timer_fdd_motor ; Сбросить флаг прерывания @@ -468,11 +501,12 @@ ReadSector: call GetStatusInfo test [FDC_ST0], 11011000b jnz @@Err_1 +; dbgstr 'ReadSector: FDC_Normal' mov [FDC_Status], FDC_Normal jmp @@Exit_1 @@Err_1: +; dbgstr 'ReadSector: FDC_SectorNotFound' mov [FDC_Status], FDC_SectorNotFound -; mov [flp_status],0 @@Exit_1: call save_timer_fdd_motor popad @@ -511,12 +545,10 @@ ReadSectWithRetr: inc [RecalRepCounter] cmp [RecalRepCounter], 3 jb @@TryAgain -; mov [flp_status],0 @@Exit_2: popa ret @@Err_3: - mov [flp_status], 0 popa ret @@ -531,6 +563,7 @@ ReadSectWithRetr: ;* содержимое FDD_DataBuffer будет занесено в сектор. * ;******************************************************* WriteSector: +; dbgstr 'WriteSector' pushad call save_timer_fdd_motor ; Сбросить флаг прерывания @@ -616,7 +649,6 @@ WriteSectWithRetr: popa ret @@Err_4: - mov [flp_status], 0 popa ret @@ -642,3 +674,276 @@ GetStatusInfo: pop AX ret +; Interface for disk subsystem. +; Assume fixed capacity for 1.44M. +FLOPPY_CAPACITY = 2880 ; in sectors + +iglobal +align 4 +floppy_functions: + dd .size + dd 0 ; no close() function + dd 0 ; no closemedia() function + dd floppy_querymedia + dd floppy_read + dd floppy_write + dd 0 ; no flush() function + dd 0 ; no adjust_cache_size() function +.size = $ - floppy_functions +endg + +uglobal +floppy_media_flags rb 2 +n_sector dd 0 ; temporary save for sector value +flp_number db 0 ; 1- Floppy A, 2-Floppy B +old_track db 0 ; old value track +flp_label rb 15*2 ; Label and ID of inserted floppy disk +align 4 +; Hardware does not allow to work with two floppies in parallel, +; so there is one mutex guarding access to any floppy. +floppy_mutex MUTEX +endg +; Meaning of bits in floppy_media_flags +FLOPPY_MEDIA_PRESENT = 1 ; media was present when last asked +FLOPPY_MEDIA_NEED_RESCAN = 2 ; media was possibly changed, need to rescan +FLOPPY_MEDIA_LABEL_CHANGED = 4 ; temporary state + +iglobal +floppy1_name db 'fd',0 +floppy2_name db 'fd2',0 +endg + +; This function is called in boot process. +; It creates filesystems /fd and/or /fd2, if the system has one/two floppy drives. +proc floppy_init + mov ecx, floppy_mutex + call mutex_init +; First floppy is present if [DRIVE_DATA] and 0xF0 is nonzero. + test byte [DRIVE_DATA], 0xF0 + jz .no1 + stdcall disk_add, floppy_functions, floppy1_name, 1, DISK_NO_INSERT_NOTIFICATION +.no1: +; Second floppy is present if [DRIVE_DATA] and 0x0F is nonzero. + test byte [DRIVE_DATA], 0x0F + jz .no2 + stdcall disk_add, floppy_functions, floppy2_name, 2, DISK_NO_INSERT_NOTIFICATION +.no2: + ret +endp + +; Returns information about disk media. +; Floppy drives do not support insert notifications, +; DISK_NO_INSERT_NOTIFICATION is set, +; the disk subsystem calls this function before each filesystem operation. +; If the media has changed, return error for the first call as signal +; to finalize work with old media and the true geometry for the second call. +; Assume that media is (possibly) changed anytime when motor is off. +proc floppy_querymedia + virtual at esp+4 + .userdata dd ? + .info dd ? + end virtual +; 1. Acquire the global lock. + mov ecx, floppy_mutex + call mutex_lock + mov edx, [.userdata] ; 1 for /fd, 2 for /fd2 +; 2. If the media was reported and has been changed, forget it and report an error. + mov al, [floppy_media_flags+edx-1] + and al, FLOPPY_MEDIA_PRESENT + FLOPPY_MEDIA_NEED_RESCAN + cmp al, FLOPPY_MEDIA_PRESENT + FLOPPY_MEDIA_NEED_RESCAN + jnz .not_reported +.no_media: + mov [floppy_media_flags+edx-1], 0 +.return_no_media: + mov ecx, floppy_mutex + call mutex_unlock + mov eax, DISK_STATUS_NO_MEDIA + retn 8 +.not_reported: +; 3. If we are in the temporary state LABEL_CHANGED, this is the second call +; after intermediate DISK_STATUS_NO_MEDIA due to media change; +; clear the flag and return the current geometry without rereading the bootsector. + cmp [floppy_media_flags+edx-1], FLOPPY_MEDIA_LABEL_CHANGED + jz .report_geometry +; 4. Try to read the bootsector. + mov [flp_number], dl + mov [FDC_Status], 0 + call floppy_read_bootsector +; 5. If reading bootsector failed, assume that media is not present. + mov edx, [.userdata] + cmp [FDC_Status], 0 + jnz .no_media +; 6. Check whether the previous status is "present". If not, go to 10. + push esi edi + imul edi, edx, 15 + add edi, flp_label-15 + mov esi, FDD_BUFF+39 + mov ecx, 15 + test [floppy_media_flags+edx-1], FLOPPY_MEDIA_PRESENT + jz .set_label +; 7. Compare the old label with the current one. + rep cmpsb +; 8. If the label has not changed, go to 11. + jz .ok +; 9. If the label has changed, store it, enter temporary state LABEL_CHANGED +; and report DISK_STATUS_NO_MEDIA. +; dbgstr 'floppy label changed' + add esi, ecx + add edi, ecx + mov ecx, 15 + sub esi, ecx + sub edi, ecx + rep movsb + mov [floppy_media_flags+edx-1], FLOPPY_MEDIA_LABEL_CHANGED + pop edi esi + jmp .return_no_media +.set_label: +; 10. The previous state was "not present". Copy the label. + rep movsb +.ok: + pop edi esi +.report_geometry: +; 11. Fill DISKMEDIAINFO structure. + mov ecx, [.info] + and [ecx+DISKMEDIAINFO.Flags], 0 + mov [ecx+DISKMEDIAINFO.SectorSize], 512 + mov dword [ecx+DISKMEDIAINFO.Capacity], FLOPPY_CAPACITY + and dword [ecx+DISKMEDIAINFO.Capacity+4], 0 +; 12. Update state: media is present, data are actual. + mov [floppy_media_flags+edx-1], FLOPPY_MEDIA_PRESENT +; 13. Release the global lock and return successful status. + mov ecx, floppy_mutex + call mutex_unlock + xor eax, eax + retn 8 +endp + +proc floppy_read_bootsector + pushad + mov [FDD_Track], 0; Цилиндр + mov [FDD_Head], 0; Сторона + mov [FDD_Sector], 1; Сектор + call FDDMotorON + call RecalibrateFDD + cmp [FDC_Status], 0 + jne .nothing + call SeekTrack + cmp [FDC_Status], 0 + jne .nothing + call ReadSectWithRetr +.nothing: + popad + ret +endp + +read_chs_sector: + call calculate_chs + call ReadSectWithRetr + ret + +save_chs_sector: + call calculate_chs + call WriteSectWithRetr + ret + +calculate_chs: + mov bl, [FDD_Track] + mov [old_track], bl + mov ebx, 18 + xor edx, edx + div ebx + inc edx + mov [FDD_Sector], dl + mov edx, eax + shr eax, 1 + and edx, 1 + mov [FDD_Track], al + mov [FDD_Head], dl + mov dl, [old_track] + cmp dl, [FDD_Track] + je no_seek_track_1 + call SeekTrack +no_seek_track_1: + ret + +; Writes one or more sectors to the device. +proc floppy_write + mov dl, 1 + jmp floppy_read_write +endp + +; Reads one or more sectors from the device. +proc floppy_read + mov dl, 0 +endp + +; Common part of floppy_read and floppy_write. +proc floppy_read_write userdata:dword, buffer:dword, start_sector:qword, numsectors_ptr:dword +virtual at ebp-8 +.sectors_todo dd ? +.operation db ? +end virtual + push edx ; save operation code to [.operation] +; 1. Get number of sectors to read/write +; and zero number of sectors that were actually read/written. + mov eax, [numsectors_ptr] + push dword [eax] ; initialize [.sectors_todo] + and dword [eax], 0 + push ebx esi edi ; save used registers to be stdcall +; 2. Acquire the global lock. + mov ecx, floppy_mutex + call mutex_lock +; 3. Set floppy number for this operation. + mov edx, [userdata] + mov [flp_number], dl +; 4. Read/write sector-by-sector. +.operation_loop: +; 4a. Check that the sector is inside the media. + cmp dword [start_sector+4], 0 + jnz .end_of_media + mov eax, dword [start_sector] + cmp eax, FLOPPY_CAPACITY + jae .end_of_media +; 4b. For read operation, call read_chs_sector and then move data from FDD_BUFF to [buffer]. +; For write operation, move data from [buffer] to FDD_BUFF and then call save_chs_sector. + cmp [.operation], 0 + jz .read + mov esi, [buffer] + mov edi, FDD_BUFF + mov ecx, 512/4 + rep movsd + mov [buffer], esi + call save_chs_sector + jmp @f +.read: + call read_chs_sector + mov esi, FDD_BUFF + mov edi, [buffer] + mov ecx, 512/4 + rep movsd + mov [buffer], edi +@@: +; 4c. If there was an error, propagate it to the caller. + cmp [FDC_Status], 0 + jnz .fail +; 4d. Otherwise, increment number of sectors processed and continue the loop. + mov eax, [numsectors_ptr] + inc dword [eax] + inc dword [start_sector] + dec [.sectors_todo] + jnz .operation_loop +; 5. Release the global lock and return with the correct status. + push 0 +.return: + mov ecx, floppy_mutex + call mutex_unlock + pop eax + pop edi esi ebx ; restore used registers to be stdcall + ret ; this translates to leave/retn N and purges local variables +.fail: + push -1 + jmp .return +.end_of_media: + push DISK_STATUS_END_OF_MEDIA + jmp .return +endp diff --git a/kernel/trunk/blkdev/hd_drv.inc b/kernel/trunk/blkdev/hd_drv.inc index 8e9d79c250..89b593fd6f 100644 --- a/kernel/trunk/blkdev/hd_drv.inc +++ b/kernel/trunk/blkdev/hd_drv.inc @@ -47,6 +47,10 @@ hd0_data HD_DATA ?, 0, 1 hd1_data HD_DATA ?, 0x10, 2 hd2_data HD_DATA ?, 0, 3 hd3_data HD_DATA ?, 0x10, 4 + +hd_address_table: + dd 0x1f0, 0x00, 0x1f0, 0x10 + dd 0x170, 0x00, 0x170, 0x10 endg uglobal @@ -645,14 +649,6 @@ hd_write_error: end if ret ;----------------------------------------------------------------------------- -hd_lba_error: - if lang eq sp - DEBUGF 1,"K : FS - HD error en LBA\n" - else - DEBUGF 1,"K : FS - HD LBA error\n" - end if - jmp LBA_read_ret -;----------------------------------------------------------------------------- align 4 wait_for_hd_idle: push eax edx diff --git a/kernel/trunk/blkdev/rd.inc b/kernel/trunk/blkdev/rd.inc index b4ca7a296c..3f721aaa60 100644 --- a/kernel/trunk/blkdev/rd.inc +++ b/kernel/trunk/blkdev/rd.inc @@ -1,2296 +1,195 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; RAMDISK functions ;; -;; (C) 2004 Ville Turjanmaa, License: GPL ;; -;; Addings by M.Lisovin ;; -;; LFN support by diamond ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision$ - -; calculate fat chain - -calculatefatchain: - - pushad - - mov esi, RAMDISK+512 - mov edi, RAMDISK_FAT - - fcnew: - mov eax, dword [esi] - mov ebx, dword [esi+4] - mov ecx, dword [esi+8] - mov edx, ecx - shr edx, 4;8 ok - shr dx, 4;7 ok - xor ch, ch - shld ecx, ebx, 20;6 ok - shr cx, 4;5 ok - shld ebx, eax, 12 - and ebx, 0x0fffffff;4 ok - shr bx, 4;3 ok - shl eax, 4 - and eax, 0x0fffffff;2 ok - shr ax, 4;1 ok - mov dword [edi], eax - mov dword [edi+4], ebx - mov dword [edi+8], ecx - mov dword [edi+12], edx - add edi, 16 - add esi, 12 - - cmp edi, RAMDISK_FAT+2856*2;2849 clusters - jnz fcnew - - popad - ret - - -restorefatchain: ; restore fat chain - - pushad - - mov esi, RAMDISK_FAT - mov edi, RAMDISK+512 - - fcnew2: - mov eax, dword [esi] - mov ebx, dword [esi+4] - shl ax, 4 - shl eax, 4 - shl bx, 4 - shr ebx, 4 - shrd eax, ebx, 8 - shr ebx, 8 - mov dword [edi], eax - mov word [edi+4], bx - add edi, 6 - add esi, 8 - - cmp edi, RAMDISK+512+4278;4274 bytes - all used FAT - jb fcnew2 - - mov esi, RAMDISK+512 ; duplicate fat chain - mov edi, RAMDISK+512+0x1200 - mov ecx, 1069;4274/4 - cld - rep movsd - - popad - ret - - -ramdisk_free_space: -;--------------------------------------------- -; -; returns free space in edi -; rewr.by Mihasik -;--------------------------------------------- - - push eax ebx ecx - - mov edi, RAMDISK_FAT;start of FAT - xor ax, ax;Free cluster=0x0000 in FAT - xor ebx, ebx;counter - mov ecx, 2849;2849 clusters - cld - rdfs1: - repne scasw - jnz rdfs2 ;if last cluster not 0 - inc ebx - test ecx, ecx - jnz rdfs1 - rdfs2: - shl ebx, 9;free clusters*512 - mov edi, ebx - - pop ecx ebx eax - ret - - -expand_filename: -;--------------------------------------------- -; -; exapand filename with '.' to 11 character -; eax - pointer to filename -;--------------------------------------------- - - push esi edi ebx - - mov edi, esp ; check for '.' in the name - add edi, 12+8 - - mov esi, eax - - mov eax, edi - mov [eax+0], dword ' ' - mov [eax+4], dword ' ' - mov [eax+8], dword ' ' - - flr1: - - cmp [esi], byte '.' - jne flr2 - mov edi, eax - add edi, 7 - jmp flr3 - - flr2: - - mov bl, [esi] - mov [edi], bl - - flr3: - - inc esi - inc edi - - mov ebx, eax - add ebx, 11 - - cmp edi, ebx - jbe flr1 - - pop ebx edi esi - ret - -fileread: -;---------------------------------------------------------------- -; -; fileread - sys floppy -; -; eax points to filename 11 chars -; ebx first wanted block ; 1+ ; if 0 then set to 1 -; ecx number of blocks to read ; 1+ ; if 0 then set to 1 -; edx mem location to return data -; esi length of filename 12*X 0=root -; -; ret ebx = size or 0xffffffff file not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- - test ebx, ebx;if ebx=0 - set to 1 - jnz frfl5 - inc ebx - frfl5: - test ecx, ecx;if ecx=0 - set to 1 - jnz frfl6 - inc ecx - frfl6: - test esi, esi ; return ramdisk root - jnz fr_noroot ;if not root - cmp ebx, 14 ;14 clusters=root dir - ja oorr - cmp ecx, 14 - ja oorr - jmp fr_do - oorr: - mov eax, 5 ;out of root range (fnf) - xor ebx, ebx - dec ebx ;0xffffffff - ret - - fr_do: ;reading rootdir - mov edi, edx - dec ebx - push edx - mov edx, ecx - add edx, ebx - cmp edx, 15 ;ebx+ecx=14+1 - pushf - jbe fr_do1 - sub edx, 14 - sub ecx, edx - fr_do1: - shl ebx, 9 - mov esi, RAMDISK+512*19 - add esi, ebx - shl ecx, 7 - cld - rep movsd - popf - pop edx - jae fr_do2 - xor eax, eax; ok read - xor ebx, ebx - ret - fr_do2: ;if last cluster - mov eax, 6;end of file - xor ebx, ebx - ret - - fr_noroot: - - sub esp, 32 - call expand_filename - - dec ebx - - push eax - - push eax ebx ecx edx esi edi - call rd_findfile - je fifound - add esp, 32+28 ;if file not found - ret - - fifound: - - mov ebx, [edi-11+28] ;file size - mov [esp+20], ebx - mov [esp+24], ebx - add edi, 0xf - movzx eax, word [edi] - mov edi, eax ;edi=cluster - - frnew: - - add eax, 31 ;bootsector+2*fat+filenames - shl eax, 9 ;*512 - add eax, RAMDISK ;image base - mov ebx, [esp+8] - mov ecx, 512 ;[esp+4] - - cmp [esp+16], dword 0 ; wanted cluster ? - jne frfl7 - call memmove - add [esp+8], dword 512 - dec dword [esp+12] ; last wanted cluster ? - je frnoread - jmp frfl8 - frfl7: - dec dword [esp+16] - frfl8: - movzx eax, word [edi*2+RAMDISK_FAT] ; find next cluster from FAT - mov edi, eax - cmp edi, 4095 ;eof - cluster - jz frnoread2 - - cmp [esp+24], dword 512 ;eof - size - jb frnoread - sub [esp+24], dword 512 - - jmp frnew - - frnoread2: - - cmp [esp+16], dword 0 ; eof without read ? - je frnoread - - pop edi esi edx ecx - add esp, 4 - pop ebx ; ebx <- eax : size of file - add esp, 36 - mov eax, 6 ; end of file - ret - - frnoread: - - pop edi esi edx ecx - add esp, 4 - pop ebx ; ebx <- eax : size of file - add esp, 36 - xor eax, eax;read ok - ret - - - - rd_findfile: - ;by Mihasik - ;IN: eax - pointer to filename OUT: filestring+11 in edi or notZero in flags and fnf in eax,ebx - - mov edi, RAMDISK+512*18+512;Point at directory - cld - rd_newsearch: - mov esi, eax - mov ecx, 11 - rep cmpsb - je rd_ff - add cl, 21 - add edi, ecx - cmp edi, RAMDISK+512*33 - jb rd_newsearch - mov eax, 5 ;if file not found - eax=5 - xor ebx, ebx - dec ebx ;ebx=0xffffffff and zf=0 - rd_ff: - ret - -; \begin{diamond} - -uni2ansi_str: -; convert UNICODE zero-terminated string to ASCII-string (codepage 866) -; in: esi->source, edi->buffer (may be esi=edi) -; destroys: eax,esi,edi - lodsw - test ax, ax - jz .done - cmp ax, 0x80 - jb .ascii - cmp ax, 0x401 - jz .yo1 - cmp ax, 0x451 - jz .yo2 - cmp ax, 0x410 - jb .unk - cmp ax, 0x440 - jb .rus1 - cmp ax, 0x450 - jb .rus2 -.unk: - mov al, '_' - jmp .doit -.yo1: - mov al, 0xF0 ; 'Ё' - jmp .doit -.yo2: - mov al, 0xF1 ; 'ё' - jmp .doit -.rus1: -; 0x410-0x43F -> 0x80-0xAF - add al, 0x70 - jmp .doit -.rus2: -; 0x440-0x44F -> 0xE0-0xEF - add al, 0xA0 -.ascii: -.doit: - stosb - jmp uni2ansi_str -.done: - mov byte [edi], 0 - ret - -ansi2uni_char: -; convert ANSI character in al to UNICODE character in ax, using cp866 encoding - mov ah, 0 -; 0x00-0x7F - trivial map - cmp al, 0x80 - jb .ret -; 0x80-0xAF -> 0x410-0x43F - cmp al, 0xB0 - jae @f - add ax, 0x410-0x80 -.ret: - ret -@@: -; 0xE0-0xEF -> 0x440-0x44F - cmp al, 0xE0 - jb .unk - cmp al, 0xF0 - jae @f - add ax, 0x440-0xE0 - ret -; 0xF0 -> 0x401 -; 0xF1 -> 0x451 -@@: - cmp al, 0xF0 ; 'Ё' - jz .yo1 - cmp al, 0xF1 ; 'ё' - jz .yo2 -.unk: - mov al, '_' ; ah=0 - ret -.yo1: - mov ax, 0x401 - ret -.yo2: - mov ax, 0x451 - ret - -char_toupper: -; convert character to uppercase, using cp866 encoding -; in: al=symbol -; out: al=converted symbol - cmp al, 'a' - jb .ret - cmp al, 'z' - jbe .az - cmp al, 0xF1 ; 'ё' - jz .yo1 - cmp al, 0xA0 ; 'а' - jb .ret - cmp al, 0xE0 ; 'р' - jb .rus1 - cmp al, 0xEF ; 'я' - ja .ret -; 0xE0-0xEF -> 0x90-0x9F - sub al, 0xE0-0x90 -.ret: - ret -.rus1: -; 0xA0-0xAF -> 0x80-0x8F -.az: - and al, not 0x20 - ret -.yo1: -; 0xF1 -> 0xF0 - dec ax - ret - -fat_get_name: -; in: edi->FAT entry -; out: CF=1 - no valid entry -; else CF=0 and ebp->ASCIIZ-name -; (maximum length of filename is 255 (wide) symbols without trailing 0, -; but implementation requires buffer 261 words) -; destroys eax - cmp byte [edi], 0 - jz .no - cmp byte [edi], 0xE5 - jnz @f -.no: - stc - ret -@@: - cmp byte [edi+11], 0xF - jz .longname - test byte [edi+11], 8 - jnz .no - push ecx - push edi ebp - test byte [ebp-4], 1 - jnz .unicode_short - - mov eax, [edi] - mov ecx, [edi+4] - mov [ebp], eax - mov [ebp+4], ecx - - mov ecx, 8 -@@: - cmp byte [ebp+ecx-1], ' ' - loope @b - - mov eax, [edi+8] - cmp al, ' ' - je .done - shl eax, 8 - mov al, '.' - - lea ebp, [ebp+ecx+1] - mov [ebp], eax - mov ecx, 3 -@@: - rol eax, 8 - cmp al, ' ' - jne .done - loop @b - dec ebp -.done: - and byte [ebp+ecx+1], 0 ; CF=0 - pop ebp edi ecx - ret -.unicode_short: - mov ecx, 8 - push ecx -@@: - mov al, [edi] - inc edi - call ansi2uni_char - mov [ebp], ax - inc ebp - inc ebp - loop @b - pop ecx -@@: - cmp word [ebp-2], ' ' - jnz @f - dec ebp - dec ebp - loop @b -@@: - mov word [ebp], '.' - inc ebp - inc ebp - mov ecx, 3 - push ecx -@@: - mov al, [edi] - inc edi - call ansi2uni_char - mov [ebp], ax - inc ebp - inc ebp - loop @b - pop ecx -@@: - cmp word [ebp-2], ' ' - jnz @f - dec ebp - dec ebp - loop @b - dec ebp - dec ebp -@@: - and word [ebp], 0 ; CF=0 - pop ebp edi ecx - ret -.longname: -; LFN - mov al, byte [edi] - and eax, 0x3F - dec eax - cmp al, 20 - jae .no ; ignore invalid entries - mov word [ebp+260*2], 0 ; force null-terminating for orphans - imul eax, 13*2 - add ebp, eax - test byte [edi], 0x40 - jz @f - mov word [ebp+13*2], 0 -@@: - push eax -; now copy name from edi to ebp ... - mov eax, [edi+1] - mov [ebp], eax ; symbols 1,2 - mov eax, [edi+5] - mov [ebp+4], eax ; 3,4 - mov eax, [edi+9] - mov [ebp+8], ax ; 5 - mov eax, [edi+14] - mov [ebp+10], eax ; 6,7 - mov eax, [edi+18] - mov [ebp+14], eax ; 8,9 - mov eax, [edi+22] - mov [ebp+18], eax ; 10,11 - mov eax, [edi+28] - mov [ebp+22], eax ; 12,13 -; ... done - pop eax - sub ebp, eax - test eax, eax - jz @f -; if this is not first entry, more processing required - stc - ret -@@: -; if this is first entry: - test byte [ebp-4], 1 - jnz .ret -; buffer at ebp contains UNICODE name, convert it to ANSI - push esi edi - mov esi, ebp - mov edi, ebp - call uni2ansi_str - pop edi esi -.ret: - clc - ret - -fat_compare_name: -; compares ASCIIZ-names, case-insensitive (cp866 encoding) -; in: esi->name, ebp->name -; out: if names match: ZF=1 and esi->next component of name -; else: ZF=0, esi is not changed -; destroys eax - push ebp esi -.loop: - mov al, [ebp] - inc ebp - call char_toupper - push eax - lodsb - call char_toupper - cmp al, [esp] - jnz .done - pop eax - test al, al - jnz .loop - dec esi - pop eax - pop ebp - xor eax, eax ; set ZF flag - ret -.done: - cmp al, '/' - jnz @f - cmp byte [esp], 0 - jnz @f - mov [esp+4], esi -@@: - pop eax - pop esi ebp - ret - -fat_time_to_bdfe: -; in: eax=FAT time -; out: eax=BDFE time - push ecx edx - mov ecx, eax - mov edx, eax - shr eax, 11 - shl eax, 16 ; hours - and edx, 0x1F - add edx, edx - mov al, dl ; seconds - shr ecx, 5 - and ecx, 0x3F - mov ah, cl ; minutes - pop edx ecx - ret - -fat_date_to_bdfe: - push ecx edx - mov ecx, eax - mov edx, eax - shr eax, 9 - add ax, 1980 - shl eax, 16 ; year - and edx, 0x1F - mov al, dl ; day - shr ecx, 5 - and ecx, 0xF - mov ah, cl ; month - pop edx ecx - ret - -bdfe_to_fat_time: - push edx - mov edx, eax - shr eax, 16 - and dh, 0x3F - shl eax, 6 - or al, dh - shr dl, 1 - and dl, 0x1F - shl eax, 5 - or al, dl - pop edx - ret - -bdfe_to_fat_date: - push edx - mov edx, eax - shr eax, 16 - sub ax, 1980 - and dh, 0xF - shl eax, 4 - or al, dh - and dl, 0x1F - shl eax, 5 - or al, dl - pop edx - ret - -fat_entry_to_bdfe: -; convert FAT entry at edi to BDFE (block of data of folder entry) at esi, advance esi -; destroys eax - mov eax, [ebp-4] - mov [esi+4], eax ; ASCII/UNICODE name -fat_entry_to_bdfe2: - movzx eax, byte [edi+11] - mov [esi], eax ; attributes - movzx eax, word [edi+14] - call fat_time_to_bdfe - mov [esi+8], eax ; creation time - movzx eax, word [edi+16] - call fat_date_to_bdfe - mov [esi+12], eax ; creation date - and dword [esi+16], 0 ; last access time is not supported on FAT - movzx eax, word [edi+18] - call fat_date_to_bdfe - mov [esi+20], eax ; last access date - movzx eax, word [edi+22] - call fat_time_to_bdfe - mov [esi+24], eax ; last write time - movzx eax, word [edi+24] - call fat_date_to_bdfe - mov [esi+28], eax ; last write date - mov eax, [edi+28] - mov [esi+32], eax ; file size (low dword) - xor eax, eax - mov [esi+36], eax ; file size (high dword) - test ebp, ebp - jz .ret - push ecx edi - lea edi, [esi+40] - mov esi, ebp - test byte [esi-4], 1 - jz .ansi - mov ecx, 260/2 - rep movsd - mov [edi-2], ax -@@: - mov esi, edi - pop edi ecx -.ret: - ret -.ansi: - mov ecx, 264/4 - rep movsd - mov [edi-1], al - jmp @b - -bdfe_to_fat_entry: -; convert BDFE at edx to FAT entry at edi -; destroys eax -; attributes byte - test byte [edi+11], 8 ; volume label? - jnz @f - mov al, [edx] - and al, 0x27 - and byte [edi+11], 0x10 - or byte [edi+11], al -@@: - mov eax, [edx+8] - call bdfe_to_fat_time - mov [edi+14], ax ; creation time - mov eax, [edx+12] - call bdfe_to_fat_date - mov [edi+16], ax ; creation date - mov eax, [edx+20] - call bdfe_to_fat_date - mov [edi+18], ax ; last access date - mov eax, [edx+24] - call bdfe_to_fat_time - mov [edi+22], ax ; last write time - mov eax, [edx+28] - call bdfe_to_fat_date - mov [edi+24], ax ; last write date - ret - -ramdisk_root_first: - mov edi, RAMDISK+512*19 - clc - ret -ramdisk_root_next: - add edi, 0x20 - cmp edi, RAMDISK+512*33 - cmc - ret - -ramdisk_root_extend_dir: - stc - ret - -uglobal -; this is for delete support -rd_prev_sector dd ? -rd_prev_prev_sector dd ? +iglobal +align 4 +ramdisk_functions: + dd .size + dd 0 ; no close() function + dd 0 ; no closemedia() function + dd ramdisk_querymedia + dd ramdisk_read + dd ramdisk_write + dd 0 ; no flush() function + dd ramdisk_adjust_cache_size +.size = $ - ramdisk_functions endg -ramdisk_notroot_next: - add edi, 0x20 - test edi, 0x1FF - jz ramdisk_notroot_next_sector - ret ; CF=0 -ramdisk_notroot_next_sector: - push ecx - mov ecx, [eax] - push [rd_prev_sector] - pop [rd_prev_prev_sector] - mov [rd_prev_sector], ecx - mov ecx, [ecx*2+RAMDISK_FAT] - and ecx, 0xFFF - cmp ecx, 2849 - jae ramdisk_notroot_first.err2 - mov [eax], ecx - pop ecx -ramdisk_notroot_first: - mov eax, [eax] - cmp eax, 2 - jb .err - cmp eax, 2849 - jae .err - shl eax, 9 - lea edi, [eax+(31 shl 9)+RAMDISK] - clc - ret -.err2: - pop ecx -.err: - stc - ret -ramdisk_notroot_next_write: - test edi, 0x1FF - jz ramdisk_notroot_next_sector -ramdisk_root_next_write: - ret - -ramdisk_notroot_extend_dir: - pusha - xor eax, eax - mov edi, RAMDISK_FAT - mov ecx, 2849 - repnz scasw - jnz .notfound - mov word [edi-2], 0xFFF - sub edi, RAMDISK_FAT - shr edi, 1 - dec edi - mov eax, [esp+28] - mov ecx, [eax] - mov [RAMDISK_FAT+ecx*2], di - mov [eax], edi - shl edi, 9 - add edi, (31 shl 9)+RAMDISK - mov [esp], edi - xor eax, eax - mov ecx, 128 - rep stosd - popa - clc - ret -.notfound: - popa - stc - ret - -rd_find_lfn: -; in: esi+ebp -> name -; out: CF=1 - file not found -; else CF=0 and edi->direntry - push esi edi - push 0 - push ramdisk_root_first - push ramdisk_root_next -.loop: - call fat_find_lfn - jc .notfound - cmp byte [esi], 0 - jz .found -.continue: - test byte [edi+11], 10h - jz .notfound - movzx eax, word [edi+26] - mov [esp+8], eax - mov dword [esp+4], ramdisk_notroot_first - mov dword [esp], ramdisk_notroot_next - test eax, eax - jnz .loop - mov dword [esp+4], ramdisk_root_first - mov dword [esp], ramdisk_notroot_next - jmp .loop -.notfound: - add esp, 12 - pop edi esi - stc - ret -.found: - test ebp, ebp - jz @f - mov esi, ebp - xor ebp, ebp - jmp .continue -@@: - mov eax, [esp+8] - add esp, 16 ; CF=0 - pop esi - ret - -;---------------------------------------------------------------- -; -; fs_RamdiskRead - LFN variant for reading sys floppy -; -; esi points to filename -; ebx pointer to 64-bit number = first wanted byte, 0+ -; may be ebx=0 - start from first byte -; ecx number of bytes to read, 0+ -; edx mem location to return data -; -; ret ebx = bytes read or 0xffffffff file not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -fs_RamdiskRead: - cmp byte [esi], 0 - jnz @f - or ebx, -1 - mov eax, 10 ; access denied - ret -@@: - push edi - call rd_find_lfn - jnc .found - pop edi - or ebx, -1 - mov eax, 5 ; file not found - ret -.found: - test ebx, ebx - jz .l1 - cmp dword [ebx+4], 0 - jz @f - xor ebx, ebx -.reteof: - mov eax, 6 ; EOF - pop edi - ret -@@: - mov ebx, [ebx] -.l1: - push ecx edx - push 0 - mov eax, [edi+28] - sub eax, ebx - jb .eof - cmp eax, ecx - jae @f - mov ecx, eax - mov byte [esp], 6 ; EOF -@@: - movzx edi, word [edi+26] ; cluster -.new: - jecxz .done - test edi, edi - jz .eof - cmp edi, 0xFF8 - jae .eof - lea eax, [edi+31] ; bootsector+2*fat+filenames - shl eax, 9 ; *512 - add eax, RAMDISK ; image base -; now eax points to data of cluster - sub ebx, 512 - jae .skip - lea eax, [eax+ebx+512] - neg ebx - push ecx - cmp ecx, ebx - jbe @f - mov ecx, ebx -@@: - mov ebx, edx - call memmove - add edx, ecx - sub [esp], ecx - pop ecx - xor ebx, ebx -.skip: - movzx edi, word [edi*2+RAMDISK_FAT] ; find next cluster from FAT - jmp .new -.eof: - mov ebx, edx - pop eax edx ecx - sub ebx, edx - jmp .reteof -.done: - mov ebx, edx - pop eax edx ecx edi - sub ebx, edx - ret - -;---------------------------------------------------------------- -; -; fs_RamdiskReadFolder - LFN variant for reading sys floppy folder -; -; esi points to filename; only root is folder on ramdisk -; ebx pointer to structure 32-bit number = first wanted block -; & flags (bitfields) -; flags: bit 0: 0=ANSI names, 1=UNICODE names -; ecx number of blocks to read, 0+ -; edx mem location to return data -; -; ret ebx = size or 0xffffffff file not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -fs_RamdiskReadFolder: - push edi - cmp byte [esi], 0 - jz .root - call rd_find_lfn - jnc .found - pop edi - or ebx, -1 - mov eax, ERROR_FILE_NOT_FOUND - ret -.found: - test byte [edi+11], 0x10 - jnz .found_dir - pop edi - or ebx, -1 - mov eax, ERROR_ACCESS_DENIED - ret -.found_dir: - movzx eax, word [edi+26] - add eax, 31 - push 0 - jmp .doit -.root: - mov eax, 19 - push 14 -.doit: - push esi ecx ebp - sub esp, 262*2 ; reserve space for LFN - mov ebp, esp - push dword [ebx+4] ; for fat_get_name: read ANSI/UNICODE names - mov ebx, [ebx] -; init header - push eax ecx - mov edi, edx - mov ecx, 32/4 - xor eax, eax - rep stosd - mov byte [edx], 1 ; version - pop ecx eax - mov esi, edi ; esi points to block of data of folder entry (BDFE) -.main_loop: - mov edi, eax - shl edi, 9 - add edi, RAMDISK - push eax -.l1: - call fat_get_name - jc .l2 - cmp byte [edi+11], 0xF - jnz .do_bdfe - add edi, 0x20 - test edi, 0x1FF - jnz .do_bdfe - pop eax - inc eax - dec byte [esp+262*2+16] - jz .done - jns @f -; read next sector from FAT - mov eax, [(eax-31-1)*2+RAMDISK_FAT] - and eax, 0xFFF - cmp eax, 0xFF8 - jae .done - add eax, 31 - mov byte [esp+262*2+16], 0 -@@: - mov edi, eax - shl edi, 9 - add edi, RAMDISK - push eax -.do_bdfe: - inc dword [edx+8] ; new file found - dec ebx - jns .l2 - dec ecx - js .l2 - inc dword [edx+4] ; new file block copied - call fat_entry_to_bdfe -.l2: - add edi, 0x20 - test edi, 0x1FF - jnz .l1 - pop eax - inc eax - dec byte [esp+262*2+16] - jz .done - jns @f -; read next sector from FAT - mov eax, [(eax-31-1)*2+RAMDISK_FAT] - and eax, 0xFFF - cmp eax, 0xFF8 - jae .done - add eax, 31 - mov byte [esp+262*2+16], 0 -@@: - jmp .main_loop -.done: - add esp, 262*2+4 - pop ebp - mov ebx, [edx+4] - xor eax, eax - dec ecx - js @f - mov al, ERROR_END_OF_FILE -@@: - pop ecx esi edi edi - ret +; See memmap.inc. +; Currently size of memory allocated for the ramdisk is fixed. +; This should be revisited when/if memory map would become more dynamic. +RAMDISK_CAPACITY = 2880 ; in sectors iglobal -label fat_legal_chars byte -; 0 = not allowed -; 1 = allowed only in long names -; 3 = allowed - times 32 db 0 -; ! " # $ % & ' ( ) * + , - . / - db 1,3,0,3,3,3,3,3,3,3,0,1,1,3,3,0 -; 0 1 2 3 4 5 6 7 8 9 : ; < = > ? - db 3,3,3,3,3,3,3,3,3,3,0,1,0,1,0,0 -; @ A B C D E F G H I J K L M N O - db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 -; P Q R S T U V W X Y Z [ \ ] ^ _ - db 3,3,3,3,3,3,3,3,3,3,3,1,0,1,3,3 -; ` a b c d e f g h i j k l m n o - db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 -; p q r s t u v w x y z { | } ~ - db 3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0 +align 4 +ramdisk_actual_size dd RAMDISK_CAPACITY endg -fat_name_is_legal: -; in: esi->(long) name -; out: CF set <=> legal -; destroys eax - push esi - xor eax, eax -@@: - lodsb - test al, al - jz .done - cmp al, 80h - jae .big - test [fat_legal_chars+eax], 1 - jnz @b -.err: - pop esi - clc - ret -.big: -; 0x80-0xAF, 0xE0-0xEF - cmp al, 0xB0 - jb @b - cmp al, 0xE0 - jb .err - cmp al, 0xF0 - jb @b - jmp .err -.done: - sub esi, [esp] - cmp esi, 257 - pop esi - ret - -fat_next_short_name: -; in: edi->8+3 name -; out: name corrected -; CF=1 <=> error - pushad - mov ecx, 8 - mov al, '~' - std - push edi - add edi, 7 - repnz scasb - pop edi - cld - jz .tilde -; tilde is not found, insert "~1" at end - add edi, 6 - cmp word [edi], ' ' - jnz .insert_tilde -@@: - dec edi - cmp byte [edi], ' ' - jz @b - inc edi -.insert_tilde: - mov word [edi], '~1' - popad - clc - ret -.tilde: - push edi - add edi, 7 +; This function is called early in boot process. +; It creates filesystem /rd/1 based on raw image data loaded by somebody before +; to memory named as RAMDISK with max size RAMDISK_CAPACITY, may be less. +proc ramdisk_init +iglobal +ramdisk_name db 'rd',0 +endg + push ebx esi ; save used registers to be stdcall +; 1. Register the device and the (always inserted) media in the disk subsystem. + stdcall disk_add, ramdisk_functions, ramdisk_name, 0, 0 + test eax, eax + jz .fail + mov ebx, eax + stdcall disk_media_changed, eax, 1 +; 2. We don't know actual size of loaded image, +; so try to calculate it using partition structure, +; assuming that file systems fill the real size based on contents of the partition. +; 2a. Prepare for loop over partitions. xor ecx, ecx -@@: -; after tilde may be only digits and trailing spaces - cmp byte [edi], '~' - jz .break - cmp byte [edi], ' ' - jz .space - cmp byte [edi], '9' - jnz .found - dec edi - jmp @b -.space: - dec edi - inc ecx - jmp @b -.found: - inc byte [edi] - add dword [esp], 8 - jmp .zerorest -.break: - jecxz .noplace - inc edi - mov al, '1' -@@: - xchg al, [edi] - inc edi - cmp al, ' ' - mov al, '0' - jnz @b -.succ: - pop edi - popad - clc - ret -.noplace: - dec edi - cmp edi, [esp] - jz .err - add dword [esp], 8 - mov word [edi], '~1' - inc edi - inc edi -@@: - mov byte [edi], '0' -.zerorest: - inc edi - cmp edi, [esp] - jb @b - pop edi - popad - ;clc ; automatically - ret -.err: - pop edi - popad - stc - ret - -fat_gen_short_name: -; in: esi->long name -; edi->buffer (8+3=11 chars) -; out: buffer filled - pushad - mov eax, ' ' - push edi - stosd - stosd - stosd - pop edi - xor eax, eax - movi ebx, 8 - lea ecx, [edi+8] -.loop: - lodsb - test al, al - jz .done - call char_toupper - cmp al, ' ' - jz .space - cmp al, 80h - ja .big - test [fat_legal_chars+eax], 2 - jnz .symbol -.inv_symbol: - mov al, '_' - or bh, 1 -.symbol: - cmp al, '.' - jz .dot -.normal_symbol: - dec bl - jns .store - mov bl, 0 -.space: - or bh, 1 - jmp .loop -.store: - stosb - jmp .loop -.big: - cmp al, 0xB0 - jb .normal_symbol - cmp al, 0xE0 - jb .inv_symbol - cmp al, 0xF0 - jb .normal_symbol - jmp .inv_symbol -.dot: - test bh, 2 - jz .firstdot - pop ebx - add ebx, edi - sub ebx, ecx - push ebx - cmp ebx, ecx + xor edx, edx +; 2b. Check that at least one partition was recognized. + cmp [ebx+DISK.NumPartitions], ecx + jz .fail +; 2c. Loop over partitions. +.partitions: +; For every partition, set edx to maximum between edx and end of partition. + mov esi, [ebx+DISK.Partitions] + mov esi, [esi+ecx*4] + mov eax, dword [esi+PARTITION.FirstSector] + add eax, dword [esi+PARTITION.Length] + cmp eax, edx jb @f - pop ebx - push ecx -@@: - cmp edi, ecx - jbe .skip -@@: - dec edi - mov al, [edi] - dec ebx - mov [ebx], al - mov byte [edi], ' ' - cmp edi, ecx - ja @b -.skip: - mov bh, 3 - jmp @f -.firstdot: - cmp bl, 8 - jz .space - push edi - or bh, 2 -@@: - mov edi, ecx - mov bl, 3 - jmp .loop -.done: - test bh, 2 - jz @f - pop edi -@@: - lea edi, [ecx-8] - test bh, 1 - jz @f - call fat_next_short_name -@@: - popad - ret - -;---------------------------------------------------------------- -; -; fs_RamdiskRewrite - LFN variant for writing ramdisk -; fs_RamdiskCreateFolder - create folder on ramdisk -; -; esi points to file/folder name -; ebx ignored (reserved) -; ecx number of bytes to write, 0+ (ignored for folders) -; edx mem location to data (ignored for folders) -; -; ret ebx = number of written bytes -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -@@: - mov eax, ERROR_ACCESS_DENIED - xor ebx, ebx - ret - -fs_RamdiskCreateFolder: - mov al, 1 ; create folder - jmp fs_RamdiskRewrite.common - -fs_RamdiskRewrite: - xor eax, eax ; create file -.common: - cmp byte [esi], 0 - jz @b - pushad - xor edi, edi - push esi - test ebp, ebp - jz @f - mov esi, ebp -@@: - lodsb - test al, al - jz @f - cmp al, '/' - jnz @b - lea edi, [esi-1] - jmp @b -@@: - pop esi - test edi, edi - jnz .noroot - test ebp, ebp - jnz .hasebp - push ramdisk_root_extend_dir - push ramdisk_root_next_write - push edi - push ramdisk_root_first - push ramdisk_root_next - jmp .common1 -.hasebp: - mov eax, ERROR_ACCESS_DENIED - cmp byte [ebp], 0 - jz .ret1 - push ebp - xor ebp, ebp - call rd_find_lfn - pop esi - jc .notfound0 - jmp .common0 -.noroot: - mov eax, ERROR_ACCESS_DENIED - cmp byte [edi+1], 0 - jz .ret1 -; check existence - mov byte [edi], 0 - push edi - call rd_find_lfn - pop esi - mov byte [esi], '/' - jnc @f -.notfound0: - mov eax, ERROR_FILE_NOT_FOUND -.ret1: - mov [esp+28], eax - popad - xor ebx, ebx - ret -@@: - inc esi -.common0: - test byte [edi+11], 0x10 ; must be directory - mov eax, ERROR_ACCESS_DENIED - jz .ret1 - movzx ebp, word [edi+26] ; ebp=cluster - mov eax, ERROR_FAT_TABLE - cmp ebp, 2 - jb .ret1 - cmp ebp, 2849 - jae .ret1 - push ramdisk_notroot_extend_dir - push ramdisk_notroot_next_write - push ebp - push ramdisk_notroot_first - push ramdisk_notroot_next -.common1: - call fat_find_lfn - jc .notfound -; found - test byte [edi+11], 10h - jz .exists_file -; found directory; if we are creating directory, return OK, -; if we are creating file, say "access denied" - add esp, 20 - popad - test al, al - mov eax, ERROR_ACCESS_DENIED - jz @f - mov al, 0 -@@: - xor ebx, ebx - ret -.exists_file: -; found file; if we are creating directory, return "access denied", -; if we are creating file, delete existing file and continue - cmp byte [esp+20+28], 0 - jz @f - add esp, 20 - popad - mov eax, ERROR_ACCESS_DENIED - xor ebx, ebx - ret -@@: -; delete FAT chain - push edi - xor eax, eax - mov dword [edi+28], eax ; zero size - xchg ax, word [edi+26] ; start cluster - test eax, eax - jz .done1 -@@: - cmp eax, 0xFF8 - jae .done1 - lea edi, [RAMDISK_FAT + eax*2] ; position in FAT - xor eax, eax - xchg ax, [edi] - jmp @b -.done1: - pop edi - call get_time_for_file - mov [edi+22], ax - call get_date_for_file - mov [edi+24], ax - mov [edi+18], ax - or byte [edi+11], 20h ; set 'archive' attribute - jmp .doit -.notfound: -; file is not found; generate short name - call fat_name_is_legal - jc @f - add esp, 20 - popad - mov eax, ERROR_FILE_NOT_FOUND - xor ebx, ebx - ret -@@: - sub esp, 12 - mov edi, esp - call fat_gen_short_name -.test_short_name_loop: - push esi edi ecx - mov esi, edi - lea eax, [esp+12+12+8] - mov [eax], ebp - call dword [eax-4] - jc .found -.test_short_name_entry: - cmp byte [edi+11], 0xF - jz .test_short_name_cont - mov ecx, 11 - push esi edi - repz cmpsb - pop edi esi - jz .short_name_found -.test_short_name_cont: - lea eax, [esp+12+12+8] - call dword [eax-8] - jnc .test_short_name_entry - jmp .found -.short_name_found: - pop ecx edi esi - call fat_next_short_name - jnc .test_short_name_loop -.disk_full: - add esp, 12+20 - popad - mov eax, ERROR_DISK_FULL - xor ebx, ebx - ret -.found: - pop ecx edi esi -; now find space in directory -; we need to save LFN <=> LFN is not equal to short name <=> generated name contains '~' - mov al, '~' - push ecx edi - mov ecx, 8 - repnz scasb - movi eax, 1 ; 1 entry - jnz .notilde -; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total - xor eax, eax -@@: - cmp byte [esi], 0 - jz @f - inc esi - inc eax - jmp @b -@@: - sub esi, eax - add eax, 12+13 - mov ecx, 13 - push edx - cdq - div ecx - pop edx -.notilde: - push -1 - push -1 -; find successive entries in directory - xor ecx, ecx - push eax - lea eax, [esp+12+8+12+8] - mov [eax], ebp - call dword [eax-4] - pop eax -.scan_dir: - cmp byte [edi], 0 - jz .free - cmp byte [edi], 0xE5 - jz .free - xor ecx, ecx -.scan_cont: - push eax - lea eax, [esp+12+8+12+8] - call dword [eax-8] - pop eax - jnc .scan_dir - push eax - lea eax, [esp+12+8+12+8] - call dword [eax+8] ; extend directory - pop eax - jnc .scan_dir - add esp, 8+8+12+20 - popad - mov eax, ERROR_DISK_FULL - xor ebx, ebx - ret -.free: - test ecx, ecx - jnz @f - mov [esp], edi - mov ecx, [esp+8+8+12+8] - mov [esp+4], ecx - xor ecx, ecx + mov edx, eax @@: inc ecx - cmp ecx, eax - jb .scan_cont -; found! -; If creating a directory, allocate one data cluster now and fail immediately -; if this is impossible. This prevents from creating an invalid directory entry -; on a full disk. -; yup, the argument is quite non-intuitive... but what should I do if -; the entire function uses such arguments? BTW, it refers to al from pushad, -; which in turn is filled with 0 in fs_RamdiskRewrite and 1 in fs_RamdiskCreateFolder. - push esi ecx - cmp byte [esp+24+12+20+28], 0 - jz .no.preallocate.folder.data - mov ecx, 2849 - mov edi, RAMDISK_FAT - xor eax, eax - repnz scasw - jz @f - add esp, 24 - jmp .disk_full + cmp ecx, [ebx+DISK.NumPartitions] + jb .partitions +; 3. Reclaim unused memory, if any. + mov [ramdisk_actual_size], edx + add edx, 7 ; aligning up + shr edx, 3 ; 512-byte sectors -> 4096-byte pages + mov esi, RAMDISK_CAPACITY / 8 ; aligning down + sub esi, edx + jbe .no_reclaim + shl edx, 12 + add edx, RAMDISK - OS_BASE @@: - mov [esp+24+12+20+20], edi ; store the cluster somewhere -.no.preallocate.folder.data: -; calculate name checksum - mov esi, [esp+8+8] - mov ecx, 11 - xor eax, eax -@@: - ror al, 1 - add al, [esi] - inc esi - loop @b - pop ecx esi - pop edi - pop dword [esp+8+12+8] -; edi points to last entry in free chunk - dec ecx - jz .nolfn - push esi - push eax - mov al, 40h -.writelfn: - or al, cl - mov esi, [esp+4] - push ecx - dec ecx - imul ecx, 13 - add esi, ecx - stosb - mov cl, 5 - call .read_symbols - mov ax, 0xF - stosw - mov al, [esp+4] - stosb - mov cl, 6 - call .read_symbols - xor eax, eax - stosw - mov cl, 2 - call .read_symbols - pop ecx - lea eax, [esp+8+8+12+8] - call dword [eax+4] ; next write - xor eax, eax - loop .writelfn - pop eax - pop esi -.nolfn: - xchg esi, [esp] - mov ecx, 11 - rep movsb - mov word [edi], 20h ; attributes - sub edi, 11 - pop esi ecx - add esp, 12 - mov byte [edi+13], 0 ; tenths of a second at file creation time - call get_time_for_file - mov [edi+14], ax ; creation time - mov [edi+22], ax ; last write time - call get_date_for_file - mov [edi+16], ax ; creation date - mov [edi+24], ax ; last write date - mov [edi+18], ax ; last access date - and word [edi+20], 0 ; high word of cluster - and word [edi+26], 0 ; low word of cluster - to be filled - and dword [edi+28], 0 ; file size - to be filled - cmp byte [esp+20+28], 0 - jz .doit -; create directory - mov byte [edi+11], 10h ; attributes: folder - mov ecx, 32*2 - mov edx, edi - push edx - push ecx - push edi - add edi, 26 ; edi points to low word of cluster - push edi - mov edi, [esp+16+20+20] - jmp .doit2 -.doit: - push edx - push ecx - push edi - add edi, 26 ; edi points to low word of cluster - push edi - jecxz .done - mov ecx, 2849 - mov edi, RAMDISK_FAT -.write_loop: -; allocate new cluster - xor eax, eax - repnz scasw - jnz .disk_full2 -.doit2: - dec edi - dec edi - - ; lea eax, [edi-(RAMDISK_FAT)] - - mov eax, edi - sub eax, RAMDISK_FAT - - shr eax, 1 ; eax = cluster - mov word [edi], 0xFFF ; mark as last cluster - xchg edi, [esp] - stosw - pop edi - push edi - inc ecx -; write data - cmp byte [esp+16+20+28], 0 - jnz .writedir - shl eax, 9 - add eax, RAMDISK+31*512 -.writefile: - mov ebx, edx - xchg eax, ebx - push ecx - mov ecx, 512 - cmp dword [esp+12], ecx - jae @f - mov ecx, [esp+12] -@@: - call memmove - add edx, ecx - sub [esp+12], ecx - pop ecx - jnz .write_loop -.done: - mov ebx, edx - pop edi edi ecx edx - sub ebx, edx - mov [edi+28], ebx - add esp, 20 - mov [esp+16], ebx - popad - xor eax, eax - ret -.disk_full2: - mov ebx, edx - pop edi edi ecx edx - sub ebx, edx - mov [edi+28], ebx - add esp, 20 - mov [esp+16], ebx - popad - movi eax, ERROR_DISK_FULL - ret -.writedir: - mov edi, eax - shl edi, 9 - add edi, RAMDISK+31*512 - mov esi, edx - mov ecx, 32/4 - push ecx - rep movsd - mov dword [edi-32], '. ' - mov dword [edi-32+4], ' ' - mov dword [edi-32+8], ' ' - mov byte [edi-32+11], 10h - mov word [edi-32+26], ax - mov esi, edx - pop ecx - rep movsd - mov dword [edi-32], '.. ' - mov dword [edi-32+4], ' ' - mov dword [edi-32+8], ' ' - mov byte [edi-32+11], 10h - mov eax, [esp+16+8] - mov word [edi-32+26], ax - xor eax, eax - mov ecx, (512-32*2)/4 - rep stosd - pop edi edi ecx edx - add esp, 20 - popad - xor eax, eax - xor ebx, ebx - ret - -.read_symbol: - or ax, -1 - test esi, esi - jz .retFFFF - lodsb - test al, al - jnz ansi2uni_char - xor eax, eax - xor esi, esi -.retFFFF: - ret - -.read_symbols: - call .read_symbol - stosw - loop .read_symbols - ret - -;---------------------------------------------------------------- -; -; fs_RamdiskWrite - LFN variant for writing to sys floppy -; -; esi points to filename -; ebx pointer to 64-bit number = first wanted byte, 0+ -; may be ebx=0 - start from first byte -; ecx number of bytes to write, 0+ -; edx mem location to data -; -; ret ebx = bytes written (maybe 0) -; eax = 0 ok write or other = errormsg -; -;-------------------------------------------------------------- -@@: - push ERROR_ACCESS_DENIED -fs_RamdiskWrite.ret0: - pop eax - xor ebx, ebx - ret - -fs_RamdiskWrite: - cmp byte [esi], 0 - jz @b - pushad - call rd_find_lfn - jnc .found - popad - push ERROR_FILE_NOT_FOUND - jmp .ret0 -.found: -; must not be directory - test byte [edi+11], 10h - jz @f - popad - push ERROR_ACCESS_DENIED - jmp .ret0 -@@: -; FAT does not support files larger than 4GB - test ebx, ebx - jz .l1 - cmp dword [ebx+4], 0 - jz @f -.eof: - popad - push ERROR_END_OF_FILE - jmp .ret0 -@@: - mov ebx, [ebx] -.l1: -; now edi points to direntry, ebx=start byte to write, -; ecx=number of bytes to write, edx=data pointer - call fat_update_datetime - -; extend file if needed - add ecx, ebx - jc .eof ; FAT does not support files larger than 4GB - push 0 ; return value=0 - cmp ecx, [edi+28] - jbe .length_ok - cmp ecx, ebx - jz .length_ok - call ramdisk_extend_file - jnc .length_ok -; ramdisk_extend_file can return two error codes: FAT table error or disk full. -; First case is fatal error, in second case we may write some data - mov [esp], eax - cmp al, ERROR_DISK_FULL - jz .disk_full - pop eax - mov [esp+28], eax - popad - xor ebx, ebx - ret -.disk_full: -; correct number of bytes to write - mov ecx, [edi+28] - cmp ecx, ebx - ja .length_ok -.ret: - pop eax - mov [esp+28], eax ; eax=return value - sub edx, [esp+20] - mov [esp+16], edx ; ebx=number of written bytes - popad - ret -.length_ok: -; now ebx=start pos, ecx=end pos, both lie inside file - sub ecx, ebx - jz .ret - movzx edi, word [edi+26] ; starting cluster -.write_loop: - sub ebx, 0x200 - jae .next_cluster - push ecx - neg ebx - cmp ecx, ebx - jbe @f - mov ecx, ebx -@@: - mov eax, edi - shl eax, 9 - add eax, RAMDISK+31*512+0x200 - sub eax, ebx - mov ebx, eax mov eax, edx - call memmove - xor ebx, ebx - add edx, ecx - sub [esp], ecx - pop ecx - jz .ret -.next_cluster: - movzx edi, word [edi*2+RAMDISK_FAT] - jmp .write_loop + call free_page + add edx, 0x1000 + dec esi + jnz @b +.no_reclaim: + pop esi ebx ; restore used registers to be stdcall + ret +.fail: + dbgstr 'Failed to initialize ramdisk' + pop esi ebx ; restore used registers to be stdcall + ret +endp -ramdisk_extend_file.zero_size: +; Returns information about disk media. +proc ramdisk_querymedia + virtual at esp+4 + .userdata dd ? + .info dd ? + end virtual +; Media is always present, sector size is always 512 bytes. + mov edx, [.userdata] + mov ecx, [.info] + mov [ecx+DISKMEDIAINFO.Flags], 0 + mov [ecx+DISKMEDIAINFO.SectorSize], 512 + mov eax, [ramdisk_actual_size] + mov dword [ecx+DISKMEDIAINFO.Capacity], eax + mov dword [ecx+DISKMEDIAINFO.Capacity+4], 0 +; Return zero as an indicator of success. xor eax, eax - jmp ramdisk_extend_file.start_extend + retn 8 +endp -; extends file on ramdisk to given size, new data area is filled by 0 -; in: edi->direntry, ecx=new size -; out: CF=0 => OK, eax=0 -; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL) -ramdisk_extend_file: - push ecx -; find the last cluster of file - movzx eax, word [edi+26] ; first cluster - mov ecx, [edi+28] - jecxz .zero_size -@@: - sub ecx, 0x200 - jbe @f - mov eax, [eax*2+RAMDISK_FAT] - and eax, 0xFFF - jz .fat_err - cmp eax, 0xFF8 - jb @b -.fat_err: - pop ecx - movi eax, ERROR_FAT_TABLE - stc - ret -@@: - push eax - mov eax, [eax*2+RAMDISK_FAT] - and eax, 0xFFF - cmp eax, 0xFF8 - pop eax - jb .fat_err -; set length to full number of sectors and make sure that last sector is zero-padded - sub [edi+28], ecx - push eax edi - mov edi, eax - shl edi, 9 - lea edi, [edi+RAMDISK+31*512+0x200+ecx] - neg ecx - xor eax, eax - rep stosb - pop edi eax -.start_extend: - pop ecx -; now do extend - push edx esi - mov esi, RAMDISK_FAT+2*2 ; start scan from cluster 2 - mov edx, 2847 ; number of clusters to scan -.extend_loop: - cmp [edi+28], ecx - jae .extend_done -; add new sector - push ecx - mov ecx, edx - push edi - mov edi, esi - jecxz .disk_full - push eax - xor eax, eax - repnz scasw - pop eax - jnz .disk_full - mov word [edi-2], 0xFFF - mov esi, edi - mov edx, ecx - sub edi, RAMDISK_FAT - shr edi, 1 - dec edi ; now edi=new cluster - test eax, eax - jz .first_cluster - mov [RAMDISK_FAT+eax*2], di - jmp @f -.first_cluster: - pop eax ; eax->direntry - push eax - mov [eax+26], di -@@: - push edi - shl edi, 9 - add edi, RAMDISK+31*512 - xor eax, eax - mov ecx, 512/4 - rep stosd - pop eax ; eax=new cluster - pop edi ; edi->direntry - pop ecx ; ecx=required size - add dword [edi+28], 0x200 - jmp .extend_loop -.extend_done: - mov [edi+28], ecx - pop esi edx - xor eax, eax ; CF=0 - ret -.disk_full: - pop edi ecx - pop esi edx - stc - movi eax, ERROR_DISK_FULL - ret - -fat_update_datetime: - call get_time_for_file - mov [edi+22], ax ; last write time - call get_date_for_file - mov [edi+24], ax ; last write date - mov [edi+18], ax ; last access date - ret - -;---------------------------------------------------------------- -; -; fs_RamdiskSetFileEnd - set end of file on ramdisk -; -; esi points to filename -; ebx points to 64-bit number = new file size -; ecx ignored (reserved) -; edx ignored (reserved) -; -; ret eax = 0 ok or other = errormsg -; -;-------------------------------------------------------------- -fs_RamdiskSetFileEnd: - cmp byte [esi], 0 - jnz @f -.access_denied: - push ERROR_ACCESS_DENIED - jmp .ret -@@: - push edi - call rd_find_lfn - jnc @f - pop edi - push ERROR_FILE_NOT_FOUND -.ret: - pop eax - ret -@@: -; must not be directory - test byte [edi+11], 10h - jz @f - pop edi - jmp .access_denied -@@: -; file size must not exceed 4Gb - cmp dword [ebx+4], 0 - jz @f - pop edi - push ERROR_END_OF_FILE - jmp .ret -@@: -; set file modification date/time to current - call fat_update_datetime - mov eax, [ebx] - cmp eax, [edi+28] - jb .truncate - ja .expand - pop edi - xor eax, eax - ret -.expand: - push ecx +; Common procedure for reading and writing. +; operation = 0 for reading, operation = 1 for writing. +; Arguments of ramdisk_read and ramdisk_write are the same. +macro ramdisk_read_write operation +{ + push esi edi ; save used registers to be stdcall + mov esi, [userdata] + mov edi, [numsectors_ptr] +; 1. Determine number of sectors to be transferred. +; This is either the requested number of sectors or number of sectors +; up to the disk boundary, depending of what is less. + xor ecx, ecx +; 1a. Test whether [start_sector] is less than RAMDISK_CAPACITY. +; If so, calculate number of sectors between [start_sector] and RAMDISK_CAPACITY. +; Otherwise, the actual number of sectors is zero. + cmp dword [start_sector+4], ecx + jnz .got_number + mov eax, [ramdisk_actual_size] + sub eax, dword [start_sector] + jbe .got_number +; 1b. Get the requested number of sectors. + mov ecx, [edi] +; 1c. If it is greater than number of sectors calculated in 1a, use the value +; from 1a. + cmp ecx, eax + jb .got_number mov ecx, eax - call ramdisk_extend_file - pop ecx - pop edi - ret -.truncate: - mov [edi+28], eax - push ecx - movzx ecx, word [edi+26] - test eax, eax - jz .zero_size -; find new last sector -@@: - sub eax, 0x200 - jbe @f - movzx ecx, word [RAMDISK_FAT+ecx*2] - jmp @b -@@: -; zero data at the end of last sector - push ecx - mov edi, ecx - shl edi, 9 - lea edi, [edi+RAMDISK+31*512+eax+0x200] - mov ecx, eax - neg ecx +.got_number: +; 2. Compare the actual number of sectors with requested. If they are +; equal, set eax (it will be the returned value) to zero. Otherwise, +; use DISK_STATUS_END_OF_MEDIA. xor eax, eax - rep stosb - pop ecx -; terminate FAT chain - lea ecx, [RAMDISK_FAT+ecx+ecx] - push dword [ecx] - mov word [ecx], 0xFFF - pop ecx - and ecx, 0xFFF - jmp .delete -.zero_size: - and word [edi+26], 0 -.delete: -; delete FAT chain starting with ecx -; mark all clusters as free - cmp ecx, 0xFF8 - jae .deleted - lea ecx, [RAMDISK_FAT+ecx+ecx] - push dword [ecx] - and word [ecx], 0 - pop ecx - and ecx, 0xFFF - jmp .delete -.deleted: - pop ecx - pop edi - xor eax, eax - ret - -fs_RamdiskGetFileInfo: - cmp byte [esi], 0 - jnz @f - mov eax, 2 ; unsupported - ret -@@: - push edi - call rd_find_lfn -fs_GetFileInfo_finish: - jnc @f - pop edi - mov eax, ERROR_FILE_NOT_FOUND - ret -@@: - push esi ebp - xor ebp, ebp - mov esi, edx - and dword [esi+4], 0 - call fat_entry_to_bdfe2 - pop ebp esi - pop edi - xor eax, eax - ret - -fs_RamdiskSetFileInfo: - cmp byte [esi], 0 - jnz @f - mov eax, 2 ; unsupported - ret -@@: - push edi - call rd_find_lfn - jnc @f - pop edi - mov eax, ERROR_FILE_NOT_FOUND - ret -@@: - call bdfe_to_fat_entry - pop edi - xor eax, eax - ret - -;---------------------------------------------------------------- -; -; fs_RamdiskDelete - delete file or empty folder from ramdisk -; -; esi points to filename -; -; ret eax = 0 ok or other = errormsg -; -;-------------------------------------------------------------- -fs_RamdiskDelete: - cmp byte [esi], 0 - jnz @f -; cannot delete root! -.access_denied: - push ERROR_ACCESS_DENIED -.pop_ret: - pop eax - ret -@@: - and [rd_prev_sector], 0 - and [rd_prev_prev_sector], 0 - push edi - call rd_find_lfn - jnc .found - pop edi - push ERROR_FILE_NOT_FOUND - jmp .pop_ret -.found: - cmp dword [edi], '. ' - jz .access_denied2 - cmp dword [edi], '.. ' - jz .access_denied2 - test byte [edi+11], 10h - jz .dodel -; we can delete only empty folders! - movzx eax, word [edi+26] - push ebx - mov ebx, eax - shl ebx, 9 - add ebx, RAMDISK + 31*0x200 + 2*0x20 -.checkempty: - cmp byte [ebx], 0 - jz .empty - cmp byte [ebx], 0xE5 - jnz .notempty - add ebx, 0x20 - test ebx, 0x1FF - jnz .checkempty - movzx eax, word [RAMDISK_FAT + eax*2] - test eax, eax - jz .empty - mov ebx, eax - shl ebx, 9 - add ebx, RAMDISK + 31*0x200 - jmp .checkempty -.notempty: - pop ebx -.access_denied2: - pop edi - jmp .access_denied -.empty: - pop ebx -.dodel: - movzx eax, word [edi+26] -; delete folder entry - mov byte [edi], 0xE5 -; delete LFN (if present) -.lfndel: - test edi, 0x1FF - jnz @f - cmp [rd_prev_sector], 0 + cmp ecx, [edi] jz @f - cmp [rd_prev_sector], -1 - jz .lfndone - mov edi, [rd_prev_sector] - push [rd_prev_prev_sector] - pop [rd_prev_sector] - or [rd_prev_prev_sector], -1 - shl edi, 9 - add edi, RAMDISK + 31*0x200 + 0x200 + mov al, DISK_STATUS_END_OF_MEDIA @@: - sub edi, 0x20 - cmp byte [edi], 0xE5 - jz .lfndone - cmp byte [edi+11], 0xF - jnz .lfndone - mov byte [edi], 0xE5 - jmp .lfndel -.lfndone: -; delete FAT chain - cmp eax, 2 - jb .done - cmp eax, 0xFF8 - jae .done - lea eax, [RAMDISK_FAT + eax*2] - push dword [eax] - and word [eax], 0 - pop eax - and eax, 0xFFF - jmp .lfndone -.done: - pop edi - xor eax, eax - ret +; 3. Store the actual number of sectors. + mov [edi], ecx +; 4. Calculate source and destination addresses. +if operation = 0 ; reading? + mov esi, dword [start_sector] + shl esi, 9 + add esi, RAMDISK + mov edi, [buffer] +else ; writing? + mov edi, dword [start_sector] + shl edi, 9 + add edi, RAMDISK + mov esi, [buffer] +end if +; 5. Calculate number of dwords to be transferred. + shl ecx, 9-2 +; 6. Copy data. + rep movsd +; 7. Return. The value in eax was calculated in step 2. + pop edi esi ; restore used registers to be stdcall +} -; \end{diamond} +; Reads one or more sectors from the device. +proc ramdisk_read userdata:dword, buffer:dword, start_sector:qword, numsectors_ptr:dword + ramdisk_read_write 0 + ret +endp + +; Writes one or more sectors to the device. +proc ramdisk_write userdata:dword, buffer:dword, start_sector:qword, numsectors_ptr:dword + ramdisk_read_write 1 + ret +endp + +; The kernel calls this function when initializing cache subsystem for +; the media. This call allows the driver to adjust the cache size. +proc ramdisk_adjust_cache_size + virtual at esp+4 + .userdata dd ? + .suggested_size dd ? + end virtual +; Since ramdisk does not need cache, just return 0. + xor eax, eax + retn 8 +endp diff --git a/kernel/trunk/blkdev/rdsave.inc b/kernel/trunk/blkdev/rdsave.inc index 7c016cccaa..fbf627c269 100644 --- a/kernel/trunk/blkdev/rdsave.inc +++ b/kernel/trunk/blkdev/rdsave.inc @@ -13,16 +13,19 @@ saverd_fileinfo: dd 2 ; subfunction: write dd 0 ; (reserved) dd 0 ; (reserved) - dd 1440*1024 ; size 1440 Kb +.size: + dd 0 dd RAMDISK db 0 .name: dd ? endg sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only) - call restorefatchain mov ebx, saverd_fileinfo - mov [saverd_fileinfo.name], ecx + mov [ebx+21], ecx + mov eax, [ramdisk_actual_size] + shl eax, 9 + mov [ebx+12], eax pushad call file_system_lfn_protected ;in ebx popad diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 9456f1a206..849835afb7 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -659,10 +659,6 @@ terminate: ; terminate application jnz @f call free_cd_channel and [cd_status], 0 -@@: - cmp [flp_status], esi - jnz @f - and [flp_status], 0 @@: pop esi cmp [bgrlockpid], esi diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index 71283fbc80..babbfd8d90 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -7,20 +7,6 @@ $Revision$ -; Old style system call converter -align 16 -cross_order: - ; load all registers in crossed order - mov eax, ebx - mov ebx, ecx - mov ecx, edx - mov edx, esi - mov esi, edi - movzx edi, byte[esp+28 + 4] - sub edi, 53 - call dword [servetable+edi*4] - ret - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; SYSENTER ENTRY ;; @@ -109,24 +95,6 @@ iglobal ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SYSTEM FUNCTIONS TABLE ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - align 4 - servetable: - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - dd file_system ; 58-Common file system interface - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; NEW SYSTEM FUNCTIONS TABLE ;; - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; align 4 servetable2: @@ -136,7 +104,7 @@ iglobal dd sys_clock ; 3-GetTime dd syscall_writetext ; 4-WriteText dd delay_hs_unprotected ; 5-DelayHs - dd syscall_openramdiskfile ; 6-OpenRamdiskFile + dd undefined_syscall ; 6-deprecated OpenRamdiskFile dd syscall_putimage ; 7-PutImage dd syscall_button ; 8-DefineButton dd sys_cpuusage ; 9-GetProcessInfo @@ -188,7 +156,7 @@ iglobal dd sound_interface ; 55-Sound interface dd undefined_syscall ; 56-reserved dd sys_pcibios ; 57-PCI BIOS32 - dd cross_order ; 58-Common file system interface + dd undefined_syscall ; 58-deprecated Common file system interface dd undefined_syscall ; 59-reserved dd sys_IPC ; 60-Inter Process Communication dd sys_gs ; 61-Direct graphics access diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index bab6334930..a3ad946f73 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -51,7 +51,7 @@ keymap_alt: if lang eq ru boot_initirq cp866 'Инициализация IRQ',0 boot_picinit cp866 'Инициализация PIC',0 - boot_v86machine cp866 'Инициализация системы V86 машины',0 + boot_v86machine cp866 'Инициализация системной V86 машины',0 boot_inittimer cp866 'Инициализация системного таймера (IRQ0)',0 boot_initapic cp866 'Попытка инициализации APIC',0 boot_enableirq cp866 'Включить прерывания 2, 13',0 @@ -69,6 +69,7 @@ if lang eq ru boot_cpuid cp866 'Чтение CPUIDs',0 ; boot_devices cp866 'Поиск устройств',0 boot_timer cp866 'Установка таймера',0 + boot_initramdisk cp866 'Инициализация рамдиска',0 boot_irqs cp866 'Переопределение IRQ',0 boot_setmouse cp866 'Установка мыши',0 boot_windefs cp866 'Установка настроек окон по умолчанию',0 @@ -98,6 +99,7 @@ else boot_picinit db 'Initialize PIC',0 boot_v86machine db 'Initialize system V86 machine',0 boot_inittimer db 'Initialize system timer (IRQ0)',0 + boot_initramdisk db 'Initialize ramdisk',0 boot_initapic db 'Try to initialize APIC',0 boot_enableirq db 'Enable interrupts 2, 13',0 boot_disabling_ide db 'Disable interrupts in IDE controller',0 @@ -172,7 +174,13 @@ end if vmode db '/sys/drivers/VMODE.MDR',0 ;vrr_m db 'VRR_M',0 -kernel_file db 'KERNEL MNT' +kernel_file_load: +; load kernel.mnt to 0x7000:0 + dd 0 ; subfunction + dq 0 ; offset in file + dd 0x30000 ; number of bytes to read + dd 0x70000 ; buffer for data + db '/RD/1/KERNEL.MNT',0 dev_data_path db '/RD/1/DRIVERS/DEVICES.DAT',0 @@ -570,8 +578,7 @@ end if org (OS_BASE+0x0100000) RAMDISK: rb 2880*512 -RAMDISK_FAT: rb 2856*2 -FLOPPY_FAT: rb 2856*2 + rb 2856*4 ; not used _CLEAN_ZONE: diff --git a/kernel/trunk/data32et.inc b/kernel/trunk/data32et.inc index 4ef93608c5..71a6dba48f 100644 --- a/kernel/trunk/data32et.inc +++ b/kernel/trunk/data32et.inc @@ -2,6 +2,7 @@ boot_picinit latin1 'Algväärtustan PIC',0 boot_v86machine latin1 'Algväärtustan süsteemi V86 masinat',0 boot_inittimer latin1 'Algväärtustan süsteemi taimerit (IRQ0)',0 + boot_initramdisk latin1 'Initialize ramdisk',0 boot_initapic latin1 'Proovin Algväärtustada APIC',0 boot_enableirq latin1 'Luban katkestused 2, 13',0 boot_disabling_ide latin1 'Keelan IDE kontrolleri katkestused',0 diff --git a/kernel/trunk/data32sp.inc b/kernel/trunk/data32sp.inc index 3f36a0bd52..61ef0d4e1b 100644 --- a/kernel/trunk/data32sp.inc +++ b/kernel/trunk/data32sp.inc @@ -2,6 +2,7 @@ boot_picinit: cp850 'Inicializar PIC',0 boot_v86machine: cp850 'Inicializar sistema V86',0 boot_inittimer: cp850 'Inicializar reloj del sistema (IRQ0)',0 + boot_initramdisk cp850 'Initialize ramdisk',0 boot_initapic: cp850 'Prueba inicializar APIC',0 boot_enableirq: cp850 'Habilitar interrupciones 2, 13',0 boot_disabling_ide:cp850 'Habiliar interrupciones en controladores IDE',0 diff --git a/kernel/trunk/detect/dev_fd.inc b/kernel/trunk/detect/dev_fd.inc index 91f2eee480..b15cf32feb 100644 --- a/kernel/trunk/detect/dev_fd.inc +++ b/kernel/trunk/detect/dev_fd.inc @@ -33,5 +33,6 @@ wait_cmos: stdcall attach_int_handler, 6, FDCInterrupt, 0 DEBUGF 1, "K : Set IDE IRQ6 return code %x\n", eax + call floppy_init @@: diff --git a/kernel/trunk/fs/fat32.inc b/kernel/trunk/fs/fat.inc similarity index 73% rename from kernel/trunk/fs/fat32.inc rename to kernel/trunk/fs/fat.inc index 6632ed5b6d..83e01474d3 100644 --- a/kernel/trunk/fs/fat32.inc +++ b/kernel/trunk/fs/fat.inc @@ -5,7 +5,7 @@ ;; ;; ;; FAT32.INC ;; ;; ;; -;; FAT16/32 functions for KolibriOS ;; +;; FAT functions for KolibriOS ;; ;; ;; ;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;; ;; ;; @@ -94,7 +94,16 @@ longname_sec2 dd 0 ; directory sectors for delete long filename fat_in_cache dd -1 -fat_cache rb 512 +; For FAT16/FAT32, this points to 512-byte buffer for the current sector of FAT. +; For FAT12, the entire FAT structure is read +; and unpacked from 12bit per cluster to word per cluster. +; +; Note: work with unpacked copy of FAT12 means +; additional memory and additional code for packing/unpacking. +; I'm not sure that the economy justifies the cost, but anyway, +; there is how work was done before my edits, and I'm just keeping the principle. +fat_cache_ptr dd ? +fat12_unpacked_ptr dd ? buffer rb 512 fsinfo_buffer rb 512 ends @@ -120,7 +129,7 @@ endg iglobal align 4 fat_user_functions: - dd free + dd fat_free dd (fat_user_functions_end - fat_user_functions - 4) / 4 dd fat_Read dd fat_ReadFolder @@ -214,30 +223,42 @@ fat_create_partition: movzx eax, byte [ebx+0x10] ; number of fats mov [ebp+FAT.NUMBER_OF_FATS], eax - imul eax, [ebp+FAT.SECTORS_PER_FAT] + mul [ebp+FAT.SECTORS_PER_FAT] + test edx, edx + jnz .free_return0 add eax, [ebp+FAT.FAT_START] + jc .free_return0 mov [ebp+FAT.ROOT_START], eax ; rootdir = fat_start + fat_size * fat_count add eax, [ebp+FAT.ROOT_SECTORS] ; rootdir sectors should be 0 on fat32 + jc .free_return0 mov [ebp+FAT.DATA_START], eax ; data area = rootdir + rootdir_size movzx eax, word [ebx+0x13] ; total sector count <65536 test eax, eax jnz @f mov eax, [ebx+0x20] ; total sector count +@@: +; total sector count must not exceed partition size + cmp dword [ebp+FAT.Length+4], 0 + jnz @f + cmp eax, dword [ebp+FAT.Length] + ja .free_return0 @@: mov dword [ebp+FAT.Length], eax and dword [ebp+FAT.Length+4], 0 sub eax, [ebp+FAT.DATA_START] ; eax = count of data sectors + jc .free_return0 xor edx, edx div [ebp+FAT.SECTORS_PER_CLUSTER] inc eax mov [ebp+FAT.LAST_CLUSTER], eax dec eax ; cluster count + jz .free_return0 mov [ebp+FAT.fatStartScan], 2 ; limits by Microsoft Hardware White Paper v1.03 cmp eax, 4085 ; 0xff5 - jb .free_return0 ; fat12 not supported + jb .fat12 cmp eax, 65525 ; 0xfff5 jb .fat16 .fat32: @@ -261,7 +282,14 @@ fat_create_partition: mov [ebp+FAT.fatEND], 0x0FFFFFF8 mov [ebp+FAT.fatMASK], 0x0FFFFFFF mov al, 32 +.fat_not_12_finalize: mov [ebp+FAT.fs_type], al +; For FAT16 and FAT32, allocate 512 bytes for FAT cache. + mov eax, 512 + call malloc + test eax, eax + jz .free_return0 + mov [ebp+FAT.fat_cache_ptr], eax mov eax, ebp pop ebp ret @@ -272,11 +300,445 @@ fat_create_partition: mov [ebp+FAT.fatEND], 0x0000FFF8 mov [ebp+FAT.fatMASK], 0x0000FFFF mov al, 16 + jmp .fat_not_12_finalize +.fat12: + and [ebp+FAT.ROOT_CLUSTER], 0 + mov [ebp+FAT.fatRESERVED], 0xFF6 + mov [ebp+FAT.fatBAD], 0xFF7 + mov [ebp+FAT.fatEND], 0xFFF + mov [ebp+FAT.fatMASK], 0xFFF + mov al, 12 mov [ebp+FAT.fs_type], al +; For FAT12, allocate&read data for entire table: +; calculate A = ALIGN_UP(NUM_CLUSTERS, 8), +; calculatefatchain/restorefatchain will process A items, +; allocate ALIGN_UP(A*3/2, 512) bytes for FAT table plus A*2 bytes for unpacked data. + mov eax, [ebp+FAT.LAST_CLUSTER] + and eax, not 7 + add eax, 8 + mov edx, eax + lea eax, [eax*3] + add eax, 512*2-1 + shr eax, 10 + shl eax, 9 + lea eax, [eax+edx*2] + call malloc + test eax, eax + jz .free_return0 +; Read ALIGN_UP(NUM_CLUSTERS*3/2, 512) bytes. +; Note that this can be less than allocated, this is ok, +; overallocation simplifies calculatefatchain/restorefatchain. + push ebx + mov [ebp+FAT.fat_cache_ptr], eax + mov edx, [ebp+FAT.LAST_CLUSTER] + lea edx, [(edx+1)*3 + 512*2-1] + shr edx, 10 + xchg eax, ebx + xor eax, eax +.read_fat: + push eax + add eax, [ebp+FAT.FAT_START] + call fs_read32_sys + test eax, eax + pop eax + jz @f + dbgstr 'Failed to read FAT table' + mov eax, [ebp+FAT.fat_cache_ptr] + call free + pop ebx + jmp .free_return0 +@@: + add ebx, 512 + inc eax + cmp eax, edx + jb .read_fat + mov [ebp+FAT.fat12_unpacked_ptr], ebx + call calculatefatchain + pop ebx mov eax, ebp pop ebp ret +fat_free: + push eax + mov eax, [eax+FAT.fat_cache_ptr] + call free + pop eax + jmp free + +calculatefatchain: + + pushad + + mov esi, [ebp+FAT.fat_cache_ptr] + mov edi, [ebp+FAT.fat12_unpacked_ptr] + + mov edx, [ebp+FAT.LAST_CLUSTER] + and edx, not 7 + lea edx, [edi+(edx+8)*2] + push edx + + fcnew: + mov eax, dword [esi] + mov ebx, dword [esi+4] + mov ecx, dword [esi+8] + mov edx, ecx + shr edx, 4;8 ok + shr dx, 4;7 ok + xor ch, ch + shld ecx, ebx, 20;6 ok + shr cx, 4;5 ok + shld ebx, eax, 12 + and ebx, 0x0fffffff;4 ok + shr bx, 4;3 ok + shl eax, 4 + and eax, 0x0fffffff;2 ok + shr ax, 4;1 ok + mov dword [edi], eax + mov dword [edi+4], ebx + mov dword [edi+8], ecx + mov dword [edi+12], edx + add edi, 16 + add esi, 12 + + cmp edi, [esp] + jnz fcnew + pop eax + + popad + ret + + +restorefatchain: ; restore fat chain + + pushad + + mov esi, [ebp+FAT.fat12_unpacked_ptr] + mov edi, [ebp+FAT.fat_cache_ptr] + + mov edx, [ebp+FAT.LAST_CLUSTER] + and edx, not 7 + lea edx, [esi+(edx+8)*2] + + fcnew2: + mov eax, dword [esi] + mov ebx, dword [esi+4] + shl ax, 4 + shl eax, 4 + shl bx, 4 + shr ebx, 4 + shrd eax, ebx, 8 + shr ebx, 8 + mov dword [edi], eax + mov word [edi+4], bx + add edi, 6 + add esi, 8 + + cmp esi, edx + jb fcnew2 + + mov esi, [ebp+FAT.NUMBER_OF_FATS] + mov edx, [ebp+FAT.LAST_CLUSTER] + lea edx, [(edx+1)*3 + 512*2-1] + shr edx, 10 + push [ebp+FAT.FAT_START] + +.write_fats: + xor eax, eax + mov ebx, [ebp+FAT.fat_cache_ptr] +.loop1: + push eax + add eax, [esp+4] + call fs_write32_sys + test eax, eax + pop eax + jnz .fail + add ebx, 512 + inc eax + cmp eax, edx + jb .loop1 + pop eax + add eax, [ebp+FAT.SECTORS_PER_FAT] + push eax + dec esi + jnz .write_fats + pop eax + + popad + ret +.fail: + dbgstr 'Failed to save FAT' + popad + ret + +iglobal +label fat_legal_chars byte +; 0 = not allowed +; 1 = allowed only in long names +; 3 = allowed + times 32 db 0 +; ! " # $ % & ' ( ) * + , - . / + db 1,3,0,3,3,3,3,3,3,3,0,1,1,3,3,0 +; 0 1 2 3 4 5 6 7 8 9 : ; < = > ? + db 3,3,3,3,3,3,3,3,3,3,0,1,0,1,0,0 +; @ A B C D E F G H I J K L M N O + db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 +; P Q R S T U V W X Y Z [ \ ] ^ _ + db 3,3,3,3,3,3,3,3,3,3,3,1,0,1,3,3 +; ` a b c d e f g h i j k l m n o + db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 +; p q r s t u v w x y z { | } ~ + db 3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0 +endg + +fat_name_is_legal: +; in: esi->(long) name +; out: CF set <=> legal +; destroys eax + push esi + xor eax, eax +@@: + lodsb + test al, al + jz .done + cmp al, 80h + jae .big + test [fat_legal_chars+eax], 1 + jnz @b +.err: + pop esi + clc + ret +.big: +; 0x80-0xAF, 0xE0-0xEF + cmp al, 0xB0 + jb @b + cmp al, 0xE0 + jb .err + cmp al, 0xF0 + jb @b + jmp .err +.done: + sub esi, [esp] + cmp esi, 257 + pop esi + ret + +fat_next_short_name: +; in: edi->8+3 name +; out: name corrected +; CF=1 <=> error + pushad + mov ecx, 8 + mov al, '~' + std + push edi + add edi, 7 + repnz scasb + pop edi + cld + jz .tilde +; tilde is not found, insert "~1" at end + add edi, 6 + cmp word [edi], ' ' + jnz .insert_tilde +@@: + dec edi + cmp byte [edi], ' ' + jz @b + inc edi +.insert_tilde: + mov word [edi], '~1' + popad + clc + ret +.tilde: + push edi + add edi, 7 + xor ecx, ecx +@@: +; after tilde may be only digits and trailing spaces + cmp byte [edi], '~' + jz .break + cmp byte [edi], ' ' + jz .space + cmp byte [edi], '9' + jnz .found + dec edi + jmp @b +.space: + dec edi + inc ecx + jmp @b +.found: + inc byte [edi] + add dword [esp], 8 + jmp .zerorest +.break: + jecxz .noplace + inc edi + mov al, '1' +@@: + xchg al, [edi] + inc edi + cmp al, ' ' + mov al, '0' + jnz @b +.succ: + pop edi + popad + clc + ret +.noplace: + dec edi + cmp edi, [esp] + jz .err + add dword [esp], 8 + mov word [edi], '~1' + inc edi + inc edi +@@: + mov byte [edi], '0' +.zerorest: + inc edi + cmp edi, [esp] + jb @b + pop edi + popad + ;clc ; automatically + ret +.err: + pop edi + popad + stc + ret + +fat_gen_short_name: +; in: esi->long name +; edi->buffer (8+3=11 chars) +; out: buffer filled + pushad + mov eax, ' ' + push edi + stosd + stosd + stosd + pop edi + xor eax, eax + movi ebx, 8 + lea ecx, [edi+8] +.loop: + lodsb + test al, al + jz .done + call char_toupper + cmp al, ' ' + jz .space + cmp al, 80h + ja .big + test [fat_legal_chars+eax], 2 + jnz .symbol +.inv_symbol: + mov al, '_' + or bh, 1 +.symbol: + cmp al, '.' + jz .dot +.normal_symbol: + dec bl + jns .store + mov bl, 0 +.space: + or bh, 1 + jmp .loop +.store: + stosb + jmp .loop +.big: + cmp al, 0xB0 + jb .normal_symbol + cmp al, 0xE0 + jb .inv_symbol + cmp al, 0xF0 + jb .normal_symbol + jmp .inv_symbol +.dot: + test bh, 2 + jz .firstdot + pop ebx + add ebx, edi + sub ebx, ecx + push ebx + cmp ebx, ecx + jb @f + pop ebx + push ecx +@@: + cmp edi, ecx + jbe .skip +@@: + dec edi + mov al, [edi] + dec ebx + mov [ebx], al + mov byte [edi], ' ' + cmp edi, ecx + ja @b +.skip: + mov bh, 3 + jmp @f +.firstdot: + cmp bl, 8 + jz .space + push edi + or bh, 2 +@@: + mov edi, ecx + mov bl, 3 + jmp .loop +.done: + test bh, 2 + jz @f + pop edi +@@: + lea edi, [ecx-8] + test bh, 1 + jz @f + call fat_next_short_name +@@: + popad + ret + +fat12_free_space: +;--------------------------------------------- +; +; returns free space in edi +; rewr.by Mihasik +;--------------------------------------------- + + push eax ebx ecx + + mov edi, [ebp+FAT.fat12_unpacked_ptr];start of FAT + xor ax, ax;Free cluster=0x0000 in FAT + xor ebx, ebx;counter + mov ecx, [ebp+FAT.LAST_CLUSTER] + inc ecx + cld + rdfs1: + repne scasw + jnz rdfs2 ;if last cluster not 0 + inc ebx + test ecx, ecx + jnz rdfs1 + rdfs2: + shl ebx, 9;free clusters*512 + mov edi, ebx + + pop ecx ebx eax + ret + + + set_FAT: ;-------------------------------- ; input : EAX = cluster @@ -291,6 +753,8 @@ set_FAT: jb sfc_error cmp eax, [ebp+FAT.LAST_CLUSTER] ja sfc_error + cmp [ebp+FAT.fs_type], 12 + je set_FAT12 cmp [ebp+FAT.fs_type], 16 je sfc_1 add eax, eax @@ -300,7 +764,7 @@ set_FAT: and esi, eax ; esi = position in fat sector shr eax, 9 ; eax = fat sector add eax, [ebp+FAT.FAT_START] - lea ebx, [ebp+FAT.fat_cache] + mov ebx, [ebp+FAT.fat_cache_ptr] cmp eax, [ebp+FAT.fat_in_cache]; is fat sector already in memory? je sfc_in_cache ; yes @@ -349,6 +813,15 @@ set_FAT: stc jmp sfc_return + set_FAT12: + test edx, 0xF000 + jnz sfc_error + mov ebx, [ebp+FAT.fat12_unpacked_ptr] + xchg [ebx+eax*2], dx + mov [ebp+FAT.fat_change], 1 + pop esi ebx eax + clc + ret get_FAT: ;-------------------------------- @@ -359,6 +832,9 @@ get_FAT: ; out: CF set <=> error push ebx esi + cmp [ebp+FAT.fs_type], 12 + je get_FAT12 + cmp [ebp+FAT.fs_type], 16 je gfc_1 add eax, eax @@ -368,7 +844,7 @@ get_FAT: and esi, eax ; esi = position in fat sector shr eax, 9 ; eax = fat sector add eax, [ebp+FAT.FAT_START] - lea ebx, [ebp+FAT.fat_cache] + mov ebx, [ebp+FAT.fat_cache_ptr] cmp eax, [ebp+FAT.fat_in_cache]; is fat sector already in memory? je gfc_in_cache @@ -394,6 +870,13 @@ get_FAT: stc jmp gfc_return +get_FAT12: + mov ebx, [ebp+FAT.fat12_unpacked_ptr] + movzx eax, word [ebx+eax*2] + pop esi ebx + clc + ret + get_free_FAT: ;----------------------------------------------------------- @@ -403,8 +886,10 @@ get_free_FAT: ;----------------------------------------------------------- push ecx mov ecx, [ebp+FAT.LAST_CLUSTER]; counter for full disk - sub ecx, 2 mov eax, [ebp+FAT.fatStartScan] + cmp [ebp+FAT.fs_type], 12 + jz get_free_FAT12 + dec ecx cmp eax, 2 jb gff_reset @@ -424,7 +909,7 @@ get_free_FAT: je gff_found ; yes inc eax ; next cluster dec ecx ; is all checked? - jns gff_test ; no + jnz gff_test ; no gff_not_found: pop ecx ; yes. disk is full @@ -442,6 +927,41 @@ get_free_FAT: clc ret +get_free_FAT12: + push edx edi + mov edi, [ebp+FAT.fat12_unpacked_ptr] + cmp eax, 2 + jb .reset + cmp eax, ecx + jbe @f +.reset: + mov eax, 2 +@@: + mov edx, eax + lea edi, [edi+eax*2] + sub ecx, eax + inc ecx + xor eax, eax + repnz scasw + jz .found + cmp edx, 2 + jz .notfound + mov edi, [ebp+FAT.fat12_unpacked_ptr] + lea ecx, [edx-2] + repnz scasw + jnz .notfound +.found: + sub edi, [ebp+FAT.fat12_unpacked_ptr] + shr edi, 1 + mov [ebp+FAT.fatStartScan], edi + lea eax, [edi-1] + pop edi edx ecx + ret +.notfound: + pop edi edx ecx + stc + ret + write_fat_sector: ;----------------------------------------------------------- @@ -453,7 +973,7 @@ write_fat_sector: mov eax, [ebp+FAT.fat_in_cache] cmp eax, -1 jz write_fat_not_used - lea ebx, [ebp+FAT.fat_cache] + mov ebx, [ebp+FAT.fat_cache_ptr] mov ecx, [ebp+FAT.NUMBER_OF_FATS] write_next_fat: @@ -683,14 +1203,20 @@ get_hd_info: end if update_disk: + cmp [ebp+FAT.fat_change], 0 ; is fat changed? + je upd_no_change + cmp [ebp+FAT.fs_type], 12 + jz .fat12 ;----------------------------------------------------------- ; write changed fat and cache to disk ;----------------------------------------------------------- - cmp [ebp+FAT.fat_change], 0 ; is fat changed? - je upd_no_change call write_fat_sector jc update_disk_acces_denied + jmp upd_no_change +.fat12: + call restorefatchain + mov [ebp+FAT.fat_change], 0 upd_no_change: @@ -709,6 +1235,484 @@ fat_unlock: jmp mutex_unlock ; \begin{diamond} +uni2ansi_str: +; convert UNICODE zero-terminated string to ASCII-string (codepage 866) +; in: esi->source, edi->buffer (may be esi=edi) +; destroys: eax,esi,edi + lodsw + test ax, ax + jz .done + cmp ax, 0x80 + jb .ascii + cmp ax, 0x401 + jz .yo1 + cmp ax, 0x451 + jz .yo2 + cmp ax, 0x410 + jb .unk + cmp ax, 0x440 + jb .rus1 + cmp ax, 0x450 + jb .rus2 +.unk: + mov al, '_' + jmp .doit +.yo1: + mov al, 0xF0 ; 'Ё' + jmp .doit +.yo2: + mov al, 0xF1 ; 'ё' + jmp .doit +.rus1: +; 0x410-0x43F -> 0x80-0xAF + add al, 0x70 + jmp .doit +.rus2: +; 0x440-0x44F -> 0xE0-0xEF + add al, 0xA0 +.ascii: +.doit: + stosb + jmp uni2ansi_str +.done: + mov byte [edi], 0 + ret + +ansi2uni_char: +; convert ANSI character in al to UNICODE character in ax, using cp866 encoding + mov ah, 0 +; 0x00-0x7F - trivial map + cmp al, 0x80 + jb .ret +; 0x80-0xAF -> 0x410-0x43F + cmp al, 0xB0 + jae @f + add ax, 0x410-0x80 +.ret: + ret +@@: +; 0xE0-0xEF -> 0x440-0x44F + cmp al, 0xE0 + jb .unk + cmp al, 0xF0 + jae @f + add ax, 0x440-0xE0 + ret +; 0xF0 -> 0x401 +; 0xF1 -> 0x451 +@@: + cmp al, 0xF0 ; 'Ё' + jz .yo1 + cmp al, 0xF1 ; 'ё' + jz .yo2 +.unk: + mov al, '_' ; ah=0 + ret +.yo1: + mov ax, 0x401 + ret +.yo2: + mov ax, 0x451 + ret + +char_toupper: +; convert character to uppercase, using cp866 encoding +; in: al=symbol +; out: al=converted symbol + cmp al, 'a' + jb .ret + cmp al, 'z' + jbe .az + cmp al, 0xF1 ; 'ё' + jz .yo1 + cmp al, 0xA0 ; 'а' + jb .ret + cmp al, 0xE0 ; 'р' + jb .rus1 + cmp al, 0xEF ; 'я' + ja .ret +; 0xE0-0xEF -> 0x90-0x9F + sub al, 0xE0-0x90 +.ret: + ret +.rus1: +; 0xA0-0xAF -> 0x80-0x8F +.az: + and al, not 0x20 + ret +.yo1: +; 0xF1 -> 0xF0 + dec ax + ret + +fat_get_name: +; in: edi->FAT entry +; out: CF=1 - no valid entry +; else CF=0 and ebp->ASCIIZ-name +; (maximum length of filename is 255 (wide) symbols without trailing 0, +; but implementation requires buffer 261 words) +; destroys eax + cmp byte [edi], 0 + jz .no + cmp byte [edi], 0xE5 + jnz @f +.no: + stc + ret +@@: + cmp byte [edi+11], 0xF + jz .longname + test byte [edi+11], 8 + jnz .no + push ecx + push edi ebp + test byte [ebp-4], 1 + jnz .unicode_short + + mov eax, [edi] + mov ecx, [edi+4] + mov [ebp], eax + mov [ebp+4], ecx + + mov ecx, 8 +@@: + cmp byte [ebp+ecx-1], ' ' + loope @b + + mov eax, [edi+8] + cmp al, ' ' + je .done + shl eax, 8 + mov al, '.' + + lea ebp, [ebp+ecx+1] + mov [ebp], eax + mov ecx, 3 +@@: + rol eax, 8 + cmp al, ' ' + jne .done + loop @b + dec ebp +.done: + and byte [ebp+ecx+1], 0 ; CF=0 + pop ebp edi ecx + ret +.unicode_short: + mov ecx, 8 + push ecx +@@: + mov al, [edi] + inc edi + call ansi2uni_char + mov [ebp], ax + inc ebp + inc ebp + loop @b + pop ecx +@@: + cmp word [ebp-2], ' ' + jnz @f + dec ebp + dec ebp + loop @b +@@: + mov word [ebp], '.' + inc ebp + inc ebp + mov ecx, 3 + push ecx +@@: + mov al, [edi] + inc edi + call ansi2uni_char + mov [ebp], ax + inc ebp + inc ebp + loop @b + pop ecx +@@: + cmp word [ebp-2], ' ' + jnz @f + dec ebp + dec ebp + loop @b + dec ebp + dec ebp +@@: + and word [ebp], 0 ; CF=0 + pop ebp edi ecx + ret +.longname: +; LFN + mov al, byte [edi] + and eax, 0x3F + dec eax + cmp al, 20 + jae .no ; ignore invalid entries + mov word [ebp+260*2], 0 ; force null-terminating for orphans + imul eax, 13*2 + add ebp, eax + test byte [edi], 0x40 + jz @f + mov word [ebp+13*2], 0 +@@: + push eax +; now copy name from edi to ebp ... + mov eax, [edi+1] + mov [ebp], eax ; symbols 1,2 + mov eax, [edi+5] + mov [ebp+4], eax ; 3,4 + mov eax, [edi+9] + mov [ebp+8], ax ; 5 + mov eax, [edi+14] + mov [ebp+10], eax ; 6,7 + mov eax, [edi+18] + mov [ebp+14], eax ; 8,9 + mov eax, [edi+22] + mov [ebp+18], eax ; 10,11 + mov eax, [edi+28] + mov [ebp+22], eax ; 12,13 +; ... done + pop eax + sub ebp, eax + test eax, eax + jz @f +; if this is not first entry, more processing required + stc + ret +@@: +; if this is first entry: + test byte [ebp-4], 1 + jnz .ret +; buffer at ebp contains UNICODE name, convert it to ANSI + push esi edi + mov esi, ebp + mov edi, ebp + call uni2ansi_str + pop edi esi +.ret: + clc + ret + +fat_compare_name: +; compares ASCIIZ-names, case-insensitive (cp866 encoding) +; in: esi->name, ebp->name +; out: if names match: ZF=1 and esi->next component of name +; else: ZF=0, esi is not changed +; destroys eax + push ebp esi +.loop: + mov al, [ebp] + inc ebp + call char_toupper + push eax + lodsb + call char_toupper + cmp al, [esp] + jnz .done + pop eax + test al, al + jnz .loop + dec esi + pop eax + pop ebp + xor eax, eax ; set ZF flag + ret +.done: + cmp al, '/' + jnz @f + cmp byte [esp], 0 + jnz @f + mov [esp+4], esi +@@: + pop eax + pop esi ebp + ret + +fat_find_lfn: +; in: esi->name +; [esp+4] = next +; [esp+8] = first +; [esp+C]... - possibly parameters for first and next +; out: CF=1 - file not found, eax=error code +; else CF=0, esi->next name component, edi->direntry + pusha + lea eax, [esp+0Ch+20h] + call dword [eax-4] + jc .reterr + sub esp, 262*2 ; reserve place for LFN + push 0 ; for fat_get_name: read ASCII name +.l1: + lea ebp, [esp+4] + call fat_get_name + jc .l2 + call fat_compare_name + jz .found +.l2: + mov ebp, [esp+8+262*2+4] + lea eax, [esp+0Ch+20h+262*2+4] + call dword [eax-8] + jnc .l1 + add esp, 262*2+4 +.reterr: + mov [esp+28], eax + stc + popa + ret +.found: + add esp, 262*2+4 + mov ebp, [esp+8] +; if this is LFN entry, advance to true entry + cmp byte [edi+11], 0xF + jnz @f + lea eax, [esp+0Ch+20h] + call dword [eax-8] + jc .reterr +@@: + add esp, 8 ; CF=0 + push esi + push edi + popa + ret + +fat_time_to_bdfe: +; in: eax=FAT time +; out: eax=BDFE time + push ecx edx + mov ecx, eax + mov edx, eax + shr eax, 11 + shl eax, 16 ; hours + and edx, 0x1F + add edx, edx + mov al, dl ; seconds + shr ecx, 5 + and ecx, 0x3F + mov ah, cl ; minutes + pop edx ecx + ret + +fat_date_to_bdfe: + push ecx edx + mov ecx, eax + mov edx, eax + shr eax, 9 + add ax, 1980 + shl eax, 16 ; year + and edx, 0x1F + mov al, dl ; day + shr ecx, 5 + and ecx, 0xF + mov ah, cl ; month + pop edx ecx + ret + +bdfe_to_fat_time: + push edx + mov edx, eax + shr eax, 16 + and dh, 0x3F + shl eax, 6 + or al, dh + shr dl, 1 + and dl, 0x1F + shl eax, 5 + or al, dl + pop edx + ret + +bdfe_to_fat_date: + push edx + mov edx, eax + shr eax, 16 + sub ax, 1980 + and dh, 0xF + shl eax, 4 + or al, dh + and dl, 0x1F + shl eax, 5 + or al, dl + pop edx + ret + +fat_entry_to_bdfe: +; convert FAT entry at edi to BDFE (block of data of folder entry) at esi, advance esi +; destroys eax + mov eax, [ebp-4] + mov [esi+4], eax ; ASCII/UNICODE name +fat_entry_to_bdfe2: + movzx eax, byte [edi+11] + mov [esi], eax ; attributes + movzx eax, word [edi+14] + call fat_time_to_bdfe + mov [esi+8], eax ; creation time + movzx eax, word [edi+16] + call fat_date_to_bdfe + mov [esi+12], eax ; creation date + and dword [esi+16], 0 ; last access time is not supported on FAT + movzx eax, word [edi+18] + call fat_date_to_bdfe + mov [esi+20], eax ; last access date + movzx eax, word [edi+22] + call fat_time_to_bdfe + mov [esi+24], eax ; last write time + movzx eax, word [edi+24] + call fat_date_to_bdfe + mov [esi+28], eax ; last write date + mov eax, [edi+28] + mov [esi+32], eax ; file size (low dword) + xor eax, eax + mov [esi+36], eax ; file size (high dword) + test ebp, ebp + jz .ret + push ecx edi + lea edi, [esi+40] + mov esi, ebp + test byte [esi-4], 1 + jz .ansi + mov ecx, 260/2 + rep movsd + mov [edi-2], ax +@@: + mov esi, edi + pop edi ecx +.ret: + ret +.ansi: + mov ecx, 264/4 + rep movsd + mov [edi-1], al + jmp @b + +bdfe_to_fat_entry: +; convert BDFE at edx to FAT entry at edi +; destroys eax +; attributes byte + test byte [edi+11], 8 ; volume label? + jnz @f + mov al, [edx] + and al, 0x27 + and byte [edi+11], 0x10 + or byte [edi+11], al +@@: + mov eax, [edx+8] + call bdfe_to_fat_time + mov [edi+14], ax ; creation time + mov eax, [edx+12] + call bdfe_to_fat_date + mov [edi+16], ax ; creation date + mov eax, [edx+20] + call bdfe_to_fat_date + mov [edi+18], ax ; last access date + mov eax, [edx+24] + call bdfe_to_fat_time + mov [edi+22], ax ; last write time + mov eax, [edx+28] + call bdfe_to_fat_date + mov [edi+24], ax ; last write date + ret + hd_find_lfn: ; in: ebp -> FAT structure ; in: esi+[esp+4] -> name @@ -718,12 +1722,14 @@ hd_find_lfn: push esi edi push 0 push 0 - push fat16_root_first - push fat16_root_next + push fat1x_root_first + push fat1x_root_next mov eax, [ebp+FAT.ROOT_CLUSTER] cmp [ebp+FAT.fs_type], 32 jz .fat32 .loop: + and [ebp+FAT.longname_sec1], 0 + and [ebp+FAT.longname_sec2], 0 call fat_find_lfn jc .notfound cmp byte [esi], 0 @@ -766,7 +1772,7 @@ hd_find_lfn: ret 4 ;---------------------------------------------------------------- -; fat_Read - FAT16/32 implementation of reading a file +; fat_Read - FAT implementation of reading a file ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -905,7 +1911,7 @@ fat_Read: jmp .reteof ;---------------------------------------------------------------- -; fat_ReadFolder - FAT16/32 implementation of reading a folder +; fat_ReadFolder - FAT implementation of reading a folder ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -1080,15 +2086,15 @@ fat_ReadFolder: pop esi edi ret -fat16_root_next: +fat1x_root_next: push ecx lea ecx, [ebp+FAT.buffer+0x200-0x20] cmp edi, ecx - jae fat16_root_next_sector + jae fat1x_root_next_sector pop ecx add edi, 0x20 ret ; CF=0 -fat16_root_next_sector: +fat1x_root_next_sector: ; read next sector push [ebp+FAT.longname_sec2] pop [ebp+FAT.longname_sec1] @@ -1101,11 +2107,11 @@ fat16_root_next_sector: mov [eax+4], ecx cmp ecx, [ebp+FAT.ROOT_SECTORS] pop ecx - jb fat16_root_first + jb fat1x_root_first mov eax, ERROR_FILE_NOT_FOUND stc ret -fat16_root_first: +fat1x_root_first: mov eax, [eax+4] add eax, [ebp+FAT.ROOT_START] push ebx @@ -1124,12 +2130,12 @@ fat16_root_first: mov eax, ERROR_FILE_NOT_FOUND stc ret -fat16_root_begin_write: +fat1x_root_begin_write: push edi eax - call fat16_root_first + call fat1x_root_first pop eax edi ret -fat16_root_end_write: +fat1x_root_end_write: pusha mov eax, [eax+4] add eax, [ebp+FAT.ROOT_START] @@ -1137,7 +2143,7 @@ fat16_root_end_write: call fs_write32_sys popa ret -fat16_root_next_write: +fat1x_root_next_write: push ecx lea ecx, [ebp+FAT.buffer+0x200] cmp edi, ecx @@ -1145,9 +2151,9 @@ fat16_root_next_write: pop ecx ret @@: - call fat16_root_end_write - jmp fat16_root_next_sector -fat16_root_extend_dir: + call fat1x_root_end_write + jmp fat1x_root_next_sector +fat1x_root_extend_dir: stc ret @@ -1308,7 +2314,7 @@ fshrad: ret ;---------------------------------------------------------------- -; fat_CreateFolder - FAT16/32 implementation of creating a folder +; fat_CreateFolder - FAT implementation of creating a folder ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -1319,7 +2325,7 @@ fat_CreateFolder: jmp fat_Rewrite.common ;---------------------------------------------------------------- -; fat_Rewrite - FAT16/32 implementation of creating a new file +; fat_Rewrite - FAT implementation of creating a new file ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -1360,14 +2366,14 @@ fat_Rewrite: jz .pushnotroot xor edx, edx push edx - push fat16_root_extend_dir - push fat16_root_end_write - push fat16_root_next_write - push fat16_root_begin_write + push fat1x_root_extend_dir + push fat1x_root_end_write + push fat1x_root_next_write + push fat1x_root_begin_write push edx push edx - push fat16_root_first - push fat16_root_next + push fat1x_root_first + push fat1x_root_next jmp .common1 .hasebp: mov eax, ERROR_ACCESS_DENIED @@ -1658,17 +2664,17 @@ fat_Rewrite: add esi, ecx stosb mov cl, 5 - call fs_RamdiskRewrite.read_symbols + call fat_read_symbols mov ax, 0xF stosw mov al, [esp+4] stosb mov cl, 6 - call fs_RamdiskRewrite.read_symbols + call fat_read_symbols xor eax, eax stosw mov cl, 2 - call fs_RamdiskRewrite.read_symbols + call fat_read_symbols pop ecx lea eax, [esp+8+8+12+8] call dword [eax+12] ; next write @@ -1866,6 +2872,25 @@ fat_Rewrite: mov [edi-32+20], cx jmp .writedircont +fat_read_symbol: + or ax, -1 + test esi, esi + jz .retFFFF + lodsb + test al, al + jnz ansi2uni_char + xor eax, eax + xor esi, esi +.retFFFF: + ret + +fat_read_symbols: + call fat_read_symbol + stosw + loop fat_read_symbols + ret + + fat_Write.access_denied: push ERROR_ACCESS_DENIED fat_Write.ret0: @@ -1878,7 +2903,7 @@ fat_Write.ret11: jmp fat_Write.ret0 ;---------------------------------------------------------------- -; fat_Write - FAT16/32 implementation of writing to file +; fat_Write - FAT implementation of writing to file ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -2204,8 +3229,17 @@ hd_extend_file: stc ret +fat_update_datetime: + call get_time_for_file + mov [edi+22], ax ; last write time + call get_date_for_file + mov [edi+24], ax ; last write date + mov [edi+18], ax ; last access date + ret + + ;---------------------------------------------------------------- -; fat_SetFileEnd - FAT16/32 implementation of setting end-of-file +; fat_SetFileEnd - FAT implementation of setting end-of-file ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -2445,7 +3479,7 @@ fat_SetFileEnd: ret ;---------------------------------------------------------------- -; fat_GetFileInfo - FAT16/32 implementation of getting file info +; fat_GetFileInfo - FAT implementation of getting file info ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -2479,7 +3513,7 @@ fat_GetFileInfo: ret ;---------------------------------------------------------------- -; fat_SetFileInfo - FAT16/32 implementation of setting file info +; fat_SetFileInfo - FAT implementation of setting file info ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 @@ -2514,7 +3548,7 @@ fat_SetFileInfo: ret ;---------------------------------------------------------------- -; fat_Delete - FAT16/32 implementation of deleting a file/folder +; fat_Delete - FAT implementation of deleting a file/folder ; in: ebp = pointer to FAT structure ; in: esi+[esp+4] = name ; in: ebx = pointer to parameters from sysfunc 70 diff --git a/kernel/trunk/fs/fat12.inc b/kernel/trunk/fs/fat12.inc deleted file mode 100644 index f4bcd5bc20..0000000000 --- a/kernel/trunk/fs/fat12.inc +++ /dev/null @@ -1,2268 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;; FAT12.INC ;; -;; (C) 2005 Mario79, License: GPL ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -$Revision$ - - -n_sector dd 0 ; temporary save for sector value -flp_status dd 0 -clust_tmp_flp dd 0 ; used by analyze_directory and analyze_directory_to_write -path_pointer_flp dd 0 -pointer_file_name_flp dd 0 -save_root_flag db 0 -save_flag db 0 -root_read db 0 ; 0-necessary to load root, 1-not to load root -flp_fat db 0 ; 0-necessary to load fat, 1-not to load fat -flp_number db 0 ; 1- Floppy A, 2-Floppy B -old_track db 0 ; old value track -flp_label rb 15 ; Label and ID of inserted floppy disk - -reserve_flp: - - cli - cmp [flp_status], 0 - je reserve_flp_ok - - sti - call change_task - jmp reserve_flp - - reserve_flp_ok: - - push eax - mov eax, [CURRENT_TASK] - shl eax, 5 - mov eax, [eax+CURRENT_TASK+TASKDATA.pid] - mov [flp_status], eax - pop eax - sti - ret - - -floppy_fileread: -;---------------------------------------------------------------- -; -; fileread - sys floppy -; -; eax points to filename 11 chars - for root directory -; ebx first wanted block ; 1+ ; if 0 then set to 1 -; ecx number of blocks to read ; 1+ ; if 0 then set to 1 -; edx mem location to return data -; esi length of filename 12*X -; edi pointer to path /fd/1/...... - for all files in nested directories -; -; ret ebx = size or 0xffffffff file not found -; eax = 0 ok read or other = errormsg -; 10 = access denied -;-------------------------------------------------------------- - - mov [save_flag], 0 - mov [path_pointer_flp], edi - test esi, esi ; return ramdisk root - jnz fr_noroot_1 - cmp ebx, 224/16 - jbe fr_do_1 - mov eax, 5 - xor ebx, ebx - mov [flp_status], ebx - ret - -fr_do_1: - push ebx ecx edx - call read_flp_root - pop edx ecx ebx - cmp [FDC_Status], 0 - jne fdc_status_error_1 - mov edi, edx - dec ebx - shl ebx, 9 - mov esi, FLOPPY_BUFF - add esi, ebx - shl ecx, 9 - cld - rep movsb - xor eax, eax - xor ebx, ebx -; mov eax,0 ; ok read -; mov ebx,0 - mov [flp_status], eax - ret -fdc_status_error_1: - xor eax, eax - mov [flp_status], eax - mov eax, 10 - or ebx, -1 - ret - -fr_noroot_1: - sub esp, 32 - call expand_filename -frfloppy_1: - test ebx, ebx - jnz frfl5_1 - mov ebx, 1 -frfl5_1: - test ecx, ecx - jnz frfl6_1 - mov ecx, 1 -frfl6_1: - dec ebx - push eax - push eax ebx ecx edx esi edi - call read_flp_fat - cmp [FDC_Status], 0 - jne fdc_status_error_3_1 - mov [FDD_Track], 0; Цилиндр - mov [FDD_Head], 1; Сторона - mov [FDD_Sector], 2; Сектор - call SeekTrack - mov dh, 14 -l.20_1: - call ReadSectWithRetr - cmp [FDC_Status], 0 - jne fdc_status_error_3_1 - mov dl, 16 - mov edi, FDD_BUFF - inc [FDD_Sector] -l.21_1: - mov esi, eax ;Name of file we want - mov ecx, 11 - cld - rep cmpsb ;Found the file? - je fifound_1 ;Yes - add ecx, 21 - add edi, ecx ;Advance to next entry - dec dl - test dl, dl - jnz l.21_1 - dec dh - test dh, dh - jnz l.20_1 -fdc_status_error_3: - mov eax, 5 ; file not found ? - or ebx, -1 - add esp, 32+28 - mov [flp_status], 0 - ret -fdc_status_error_3_2: - cmp [FDC_Status], 0 - je fdc_status_error_3 -fdc_status_error_3_1: - add esp, 32+28 - jmp fdc_status_error_1 - -fifound_1: - mov eax, [path_pointer_flp] - cmp [eax+36], byte 0 - je fifound_2 - add edi, 0xf - mov eax, [edi] - and eax, 65535 - mov ebx, [path_pointer_flp] - add ebx, 36 - call get_cluster_of_a_path_flp - jc fdc_status_error_3_2 - mov ebx, [ebx-11+28] ;file size - mov [esp+20], ebx - mov [esp+24], ebx - jmp fifound_3 -fifound_2: - mov ebx, [edi-11+28] ;file size - mov [esp+20], ebx - mov [esp+24], ebx - add edi, 0xf - mov eax, [edi] -fifound_3: - and eax, 65535 - mov [n_sector], eax ;eax=cluster -frnew_1: - add eax, 31 ;bootsector+2*fat+filenames - cmp [esp+16], dword 0; wanted cluster ? - jne frfl7_1 - call read_chs_sector - cmp [FDC_Status], 0 - jne fdc_status_error_5 - mov edi, [esp+8] - call give_back_application_data_1 - add [esp+8], dword 512 - dec dword [esp+12] ; last wanted cluster ? - cmp [esp+12], dword 0 - je frnoread_1 - jmp frfl8_1 -frfl7_1: - dec dword [esp+16] -frfl8_1: - mov edi, [n_sector] - shl edi, 1 ;find next cluster from FAT - add edi, FLOPPY_FAT - mov eax, [edi] - and eax, 4095 - mov edi, eax - mov [n_sector], edi - cmp edi, 4095 ;eof - cluster - jz frnoread2_1 - cmp [esp+24], dword 512;eof - size - jb frnoread_1 - sub [esp+24], dword 512 - jmp frnew_1 - -read_chs_sector: - call calculate_chs - call ReadSectWithRetr - ret - -frnoread2_1: - cmp [esp+16], dword 0; eof without read ? - je frnoread_1 - - pop edi esi edx ecx - add esp, 4 - pop ebx; ebx <- eax : size of file - add esp, 36 - mov eax, 6; end of file - mov [flp_status], 0 - ret - -frnoread_1: - pop edi esi edx ecx - add esp, 4 - pop ebx; ebx <- eax : size of file - add esp, 36 - xor eax, eax - mov [flp_status], eax - ret - -fdc_status_error_5: - pop edi esi edx ecx - add esp, 4 - pop ebx; ebx <- eax : size of file - add esp, 36 - jmp fdc_status_error_1 - -read_flp_root: - pusha - call check_label - cmp [FDC_Status], 0 - jne unnecessary_root_read - cmp [root_read], 1 - je unnecessary_root_read - mov [FDD_Track], 0; Цилиндр - mov [FDD_Head], 1; Сторона - mov [FDD_Sector], 2; Сектор - mov edi, FLOPPY_BUFF - call SeekTrack -read_flp_root_1: - call ReadSectWithRetr - cmp [FDC_Status], 0 - jne unnecessary_root_read - push edi - call give_back_application_data_1 - pop edi - add edi, 512 - inc [FDD_Sector] - cmp [FDD_Sector], 16 - jne read_flp_root_1 - mov [root_read], 1 -unnecessary_root_read: - popa - ret - - -read_flp_fat: - pusha - call check_label - cmp [FDC_Status], 0 - jne unnecessary_flp_fat - cmp [flp_fat], 1 - je unnecessary_flp_fat - mov [FDD_Track], 0; Цилиндр - mov [FDD_Head], 0; Сторона - mov [FDD_Sector], 2; Сектор - mov edi, FLOPPY_BUFF - call SeekTrack -read_flp_fat_1: - call ReadSectWithRetr - cmp [FDC_Status], 0 - jne unnecessary_flp_fat - push edi - call give_back_application_data_1 - pop edi - add edi, 512 - inc [FDD_Sector] - cmp [FDD_Sector], 19 - jne read_flp_fat_1 - mov [FDD_Sector], 1 - mov [FDD_Head], 1 - call ReadSectWithRetr - cmp [FDC_Status], 0 - jne unnecessary_flp_fat - call give_back_application_data_1 - call calculatefatchain_flp - mov [root_read], 0 - mov [flp_fat], 1 -unnecessary_flp_fat: - popa - ret - -calculatefatchain_flp: - pushad - - mov esi, FLOPPY_BUFF - mov edi, FLOPPY_FAT - - fcnew_1: - mov eax, dword [esi] - mov ebx, dword [esi+4] - mov ecx, dword [esi+8] - mov edx, ecx - shr edx, 4;8 ok - shr dx, 4;7 ok - xor ch, ch - shld ecx, ebx, 20;6 ok - shr cx, 4;5 ok - shld ebx, eax, 12 - and ebx, 0x0fffffff;4 ok - shr bx, 4;3 ok - shl eax, 4 - and eax, 0x0fffffff;2 ok - shr ax, 4;1 ok - mov dword [edi], eax - add edi, 4 - mov dword [edi], ebx - add edi, 4 - mov dword [edi], ecx - add edi, 4 - mov dword [edi], edx - add edi, 4 - add esi, 12 - - cmp edi, FLOPPY_FAT+2856*2;2849 clusters - jnz fcnew_1 - - popad - ret - -check_label: - pushad - mov [FDD_Track], 0; Цилиндр - mov [FDD_Head], 0; Сторона - mov [FDD_Sector], 1; Сектор - call FDDMotorON - call RecalibrateFDD - cmp [FDC_Status], 0 - jne fdc_status_error - call SeekTrack - cmp [FDC_Status], 0 - jne fdc_status_error - call ReadSectWithRetr - cmp [FDC_Status], 0 - jne fdc_status_error - mov esi, flp_label - mov edi, FDD_BUFF+39 - mov ecx, 15 - cld - rep cmpsb - je same_label - mov [root_read], 0 - mov [flp_fat], 0 -same_label: - mov esi, FDD_BUFF+39 - mov edi, flp_label - mov ecx, 15 - cld - rep movsb - popad - ret -fdc_status_error: - popad - ret - -save_flp_root: - pusha - call check_label - cmp [FDC_Status], 0 - jne unnecessary_root_save - cmp [root_read], 0 - je unnecessary_root_save - mov [FDD_Track], 0; Цилиндр - mov [FDD_Head], 1; Сторона - mov [FDD_Sector], 2; Сектор - mov esi, FLOPPY_BUFF - call SeekTrack -save_flp_root_1: - push esi - call take_data_from_application_1 - pop esi - add esi, 512 - call WriteSectWithRetr - cmp [FDC_Status], 0 - jne unnecessary_root_save - inc [FDD_Sector] - cmp [FDD_Sector], 16 - jne save_flp_root_1 -unnecessary_root_save: - popa - ret - -save_flp_fat: - pusha - call check_label - cmp [FDC_Status], 0 - jne unnecessary_flp_fat_save - cmp [flp_fat], 0 - je unnecessary_flp_fat_save - call restorefatchain_flp - mov [FDD_Track], 0; Цилиндр - mov [FDD_Head], 0; Сторона - mov [FDD_Sector], 2; Сектор - mov esi, FLOPPY_BUFF - call SeekTrack -save_flp_fat_1: - push esi - call take_data_from_application_1 - pop esi - add esi, 512 - call WriteSectWithRetr - cmp [FDC_Status], 0 - jne unnecessary_flp_fat_save - inc [FDD_Sector] - cmp [FDD_Sector], 19 - jne save_flp_fat_1 - mov [FDD_Sector], 1 - mov [FDD_Head], 1 - call take_data_from_application_1 - call WriteSectWithRetr - cmp [FDC_Status], 0 - jne unnecessary_flp_fat_save - mov [root_read], 0 -unnecessary_flp_fat_save: - popa - ret - - -restorefatchain_flp: ; restore fat chain - pushad - - mov esi, FLOPPY_FAT - mov edi, FLOPPY_BUFF - - fcnew2_1: - mov eax, dword [esi] - mov ebx, dword [esi+4] - shl ax, 4 - shl eax, 4 - shl bx, 4 - shr ebx, 4 - shrd eax, ebx, 8 - shr ebx, 8 - mov dword [edi], eax - add edi, 4 - mov word [edi], bx - add edi, 2 - add esi, 8 - - cmp edi, FLOPPY_BUFF+0x1200;4274 bytes - all used FAT - jb fcnew2_1 - - mov esi, FLOPPY_BUFF ; duplicate fat chain - mov edi, FLOPPY_BUFF+0x1200 - mov ecx, 0x1200/4 - cld - rep movsd - - popad - ret - - -save_chs_sector: - call calculate_chs - call WriteSectWithRetr - ret - -calculate_chs: - mov bl, [FDD_Track] - mov [old_track], bl - mov ebx, 18 - xor edx, edx - div ebx - inc edx - mov [FDD_Sector], dl - xor edx, edx - mov ebx, 2 - div ebx - mov [FDD_Track], al - mov [FDD_Head], 0 - test edx, edx - jz no_head_2 - inc [FDD_Head] -no_head_2: - mov dl, [old_track] - cmp dl, [FDD_Track] - je no_seek_track_1 - call SeekTrack -no_seek_track_1: - ret - - -get_cluster_of_a_path_flp: -;--------------------------------------------------------- -; input : EBX = pointer to a path string -; (example: the path "/files/data/document" become -; "files......data.......document...0" -; '.' = space char -; '0' = char(0) (ASCII=0) !!! ) -; output : if (CARRY=1) -> ERROR in the PATH -; if (CARRY=0) -> EAX=cluster -;--------------------------------------------------------- - - push edx - mov edx, ebx - -search_end_of_path_flp: - cmp [save_flag], 0 - jne search_end_of_path_flp_1 - cmp byte [edx], 0 - je found_end_of_path_flp - jmp search_end_of_path_flp_2 -search_end_of_path_flp_1: - cmp byte [edx+12], 0 - je found_end_of_path_flp -search_end_of_path_flp_2: - inc edx; '/' - call analyze_directory_flp - jc directory_not_found_flp - - mov eax, [ebx+20-2] ; read the HIGH 16bit cluster field - mov ax, [ebx+26] ; read the LOW 16bit cluster field - and eax, 0xfff ;[fatMASK] - add edx, 11 ; 8+3 (name+extension) - jmp search_end_of_path_flp - -found_end_of_path_flp: - inc edx - mov [pointer_file_name_flp], edx - pop edx - clc ; no errors - ret - -directory_not_found_flp: - pop edx - stc ; errors occour - ret - -analyze_directory_flp: -;-------------------------------- -; input : EAX = first cluster of the directory -; EBX = pointer to filename -; output : IF CARRY=0 EAX = sector where th file is found -; EBX = pointer in buffer -; [buffer .. buffer+511] -; ECX,EDX,EDI,EDI not changed -; IF CARRY=1 -;-------------------------------- - push ebx;[esp+16] - push ecx - push edx - push esi - push edi - - -adr56_flp: - mov [clust_tmp_flp], eax - add eax, 31 - pusha - call read_chs_sector - popa - cmp [FDC_Status], 0 - jne not_found_file_analyze_flp - - mov ecx, 512/32 - mov ebx, FDD_BUFF - -adr1_analyze_flp: - mov esi, edx;[esp+16] - mov edi, ebx - cld - push ecx - mov ecx, 11 - rep cmpsb - pop ecx - je found_file_analyze_flp - - add ebx, 32 - loop adr1_analyze_flp - - mov eax, [clust_tmp_flp] - shl eax, 1 ;find next cluster from FAT - add eax, FLOPPY_FAT - mov eax, [eax] - and eax, 4095 - cmp eax, 0x0ff8 - jb adr56_flp -not_found_file_analyze_flp: - pop edi - pop esi - pop edx - pop ecx - add esp, 4 - stc ;file not found - ret - -found_file_analyze_flp: - pop edi - pop esi - pop edx - pop ecx - add esp, 4 - clc ;file found - ret - - -; \begin{diamond} -fat_find_lfn: -; in: esi->name -; [esp+4] = next -; [esp+8] = first -; [esp+C]... - possibly parameters for first and next -; out: CF=1 - file not found, eax=error code -; else CF=0, esi->next name component, edi->direntry - pusha - lea eax, [esp+0Ch+20h] - call dword [eax-4] - jc .reterr - sub esp, 262*2 ; reserve place for LFN - push 0 ; for fat_get_name: read ASCII name -.l1: - lea ebp, [esp+4] - call fat_get_name - jc .l2 - call fat_compare_name - jz .found -.l2: - mov ebp, [esp+8+262*2+4] - lea eax, [esp+0Ch+20h+262*2+4] - call dword [eax-8] - jnc .l1 - add esp, 262*2+4 -.reterr: - mov [esp+28], eax - stc - popa - ret -.found: - add esp, 262*2+4 - mov ebp, [esp+8] -; if this is LFN entry, advance to true entry - cmp byte [edi+11], 0xF - jnz @f - lea eax, [esp+0Ch+20h] - call dword [eax-8] - jc .reterr -@@: - add esp, 8 ; CF=0 - push esi - push edi - popa - ret - -uglobal -; this is for delete support -fd_prev_sector dd ? -fd_prev_prev_sector dd ? -endg - -flp_root_next: - cmp edi, OS_BASE+0xD200-0x20 - jae @f - add edi, 0x20 - ret ; CF=0 -@@: -; read next sector - inc dword [eax] - cmp dword [eax], 14 - jae flp_root_first.readerr - push [fd_prev_sector] - pop [fd_prev_prev_sector] - push eax - mov eax, [eax] - add eax, 19-1 - mov [fd_prev_sector], eax - pop eax -flp_root_first: - mov eax, [eax] - pusha - add eax, 19 - call read_chs_sector - popa - cmp [FDC_Status], 0 - jnz .readerr - mov edi, FDD_BUFF - ret ; CF=0 -.readerr: - stc - ret - -flp_rootmem_first: - mov edi, FLOPPY_BUFF - clc - ret -flp_rootmem_next: - add edi, 0x20 - cmp edi, FLOPPY_BUFF+14*0x200 - cmc -flp_rootmem_next_write: -flp_rootmem_begin_write: -flp_rootmem_end_write: - ret -flp_rootmem_extend_dir: - stc - ret - -flp_notroot_next: - cmp edi, OS_BASE+0xD200-0x20 - jae flp_notroot_next_sector - add edi, 0x20 - ret ; CF=0 -flp_notroot_next_sector: - push ecx - mov ecx, [eax] - push [fd_prev_sector] - pop [fd_prev_prev_sector] - add ecx, 31 - mov [fd_prev_sector], ecx - mov ecx, [(ecx-31)*2+FLOPPY_FAT] - and ecx, 0xFFF - cmp ecx, 2849 - jae flp_notroot_first.err2 - mov [eax], ecx - pop ecx -flp_notroot_first: - mov eax, [eax] - cmp eax, 2 - jb .err - cmp eax, 2849 - jae .err - pusha - add eax, 31 - call read_chs_sector - popa - mov edi, FDD_BUFF - cmp [FDC_Status], 0 - jnz .err - ret ; CF=0 -.err2: - pop ecx -.err: - stc - ret -flp_notroot_begin_write: - pusha - mov eax, [eax] - add eax, 31 - call read_chs_sector - popa - ret -flp_notroot_end_write: - pusha - mov eax, [eax] - add eax, 31 - call save_chs_sector - popa - ret -flp_notroot_next_write: - cmp edi, OS_BASE+0xD200 - jae @f - ret -@@: - call flp_notroot_end_write - jmp flp_notroot_next_sector -flp_notroot_extend_dir: -; find free cluster in FAT - pusha - xor eax, eax - mov edi, FLOPPY_FAT - mov ecx, 2849 - repnz scasw - jnz .notfound - mov word [edi-2], 0xFFF ; mark as last cluster - sub edi, FLOPPY_FAT - shr edi, 1 - dec edi - mov eax, [esp+28] - mov ecx, [eax] - mov [FLOPPY_FAT+ecx*2], di - mov [eax], edi - xor eax, eax - mov edi, FDD_BUFF - mov ecx, 128 - rep stosd - popa - call flp_notroot_end_write - mov edi, FDD_BUFF - clc - ret -.notfound: - popa - stc - ret - -fd_find_lfn: -; in: esi+ebp -> name -; out: CF=1 - file not found -; else CF=0 and edi->direntry, eax=directory cluster (0 for root) - push esi edi - push 0 - push flp_root_first - push flp_root_next -.loop: - call fat_find_lfn - jc .notfound - cmp byte [esi], 0 - jz .found -.continue: - test byte [edi+11], 10h - jz .notfound - movzx eax, word [edi+26] ; cluster - mov [esp+8], eax - mov dword [esp+4], flp_notroot_first - mov dword [esp], flp_notroot_next - jmp .loop -.notfound: - add esp, 12 - pop edi esi - stc - ret -.found: - test ebp, ebp - jz @f - mov esi, ebp - xor ebp, ebp - jmp .continue -@@: - mov eax, [esp+8] - add eax, 31 - cmp dword [esp], flp_root_next - jnz @f - add eax, -31+19 -@@: - add esp, 16 ; CF=0 - pop esi - ret - -;---------------------------------------------------------------- -; -; fs_FloppyRead - LFN variant for reading floppy -; -; esi points to filename -; ebx pointer to 64-bit number = first wanted byte, 0+ -; may be ebx=0 - start from first byte -; ecx number of bytes to read, 0+ -; edx mem location to return data -; -; ret ebx = bytes read or 0xffffffff file not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -fs_FloppyRead: - call read_flp_fat - cmp byte [esi], 0 - jnz @f - or ebx, -1 - mov eax, 10 ; access denied - ret -@@: - push edi - call fd_find_lfn - jnc .found - pop edi - or ebx, -1 - mov eax, 5 ; file not found - ret -.found: - test ebx, ebx - jz .l1 - cmp dword [ebx+4], 0 - jz @f - xor ebx, ebx -.reteof: - mov eax, 6 ; EOF - pop edi - ret -@@: - mov ebx, [ebx] -.l1: - push ecx edx - push 0 - mov eax, [edi+28] - sub eax, ebx - jb .eof - cmp eax, ecx - jae @f - mov ecx, eax - mov byte [esp], 6 ; EOF -@@: - movzx edi, word [edi+26] -.new: - jecxz .done - test edi, edi - jz .eof - cmp edi, 0xFF8 - jae .eof - sub ebx, 512 - jae .skip - lea eax, [edi+31] - pusha - call read_chs_sector - popa - cmp [FDC_Status], 0 - jnz .err - lea eax, [FDD_BUFF+ebx+512] - neg ebx - push ecx - cmp ecx, ebx - jbe @f - mov ecx, ebx -@@: - mov ebx, edx - call memmove - add edx, ecx - sub [esp], ecx - pop ecx - xor ebx, ebx -.skip: - movzx edi, word [edi*2+FLOPPY_FAT] - jmp .new -.done: - mov ebx, edx - pop eax edx ecx edi - sub ebx, edx - ret -.eof: - mov ebx, edx - pop eax edx ecx - jmp .reteof -.err: - mov ebx, edx - pop eax edx ecx edi - sub ebx, edx - mov al, 11 - ret - -;---------------------------------------------------------------- -; -; fs_FloppyReadFolder - LFN variant for reading floppy folders -; -; esi points to filename -; ebx pointer to structure: 32-bit number = first wanted block, 0+ -; & flags (bitfields) -; flags: bit 0: 0=ANSI names, 1=UNICODE names -; ecx number of blocks to read, 0+ -; edx mem location to return data -; -; ret ebx = blocks read or 0xffffffff folder not found -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -fs_FloppyReadFolder: - call read_flp_fat - push edi - cmp byte [esi], 0 - jz .root - call fd_find_lfn - jnc .found - pop edi - or ebx, -1 - mov eax, ERROR_FILE_NOT_FOUND - ret -.found: - test byte [edi+11], 0x10 ; do not allow read files - jnz .found_dir - pop edi - or ebx, -1 - mov eax, ERROR_ACCESS_DENIED - ret -.found_dir: - movzx eax, word [edi+26] - add eax, 31 - push 0 - jmp .doit -.root: - mov eax, 19 - push 14 -.doit: - push ecx ebp - sub esp, 262*2 ; reserve space for LFN - mov ebp, esp - push dword [ebx+4] ; for fat_get_name: read ANSI/UNICODE names - mov ebx, [ebx] -; init header - push eax ecx - mov edi, edx - mov ecx, 32/4 - xor eax, eax - rep stosd - pop ecx eax - mov byte [edx], 1 ; version - mov esi, edi ; esi points to BDFE -.main_loop: - pusha - call read_chs_sector - popa - cmp [FDC_Status], 0 - jnz .error - mov edi, FDD_BUFF - push eax -.l1: - call fat_get_name - jc .l2 - cmp byte [edi+11], 0xF - jnz .do_bdfe - add edi, 0x20 - cmp edi, OS_BASE+0xD200 - jb .do_bdfe - pop eax - inc eax - dec byte [esp+262*2+12] - jz .done - jns @f -; read next sector from FAT - mov eax, [(eax-31-1)*2+FLOPPY_FAT] - and eax, 0xFFF - cmp eax, 0xFF8 - jae .done - add eax, 31 - mov byte [esp+262*2+12], 0 -@@: - pusha - call read_chs_sector - popa - cmp [FDC_Status], 0 - jnz .error - mov edi, FDD_BUFF - push eax -.do_bdfe: - inc dword [edx+8] ; new file found - dec ebx - jns .l2 - dec ecx - js .l2 - inc dword [edx+4] ; new file block copied - call fat_entry_to_bdfe -.l2: - add edi, 0x20 - cmp edi, OS_BASE+0xD200 - jb .l1 - pop eax - inc eax - dec byte [esp+262*2+12] - jz .done - jns @f -; read next sector from FAT - mov eax, [(eax-31-1)*2+FLOPPY_FAT] - and eax, 0xFFF - cmp eax, 0xFF8 - jae .done - add eax, 31 - mov byte [esp+262*2+12], 0 -@@: - jmp .main_loop -.error: - add esp, 262*2+4 - pop ebp ecx edi edi - or ebx, -1 - mov eax, ERROR_FILE_NOT_FOUND - ret -.done: - add esp, 262*2+4 - pop ebp - mov ebx, [edx+4] - xor eax, eax - dec ecx - js @f - mov al, ERROR_END_OF_FILE -@@: - pop ecx edi edi - ret - -;---------------------------------------------------------------- -; -; fs_FloppyRewrite - LFN variant for writing sys floppy -; -; esi points to filename -; ebx ignored (reserved) -; ecx number of bytes to write, 0+ -; edx mem location to data -; -; ret ebx = number of written bytes -; eax = 0 ok read or other = errormsg -; -;-------------------------------------------------------------- -@@: - mov eax, ERROR_ACCESS_DENIED - xor ebx, ebx - ret -fsfrfe2: - popad -fsfrfe: - mov eax, 11 - xor ebx, ebx - ret - -fs_FloppyCreateFolder: - mov al, 1 - jmp fs_FloppyRewrite.common - -fs_FloppyRewrite: - xor eax, eax -.common: - cmp byte [esi], 0 - jz @b - call read_flp_fat - cmp [FDC_Status], 0 - jnz fsfrfe - pushad - xor edi, edi - push esi - test ebp, ebp - jz @f - mov esi, ebp -@@: - lodsb - test al, al - jz @f - cmp al, '/' - jnz @b - lea edi, [esi-1] - jmp @b -@@: - pop esi - test edi, edi - jnz .noroot - test ebp, ebp - jnz .hasebp - call read_flp_root - cmp [FDC_Status], 0 - jnz fsfrfe2 - push flp_rootmem_extend_dir - push flp_rootmem_end_write - push flp_rootmem_next_write - push flp_rootmem_begin_write - xor ebp, ebp - push ebp - push flp_rootmem_first - push flp_rootmem_next - jmp .common1 -.hasebp: - mov eax, ERROR_ACCESS_DENIED - cmp byte [ebp], 0 - jz .ret1 - push ebp - xor ebp, ebp - call fd_find_lfn - pop esi - jc .notfound0 - jmp .common0 -.noroot: - mov eax, ERROR_ACCESS_DENIED - cmp byte [edi+1], 0 - jz .ret1 -; check existence - mov byte [edi], 0 - push edi - call fd_find_lfn - pop esi - mov byte [esi], '/' - jnc @f -.notfound0: - mov eax, ERROR_FILE_NOT_FOUND -.ret1: - mov [esp+28], eax - popad - xor ebx, ebx - ret -@@: - inc esi -.common0: - test byte [edi+11], 0x10 ; must be directory - mov eax, ERROR_ACCESS_DENIED - jz .ret1 - movzx ebp, word [edi+26] ; ebp=cluster - mov eax, ERROR_FAT_TABLE - cmp ebp, 2 - jb .ret1 - cmp ebp, 2849 - jae .ret1 - push flp_notroot_extend_dir - push flp_notroot_end_write - push flp_notroot_next_write - push flp_notroot_begin_write - push ebp - push flp_notroot_first - push flp_notroot_next -.common1: - call fat_find_lfn - jc .notfound -; found - test byte [edi+11], 10h - jz .exists_file -; found directory; if we are creating directory, return OK, -; if we are creating file, say "access denied" - add esp, 28 - popad - test al, al - mov eax, ERROR_ACCESS_DENIED - jz @f - mov al, 0 -@@: - xor ebx, ebx - ret -.exists_file: -; found file; if we are creating directory, return "access denied", -; if we are creating file, delete existing file and continue - cmp byte [esp+28+28], 0 - jz @f - add esp, 28 - popad - mov eax, ERROR_ACCESS_DENIED - xor ebx, ebx - ret -@@: -; delete FAT chain - push edi - xor eax, eax - mov dword [edi+28], eax ; zero size - xchg ax, word [edi+26] ; start cluster - test eax, eax - jz .done1 -@@: - cmp eax, 0xFF8 - jae .done1 - lea edi, [FLOPPY_FAT + eax*2] ; position in FAT - xor eax, eax - xchg ax, [edi] - jmp @b -.done1: - pop edi - call get_time_for_file - mov [edi+22], ax - call get_date_for_file - mov [edi+24], ax - mov [edi+18], ax - or byte [edi+11], 20h ; set 'archive' attribute - jmp .doit -.notfound: -; file is not found; generate short name - call fat_name_is_legal - jc @f - add esp, 28 - popad - mov eax, ERROR_FILE_NOT_FOUND - xor ebx, ebx - ret -@@: - sub esp, 12 - mov edi, esp - call fat_gen_short_name -.test_short_name_loop: - push esi edi ecx - mov esi, edi - lea eax, [esp+12+12+8] - mov [eax], ebp - call dword [eax-4] - jc .found -.test_short_name_entry: - cmp byte [edi+11], 0xF - jz .test_short_name_cont - mov ecx, 11 - push esi edi - repz cmpsb - pop edi esi - jz .short_name_found -.test_short_name_cont: - lea eax, [esp+12+12+8] - call dword [eax-8] - jnc .test_short_name_entry - jmp .found -.short_name_found: - pop ecx edi esi - call fat_next_short_name - jnc .test_short_name_loop -.disk_full: - add esp, 12+28 - popa - mov eax, ERROR_DISK_FULL - xor ebx, ebx - ret -.found: - pop ecx edi esi -; now find space in directory -; we need to save LFN <=> LFN is not equal to short name <=> generated name contains '~' - mov al, '~' - push ecx edi - mov ecx, 8 - repnz scasb - movi eax, 1 ; 1 entry - jnz .notilde -; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total - xor eax, eax -@@: - cmp byte [esi], 0 - jz @f - inc esi - inc eax - jmp @b -@@: - sub esi, eax - add eax, 12+13 - mov ecx, 13 - push edx - cdq - div ecx - pop edx -.notilde: - push -1 - push -1 -; find successive entries in directory - xor ecx, ecx - push eax - lea eax, [esp+12+8+12+8] - mov [eax], ebp - call dword [eax-4] - pop eax - jnc .scan_dir -.fsfrfe3: - add esp, 8+8+12+28 - popad - mov eax, 11 - xor ebx, ebx - ret -.scan_dir: - cmp byte [edi], 0 - jz .free - cmp byte [edi], 0xE5 - jz .free - xor ecx, ecx -.scan_cont: - push eax - lea eax, [esp+12+8+12+8] - call dword [eax-8] - pop eax - jnc .scan_dir - cmp [FDC_Status], 0 - jnz .fsfrfe3 - push eax - lea eax, [esp+12+8+12+8] - call dword [eax+16] ; extend directory - pop eax - jnc .scan_dir - add esp, 8+8+12+28 - popad - mov eax, ERROR_DISK_FULL - xor ebx, ebx - ret -.free: - test ecx, ecx - jnz @f - mov [esp], edi - mov ecx, [esp+8+8+12+8] - mov [esp+4], ecx - xor ecx, ecx -@@: - inc ecx - cmp ecx, eax - jb .scan_cont -; found! -; calculate name checksum - push esi ecx - mov esi, [esp+8+8] - mov ecx, 11 - xor eax, eax -@@: - ror al, 1 - add al, [esi] - inc esi - loop @b - pop ecx esi - pop edi - pop dword [esp+8+12+8] -; edi points to first entry in free chunk - dec ecx - jz .nolfn - push esi - push eax - lea eax, [esp+8+8+12+8] - call dword [eax+4] ; begin write - mov al, 40h -.writelfn: - or al, cl - mov esi, [esp+4] - push ecx - dec ecx - imul ecx, 13 - add esi, ecx - stosb - mov cl, 5 - call fs_RamdiskRewrite.read_symbols - mov ax, 0xF - stosw - mov al, [esp+4] - stosb - mov cl, 6 - call fs_RamdiskRewrite.read_symbols - xor eax, eax - stosw - mov cl, 2 - call fs_RamdiskRewrite.read_symbols - pop ecx - lea eax, [esp+8+8+12+8] - call dword [eax+8] ; next write - xor eax, eax - loop .writelfn - pop eax - pop esi -; lea eax, [esp+8+12+8] -; call dword [eax+12] ; end write -.nolfn: - xchg esi, [esp] - mov ecx, 11 - rep movsb - mov word [edi], 20h ; attributes - sub edi, 11 - pop esi ecx - add esp, 12 - mov byte [edi+13], 0 ; tenths of a second at file creation time - call get_time_for_file - mov [edi+14], ax ; creation time - mov [edi+22], ax ; last write time - call get_date_for_file - mov [edi+16], ax ; creation date - mov [edi+24], ax ; last write date - mov [edi+18], ax ; last access date - and word [edi+20], 0 ; high word of cluster - and word [edi+26], 0 ; low word of cluster - to be filled - and dword [edi+28], 0 ; file size - to be filled - cmp byte [esp+28+28], 0 - jz .doit -; create directory - mov byte [edi+11], 10h ; attributes: folder - mov ecx, 32*2 - mov edx, edi -.doit: - lea eax, [esp+8] - call dword [eax+12] ; flush directory - push ecx - push edi - push 0 - mov esi, edx - test ecx, ecx - jz .done - mov ecx, 2849 - mov edi, FLOPPY_FAT - push 0 ; first cluster -.write_loop: -; allocate new cluster - xor eax, eax - repnz scasw - mov al, ERROR_DISK_FULL - jnz .ret - dec edi - dec edi - - mov eax, edi - sub eax, FLOPPY_FAT - - shr eax, 1 ; eax = cluster - mov word [edi], 0xFFF ; mark as last cluster - xchg edi, [esp+4] - cmp dword [esp], 0 - jz .first - stosw - jmp @f -.first: - mov [esp], eax -@@: - mov edi, [esp+4] - inc ecx -; write data - push ecx edi - mov ecx, 512 - cmp dword [esp+20], ecx - jae @f - mov ecx, [esp+20] -@@: - mov edi, FDD_BUFF - cmp byte [esp+24+28+28], 0 - jnz .writedir - push ecx - rep movsb - pop ecx -.writedircont: - push ecx - sub ecx, 512 - neg ecx - push eax - xor eax, eax - rep stosb - pop eax - add eax, 31 - pusha - call save_chs_sector - popa - pop ecx - cmp [FDC_Status], 0 - jnz .diskerr - sub [esp+20], ecx - pop edi ecx - jnz .write_loop -.done: - xor eax, eax -.ret: - pop ebx edi edi ecx - mov [esp+28+28], eax - lea eax, [esp+8] - call dword [eax+4] - mov [edi+26], bx - mov ebx, esi - sub ebx, edx - mov [edi+28], ebx - call dword [eax+12] - mov [esp+28+16], ebx - test ebp, ebp - jnz @f - call save_flp_root -@@: - add esp, 28 - cmp [FDC_Status], 0 - jnz .err3 - call save_flp_fat - cmp [FDC_Status], 0 - jnz .err3 - popa - ret -.err3: - popa - mov al, 11 - xor ebx, ebx - ret -.diskerr: - sub esi, ecx - mov eax, 11 - pop edi ecx - jmp .ret -.writedir: - push ecx - mov ecx, 32/4 - push ecx esi - rep movsd - pop esi ecx - mov dword [edi-32], '. ' - mov dword [edi-32+4], ' ' - mov dword [edi-32+8], ' ' - mov byte [edi-32+11], 10h - mov word [edi-32+26], ax - push esi - rep movsd - pop esi - mov dword [edi-32], '.. ' - mov dword [edi-32+4], ' ' - mov dword [edi-32+8], ' ' - mov byte [edi-32+11], 10h - mov ecx, [esp+28+8] - mov word [edi-32+26], cx - pop ecx - jmp .writedircont - -;---------------------------------------------------------------- -; -; fs_FloppyWrite - LFN variant for writing to floppy -; -; esi points to filename -; ebx pointer to 64-bit number = first wanted byte, 0+ -; may be ebx=0 - start from first byte -; ecx number of bytes to write, 0+ -; edx mem location to data -; -; ret ebx = bytes written (maybe 0) -; eax = 0 ok write or other = errormsg -; -;-------------------------------------------------------------- - -@@: - push ERROR_ACCESS_DENIED -fs_FloppyWrite.ret0: - pop eax - xor ebx, ebx - ret - -fs_FloppyWrite.ret11: - push 11 - jmp fs_FloppyWrite.ret0 - -fs_FloppyWrite: - cmp byte [esi], 0 - jz @b - call read_flp_fat - cmp [FDC_Status], 0 - jnz .ret11 - pushad - call fd_find_lfn - jnc .found - popad - push ERROR_FILE_NOT_FOUND - jmp .ret0 -.found: -; FAT does not support files larger than 4GB - test ebx, ebx - jz .l1 - cmp dword [ebx+4], 0 - jz @f -.eof: - popad - push ERROR_END_OF_FILE - jmp .ret0 -@@: - mov ebx, [ebx] -.l1: -; now edi points to direntry, ebx=start byte to write, -; ecx=number of bytes to write, edx=data pointer - -; extend file if needed - add ecx, ebx - jc .eof ; FAT does not support files larger than 4GB - push eax ; save directory cluster - push 0 ; return value=0 - - call get_time_for_file - mov [edi+22], ax ; last write time - call get_date_for_file - mov [edi+24], ax ; last write date - mov [edi+18], ax ; last access date - - push dword [edi+28] ; save current file size - cmp ecx, [edi+28] - jbe .length_ok - cmp ecx, ebx - jz .length_ok - call floppy_extend_file - jnc .length_ok - mov [esp+4], eax -; floppy_extend_file can return two error codes: FAT table error or disk full. -; First case is fatal error, in second case we may write some data - cmp al, ERROR_DISK_FULL - jz .disk_full - pop eax - pop eax - mov [esp+4+28], eax - pop eax - popad - xor ebx, ebx - ret -.disk_full: -; correct number of bytes to write - mov ecx, [edi+28] - cmp ecx, ebx - ja .length_ok -.ret: - pop eax - pop eax - mov [esp+4+28], eax ; eax=return value - pop eax - sub edx, [esp+20] - mov [esp+16], edx ; ebx=number of written bytes - popad - ret -.length_ok: -; save FAT & directory -; note that directory must be saved first because save_flp_fat uses buffer at 0xD000 - mov esi, [edi+28] - movzx edi, word [edi+26] ; starting cluster - mov eax, [esp+8] - pusha - call save_chs_sector - popa - cmp [FDC_Status], 0 - jnz .device_err - call save_flp_fat - cmp [FDC_Status], 0 - jz @f -.device_err: - mov byte [esp+4], 11 - jmp .ret -@@: - -; now ebx=start pos, ecx=end pos, both lie inside file - sub ecx, ebx - jz .ret - -.write_loop: -; skip unmodified sectors - cmp dword [esp], 0x200 - jb .modify - sub ebx, 0x200 - jae .skip - add ebx, 0x200 -.modify: - lea eax, [edi+31] ; current sector -; get length of data in current sector - push ecx - sub ebx, 0x200 - jb .hasdata - neg ebx - xor ecx, ecx - jmp @f -.hasdata: - neg ebx - cmp ecx, ebx - jbe @f - mov ecx, ebx -@@: -; load sector if needed - cmp dword [esp+4], 0 ; we don't need to read uninitialized data - jz .noread - cmp ecx, 0x200 ; we don't need to read sector if it is fully rewritten - jz .noread - cmp ecx, esi ; (same for the last sector) - jz .noread - pusha - call read_chs_sector - popa - cmp [FDC_Status], 0 - jz @f -.device_err2: - pop ecx - jmp .device_err -@@: -.noread: -; zero uninitialized data if file was extended (because floppy_extend_file does not this) - push eax ecx edi - xor eax, eax - mov ecx, 0x200 - sub ecx, [esp+4+12] - jbe @f - mov edi, FDD_BUFF - add edi, [esp+4+12] - rep stosb -@@: -; zero uninitialized data in the last sector - mov ecx, 0x200 - sub ecx, esi - jbe @f - mov edi, FDD_BUFF - add edi, esi - rep stosb -@@: - pop edi ecx eax -; copy new data - push eax - mov eax, edx - neg ebx - jecxz @f - add ebx, FDD_BUFF+0x200 - call memmove - xor ebx, ebx -@@: - pop eax -; save sector - pusha - call save_chs_sector - popa - cmp [FDC_Status], 0 - jnz .device_err2 - add edx, ecx - sub [esp], ecx - pop ecx - jz .done -.skip: -.next_cluster: - movzx edi, word [edi*2+FLOPPY_FAT] - sub esi, 0x200 - jae @f - xor esi, esi -@@: - sub dword [esp], 0x200 - jae .write_loop - and dword [esp], 0 - jmp .write_loop -.done: - jmp .ret - -floppy_extend_file.zero_size: - xor eax, eax - jmp floppy_extend_file.start_extend - -; extends file on floppy to given size (new data area is undefined) -; in: edi->direntry, ecx=new size -; out: CF=0 => OK, eax=0 -; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL) -floppy_extend_file: - push ecx -; find the last cluster of file - movzx eax, word [edi+26] ; first cluster - mov ecx, [edi+28] - jecxz .zero_size -@@: - sub ecx, 0x200 - jbe @f - mov eax, [eax*2+FLOPPY_FAT] - and eax, 0xFFF - jz .fat_err - cmp eax, 0xFF8 - jb @b -.fat_err: - pop ecx - movi eax, ERROR_FAT_TABLE - stc - ret -@@: - push eax - mov eax, [eax*2+FLOPPY_FAT] - and eax, 0xFFF - cmp eax, 0xFF8 - pop eax - jb .fat_err -; set length to full number of sectors - sub [edi+28], ecx -.start_extend: - pop ecx -; now do extend - push edx esi - mov esi, FLOPPY_FAT+2*2 ; start scan from cluster 2 - mov edx, 2847 ; number of clusters to scan -.extend_loop: - cmp [edi+28], ecx - jae .extend_done -; add new sector - push ecx - push edi -.scan: - mov ecx, edx - mov edi, esi - jecxz .disk_full - push eax - xor eax, eax - repnz scasw - pop eax - jnz .disk_full - mov word [edi-2], 0xFFF - mov esi, edi - mov edx, ecx - sub edi, FLOPPY_FAT - shr edi, 1 - dec edi ; now edi=new cluster - test eax, eax - jz .first_cluster - mov [FLOPPY_FAT+eax*2], di - jmp @f -.first_cluster: - pop eax ; eax->direntry - push eax - mov [eax+26], di -@@: - mov eax, edi ; eax=new cluster - pop edi ; edi->direntry - pop ecx ; ecx=required size - add dword [edi+28], 0x200 - jmp .extend_loop -.extend_done: - mov [edi+28], ecx - pop esi edx - xor eax, eax ; CF=0 - ret -.disk_full: - pop edi ecx - pop esi edx - stc - movi eax, ERROR_DISK_FULL - ret - -;---------------------------------------------------------------- -; -; fs_FloppySetFileEnd - set end of file on floppy -; -; esi points to filename -; ebx points to 64-bit number = new file size -; ecx ignored (reserved) -; edx ignored (reserved) -; -; ret eax = 0 ok or other = errormsg -; -;-------------------------------------------------------------- -fs_FloppySetFileEnd: - call read_flp_fat - cmp [FDC_Status], 0 - jnz ret11 - cmp byte [esi], 0 - jnz @f -.access_denied: - push ERROR_ACCESS_DENIED - jmp .ret -@@: - push edi - call fd_find_lfn - jnc @f - pop edi - push ERROR_FILE_NOT_FOUND -.ret: - pop eax - jmp .doret -@@: -; must not be directory - test byte [edi+11], 10h - jz @f - pop edi - jmp .access_denied -@@: -; file size must not exceed 4 Gb - cmp dword [ebx+4], 0 - jz @f - pop edi - push ERROR_END_OF_FILE - jmp .ret -@@: - push eax -; set file modification date/time to current - call fat_update_datetime - mov eax, [ebx] - cmp eax, [edi+28] - jb .truncate - ja .expand - pop eax - pushad - call save_chs_sector - popad - pop edi - xor eax, eax - cmp [FDC_Status], 0 - jz @f - mov al, 11 -@@: -.doret: - ret -.expand: - push ecx - push dword [edi+28] ; save old size - mov ecx, eax - call floppy_extend_file - push eax ; return code - jnc .expand_ok - cmp al, ERROR_DISK_FULL - jz .disk_full - pop eax ecx ecx edi edi - jmp .doret -.device_err: - pop eax -.device_err2: - pop ecx ecx eax edi - push 11 - jmp .ret -.disk_full: -.expand_ok: -; save directory & FAT - mov eax, [edi+28] - xchg eax, [esp+12] - movzx edi, word [edi+26] - pusha - call save_chs_sector - popa - cmp [FDC_Status], 0 - jnz .device_err - call save_flp_fat - cmp [FDC_Status], 0 - jnz .device_err -; now zero new data -; edi = current cluster, [esp+12]=new size, [esp+4]=old size, [esp]=return code -.zero_loop: - sub dword [esp+4], 0x200 - jae .next_cluster - cmp dword [esp+4], -0x200 - jz .noread - lea eax, [edi+31] - pusha - call read_chs_sector - popa - cmp [FDC_Status], 0 - jnz .err_next -.noread: - mov ecx, [esp+4] - neg ecx - push edi - mov edi, FDD_BUFF+0x200 - add edi, [esp+8] - xor eax, eax - mov [esp+8], eax - rep stosb - pop edi - lea eax, [edi+31] - pusha - call save_chs_sector - popa - cmp [FDC_Status], 0 - jz .next_cluster -.err_next: - mov byte [esp], 11 -.next_cluster: - sub dword [esp+12], 0x200 - jbe .expand_done - movzx edi, word [FLOPPY_FAT+edi*2] - jmp .zero_loop -.expand_done: - pop eax ecx ecx edi edi - jmp .doret -.truncate: - mov [edi+28], eax - push ecx - movzx ecx, word [edi+26] - test eax, eax - jz .zero_size -; find new last sector -@@: - sub eax, 0x200 - jbe @f - movzx ecx, word [FLOPPY_FAT+ecx*2] - jmp @b -@@: -; we will zero data at the end of last sector - remember it - push ecx -; terminate FAT chain - lea ecx, [FLOPPY_FAT+ecx+ecx] - push dword [ecx] - mov word [ecx], 0xFFF - pop ecx - and ecx, 0xFFF - jmp .delete -.zero_size: - and word [edi+26], 0 - push 0 -.delete: -; delete FAT chain starting with ecx -; mark all clusters as free - cmp ecx, 0xFF8 - jae .deleted - lea ecx, [FLOPPY_FAT+ecx+ecx] - push dword [ecx] - and word [ecx], 0 - pop ecx - and ecx, 0xFFF - jmp .delete -.deleted: - mov edi, [edi+28] -; save directory & FAT - mov eax, [esp+8] - pusha - call save_chs_sector - popa - cmp [FDC_Status], 0 - jnz .device_err2 - call save_flp_fat - cmp [FDC_Status], 0 - jnz .device_err2 -; zero last sector, ignore errors - pop eax - add eax, 31 - and edi, 0x1FF - jz .truncate_done - - pusha - call read_chs_sector - popa - add edi, FDD_BUFF - mov ecx, FDD_BUFF+0x200 - sub ecx, edi - push eax - xor eax, eax - rep stosb - pop eax - pusha - call save_chs_sector - popa -.truncate_done: - pop ecx eax edi - xor eax, eax - jmp .doret - -fs_FloppyGetFileInfo: - call read_flp_fat - cmp [FDC_Status], 0 - jnz ret11 - cmp byte [esi], 0 - jnz @f - mov eax, 2 ; unsupported - ret -@@: - push edi - call fd_find_lfn - jmp fs_GetFileInfo_finish - -ret11: - mov eax, 11 - ret - -fs_FloppySetFileInfo: - call read_flp_fat - cmp [FDC_Status], 0 - jnz ret11 - cmp byte [esi], 0 - jnz @f - mov eax, 2 ; unsupported - ret -@@: - push edi - call fd_find_lfn - jnc @f - pop edi - mov eax, ERROR_FILE_NOT_FOUND - ret -@@: - push eax - call bdfe_to_fat_entry - pop eax - pusha - call save_chs_sector - popa - pop edi - xor eax, eax - cmp [FDC_Status], al - jz @f - mov al, 11 -@@: - ret - -;---------------------------------------------------------------- -; -; fs_FloppyDelete - delete file or empty folder from floppy -; -; esi points to filename -; -; ret eax = 0 ok or other = errormsg -; -;-------------------------------------------------------------- -fs_FloppyDelete: - call read_flp_fat - cmp [FDC_Status], 0 - jz @f - push 11 - jmp .pop_ret -@@: - cmp byte [esi], 0 - jnz @f -; cannot delete root! -.access_denied: - push ERROR_ACCESS_DENIED -.pop_ret: - pop eax - ret -@@: - and [fd_prev_sector], 0 - and [fd_prev_prev_sector], 0 - push edi - call fd_find_lfn - jnc .found - pop edi - push ERROR_FILE_NOT_FOUND - jmp .pop_ret -.found: - cmp dword [edi], '. ' - jz .access_denied2 - cmp dword [edi], '.. ' - jz .access_denied2 - test byte [edi+11], 10h - jz .dodel -; we can delete only empty folders! - push eax - movzx eax, word [edi+26] - push ebx - pusha - add eax, 31 - call read_chs_sector - popa - mov ebx, FDD_BUFF + 2*0x20 -.checkempty: - cmp byte [ebx], 0 - jz .empty - cmp byte [ebx], 0xE5 - jnz .notempty - add ebx, 0x20 - cmp ebx, FDD_BUFF + 0x200 - jb .checkempty - movzx eax, word [FLOPPY_FAT + eax*2] - pusha - add eax, 31 - call read_chs_sector - popa - mov ebx, FDD_BUFF - jmp .checkempty -.notempty: - pop ebx - pop eax -.access_denied2: - pop edi - jmp .access_denied -.empty: - pop ebx - pop eax - pusha - call read_chs_sector - popa -.dodel: - push eax - movzx eax, word [edi+26] - xchg eax, [esp] -; delete folder entry - mov byte [edi], 0xE5 -; delete LFN (if present) -.lfndel: - cmp edi, FDD_BUFF - ja @f - cmp [fd_prev_sector], 0 - jz .lfndone - push [fd_prev_sector] - push [fd_prev_prev_sector] - pop [fd_prev_sector] - and [fd_prev_prev_sector], 0 - pusha - call save_chs_sector - popa - pop eax - pusha - call read_chs_sector - popa - mov edi, FDD_BUFF+0x200 -@@: - sub edi, 0x20 - cmp byte [edi], 0xE5 - jz .lfndone - cmp byte [edi+11], 0xF - jnz .lfndone - mov byte [edi], 0xE5 - jmp .lfndel -.lfndone: - pusha - call save_chs_sector - popa -; delete FAT chain - pop eax -@@: - cmp eax, 2 - jb .done - cmp eax, 0xFF8 - jae .done - lea eax, [FLOPPY_FAT + eax*2] - push dword [eax] - and word [eax], 0 - pop eax - and eax, 0xFFF - jmp @b -.done: - call save_flp_fat - pop edi - xor eax, eax - ret - -; \end{diamond} diff --git a/kernel/trunk/fs/fs-et.inc b/kernel/trunk/fs/fs-et.inc deleted file mode 100644 index 454c2a8410..0000000000 --- a/kernel/trunk/fs/fs-et.inc +++ /dev/null @@ -1,12 +0,0 @@ -dir0: - db 'KÕVAKETAS ' - db 'MÄLUKETAS ' - db 'FLOPPIKETAS' - db 0 - -dir1: - db 'ESIMENE ' - db 'TEINE ' - db 'KOLAMS ' - db 'NELJAS ' - db 0 \ No newline at end of file diff --git a/kernel/trunk/fs/fs-sp.inc b/kernel/trunk/fs/fs-sp.inc deleted file mode 100644 index 7d0f4225fa..0000000000 --- a/kernel/trunk/fs/fs-sp.inc +++ /dev/null @@ -1,13 +0,0 @@ -dir0: - db 'DISCO DURO ' - db 'UNIDAD RAM ' - db 'DISQUETE ' - db 0 - -dir1: - db 'PRIMERO ' - db 'SEGUNDO ' - db 'TERCERO ' - db 'CUARTO ' - db 0 - diff --git a/kernel/trunk/fs/fs.inc b/kernel/trunk/fs/fs.inc deleted file mode 100644 index 1b9f0bd81f..0000000000 --- a/kernel/trunk/fs/fs.inc +++ /dev/null @@ -1,682 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;; ;; -;; System service for filesystem call ;; -;; (C) 2004 Ville Turjanmaa, License: GPL ;; -;; 29.04.2006 Elimination of hangup after the ;; -;; expiration hd_wait_timeout (for LBA) - Mario79 ;; -;; 15.01.2005 get file size/attr/date, ;; -;; file_append (only for hd) - ATV ;; -;; 23.11.2004 test if hd/partition is set - ATV ;; -;; 18.11.2004 get_disk_info and more error codes - ATV ;; -;; 08.11.2004 expand_pathz and rename (only for hd) - ATV ;; -;; 20.10.2004 Makedir/Removedir (only for hd) - ATV ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -$Revision$ - - -iglobal - -if lang eq sp -include 'fs/fs-sp.inc' -else if lang eq et -include 'fs/fs-et.inc' -else -dir0: - db 'HARDDISK ' - db 'RAMDISK ' - db 'FLOPPYDISK ' - db 0 - -dir1: - db 'FIRST ' - db 'SECOND ' - db 'THIRD ' - db 'FOURTH ' - db 0 -end if - -not_select_IDE db 0 - -hd_address_table: - dd 0x1f0,0x00,0x1f0,0x10 - dd 0x170,0x00,0x170,0x10 -endg - -file_system: - -; IN: -; -; eax = 0 ; read file /RamDisk/First 6 -; eax = 8 ; lba read -; eax = 15 ; get_disk_info -; -; OUT: -; -; eax = 0 : read ok -; eax = 1 : no hd base and/or partition defined -; eax = 2 : function is unsupported for this FS -; eax = 3 : unknown FS -; eax = 4 : partition not defined at hd -; eax = 5 : file not found -; eax = 6 : end of file -; eax = 7 : memory pointer not in application area -; eax = 8 : disk full -; eax = 9 : fat table corrupted -; eax = 10 : access denied -; eax = 11 : disk error -; -; ebx = size - -; \begin{diamond}[18.03.2006] -; for subfunction 16 (start application) error codes must be negative -; because positive values are valid PIDs -; so possible return values are: -; eax > 0 : process created, eax=PID - -; -0x10 <= eax < 0 : -eax is filesystem error code: -; eax = -1 = 0xFFFFFFFF : no hd base and/or partition defined -; eax = -3 = 0xFFFFFFFD : unknown FS -; eax = -5 = 0xFFFFFFFB : file not found -; eax = -6 = 0xFFFFFFFA : unexpected end of file (probably not executable file) -; eax = -9 = 0xFFFFFFF7 : fat table corrupted -; eax = -10 = 0xFFFFFFF6 : access denied - -; -0x20 <= eax < -0x10: eax is process creation error code: -; eax = -0x20 = 0xFFFFFFE0 : too many processes -; eax = -0x1F = 0xFFFFFFE1 : not Menuet/Kolibri executable -; eax = -0x1E = 0xFFFFFFE2 : no memory - -; ebx is not changed - -; \end{diamond}[18.03.2006] - - ; Extract parameters - ; add eax, std_application_base_address ; abs start of info block - - cmp dword [eax+0], 15; GET_DISK_INFO - je fs_info - - cmp dword [CURRENT_TASK], 1; no memory checks for kernel requests - jz no_checks_for_kernel - mov edx, eax - cmp dword [eax+0], 1 - jnz .usual_check - mov ebx, [eax+12] - ; add ebx,std_application_base_address - mov ecx, [eax+8] - call check_region - test eax, eax - jnz area_in_app_mem - -.error_output: - mov esi, buffer_failed - call sys_msg_board_str -; mov eax,7 - mov dword [esp+36], 7 - ret -iglobal - buffer_failed db 'K : Buffer check failed',13,10,0 -endg -.usual_check: - cmp dword [eax+0], 0 - mov ecx, 512 - jnz .small_size - mov ecx, [eax+8] - shl ecx, 9 -.small_size: - mov ebx, [eax+12] - ; add ebx,std_application_base_address - call check_region - test eax, eax - jz .error_output - area_in_app_mem: - mov eax, edx - no_checks_for_kernel: - - fs_read: - - mov ebx, [eax+20] ; program wants root directory ? - test bl, bl - je fs_getroot - test bh, bh - jne fs_noroot - fs_getroot: -; \begin{diamond}[18.03.2006] -; root - only read is allowed -; other operations return "access denied", eax=10 -; (execute operation returns eax=-10) - cmp dword [eax], 0 - jz .read_root - mov dword [esp+36], 10 - ret -.read_root: -; \end{diamond}[18.03.2006] - mov esi, dir0 - mov edi, [eax+12] - ; add edi,std_application_base_address - mov ecx, 11 - push ecx -; cld ; already is - rep movsb - mov al, 0x10 - stosb - add edi, 32-11-1 - pop ecx - rep movsb - stosb - and dword [esp+36], 0; ok read - mov dword [esp+24], 32*2; size of root - ret - - fs_info: ;start of code - Mihasik - push eax - cmp [eax+21], byte 'r' - je fs_info_r - cmp [eax+21], byte 'R' - je fs_info_r - mov eax, 3 ;if unknown disk - xor ebx, ebx - xor ecx, ecx - xor edx, edx - jmp fs_info1 - fs_info_r: - call ramdisk_free_space;if ramdisk - mov ecx, edi ;free space in ecx - shr ecx, 9 ;free clusters - mov ebx, 2847 ;total clusters - mov edx, 512 ;cluster size - xor eax, eax ;always 0 - fs_info1: - pop edi - mov [esp+36], eax - mov [esp+24], ebx ; total clusters on disk - mov [esp+32], ecx ; free clusters on disk - mov [edi], edx ; cluster size in bytes - ret ;end of code - Mihasik - - fs_noroot: - - push dword [eax+0] ; read/write/delete/.../makedir/rename/lba/run - push dword [eax+4] ; 512 block number to read - push dword [eax+8] ; bytes to write/append or 512 blocks to read - mov ebx, [eax+12] - ; add ebx,std_application_base_address - push ebx ; abs start of return/save area - - lea esi, [eax+20] ; abs start of dir + filename - mov edi, [eax+16] - ; add edi,std_application_base_address ; abs start of work area - - call expand_pathz - - push edi ; dir start - push ebx ; name of file start - - mov eax, [edi+1] - cmp eax, 'RD ' - je fs_yesramdisk - cmp eax, 'RAMD' - jne fs_noramdisk - - fs_yesramdisk: - - cmp byte [edi+1+11], 0 - je fs_give_dir1 - - mov eax, [edi+1+12] - cmp eax, '1 ' - je fs_yesramdisk_first - cmp eax, 'FIRS' - jne fs_noramdisk - - fs_yesramdisk_first: - - cmp dword [esp+20], 8; LBA read ramdisk - jne fs_no_LBA_read_ramdisk - - mov eax, [esp+16] ; LBA block to read - mov ecx, [esp+8] ; abs pointer to return area - - call LBA_read_ramdisk - jmp file_system_return - - - fs_no_LBA_read_ramdisk: - - cmp dword [esp+20], 0; READ - jne fs_noramdisk_read - - mov eax, [esp+4] ; fname - add eax, 2*12+1 - mov ebx, [esp+16] ; block start - inc ebx - mov ecx, [esp+12] ; block count - mov edx, [esp+8] ; return - mov esi, [esp+0] - sub esi, eax - add esi, 12+1 ; file name length - call fileread - - jmp file_system_return - - - fs_noramdisk_read: - fs_noramdisk: - - ;******************************************************************** - mov eax, [edi+1] - cmp eax, 'FD ' - je fs_yesflpdisk - cmp eax, 'FLOP' - jne fs_noflpdisk - - fs_yesflpdisk: - call reserve_flp - - cmp byte [edi+1+11], 0 - je fs_give_dir1 - - mov eax, [edi+1+12] - cmp eax, '1 ' - je fs_yesflpdisk_first - cmp eax, 'FIRS' - je fs_yesflpdisk_first - cmp eax, '2 ' - je fs_yesflpdisk_second - cmp eax, 'SECO' - jne fs_noflpdisk - jmp fs_yesflpdisk_second - - fs_yesflpdisk_first: - mov [flp_number], 1 - jmp fs_yesflpdisk_start - fs_yesflpdisk_second: - mov [flp_number], 2 - fs_yesflpdisk_start: - cmp dword [esp+20], 0; READ - jne fs_noflpdisk_read - - mov eax, [esp+4] ; fname - add eax, 2*12+1 - mov ebx, [esp+16] ; block start - inc ebx - mov ecx, [esp+12] ; block count - mov edx, [esp+8] ; return - mov esi, [esp+0] - sub esi, eax - add esi, 12+1 ; file name length - call floppy_fileread - - jmp file_system_return - - - fs_noflpdisk_read: - fs_noflpdisk: - ;***************************************************************** - - old_path_harddisk: - mov eax, [edi+1] - cmp eax, 'HD ' - je fs_yesharddisk - cmp eax, 'HARD' - jne fs_noharddisk - - fs_yesharddisk: - cmp dword [esp+20], 8; LBA read - jne fs_no_LBA_read - mov eax, [esp+16] ; LBA block to read - lea ebx, [edi+1+12] ; pointer to FIRST/SECOND/THIRD/FOURTH - mov ecx, [esp+8] ; abs pointer to return area - call LBA_read - jmp file_system_return - - fs_no_LBA_read: - -hd_err_return: - - fs_noharddisk: -; \begin{diamond}[18.03.2006] - mov eax, 5 ; file not found -; а может быть, возвращать другой код ошибки? - mov ebx, [esp+24+24]; do not change ebx in application -; \end{diamond}[18.03.2006] - - file_system_return: - - add esp, 24 - - mov [esp+36], eax - mov [esp+24], ebx - ret - - - fs_give_dir1: - -; \begin{diamond}[18.03.2006] -; /RD,/FD,/HD - only read is allowed -; other operations return "access denied", eax=10 -; (execute operation returns eax=-10) - cmp dword [esp+20], 0 - jz .read - add esp, 20 - pop ecx - mov dword [esp+36], 10 - ret -.read: -; \end{diamond}[18.03.2006] - mov al, 0x10 - mov ebx, 1 - mov edi, [esp+8] - mov esi, dir1 - fs_d1_new: - mov ecx, 11 -; cld - rep movsb - stosb - add edi, 32-11-1 - dec ebx - jne fs_d1_new - - add esp, 24 - - and dword [esp+36], 0; ok read - mov dword [esp+24], 32*1; dir/data size - ret - - - -LBA_read_ramdisk: - - cmp [lba_read_enabled], 1 - je lbarrl1 - - xor ebx, ebx - mov eax, 2 - ret - - lbarrl1: - - cmp eax, 18*2*80 - jb lbarrl2 - xor ebx, ebx - mov eax, 3 - ret - - lbarrl2: - - pushad - - call restorefatchain - - mov edi, ecx - mov esi, eax - - shl esi, 9 - add esi, RAMDISK - mov ecx, 512/4 -; cld - rep movsd - - popad - - xor ebx, ebx - xor eax, eax - ret - -LBA_read: - -; IN: -; -; eax = LBA block to read -; ebx = pointer to FIRST/SECOND/THIRD/FOURTH -; ecx = abs pointer to return area - - cmp [lba_read_enabled], 1 - je lbarl1 - mov eax, 2 - ret - - lbarl1: - - pushad - mov ecx, ide_mutex - call mutex_lock - popad - - push eax - push ecx - - mov edi, hd_address_table - mov esi, dir1 - mov eax, [ebx] - mov edx, '1 ' - mov ecx, 4 - blar0: - cmp eax, [esi] - je blar2 - cmp eax, edx - je blar2 - inc edx - add edi, 8 - add esi, 11 - dec ecx - jnz blar0 - - mov eax, 1 - mov ebx, 1 - jmp LBA_read_ret - - blar2: - mov eax, [edi+0] - mov ebx, [edi+4] - - mov [hdbase], eax - mov [hdid], ebx - - call wait_for_hd_idle - cmp [hd_error], 0 - jne hd_lba_error - - ; eax = hd port - ; ebx = set for primary (0x00) or slave (0x10) - - cli - - mov edx, eax - inc edx - xor eax, eax - out dx, al - inc edx - inc eax - out dx, al - inc edx - mov eax, [esp+4] - out dx, al - shr eax, 8 - inc edx - out dx, al - shr eax, 8 - inc edx - out dx, al - shr eax, 8 - inc edx - and al, 1+2+4+8 - add al, bl - add al, 128+64+32 - out dx, al - - inc edx - mov al, 20h - out dx, al - - sti - - call wait_for_sector_buffer - cmp [hd_error], 0 - jne hd_lba_error - - cli - - mov edi, [esp+0] - mov ecx, 256 - sub edx, 7 - cld - rep insw - - sti - - xor eax, eax - xor ebx, ebx - - LBA_read_ret: - mov [hd_error], 0 - mov [hd1_status], 0 - add esp, 2*4 - pushad - mov ecx, ide_mutex - call mutex_unlock - popad - - ret - - -expand_pathz: -; IN: -; esi = asciiz path & file -; edi = buffer for path & file name -; OUT: -; edi = directory & file : / 11 + / 11 + / 11 - zero terminated -; ebx = /file name - zero terminated -; esi = pointer after source - - push eax - push ecx - push edi;[esp+0] - - pathz_start: - mov byte [edi], '/' - inc edi - mov al, 32 - mov ecx, 11 - cld - rep stosb ; clear filename area - sub edi, 11 - mov ebx, edi ; start of dir/file name - - pathz_new_char: - mov al, [esi] - inc esi - cmp al, 0 - je pathz_end - - cmp al, '/' - jne pathz_not_path - cmp edi, ebx ; skip first '/' - jz pathz_new_char - lea edi, [ebx+11] ; start of next directory - jmp pathz_start - - pathz_not_path: - cmp al, '.' - jne pathz_not_ext - lea edi, [ebx+8] ; start of extension - jmp pathz_new_char - - pathz_not_ext: - cmp al, 'a' - jb pathz_not_low - cmp al, 'z' - ja pathz_not_low - sub al, 0x20 ; char to uppercase - - pathz_not_low: - mov [edi], al - inc edi - mov eax, [esp+0] ; start_of_dest_path - add eax, 512 ; keep maximum path under 512 bytes - cmp edi, eax - jb pathz_new_char - - pathz_end: - cmp ebx, edi ; if path end with '/' - jnz pathz_put_zero ; go back 1 level - sub ebx, 12 - - pathz_put_zero: - mov byte [ebx+11], 0 - dec ebx ; include '/' char into file name - pop edi - pop ecx - pop eax - ret - -;******************************************* -;* string to number -;* input eax - 4 byte string -;* output eax - number -;******************************************* -StringToNumber: -; ПЕРЕВОД СТРОКОВОГО ЧИСЛА В ЧИСЛОВОЙ ВИД -; Вход: -; EDI - адрес строки с числом. Конец числа отмечен кодом 0Dh -; Выход: -; CF - индикатор ошибок: -; 0 - ошибок нет; -; 1 - ошибка -; Если CF=0, то AX - число. - - push bx - push cx - push dx - push edi - mov [partition_string], eax - mov edi, partition_string - xor cx, cx -i1: - mov al, [edi] - cmp al, 32;13 - je i_exit -; cmp al,'0' -; jb err -; cmp al,'9' -; ja err - sub al, 48 - shl cx, 1 - jc error - mov bx, cx - shl cx, 1 - jc error - shl cx, 1 - jc error - add cx, bx - jc error - cbw - add cx, ax - jc error -i3: - inc edi - jmp i1 -i_exit: - mov ax, cx - clc -i4: - movzx eax, ax - pop edi - pop dx - pop cx - pop bx - ret - -error: - stc - jmp i4 - -partition_string: - dd 0 - db 32 diff --git a/kernel/trunk/fs/fs_lfn.inc b/kernel/trunk/fs/fs_lfn.inc index 155371e8a6..0b39c2d3df 100644 --- a/kernel/trunk/fs/fs_lfn.inc +++ b/kernel/trunk/fs/fs_lfn.inc @@ -30,18 +30,6 @@ image_of_ebx EQU esp+20 iglobal ; in this table names must be in lowercase rootdirs: - db 2,'rd' - dd fs_OnRamdisk - dd fs_NextRamdisk - db 7,'ramdisk' - dd fs_OnRamdisk - dd fs_NextRamdisk - db 2,'fd' - dd fs_OnFloppy - dd fs_NextFloppy - db 10,'floppydisk' - dd fs_OnFloppy - dd fs_NextFloppy ;********************************************** db 3,'cd0' dd fs_OnCd0 @@ -60,10 +48,6 @@ rootdirs: virtual_root_query: - dd fs_HasRamdisk - db 'rd',0 - dd fs_HasFloppy - db 'fd',0 ;********************************************** dd fs_HasCd0 db 'cd0',0 @@ -436,72 +420,10 @@ file_system_lfn: ; ebp = 0 or pointer to rest of name from folder addressed by esi ; out: [image_of_eax]=image of eax, [image_of_ebx]=image of ebx -fs_OnRamdisk: - cmp ecx, 1 - jnz file_system_lfn.notfound - mov eax, [ebx] - cmp eax, fs_NumRamdiskServices - jae .not_impl - mov ecx, [ebx+12] - mov edx, [ebx+16] - ; add edx, std_application_base_address - add ebx, 4 - call dword [fs_RamdiskServices + eax*4] - mov [image_of_eax], eax - mov [image_of_ebx], ebx - ret -.not_impl: - mov dword [image_of_eax], 2 ; not implemented - ret - fs_NotImplemented: mov eax, 2 ret -fs_RamdiskServices: - dd fs_RamdiskRead - dd fs_RamdiskReadFolder - dd fs_RamdiskRewrite - dd fs_RamdiskWrite - dd fs_RamdiskSetFileEnd - dd fs_RamdiskGetFileInfo - dd fs_RamdiskSetFileInfo - dd 0 - dd fs_RamdiskDelete - dd fs_RamdiskCreateFolder -fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4 - -fs_OnFloppy: - cmp ecx, 2 - ja file_system_lfn.notfound - mov eax, [ebx] - cmp eax, fs_NumFloppyServices - jae fs_OnRamdisk.not_impl - call reserve_flp - mov [flp_number], cl - mov ecx, [ebx+12] - mov edx, [ebx+16] - ; add edx, std_application_base_address - add ebx, 4 - call dword [fs_FloppyServices + eax*4] - and [flp_status], 0 - mov [image_of_eax], eax - mov [image_of_ebx], ebx - ret - -fs_FloppyServices: - dd fs_FloppyRead - dd fs_FloppyReadFolder - dd fs_FloppyRewrite - dd fs_FloppyWrite - dd fs_FloppySetFileEnd - dd fs_FloppyGetFileInfo - dd fs_FloppySetFileInfo - dd 0 - dd fs_FloppyDelete - dd fs_FloppyCreateFolder -fs_NumFloppyServices = ($ - fs_FloppyServices)/4 - ;******************************************************* fs_OnCd0: call reserve_cd @@ -583,16 +505,6 @@ fs_CdServices: dd fs_NotImplemented fs_NumCdServices = ($ - fs_CdServices)/4 -;******************************************************* - -fs_HasRamdisk: - mov al, 1 ; we always have ramdisk - ret -fs_HasFloppy: - cmp byte [DRIVE_DATA], 0 - setnz al - ret - ;******************************************************* fs_HasCd0: test byte [DRIVE_DATA+1], 10000000b @@ -617,36 +529,6 @@ fs_HasCd3: ; out: CF=1 => no more partitions ; CF=0 => eax=next partition number -fs_NextRamdisk: -; we always have /rd/1 - test eax, eax - stc - jnz @f - mov al, 1 - clc -@@: - ret - -fs_NextFloppy: -; we have /fd/1 iff (([DRIVE_DATA] and 0xF0) != 0) and /fd/2 iff (([DRIVE_DATA] and 0x0F) != 0) - test byte [DRIVE_DATA], 0xF0 - jz .no1 - test eax, eax - jnz .no1 - inc eax - ret ; CF cleared -.no1: - test byte [DRIVE_DATA], 0x0F - jz .no2 - cmp al, 2 - jae .no2 - mov al, 2 - clc - ret -.no2: - stc - ret - ;******************************************************* fs_NextCd: ; we always have /cdX/1 diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index af4fe74d73..9ff53f9ce8 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -759,9 +759,10 @@ no_mode_0x12: ; Initialize system timer (IRQ0) call PIT_init -; CALCULATE FAT CHAIN FOR RAMDISK - - call calculatefatchain +; Register ramdisk file system + mov esi, boot_initramdisk + call boot_log + call ramdisk_init mov esi, boot_initapic call boot_log @@ -1333,8 +1334,8 @@ proc osloop_has_work? jnz .yes call stack_handler_has_work? jnz .yes -; call check_fdd_motor_status_has_work? -; jnz .yes + call check_fdd_motor_status_has_work? + jnz .yes call check_ATAPI_device_event_has_work? jnz .yes call check_lights_state_has_work? @@ -2673,29 +2674,14 @@ endg align 4 sys_cachetodiskette: cmp ebx, 1 - jne .no_floppy_a_save - mov [flp_number], 1 - jmp .save_image_on_floppy -;-------------------------------------- -align 4 -.no_floppy_a_save: + jb .no_floppy_save cmp ebx, 2 - jne .no_floppy_b_save - mov [flp_number], 2 -;-------------------------------------- -align 4 -.save_image_on_floppy: + ja .no_floppy_save call save_image - mov [esp + 32], dword 0 - cmp [FDC_Status], 0 - je .yes_floppy_save -;-------------------------------------- -align 4 -.no_floppy_b_save: + mov [esp + 32], eax + ret +.no_floppy_save: mov [esp + 32], dword 1 -;-------------------------------------- -align 4 -.yes_floppy_save: ret ;------------------------------------------------------------------------------ uglobal @@ -5266,19 +5252,6 @@ align 4 align 4 -syscall_openramdiskfile: ; OpenRamdiskFile - - mov eax, ebx - mov ebx, ecx - mov ecx, edx - mov edx, esi - mov esi, 12 - call fileread - mov [esp+32], eax - ret - -align 4 - syscall_drawrect: ; DrawRect mov edi, edx ; color + gradient @@ -5783,12 +5756,11 @@ yes_shutdown_param: cli if ~ defined extended_primary_loader - mov eax, kernel_file ; load kernel.mnt to 0x7000:0 - movi esi, 12 - xor ebx, ebx - or ecx, -1 - mov edx, OS_BASE+0x70000 - call fileread +; load kernel.mnt to 0x7000:0 + mov ebx, kernel_file_load + pushad + call file_system_lfn + popad mov esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0 mov edi, OS_BASE+0x40000 @@ -5802,8 +5774,6 @@ end if ; cld ; rep movsd - call restorefatchain - call IRQ_mask_all if 0 diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index f31a51d0aa..acc9d0d33d 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -185,11 +185,9 @@ include "gui/button.inc" include "blkdev/disk.inc" ; support for plug-n-play disks include "blkdev/disk_cache.inc" ; caching for plug-n-play disks -include "fs/fs.inc" ; syscall -include "fs/fat32.inc" ; read / write for fat32 filesystem -include "fs/ntfs.inc" ; read / write for ntfs filesystem -include "fs/fat12.inc" ; read / write for fat12 filesystem include "blkdev/rd.inc" ; ramdisk read /write +include "fs/fat.inc" ; read / write for fat filesystem +include "fs/ntfs.inc" ; read / write for ntfs filesystem include "fs/fs_lfn.inc" ; syscall, version 2 include "fs/iso9660.inc" ; read for iso9660 filesystem CD include "fs/ext2/ext2.asm" ; read / write for ext2 filesystem diff --git a/kernel/trunk/memmap.inc b/kernel/trunk/memmap.inc index 3b035092e7..e149b67226 100644 --- a/kernel/trunk/memmap.inc +++ b/kernel/trunk/memmap.inc @@ -198,8 +198,7 @@ ; 0x800A0000 -> AFFFF screen access area ; 0x800B0000 -> FFFFF bios rest in peace -area (320k) ? ; 0x80100000 -> 27FFFF diskette image (1m5) -; 0x80280000 -> 281FFF ramdisk fat (8k) -; 0x80282000 -> 283FFF floppy fat (8k) +; 0x80280000 -> 283FFF free (16k) ; ; 0x80284000 -> 28BFFF HDD DMA AREA (32k) ; 0x8028C000 -> 297FFF free (48k)