2023-09-21 23:53:14 -04:00
|
|
|
/*
|
|
|
|
* =====================================================================================
|
|
|
|
*
|
|
|
|
* Filename: main.c
|
|
|
|
*
|
|
|
|
* Description: Emulator main loop
|
|
|
|
*
|
|
|
|
* Version: 1.0
|
|
|
|
* Created: 2023-09-21 09:50:34 PM
|
|
|
|
* Revision: none
|
|
|
|
* Compiler: gcc
|
|
|
|
*
|
|
|
|
* Author: William Nolin,
|
|
|
|
* Organization:
|
|
|
|
*
|
|
|
|
* =====================================================================================
|
|
|
|
*/
|
|
|
|
#include <stdlib.h>
|
2024-01-06 14:27:09 -05:00
|
|
|
#include <log.h>
|
2024-01-07 16:20:37 -05:00
|
|
|
#include "debugger/debugger.h"
|
2023-09-21 23:53:14 -04:00
|
|
|
|
2023-12-03 00:27:07 -05:00
|
|
|
#include "include/rom.h"
|
2024-01-06 14:27:09 -05:00
|
|
|
#include "include/system.h"
|
2023-09-21 23:53:14 -04:00
|
|
|
|
2024-01-07 16:20:37 -05:00
|
|
|
//int win() {
|
|
|
|
// printf("NCURSES\n");
|
|
|
|
//
|
|
|
|
// setlocale(LC_ALL, "");
|
|
|
|
// setenv("TERM", "xterm-256color", 1);
|
|
|
|
// setenv("TERMINFO", "/usr/share/terminfo", 1);
|
|
|
|
//
|
|
|
|
// initscr();
|
|
|
|
// printw("Hello World !!!");
|
|
|
|
// refresh();
|
|
|
|
// getch();
|
|
|
|
// endwin();
|
|
|
|
//
|
|
|
|
// return EXIT_SUCCESS;
|
|
|
|
//}
|
2023-12-23 16:35:23 -05:00
|
|
|
|
2024-01-07 16:20:37 -05:00
|
|
|
int main() {
|
2024-01-06 14:27:09 -05:00
|
|
|
System system;
|
2023-12-23 16:35:23 -05:00
|
|
|
|
2024-01-07 16:20:37 -05:00
|
|
|
log_set_level(LOG_INFO);
|
2024-01-06 14:27:09 -05:00
|
|
|
system_init(&system);
|
2023-12-23 16:35:23 -05:00
|
|
|
|
2024-01-07 16:20:37 -05:00
|
|
|
char *rom_path = "../test_roms/nestest.nes";
|
|
|
|
|
2024-01-06 14:27:09 -05:00
|
|
|
if (!rom_load(rom_path, &system)) {
|
|
|
|
system_uninit(&system);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2023-09-21 23:53:14 -04:00
|
|
|
|
2024-01-07 16:20:37 -05:00
|
|
|
start_debugger(&system);
|
|
|
|
|
2024-01-06 14:27:09 -05:00
|
|
|
system_uninit(&system);
|
2024-01-07 16:20:37 -05:00
|
|
|
return 0;
|
|
|
|
//
|
|
|
|
// system_start(&system);
|
|
|
|
// system_loop(&system);
|
|
|
|
// system_uninit(&system);
|
|
|
|
|
|
|
|
// return EXIT_SUCCESS;
|
2023-09-21 23:53:14 -04:00
|
|
|
|
2024-01-07 16:20:37 -05:00
|
|
|
// return win();
|
2024-01-06 14:27:09 -05:00
|
|
|
}
|