fix issue with comments and error stop execution
2 files changed, 7 insertions(+), 6 deletions(-)

M src/tnyasm.c
M src/tnyemu.c
M src/tnyasm.c +1 -1
@@ 47,7 47,7 @@ int nextoken(char *t, FILE *fp)
 	int c;
 
 	c = readtoken(t, fp);
-	if (strcmp(t, "#") == 0) {
+	if (t[0] == '#') {
 		while ((c = fgetc(fp)) != EOF && c != '\n')
 			;
 		c = nextoken(t, fp);

          
M src/tnyemu.c +6 -5
@@ 189,9 189,6 @@ void loop(Tny *t)
 
 		while (SDL_PollEvent(&e) != 0) {
 			if (e.type == SDL_QUIT) {
-				SDL_DestroyRenderer(renderer);
-				SDL_DestroyWindow(window);
-				SDL_Quit();
 				return;
 			} else if (e.type == SDL_KEYDOWN) {
 				switch (e.key.keysym.sym) {

          
@@ 204,7 201,7 @@ void loop(Tny *t)
 				}
 				if (e.type == SDL_KEYDOWN) {
 					if (t->ram[1]) {
-						eval(t, t->ram[1]);
+						if (!eval(t, t->ram[1])) return;
 					}
 				}
 			} else if (e.type == SDL_KEYUP) {

          
@@ 220,7 217,7 @@ void loop(Tny *t)
 		}
 
 		if (t->ram[0]) {
-			eval(t, t->ram[0]);
+			if (!eval(t, t->ram[0])) return;
 		}
 		frame = (frame + 1) % 60;
 		redraw();

          
@@ 276,5 273,9 @@ int main(int argc, char **argv)
 
 	printf("\n");
 
+	SDL_DestroyRenderer(renderer);
+	SDL_DestroyWindow(window);
+	SDL_Quit();
+
 	return 0;
 }