diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d203bc9..052dedc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ jobs: strategy: matrix: build: + - assembly - bun - clang - crystal @@ -61,7 +62,7 @@ jobs: curl -fsSL https://crystal-lang.org/install.sh | sudo bash sudo apt-get update - sudo apt-get install -y build-essential cargo clang curl erlang gfortran haskell-platform jq kotlin moreutils nodejs php rustc scala tar wget xz-utils + sudo apt-get install -y build-essential cargo clang curl erlang gfortran haskell-platform jq kotlin moreutils nasm nodejs php rustc scala tar wget xz-utils cargo install timers cargo install hyperfine cargo install ripgrep --features 'pcre2' diff --git a/count.asm b/count.asm new file mode 100644 index 0000000..2e71c4d --- /dev/null +++ b/count.asm @@ -0,0 +1,25 @@ +section .data +format db "%d", 10, 0 + +section .text +extern printf +global _start + +_start: + xor ecx, ecx + +start_loop: + inc ecx + cmp ecx, 1000000000 + jl start_loop + + ; print + mov rdi, format ; rdi: first argument + mov esi, ecx ; esi: second argument + xor eax, eax ; number of vector registers used is 0 + call printf + + ; exit + mov eax, 60 ; system call number for exit + xor edi, edi ; exit code 0 + syscall diff --git a/justfile b/justfile index d9fd88c..8b124ce 100644 --- a/justfile +++ b/justfile @@ -107,3 +107,8 @@ build-erlang: (_check "erlc erl") build-crystal: (_check "crystal") echo 'crystal run ./count.cr' > CMD + +build-assembly: (_check "nasm") + nasm -f elf64 count.asm + ld count.o -o count -lc -I/lib64/ld-linux-x86-64.so.2 + echo './count' > CMD