Create learn asm repo

Repository for learning assembly language
This commit is contained in:
2025-05-24 11:05:24 +03:00
commit 9165f49e62
20 changed files with 188 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
https://asmtutor.com/
https://www.chromium.org/chromium-os/developer-library/reference/linux-constants/syscalls/#x86-32-bit
Executable
BIN
View File
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
; Lesson 1
; nasm -f elf l1.asm
; ld -m elf_i386 l1.o -o l1
SECTION .data
msg db 'Hello, World!', 0Ah
SECTION .text
global _start
_start:
mov edx, 13
mov ecx, msg
mov ebx, 1
mov eax, 4
int 80h
BIN
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
SECTION .data
msg db 'cat!', 0Ah
SECTION .text
global _start
_start:
mov edx, 5
mov ecx, msg
mov ebx, 1
mov eax, 4
int 80h
mov ebx, 0
mov eax, 1
int 80h
BIN
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
SECTION .data
msg db 'Le Chat!', 0Ah
SECTION .text
global _start
_start:
mov ebx, msg
mov eax, ebx
nextchar:
cmp byte [eax], 0
jz finished
inc eax
jmp nextchar
finished:
sub eax, ebx
mov edx, eax
mov ecx, msg
mov ebx, 1
mov eax, 4
int 80h
mov ebx, 0
mov eax, 1
int 80h
BIN
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
SECTION .data
msg db 'Le Chat!', 0Ah
SECTION .text
global _start
_start:
mov ecx, msg
mov edx, ecx
nextchar:
cmp byte [edx], 0
jz finished
inc edx
jmp nextchar
finished:
sub edx, ecx
mov ebx, 1
mov eax, 4
int 80h
mov ebx, 0
mov eax, 1
int 80h
BIN
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
SECTION .data
msg db 'A cat!', 0Ah
SECTION .text
global _start
_start:
mov edx, msg
call strlen
mov ecx, msg
mov ebx, 1
mov eax, 4
int 80h
mov ebx, 0
mov eax, 1
int 80h
strlen:
push ebx
mov ebx, edx
nextchar:
cmp byte [edx], 0
jz finished
inc edx
jmp nextchar
finished:
sub edx, ebx
pop ebx
ret
BIN
View File
Binary file not shown.
Executable
BIN
View File
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
%include '../lib/fl.asm'
SECTION .data
msg1 db 'Cats and', 0Ah
msg2 db 'Dogs', 0Ah
SECTION .text
global _start
_start:
mov eax, msg1
call sprint
mov eax, msg2
call sprint
call quit
BIN
View File
Binary file not shown.
+45
View File
@@ -0,0 +1,45 @@
slen:
push ebx
mov ebx, eax
nextchar:
cmp byte [eax], 0
jz finished
inc eax
jmp nextchar
finished:
sub eax, ebx
pop ebx
ret
sprint:
push edx
push ecx
push ebx
push eax
call slen
mov edx, eax
pop eax
mov ecx, eax
mov ebx, 1
mov eax, 4
int 80h
pop ebx
pop ecx
pop edx
ret
quit:
mov ebx, 0
mov eax, 1
int 80h
ret