diff --git a/src/86box.c b/src/86box.c index 3ade3c4e2..e1cf61b64 100644 --- a/src/86box.c +++ b/src/86box.c @@ -210,6 +210,7 @@ int video_fullscreen_scale_maximized = 0; /* (C) Whether int do_auto_pause = 0; /* (C) Auto-pause the emulator on focus loss */ int hook_enabled = 1; /* (C) Keyboard hook is enabled */ +int test_mode = 0; /* (C) Test mode */ char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */ int other_ide_present = 0; /* IDE controllers from non-IDE cards are @@ -585,6 +586,7 @@ usage: #ifndef USE_SDL_UI printf("-S or --settings - show only the settings dialog\n"); #endif + printf("-T or --testmode - test mode: execute the test mode entry point on init/hard reset\n"); printf("-V or --vmname name - overrides the name of the running VM\n"); printf("-W or --nohook - disables keyboard hook (compatibility-only outside Windows)\n"); printf("-X or --clear what - clears the 'what' (cmos/flash/both)\n"); @@ -656,6 +658,8 @@ usage: } else if (!strcasecmp(argv[c], "--settings") || !strcasecmp(argv[c], "-S")) { settings_only = 1; #endif + } else if (!strcasecmp(argv[c], "--testmode") || !strcasecmp(argv[c], "-T")) { + test_mode = 1; } else if (!strcasecmp(argv[c], "--noconfirm") || !strcasecmp(argv[c], "-N")) { confirm_exit_cmdl = 0; } else if (!strcasecmp(argv[c], "--missing") || !strcasecmp(argv[c], "-M")) { @@ -1112,6 +1116,23 @@ pc_send_cae(void) pc_send_ca(1); } +/* + Currently available API: + + extern void prefetch_queue_set_pos(int pos); + extern void prefetch_queue_set_ip(uint16_t ip); + extern void prefetch_queue_set_prefetching(int p); + extern int prefetch_queue_get_pos(void); + extern uint16_t prefetch_queue_get_ip(void); + extern int prefetch_queue_get_prefetching(void); + extern int prefetch_queue_get_size(void); + */ +static void +pc_test_mode_entry_point(void) +{ + pclog("Test mode entry point\n=====================\n"); +} + void pc_reset_hard_close(void) { @@ -1313,6 +1334,9 @@ pc_reset_hard_init(void) update_mouse_msg(); + if (test_mode) + pc_test_mode_entry_point(); + ui_hard_reset_completed(); } diff --git a/src/cpu/808x.c b/src/cpu/808x.c index a74cf84ab..e3a326503 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -154,6 +154,48 @@ x808x_log(const char *fmt, ...) static void pfq_add(int c, int add); static void set_pzs(int bits); +void +prefetch_queue_set_pos(int pos) +{ + pfq_pos = pos; +} + +void +prefetch_queue_set_ip(uint16_t ip) +{ + pfq_ip = ip; +} + +void +prefetch_queue_set_prefetching(int p) +{ + prefetching = p; +} + +int +prefetch_queue_get_pos(void) +{ + return pfq_pos; +} + +uint16_t +prefetch_queue_get_ip(void) +{ + return pfq_ip; +} + +int +prefetch_queue_get_prefetching(void) +{ + return prefetching; +} + +int +prefetch_queue_get_size(void) +{ + return pfq_size; +} + uint16_t get_last_addr(void) { diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index bd841ccc6..ab4bad8b0 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -821,4 +821,12 @@ extern int cpu_override_interpreter; extern int is_lock_legal(uint32_t fetchdat); +extern void prefetch_queue_set_pos(int pos); +extern void prefetch_queue_set_ip(uint16_t ip); +extern void prefetch_queue_set_prefetching(int p); +extern int prefetch_queue_get_pos(void); +extern uint16_t prefetch_queue_get_ip(void); +extern int prefetch_queue_get_prefetching(void); +extern int prefetch_queue_get_size(void); + #endif /*EMU_CPU_H*/