Browse code

Removed hardcoded number for LIT opcode in asm

neauoire authored on 29/08/2021 18:25:58
Showing 1 changed files
... ...
@@ -59,30 +59,6 @@ static char *scat(char *dst, const char *src) { char *ptr = dst + slen(dst); whi
59 59
 
60 60
 #pragma mark - I/O
61 61
 
62
-static void
63
-pushbyte(Uint8 b, int lit)
64
-{
65
-	if(lit) pushbyte(0x80, 0);
66
-	p.data[p.ptr++] = b;
67
-	p.length = p.ptr;
68
-}
69
-
70
-static void
71
-pushshort(Uint16 s, int lit)
72
-{
73
-	if(lit) pushbyte(0x20, 0);
74
-	pushbyte((s >> 8) & 0xff, 0);
75
-	pushbyte(s & 0xff, 0);
76
-}
77
-
78
-static void
79
-pushword(char *s)
80
-{
81
-	int i = 0;
82
-	char c;
83
-	while((c = s[i++])) pushbyte(c, 0);
84
-}
85
-
86 62
 static Macro *
87 63
 findmacro(char *name)
88 64
 {
... ...
@@ -129,6 +105,30 @@ findopcode(char *s)
129 105
 	return 0;
130 106
 }
131 107
 
108
+static void
109
+pushbyte(Uint8 b, int lit)
110
+{
111
+	if(lit) pushbyte(findopcode("LIT"), 0);
112
+	p.data[p.ptr++] = b;
113
+	p.length = p.ptr;
114
+}
115
+
116
+static void
117
+pushshort(Uint16 s, int lit)
118
+{
119
+	if(lit) pushbyte(findopcode("LIT2"), 0);
120
+	pushbyte((s >> 8) & 0xff, 0);
121
+	pushbyte(s & 0xff, 0);
122
+}
123
+
124
+static void
125
+pushword(char *s)
126
+{
127
+	int i = 0;
128
+	char c;
129
+	while((c = s[i++])) pushbyte(c, 0);
130
+}
131
+
132 132
 static char *
133 133
 sublabel(char *src, char *scope, char *name)
134 134
 {