Files
nand2tetris-zed/examples/EnhancedAssembly.asm
Sean O'Connor c231dbfd27 Fix HDL and Hack Assembly syntax highlighting and queries
- Fixed HDL highlights query syntax error with #match? predicate
- Replaced #match? with #any-of? for exact string matching
- Fixed Hack Assembly outline query invalid field name
- Improved HDL syntax highlighting with comprehensive patterns
- Added HDL bracket matching for all syntax types
- Fixed XML scope mismatch from text.xml to source.xml
- Enhanced outline queries for better code navigation
2025-09-11 11:24:24 -04:00

108 lines
2.3 KiB
NASM

// Enhanced Hack Assembly Test File
// Demonstrates all the improved highlighting features
// Test A-instructions with various symbol types
@R0 // Virtual register
@R15 // Virtual register
@SP // Stack pointer
@LCL // Local pointer
@ARG // Argument pointer
@THIS // This pointer
@THAT // That pointer
@SCREEN // Screen memory map
@KBD // Keyboard memory map
@userVar // User-defined variable
@LOOP // User-defined label
// Test constants (including negative)
@0 // Zero
@1 // One
@-1 // Negative one
@32767 // Max positive
@-32768 // Min negative
@42 // Random positive
@-42 // Random negative
// Test C-instructions with all destination combinations
D=A // D register
A=M // A register
M=D // M register
MD=A // M and D
AM=D // A and M
AD=M // A and D
AMD=A // All three
// Test computation field operations
D=0 // Zero
D=1 // One
D=-1 // Negative one
D=D // D register
D=!D // Not D
D=-D // Negate D
D=D+1 // Increment D
D=D-1 // Decrement D
D=A // A register
D=!A // Not A
D=-A // Negate A
D=A+1 // Increment A
D=A-1 // Decrement A
D=M // M register
D=!M // Not M
D=-M // Negate M
D=M+1 // Increment M
D=M-1 // Decrement M
D=D+A // D plus A
D=D-A // D minus A
D=A-D // A minus D
D=D&A // D and A
D=D|A // D or A
D=D+M // D plus M
D=D-M // D minus M
D=M-D // M minus D
D=D&M // D and M
D=D|M // D or M
// Test jump conditions
D;JGT // Jump if greater than
D;JEQ // Jump if equal
D;JGE // Jump if greater or equal
D;JLT // Jump if less than
D;JNE // Jump if not equal
D;JLE // Jump if less or equal
D;JMP // Unconditional jump
// Test label declarations
(MAIN_LOOP)
(END_PROGRAM)
(ERROR_HANDLER)
// Test complex program structure
@MAIN_LOOP
D;JGT
@END_PROGRAM
0;JMP
(MAIN_LOOP)
@SCREEN
D=A
@pointer
M=D
@KBD
D=M
@END_PROGRAM
D;JEQ
@pointer
A=M
M=-1
@pointer
M=M+1
@MAIN_LOOP
0;JMP
(END_PROGRAM)
0;JMP