简体中文
VSCode 8051/8052 Assembly Language Support
Syntax highlighting and IntelliSense for 8051/8052 assembly language in Visual Studio Code.
Syntax Highlighting
- Comments starting with semicolon (
;)
- Double quotation mark (
") strings (with escape character recognition)
- Numbers in various bases
- Hexadecimal (case-insensitive)
- Binary numbers are case-insensitive and support segmentation with underscores (
_), i.e., 0b1010_0101
- Decimal excludes numbers ending with
$ (reserved for inside jump labels)
- A single character enclosed in single quotation marks (
') is also treated as a number
- 8051/8052 assembly language mnemonics
- Common built-in registers:
- Only supports
A, ACC, AB, B, C, DPH, DPL, DPTR, PSW, SP, R0~R7 and AR0~AR7
- Indirect addressing:
@R0, @R1, @DPTR
- Relative addressing:
@A+PC
- Indexed addressing:
@A+DPTR
- Invalid
@xx patterns highlighted as errors
- Common assembly directives:
- Data definition:
.org, .db, .dw, .ds, .equ, .set, .end, .include, etc.
- Conditional compilation:
.if....else....endif, etc.
- Macro definition:
macro...endm, etc.
- Repetitive iteration:
rept...endr, irp, irpc, etc.
- SDCC proprietary assembly directives:
- Segments and symbol declaration:
.module, .area, .globl, etc.
- Flow control extensions:
iff, ift, iftf, ifxx, etc.
- Full directive reference: asmlnk.txt
- Keil proprietary assembly directives
- Segment definitions and references:
- Definitions:
.area SEGNAME (OPTIONS)
- References:
s_SEGNAME (segment start address), l_SEGNAME (segment length)
- Parameters: Mutually exclusive options (e.g.,
ABS/REL together) are marked as errors
- Address labels:
- Global labels:
name:: highlighted when definition/declaration found in workspace
- Document labels:
name: visible within file only, can be promoted to global via .globl
- Inside labels:
1000$: scoped between two global/document labels, marked as error if undefined
- Registers/constants:
_SBUF = 0x0099 defined with equals sign
Intelligent Navigation
- Go to Definition (
F12) and Find All References (Shift+F12) for segments
- On segment definition: Lists all matching segments across the workspace
- On segment reference: Jumps to the definition in current file if exists; otherwise lists all matching segments
- Go to Definition (
F12) and Find All References (Shift+F12) for address labels
- Search order: local definition → local declaration → workspace definition → workspace declaration
- Global labels and registers/constants support cross-file navigation
- Inside labels are searched within current scope only
Installation
From Marketplace
- Open Visual Studio Code
- Press
Ctrl+Shift+X (or Cmd+Shift+X on Mac) to open Extensions view
- Search for "8052 Assembly" or "asm8052"
- Click Install
From VSIX File
- Download the
.vsix file from Releases
- Open Visual Studio Code
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac) to open Command Palette
- Type "Extensions: Install from VSIX..." and select it
- Choose the downloaded
.vsix file
License
Licensed under the Apache License 2.0.
| |