summaryrefslogtreecommitdiff
path: root/mknes.c
diff options
context:
space:
mode:
Diffstat (limited to 'mknes.c')
-rw-r--r--mknes.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/mknes.c b/mknes.c
index f68493c..8169fae 100644
--- a/mknes.c
+++ b/mknes.c
@@ -299,9 +299,9 @@ int main(int argc, char **argv) {
// ines2_load(nstate, "data/0000/10-Yard Fight (USA, Europe).nes");
// ines2_load(nstate, "data/0000/Balloon Fight (USA).nes");
// ines2_load(nstate, "data/0000/Excitebike (Japan, USA).nes");
- // ines2_load(nstate, "data/0000/Ice Climber (USA, Europe, Korea).nes");
+ ines2_load(nstate, "data/0000/Ice Climber (USA, Europe, Korea).nes");
// ines2_load(nstate, "data/0000/Kung Fu (Japan, USA).nes");
- ines2_load(nstate, "data/0000/Super Mario Bros. (World) (HVC-SM).nes");
+ // ines2_load(nstate, "data/0000/Super Mario Bros. (World) (HVC-SM).nes");
// ines2_load(nstate, "data/Super Mario Bros. (W) (V1.0) [!].nes");
// ines2_load(nstate, "data/Super Mario Bros. (JU) [!].nes");
// ines2_load(nstate, "data/0000/Urban Champion (World).nes");
@@ -342,8 +342,8 @@ int main(int argc, char **argv) {
// ines2_load(nstate, "data/2002/Best of the Best - Championship Karate (USA).zip");
// ines2_load(nstate, "data/0001/Kid Icarus (UE) (V1.1) [!].nes");
- // ines2_load(nstate, "data/0001/Metroid (U) [!].nes");
- // ines2_load(nstate, "data/0001/Legend of Zelda, The (U) (V1.1) [!].nes");
+ ines2_load(nstate, "data/0001/Metroid (U) [!].nes");
+ ines2_load(nstate, "data/0001/Legend of Zelda, The (U) (V1.1) [!].nes");
// ines2_load(nstate, "data/Blaster Master (USA).zip"); // mapper 1
// ines2_load(nstate, "AccuracyCoin.nes"); // mapper 1
@@ -377,17 +377,37 @@ int main(int argc, char **argv) {
// // Check for ESC key
if(mkfw_is_key_pressed(window, MKS_KEY_ESCAPE)) running = false;
+ uint32_t n = -1;
+ if(mkfw_is_key_pressed(window, MKS_KEY_Q)) n = 0;
+ if(mkfw_is_key_pressed(window, MKS_KEY_W)) n = 1;
+ if(mkfw_is_key_pressed(window, MKS_KEY_E)) n = 2;
+ if(mkfw_is_key_pressed(window, MKS_KEY_R)) n = 3;
+
+ if(n != -1) {
+ printf("\033[2J\033[H");
+ uint8_t *d = nstate->ciram + n * 960;
+ for(size_t i = 0; i < 30; ++i, d += 32) {
+ for(size_t j = 0; j < 32; ++j) {
+ uint8_t tile = d[j];
+ if(tile == 0x00) printf(" ");
+ else if(tile == 0xff) printf("##");
+ else printf("%02d", tile % 100);
+ }
+ printf("\n");
+ }
+ }
+
// Joypad input
uint8_t input = 0;
- // if(window->keyboard_state[MKS_KEY_X]) { input |= (1 << 0); }
- // if(window->keyboard_state[MKS_KEY_Z]) { input |= (1 << 1); }
- // if(window->keyboard_state[MKS_KEY_SPACE]) { input |= (1 << 2); }
- // if(window->keyboard_state[MKS_KEY_RETURN]) { input |= (1 << 3); }
- // if(window->keyboard_state[MKS_KEY_UP]) { input |= (1 << 4); }
- // if(window->keyboard_state[MKS_KEY_DOWN]) { input |= (1 << 5); }
- // if(window->keyboard_state[MKS_KEY_LEFT]) { input |= (1 << 6); }
- // if(window->keyboard_state[MKS_KEY_RIGHT]) { input |= (1 << 7); }
- // nstate->ppu.input[0] = input;
+ if(window->keyboard_state[MKS_KEY_X]) { input |= (1 << 0); }
+ if(window->keyboard_state[MKS_KEY_Z]) { input |= (1 << 1); }
+ if(window->keyboard_state[MKS_KEY_SPACE]) { input |= (1 << 2); }
+ if(window->keyboard_state[MKS_KEY_RETURN]) { input |= (1 << 3); }
+ if(window->keyboard_state[MKS_KEY_UP]) { input |= (1 << 4); }
+ if(window->keyboard_state[MKS_KEY_DOWN]) { input |= (1 << 5); }
+ if(window->keyboard_state[MKS_KEY_LEFT]) { input |= (1 << 6); }
+ if(window->keyboard_state[MKS_KEY_RIGHT]) { input |= (1 << 7); }
+ nstate->ppu.input[0] = input;
// Run NES emulation for one frame
while(!nstate->ppu.frame_ready) {
@@ -402,7 +422,7 @@ int main(int argc, char **argv) {
// }
// nstate->ppu.open_bus = v;
// }
- nstate->ppu.input[0] = tas_input[tas_frame++];
+ // nstate->ppu.input[0] = tas_input[tas_frame++];
frames++;
@@ -435,7 +455,7 @@ int main(int argc, char **argv) {
}
}
- printf("total frames: %6d total cycles: %12llu\n", frames, (unsigned long long)nstate->cpu.cycles);
+ // printf("total frames: %6d total cycles: %12llu\n", frames, (unsigned long long)nstate->cpu.cycles);
printf("state dumps created: %zu\n", state_dump_count);
if(state_dump_file) {