aboutsummaryrefslogtreecommitdiff
path: root/projects/12/ScreenTest/Math.vm
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-20 15:41:49 +0100
committerYuchen Pei <me@ypei.me>2018-01-20 15:41:49 +0100
commitd3a0cc3a8ba6dfeb64d3faeffdeb6845b60e5840 (patch)
treed58df9ec2480e2a9ec6240f9c797f83d1a0b1056 /projects/12/ScreenTest/Math.vm
parent3571f998b28fbc8d9250ba04c983935f10a16c15 (diff)
rearranged the dir for github
- removed tools and pdfs - rearranged the projects dirs - added md files - other minor changes
Diffstat (limited to 'projects/12/ScreenTest/Math.vm')
-rw-r--r--projects/12/ScreenTest/Math.vm472
1 files changed, 0 insertions, 472 deletions
diff --git a/projects/12/ScreenTest/Math.vm b/projects/12/ScreenTest/Math.vm
deleted file mode 100644
index 513fc1a..0000000
--- a/projects/12/ScreenTest/Math.vm
+++ /dev/null
@@ -1,472 +0,0 @@
-function Math.init 2
-push constant 1
-pop local 1
-push constant 0
-pop local 0
-push constant 16
-call Array.new 1
-pop static 0
-label WHILE_EXP0
-push local 0
-push constant 16
-lt
-not
-if-goto WHILE_END0
-push local 0
-push static 0
-add
-push local 1
-pop temp 0
-pop pointer 1
-push temp 0
-pop that 0
-push local 1
-push local 1
-add
-pop local 1
-push local 0
-push constant 1
-add
-pop local 0
-goto WHILE_EXP0
-label WHILE_END0
-push constant 0
-return
-function Math.bit 0
-push argument 0
-push argument 1
-push static 0
-add
-pop pointer 1
-push that 0
-and
-push constant 0
-eq
-not
-return
-function Math.sign 0
-push argument 0
-push constant 0
-gt
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push constant 1
-return
-goto IF_END0
-label IF_FALSE0
-push argument 0
-push constant 0
-lt
-if-goto IF_TRUE1
-goto IF_FALSE1
-label IF_TRUE1
-push constant 1
-neg
-return
-goto IF_END1
-label IF_FALSE1
-push constant 0
-return
-label IF_END1
-label IF_END0
-function Math.abs 0
-push argument 0
-push constant 0
-gt
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push argument 0
-return
-goto IF_END0
-label IF_FALSE0
-push argument 0
-neg
-return
-label IF_END0
-function Math.multiply 3
-push argument 0
-pop local 1
-push constant 0
-pop local 2
-push constant 0
-pop local 0
-label WHILE_EXP0
-push local 2
-push constant 16
-lt
-not
-if-goto WHILE_END0
-push argument 1
-push local 2
-call Math.bit 2
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push local 0
-push local 1
-add
-pop local 0
-label IF_FALSE0
-push local 1
-push local 1
-add
-pop local 1
-push local 2
-push constant 1
-add
-pop local 2
-goto WHILE_EXP0
-label WHILE_END0
-push local 0
-return
-function Math.divide 2
-push argument 0
-push constant 0
-gt
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push argument 1
-push constant 0
-gt
-if-goto IF_TRUE1
-goto IF_FALSE1
-label IF_TRUE1
-push argument 0
-push argument 1
-call Math.divide1 2
-return
-goto IF_END1
-label IF_FALSE1
-push argument 0
-push argument 1
-neg
-call Math.divide1 2
-neg
-return
-label IF_END1
-goto IF_END0
-label IF_FALSE0
-push argument 1
-push constant 0
-gt
-if-goto IF_TRUE2
-goto IF_FALSE2
-label IF_TRUE2
-push argument 0
-neg
-push argument 1
-call Math.divide1 2
-neg
-return
-goto IF_END2
-label IF_FALSE2
-push argument 0
-neg
-push argument 1
-neg
-call Math.divide1 2
-return
-label IF_END2
-label IF_END0
-function Math.divide1 1
-push argument 1
-push constant 0
-eq
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push constant 24
-call String.new 1
-push constant 69
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 111
-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
-push constant 100
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 118
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 98
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 122
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 46
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-push constant 0
-call Sys.error 1
-pop temp 0
-label IF_FALSE0
-push argument 1
-push argument 0
-gt
-push argument 1
-push constant 0
-lt
-or
-if-goto IF_TRUE1
-goto IF_FALSE1
-label IF_TRUE1
-push constant 0
-return
-label IF_FALSE1
-push argument 0
-push argument 1
-push constant 2
-call Math.multiply 2
-call Math.divide1 2
-pop local 0
-push argument 0
-push constant 2
-push local 0
-call Math.multiply 2
-push argument 1
-call Math.multiply 2
-sub
-push argument 1
-lt
-if-goto IF_TRUE2
-goto IF_FALSE2
-label IF_TRUE2
-push constant 2
-push local 0
-call Math.multiply 2
-return
-goto IF_END2
-label IF_FALSE2
-push constant 2
-push local 0
-call Math.multiply 2
-push constant 1
-add
-return
-label IF_END2
-function Math.length 1
-push constant 14
-pop local 0
-label WHILE_EXP0
-push local 0
-push static 0
-add
-pop pointer 1
-push that 0
-push argument 0
-gt
-not
-if-goto WHILE_END0
-push local 0
-push constant 1
-sub
-pop local 0
-goto WHILE_EXP0
-label WHILE_END0
-push local 0
-return
-function Math.sqrt 4
-push argument 0
-push constant 0
-lt
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push constant 40
-call String.new 1
-push constant 69
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 111
-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
-push constant 115
-call String.appendChar 2
-push constant 113
-call String.appendChar 2
-push constant 117
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 103
-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 101
-call String.appendChar 2
-push constant 103
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 118
-call String.appendChar 2
-push constant 101
-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 46
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-push constant 0
-call Sys.error 1
-pop temp 0
-label IF_FALSE0
-push argument 0
-call Math.length 1
-push constant 2
-call Math.divide 2
-pop local 1
-push constant 0
-pop local 0
-label WHILE_EXP0
-push local 1
-push constant 0
-lt
-not
-not
-if-goto WHILE_END0
-push local 0
-push local 1
-push static 0
-add
-pop pointer 1
-push that 0
-add
-pop local 2
-push local 2
-push local 2
-call Math.multiply 2
-pop local 3
-push local 3
-push argument 0
-gt
-not
-push local 3
-push constant 0
-gt
-and
-if-goto IF_TRUE1
-goto IF_FALSE1
-label IF_TRUE1
-push local 2
-pop local 0
-label IF_FALSE1
-push local 1
-push constant 1
-sub
-pop local 1
-goto WHILE_EXP0
-label WHILE_END0
-push local 0
-return
-function Math.max 0
-push argument 0
-push argument 1
-gt
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push argument 0
-return
-goto IF_END0
-label IF_FALSE0
-push argument 1
-return
-label IF_END0
-function Math.min 0
-push argument 0
-push argument 1
-lt
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push argument 0
-return
-goto IF_END0
-label IF_FALSE0
-push argument 1
-return
-label IF_END0