// 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