50 lines
878 B
Plaintext
50 lines
878 B
Plaintext
snippet string86 "Assembler string definition"
|
|
${1:Name} db ${2:"Hello World!"} ; string $1 = $2
|
|
len_$1 equ $ - $1 ; length of string $1
|
|
$0
|
|
endsnippet
|
|
|
|
snippet write86 "write sys_call"
|
|
mov eax, 4 ; write sys_call
|
|
mov ebx, 1 ; write to stdout
|
|
mov ecx, ${1:string} ; string to write
|
|
mov edx, len_$1 ; length of $1
|
|
int 0x80 ; system interrupt
|
|
$0
|
|
endsnippet
|
|
|
|
snippet exit86 "exit sys_call"
|
|
mov eax, 1 ; exit sys_call
|
|
mov ebx, ${1:0} ; exit Code
|
|
int 0x80 ; system interrupt$0
|
|
endsnippet
|
|
|
|
snippet template "Template for assembly program"
|
|
global ${1:_start} ; linker entry point
|
|
; Author: ${2: Yannick Reiß}
|
|
; Date: `date`
|
|
; Description: ${3:Desciption}
|
|
|
|
section .data
|
|
$4
|
|
|
|
section .bss
|
|
$5
|
|
|
|
section .text
|
|
$1:
|
|
$0
|
|
endsnippet
|
|
|
|
snippet functionGCC "GCC conform function implementation" b
|
|
$1:
|
|
push %ebp
|
|
mov %esp, %ebp
|
|
|
|
$2
|
|
|
|
mov %ebp, %esp
|
|
pop %ebp
|
|
ret
|
|
endsnippet
|