Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>8051 Assembly (A51)New to Visual Studio Code? Get it now.
8051 Assembly (A51)

8051 Assembly (A51)

qmkc

|
2 installs
| (0) | Free
Syntax highlighting, formatting, diagnostics, hover reference, and IntelliSense for 8051 (MCS-51) A51 assembly.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

8051 Assembly (A51)

Syntax highlighting, formatting, diagnostics, hover reference, and IntelliSense for 8051 (MCS-51) assembly in the Keil A51 dialect, for .asm and .a51 files.

Syntax highlighting and diagnostics

Features

Syntax highlighting

TextMate-grammar highlighting for instructions, directives, registers, SFRs/SFR bits, bit addresses, numeric literals (hex/binary/octal/decimal), string literals, $/# compiler-control lines, and labels/symbol/macro definitions.

Formatting

Format Document and Format Selection align labels, mnemonics, operands, and trailing comments into configurable columns:

; before
loop1: setb led
lcall delay ; go

; after (Format Document)
loop1:  setb    led
        lcall   delay                   ; go
  • Content after a top-level END is left byte-for-byte untouched.
  • Formatting is idempotent: formatting an already-formatted file is a no-op.
  • Case normalization (if enabled) only ever touches mnemonics, directives, and known registers — your own label and symbol names are never rewritten.

See Extension Settings for the full list of formatting options.

Diagnostics

Lightweight, real-time checks as you type:

  • Unknown instruction or directive
  • Wrong number of operands for a known instruction
  • A branch/call target that doesn't resolve to any label in the file
  • Invalid indirect addressing (@R2-@R7 — only @R0/@R1 are addressable)
  • Unmatched or never-closed MACRO/IF/REPT/WHILE blocks
  • A symbol (label, EQU, BIT, DATA/IDATA/XDATA/CODE/SEGMENT, or macro) defined more than once

Like formatting, diagnostics stop at a top-level END — nothing after it is real code, so nothing after it is checked.

This is a lightweight checker, not a full assembler: it won't catch every semantic error a real A51 build would, and it does not assemble or simulate your code.

Hover reference

Hovering an instruction shows its opcode(s), byte length, cycle count, affected flags, and an addressing-mode-specific explanation, plus relevant notes (e.g. the ACALL/AJMP same-page restriction, relative-jump range, @Ri indirect RAM range, RETI vs. RET).

Hovering any other reference to a label, EQU/SET/BIT/DATA-style constant, or macro — whether it's the definition itself or a use elsewhere, like a branch target — shows its kind, its value or parameter list, and where it's defined.

Doc comments

A ; comment block written directly above a definition (no blank line in between) is treated as that symbol's documentation, and shown wherever it's hovered:

; Blinks the status LED once per second.
; Call after SETUP.
LOOP:   SETB    LED
        LCALL   DELAY
        SJMP    LOOP

Hovering LOOP here — on its definition or on the SJMP LOOP reference — shows that two-line comment as its documentation.

IntelliSense

  • Auto-completion for instructions, directives, registers, and every symbol defined in the current file
  • Go to Definition for labels, constants, and macros
  • Find All References
  • Outline / breadcrumbs (document symbols) for labels, constants, and macros
  • Code folding for MACRO/IF/REPT/WHILE blocks

Snippets

Prefix-triggered snippets for common A51 patterns: org (reset-vector + main-loop skeleton), vectors (full interrupt vector table), isr, sub, macro, delay, equ, bit, and cjne.

Localization

Diagnostics messages, hover reference text, and completion details follow VS Code's display language: English, Simplified Chinese (简体中文), and Traditional Chinese (繁體中文) are all supported.

Requirements

None — this extension only provides editor tooling (highlighting, formatting, diagnostics, IntelliSense). It does not assemble, build, or simulate your code, so no external toolchain is required.

Extension Settings

Setting Default Description
a51.format.mnemonicColumn 8 Column where the mnemonic/directive starts.
a51.format.operandColumn 16 Column where the operand field starts.
a51.format.commentColumn 40 Column where trailing line comments start.
a51.format.indentStyle spaces Whitespace character used to reach each column (spaces or tabs).
a51.format.tabSize 8 Tab stop width used when indentStyle is tabs.
a51.format.longLabelStyle newline How to handle a label too long to fit before the mnemonic column: put the instruction on its own following line (newline), or keep it on the same line separated by a single space (sameLine).
a51.format.caseStyle preserve Case normalization for mnemonics, directives, and known registers (preserve, upper, or lower). User-defined label/symbol names are never changed.
a51.format.commaSpacing preserve Whether to normalize operand lists to have exactly one space after each comma (preserve or space).
a51.format.semicolonSpacing preserve Whether to normalize trailing comments to have exactly one space after ; (preserve or space).
a51.format.indentMacroBody false Indent one extra level inside MACRO/ENDM, IF/ENDIF, REPT/ENDM, and WHILE/ENDW blocks.
a51.format.maxBlankLines 1 Maximum number of consecutive blank lines to keep.

Known Issues

  • Diagnostics are a heuristic, line-based checker rather than a full A51 assembler, so some real assembler errors may go unreported and some unusual-but-valid code may be flagged.

Found a bug or have a feature request? Please open an issue.

Release Notes

See CHANGELOG.md.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft