69 lines
1.2 KiB
Plaintext
69 lines
1.2 KiB
Plaintext
snippet string "Assembler string definition"
|
|
${1:Name} db ${2:"Hello World!"} ; string $1 = $2
|
|
len_$1 equ $ - $1 ; length of string $1
|
|
$0
|
|
endsnippet
|
|
|
|
snippet \n "Zeilenumbruch" A
|
|
", 0x0a, "
|
|
endsnippet
|
|
|
|
snippet write "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 exit "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 read "read sys call"
|
|
mov eax, 3 ; read sys call
|
|
mov ebx, 2 ; stdin file descriptor
|
|
mov ecx, ${1: variable} ; read input value in $1
|
|
mov edx, ${2:5} ; read $2 bytes of data
|
|
int 0x80 ; system interrupt
|
|
endsnippet
|
|
|
|
snippet aprstore "Store all purpose register on stack"
|
|
; store ap-register
|
|
push eax
|
|
push ebx
|
|
push ecx
|
|
push edx
|
|
$0
|
|
endsnippet
|
|
|
|
snippet aprload "Load all purpose register from stack"
|
|
; load ap-register
|
|
pop eax
|
|
pop ebx
|
|
pop ecx
|
|
pop edx
|
|
$0
|
|
endsnippet
|
|
|