aboutsummaryrefslogtreecommitdiff
path: root/projects/11/Square/Square.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/11/Square/Square.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/11/Square/Square.vm')
-rw-r--r--projects/11/Square/Square.vm298
1 files changed, 0 insertions, 298 deletions
diff --git a/projects/11/Square/Square.vm b/projects/11/Square/Square.vm
deleted file mode 100644
index 871ccf7..0000000
--- a/projects/11/Square/Square.vm
+++ /dev/null
@@ -1,298 +0,0 @@
-function Square.new 0
-push constant 3
-call Memory.alloc 1
-pop pointer 0
-push argument 0
-pop this 0
-push argument 1
-pop this 1
-push argument 2
-pop this 2
-push pointer 0
-call Square.draw 1
-pop temp 0
-push pointer 0
-return
-function Square.dispose 0
-push argument 0
-pop pointer 0
-push pointer 0
-call Memory.deAlloc 1
-pop temp 0
-push constant 0
-return
-function Square.draw 0
-push argument 0
-pop pointer 0
-push constant 1
-neg
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 0
-push this 2
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-push constant 0
-return
-function Square.erase 0
-push argument 0
-pop pointer 0
-push constant 0
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 0
-push this 2
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-push constant 0
-return
-function Square.incSize 0
-push argument 0
-pop pointer 0
-push this 1
-push this 2
-add
-push constant 254
-lt
-push this 0
-push this 2
-add
-push constant 510
-lt
-and
-not
-if-goto incSize.Else0
-push pointer 0
-call Square.erase 1
-pop temp 0
-push this 2
-push constant 2
-add
-pop this 2
-push pointer 0
-call Square.draw 1
-pop temp 0
-label incSize.Else0
-push constant 0
-return
-function Square.decSize 0
-push argument 0
-pop pointer 0
-push this 2
-push constant 2
-gt
-not
-if-goto decSize.Else0
-push pointer 0
-call Square.erase 1
-pop temp 0
-push this 2
-push constant 2
-sub
-pop this 2
-push pointer 0
-call Square.draw 1
-pop temp 0
-label decSize.Else0
-push constant 0
-return
-function Square.moveUp 0
-push argument 0
-pop pointer 0
-push this 1
-push constant 1
-gt
-not
-if-goto moveUp.Else0
-push constant 0
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 2
-add
-push constant 1
-sub
-push this 0
-push this 2
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-push this 1
-push constant 2
-sub
-pop this 1
-push constant 1
-neg
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 0
-push this 2
-add
-push this 1
-push constant 1
-add
-call Screen.drawRectangle 4
-pop temp 0
-label moveUp.Else0
-push constant 0
-return
-function Square.moveDown 0
-push argument 0
-pop pointer 0
-push this 1
-push this 2
-add
-push constant 254
-lt
-not
-if-goto moveDown.Else0
-push constant 0
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 0
-push this 2
-add
-push this 1
-push constant 1
-add
-call Screen.drawRectangle 4
-pop temp 0
-push this 1
-push constant 2
-add
-pop this 1
-push constant 1
-neg
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 2
-add
-push constant 1
-sub
-push this 0
-push this 2
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-label moveDown.Else0
-push constant 0
-return
-function Square.moveLeft 0
-push argument 0
-pop pointer 0
-push this 0
-push constant 1
-gt
-not
-if-goto moveLeft.Else0
-push constant 0
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 2
-add
-push constant 1
-sub
-push this 1
-push this 0
-push this 2
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-push this 0
-push constant 2
-sub
-pop this 0
-push constant 1
-neg
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 0
-push constant 1
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-label moveLeft.Else0
-push constant 0
-return
-function Square.moveRight 0
-push argument 0
-pop pointer 0
-push this 0
-push this 2
-add
-push constant 510
-lt
-not
-if-goto moveRight.Else0
-push constant 0
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 1
-push this 0
-push constant 1
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-push this 0
-push constant 2
-add
-pop this 0
-push constant 1
-neg
-call Screen.setColor 1
-pop temp 0
-push this 0
-push this 2
-add
-push constant 1
-sub
-push this 1
-push this 0
-push this 2
-add
-push this 1
-push this 2
-add
-call Screen.drawRectangle 4
-pop temp 0
-label moveRight.Else0
-push constant 0
-return