Sun, 28 Nov 2010 23:08:06 +0000
add preliminary main loop
src/main.c | file | annotate | diff | revisions |
1.1 --- a/src/main.c Sun Nov 28 23:07:49 2010 +0000 1.2 +++ b/src/main.c Sun Nov 28 23:08:06 2010 +0000 1.3 @@ -245,8 +245,11 @@ 1.4 int main(void) 1.5 { 1.6 // copyright banner 1.7 - printf("FreeBee: A Quick-and-Dirty AT&T 3B1 Emulator\n"); 1.8 + printf("FreeBee: A Quick-and-Dirty AT&T 3B1 Emulator. Version %s, %s mode.\n", VER_FULLSTR, VER_BUILD_TYPE); 1.9 printf("Copyright (C) 2010 P. A. Pemberton.\n"); 1.10 + printf("Built %s by %s@%s.\n", VER_COMPILE_DATETIME, VER_COMPILE_BY, VER_COMPILE_HOST); 1.11 + printf("Compiler: %s\n", VER_COMPILER); 1.12 + printf("CFLAGS: %s\n", VER_CFLAGS); 1.13 printf("Musashi M680x0 emulator engine developed by Karl Stenerud <kstenerud@gmail.com>\n"); 1.14 1.15 // set up system state 1.16 @@ -268,7 +271,24 @@ 1.17 // repeat: 1.18 // m68k_execute() 1.19 // m68k_set_irq() every 60ms 1.20 - printf("ran for %d cycles\n", m68k_execute(100000)); 1.21 + int32_t dwTimerTickCounter, dwCpuCycles; 1.22 + const int32_t CLOCKS_PER_TIMER_TICK = 10e6/60; //< number of clocks per 60Hz timer tick 1.23 + 1.24 + // initialise emulation variables 1.25 + dwTimerTickCounter = CLOCKS_PER_TIMER_TICK; 1.26 + bool exitEmu = false; 1.27 + for (;;) { 1.28 + dwCpuCycles = m68k_execute(10e6/60); 1.29 + dwTimerTickCounter -= dwCpuCycles; 1.30 + 1.31 + // check for timer tick expiry 1.32 + if (dwTimerTickCounter <= 0) { 1.33 + // TODO: Timer Tick IRQ 1.34 + 1.35 + } 1.36 + 1.37 + if (exitEmu) break; 1.38 + } 1.39 1.40 // shut down and exit 1.41