mirror of
https://github.com/soconnor0919/nand2tetris-zed.git
synced 2025-12-12 23:24:45 -05:00
- 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
107 lines
952 B
NASM
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
|