|
@@ -71,7 +71,6 @@ int main(int argc, char **argv) {
|
71
|
71
|
|
72
|
72
|
int delay = 0;
|
73
|
73
|
int sound = 0;
|
74
|
|
- int frame = 0;
|
75
|
74
|
int press = 0;
|
76
|
75
|
int wait = 0;
|
77
|
76
|
int store = 0;
|
|
@@ -79,14 +78,10 @@ int main(int argc, char **argv) {
|
79
|
78
|
while (1) {
|
80
|
79
|
if (DEBUG) printf("0x%x ", state.program_counter);
|
81
|
80
|
|
82
|
|
- if (frame == 10)
|
83
|
|
- {
|
84
|
|
- frame = 0;
|
85
|
|
- if (delay > 0) --delay;
|
86
|
|
- if (sound > 0) --sound;
|
87
|
|
- memset(state.input, 0, 0x10);
|
88
|
|
- press = 0;
|
89
|
|
- }
|
|
81
|
+ if (delay > 0) --delay;
|
|
82
|
+ if (sound > 0) --sound;
|
|
83
|
+ memset(state.input, 0, 0x10);
|
|
84
|
+ press = 0;
|
90
|
85
|
|
91
|
86
|
// opcodes are 16 bits
|
92
|
87
|
|
|
@@ -117,6 +112,10 @@ int main(int argc, char **argv) {
|
117
|
112
|
wait = 0;
|
118
|
113
|
}
|
119
|
114
|
|
|
115
|
+ int ops = 0;
|
|
116
|
+
|
|
117
|
+ loop:;
|
|
118
|
+
|
120
|
119
|
word opcode = (state.memory[state.program_counter++] << 8) | (state.memory[state.program_counter++]);
|
121
|
120
|
|
122
|
121
|
switch (opcode & 0xF000)
|
|
@@ -403,6 +402,12 @@ int main(int argc, char **argv) {
|
403
|
402
|
}
|
404
|
403
|
if (DEBUG) printf("\n");
|
405
|
404
|
|
|
405
|
+ if (ops < 10)
|
|
406
|
+ {
|
|
407
|
+ ops++;
|
|
408
|
+ goto loop;
|
|
409
|
+ }
|
|
410
|
+
|
406
|
411
|
for (int x = 0; x < 64; ++x) {
|
407
|
412
|
for (int y = 0; y < 32; ++y)
|
408
|
413
|
{
|
|
@@ -422,8 +427,7 @@ int main(int argc, char **argv) {
|
422
|
427
|
|
423
|
428
|
SDL_RenderPresent(renderer);
|
424
|
429
|
|
425
|
|
- SDL_Delay(1);
|
426
|
|
- ++frame;
|
|
430
|
+ SDL_Delay(16);
|
427
|
431
|
// SDL_DestroyWindow(window);
|
428
|
432
|
// SDL_Quit();
|
429
|
433
|
}
|