commit 2ffc18b08ca04a6774f0ac2841e255b8898b29ed from: Sven M. Hallberg date: Fri Sep 09 09:00:16 2022 UTC comments/style in .hack files commit - c13dce56093d2a9cf83bce6cd5326e9f0e7419a5 commit + 2ffc18b08ca04a6774f0ac2841e255b8898b29ed blob - 9ffbed78760266c3d708367878e4142f65682c94 blob + 0f265306627157dd88188865eaa84f84c18aa778 --- add.hack +++ add.hack @@ -1,4 +1,4 @@ -# compute D=2+3, store result in R0 + # compute D=2+3, store result in R0 0 000000000000010 # 0: @2 1 11 0 110000 010 000 # 1: D=A; (~0 & A) 0 000000000000011 # 2: @3 @@ -6,6 +6,6 @@ 0 000000000000000 # 4: @0 1 11 0 001100 001 000 # 5: M=D; (D & ~0) -# terminate (enter infinite loop) + # terminate (enter infinite loop) 0 000000000000111 # 6: @7 1 11 0 101000 000 111 # 7: 0;JMP (0 & 0) blob - 9b3be0acf11214cab8d0a5bb83f2c561452787c0 blob + 222a8f82b24d40310be54730605d30172d2d95fa --- max.hack +++ max.hack @@ -1,3 +1,4 @@ + # store 13 and 17 to R0 and R1, respectively 0 000000000001101 # 0: @13 <- arg 1 1 11 0 110000 010 000 # 1: D=A; 0 000000000000000 # 2: @0 @@ -7,6 +8,7 @@ 0 000000000000001 # 6: @1 1 11 1 001100 001 000 # 7: M=D; + # compute the maximum of R0 and R1, store in R2 0 000000000000000 # 8: @0 1 11 1 110000 010 000 # 9: D=M; 0 000000000000001 # 10: @1 @@ -22,5 +24,6 @@ 0 000000000000010 # 20: @2 1 11 0 001100 001 000 # 21: M=D; + # terminate 0 000000000010110 # 22: @22 1 11 0 101010 000 111 # 23: 0;JMP blob - 820043414bf5f9edaf7bd5755818a8edf5302351 blob + 63a0dadda69c8958a45890cd4c1fc450e276af22 --- term0.hack +++ term0.hack @@ -1,2 +1,2 @@ -# terminate (enter infinite loop), returns D = 0 + # terminate (enter infinite loop), returns D = 0 1 11 0 101000 000 111 # 0: 0;JMP (0 & 0) blob - a24db0d081dc3194a28cb5ae19033e42633b0576 blob + 3cc587a9b9847c2bb22c3c26669b70b1379bfb36 --- term1.hack +++ term1.hack @@ -1,4 +1,4 @@ -# terminate (enter infinite loop) and return 1 + # terminate (enter infinite loop) and return 1 1 11 0 111111 010 000 # 0: D=1; (~ (~0 + ~0)) 0 000000000000010 # 1: @2 1 11 0 101000 000 111 # 2: 0;JMP (0 & 0) blob - 178479808f68e6e4f16acee052916026e89cb05b blob + e37ea65c2444d581333dc307b0031bffcba0d362 --- term2.hack +++ term2.hack @@ -1,4 +1,4 @@ -# terminate with idiomatic two-instruction loop, return 23 + # terminate with two-instruction loop, return 23 0 000000000010111 # 0: @23 1 11 0 110000 010 000 # 1: D=A; (~0 & A) 0 000000000000010 # 2: @2