We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 602bca7 commit a4bca5aCopy full SHA for a4bca5a
src/clj_dcpu16/asm.clj
@@ -0,0 +1,31 @@
1
+(ns clj-dcpu16.asm
2
+ (:use [clojure.java.io]))
3
+
4
+(def opcode-map {"SET" 0x1 "ADD" 0x2 "SUB" 0x3 "MUL" 0x4 "DIV" 0x5
5
+ "MOD" 0x6 "SHL" 0x7 "SHR" 0x8 "AND" 0x9 "BOR" 0xA
6
+ "XOR" 0xB "IFE" 0xC "IFN" 0xD "IFG" 0xE "IFB" 0xF
7
+ "JSR" 0})
8
9
+(def comment-regex #"$;.*")
10
11
+(defn parse [line]
12
+ )
13
14
+(defn parse-lines [lines]
15
+ (map parse lines))
16
17
+(defn first-pass [lines])
18
19
+(defn second-pass [fp lines])
20
21
+(defn output [result w])
22
23
+(defn parse [filename]
24
+ (with-open [r (reader filename)
25
+ w (writer (str filename ".out"))]
26
+ (let [lines (line-seq r)]
27
+ (-> lines
28
+ parse-lines
29
+ first-pass
30
+ (second-pass lines)
31
+ (output w)))))
0 commit comments