-
Notifications
You must be signed in to change notification settings - Fork 39
/
Assembly.fs
73 lines (66 loc) · 1.08 KB
/
Assembly.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
######################################################
##
## Assembly:
##
## Support words and constants for using Maker
## in the manner of a conventional assembler and/or
## for making self-modifying code.
##
## John Earnest
##
######################################################
:const CONST 0
:const CALL 1
:const JUMP 2
:const JUMPZ 3
:const JUMPIF 4
:const LOAD 10
:const STOR 11
:const RETURN 12
:const DROP 13
:const SWAP 14
:const DUP 15
:const OVER 16
:const STR 17
:const RTS 18
:const ADD 19
:const SUB 20
:const MUL 21
:const DIV 22
:const MOD 23
:const AND 24
:const OR 25
:const XOR 26
:const NOT 27
:const SGT 28
:const SLT 29
:const SYNC 30
:const NEXT 31
######################################################
##
## A horrifying real-world example:
##
######################################################
(
:data hello "Hello, World!"
:data main
CONST hello
:data print
DUP
LOAD
DUP
if
CONST CO
STOR
else
DROP
DROP
CONST 10
CONST CO
STOR
JUMP -1
then
CONST 1
ADD
JUMP print
)