aboutsummaryrefslogtreecommitdiff
path: root/projects/11/Average
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-15 12:07:13 +0100
committerYuchen Pei <me@ypei.me>2018-01-15 12:07:13 +0100
commit09c40f135cb3f69599457a5b278d29bcb38fa6ef (patch)
treed92034782bafc958fe1077ba575534d7a7b7f587 /projects/11/Average
parent459776159903ab583c0791b1599ec4fc47da8f79 (diff)
checkpoint
Diffstat (limited to 'projects/11/Average')
-rw-r--r--projects/11/Average/Main.vm147
1 files changed, 147 insertions, 0 deletions
diff --git a/projects/11/Average/Main.vm b/projects/11/Average/Main.vm
new file mode 100644
index 0000000..91772b9
--- /dev/null
+++ b/projects/11/Average/Main.vm
@@ -0,0 +1,147 @@
+function Main.main 4
+push constant 18
+call String.new 1
+push constant 72
+call String.appendChar 2
+push constant 111
+call String.appendChar 2
+push constant 119
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+push constant 109
+call String.appendChar 2
+push constant 97
+call String.appendChar 2
+push constant 110
+call String.appendChar 2
+push constant 121
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+push constant 110
+call String.appendChar 2
+push constant 117
+call String.appendChar 2
+push constant 109
+call String.appendChar 2
+push constant 98
+call String.appendChar 2
+push constant 101
+call String.appendChar 2
+push constant 114
+call String.appendChar 2
+push constant 115
+call String.appendChar 2
+push constant 63
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+call Keyboard.readInt 1
+pop local 1
+push local 1
+call Array.new 1
+pop local 0
+push constant 0
+pop local 2
+label main.While0
+push local 2
+push local 1
+lt
+not
+if-goto main.EndWhile0
+push constant 16
+call String.new 1
+push constant 69
+call String.appendChar 2
+push constant 110
+call String.appendChar 2
+push constant 116
+call String.appendChar 2
+push constant 101
+call String.appendChar 2
+push constant 114
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+push constant 97
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+push constant 110
+call String.appendChar 2
+push constant 117
+call String.appendChar 2
+push constant 109
+call String.appendChar 2
+push constant 98
+call String.appendChar 2
+push constant 101
+call String.appendChar 2
+push constant 114
+call String.appendChar 2
+push constant 58
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+call Keyboard.readInt 1
+push local 0
+push local 2
+add
+pop pointer 1
+pop that 0
+push local 3
+push local 0
+push local 2
+add
+pop pointer 1
+push that 0
+add
+pop local 3
+push local 2
+push constant 1
+add
+pop local 2
+goto main.While0
+label main.EndWhile0
+push constant 15
+call String.new 1
+push constant 84
+call String.appendChar 2
+push constant 104
+call String.appendChar 2
+push constant 101
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+push constant 97
+call String.appendChar 2
+push constant 118
+call String.appendChar 2
+push constant 101
+call String.appendChar 2
+push constant 114
+call String.appendChar 2
+push constant 97
+call String.appendChar 2
+push constant 103
+call String.appendChar 2
+push constant 101
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+push constant 105
+call String.appendChar 2
+push constant 115
+call String.appendChar 2
+push constant 32
+call String.appendChar 2
+call Output.printString 1
+pop temp 0
+push local 3
+push local 1
+call Math.divide 2
+call Output.printInt 1
+pop temp 0
+push constant 0
+return