Skip to content

Instantly share code, notes, and snippets.

@beardhatcode
Created March 24, 2014 10:39
Show Gist options
  • Save beardhatcode/9737954 to your computer and use it in GitHub Desktop.
Save beardhatcode/9737954 to your computer and use it in GitHub Desktop.
Assembly syntax highlighting
\usepackage{listings}
\usepackage{color}
\usepackage{float}
\definecolor{lightgray}{rgb}{0.95, 0.95, 0.95}
\definecolor{darkgray}{rgb}{0.4, 0.4, 0.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}
% Shamelessly stolen from: http://tex.stackexchange.com/a/22992/37828
\lstdefinelanguage{Assembler}[x86masm]{Assembler}{%
comment=[l]{\#}
,morekeywords={rax,rbx,rcx,rdx,rip,rdi,rsi,rsp,subq,decl,movq,movl,xorl,imull,popq}%
,morekeywords=[2]{.file,.section,.string,.text,.globl,.cfi_startproc,.cfi_def_cfa_offset,.cfi_endproc,.size,.ident}%
}
\lstset{language=Assembler}
\lstset{%
% General design
backgroundcolor=\color{lightgray},
basicstyle={\small\ttfamily},
frame=l,
% Code design
identifierstyle=\color{black},
keywordstyle=\color{blue}\bfseries,
ndkeywordstyle=\color{greenCode}\bfseries,
stringstyle=\color{ocherCode}\ttfamily,
commentstyle=\color{purple}\ttfamily,
% Code
language={Assembler},
tabsize=2,
showtabs=false,
showspaces=false,
showstringspaces=false,
extendedchars=true,
breaklines=true,
% line-numbers
xleftmargin={0.75cm},
numbers=left,
stepnumber=1,
firstnumber=1,
numberfirstline=true,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment