Corrected problem in Makefile snippets for assembly

This commit is contained in:
Yannick Reiß 2023-10-08 08:59:18 +02:00
parent fc9dcc1441
commit 73be9d0cb1
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
2 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,6 @@
snippet string "Assembler string definition"
snippet string "Assembler string definition"
${1:Name} db ${2:"Hello World!"} ; string $1 = $2
len_$1 equ $ - $1 ; length of string $1
len_$1 equ $ - $1 ; length of string $1
$0
endsnippet
@ -8,7 +8,7 @@ snippet \n "Zeilenumbruch" A
", 0x0a, "
endsnippet
snippet write "write sys_call"
snippet write "write sys_call"
mov eax, 4 ; write sys_call
mov ebx, 1 ; write to stdout
mov ecx, ${1:string} ; string to write
@ -17,13 +17,13 @@ int 0x80 ; system interrupt
$0
endsnippet
snippet exit "exit sys_call"
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"
snippet template "Template for assembly program"
global ${1:_start} ; linker entry point
; Author: ${2: Yannick Reiß}
; Date: `date`
@ -40,15 +40,15 @@ $1:
$0
endsnippet
snippet read "read sys call"
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
int 0x80 ; system interrupt
endsnippet
snippet aprstore "Store all purpose register on stack"
snippet aprstore "Store all purpose register on stack"
; store ap-register
push eax
push ebx
@ -57,7 +57,7 @@ push edx
$0
endsnippet
snippet aprload "Load all purpose register from stack"
snippet aprload "Load all purpose register from stack"
; load ap-register
pop eax
pop ebx
@ -66,3 +66,14 @@ pop edx
$0
endsnippet
snippet gcc_function "GCC conform function implementation" b
$1:
push %ebp
mov %esp, %ebp
$2
mov %ebp, %esp
pop %ebp
ret
endsnippet

View File

@ -81,7 +81,7 @@ endsnippet
snippet buildobj "Build an executable from object files." b
${1:\$(BIN)}: ${2:\$(OBJECTS)}
${3:\$(LD)} -o \$@ \$^
${3:\$(CC)} -o \$@ \$^ ${4:\$(LDFLAGS)}
endsnippet
snippet ctoobj "Build object from C file." b
@ -96,12 +96,12 @@ endsnippet
snippet astoobj "Build object from assembly file." b
%.o: ${1:\$(ASFDIR)}%.S
${2:\$(AS)} ${3:\$(CFLAGS)} -o \$@ -c \$<
${2:\$(AS)} ${3:\$(ASFLAGS)} -o \$@ -c \$<
endsnippet
snippet asmtoobj "Build object from assembly file." b
%.o: ${1:\$(ASFDIR)}%.asm
${2:\$(AS)} ${3:\$(CFLAGS)} -o \$@ -c \$<
${2:\$(AS)} ${3:\$(ASFLAGS)} -o \$@ -c \$<
endsnippet
snippet rule "Add new Rule"