diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de74700 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.out +*.o diff --git a/nasm.asm b/asm1/lab3/nasm.asm similarity index 100% rename from nasm.asm rename to asm1/lab3/nasm.asm diff --git a/лаб3_отчёт.docx b/asm1/lab3/report.docx similarity index 100% rename from лаб3_отчёт.docx rename to asm1/lab3/report.docx diff --git a/лабораторная 3.1.docx b/asm1/lab3/task.docx similarity index 100% rename from лабораторная 3.1.docx rename to asm1/lab3/task.docx diff --git a/asm2/example_c_asm_and_coproc/compile.sh b/asm2/example_c_asm_and_coproc/compile.sh new file mode 100644 index 0000000..d64273a --- /dev/null +++ b/asm2/example_c_asm_and_coproc/compile.sh @@ -0,0 +1 @@ +nasm sum.asm -f elf && gcc main.c sum.o -m32 diff --git a/asm2/example_c_asm_and_coproc/main.c b/asm2/example_c_asm_and_coproc/main.c new file mode 100644 index 0000000..8f3fd3a --- /dev/null +++ b/asm2/example_c_asm_and_coproc/main.c @@ -0,0 +1,18 @@ +/* +Copyright 2020 KoroLion (github.com/KoroLion) +*/ + +#include + +float sum(float a, float b); + +int main() { + float a, b; + scanf("%f %f", &a, &b); + + float c = sum(a, b); + + printf("%f\n", c); + + return 0; +} diff --git a/asm2/example_c_asm_and_coproc/sum.asm b/asm2/example_c_asm_and_coproc/sum.asm new file mode 100644 index 0000000..007b43e --- /dev/null +++ b/asm2/example_c_asm_and_coproc/sum.asm @@ -0,0 +1,19 @@ +; Copyright 2020 KoroLion (github.com/KoroLion) + +global sum + +section .data +section .bss + temp: resb 4 + +section .text + +; sum(x, y) +sum: + finit + fld dword [esp + 4] ; = x + fadd dword [esp + 8] ; += y + fst dword [temp] ; [temp] = st0 + + mov eax, [temp] + ret