autobuild HLL stuff
git-svn-id: svn://kolibrios.org@1764 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
db55961834
commit
9883e4f56f
Binary file not shown.
@ -190,6 +190,15 @@ COPY_FILES:=\
|
|||||||
fonts/tscr.chr:FONTS/TSCR.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/TSCR.CHR \
|
fonts/tscr.chr:FONTS/TSCR.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/TSCR.CHR \
|
||||||
games/snake.ini:GAMES/SNAKE.INI:$(PROGS)/games/snake/trunk/snake.ini
|
games/snake.ini:GAMES/SNAKE.INI:$(PROGS)/games/snake/trunk/snake.ini
|
||||||
|
|
||||||
|
# The list of all C-- programs with one main C-- file.
|
||||||
|
# Format of an item is exactly the same as in the previous list.
|
||||||
|
CMM_PROGRAMS:=\
|
||||||
|
File|Managers/eolite:File|Managers/EOLITE:$(PROGS)/fs/Eolite/trunk/Eolite.c-- \
|
||||||
|
games/clicks:GAMES/CLICKS:$(PROGS)/games/clicks/trunk/clicks.c-- \
|
||||||
|
# end if list
|
||||||
|
# mine is not compilable
|
||||||
|
# games/mine:GAMES/MINE:$(PROGS)/games/mine/trunk/mine.c--
|
||||||
|
|
||||||
# List of other files to be included in the image file.
|
# List of other files to be included in the image file.
|
||||||
# Some of them are auto-built with special rules, some just exist before build.
|
# Some of them are auto-built with special rules, some just exist before build.
|
||||||
# Each item is of the form <local name>:<name inside image>.
|
# Each item is of the form <local name>:<name inside image>.
|
||||||
@ -212,7 +221,6 @@ OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \
|
|||||||
demos/use_mb:DEMOS/USE_MB demos/web:DEMOS/WEB \
|
demos/use_mb:DEMOS/USE_MB demos/web:DEMOS/WEB \
|
||||||
drivers/atikms.dll:DRIVERS/ATIKMS.DLL \
|
drivers/atikms.dll:DRIVERS/ATIKMS.DLL \
|
||||||
File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP \
|
File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP \
|
||||||
File|Managers/eolite:File|Managers/EOLITE \
|
|
||||||
File|Managers/eolite.ini:File|Managers/EOLITE.INI \
|
File|Managers/eolite.ini:File|Managers/EOLITE.INI \
|
||||||
File|Managers/icons.bmp:File|Managers/ICONS.BMP \
|
File|Managers/icons.bmp:File|Managers/ICONS.BMP \
|
||||||
File|Managers/icons.ini:File|Managers/ICONS.INI \
|
File|Managers/icons.ini:File|Managers/ICONS.INI \
|
||||||
@ -223,7 +231,7 @@ OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \
|
|||||||
fonts/bold.chr:FONTS/BOLD.CHR fonts/char2.mt:FONTS/CHAR2.MT \
|
fonts/bold.chr:FONTS/BOLD.CHR fonts/char2.mt:FONTS/CHAR2.MT \
|
||||||
fonts/char.mt:FONTS/CHAR.MT \
|
fonts/char.mt:FONTS/CHAR.MT \
|
||||||
games/bnc:GAMES/BNC \
|
games/bnc:GAMES/BNC \
|
||||||
games/checkers:GAMES/CHECKERS games/clicks:GAMES/CLICKS \
|
games/checkers:GAMES/CHECKERS \
|
||||||
games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \
|
games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \
|
||||||
games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \
|
games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \
|
||||||
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \
|
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \
|
||||||
@ -257,7 +265,7 @@ fsource=$(call respace,$(call sourcepart,$(f)))
|
|||||||
|
|
||||||
# Define targets for image file.
|
# Define targets for image file.
|
||||||
# Join all the lists above.
|
# Join all the lists above.
|
||||||
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES)
|
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
|
||||||
# For each item in the united list call fbinary.
|
# For each item in the united list call fbinary.
|
||||||
targets:=$(foreach f,$(targets_full),$(fbinary))
|
targets:=$(foreach f,$(targets_full),$(fbinary))
|
||||||
|
|
||||||
@ -332,3 +340,119 @@ include Makefile.copy
|
|||||||
docpak: $(DOCDIR)SYSFUNCS.TXT $(wildcard $(DOCDIR)*)
|
docpak: $(DOCDIR)SYSFUNCS.TXT $(wildcard $(DOCDIR)*)
|
||||||
$(DOCDIR)SYSFUNCS.TXT: $(KERNEL)/docs/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
|
||||||
|
|
||||||
|
# Sorry, even black magic seems to be insufficient for
|
||||||
|
# auto-handling all subtle effects. So we just define
|
||||||
|
# command lines for compiling and linking, and
|
||||||
|
# maintain the list of sources and objects by hand.
|
||||||
|
include Makefile.msvc
|
||||||
|
|
||||||
|
# Rules for table
|
||||||
|
table: .obj.table/table.exe
|
||||||
|
$(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)
|
||||||
|
$(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table
|
||||||
|
$(msvc_compile)
|
||||||
|
.obj.table:
|
||||||
|
mkdir -p .obj.table
|
||||||
|
|
||||||
|
# Rules for graph
|
||||||
|
graph: .obj.graph/graph.exe
|
||||||
|
$(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
|
||||||
|
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)
|
||||||
|
$(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph
|
||||||
|
$(msvc_compile)
|
||||||
|
$(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph
|
||||||
|
$(msvc_compile)
|
||||||
|
$(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph
|
||||||
|
fasm $< $@
|
||||||
|
.obj.graph:
|
||||||
|
mkdir -p .obj.graph
|
||||||
|
|
||||||
|
# Rules for kosilka
|
||||||
|
games/kosilka: .obj.kosilka/kosilka.exe
|
||||||
|
$(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)
|
||||||
|
$(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka
|
||||||
|
$(msvc_compile)
|
||||||
|
.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 \
|
||||||
|
$(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 \
|
||||||
|
$(PROGS)/system/shell/cmd/*.c \
|
||||||
|
$(PROGS)/system/shell/modules/*.c \
|
||||||
|
$(PROGS)/system/shell/locale/rus/globals.h \
|
||||||
|
Makefile.gcc | .obj.shell
|
||||||
|
$(gcc_compile)
|
||||||
|
.obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.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 $@ $<
|
||||||
|
.obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell
|
||||||
|
fasm $< $@
|
||||||
|
.obj.shell:
|
||||||
|
mkdir -p .obj.shell
|
||||||
|
|
||||||
|
# Rules for media/ac97snd
|
||||||
|
# Not compilable from svn sources, using preloaded binary
|
||||||
|
|
||||||
|
# Rules for atikms.dll
|
||||||
|
# Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon
|
||||||
|
# However, dependencies must be duplicated - I don't know how to avoid this
|
||||||
|
# without need to rebuild kolibri.img at every iteration...
|
||||||
|
# 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 $< $@
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/atikms.dll:
|
||||||
|
flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \
|
||||||
|
$(MAKE) CC=win32-gcc AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon
|
||||||
|
$(REPOSITORY)/drivers/ddk/libddk.a:
|
||||||
|
flock $(REPOSITORY)/drivers/ddk/.lock \
|
||||||
|
$(MAKE) CC=win32-gcc AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk
|
||||||
|
# dependencies
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \
|
||||||
|
$(REPOSITORY)/drivers/ddk/libddk.a \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/*.[Sch] \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/*.asm \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/Makefile \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/firmware/*.bin \
|
||||||
|
$(REPOSITORY)/drivers/include/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*/*.h
|
||||||
|
$(REPOSITORY)/drivers/ddk/libddk.a: \
|
||||||
|
$(REPOSITORY)/drivers/ddk/Makefile \
|
||||||
|
$(REPOSITORY)/drivers/ddk/*/* \
|
||||||
|
$(REPOSITORY)/drivers/include/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*/*.h
|
||||||
|
15
data/eng/Makefile.cmm
Normal file
15
data/eng/Makefile.cmm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# This is similar to Makefile.fasm, look there for comments.
|
||||||
|
# No dependency tracking, so force dependencies on all files
|
||||||
|
# in dir/* and dir/*/*
|
||||||
|
# Also, we cannot set output file name and need to guess
|
||||||
|
# whether c-- has created .com file or no-extension file.
|
||||||
|
define cmm_meta_rule
|
||||||
|
$(1): $(2) Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \
|
||||||
|
$$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*)
|
||||||
|
flock $$(dir $(2)).lock \
|
||||||
|
win32-c-- /IP=Z:$$(dir $(2)) Z:$$< >&2 && \
|
||||||
|
if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \
|
||||||
|
kpack --nologo $$$$f "$$@" && rm $$$$f
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach f,$(CMM_PROGRAMS),$(eval $(call cmm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname))))
|
8
data/eng/Makefile.gcc
Normal file
8
data/eng/Makefile.gcc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
define gcc_compile
|
||||||
|
win32-gcc -c -Os -DAUTOBUILD -DLANG_ENG=1 -o $@ $<
|
||||||
|
endef
|
||||||
|
define gcc_link
|
||||||
|
win32-ld -nostdlib -T $(1) -o "$@" $^
|
||||||
|
win32-objcopy "$@" -O binary
|
||||||
|
kpack --nologo "$@"
|
||||||
|
endef
|
13
data/eng/Makefile.msvc
Normal file
13
data/eng/Makefile.msvc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
define msvc_compile
|
||||||
|
win32-cl /c /O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /DAUTOBUILD /Fo$@ Z:$< >&2
|
||||||
|
endef
|
||||||
|
define msvc_link
|
||||||
|
win32-link /section:.bss,E /fixed:no /subsystem:native \
|
||||||
|
/merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text \
|
||||||
|
/entry:crtStartUp /out:$@ /ltcg /nodefaultlib \
|
||||||
|
$(addprefix Z:,$^) >&2
|
||||||
|
endef
|
||||||
|
define msvc_final
|
||||||
|
EXENAME=$< fasm doexe2.asm "$@"
|
||||||
|
kpack --nologo "$@"
|
||||||
|
endef
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
data/eng/graph
BIN
data/eng/graph
Binary file not shown.
BIN
data/eng/shell
BIN
data/eng/shell
Binary file not shown.
BIN
data/eng/table
BIN
data/eng/table
Binary file not shown.
Binary file not shown.
@ -190,6 +190,15 @@ COPY_FILES:=\
|
|||||||
fonts/tscr.chr:FONTS/TSCR.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/TSCR.CHR \
|
fonts/tscr.chr:FONTS/TSCR.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/TSCR.CHR \
|
||||||
games/snake.ini:GAMES/SNAKE.INI:$(PROGS)/games/snake/trunk/snake.ini
|
games/snake.ini:GAMES/SNAKE.INI:$(PROGS)/games/snake/trunk/snake.ini
|
||||||
|
|
||||||
|
# The list of all C-- programs with one main C-- file.
|
||||||
|
# Format of an item is exactly the same as in the previous list.
|
||||||
|
CMM_PROGRAMS:=\
|
||||||
|
File|Managers/eolite:File|Managers/EOLITE:$(PROGS)/fs/Eolite/trunk/Eolite.c-- \
|
||||||
|
games/clicks:GAMES/CLICKS:$(PROGS)/games/clicks/trunk/clicks.c-- \
|
||||||
|
# end if list
|
||||||
|
# mine is not compilable
|
||||||
|
# games/mine:GAMES/MINE:$(PROGS)/games/mine/trunk/mine.c--
|
||||||
|
|
||||||
# List of other files to be included in the image file.
|
# List of other files to be included in the image file.
|
||||||
# Some of them are auto-built with special rules, some just exist before build.
|
# Some of them are auto-built with special rules, some just exist before build.
|
||||||
# Each item is of the form <local name>:<name inside image>.
|
# Each item is of the form <local name>:<name inside image>.
|
||||||
@ -212,7 +221,6 @@ OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \
|
|||||||
demos/use_mb:DEMOS/USE_MB demos/web:DEMOS/WEB \
|
demos/use_mb:DEMOS/USE_MB demos/web:DEMOS/WEB \
|
||||||
drivers/atikms.dll:DRIVERS/ATIKMS.DLL \
|
drivers/atikms.dll:DRIVERS/ATIKMS.DLL \
|
||||||
File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP \
|
File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP \
|
||||||
File|Managers/eolite:File|Managers/EOLITE \
|
|
||||||
File|Managers/eolite.ini:File|Managers/EOLITE.INI \
|
File|Managers/eolite.ini:File|Managers/EOLITE.INI \
|
||||||
File|Managers/icons.bmp:File|Managers/ICONS.BMP \
|
File|Managers/icons.bmp:File|Managers/ICONS.BMP \
|
||||||
File|Managers/icons.ini:File|Managers/ICONS.INI \
|
File|Managers/icons.ini:File|Managers/ICONS.INI \
|
||||||
@ -224,7 +232,7 @@ OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \
|
|||||||
fonts/char.mt:FONTS/CHAR.MT \
|
fonts/char.mt:FONTS/CHAR.MT \
|
||||||
games/appdata.dat:GAMES/APPDATA.DAT games/ataka:GAMES/ATAKA \
|
games/appdata.dat:GAMES/APPDATA.DAT games/ataka:GAMES/ATAKA \
|
||||||
games/basekurs.kla:GAMES/BASEKURS.KLA games/bnc:GAMES/BNC \
|
games/basekurs.kla:GAMES/BASEKURS.KLA games/bnc:GAMES/BNC \
|
||||||
games/checkers:GAMES/CHECKERS games/clicks:GAMES/CLICKS \
|
games/checkers:GAMES/CHECKERS \
|
||||||
games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \
|
games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \
|
||||||
games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \
|
games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \
|
||||||
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \
|
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \
|
||||||
@ -258,7 +266,7 @@ fsource=$(call respace,$(call sourcepart,$(f)))
|
|||||||
|
|
||||||
# Define targets for image file.
|
# Define targets for image file.
|
||||||
# Join all the lists above.
|
# Join all the lists above.
|
||||||
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES)
|
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
|
||||||
# For each item in the united list call fbinary.
|
# For each item in the united list call fbinary.
|
||||||
targets:=$(foreach f,$(targets_full),$(fbinary))
|
targets:=$(foreach f,$(targets_full),$(fbinary))
|
||||||
|
|
||||||
@ -333,3 +341,118 @@ include Makefile.copy
|
|||||||
docpak: $(DOCDIR)SYSFUNCR.TXT $(wildcard $(DOCDIR)*)
|
docpak: $(DOCDIR)SYSFUNCR.TXT $(wildcard $(DOCDIR)*)
|
||||||
$(DOCDIR)SYSFUNCR.TXT: $(KERNEL)/docs/sysfuncr.txt
|
$(DOCDIR)SYSFUNCR.TXT: $(KERNEL)/docs/sysfuncr.txt
|
||||||
cp $(KERNEL)/docs/sysfuncr.txt $(DOCDIR)SYSFUNCR.TXT
|
cp $(KERNEL)/docs/sysfuncr.txt $(DOCDIR)SYSFUNCR.TXT
|
||||||
|
|
||||||
|
# Similar for C--.
|
||||||
|
include Makefile.cmm
|
||||||
|
|
||||||
|
# Sorry, even black magic seems to be insufficient for
|
||||||
|
# auto-handling all subtle effects. So we just define
|
||||||
|
# command lines for compiling and linking, and
|
||||||
|
# maintain the list of sources and objects by hand.
|
||||||
|
include Makefile.msvc
|
||||||
|
|
||||||
|
# Rules for table
|
||||||
|
table: .obj.table/table.exe
|
||||||
|
$(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)
|
||||||
|
$(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table
|
||||||
|
$(msvc_compile)
|
||||||
|
.obj.table:
|
||||||
|
mkdir -p .obj.table
|
||||||
|
|
||||||
|
# Rules for graph
|
||||||
|
graph: .obj.graph/graph.exe
|
||||||
|
$(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
|
||||||
|
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)
|
||||||
|
$(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph
|
||||||
|
$(msvc_compile)
|
||||||
|
$(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph
|
||||||
|
$(msvc_compile)
|
||||||
|
$(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph
|
||||||
|
fasm $< $@
|
||||||
|
.obj.graph:
|
||||||
|
mkdir -p .obj.graph
|
||||||
|
|
||||||
|
# Rules for kosilka
|
||||||
|
games/kosilka: .obj.kosilka/kosilka.exe
|
||||||
|
$(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)
|
||||||
|
$(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka
|
||||||
|
$(msvc_compile)
|
||||||
|
.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 \
|
||||||
|
$(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 \
|
||||||
|
$(PROGS)/system/shell/cmd/*.c \
|
||||||
|
$(PROGS)/system/shell/modules/*.c \
|
||||||
|
$(PROGS)/system/shell/locale/rus/globals.h \
|
||||||
|
Makefile.gcc | .obj.shell
|
||||||
|
$(gcc_compile)
|
||||||
|
.obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o: .obj.shell/%.o: \
|
||||||
|
$(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \
|
||||||
|
Makefile.gcc | .obj.shell
|
||||||
|
$(gcc_compile)
|
||||||
|
.obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell
|
||||||
|
fasm $< $@
|
||||||
|
.obj.shell:
|
||||||
|
mkdir -p .obj.shell
|
||||||
|
|
||||||
|
# Rules for media/ac97snd
|
||||||
|
# Not compilable from svn sources, using preloaded binary
|
||||||
|
|
||||||
|
# Rules for atikms.dll
|
||||||
|
# Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon
|
||||||
|
# However, dependencies must be duplicated - I don't know how to avoid this
|
||||||
|
# without need to rebuild kolibri.img at every iteration...
|
||||||
|
# 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 $< $@
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/atikms.dll:
|
||||||
|
flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \
|
||||||
|
$(MAKE) CC=win32-gcc AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon
|
||||||
|
$(REPOSITORY)/drivers/ddk/libddk.a:
|
||||||
|
flock $(REPOSITORY)/drivers/ddk/.lock \
|
||||||
|
$(MAKE) CC=win32-gcc AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk
|
||||||
|
# dependencies
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \
|
||||||
|
$(REPOSITORY)/drivers/ddk/libddk.a \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/*.[Sch] \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/*.asm \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/Makefile \
|
||||||
|
$(REPOSITORY)/drivers/video/drm/radeon/firmware/*.bin \
|
||||||
|
$(REPOSITORY)/drivers/include/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*/*.h
|
||||||
|
$(REPOSITORY)/drivers/ddk/libddk.a: \
|
||||||
|
$(REPOSITORY)/drivers/ddk/Makefile \
|
||||||
|
$(REPOSITORY)/drivers/ddk/*/* \
|
||||||
|
$(REPOSITORY)/drivers/include/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*.h \
|
||||||
|
$(REPOSITORY)/drivers/include/*/*/*/*.h
|
||||||
|
15
data/rus/Makefile.cmm
Normal file
15
data/rus/Makefile.cmm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# This is similar to Makefile.fasm, look there for comments.
|
||||||
|
# No dependency tracking, so force dependencies on all files
|
||||||
|
# in dir/* and dir/*/*
|
||||||
|
# Also, we cannot set output file name and need to guess
|
||||||
|
# whether c-- has created .com file or no-extension file.
|
||||||
|
define cmm_meta_rule
|
||||||
|
$(1): $(2) Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \
|
||||||
|
$$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*)
|
||||||
|
flock $$(dir $(2)).lock \
|
||||||
|
win32-c-- /IP=Z:$$(dir $(2)) Z:$$< >&2 && \
|
||||||
|
if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \
|
||||||
|
kpack --nologo $$$$f "$$@" && rm $$$$f
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach f,$(CMM_PROGRAMS),$(eval $(call cmm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname))))
|
8
data/rus/Makefile.gcc
Normal file
8
data/rus/Makefile.gcc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
define gcc_compile
|
||||||
|
win32-gcc -c -Os -DAUTOBUILD -DLANG_RUS=1 -o $@ $<
|
||||||
|
endef
|
||||||
|
define gcc_link
|
||||||
|
win32-ld -nostdlib -T $(1) -o "$@" $^
|
||||||
|
win32-objcopy "$@" -O binary
|
||||||
|
kpack --nologo "$@"
|
||||||
|
endef
|
13
data/rus/Makefile.msvc
Normal file
13
data/rus/Makefile.msvc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
define msvc_compile
|
||||||
|
win32-cl /c /O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /DAUTOBUILD /Fo$@ Z:$< >&2
|
||||||
|
endef
|
||||||
|
define msvc_link
|
||||||
|
win32-link /section:.bss,E /fixed:no /subsystem:native \
|
||||||
|
/merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text \
|
||||||
|
/entry:crtStartUp /out:$@ /ltcg /nodefaultlib \
|
||||||
|
$(addprefix Z:,$^) >&2
|
||||||
|
endef
|
||||||
|
define msvc_final
|
||||||
|
EXENAME=$< fasm doexe2.asm "$@"
|
||||||
|
kpack --nologo "$@"
|
||||||
|
endef
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
data/rus/graph
BIN
data/rus/graph
Binary file not shown.
BIN
data/rus/shell
BIN
data/rus/shell
Binary file not shown.
BIN
data/rus/table
BIN
data/rus/table
Binary file not shown.
@ -7,7 +7,7 @@ DRV_INCLUDES = $(DRV_TOPDIR)/include
|
|||||||
|
|
||||||
INCLUDES = -I$(DRV_INCLUDES) -I$(DRV_INCLUDES)/linux -I$(DRV_INCLUDES)/linux/asm
|
INCLUDES = -I$(DRV_INCLUDES) -I$(DRV_INCLUDES)/linux -I$(DRV_INCLUDES)/linux/asm
|
||||||
DEFINES = -DKOLIBRI -D__KERNEL__ -DCONFIG_X86_32
|
DEFINES = -DKOLIBRI -D__KERNEL__ -DCONFIG_X86_32
|
||||||
CFLAGS = -c -O2 $(INCLUDES) $(DEFINES) -fomit-frame-pointer -fno-builtin-printf
|
CFLAGS = -c -Os $(INCLUDES) $(DEFINES) -march=i486 -fomit-frame-pointer -fno-builtin-printf
|
||||||
|
|
||||||
NAME:= libddk
|
NAME:= libddk
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
LD = ld
|
||||||
|
AS = as
|
||||||
FASM = e:/fasm/fasm.exe
|
FASM = e:/fasm/fasm.exe
|
||||||
|
|
||||||
DEFINES = -D__KERNEL__ -DCONFIG_X86_32
|
DEFINES = -D__KERNEL__ -DCONFIG_X86_32
|
||||||
@ -13,7 +15,7 @@ DRV_INCLUDES = $(DRV_TOPDIR)/include
|
|||||||
INCLUDES = -I$(DRV_INCLUDES) -I$(DRV_INCLUDES)/drm \
|
INCLUDES = -I$(DRV_INCLUDES) -I$(DRV_INCLUDES)/drm \
|
||||||
-I$(DRV_INCLUDES)/linux
|
-I$(DRV_INCLUDES)/linux
|
||||||
|
|
||||||
CFLAGS = -c -O2 $(INCLUDES) $(DEFINES) -march=i686 -fomit-frame-pointer -fno-builtin-printf
|
CFLAGS = -c -Os $(INCLUDES) $(DEFINES) -march=i486 -fomit-frame-pointer -fno-builtin-printf
|
||||||
|
|
||||||
LIBPATH:= $(DRV_TOPDIR)/ddk
|
LIBPATH:= $(DRV_TOPDIR)/ddk
|
||||||
|
|
||||||
@ -135,15 +137,15 @@ NAME_OBJS = $(patsubst %.S, %.o, $(patsubst %.asm, %.o,\
|
|||||||
|
|
||||||
all: $(NAME).dll
|
all: $(NAME).dll
|
||||||
|
|
||||||
$(NAME).dll: $(NAME_OBJS) $(FW_BINS) $(SRC_DEP) $(HFILES) atikms.lds Makefile
|
$(NAME).dll: $(NAME_OBJS) $(FW_BINS) $(SRC_DEP) $(HFILES) $(LIBPATH)/libcore.a $(LIBPATH)/libddk.a atikms.lds Makefile
|
||||||
ld -L$(LIBPATH) $(LDFLAGS) -T atikms.lds -o $@ $(NAME_OBJS) $(LIBS)
|
$(LD) -L$(LIBPATH) $(LDFLAGS) -T atikms.lds -o $@ $(NAME_OBJS) $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
%.o : %.c $(HFILES) Makefile
|
%.o : %.c $(HFILES) Makefile
|
||||||
$(CC) $(CFLAGS) $(DEFINES) -o $@ $<
|
$(CC) $(CFLAGS) $(DEFINES) -o $@ $<
|
||||||
|
|
||||||
%.o : %.S $(HFILES) Makefile
|
%.o : %.S $(HFILES) Makefile
|
||||||
as -o $@ $<
|
$(AS) -o $@ $<
|
||||||
|
|
||||||
fwblob.o: fwblob.asm $(FW_BINS) Makefile
|
fwblob.o: fwblob.asm $(FW_BINS) Makefile
|
||||||
$(FASM) $< $@
|
$(FASM) $< $@
|
@ -172,146 +172,146 @@ FIRMWARE_R700_RLC db 'radeon/R700_rlc.bin',0
|
|||||||
|
|
||||||
align 16
|
align 16
|
||||||
R100CP_START:
|
R100CP_START:
|
||||||
file 'firmware/r100_cp.bin'
|
file 'firmware/R100_cp.bin'
|
||||||
R100CP_END:
|
R100CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R200CP_START:
|
R200CP_START:
|
||||||
file 'firmware/r200_cp.bin'
|
file 'firmware/R200_cp.bin'
|
||||||
R200CP_END:
|
R200CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R300CP_START:
|
R300CP_START:
|
||||||
file 'firmware/r300_cp.bin'
|
file 'firmware/R300_cp.bin'
|
||||||
R300CP_END:
|
R300CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R420CP_START:
|
R420CP_START:
|
||||||
file 'firmware/r420_cp.bin'
|
file 'firmware/R420_cp.bin'
|
||||||
R420CP_END:
|
R420CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R520CP_START:
|
R520CP_START:
|
||||||
file 'firmware/r520_cp.bin'
|
file 'firmware/R520_cp.bin'
|
||||||
R520CP_END:
|
R520CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RS600CP_START:
|
RS600CP_START:
|
||||||
file 'firmware/rs600_cp.bin'
|
file 'firmware/RS600_cp.bin'
|
||||||
RS600CP_END:
|
RS600CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RS690CP_START:
|
RS690CP_START:
|
||||||
file 'firmware/rs690_cp.bin'
|
file 'firmware/RS690_cp.bin'
|
||||||
RS690CP_END:
|
RS690CP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RS780ME_START:
|
RS780ME_START:
|
||||||
file 'firmware/rs780_me.bin'
|
file 'firmware/RS780_me.bin'
|
||||||
RS780ME_END:
|
RS780ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RS780PFP_START:
|
RS780PFP_START:
|
||||||
file 'firmware/rs780_pfp.bin'
|
file 'firmware/RS780_pfp.bin'
|
||||||
RS780PFP_END:
|
RS780PFP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R600ME_START:
|
R600ME_START:
|
||||||
file 'firmware/r600_me.bin'
|
file 'firmware/R600_me.bin'
|
||||||
R600ME_END:
|
R600ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV610ME_START:
|
RV610ME_START:
|
||||||
file 'firmware/rv610_me.bin'
|
file 'firmware/RV610_me.bin'
|
||||||
RV610ME_END:
|
RV610ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV620ME_START:
|
RV620ME_START:
|
||||||
file 'firmware/rv620_me.bin'
|
file 'firmware/RV620_me.bin'
|
||||||
RV620ME_END:
|
RV620ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV630ME_START:
|
RV630ME_START:
|
||||||
file 'firmware/rv630_me.bin'
|
file 'firmware/RV630_me.bin'
|
||||||
RV630ME_END:
|
RV630ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV635ME_START:
|
RV635ME_START:
|
||||||
file 'firmware/rv635_me.bin'
|
file 'firmware/RV635_me.bin'
|
||||||
RV635ME_END:
|
RV635ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV670ME_START:
|
RV670ME_START:
|
||||||
file 'firmware/rv670_me.bin'
|
file 'firmware/RV670_me.bin'
|
||||||
RV670ME_END:
|
RV670ME_END:
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV710ME_START:
|
RV710ME_START:
|
||||||
file 'firmware/rv710_me.bin'
|
file 'firmware/RV710_me.bin'
|
||||||
RV710ME_END:
|
RV710ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV730ME_START:
|
RV730ME_START:
|
||||||
file 'firmware/rv730_me.bin'
|
file 'firmware/RV730_me.bin'
|
||||||
RV730ME_END:
|
RV730ME_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV770ME_START:
|
RV770ME_START:
|
||||||
file 'firmware/rv770_me.bin'
|
file 'firmware/RV770_me.bin'
|
||||||
RV770ME_END:
|
RV770ME_END:
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV610PFP_START:
|
RV610PFP_START:
|
||||||
file 'firmware/rv610_pfp.bin'
|
file 'firmware/RV610_pfp.bin'
|
||||||
RV610PFP_END:
|
RV610PFP_END:
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV620PFP_START:
|
RV620PFP_START:
|
||||||
file 'firmware/rv620_pfp.bin'
|
file 'firmware/RV620_pfp.bin'
|
||||||
RV620PFP_END:
|
RV620PFP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV630PFP_START:
|
RV630PFP_START:
|
||||||
file 'firmware/rv630_pfp.bin'
|
file 'firmware/RV630_pfp.bin'
|
||||||
RV630PFP_END:
|
RV630PFP_END:
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV635PFP_START:
|
RV635PFP_START:
|
||||||
file 'firmware/rv635_pfp.bin'
|
file 'firmware/RV635_pfp.bin'
|
||||||
RV635PFP_END:
|
RV635PFP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV670PFP_START:
|
RV670PFP_START:
|
||||||
file 'firmware/rv670_pfp.bin'
|
file 'firmware/RV670_pfp.bin'
|
||||||
RV670PFP_END:
|
RV670PFP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV710PFP_START:
|
RV710PFP_START:
|
||||||
file 'firmware/rv710_pfp.bin'
|
file 'firmware/RV710_pfp.bin'
|
||||||
RV710PFP_END:
|
RV710PFP_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV730PFP_START:
|
RV730PFP_START:
|
||||||
file 'firmware/rv730_pfp.bin'
|
file 'firmware/RV730_pfp.bin'
|
||||||
RV730PFP_END:
|
RV730PFP_END:
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
RV770PFP_START:
|
RV770PFP_START:
|
||||||
file 'firmware/rv770_pfp.bin'
|
file 'firmware/RV770_pfp.bin'
|
||||||
RV770PFP_END:
|
RV770PFP_END:
|
||||||
|
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R600RLC_START:
|
R600RLC_START:
|
||||||
file 'firmware/r600_rlc.bin'
|
file 'firmware/R600_rlc.bin'
|
||||||
R600RLC_END:
|
R600RLC_END:
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
R700RLC_START:
|
R700RLC_START:
|
||||||
file 'firmware/r700_rlc.bin'
|
file 'firmware/R700_rlc.bin'
|
||||||
R700RLC_END:
|
R700RLC_END:
|
||||||
|
@ -130,7 +130,7 @@ Dword rtlInterlockedExchange( Dword *target, Dword value );
|
|||||||
// функция -1 завершения процесса
|
// функция -1 завершения процесса
|
||||||
void __declspec(noreturn) kos_ExitApp();
|
void __declspec(noreturn) kos_ExitApp();
|
||||||
// функция 0
|
// функция 0
|
||||||
void kos_DefineAndDrawWindow(
|
void __declspec(noinline) kos_DefineAndDrawWindow(
|
||||||
Word x, Word y,
|
Word x, Word y,
|
||||||
Word sizeX, Word sizeY,
|
Word sizeX, Word sizeY,
|
||||||
Byte mainAreaType, Dword mainAreaColour,
|
Byte mainAreaType, Dword mainAreaColour,
|
||||||
@ -158,11 +158,11 @@ void kos_WriteTextToWindow_internal(Dword pos, Dword font, const char* textPtr,
|
|||||||
kos_WriteTextToWindow_internal(((x)<<16)|(y), ((fontType)<<24)|(textColour), textPtr, textLen)
|
kos_WriteTextToWindow_internal(((x)<<16)|(y), ((fontType)<<24)|(textColour), textPtr, textLen)
|
||||||
#endif
|
#endif
|
||||||
// функция 7 нарисовать изображение
|
// функция 7 нарисовать изображение
|
||||||
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
void __declspec(noinline) kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
||||||
// функция 8 определить кнопку
|
// функция 8 определить кнопку
|
||||||
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
||||||
// функция 5 пауза, в сотых долях секунды
|
// функция 5 пауза, в сотых долях секунды
|
||||||
void __cdecl kos_Pause( Dword value );
|
void __declspec(noinline) __cdecl kos_Pause( Dword value );
|
||||||
// функция 9 - информация о процессе
|
// функция 9 - информация о процессе
|
||||||
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
|
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
|
||||||
// функция 10
|
// функция 10
|
||||||
@ -172,7 +172,7 @@ Dword kos_CheckForEvent();
|
|||||||
// функция 12
|
// функция 12
|
||||||
void __cdecl kos_WindowRedrawStatus( Dword status );
|
void __cdecl kos_WindowRedrawStatus( Dword status );
|
||||||
// функция 13 нарисовать полосу
|
// функция 13 нарисовать полосу
|
||||||
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
||||||
// функция 17
|
// функция 17
|
||||||
bool kos_GetButtonID( Dword &buttonID );
|
bool kos_GetButtonID( Dword &buttonID );
|
||||||
// функция 23
|
// функция 23
|
||||||
@ -189,7 +189,7 @@ void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
|
|||||||
// функция 40 установить маску событий
|
// функция 40 установить маску событий
|
||||||
void kos_SetMaskForEvents( Dword mask );
|
void kos_SetMaskForEvents( Dword mask );
|
||||||
// функция 47 вывести в окно приложения число
|
// функция 47 вывести в окно приложения число
|
||||||
void kos_DisplayNumberToWindow(
|
void __declspec(noinline) kos_DisplayNumberToWindow(
|
||||||
Dword value,
|
Dword value,
|
||||||
Dword digitsNum,
|
Dword digitsNum,
|
||||||
Word x,
|
Word x,
|
||||||
|
@ -59,18 +59,18 @@ int atoi(const char* string)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
double fabs(double x)
|
double __cdecl fabs(double x)
|
||||||
{
|
{
|
||||||
__asm fld x
|
__asm fld x
|
||||||
__asm fabs
|
__asm fabs
|
||||||
}
|
}
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
double cos(double x)
|
double __cdecl cos(double x)
|
||||||
{
|
{
|
||||||
__asm fld x
|
__asm fld x
|
||||||
__asm fcos
|
__asm fcos
|
||||||
}
|
}
|
||||||
double sin(double x)
|
double __cdecl sin(double x)
|
||||||
{
|
{
|
||||||
__asm fld x
|
__asm fld x
|
||||||
__asm fsin
|
__asm fsin
|
||||||
@ -242,12 +242,14 @@ void format( char *Str, int len, char* Format, ... )
|
|||||||
Str[j] = 0;
|
Str[j] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef AUTOBUILD
|
||||||
void *memcpy(void *dst, const void *src, unsigned size)
|
void *memcpy(void *dst, const void *src, unsigned size)
|
||||||
{
|
{
|
||||||
while (size--)
|
while (size--)
|
||||||
*((char*)dst+size) = *((char*)src+size);
|
*((char*)dst+size) = *((char*)src+size);
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int strcmp(const char *s1, const char *s2)
|
int strcmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
|
@ -31,9 +31,9 @@ void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword inver
|
|||||||
void DrawRegion(Dword x,Dword y,Dword width,Dword height,Dword color1);
|
void DrawRegion(Dword x,Dword y,Dword width,Dword height,Dword color1);
|
||||||
int atoi(const char* string);
|
int atoi(const char* string);
|
||||||
|
|
||||||
double fabs(double x);
|
double __cdecl fabs(double x);
|
||||||
double cos(double x);
|
double __cdecl cos(double x);
|
||||||
double sin(double x);
|
double __cdecl sin(double x);
|
||||||
int di(double x);
|
int di(double x);
|
||||||
|
|
||||||
double id(int x);
|
double id(int x);
|
||||||
|
@ -55,7 +55,12 @@ char *HugeBuf = NULL;
|
|||||||
|
|
||||||
//char fuck[64] = "$this is a fucking marker$";
|
//char fuck[64] = "$this is a fucking marker$";
|
||||||
// ïàðàìåòðû êîìàíäíîé ñòðîêè
|
// ïàðàìåòðû êîìàíäíîé ñòðîêè
|
||||||
|
#ifdef AUTOBUILD
|
||||||
|
extern char params[1024];
|
||||||
|
char params[1024];
|
||||||
|
#else
|
||||||
char params[1024] = "_FIND_ME_";
|
char params[1024] = "_FIND_ME_";
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -1,13 +1,44 @@
|
|||||||
#include "kosSyst.h"
|
#include "kosSyst.h"
|
||||||
|
#include "func.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define atexitBufferSize 32
|
#define atexitBufferSize 32
|
||||||
|
|
||||||
|
// Autobuild uses FASM method for exe->kos,
|
||||||
|
// MENUET01 header should be present in EXE.
|
||||||
|
#ifdef AUTOBUILD
|
||||||
|
char kosExePath[1024];
|
||||||
|
char exeStack[16384];
|
||||||
|
extern char params[1024];
|
||||||
|
// must be alphabetically first in the image
|
||||||
|
#pragma data_seg(".1seg")
|
||||||
|
extern "C" struct
|
||||||
|
{
|
||||||
|
char header[8];
|
||||||
|
int headerver;
|
||||||
|
void* entry;
|
||||||
|
void* i_end;
|
||||||
|
void* memsize;
|
||||||
|
void* stack;
|
||||||
|
void* params;
|
||||||
|
void* icon;
|
||||||
|
} header = {
|
||||||
|
{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
|
||||||
|
1,
|
||||||
|
&crtStartUp,
|
||||||
|
0, // filled by doexe2.asm
|
||||||
|
0, // filled by doexe2.asm
|
||||||
|
exeStack + sizeof(exeStack),
|
||||||
|
params,
|
||||||
|
kosExePath
|
||||||
|
};
|
||||||
|
#pragma data_seg()
|
||||||
|
#else
|
||||||
|
char *kosExePath = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
char pureCallMessage[] = "PURE function call!";
|
char pureCallMessage[] = "PURE function call!";
|
||||||
|
|
||||||
char *kosExePath = NULL;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
void (__cdecl *atExitList[atexitBufferSize])();
|
void (__cdecl *atExitList[atexitBufferSize])();
|
||||||
int atExitFnNum = 0;
|
int atExitFnNum = 0;
|
||||||
@ -64,13 +95,13 @@ Dword rtlRand( void )
|
|||||||
return RandomSeed;
|
return RandomSeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _MSC_VER >= 1400
|
#ifdef AUTOBUILD
|
||||||
//
|
// Well, not really related to auto-build, but some compilation issue
|
||||||
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount )
|
void memcpy( void *dst, const void *src, size_t bytesCount )
|
||||||
{
|
{
|
||||||
__asm{
|
__asm{
|
||||||
mov edi, dst
|
mov edi, dst
|
||||||
mov eax, dst
|
// mov eax, dst
|
||||||
mov esi, src
|
mov esi, src
|
||||||
mov ecx, bytesCount
|
mov ecx, bytesCount
|
||||||
rep movsb
|
rep movsb
|
||||||
@ -90,6 +121,7 @@ void memset( Byte *dst, Byte filler, Dword count )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Dword rtlInterlockedExchange( Dword *target, Dword value )
|
Dword rtlInterlockedExchange( Dword *target, Dword value )
|
||||||
{
|
{
|
||||||
@ -817,24 +849,30 @@ int __cdecl _purecall()
|
|||||||
#pragma data_seg(".CRT$XCA")
|
#pragma data_seg(".CRT$XCA")
|
||||||
#pragma data_seg(".CRT$XCZ")
|
#pragma data_seg(".CRT$XCZ")
|
||||||
typedef void (__cdecl *_PVFV)(void);
|
typedef void (__cdecl *_PVFV)(void);
|
||||||
__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
|
//__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
|
||||||
__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
|
//__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
|
||||||
//
|
//
|
||||||
#pragma comment(linker, "/merge:.CRT=.rdata")
|
#pragma comment(linker, "/merge:.CRT=.rdata")
|
||||||
//
|
//
|
||||||
void crtStartUp()
|
void crtStartUp()
|
||||||
{
|
{
|
||||||
|
#ifdef AUTOBUILD
|
||||||
|
// linker will try to remove unused variables; force header to be included
|
||||||
|
header.header;
|
||||||
|
#endif
|
||||||
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
|
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
|
||||||
for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
|
/*for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if ( *pbegin != NULL )
|
if ( *pbegin != NULL )
|
||||||
(**pbegin)();
|
(**pbegin)();
|
||||||
}
|
}*/
|
||||||
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
|
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
|
||||||
rtlSrand( kos_GetSystemClock() );
|
rtlSrand( kos_GetSystemClock() );
|
||||||
|
#ifndef AUTOBUILD
|
||||||
// ïóòü ê ôàéëó ïðîöåññà
|
// ïóòü ê ôàéëó ïðîöåññà
|
||||||
kosExePath = *((char **)0x20);
|
kosExePath = *((char **)0x20);
|
||||||
|
#endif
|
||||||
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
|
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
|
||||||
kos_Main();
|
kos_Main();
|
||||||
// âûõîä
|
// âûõîä
|
||||||
|
@ -32,10 +32,10 @@ typedef unsigned __int8 Byte;
|
|||||||
|
|
||||||
#define abs(a) (a<0?0-a:a)
|
#define abs(a) (a<0?0-a:a)
|
||||||
|
|
||||||
extern "C" double acos(double x);
|
extern "C" double __cdecl acos(double x);
|
||||||
extern "C" double asin(double x);
|
extern "C" double __cdecl asin(double x);
|
||||||
extern "C" double floor(double x);
|
extern "C" double __cdecl floor(double x);
|
||||||
extern "C" double round(double x);
|
extern "C" double __cdecl round(double x);
|
||||||
#pragma function(acos,asin)
|
#pragma function(acos,asin)
|
||||||
#if _MSC_VER > 1200
|
#if _MSC_VER > 1200
|
||||||
#pragma function(floor)
|
#pragma function(floor)
|
||||||
@ -101,8 +101,10 @@ union sProcessInfo
|
|||||||
} processInfo;
|
} processInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef AUTOBUILD
|
||||||
//
|
//
|
||||||
extern char *kosExePath;
|
extern char *kosExePath;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
void crtStartUp();
|
void crtStartUp();
|
||||||
@ -119,9 +121,12 @@ int __cdecl strlen( const char *line );
|
|||||||
char * __cdecl strrchr( const char * string, int c );
|
char * __cdecl strrchr( const char * string, int c );
|
||||||
|
|
||||||
#if _MSC_VER < 1400
|
#if _MSC_VER < 1400
|
||||||
//extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
||||||
//extern "C" void memset( Byte *dst, Byte filler, Dword count );
|
extern "C" void memset( Byte *dst, Byte filler, Dword count );
|
||||||
//#pragma intrinsic(memcpy,memset)
|
//#pragma intrinsic(memcpy,memset)
|
||||||
|
#elif defined AUTOBUILD
|
||||||
|
void memcpy( void *dst, const void *src, size_t bytesCount );
|
||||||
|
void memset( Byte *dst, Byte filler, Dword count );
|
||||||
#else
|
#else
|
||||||
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
||||||
void memset( Byte *dst, Byte filler, Dword count );
|
void memset( Byte *dst, Byte filler, Dword count );
|
||||||
@ -147,7 +152,7 @@ bool kos_GetKey( Byte &keyCode );
|
|||||||
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
|
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
|
||||||
Dword kos_GetSystemClock();
|
Dword kos_GetSystemClock();
|
||||||
// ôóíêöèÿ 4
|
// ôóíêöèÿ 4
|
||||||
void kos_WriteTextToWindow(
|
void __declspec(noinline) kos_WriteTextToWindow(
|
||||||
Word x, Word y,
|
Word x, Word y,
|
||||||
Byte fontType,
|
Byte fontType,
|
||||||
Dword textColour,
|
Dword textColour,
|
||||||
@ -157,7 +162,7 @@ void kos_WriteTextToWindow(
|
|||||||
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
|
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
|
||||||
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
||||||
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
|
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
|
||||||
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
||||||
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
|
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
|
||||||
void kos_Pause( Dword value );
|
void kos_Pause( Dword value );
|
||||||
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
|
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
|
||||||
@ -169,7 +174,7 @@ Dword kos_CheckForEvent();
|
|||||||
// ôóíêöèÿ 12
|
// ôóíêöèÿ 12
|
||||||
void kos_WindowRedrawStatus( Dword status );
|
void kos_WindowRedrawStatus( Dword status );
|
||||||
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
|
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
|
||||||
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
||||||
// ôóíêöèÿ 17
|
// ôóíêöèÿ 17
|
||||||
bool kos_GetButtonID( Dword &buttonID );
|
bool kos_GetButtonID( Dword &buttonID );
|
||||||
// ôóíêöèÿ 23
|
// ôóíêöèÿ 23
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "kosSyst.h"
|
#include "kosSyst.h"
|
||||||
extern "C" int _fltused = 0;
|
extern "C" int _fltused = 0;
|
||||||
double acos(double x)
|
double __cdecl acos(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -15,7 +15,7 @@ double acos(double x)
|
|||||||
fpatan
|
fpatan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double asin(double x)
|
double __cdecl asin(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -43,7 +43,7 @@ extern "C" double _ftol(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
double ceil(double x)
|
double __cdecl ceil(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -56,7 +56,7 @@ double ceil(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double floor(double x)
|
double __cdecl floor(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -69,7 +69,7 @@ double floor(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double round(double x)
|
double __cdecl round(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
|
@ -18,17 +18,17 @@
|
|||||||
#define ERR_BADVARIABLE -5
|
#define ERR_BADVARIABLE -5
|
||||||
#define ERR_OVERFLOW -6
|
#define ERR_OVERFLOW -6
|
||||||
|
|
||||||
double tg(double d)
|
double __cdecl tg(double d)
|
||||||
{
|
{
|
||||||
return sin(d) / cos(d);
|
return sin(d) / cos(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ctg(double d)
|
double __cdecl ctg(double d)
|
||||||
{
|
{
|
||||||
return cos(d) / sin(d);
|
return cos(d) / sin(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
double exp(double x)
|
double __cdecl exp(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld x
|
fld x
|
||||||
@ -49,7 +49,7 @@ double exp(double x)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double log(double x)
|
double __cdecl log(double x)
|
||||||
{
|
{
|
||||||
//return 0.0;
|
//return 0.0;
|
||||||
__asm {
|
__asm {
|
||||||
@ -61,7 +61,7 @@ double log(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double sqrt(double x)
|
double __cdecl sqrt(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld x
|
fld x
|
||||||
@ -69,7 +69,7 @@ double sqrt(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double atan(double x)
|
double __cdecl atan(double x)
|
||||||
{
|
{
|
||||||
return 0.0; // â ëîì
|
return 0.0; // â ëîì
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ double pow(double x, double y)
|
|||||||
|
|
||||||
|
|
||||||
// represents general mathematical function
|
// represents general mathematical function
|
||||||
typedef double(*matfunc)(double);
|
typedef double(__cdecl*matfunc)(double);
|
||||||
|
|
||||||
// used to link function name to the function
|
// used to link function name to the function
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
|
#ifndef AUTOBUILD
|
||||||
void* memset(void *mem, int c, unsigned size)
|
void* memset(void *mem, int c, unsigned size)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -109,3 +110,4 @@ char* strchr(const char* string, int c)
|
|||||||
return (char*)0;
|
return (char*)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
|
||||||
|
#ifndef AUTOBUILD
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
|
||||||
void* memset(void *mem, int c, unsigned size);
|
void* memset(void *mem, int c, unsigned size);
|
||||||
void* memcpy(void *dst, const void *src, unsigned size);
|
void* memcpy(void *dst, const void *src, unsigned size);
|
||||||
|
int strlen(const char* string);
|
||||||
|
#endif
|
||||||
|
|
||||||
void strcat(char strDest[], char strSource[]);
|
void strcat(char strDest[], char strSource[]);
|
||||||
int strcmp(const char* string1, const char* string2);
|
int strcmp(const char* string1, const char* string2);
|
||||||
//void strcpy(char strDest[], const char strSource[]);
|
//void strcpy(char strDest[], const char strSource[]);
|
||||||
char* strncpy(char *strDest, const char *strSource, unsigned n);
|
char* strncpy(char *strDest, const char *strSource, unsigned n);
|
||||||
int strlen(const char* string);
|
|
||||||
char *strchr(const char* string, int c);
|
char *strchr(const char* string, int c);
|
||||||
|
@ -4,11 +4,40 @@
|
|||||||
|
|
||||||
#define atexitBufferSize 32
|
#define atexitBufferSize 32
|
||||||
|
|
||||||
|
// Autobuild uses FASM method for exe->kos,
|
||||||
|
// MENUET01 header should be present in EXE.
|
||||||
|
#ifdef AUTOBUILD
|
||||||
|
char kosExePath[1024];
|
||||||
|
char exeStack[16384];
|
||||||
|
// must be alphabetically first in the image
|
||||||
|
#pragma data_seg(".1seg")
|
||||||
|
extern "C" struct
|
||||||
|
{
|
||||||
|
char header[8];
|
||||||
|
int headerver;
|
||||||
|
void* entry;
|
||||||
|
void* i_end;
|
||||||
|
void* memsize;
|
||||||
|
void* stack;
|
||||||
|
void* params;
|
||||||
|
void* icon;
|
||||||
|
} header = {
|
||||||
|
{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
|
||||||
|
1,
|
||||||
|
&crtStartUp,
|
||||||
|
0, // filled by doexe2.asm
|
||||||
|
0, // filled by doexe2.asm
|
||||||
|
exeStack + sizeof(exeStack),
|
||||||
|
NULL,
|
||||||
|
kosExePath
|
||||||
|
};
|
||||||
|
#pragma data_seg()
|
||||||
|
#else
|
||||||
|
char *kosExePath = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
char pureCallMessage[] = "PURE function call!";
|
char pureCallMessage[] = "PURE function call!";
|
||||||
|
|
||||||
char *kosExePath = NULL;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
void (__cdecl *atExitList[atexitBufferSize])();
|
void (__cdecl *atExitList[atexitBufferSize])();
|
||||||
int atExitFnNum = 0;
|
int atExitFnNum = 0;
|
||||||
@ -65,12 +94,13 @@ Dword rtlRand( void )
|
|||||||
return RandomSeed;
|
return RandomSeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AUTOBUILD
|
||||||
/*void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount )
|
// Well, not really related to auto-build, but some compilation issue
|
||||||
|
void memcpy( void *dst, const void *src, size_t bytesCount )
|
||||||
{
|
{
|
||||||
__asm{
|
__asm{
|
||||||
mov edi, dst
|
mov edi, dst
|
||||||
mov eax, dst
|
// mov eax, dst
|
||||||
mov esi, src
|
mov esi, src
|
||||||
mov ecx, bytesCount
|
mov ecx, bytesCount
|
||||||
rep movsb
|
rep movsb
|
||||||
@ -87,7 +117,8 @@ void memset( Byte *dst, Byte filler, Dword count )
|
|||||||
mov ecx, count
|
mov ecx, count
|
||||||
rep stosb
|
rep stosb
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -867,24 +898,32 @@ int __cdecl _purecall()
|
|||||||
#pragma data_seg(".CRT$XCA")
|
#pragma data_seg(".CRT$XCA")
|
||||||
#pragma data_seg(".CRT$XCZ")
|
#pragma data_seg(".CRT$XCZ")
|
||||||
typedef void (__cdecl *_PVFV)(void);
|
typedef void (__cdecl *_PVFV)(void);
|
||||||
__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
|
//__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
|
||||||
__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
|
//__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
|
||||||
//
|
//
|
||||||
|
extern void ALMOST_HALF_init();
|
||||||
#pragma comment(linker, "/merge:.CRT=.rdata")
|
#pragma comment(linker, "/merge:.CRT=.rdata")
|
||||||
//
|
//
|
||||||
void crtStartUp()
|
void crtStartUp()
|
||||||
{
|
{
|
||||||
|
#ifdef AUTOBUILD
|
||||||
|
// linker will try to remove unused variables; force header to be included
|
||||||
|
header.header;
|
||||||
|
#endif
|
||||||
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
|
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
|
||||||
for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
|
/*for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if ( *pbegin != NULL )
|
if ( *pbegin != NULL )
|
||||||
(**pbegin)();
|
(**pbegin)();
|
||||||
}
|
}*/
|
||||||
|
ALMOST_HALF_init();
|
||||||
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
|
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
|
||||||
rtlSrand( kos_GetSystemClock() );
|
rtlSrand( kos_GetSystemClock() );
|
||||||
|
#ifndef AUTOBUILD
|
||||||
// ïóòü ê ôàéëó ïðîöåññà
|
// ïóòü ê ôàéëó ïðîöåññà
|
||||||
kosExePath = *((char **)0x20);
|
kosExePath = *((char **)0x20);
|
||||||
|
#endif
|
||||||
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
|
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
|
||||||
kos_Main();
|
kos_Main();
|
||||||
// âûõîä
|
// âûõîä
|
||||||
|
@ -32,10 +32,10 @@ typedef unsigned __int8 Byte;
|
|||||||
|
|
||||||
#define abs(a) (a<0?0-a:a)
|
#define abs(a) (a<0?0-a:a)
|
||||||
|
|
||||||
extern "C" double acos(double x);
|
extern "C" double __cdecl acos(double x);
|
||||||
extern "C" double asin(double x);
|
extern "C" double __cdecl asin(double x);
|
||||||
extern "C" double floor(double x);
|
extern "C" double __cdecl floor(double x);
|
||||||
extern "C" double round(double x);
|
extern "C" double __cdecl round(double x);
|
||||||
#pragma function(acos,asin)
|
#pragma function(acos,asin)
|
||||||
#if _MSC_VER > 1200
|
#if _MSC_VER > 1200
|
||||||
#pragma function(floor)
|
#pragma function(floor)
|
||||||
@ -101,8 +101,10 @@ union sProcessInfo
|
|||||||
} processInfo;
|
} processInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef AUTOBUILD
|
||||||
//
|
//
|
||||||
extern char *kosExePath;
|
extern char *kosExePath;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
void crtStartUp();
|
void crtStartUp();
|
||||||
@ -122,6 +124,9 @@ char * __cdecl strrchr( const char * string, int c );
|
|||||||
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
||||||
extern "C" void memset( Byte *dst, Byte filler, Dword count );
|
extern "C" void memset( Byte *dst, Byte filler, Dword count );
|
||||||
//#pragma intrinsic(memcpy,memset)
|
//#pragma intrinsic(memcpy,memset)
|
||||||
|
#elif defined AUTOBUILD
|
||||||
|
void memcpy( void *dst, const void *src, size_t bytesCount );
|
||||||
|
void memset( Byte *dst, Byte filler, Dword count );
|
||||||
#else
|
#else
|
||||||
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
|
||||||
void memset( Byte *dst, Byte filler, Dword count );
|
void memset( Byte *dst, Byte filler, Dword count );
|
||||||
@ -147,7 +152,7 @@ bool kos_GetKey( Byte &keyCode );
|
|||||||
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
|
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
|
||||||
Dword kos_GetSystemClock();
|
Dword kos_GetSystemClock();
|
||||||
// ôóíêöèÿ 4
|
// ôóíêöèÿ 4
|
||||||
void kos_WriteTextToWindow(
|
void __declspec(noinline) kos_WriteTextToWindow(
|
||||||
Word x, Word y,
|
Word x, Word y,
|
||||||
Byte fontType,
|
Byte fontType,
|
||||||
Dword textColour,
|
Dword textColour,
|
||||||
@ -157,7 +162,7 @@ void kos_WriteTextToWindow(
|
|||||||
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
|
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
|
||||||
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
|
||||||
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
|
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
|
||||||
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
|
||||||
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
|
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
|
||||||
void kos_Pause( Dword value );
|
void kos_Pause( Dword value );
|
||||||
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
|
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
|
||||||
@ -169,7 +174,7 @@ Dword kos_CheckForEvent();
|
|||||||
// ôóíêöèÿ 12
|
// ôóíêöèÿ 12
|
||||||
void kos_WindowRedrawStatus( Dword status );
|
void kos_WindowRedrawStatus( Dword status );
|
||||||
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
|
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
|
||||||
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
|
||||||
// ôóíêöèÿ 17
|
// ôóíêöèÿ 17
|
||||||
bool kos_GetButtonID( Dword &buttonID );
|
bool kos_GetButtonID( Dword &buttonID );
|
||||||
// ôóíêöèÿ 23
|
// ôóíêöèÿ 23
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "kosSyst.h"
|
#include "kosSyst.h"
|
||||||
extern "C" int _fltused = 0;
|
extern "C" int _fltused = 0;
|
||||||
double acos(double x)
|
double __cdecl acos(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -15,7 +15,7 @@ double acos(double x)
|
|||||||
fpatan
|
fpatan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double asin(double x)
|
double __cdecl asin(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -43,7 +43,7 @@ extern "C" double _ftol(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
double ceil(double x)
|
double __cdecl ceil(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -56,7 +56,7 @@ double ceil(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double floor(double x)
|
double __cdecl floor(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
@ -69,7 +69,7 @@ double floor(double x)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double round(double x)
|
double __cdecl round(double x)
|
||||||
{
|
{
|
||||||
__asm {
|
__asm {
|
||||||
fld qword ptr [esp+4]
|
fld qword ptr [esp+4]
|
||||||
|
@ -260,7 +260,10 @@ double func_round(double val)
|
|||||||
__asm fild x
|
__asm fild x
|
||||||
}
|
}
|
||||||
|
|
||||||
const double ALMOST_HALF = 0.5 - epsilon;
|
//const double ALMOST_HALF = 0.5 - epsilon;
|
||||||
|
double ALMOST_HALF;
|
||||||
|
extern void ALMOST_HALF_init(void)
|
||||||
|
{ ALMOST_HALF = 0.5 - epsilon; }
|
||||||
double func_floor(double val)
|
double func_floor(double val)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
|
||||||
/// ===========================================================
|
/// ===========================================================
|
||||||
|
|
||||||
|
#ifndef AUTOBUILD
|
||||||
|
// autobuild does not create lang.h, but defines LANG_{RUS,ENG} directly
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "system/boolean.h"
|
#include "system/boolean.h"
|
||||||
#include "system/kolibri.h"
|
#include "system/kolibri.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user