Compare commits

1 Commits

Author SHA1 Message Date
5709c50700 testing 2025-10-10 22:16:15 -04:00
3 changed files with 16 additions and 48 deletions

View File

@@ -1,3 +1,3 @@
# asm
x86 assembly exercises using [asmtutor.com](https://asmtutor.com)
Build x86_64 assembly examples from [asmtutor.com](https://asmtutor.com)

View File

@@ -1,39 +0,0 @@
SYS_EXIT equ 1
SYS_WRITE equ 4
STDOUT equ 1
strlen:
push ebx
mov ebx, eax
nextchar:
cmp byte[eax], 0
jz finished
inc eax
jmp nextchar
finished:
sub eax, ebx
pop ebx
ret
print:
push ebx
push ecx
push edx
mov ebx, eax
call strlen
mov edx, eax
mov ecx, ebx
mov ebx, STDOUT
mov eax, SYS_WRITE
int 0x80
pop edx
pop ecx
pop ebx
ret
quit:
mov ebx, 0
mov eax, SYS_EXIT
int 0x80

View File

@@ -1,15 +1,22 @@
%include 'functions.asm'
; %include 'functions.asm'
SYS_EXIT equ 1
SYS_WRITE equ 4
STDOUT equ 1
section .data
msg1 db "Hello, world!", 0x0A, 0x00
msg2 db "Display a line of text", 0x0A, 0x00
msg db "Hello, world!", 0Ah
section .text
global _start
_start:
mov eax, msg1
call print
mov eax, msg2
call print
call quit
mov edx, 14
mov ecx, msg
mov ebx, STDOUT
mov eax, SYS_WRITE
int 0x80
mov ebx, 0
mov eax, SYS_EXIT
int 0x80