├── .gitignore ├── Makefile ├── README.md ├── UNLICENSE └── nasm-mode.el /.gitignore: -------------------------------------------------------------------------------- 1 | *.elc 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .POSIX: 2 | .SUFFIXES: .el .elc 3 | EMACS = emacs 4 | 5 | compile: nasm-mode.elc 6 | 7 | clean: 8 | rm -f nasm-mode.elc 9 | 10 | .el.elc: 11 | $(EMACS) -Q -batch -f batch-byte-compile $< 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nasm-mode 2 | 3 | `nasm-mode` is a major mode for editing [NASM][nasm] x86 assembly 4 | programs. It includes syntax highlighting, automatic indentation, and 5 | imenu integration. Unlike Emacs' generic `asm-mode`, it understands 6 | NASM-specific syntax. Requires Emacs 24.3 or higher. 7 | 8 | The instruction and keyword lists are from NASM 2.12.01. 9 | 10 | ## Known Issues 11 | 12 | * Due to limitations of Emacs' syntax tables, like many other major 13 | modes, double and single quoted strings don't properly handle 14 | backslashes, which, unlike backquoted strings, aren't escapes in 15 | NASM syntax. 16 | 17 | 18 | [nasm]: http://www.nasm.us/ 19 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /nasm-mode.el: -------------------------------------------------------------------------------- 1 | ;;; nasm-mode.el --- NASM x86 assembly major mode -*- lexical-binding: t; -*- 2 | 3 | ;; This is free and unencumbered software released into the public domain. 4 | 5 | ;; Author: Christopher Wellons 6 | ;; URL: https://github.com/skeeto/nasm-mode 7 | ;; Version: 1.1.1 8 | ;; Package-Requires: ((emacs "24.3")) 9 | 10 | ;;; Commentary: 11 | 12 | ;; A major mode for editing NASM x86 assembly programs. It includes 13 | ;; syntax highlighting, automatic indentation, and imenu integration. 14 | ;; Unlike Emacs' generic `asm-mode`, it understands NASM-specific 15 | ;; syntax. 16 | 17 | ;; NASM Home: http://www.nasm.us/ 18 | 19 | ;; Labels without colons are not recognized as labels by this mode, 20 | ;; since, without a parser equal to that of NASM itself, it's 21 | ;; otherwise ambiguous between macros and labels. This covers both 22 | ;; indentation and imenu support. 23 | 24 | ;; The keyword lists are up to date as of NASM 2.12.01. 25 | ;; http://www.nasm.us/doc/nasmdocb.html 26 | 27 | ;; TODO: 28 | ;; [ ] Line continuation awareness 29 | ;; [x] Don't run comment command if type ';' inside a string 30 | ;; [ ] Nice multi-; comments, like in asm-mode 31 | ;; [x] Be able to hit tab after typing mnemonic and insert a TAB 32 | ;; [ ] Autocompletion 33 | ;; [ ] Help menu with basic summaries of instructions 34 | ;; [ ] Highlight errors, e.g. size mismatches "mov al, dword [rbx]" 35 | ;; [ ] Work nicely with outline-minor-mode 36 | ;; [ ] Highlighting of multiline macro definition arguments 37 | 38 | ;;; Code: 39 | 40 | (require 'imenu) 41 | 42 | (defgroup nasm-mode () 43 | "Options for `nasm-mode'." 44 | :group 'languages) 45 | 46 | (defgroup nasm-mode-faces () 47 | "Faces used by `nasm-mode'." 48 | :group 'nasm-mode) 49 | 50 | (defcustom nasm-basic-offset (default-value 'tab-width) 51 | "Indentation level for `nasm-mode'." 52 | :type 'integer 53 | :group 'nasm-mode) 54 | 55 | (defcustom nasm-after-mnemonic-whitespace :tab 56 | "In `nasm-mode', determines the whitespace to use after mnemonics. 57 | This can be :tab, :space, or nil (do nothing)." 58 | :type '(choice (const :tab) (const :space) (const nil)) 59 | :group 'nasm-mode) 60 | 61 | (defface nasm-registers 62 | '((t :inherit (font-lock-variable-name-face))) 63 | "Face for registers." 64 | :group 'nasm-mode-faces) 65 | 66 | (defface nasm-prefix 67 | '((t :inherit (font-lock-builtin-face))) 68 | "Face for prefix." 69 | :group 'nasm-mode-faces) 70 | 71 | (defface nasm-types 72 | '((t :inherit (font-lock-type-face))) 73 | "Face for types." 74 | :group 'nasm-mode-faces) 75 | 76 | (defface nasm-instructions 77 | '((t :inherit (font-lock-builtin-face))) 78 | "Face for instructions." 79 | :group 'nasm-mode-faces) 80 | 81 | (defface nasm-directives 82 | '((t :inherit (font-lock-keyword-face))) 83 | "Face for directives." 84 | :group 'nasm-mode-faces) 85 | 86 | (defface nasm-preprocessor 87 | '((t :inherit (font-lock-preprocessor-face))) 88 | "Face for preprocessor directives." 89 | :group 'nasm-mode-faces) 90 | 91 | (defface nasm-labels 92 | '((t :inherit (font-lock-function-name-face))) 93 | "Face for nonlocal labels." 94 | :group 'nasm-mode-faces) 95 | 96 | (defface nasm-local-labels 97 | '((t :inherit (font-lock-function-name-face))) 98 | "Face for local labels." 99 | :group 'nasm-mode-faces) 100 | 101 | (defface nasm-section-name 102 | '((t :inherit (font-lock-type-face))) 103 | "Face for section name face." 104 | :group 'nasm-mode-faces) 105 | 106 | (defface nasm-constant 107 | '((t :inherit (font-lock-constant-face))) 108 | "Face for constant." 109 | :group 'nasm-mode-faces) 110 | 111 | (eval-and-compile 112 | (defconst nasm-registers 113 | '("ah" "al" "ax" "bh" "bl" "bnd0" "bnd1" "bnd2" "bnd3" "bp" "bpl" 114 | "bx" "ch" "cl" "cr0" "cr1" "cr10" "cr11" "cr12" "cr13" "cr14" 115 | "cr15" "cr2" "cr3" "cr4" "cr5" "cr6" "cr7" "cr8" "cr9" "cs" "cx" 116 | "dh" "di" "dil" "dl" "dr0" "dr1" "dr10" "dr11" "dr12" "dr13" 117 | "dr14" "dr15" "dr2" "dr3" "dr4" "dr5" "dr6" "dr7" "dr8" "dr9" "ds" 118 | "dx" "eax" "ebp" "ebx" "ecx" "edi" "edx" "es" "esi" "esp" "fs" 119 | "gs" "k0" "k1" "k2" "k3" "k4" "k5" "k6" "k7" "mm0" "mm1" "mm2" 120 | "mm3" "mm4" "mm5" "mm6" "mm7" "r10" "r10b" "r10d" "r10w" "r11" 121 | "r11b" "r11d" "r11w" "r12" "r12b" "r12d" "r12w" "r13" "r13b" 122 | "r13d" "r13w" "r14" "r14b" "r14d" "r14w" "r15" "r15b" "r15d" 123 | "r15w" "r8" "r8b" "r8d" "r8w" "r9" "r9b" "r9d" "r9w" "rax" "rbp" 124 | "rbx" "rcx" "rdi" "rdx" "rsi" "rsp" "segr6" "segr7" "si" "sil" 125 | "sp" "spl" "ss" "st0" "st1" "st2" "st3" "st4" "st5" "st6" "st7" 126 | "tr0" "tr1" "tr2" "tr3" "tr4" "tr5" "tr6" "tr7" "xmm0" "xmm1" 127 | "xmm10" "xmm11" "xmm12" "xmm13" "xmm14" "xmm15" "xmm16" "xmm17" 128 | "xmm18" "xmm19" "xmm2" "xmm20" "xmm21" "xmm22" "xmm23" "xmm24" 129 | "xmm25" "xmm26" "xmm27" "xmm28" "xmm29" "xmm3" "xmm30" "xmm31" 130 | "xmm4" "xmm5" "xmm6" "xmm7" "xmm8" "xmm9" "ymm0" "ymm1" "ymm10" 131 | "ymm11" "ymm12" "ymm13" "ymm14" "ymm15" "ymm16" "ymm17" "ymm18" 132 | "ymm19" "ymm2" "ymm20" "ymm21" "ymm22" "ymm23" "ymm24" "ymm25" 133 | "ymm26" "ymm27" "ymm28" "ymm29" "ymm3" "ymm30" "ymm31" "ymm4" 134 | "ymm5" "ymm6" "ymm7" "ymm8" "ymm9" "zmm0" "zmm1" "zmm10" "zmm11" 135 | "zmm12" "zmm13" "zmm14" "zmm15" "zmm16" "zmm17" "zmm18" "zmm19" 136 | "zmm2" "zmm20" "zmm21" "zmm22" "zmm23" "zmm24" "zmm25" "zmm26" 137 | "zmm27" "zmm28" "zmm29" "zmm3" "zmm30" "zmm31" "zmm4" "zmm5" 138 | "zmm6" "zmm7" "zmm8" "zmm9") 139 | "NASM registers (reg.c) for `nasm-mode'.")) 140 | 141 | (eval-and-compile 142 | (defconst nasm-directives 143 | '("absolute" "bits" "common" "cpu" "debug" "default" "extern" 144 | "float" "global" "list" "section" "segment" "warning" "sectalign" 145 | "export" "group" "import" "library" "map" "module" "org" "osabi" 146 | "safeseh" "uppercase") 147 | "NASM directives (directiv.c) for `nasm-mode'.")) 148 | 149 | (eval-and-compile 150 | (defconst nasm-instructions 151 | '("aaa" "aad" "aam" "aas" "adc" "adcx" "add" "addpd" "addps" 152 | "addsd" "addss" "addsubpd" "addsubps" "adox" "aesdec" 153 | "aesdeclast" "aesenc" "aesenclast" "aesimc" "aeskeygenassist" 154 | "and" "andn" "andnpd" "andnps" "andpd" "andps" "arpl" 155 | "bb0_reset" "bb1_reset" "bextr" "blcfill" "blci" "blcic" 156 | "blcmsk" "blcs" "blendpd" "blendps" "blendvpd" "blendvps" 157 | "blsfill" "blsi" "blsic" "blsmsk" "blsr" "bndcl" "bndcn" "bndcu" 158 | "bndldx" "bndmk" "bndmov" "bndstx" "bound" "bsf" "bsr" "bswap" 159 | "bt" "btc" "btr" "bts" "bzhi" "call" "cbw" "cdq" "cdqe" "clac" 160 | "clc" "cld" "clflush" "clflushopt" "clgi" "cli" "clts" "clzero" 161 | "cmc" "cmova" "cmovae" "cmovb" "cmovbe" "cmovc" "cmove" "cmovg" 162 | "cmovge" "cmovl" "cmovle" "cmovna" "cmovnae" "cmovnb" "cmovnbe" 163 | "cmovnc" "cmovne" "cmovng" "cmovnge" "cmovnl" "cmovnle" "cmovno" 164 | "cmovnp" "cmovns" "cmovnz" "cmovo" "cmovp" "cmovpe" "cmovpo" 165 | "cmovs" "cmovz" "cmp" "cmpeqpd" "cmpeqps" "cmpeqsd" "cmpeqss" 166 | "cmplepd" "cmpleps" "cmplesd" "cmpless" "cmpltpd" "cmpltps" 167 | "cmpltsd" "cmpltss" "cmpneqpd" "cmpneqps" "cmpneqsd" "cmpneqss" 168 | "cmpnlepd" "cmpnleps" "cmpnlesd" "cmpnless" "cmpnltpd" 169 | "cmpnltps" "cmpnltsd" "cmpnltss" "cmpordpd" "cmpordps" 170 | "cmpordsd" "cmpordss" "cmppd" "cmpps" "cmpsb" "cmpsd" "cmpsq" 171 | "cmpss" "cmpsw" "cmpunordpd" "cmpunordps" "cmpunordsd" 172 | "cmpunordss" "cmpxchg" "cmpxchg16b" "cmpxchg486" "cmpxchg8b" 173 | "comisd" "comiss" "cpu_read" "cpu_write" "cpuid" "cqo" "crc32" 174 | "cvtdq2pd" "cvtdq2ps" "cvtpd2dq" "cvtpd2pi" "cvtpd2ps" 175 | "cvtpi2pd" "cvtpi2ps" "cvtps2dq" "cvtps2pd" "cvtps2pi" 176 | "cvtsd2si" "cvtsd2ss" "cvtsi2sd" "cvtsi2ss" "cvtss2sd" 177 | "cvtss2si" "cvttpd2dq" "cvttpd2pi" "cvttps2dq" "cvttps2pi" 178 | "cvttsd2si" "cvttss2si" "cwd" "cwde" "daa" "das" "db" "dd" "dec" 179 | "div" "divpd" "divps" "divsd" "divss" "dmint" "do" "dppd" "dpps" 180 | "dq" "dt" "dw" "dy" "dz" "emms" "enter" "equ" "extractps" 181 | "extrq" "f2xm1" "fabs" "fadd" "faddp" "fbld" "fbstp" "fchs" 182 | "fclex" "fcmovb" "fcmovbe" "fcmove" "fcmovnb" "fcmovnbe" 183 | "fcmovne" "fcmovnu" "fcmovu" "fcom" "fcomi" "fcomip" "fcomp" 184 | "fcompp" "fcos" "fdecstp" "fdisi" "fdiv" "fdivp" "fdivr" 185 | "fdivrp" "femms" "feni" "ffree" "ffreep" "fiadd" "ficom" 186 | "ficomp" "fidiv" "fidivr" "fild" "fimul" "fincstp" "finit" 187 | "fist" "fistp" "fisttp" "fisub" "fisubr" "fld" "fld1" "fldcw" 188 | "fldenv" "fldl2e" "fldl2t" "fldlg2" "fldln2" "fldpi" "fldz" 189 | "fmul" "fmulp" "fnclex" "fndisi" "fneni" "fninit" "fnop" 190 | "fnsave" "fnstcw" "fnstenv" "fnstsw" "fpatan" "fprem" "fprem1" 191 | "fptan" "frndint" "frstor" "fsave" "fscale" "fsetpm" "fsin" 192 | "fsincos" "fsqrt" "fst" "fstcw" "fstenv" "fstp" "fstsw" "fsub" 193 | "fsubp" "fsubr" "fsubrp" "ftst" "fucom" "fucomi" "fucomip" 194 | "fucomp" "fucompp" "fwait" "fxam" "fxch" "fxrstor" "fxrstor64" 195 | "fxsave" "fxsave64" "fxtract" "fyl2x" "fyl2xp1" "getsec" 196 | "haddpd" "haddps" "hint_nop0" "hint_nop1" "hint_nop10" 197 | "hint_nop11" "hint_nop12" "hint_nop13" "hint_nop14" "hint_nop15" 198 | "hint_nop16" "hint_nop17" "hint_nop18" "hint_nop19" "hint_nop2" 199 | "hint_nop20" "hint_nop21" "hint_nop22" "hint_nop23" "hint_nop24" 200 | "hint_nop25" "hint_nop26" "hint_nop27" "hint_nop28" "hint_nop29" 201 | "hint_nop3" "hint_nop30" "hint_nop31" "hint_nop32" "hint_nop33" 202 | "hint_nop34" "hint_nop35" "hint_nop36" "hint_nop37" "hint_nop38" 203 | "hint_nop39" "hint_nop4" "hint_nop40" "hint_nop41" "hint_nop42" 204 | "hint_nop43" "hint_nop44" "hint_nop45" "hint_nop46" "hint_nop47" 205 | "hint_nop48" "hint_nop49" "hint_nop5" "hint_nop50" "hint_nop51" 206 | "hint_nop52" "hint_nop53" "hint_nop54" "hint_nop55" "hint_nop56" 207 | "hint_nop57" "hint_nop58" "hint_nop59" "hint_nop6" "hint_nop60" 208 | "hint_nop61" "hint_nop62" "hint_nop63" "hint_nop7" "hint_nop8" 209 | "hint_nop9" "hlt" "hsubpd" "hsubps" "ibts" "icebp" "idiv" "imul" 210 | "in" "inc" "incbin" "insb" "insd" "insertps" "insertq" "insw" 211 | "int" "int01" "int03" "int1" "int3" "into" "invd" "invept" 212 | "invlpg" "invlpga" "invpcid" "invvpid" "iret" "iretd" "iretq" 213 | "iretw" "ja" "jae" "jb" "jbe" "jc" "jcxz" "je" "jecxz" "jg" 214 | "jge" "jl" "jle" "jmp" "jmpe" "jna" "jnae" "jnb" "jnbe" "jnc" 215 | "jne" "jng" "jnge" "jnl" "jnle" "jno" "jnp" "jns" "jnz" "jo" 216 | "jp" "jpe" "jpo" "jrcxz" "js" "jz" "kaddb" "kaddd" "kaddq" 217 | "kaddw" "kandb" "kandd" "kandnb" "kandnd" "kandnq" "kandnw" 218 | "kandq" "kandw" "kmovb" "kmovd" "kmovq" "kmovw" "knotb" "knotd" 219 | "knotq" "knotw" "korb" "kord" "korq" "kortestb" "kortestd" 220 | "kortestq" "kortestw" "korw" "kshiftlb" "kshiftld" "kshiftlq" 221 | "kshiftlw" "kshiftrb" "kshiftrd" "kshiftrq" "kshiftrw" "ktestb" 222 | "ktestd" "ktestq" "ktestw" "kunpckbw" "kunpckdq" "kunpckwd" 223 | "kxnorb" "kxnord" "kxnorq" "kxnorw" "kxorb" "kxord" "kxorq" 224 | "kxorw" "lahf" "lar" "lddqu" "ldmxcsr" "lds" "lea" "leave" "les" 225 | "lfence" "lfs" "lgdt" "lgs" "lidt" "lldt" "llwpcb" "lmsw" 226 | "loadall" "loadall286" "lodsb" "lodsd" "lodsq" "lodsw" "loop" 227 | "loope" "loopne" "loopnz" "loopz" "lsl" "lss" "ltr" "lwpins" 228 | "lwpval" "lzcnt" "maskmovdqu" "maskmovq" "maxpd" "maxps" "maxsd" 229 | "maxss" "mfence" "minpd" "minps" "minsd" "minss" "monitor" "monitorx" 230 | "montmul" "mov" "movapd" "movaps" "movbe" "movd" "movddup" 231 | "movdq2q" "movdqa" "movdqu" "movhlps" "movhpd" "movhps" 232 | "movlhps" "movlpd" "movlps" "movmskpd" "movmskps" "movntdq" 233 | "movntdqa" "movnti" "movntpd" "movntps" "movntq" "movntsd" 234 | "movntss" "movq" "movq2dq" "movsb" "movsd" "movshdup" "movsldup" 235 | "movsq" "movss" "movsw" "movsx" "movsxd" "movupd" "movups" 236 | "movzx" "mpsadbw" "mul" "mulpd" "mulps" "mulsd" "mulss" "mulx" 237 | "mwait" "mwaitx" "neg" "nop" "not" "or" "orpd" "orps" "out" "outsb" 238 | "outsd" "outsw" "pabsb" "pabsd" "pabsw" "packssdw" "packsswb" 239 | "packusdw" "packuswb" "paddb" "paddd" "paddq" "paddsb" "paddsiw" 240 | "paddsw" "paddusb" "paddusw" "paddw" "palignr" "pand" "pandn" 241 | "pause" "paveb" "pavgb" "pavgusb" "pavgw" "pblendvb" "pblendw" 242 | "pclmulhqhqdq" "pclmulhqlqdq" "pclmullqhqdq" "pclmullqlqdq" 243 | "pclmulqdq" "pcmpeqb" "pcmpeqd" "pcmpeqq" "pcmpeqw" "pcmpestri" 244 | "pcmpestrm" "pcmpgtb" "pcmpgtd" "pcmpgtq" "pcmpgtw" "pcmpistri" 245 | "pcmpistrm" "pdep" "pdistib" "pext" "pextrb" "pextrd" "pextrq" 246 | "pextrw" "pf2id" "pf2iw" "pfacc" "pfadd" "pfcmpeq" "pfcmpge" 247 | "pfcmpgt" "pfmax" "pfmin" "pfmul" "pfnacc" "pfpnacc" "pfrcp" 248 | "pfrcpit1" "pfrcpit2" "pfrcpv" "pfrsqit1" "pfrsqrt" "pfrsqrtv" 249 | "pfsub" "pfsubr" "phaddd" "phaddsw" "phaddw" "phminposuw" 250 | "phsubd" "phsubsw" "phsubw" "pi2fd" "pi2fw" "pinsrb" "pinsrd" 251 | "pinsrq" "pinsrw" "pmachriw" "pmaddubsw" "pmaddwd" "pmagw" 252 | "pmaxsb" "pmaxsd" "pmaxsw" "pmaxub" "pmaxud" "pmaxuw" "pminsb" 253 | "pminsd" "pminsw" "pminub" "pminud" "pminuw" "pmovmskb" 254 | "pmovsxbd" "pmovsxbq" "pmovsxbw" "pmovsxdq" "pmovsxwd" 255 | "pmovsxwq" "pmovzxbd" "pmovzxbq" "pmovzxbw" "pmovzxdq" 256 | "pmovzxwd" "pmovzxwq" "pmuldq" "pmulhriw" "pmulhrsw" "pmulhrwa" 257 | "pmulhrwc" "pmulhuw" "pmulhw" "pmulld" "pmullw" "pmuludq" 258 | "pmvgezb" "pmvlzb" "pmvnzb" "pmvzb" "pop" "popa" "popad" "popaw" 259 | "popcnt" "popf" "popfd" "popfq" "popfw" "por" "prefetch" 260 | "prefetchnta" "prefetcht0" "prefetcht1" "prefetcht2" "prefetchw" 261 | "prefetchwt1" "psadbw" "pshufb" "pshufd" "pshufhw" "pshuflw" 262 | "pshufw" "psignb" "psignd" "psignw" "pslld" "pslldq" "psllq" 263 | "psllw" "psrad" "psraw" "psrld" "psrldq" "psrlq" "psrlw" "psubb" 264 | "psubd" "psubq" "psubsb" "psubsiw" "psubsw" "psubusb" "psubusw" 265 | "psubw" "pswapd" "ptest" "punpckhbw" "punpckhdq" "punpckhqdq" 266 | "punpckhwd" "punpcklbw" "punpckldq" "punpcklqdq" "punpcklwd" 267 | "push" "pusha" "pushad" "pushaw" "pushf" "pushfd" "pushfq" 268 | "pushfw" "pxor" "rcl" "rcpps" "rcpss" "rcr" "rdfsbase" 269 | "rdgsbase" "rdm" "rdmsr" "rdpmc" "rdrand" "rdseed" "rdshr" 270 | "rdtsc" "rdtscp" "resb" "resd" "reso" "resq" "rest" "resw" 271 | "resy" "resz" "ret" "retf" "retn" "rol" "ror" "rorx" "roundpd" 272 | "roundps" "roundsd" "roundss" "rsdc" "rsldt" "rsm" "rsqrtps" 273 | "rsqrtss" "rsts" "sahf" "sal" "salc" "sar" "sarx" "sbb" "scasb" 274 | "scasd" "scasq" "scasw" "seta" "setae" "setb" "setbe" "setc" 275 | "sete" "setg" "setge" "setl" "setle" "setna" "setnae" "setnb" 276 | "setnbe" "setnc" "setne" "setng" "setnge" "setnl" "setnle" 277 | "setno" "setnp" "setns" "setnz" "seto" "setp" "setpe" "setpo" 278 | "sets" "setz" "sfence" "sgdt" "sha1msg1" "sha1msg2" "sha1nexte" 279 | "sha1rnds4" "sha256msg1" "sha256msg2" "sha256rnds2" "shl" "shld" 280 | "shlx" "shr" "shrd" "shrx" "shufpd" "shufps" "sidt" "skinit" 281 | "sldt" "slwpcb" "smi" "smint" "smintold" "smsw" "sqrtpd" 282 | "sqrtps" "sqrtsd" "sqrtss" "stac" "stc" "std" "stgi" "sti" 283 | "stmxcsr" "stosb" "stosd" "stosq" "stosw" "str" "sub" "subpd" 284 | "subps" "subsd" "subss" "svdc" "svldt" "svts" "swapgs" "syscall" 285 | "sysenter" "sysexit" "sysret" "t1mskc" "test" "tzcnt" "tzmsk" 286 | "ucomisd" "ucomiss" "ud0" "ud1" "ud2" "ud2a" "ud2b" "umov" 287 | "unpckhpd" "unpckhps" "unpcklpd" "unpcklps" "vaddpd" "vaddps" 288 | "vaddsd" "vaddss" "vaddsubpd" "vaddsubps" "vaesdec" 289 | "vaesdeclast" "vaesenc" "vaesenclast" "vaesimc" 290 | "vaeskeygenassist" "valignd" "valignq" "vandnpd" "vandnps" 291 | "vandpd" "vandps" "vblendmpd" "vblendmps" "vblendpd" "vblendps" 292 | "vblendvpd" "vblendvps" "vbroadcastf128" "vbroadcastf32x2" 293 | "vbroadcastf32x4" "vbroadcastf32x8" "vbroadcastf64x2" 294 | "vbroadcastf64x4" "vbroadcasti128" "vbroadcasti32x2" 295 | "vbroadcasti32x4" "vbroadcasti32x8" "vbroadcasti64x2" 296 | "vbroadcasti64x4" "vbroadcastsd" "vbroadcastss" "vcmpeq_ospd" 297 | "vcmpeq_osps" "vcmpeq_ossd" "vcmpeq_osss" "vcmpeq_uqpd" 298 | "vcmpeq_uqps" "vcmpeq_uqsd" "vcmpeq_uqss" "vcmpeq_uspd" 299 | "vcmpeq_usps" "vcmpeq_ussd" "vcmpeq_usss" "vcmpeqpd" "vcmpeqps" 300 | "vcmpeqsd" "vcmpeqss" "vcmpfalse_oqpd" "vcmpfalse_oqps" 301 | "vcmpfalse_oqsd" "vcmpfalse_oqss" "vcmpfalse_ospd" 302 | "vcmpfalse_osps" "vcmpfalse_ossd" "vcmpfalse_osss" "vcmpfalsepd" 303 | "vcmpfalseps" "vcmpfalsesd" "vcmpfalsess" "vcmpge_oqpd" 304 | "vcmpge_oqps" "vcmpge_oqsd" "vcmpge_oqss" "vcmpge_ospd" 305 | "vcmpge_osps" "vcmpge_ossd" "vcmpge_osss" "vcmpgepd" "vcmpgeps" 306 | "vcmpgesd" "vcmpgess" "vcmpgt_oqpd" "vcmpgt_oqps" "vcmpgt_oqsd" 307 | "vcmpgt_oqss" "vcmpgt_ospd" "vcmpgt_osps" "vcmpgt_ossd" 308 | "vcmpgt_osss" "vcmpgtpd" "vcmpgtps" "vcmpgtsd" "vcmpgtss" 309 | "vcmple_oqpd" "vcmple_oqps" "vcmple_oqsd" "vcmple_oqss" 310 | "vcmple_ospd" "vcmple_osps" "vcmple_ossd" "vcmple_osss" 311 | "vcmplepd" "vcmpleps" "vcmplesd" "vcmpless" "vcmplt_oqpd" 312 | "vcmplt_oqps" "vcmplt_oqsd" "vcmplt_oqss" "vcmplt_ospd" 313 | "vcmplt_osps" "vcmplt_ossd" "vcmplt_osss" "vcmpltpd" "vcmpltps" 314 | "vcmpltsd" "vcmpltss" "vcmpneq_oqpd" "vcmpneq_oqps" 315 | "vcmpneq_oqsd" "vcmpneq_oqss" "vcmpneq_ospd" "vcmpneq_osps" 316 | "vcmpneq_ossd" "vcmpneq_osss" "vcmpneq_uqpd" "vcmpneq_uqps" 317 | "vcmpneq_uqsd" "vcmpneq_uqss" "vcmpneq_uspd" "vcmpneq_usps" 318 | "vcmpneq_ussd" "vcmpneq_usss" "vcmpneqpd" "vcmpneqps" 319 | "vcmpneqsd" "vcmpneqss" "vcmpnge_uqpd" "vcmpnge_uqps" 320 | "vcmpnge_uqsd" "vcmpnge_uqss" "vcmpnge_uspd" "vcmpnge_usps" 321 | "vcmpnge_ussd" "vcmpnge_usss" "vcmpngepd" "vcmpngeps" 322 | "vcmpngesd" "vcmpngess" "vcmpngt_uqpd" "vcmpngt_uqps" 323 | "vcmpngt_uqsd" "vcmpngt_uqss" "vcmpngt_uspd" "vcmpngt_usps" 324 | "vcmpngt_ussd" "vcmpngt_usss" "vcmpngtpd" "vcmpngtps" 325 | "vcmpngtsd" "vcmpngtss" "vcmpnle_uqpd" "vcmpnle_uqps" 326 | "vcmpnle_uqsd" "vcmpnle_uqss" "vcmpnle_uspd" "vcmpnle_usps" 327 | "vcmpnle_ussd" "vcmpnle_usss" "vcmpnlepd" "vcmpnleps" 328 | "vcmpnlesd" "vcmpnless" "vcmpnlt_uqpd" "vcmpnlt_uqps" 329 | "vcmpnlt_uqsd" "vcmpnlt_uqss" "vcmpnlt_uspd" "vcmpnlt_usps" 330 | "vcmpnlt_ussd" "vcmpnlt_usss" "vcmpnltpd" "vcmpnltps" 331 | "vcmpnltsd" "vcmpnltss" "vcmpord_qpd" "vcmpord_qps" 332 | "vcmpord_qsd" "vcmpord_qss" "vcmpord_spd" "vcmpord_sps" 333 | "vcmpord_ssd" "vcmpord_sss" "vcmpordpd" "vcmpordps" "vcmpordsd" 334 | "vcmpordss" "vcmppd" "vcmpps" "vcmpsd" "vcmpss" "vcmptrue_uqpd" 335 | "vcmptrue_uqps" "vcmptrue_uqsd" "vcmptrue_uqss" "vcmptrue_uspd" 336 | "vcmptrue_usps" "vcmptrue_ussd" "vcmptrue_usss" "vcmptruepd" 337 | "vcmptrueps" "vcmptruesd" "vcmptruess" "vcmpunord_qpd" 338 | "vcmpunord_qps" "vcmpunord_qsd" "vcmpunord_qss" "vcmpunord_spd" 339 | "vcmpunord_sps" "vcmpunord_ssd" "vcmpunord_sss" "vcmpunordpd" 340 | "vcmpunordps" "vcmpunordsd" "vcmpunordss" "vcomisd" "vcomiss" 341 | "vcompresspd" "vcompressps" "vcvtdq2pd" "vcvtdq2ps" "vcvtpd2dq" 342 | "vcvtpd2ps" "vcvtpd2qq" "vcvtpd2udq" "vcvtpd2uqq" "vcvtph2ps" 343 | "vcvtps2dq" "vcvtps2pd" "vcvtps2ph" "vcvtps2qq" "vcvtps2udq" 344 | "vcvtps2uqq" "vcvtqq2pd" "vcvtqq2ps" "vcvtsd2si" "vcvtsd2ss" 345 | "vcvtsd2usi" "vcvtsi2sd" "vcvtsi2ss" "vcvtss2sd" "vcvtss2si" 346 | "vcvtss2usi" "vcvttpd2dq" "vcvttpd2qq" "vcvttpd2udq" 347 | "vcvttpd2uqq" "vcvttps2dq" "vcvttps2qq" "vcvttps2udq" 348 | "vcvttps2uqq" "vcvttsd2si" "vcvttsd2usi" "vcvttss2si" 349 | "vcvttss2usi" "vcvtudq2pd" "vcvtudq2ps" "vcvtuqq2pd" 350 | "vcvtuqq2ps" "vcvtusi2sd" "vcvtusi2ss" "vdbpsadbw" "vdivpd" 351 | "vdivps" "vdivsd" "vdivss" "vdppd" "vdpps" "verr" "verw" 352 | "vexp2pd" "vexp2ps" "vexpandpd" "vexpandps" "vextractf128" 353 | "vextractf32x4" "vextractf32x8" "vextractf64x2" "vextractf64x4" 354 | "vextracti128" "vextracti32x4" "vextracti32x8" "vextracti64x2" 355 | "vextracti64x4" "vextractps" "vfixupimmpd" "vfixupimmps" 356 | "vfixupimmsd" "vfixupimmss" "vfmadd123pd" "vfmadd123ps" 357 | "vfmadd123sd" "vfmadd123ss" "vfmadd132pd" "vfmadd132ps" 358 | "vfmadd132sd" "vfmadd132ss" "vfmadd213pd" "vfmadd213ps" 359 | "vfmadd213sd" "vfmadd213ss" "vfmadd231pd" "vfmadd231ps" 360 | "vfmadd231sd" "vfmadd231ss" "vfmadd312pd" "vfmadd312ps" 361 | "vfmadd312sd" "vfmadd312ss" "vfmadd321pd" "vfmadd321ps" 362 | "vfmadd321sd" "vfmadd321ss" "vfmaddpd" "vfmaddps" "vfmaddsd" 363 | "vfmaddss" "vfmaddsub123pd" "vfmaddsub123ps" "vfmaddsub132pd" 364 | "vfmaddsub132ps" "vfmaddsub213pd" "vfmaddsub213ps" 365 | "vfmaddsub231pd" "vfmaddsub231ps" "vfmaddsub312pd" 366 | "vfmaddsub312ps" "vfmaddsub321pd" "vfmaddsub321ps" "vfmaddsubpd" 367 | "vfmaddsubps" "vfmsub123pd" "vfmsub123ps" "vfmsub123sd" 368 | "vfmsub123ss" "vfmsub132pd" "vfmsub132ps" "vfmsub132sd" 369 | "vfmsub132ss" "vfmsub213pd" "vfmsub213ps" "vfmsub213sd" 370 | "vfmsub213ss" "vfmsub231pd" "vfmsub231ps" "vfmsub231sd" 371 | "vfmsub231ss" "vfmsub312pd" "vfmsub312ps" "vfmsub312sd" 372 | "vfmsub312ss" "vfmsub321pd" "vfmsub321ps" "vfmsub321sd" 373 | "vfmsub321ss" "vfmsubadd123pd" "vfmsubadd123ps" "vfmsubadd132pd" 374 | "vfmsubadd132ps" "vfmsubadd213pd" "vfmsubadd213ps" 375 | "vfmsubadd231pd" "vfmsubadd231ps" "vfmsubadd312pd" 376 | "vfmsubadd312ps" "vfmsubadd321pd" "vfmsubadd321ps" "vfmsubaddpd" 377 | "vfmsubaddps" "vfmsubpd" "vfmsubps" "vfmsubsd" "vfmsubss" 378 | "vfnmadd123pd" "vfnmadd123ps" "vfnmadd123sd" "vfnmadd123ss" 379 | "vfnmadd132pd" "vfnmadd132ps" "vfnmadd132sd" "vfnmadd132ss" 380 | "vfnmadd213pd" "vfnmadd213ps" "vfnmadd213sd" "vfnmadd213ss" 381 | "vfnmadd231pd" "vfnmadd231ps" "vfnmadd231sd" "vfnmadd231ss" 382 | "vfnmadd312pd" "vfnmadd312ps" "vfnmadd312sd" "vfnmadd312ss" 383 | "vfnmadd321pd" "vfnmadd321ps" "vfnmadd321sd" "vfnmadd321ss" 384 | "vfnmaddpd" "vfnmaddps" "vfnmaddsd" "vfnmaddss" "vfnmsub123pd" 385 | "vfnmsub123ps" "vfnmsub123sd" "vfnmsub123ss" "vfnmsub132pd" 386 | "vfnmsub132ps" "vfnmsub132sd" "vfnmsub132ss" "vfnmsub213pd" 387 | "vfnmsub213ps" "vfnmsub213sd" "vfnmsub213ss" "vfnmsub231pd" 388 | "vfnmsub231ps" "vfnmsub231sd" "vfnmsub231ss" "vfnmsub312pd" 389 | "vfnmsub312ps" "vfnmsub312sd" "vfnmsub312ss" "vfnmsub321pd" 390 | "vfnmsub321ps" "vfnmsub321sd" "vfnmsub321ss" "vfnmsubpd" 391 | "vfnmsubps" "vfnmsubsd" "vfnmsubss" "vfpclasspd" "vfpclassps" 392 | "vfpclasssd" "vfpclassss" "vfrczpd" "vfrczps" "vfrczsd" 393 | "vfrczss" "vgatherdpd" "vgatherdps" "vgatherpf0dpd" 394 | "vgatherpf0dps" "vgatherpf0qpd" "vgatherpf0qps" "vgatherpf1dpd" 395 | "vgatherpf1dps" "vgatherpf1qpd" "vgatherpf1qps" "vgatherqpd" 396 | "vgatherqps" "vgetexppd" "vgetexpps" "vgetexpsd" "vgetexpss" 397 | "vgetmantpd" "vgetmantps" "vgetmantsd" "vgetmantss" "vhaddpd" 398 | "vhaddps" "vhsubpd" "vhsubps" "vinsertf128" "vinsertf32x4" 399 | "vinsertf32x8" "vinsertf64x2" "vinsertf64x4" "vinserti128" 400 | "vinserti32x4" "vinserti32x8" "vinserti64x2" "vinserti64x4" 401 | "vinsertps" "vlddqu" "vldmxcsr" "vldqqu" "vmaskmovdqu" 402 | "vmaskmovpd" "vmaskmovps" "vmaxpd" "vmaxps" "vmaxsd" "vmaxss" 403 | "vmcall" "vmclear" "vmfunc" "vminpd" "vminps" "vminsd" "vminss" 404 | "vmlaunch" "vmload" "vmmcall" "vmovapd" "vmovaps" "vmovd" 405 | "vmovddup" "vmovdqa" "vmovdqa32" "vmovdqa64" "vmovdqu" 406 | "vmovdqu16" "vmovdqu32" "vmovdqu64" "vmovdqu8" "vmovhlps" 407 | "vmovhpd" "vmovhps" "vmovlhps" "vmovlpd" "vmovlps" "vmovmskpd" 408 | "vmovmskps" "vmovntdq" "vmovntdqa" "vmovntpd" "vmovntps" 409 | "vmovntqq" "vmovq" "vmovqqa" "vmovqqu" "vmovsd" "vmovshdup" 410 | "vmovsldup" "vmovss" "vmovupd" "vmovups" "vmpsadbw" "vmptrld" 411 | "vmptrst" "vmread" "vmresume" "vmrun" "vmsave" "vmulpd" "vmulps" 412 | "vmulsd" "vmulss" "vmwrite" "vmxoff" "vmxon" "vorpd" "vorps" 413 | "vpabsb" "vpabsd" "vpabsq" "vpabsw" "vpackssdw" "vpacksswb" 414 | "vpackusdw" "vpackuswb" "vpaddb" "vpaddd" "vpaddq" "vpaddsb" 415 | "vpaddsw" "vpaddusb" "vpaddusw" "vpaddw" "vpalignr" "vpand" 416 | "vpandd" "vpandn" "vpandnd" "vpandnq" "vpandq" "vpavgb" "vpavgw" 417 | "vpblendd" "vpblendmb" "vpblendmd" "vpblendmq" "vpblendmw" 418 | "vpblendvb" "vpblendw" "vpbroadcastb" "vpbroadcastd" 419 | "vpbroadcastmb2q" "vpbroadcastmw2d" "vpbroadcastq" 420 | "vpbroadcastw" "vpclmulhqhqdq" "vpclmulhqlqdq" "vpclmullqhqdq" 421 | "vpclmullqlqdq" "vpclmulqdq" "vpcmov" "vpcmpb" "vpcmpd" 422 | "vpcmpeqb" "vpcmpeqd" "vpcmpeqq" "vpcmpeqw" "vpcmpestri" 423 | "vpcmpestrm" "vpcmpgtb" "vpcmpgtd" "vpcmpgtq" "vpcmpgtw" 424 | "vpcmpistri" "vpcmpistrm" "vpcmpq" "vpcmpub" "vpcmpud" "vpcmpuq" 425 | "vpcmpuw" "vpcmpw" "vpcomb" "vpcomd" "vpcompressd" "vpcompressq" 426 | "vpcomq" "vpcomub" "vpcomud" "vpcomuq" "vpcomuw" "vpcomw" 427 | "vpconflictd" "vpconflictq" "vperm2f128" "vperm2i128" "vpermb" 428 | "vpermd" "vpermi2b" "vpermi2d" "vpermi2pd" "vpermi2ps" 429 | "vpermi2q" "vpermi2w" "vpermilpd" "vpermilps" "vpermpd" 430 | "vpermps" "vpermq" "vpermt2b" "vpermt2d" "vpermt2pd" "vpermt2ps" 431 | "vpermt2q" "vpermt2w" "vpermw" "vpexpandd" "vpexpandq" "vpextrb" 432 | "vpextrd" "vpextrq" "vpextrw" "vpgatherdd" "vpgatherdq" 433 | "vpgatherqd" "vpgatherqq" "vphaddbd" "vphaddbq" "vphaddbw" 434 | "vphaddd" "vphadddq" "vphaddsw" "vphaddubd" "vphaddubq" 435 | "vphaddubw" "vphaddudq" "vphadduwd" "vphadduwq" "vphaddw" 436 | "vphaddwd" "vphaddwq" "vphminposuw" "vphsubbw" "vphsubd" 437 | "vphsubdq" "vphsubsw" "vphsubw" "vphsubwd" "vpinsrb" "vpinsrd" 438 | "vpinsrq" "vpinsrw" "vplzcntd" "vplzcntq" "vpmacsdd" "vpmacsdqh" 439 | "vpmacsdql" "vpmacssdd" "vpmacssdqh" "vpmacssdql" "vpmacsswd" 440 | "vpmacssww" "vpmacswd" "vpmacsww" "vpmadcsswd" "vpmadcswd" 441 | "vpmadd52huq" "vpmadd52luq" "vpmaddubsw" "vpmaddwd" "vpmaskmovd" 442 | "vpmaskmovq" "vpmaxsb" "vpmaxsd" "vpmaxsq" "vpmaxsw" "vpmaxub" 443 | "vpmaxud" "vpmaxuq" "vpmaxuw" "vpminsb" "vpminsd" "vpminsq" 444 | "vpminsw" "vpminub" "vpminud" "vpminuq" "vpminuw" "vpmovb2m" 445 | "vpmovd2m" "vpmovdb" "vpmovdw" "vpmovm2b" "vpmovm2d" "vpmovm2q" 446 | "vpmovm2w" "vpmovmskb" "vpmovq2m" "vpmovqb" "vpmovqd" "vpmovqw" 447 | "vpmovsdb" "vpmovsdw" "vpmovsqb" "vpmovsqd" "vpmovsqw" 448 | "vpmovswb" "vpmovsxbd" "vpmovsxbq" "vpmovsxbw" "vpmovsxdq" 449 | "vpmovsxwd" "vpmovsxwq" "vpmovusdb" "vpmovusdw" "vpmovusqb" 450 | "vpmovusqd" "vpmovusqw" "vpmovuswb" "vpmovw2m" "vpmovwb" 451 | "vpmovzxbd" "vpmovzxbq" "vpmovzxbw" "vpmovzxdq" "vpmovzxwd" 452 | "vpmovzxwq" "vpmuldq" "vpmulhrsw" "vpmulhuw" "vpmulhw" "vpmulld" 453 | "vpmullq" "vpmullw" "vpmultishiftqb" "vpmuludq" "vpor" "vpord" 454 | "vporq" "vpperm" "vprold" "vprolq" "vprolvd" "vprolvq" "vprord" 455 | "vprorq" "vprorvd" "vprorvq" "vprotb" "vprotd" "vprotq" "vprotw" 456 | "vpsadbw" "vpscatterdd" "vpscatterdq" "vpscatterqd" 457 | "vpscatterqq" "vpshab" "vpshad" "vpshaq" "vpshaw" "vpshlb" 458 | "vpshld" "vpshlq" "vpshlw" "vpshufb" "vpshufd" "vpshufhw" 459 | "vpshuflw" "vpsignb" "vpsignd" "vpsignw" "vpslld" "vpslldq" 460 | "vpsllq" "vpsllvd" "vpsllvq" "vpsllvw" "vpsllw" "vpsrad" 461 | "vpsraq" "vpsravd" "vpsravq" "vpsravw" "vpsraw" "vpsrld" 462 | "vpsrldq" "vpsrlq" "vpsrlvd" "vpsrlvq" "vpsrlvw" "vpsrlw" 463 | "vpsubb" "vpsubd" "vpsubq" "vpsubsb" "vpsubsw" "vpsubusb" 464 | "vpsubusw" "vpsubw" "vpternlogd" "vpternlogq" "vptest" 465 | "vptestmb" "vptestmd" "vptestmq" "vptestmw" "vptestnmb" 466 | "vptestnmd" "vptestnmq" "vptestnmw" "vpunpckhbw" "vpunpckhdq" 467 | "vpunpckhqdq" "vpunpckhwd" "vpunpcklbw" "vpunpckldq" 468 | "vpunpcklqdq" "vpunpcklwd" "vpxor" "vpxord" "vpxorq" "vrangepd" 469 | "vrangeps" "vrangesd" "vrangess" "vrcp14pd" "vrcp14ps" 470 | "vrcp14sd" "vrcp14ss" "vrcp28pd" "vrcp28ps" "vrcp28sd" 471 | "vrcp28ss" "vrcpps" "vrcpss" "vreducepd" "vreduceps" "vreducesd" 472 | "vreducess" "vrndscalepd" "vrndscaleps" "vrndscalesd" 473 | "vrndscaless" "vroundpd" "vroundps" "vroundsd" "vroundss" 474 | "vrsqrt14pd" "vrsqrt14ps" "vrsqrt14sd" "vrsqrt14ss" "vrsqrt28pd" 475 | "vrsqrt28ps" "vrsqrt28sd" "vrsqrt28ss" "vrsqrtps" "vrsqrtss" 476 | "vscalefpd" "vscalefps" "vscalefsd" "vscalefss" "vscatterdpd" 477 | "vscatterdps" "vscatterpf0dpd" "vscatterpf0dps" "vscatterpf0qpd" 478 | "vscatterpf0qps" "vscatterpf1dpd" "vscatterpf1dps" 479 | "vscatterpf1qpd" "vscatterpf1qps" "vscatterqpd" "vscatterqps" 480 | "vshuff32x4" "vshuff64x2" "vshufi32x4" "vshufi64x2" "vshufpd" 481 | "vshufps" "vsqrtpd" "vsqrtps" "vsqrtsd" "vsqrtss" "vstmxcsr" 482 | "vsubpd" "vsubps" "vsubsd" "vsubss" "vtestpd" "vtestps" 483 | "vucomisd" "vucomiss" "vunpckhpd" "vunpckhps" "vunpcklpd" 484 | "vunpcklps" "vxorpd" "vxorps" "vzeroall" "vzeroupper" "wbinvd" 485 | "wrfsbase" "wrgsbase" "wrmsr" "wrshr" "xabort" "xadd" "xbegin" 486 | "xbts" "xchg" "xcryptcbc" "xcryptcfb" "xcryptctr" "xcryptecb" 487 | "xcryptofb" "xend" "xgetbv" "xlat" "xlatb" "xor" "xorpd" "xorps" 488 | "xrstor" "xrstor64" "xrstors" "xrstors64" "xsave" "xsave64" 489 | "xsavec" "xsavec64" "xsaveopt" "xsaveopt64" "xsaves" "xsaves64" 490 | "xsetbv" "xsha1" "xsha256" "xstore" "xtest") 491 | "NASM instructions (tokhash.c) for `nasm-mode'.")) 492 | 493 | (eval-and-compile 494 | (defconst nasm-types 495 | '("1to16" "1to2" "1to4" "1to8" "__float128h__" "__float128l__" 496 | "__float16__" "__float32__" "__float64__" "__float80e__" 497 | "__float80m__" "__float8__" "__infinity__" "__nan__" "__qnan__" 498 | "__snan__" "__utf16__" "__utf16be__" "__utf16le__" "__utf32__" 499 | "__utf32be__" "__utf32le__" "abs" "byte" "dword" "evex" "far" 500 | "long" "near" "nosplit" "oword" "qword" "rel" "seg" "short" 501 | "strict" "to" "tword" "vex2" "vex3" "word" "wrt" "yword" 502 | "zword") 503 | "NASM types (tokens.dat) for `nasm-mode'.")) 504 | 505 | (eval-and-compile 506 | (defconst nasm-prefix 507 | '("a16" "a32" "a64" "asp" "lock" "o16" "o32" "o64" "osp" "rep" "repe" 508 | "repne" "repnz" "repz" "times" "wait" "xacquire" "xrelease" "bnd") 509 | "NASM prefixes (nasmlib.c) for `nasm-mode'.")) 510 | 511 | (eval-and-compile 512 | (defconst nasm-pp-directives 513 | '("%elif" "%elifn" "%elifctx" "%elifnctx" "%elifdef" "%elifndef" 514 | "%elifempty" "%elifnempty" "%elifenv" "%elifnenv" "%elifid" 515 | "%elifnid" "%elifidn" "%elifnidn" "%elifidni" "%elifnidni" 516 | "%elifmacro" "%elifnmacro" "%elifnum" "%elifnnum" "%elifstr" 517 | "%elifnstr" "%eliftoken" "%elifntoken" "%if" "%ifn" "%ifctx" 518 | "%ifnctx" "%ifdef" "%ifndef" "%ifempty" "%ifnempty" "%ifenv" 519 | "%ifnenv" "%ifid" "%ifnid" "%ifidn" "%ifnidn" "%ifidni" "%ifnidni" 520 | "%ifmacro" "%ifnmacro" "%ifnum" "%ifnnum" "%ifstr" "%ifnstr" 521 | "%iftoken" "%ifntoken" "%arg" "%assign" "%clear" "%define" 522 | "%defstr" "%deftok" "%depend" "%else" "%endif" "%endm" "%endmacro" 523 | "%endrep" "%error" "%exitmacro" "%exitrep" "%fatal" "%iassign" 524 | "%idefine" "%idefstr" "%ideftok" "%imacro" "%include" "%irmacro" 525 | "%ixdefine" "%line" "%local" "%macro" "%pathsearch" "%pop" "%push" 526 | "%rep" "%repl" "%rmacro" "%rotate" "%stacksize" "%strcat" 527 | "%strlen" "%substr" "%undef" "%unimacro" "%unmacro" "%use" 528 | "%warning" "%xdefine" "istruc" "at" "iend" "align" "alignb" 529 | "struc" "endstruc" "__LINE__" "__FILE__" "%comment" "%endcomment" 530 | "__NASM_MAJOR__" " __NASM_MINOR__" "__NASM_SUBMINOR__" 531 | "___NASM_PATCHLEVEL__" "__NASM_VERSION_ID__" "__NASM_VER__" 532 | "__BITS__" "__OUTPUT_FORMAT__" "__DATE__" "__TIME__" "__DATE_NUM__" 533 | "__TIME_NUM__" "__UTC_DATE__" "__UTC_TIME__" "__UTC_DATE_NUM__" 534 | "__UTC_TIME_NUM__" "__POSIX_TIME__" " __PASS__" "SECTALIGN") 535 | "NASM preprocessor directives (pptok.c) for `nasm-mode'.")) 536 | 537 | (defconst nasm-nonlocal-label-rexexp 538 | "\\(\\_<[a-zA-Z_?][a-zA-Z0-9_$#@~?]*\\_>\\)\\s-*:" 539 | "Regexp for `nasm-mode' for matching nonlocal labels.") 540 | 541 | (defconst nasm-local-label-regexp 542 | "\\(\\_<\\.[a-zA-Z_?][a-zA-Z0-9_$#@~?]*\\_>\\)\\(?:\\s-*:\\)?" 543 | "Regexp for `nasm-mode' for matching local labels.") 544 | 545 | (defconst nasm-label-regexp 546 | (concat nasm-nonlocal-label-rexexp "\\|" nasm-local-label-regexp) 547 | "Regexp for `nasm-mode' for matching labels.") 548 | 549 | (defconst nasm-constant-regexp 550 | "\\_<$?[-+]?[0-9][-+_0-9A-Fa-fHhXxDdTtQqOoBbYyeE.]*\\_>" 551 | "Regexp for `nasm-mode' for matching numeric constants.") 552 | 553 | (defconst nasm-section-name-regexp 554 | "^\\s-*section[ \t]+\\(\\_<\\.[a-zA-Z0-9_$#@~.?]+\\_>\\)" 555 | "Regexp for `nasm-mode' for matching section names.") 556 | 557 | (defmacro nasm--opt (keywords) 558 | "Prepare KEYWORDS for `looking-at'." 559 | `(eval-when-compile 560 | (regexp-opt ,keywords 'symbols))) 561 | 562 | (defconst nasm-imenu-generic-expression 563 | `((nil ,(concat "^\\s-*" nasm-nonlocal-label-rexexp) 1) 564 | (nil ,(concat (nasm--opt '("%define" "%macro")) 565 | "\\s-+\\([a-zA-Z0-9_$#@~.?]+\\)") 2)) 566 | "Expressions for `imenu-generic-expression'.") 567 | 568 | (defconst nasm-full-instruction-regexp 569 | (eval-when-compile 570 | (let ((pfx (nasm--opt nasm-prefix)) 571 | (ins (nasm--opt nasm-instructions))) 572 | (concat "^\\(" pfx "\\s-+\\)?" ins "$"))) 573 | "Regexp for `nasm-mode' matching a valid full NASM instruction field. 574 | This includes prefixes or modifiers (eg \"mov\", \"rep mov\", etc match)") 575 | 576 | (defconst nasm-font-lock-keywords 577 | `((,nasm-section-name-regexp (1 'nasm-section-name)) 578 | (,(nasm--opt nasm-registers) . 'nasm-registers) 579 | (,(nasm--opt nasm-prefix) . 'nasm-prefix) 580 | (,(nasm--opt nasm-types) . 'nasm-types) 581 | (,(nasm--opt nasm-instructions) . 'nasm-instructions) 582 | (,(nasm--opt nasm-pp-directives) . 'nasm-preprocessor) 583 | (,(concat "^\\s-*" nasm-nonlocal-label-rexexp) (1 'nasm-labels)) 584 | (,(concat "^\\s-*" nasm-local-label-regexp) (1 'nasm-local-labels)) 585 | (,nasm-constant-regexp . 'nasm-constant) 586 | (,(nasm--opt nasm-directives) . 'nasm-directives)) 587 | "Keywords for `nasm-mode'.") 588 | 589 | (defconst nasm-mode-syntax-table 590 | (with-syntax-table (copy-syntax-table) 591 | (modify-syntax-entry ?_ "_") 592 | (modify-syntax-entry ?# "_") 593 | (modify-syntax-entry ?@ "_") 594 | (modify-syntax-entry ?\? "_") 595 | (modify-syntax-entry ?~ "_") 596 | (modify-syntax-entry ?\. "w") 597 | (modify-syntax-entry ?\; "<") 598 | (modify-syntax-entry ?\n ">") 599 | (modify-syntax-entry ?\" "\"") 600 | (modify-syntax-entry ?\' "\"") 601 | (modify-syntax-entry ?\` "\"") 602 | (syntax-table)) 603 | "Syntax table for `nasm-mode'.") 604 | 605 | (defvar nasm-mode-map 606 | (let ((map (make-sparse-keymap))) 607 | (prog1 map 608 | (define-key map (kbd ":") #'nasm-colon) 609 | (define-key map (kbd ";") #'nasm-comment) 610 | (define-key map [remap join-line] #'nasm-join-line))) 611 | "Key bindings for `nasm-mode'.") 612 | 613 | (defun nasm-colon () 614 | "Insert a colon and convert the current line into a label." 615 | (interactive) 616 | (call-interactively #'self-insert-command) 617 | (nasm-indent-line)) 618 | 619 | (defun nasm-indent-line () 620 | "Indent current line (or insert a tab) as NASM assembly code. 621 | This will be called by `indent-for-tab-command' when TAB is 622 | pressed. We indent the entire line as appropriate whenever POINT 623 | is not immediately after a mnemonic; otherwise, we insert a tab." 624 | (interactive) 625 | (let ((before ; text before point and after indentation 626 | (save-excursion 627 | (let ((point (point)) 628 | (bti (progn (back-to-indentation) (point)))) 629 | (buffer-substring-no-properties bti point))))) 630 | (if (string-match nasm-full-instruction-regexp before) 631 | ;; We are immediately after a mnemonic 632 | (cl-case nasm-after-mnemonic-whitespace 633 | (:tab (insert "\t")) 634 | (:space (insert-char ?\s nasm-basic-offset))) 635 | ;; We're literally anywhere else, indent the whole line 636 | (let ((orig (- (point-max) (point)))) 637 | (back-to-indentation) 638 | (if (or (looking-at (nasm--opt nasm-directives)) 639 | (looking-at (nasm--opt nasm-pp-directives)) 640 | (looking-at "\\[") 641 | (looking-at ";;+") 642 | (looking-at nasm-label-regexp)) 643 | (indent-line-to 0) 644 | (indent-line-to nasm-basic-offset)) 645 | (when (> (- (point-max) orig) (point)) 646 | (goto-char (- (point-max) orig))))))) 647 | 648 | (defun nasm--current-line () 649 | "Return the current line as a string." 650 | (save-excursion 651 | (let ((start (progn (beginning-of-line) (point))) 652 | (end (progn (end-of-line) (point)))) 653 | (buffer-substring-no-properties start end)))) 654 | 655 | (defun nasm--empty-line-p () 656 | "Return non-nil if current line has non-whitespace." 657 | (not (string-match-p "\\S-" (nasm--current-line)))) 658 | 659 | (defun nasm--line-has-comment-p () 660 | "Return non-nil if current line contains a comment." 661 | (save-excursion 662 | (end-of-line) 663 | (nth 4 (syntax-ppss)))) 664 | 665 | (defun nasm--line-has-non-comment-p () 666 | "Return non-nil of the current line has code." 667 | (let* ((line (nasm--current-line)) 668 | (match (string-match-p "\\S-" line))) 669 | (when match 670 | (not (eql ?\; (aref line match)))))) 671 | 672 | (defun nasm--inside-indentation-p () 673 | "Return non-nil if point is within the indentation." 674 | (save-excursion 675 | (let ((point (point)) 676 | (start (progn (beginning-of-line) (point))) 677 | (end (progn (back-to-indentation) (point)))) 678 | (and (<= start point) (<= point end))))) 679 | 680 | (defun nasm-comment-indent () 681 | "Compute desired indentation for comment on the current line." 682 | comment-column) 683 | 684 | (defun nasm-insert-comment () 685 | "Insert a comment if the current line doesn’t contain one." 686 | (let ((comment-insert-comment-function nil)) 687 | (comment-indent))) 688 | 689 | (defun nasm-comment (&optional arg) 690 | "Begin or edit a comment with context-sensitive placement. 691 | 692 | The right-hand comment gutter is far away from the code, so this 693 | command uses the mark ring to help move back and forth between 694 | code and the comment gutter. 695 | 696 | * If no comment gutter exists yet, mark the current position and 697 | jump to it. 698 | * If already within the gutter, pop the top mark and return to 699 | the code. 700 | * If on a line with no code, just insert a comment character. 701 | * If within the indentation, just insert a comment character. 702 | This is intended prevent interference when the intention is to 703 | comment out the line. 704 | 705 | With a prefix ARG, kill the comment on the current line with 706 | `comment-kill'." 707 | (interactive "p") 708 | (if (not (eql arg 1)) 709 | (comment-kill nil) 710 | (cond 711 | ;; Empty line, or inside a string? Insert. 712 | ((or (nasm--empty-line-p) (nth 3 (syntax-ppss))) 713 | (insert ";")) 714 | ;; Inside the indentation? Comment out the line. 715 | ((nasm--inside-indentation-p) 716 | (insert ";")) 717 | ;; Currently in a right-side comment? Return. 718 | ((and (nasm--line-has-comment-p) 719 | (nasm--line-has-non-comment-p) 720 | (nth 4 (syntax-ppss))) 721 | (goto-char (mark)) 722 | (pop-mark)) 723 | ;; Line has code? Mark and jump to right-side comment. 724 | ((nasm--line-has-non-comment-p) 725 | (push-mark) 726 | (comment-indent)) 727 | ;; Otherwise insert. 728 | ((insert ";"))))) 729 | 730 | (defun nasm-join-line (&optional arg) 731 | "Join this line to previous, but use a tab when joining with a label. 732 | With prefix ARG, join the current line to the following line. See `join-line' 733 | for more information." 734 | (interactive "*P") 735 | (join-line arg) 736 | (if (looking-back nasm-label-regexp (line-beginning-position)) 737 | (let ((column (current-column))) 738 | (cond ((< column nasm-basic-offset) 739 | (delete-char 1) 740 | (insert-char ?\t)) 741 | ((and (= column nasm-basic-offset) (eql ?: (char-before))) 742 | (delete-char 1)))) 743 | (nasm-indent-line))) 744 | 745 | ;;;###autoload 746 | (define-derived-mode nasm-mode prog-mode "NASM" 747 | "Major mode for editing NASM assembly programs." 748 | :group 'nasm-mode 749 | (make-local-variable 'indent-line-function) 750 | (make-local-variable 'comment-start) 751 | (make-local-variable 'comment-insert-comment-function) 752 | (make-local-variable 'comment-indent-function) 753 | (setf font-lock-defaults '(nasm-font-lock-keywords nil :case-fold) 754 | indent-line-function #'nasm-indent-line 755 | comment-start ";" 756 | comment-indent-function #'nasm-comment-indent 757 | comment-insert-comment-function #'nasm-insert-comment 758 | imenu-generic-expression nasm-imenu-generic-expression)) 759 | 760 | (provide 'nasm-mode) 761 | 762 | ;;; nasm-mode.el ends here 763 | --------------------------------------------------------------------------------