blob: 5554aefc903293efe659f134748c5c69d5b431a0 (
plain)
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
|
morris mano assembler
=====================
it reads the input file and output the hex equivalent
of the instructions. list of pseudoinstructions:
- ORG - DEC - HEX - END
instead of make decision based on counting words, i
made a general structure called token.
LOOP, STA SUM2 I / AC TO SUM2
----- --- ---- - ------------
0 1 2 3 4
0: label: ends with ',' -> lab[10]
1: symbol: check out the opcode.txt -> sym[3]
2: operand: cant start with digit -> opr[10]
3: indirect-address: opcode plus 8 -> ind
4: comment: starts with '/' !> not a part
!) just read the line till that.
or maybe we have something like this:
HEX B2D7
--- ----
0 1
0: pseudo-ops: put the !code -> psu
1: number: string for now -> opr[10]
!code)
ORG -> 1
DEC -> 2
HEX -> 3
END -> 4
i used stb_ds.h for hash table, please check out
the website nothings.org for more amazing projects.
|