# HG changeset patch # User m15o # Date 1680856104 -7200 # Fri Apr 07 10:28:24 2023 +0200 # Node ID 4dcca1606979f9b29d6b8c678c7dc070afd8b6c7 # Parent df7636c92e69bd305a63b33ffb04e46c7323a7f6 fix issue with comments and error stop execution diff --git a/src/tnyasm.c b/src/tnyasm.c --- a/src/tnyasm.c +++ b/src/tnyasm.c @@ -47,7 +47,7 @@ int c; c = readtoken(t, fp); - if (strcmp(t, "#") == 0) { + if (t[0] == '#') { while ((c = fgetc(fp)) != EOF && c != '\n') ; c = nextoken(t, fp); diff --git a/src/tnyemu.c b/src/tnyemu.c --- a/src/tnyemu.c +++ b/src/tnyemu.c @@ -189,9 +189,6 @@ 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 @@ } 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 @@ } 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 @@ printf("\n"); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); + SDL_Quit(); + return 0; }