Skip to content

Instantly share code, notes, and snippets.

@SuperV1234 SuperV1234/test.asm
Created May 5, 2014

Embed
What would you like to do?
x86 print/write tests
section .data
str: db 100
section .bss
section .text
global _start
_start:
mov eax, 3 ; Read user input into str
mov ebx, 0 ; | <- read source (0=stdin)
mov ecx, str ; | <- destination
mov edx, 100 ; | <- length
int 80h ; \___
mov eax, 4 ; Print 100 bytes starting from str
mov ebx, 1 ; | <- print target (1=stdout)
mov ecx, str ; | <- source
mov edx, 100 ; | <- length
int 80h ; \___
mov eax, 1 ; Return
mov ebx, 0 ; | <- return code
int 80h ; \___
; mov eax, 5 ; Open file
; mov ebx, filename ; |
; mov ecx, 1 ; | <- method (0=RDONLY, 1=WRONLY, 2=RDWR, ...)
; mov edx, 400h ; | <- permissions?
; int 80h ; \___
; mov eax, 4 ; Printing
; mov ebx, eax ; | <- print target
; mov ecx, text ; | <- source (what to print)
; mov edx, length ; | <- length
; int 80h ; \___
; mov eax, 6 ; Close file
; int 80h ; \___
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.