// Test script file for syntax highlighting // This file demonstrates various test script features load CPU.hdl, output-file CPU.out, compare-to CPU.cmp, // Set up output format output-list time%S1.3.1 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.2 addressM%D1.5.1 pc%D0.5.0 DRegister[]%D1.7.1; // Test A-instruction: @12345 set instruction %B0011000000111001, tick, output, tock, output; // Test C-instruction: D=A set instruction %B1110110000010000, tick, output, tock, output; // Test memory access set instruction %B0101101110100000, // @23456 tick, output, tock, output; set instruction %B1110000111110000, // AD=A-D tick, output, tock, output; // Test RAM operations set RAM[0] 256, set RAM[1] 0, set RAM[2] 100, repeat 10 { ticktock; output; } // Test conditional operations set instruction %B0000001111101011, // @1003 tick, output, tock, output; set instruction %B1110001100001000, // M=D tick, output, tock, output; // Test jump operations set instruction %B0000000000001110, // @14 tick, output, tock, output; set instruction %B1110001100000100, // D;jlt tick, output, tock, output; // While loop test while RAM[0] > 0 { set RAM[0] RAM[0] - 1, ticktock; output; } // Reset test set reset 1; tick, output, tock, output; set instruction %B0111111111111111, // @32767 set reset 0; tick, output, tock, output; // Binary instruction tests set instruction %B1111110111100000, // A=M+1 tick, output, tock, output; set instruction %B1110001100101000, // AM=D tick, output, tock, output; // Test all jump conditions set instruction %B1110001100000001, // D;JGT tick, output, tock, output; set instruction %B1110001100000010, // D;JEQ tick, output, tock, output; set instruction %B1110001100000011, // D;JGE tick, output, tock, output; set instruction %B1110001100000100, // D;JLT tick, output, tock, output; set instruction %B1110001100000101, // D;JNE tick, output, tock, output; set instruction %B1110001100000110, // D;JLE tick, output, tock, output; set instruction %B1110001100000111, // D;JMP tick, output, tock, output; // Final output output; echo "Test completed successfully";