Browse code

(uxnasm) Removed lit flag for writebyte

neauoire authored on 27/11/2021 22:20:56
Showing 1 changed files
... ...
@@ -162,9 +162,8 @@ makelabel(char *name)
162 162
 }
163 163
 
164 164
 static void
165
-writebyte(Uint8 b, int lit)
165
+writebyte(Uint8 b)
166 166
 {
167
-	if(lit) writebyte(findopcode("LIT"), 0);
168 167
 	p.data[p.ptr++] = b;
169 168
 	p.length = p.ptr;
170 169
 	litlast = 0;
... ...
@@ -173,9 +172,10 @@ writebyte(Uint8 b, int lit)
173 172
 static void
174 173
 writeshort(Uint16 s, int lit)
175 174
 {
176
-	if(lit) writebyte(findopcode("LIT2"), 0);
177
-	writebyte((s >> 8) & 0xff, 0);
178
-	writebyte(s & 0xff, 0);
175
+	if(lit)
176
+		writebyte(findopcode("LIT2"));
177
+	writebyte(s >> 8);
178
+	writebyte(s & 0xff);
179 179
 }
180 180
 
181 181
 static void
... ...
@@ -185,12 +185,10 @@ writelitbyte(Uint8 b)
185 185
 		Uint8 hb = p.data[p.ptr - 1];
186 186
 		p.ptr -= 2;
187 187
 		writeshort((hb << 8) + b, 1);
188
-		litlast = 0;
189 188
 		return;
190 189
 	}
191
-	p.data[p.ptr++] = findopcode("LIT");
192
-	p.data[p.ptr++] = b;
193
-	p.length = p.ptr;
190
+	writebyte(findopcode("LIT"));
191
+	writebyte(b);
194 192
 	litlast = 1;
195 193
 }
196 194
 
... ...
@@ -292,22 +290,22 @@ tokenize(char *w, FILE *f)
292 290
 		writeshort(0xffff, 0);
293 291
 		break;
294 292
 	case '\'': /* raw char */
295
-		writebyte((Uint8)w[1], 0);
293
+		writebyte((Uint8)w[1]);
296 294
 		break;
297 295
 	case '"': /* raw string */
298 296
 		i = 0;
299 297
 		while((c = w[++i]))
300
-			writebyte(c, 0);
298
+			writebyte(c);
301 299
 		break;
302 300
 	case '[': break; /* ignored */
303 301
 	case ']': break; /* ignored */
304 302
 	default:
305 303
 		/* opcode */
306 304
 		if(findopcode(w) || scmp(w, "BRK", 4))
307
-			writebyte(findopcode(w), 0);
305
+			writebyte(findopcode(w));
308 306
 		/* raw byte */
309 307
 		else if(sihx(w) && slen(w) == 2)
310
-			writebyte(shex(w), 0);
308
+			writebyte(shex(w));
311 309
 		/* raw short */
312 310
 		else if(sihx(w) && slen(w) == 4)
313 311
 			writeshort(shex(w), 0);