asm-brush is small WordPress plugin I wrote and dedicated to the dinosaurs (like me) who still use and want to share assembly language source code. It is a brush designed to work with the SyntaxHighlighter Evolved WordPress plugin (written by Viper), itself based on the SyntaxHighlighter JavaScript package by Alex Gorbatchev. To be able to use this brush, you will need the asm-brush as well as the SyntaxHighlighter Evolved plugins installed.

To highlight your assembly language code, simply wrap it between these tags:




The brush detects and applies different styles to the following elements:

  • Registers
  • Assembly language user instructions
  • Assembly language system instructions
  • FPU instructions
  • Multimedia instructions
  • MASM specific directives & instructions
  • Numbers (decimal and hexadecimal)
  • IDA (The Interactive Disassembler) labels style

The styles are easily customizable by editing the CSS file (style.css).

You can download asm-brush at the WordPress Plugin Directory

Example N°1 : a MASM source

.model flat,stdcall
option casemap:none


includelib  user32.lib
includelib  kernel32.lib


message     db  'Hello friends!', 13, 10
            db  'This is an autotyping example.', 0
app         db  'notepad.exe', 0
wndclass    db  'Notepad', 0
childclass  db  'Edit', 0


handle      dd  ?


    invoke  WinExec, ADDR app, SW_SHOW
    invoke  FindWindow, ADDR wndclass, 0
    invoke  FindWindowEx, eax, 0, ADDR childclass, 0
    mov     handle, eax
    mov     edx, OFFSET message
    movzx   eax,BYTE PTR [edx]
    test    eax,eax
    jz      @lb_end
    push    edx
    invoke  SendMessage, handle, WM_CHAR, eax, 0
    invoke  Sleep, 200
    pop     edx
    inc     edx
    jmp     @lb_start
    invoke  ExitProcess, 0

    END     start

Example N°2 : an IDA disassembly

.text:00402C9D sub_402C9D      proc near
.text:00402C9D arg_0           = dword ptr  8
.text:00402C9D arg_4           = dword ptr  0Ch
.text:00402C9D arg_8           = dword ptr  10h
.text:00402C9D arg_C           = dword ptr  14h
.text:00402C9D arg_10          = dword ptr  18h
.text:00402C9D arg_14          = dword ptr  1Ch
.text:00402C9D arg_18          = dword ptr  20h
.text:00402C9D                 push    ebp
.text:00402C9E                 mov     ebp, esp
.text:00402CA0                 push    [esp+arg_18]    ; int
.text:00402CA4                 push    [ebp+arg_14]    ; int
.text:00402CA7                 push    [ebp+arg_10]    ; wchar_t *
.text:00402CAA                 push    [ebp+arg_C]     ; int
.text:00402CAD                 push    [ebp+arg_8]     ; int
.text:00402CB0                 push    [ebp+arg_4]     ; int
.text:00402CB3                 push    [ebp+arg_0]     ; int
.text:00402CB6                 call    sub_402CC6
.text:00402CBB                 add     esp, 1Ch
.text:00402CBE                 cmp     eax, 1
.text:00402CC1                 sbb     eax, eax
.text:00402CC3                 pop     ebp
.text:00402CC4                 inc     eax
.text:00402CC5                 retn
.text:00402CC5 sub_402C9D      endp

Example N°3 : another IDA disassembly

.text:00402F9B loc_402F9B: ; CODE XREF: sub_402F74+A
.text:00402F9B                 mov     eax, [ebp+arg_8]
.text:00402F9E                 push    eax
.text:00402F9F                 mov     ax, [ebp+arg_4]
.text:00402FA3                 shr     ax, 1
.text:00402FA6                 push    eax
.text:00402FA7                 push    [ebp+lpMultiByteStr]
.text:00402FAA                 call    sub_402EE2
.text:00402FAF                 add     esp, 0Ch
.text:00402FB2                 test    eax, eax
.text:00402FB4                 mov     eax, 0
.text:00402FB9                 jz      short loc_402FC0
.text:00402FBB loc_402FBB: ; CODE XREF: sub_402F74+21
.text:00402FBB                 mov     eax, 1
.text:00402FC0 loc_402FC0: ; CODE XREF: sub_402F74+25
.text:00402FC0                 pop     ebp
.text:00402FC1                 retn
.text:00402FC1 sub_402F74      endp

Frequently Asked Questions

  • Will the brush work with other processors?
    Processors have in common some mnemonics, so yes it will, but not everything will be highlighted like with the x86 instruction set, you need to add your particular instructions set to the brush.
  • How can I add instructions to the brush?
    By editing the shBrushAsm.js file.

Not on WordPress?

I’m really sorry for you! no seriously, if you are not a WordPress user, you can download the asm-brush JavaScript file and use it with the original SyntaxHighlighter JavaScript package by Alex Gorbatchev. For the styles, you can either add the plugin styles to the package (please see below) or modify the brush file and stick to Alex’s orginal styles.

/* Registers */
.syntaxhighlighter .registers
{ color: #ff8000; font-weight: normal !important; }

/* User Instructions */
.syntaxhighlighter .usr_inst
{ color: #ff0080; font-weight: normal !important; }

/* System Instructions */
.syntaxhighlighter .sys_inst
{ color: #0000ff; font-weight: normal !important; }

/* FPU Instructions */
.syntaxhighlighter .fpu_inst
{ color: #ff8040; font-weight: normal !important; }

/* Multimedia Instructions */
.syntaxhighlighter .mul_inst
{ color: #cbd601; font-weight: normal !important; }

/* Masm Specific */
.syntaxhighlighter .masm_spc
{ color: #0080c0; font-weight: normal !important; }

/* Numbers */
.syntaxhighlighter .numbers
{ color: #8000ff; font-weight: normal !important; }

/* IDA labels */
.syntaxhighlighter .labels
{ color: blue; font-weight: normal !important; }

/* Strings */
.syntaxhighlighter .asmstring
{ color: #b0002d; font-weight: normal !important; }

{ 6 comments… read them below or add one }