diff options
Diffstat (limited to 'projects/11/ComplexArrays')
-rw-r--r-- | projects/11/ComplexArrays/Main.vm | 681 |
1 files changed, 681 insertions, 0 deletions
diff --git a/projects/11/ComplexArrays/Main.vm b/projects/11/ComplexArrays/Main.vm new file mode 100644 index 0000000..dc83733 --- /dev/null +++ b/projects/11/ComplexArrays/Main.vm @@ -0,0 +1,681 @@ +function Main.main 3 +push constant 10 +call Array.new 1 +pop local 0 +push constant 5 +call Array.new 1 +pop local 1 +push constant 1 +call Array.new 1 +pop local 2 +push constant 2 +push local 0 +push constant 3 +add +pop pointer 1 +pop that 0 +push constant 8 +push local 0 +push constant 4 +add +pop pointer 1 +pop that 0 +push constant 4 +push local 0 +push constant 5 +add +pop pointer 1 +pop that 0 +push local 0 +push constant 3 +add +pop pointer 1 +push that 0 +push constant 3 +add +push local 1 +push local 0 +push constant 3 +add +pop pointer 1 +push that 0 +add +pop pointer 1 +pop that 0 +push local 0 +push local 0 +push constant 5 +add +pop pointer 1 +push that 0 +add +pop pointer 1 +push that 0 +push local 1 +push constant 7 +push local 0 +push constant 3 +add +pop pointer 1 +push that 0 +sub +push constant 2 +call Main.double 1 +sub +push constant 1 +add +add +pop pointer 1 +push that 0 +call Math.multiply 2 +push local 0 +push local 1 +push local 0 +push constant 3 +add +pop pointer 1 +push that 0 +add +pop pointer 1 +push that 0 +add +pop pointer 1 +pop that 0 +push constant 0 +push local 2 +push constant 0 +add +pop pointer 1 +pop that 0 +push local 2 +push constant 0 +add +pop pointer 1 +push that 0 +pop local 2 +push constant 43 +call String.new 1 +push constant 84 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 49 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 120 +call String.appendChar 2 +push constant 112 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 100 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 53 +call String.appendChar 2 +push constant 59 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +call Output.printString 1 +pop temp 0 +push local 1 +push constant 2 +add +pop pointer 1 +push that 0 +call Output.printInt 1 +pop temp 0 +call Output.println 0 +pop temp 0 +push constant 44 +call String.new 1 +push constant 84 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 50 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 120 +call String.appendChar 2 +push constant 112 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 100 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 52 +call String.appendChar 2 +push constant 48 +call String.appendChar 2 +push constant 59 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +call Output.printString 1 +pop temp 0 +push local 0 +push constant 5 +add +pop pointer 1 +push that 0 +call Output.printInt 1 +pop temp 0 +call Output.println 0 +pop temp 0 +push constant 43 +call String.new 1 +push constant 84 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 51 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 120 +call String.appendChar 2 +push constant 112 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 100 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 48 +call String.appendChar 2 +push constant 59 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +call Output.printString 1 +pop temp 0 +push local 2 +call Output.printInt 1 +pop temp 0 +call Output.println 0 +pop temp 0 +push constant 0 +pop local 2 +push local 2 +push constant 0 +eq +not +if-goto main.Else0 +push local 0 +push constant 10 +call Main.fill 2 +pop temp 0 +push local 0 +push constant 3 +add +pop pointer 1 +push that 0 +pop local 2 +push constant 33 +push local 2 +push constant 1 +add +pop pointer 1 +pop that 0 +push local 0 +push constant 7 +add +pop pointer 1 +push that 0 +pop local 2 +push constant 77 +push local 2 +push constant 1 +add +pop pointer 1 +pop that 0 +push local 0 +push constant 3 +add +pop pointer 1 +push that 0 +pop local 1 +push local 1 +push constant 1 +add +pop pointer 1 +push that 0 +push local 2 +push constant 1 +add +pop pointer 1 +push that 0 +add +push local 1 +push constant 1 +add +pop pointer 1 +pop that 0 +label main.Else0 +push constant 44 +call String.new 1 +push constant 84 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 52 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 120 +call String.appendChar 2 +push constant 112 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 100 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 55 +call String.appendChar 2 +push constant 55 +call String.appendChar 2 +push constant 59 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +call Output.printString 1 +pop temp 0 +push local 2 +push constant 1 +add +pop pointer 1 +push that 0 +call Output.printInt 1 +pop temp 0 +call Output.println 0 +pop temp 0 +push constant 45 +call String.new 1 +push constant 84 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 53 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 120 +call String.appendChar 2 +push constant 112 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 100 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 49 +call String.appendChar 2 +push constant 49 +call String.appendChar 2 +push constant 48 +call String.appendChar 2 +push constant 59 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 99 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 97 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +push constant 114 +call String.appendChar 2 +push constant 101 +call String.appendChar 2 +push constant 115 +call String.appendChar 2 +push constant 117 +call String.appendChar 2 +push constant 108 +call String.appendChar 2 +push constant 116 +call String.appendChar 2 +push constant 58 +call String.appendChar 2 +push constant 32 +call String.appendChar 2 +call Output.printString 1 +pop temp 0 +push local 1 +push constant 1 +add +pop pointer 1 +push that 0 +call Output.printInt 1 +pop temp 0 +call Output.println 0 +pop temp 0 +push constant 0 +return +function Main.double 0 +push argument 0 +push constant 2 +call Math.multiply 2 +return +function Main.fill 0 +label fill.While0 +push argument 1 +push constant 0 +gt +not +if-goto fill.EndWhile0 +push argument 1 +push constant 1 +sub +pop argument 1 +push constant 3 +call Array.new 1 +push argument 0 +push argument 1 +add +pop pointer 1 +pop that 0 +goto fill.While0 +label fill.EndWhile0 +push constant 0 +return |