Last active
October 17, 2020 23:27
-
-
Save romirk/d9c67745f8e072009f440c60c5139b95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VS Code Snippets for GNU Assembly | |
// by Romir Kulshrestha <http://github.com/romirk> | |
{ | |
"main": { | |
"prefix": "main", | |
"body": [ | |
".bss", | |
".data", | |
".text", | |
"", | |
".global main", | |
"", | |
"main:", | |
"\tpush\t%rbp", | |
"\tmovq\t%rsp, %rbp", | |
"", | |
"\t${0:$BLOCK_COMMENT_START hello, world! $BLOCK_COMMENT_END}", | |
"", | |
"\tmovq\t%rbp, %rsp", | |
"\tpop\t\t%rbp\n" | |
], | |
"description": "Main function and epilogue" | |
}, | |
"label": { | |
"prefix": "label", | |
"body": "${1:label}:\n\t$0" | |
}, | |
"function": { | |
"prefix": "function", | |
"body": [ | |
"${1:function}:", | |
"\tpush\t%rbp", | |
"\tmovq\t%rsp, %rbp", | |
"", | |
"\t${0:$BLOCK_COMMENT_START body $BLOCK_COMMENT_END}", | |
"", | |
"\tmovq\t%rbp, %rsp", | |
"\tpop\t\t%rbp\n" | |
] | |
}, | |
"headers": { | |
"prefix": "headers", | |
"body": [ | |
".bss", | |
"${1}", | |
".data", | |
"${2}", | |
".text", | |
"", | |
"$0" | |
] | |
}, | |
"section": { | |
"prefix": "section", | |
"body": [ | |
"${1|.bss,.data,.text|}", | |
"$0\n" | |
] | |
}, | |
"global": { | |
"prefix": ["global", ".global"], | |
"body": ".global\t$0\n" | |
}, | |
"skip": { | |
"prefix": "skip", | |
"body": "${1:block}:\t.skip ${2:0}" | |
}, | |
"for": { | |
"prefix": "for", | |
"body": [ | |
"movq\t$${1:0}, ${2:%rbx}", | |
"", | |
"${3:forloop}:", | |
"\ttest\t$2, $2", | |
"\tje\t\t${4:end$3}", | |
"", | |
"\t${0:$BLOCK_COMMENT_START body $BLOCK_COMMENT_END}", | |
"", | |
"\tdecq\t$2", | |
"\tjmp\t\t$3", | |
"", | |
"${4:end$3}:" | |
] | |
}, | |
"loop": { | |
"prefix": "loop", | |
"body": [ | |
"${1:loop}:", | |
"\t$0", | |
"\tjmp\t\t$1" | |
] | |
}, | |
"include": { | |
"prefix": ["include", ".include"], | |
"body": ".include\t\"${0:filename.s}\"" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment