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