Init commit

This commit is contained in:
2019-12-08 17:55:49 +01:00
commit 3c7376cca6
15 changed files with 977 additions and 0 deletions

45
examples/Fibonacci.mxc Normal file
View File

@@ -0,0 +1,45 @@
// Fibonacci program written in mexico - calculating all results below 1337
// Set up tape
push 1
pop
right
push 1
pop
left
// Fibonnacci loop
MAINLOOP:
// Calculate i + j
pusht
right
pusht
add
// Print out result
dup
print
// Overwrite i with j
pusht
left
pop
// Write result of calculation to j, and duplicate it for further usage
dup
right
pop
// Move head for a clean loop
left
// Check if we should already stop
push 1337
lt
not
push MAINLOOP
jmpc
// MAINLOOP END
// Calculated all fibonacci numbers below 1337 :) yay!

26
examples/HelloWorld.mxc Normal file
View File

@@ -0,0 +1,26 @@
// A simple Hello World program, only working with the stack
// Push "Hello World\0" in reverse order
push 0
push 100
push 108
push 114
push 111
push 87
push 32
push 111
push 108
push 108
push 101
push 72
PRINTLOOP:
// Print until encountering null byte
dup
print
push 0
eq
not
push PRINTLOOP
jmpc
// Done