Files
nand2tetris-zed/examples/test.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

107 lines
952 B
NASM

// Test Hack Assembly file for syntax highlighting
// This file demonstrates various Hack Assembly features
// Simple A-instruction with constant
@17
D=A
// A-instruction with symbol
@sum
M=D
// C-instruction with all parts: dest=comp;jump
@i
D=M
@LOOP
D;JGT
// Label declaration
(LOOP)
// Various computation operations
@sum
D=M
@i
D=D+M
@sum
M=D
// Memory operations
@R0
D=M
@temp
M=D
// Predefined symbols
@SP
M=M+1
@LCL
D=M
@ARG
M=D
// Screen and keyboard
@SCREEN
D=A
@KBD
M=M+1
// Complex computations
D=D+1
D=D-1
D=!D
D=-D
A=D+A
M=D&A
D=D|M
// Jump conditions
@END
0;JMP
@value
D=M
@POSITIVE
D;JGT
@ZERO
D;JEQ
@NEGATIVE
D;JLT
(POSITIVE)
// Positive value handling
@1
D=A
@result
M=D
@END
0;JMP
(ZERO)
// Zero value handling
@0
D=A
@result
M=D
@END
0;JMP
(NEGATIVE)
// Negative value handling
@-1
D=A
@result
M=D
(END)
// Infinite loop
@END
0;JMP
// Variable declarations (will be resolved by assembler)
@counter
@total
@average