void testTapeIncrement(void) { // Arrange int expected_numbers[] = {2,5,7}; int actual_starting_numbers[] = {2,4,7}; Tape* expectedTape = tape_load(expected_numbers, 3, 1); Tape* actualTape = tape_load(actual_starting_numbers, 3, 1); printf("Expected: %s, Actual: %s\n", tape_to_string(expectedTape), tape_to_string(actualTape)); // Act tape_increment(actualTape); // Assert CU_ASSERT(tape_equals(expectedTape, actualTape)); printf("Expected: %s, Actual: %s\n", tape_to_string(expectedTape), tape_to_string(actualTape)); }
int main() { write_string("z88dk Multi8 bootstrap starting\n"); setup_memory_map(); if ( tape_load() == 0 ) { start(); } else { reset_memory_map(); write_string("Loading failed\n"); } }
int gui_loadt() { char tempname[260]; int ret; int xsize = windx - 32, ysize = windy - 16; memcpy(tempname, tape_fn, 260); ret=file_select_ex("Please choose a tape image", tempname, "UEF;CSW", 260, xsize, ysize); if (ret) { tape_close(); memcpy(tape_fn, tempname, 260); tape_load(tape_fn); tape_loaded = 1; } return D_CLOSE; }
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HMENU hmenu; RECT rect; int c; LRESULT r; switch (message) { case WM_COMMAND: hmenu = GetMenu(hwnd); switch (LOWORD(wParam)) { case IDM_FILE_RESET: EnterCriticalSection(&cs); main_reset(); LeaveCriticalSection(&cs); break; case IDM_FILE_LSTATE: EnterCriticalSection(&cs); if (!getfile(hwnd, "Save State (*.SNP)\0*.SNP\0All files (*.*)\0*.*\0\0", savestate_name)) { CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_UNCHECKED); savestate_load(); CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_CHECKED); CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_CHECKED); } main_cleardrawit(); LeaveCriticalSection(&cs); break; case IDM_FILE_SSTATE: EnterCriticalSection(&cs); if (curtube != -1) { log_error("Second processor save states not supported yet."); } else { if (!getsfile(hwnd, "Save State (*.SNP)\0*.SNP\0All files (*.*)\0*.*\0\0", savestate_name, "SNP")) savestate_save(); } main_cleardrawit(); LeaveCriticalSection(&cs); break; case IDM_FILE_EXIT: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case IDM_DISC_AUTOBOOT: if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[0])) { doautoboot = 1; } break; case IDM_DISC_LOAD_0: if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[0])) { disc_close(0); disc_load(0, discfns[0]); if (defaultwriteprot) writeprot[0] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_LOAD_1: if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[1])) { disc_close(1); disc_load(1, discfns[1]); if (defaultwriteprot) writeprot[1] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_EJECT_0: disc_close(0); discfns[0][0] = 0; setejecttext(0, ""); break; case IDM_DISC_EJECT_1: disc_close(1); discfns[1][0] = 0; setejecttext(1, ""); break; case IDM_DISC_NEW_0: if (!getsfile(hwnd, "Disc image (*.SSD;*.DSD;*.ADF;*.ADL)\0*.SSD;*.DSD;*.ADF;*.ADL\0All files (*.*)\0*.*\0", discfns[0], "SSD")) { disc_close(0); disc_new(0, discfns[0]); if (defaultwriteprot) writeprot[0] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_NEW_1: if (!getsfile(hwnd, "Disc image (*.SSD;*.DSD;*.ADF;*.ADL)\0*.SSD;*.DSD;*.ADF;*.ADL\0All files (*.*)\0*.*\0", discfns[1], "SSD")) { disc_close(1); disc_new(1, discfns[1]); if (defaultwriteprot) writeprot[1] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED); } break; case IDM_DISC_WPROT_0: writeprot[0] = !writeprot[0]; if (fwriteprot[0]) writeprot[0] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_WPROT_1: writeprot[1] = !writeprot[1]; if (fwriteprot[1]) writeprot[1] = 1; CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_WPROT_D: defaultwriteprot = !defaultwriteprot; CheckMenuItem(hmenu, IDM_DISC_WPROT_D, (defaultwriteprot) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_VDFS_ENABLE: vdfs_enabled = !vdfs_enabled; CheckMenuItem(hmenu, IDM_DISC_VDFS_ENABLE, (vdfs_enabled) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_DISC_VDFS_ROOT: strncpy(openfilestring, vdfs_get_root(), MAX_PATH); if (!getDir(hwnd, "VDFS Root")) vdfs_set_root(openfilestring); break; case IDM_TAPE_LOAD: if (!getfile(hwnd, "Tape image (*.UEF;*.CSW)\0*.UEF;*.CSW\0All files (*.*)\0*.*\0", tape_fn)) { tape_close(); tape_load(tape_fn); tape_loaded = 1; } break; case IDM_TAPE_EJECT: tape_close(); tape_loaded = 0; break; case IDM_TAPE_REWIND: tape_close(); tape_load(tape_fn); break; case IDM_TAPE_CAT: showcatalogue(hinstance, ghwnd); break; case IDM_TAPES_NORMAL: case IDM_TAPES_FAST: fasttape = LOWORD(wParam) - IDM_TAPES_NORMAL; CheckMenuItem(hmenu, IDM_TAPES_NORMAL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TAPES_FAST, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); break; case IDM_VIDEO_NOBORDERS: case IDM_VIDEO_MBORDERS: case IDM_VIDEO_FBORDERS: CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_UNCHECKED); vid_fullborders = LOWORD(wParam) - IDM_VIDEO_NOBORDERS; CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_CHECKED); break; case IDM_VIDEO_FULLSCR: fullscreen = 1; EnterCriticalSection(&cs); video_enterfullscreen(); LeaveCriticalSection(&cs); break; case IDM_VIDEO_NULA: if (nula_disable) nula_disable = 0; else nula_disable = 1; break; case IDM_VIDEO_RESIZE: videoresize = !videoresize; CheckMenuItem(hmenu, IDM_VIDEO_RESIZE, (videoresize) ? MF_CHECKED : MF_UNCHECKED); if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE); GetWindowRect(hwnd, &rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); break; case IDM_VIDEO_SLINEDBL: case IDM_VIDEO_LINEDBL: case IDM_VIDEO_SCANLINES: case IDM_VIDEO_INTERLACED: case IDM_VIDEO_PAL: case IDM_VIDEO_PALI: CheckMenuItem(hmenu, IDM_VIDEO_SLINEDBL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_LINEDBL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_SCANLINES, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_INTERLACED, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_PAL, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_VIDEO_PALI, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); vid_scanlines = vid_interlace = vid_linedbl = vid_pal = 0; if (LOWORD(wParam) == IDM_VIDEO_INTERLACED) vid_interlace = 1; if (LOWORD(wParam) == IDM_VIDEO_SCANLINES) vid_scanlines = 1; if (LOWORD(wParam) == IDM_VIDEO_SLINEDBL) vid_linedbl = 1; if (LOWORD(wParam) == IDM_VIDEO_PAL) vid_pal = 1; if (LOWORD(wParam) == IDM_VIDEO_PALI) vid_interlace = vid_pal = 1; video_clearscreen(); break; case IDM_TUBE_NONE: case IDM_TUBE_6502: case IDM_TUBE_Z80: case IDM_TUBE_65816: case IDM_TUBE_32016: CheckMenuItem(hmenu, IDM_TUBE_NONE, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_6502, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_65816, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_Z80, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBE_32016, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); selecttube = LOWORD(wParam) - IDM_TUBE_6502; main_restart(); break; case IDM_TUBES_4: case IDM_TUBES_8: case IDM_TUBES_16: case IDM_TUBES_32: case IDM_TUBES_64: CheckMenuItem(hmenu, IDM_TUBES_4, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_8, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_16, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_32, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_TUBES_64, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); tube_6502_speed = (LOWORD(wParam) - IDM_TUBES_4) + 1; tube_updatespeed(); break; case IDM_SOUND_INTERNAL: sound_internal = !sound_internal; CheckMenuItem(hmenu, IDM_SOUND_INTERNAL, (sound_internal) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_BEEBSID: sound_beebsid = !sound_beebsid; CheckMenuItem(hmenu, IDM_SOUND_BEEBSID, (sound_beebsid) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_MUSIC5000: sound_music5000 = !sound_music5000; CheckMenuItem(hmenu, IDM_SOUND_MUSIC5000, (sound_music5000) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_DAC: sound_dac = !sound_dac; CheckMenuItem(hmenu, IDM_SOUND_DAC, (sound_dac) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_DDNOISE: sound_ddnoise = !sound_ddnoise; CheckMenuItem(hmenu, IDM_SOUND_DDNOISE, (sound_ddnoise) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_TAPE: sound_tape = !sound_tape; CheckMenuItem(hmenu, IDM_SOUND_TAPE, (sound_tape) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_SOUND_FILTER: sound_filter = !sound_filter; CheckMenuItem(hmenu, IDM_SOUND_FILTER, (sound_filter) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_WAVE_SQUARE: case IDM_WAVE_SAW: case IDM_WAVE_SINE: case IDM_WAVE_TRI: case IDM_WAVE_SID: CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_UNCHECKED); curwave = LOWORD(wParam) - IDM_WAVE_SQUARE; CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_CHECKED); break; case IDM_SID_INTERP: case IDM_SID_RESAMP: CheckMenuItem(hmenu, IDM_SID_INTERP, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_SID_RESAMP, MF_UNCHECKED); CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED); sidmethod = LOWORD(wParam) - IDM_SID_INTERP; sid_settype(sidmethod, cursid); break; case IDM_DDV_33: case IDM_DDV_66: case IDM_DDV_100: CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_UNCHECKED); ddnoise_vol = (LOWORD(wParam) - IDM_DDV_33) + 1; CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_CHECKED); break; case IDM_DDT_525: case IDM_DDT_35: CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type, MF_UNCHECKED); ddnoise_type = LOWORD(wParam) - IDM_DDT_525; CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type, MF_CHECKED); ddnoise_close(); ddnoise_init(); break; case IDM_DEBUGGER: EnterCriticalSection(&cs); rest(200); debug_toggle_core(); CheckMenuItem(hmenu, IDM_DEBUGGER, (debug_core) ? MF_CHECKED: MF_UNCHECKED); LeaveCriticalSection(&cs); break; case IDM_DEBUG_TUBE: EnterCriticalSection(&cs); rest(200); debug_toggle_tube(); CheckMenuItem(hmenu, IDM_DEBUG_TUBE, (debug_tube) ? MF_CHECKED: MF_UNCHECKED); LeaveCriticalSection(&cs); break; case IDM_BREAK: debug_step = 1; break; case IDM_SCRSHOT: if (!getsfile(hwnd, "Bitmap file (*.BMP)\0*.BMP\0All files (*.*)\0*.*\0", vid_scrshotname, "BMP")) { vid_savescrshot = 1; } break; case IDM_KEY_REDEFINE: redefinekeys(); break; case IDM_KEY_AS: keyas = !keyas; CheckMenuItem(hmenu, IDM_KEY_AS, (keyas) ? MF_CHECKED : MF_UNCHECKED); break; case IDM_MOUSE_AMX: mouse_amx = !mouse_amx; CheckMenuItem(hmenu, IDM_MOUSE_AMX, (mouse_amx) ? MF_CHECKED : MF_UNCHECKED); main_setmouse(); updatewindowtitle(); break; case IDM_SCSI_ENABLE: EnterCriticalSection(&cs); CheckMenuItem(hmenu, IDM_SCSI_ENABLE, (!scsi_enabled) ? MF_CHECKED : MF_UNCHECKED); scsi_enabled = !scsi_enabled; main_restart(); LeaveCriticalSection(&cs); break; case IDM_IDE_ENABLE: EnterCriticalSection(&cs); CheckMenuItem(hmenu, IDM_IDE_ENABLE, (!ide_enable) ? MF_CHECKED : MF_UNCHECKED); ide_enable = !ide_enable; main_restart(); LeaveCriticalSection(&cs); break; case IDM_SPD_10: case IDM_SPD_25: case IDM_SPD_50: case IDM_SPD_75: case IDM_SPD_100: case IDM_SPD_150: case IDM_SPD_200: case IDM_SPD_300: case IDM_SPD_400: case IDM_SPD_500: CheckMenuItem(hmenu, IDM_SPD_10 + emuspeed, MF_UNCHECKED); emuspeed = curmodel = LOWORD(wParam) - IDM_SPD_10; changetimerspeed(timerspeeds[emuspeed]); vid_fskipmax = frameskips[emuspeed]; CheckMenuItem(hmenu, IDM_SPD_10 + emuspeed, MF_CHECKED); break; } if (LOWORD(wParam) >= IDM_MODEL_0 && LOWORD(wParam) < (IDM_MODEL_0 + 50)) { CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_UNCHECKED); oldmodel = curmodel; curmodel = LOWORD(wParam) - IDM_MODEL_0; CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_CHECKED); main_restart(); updatewindowtitle(); } if (LOWORD(wParam) >= IDM_SID_TYPE && LOWORD(wParam) < (IDM_SID_TYPE + 100)) { CheckMenuItem(hmenu, IDM_SID_TYPE + cursid, MF_UNCHECKED); cursid = LOWORD(wParam) - IDM_SID_TYPE; CheckMenuItem(hmenu, IDM_SID_TYPE + cursid, MF_CHECKED); sid_settype(sidmethod, cursid); } return 0; case WM_USER: if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE); GetWindowRect(hwnd, &rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); break; case WM_USER+1: if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW & ~WS_VISIBLE); else SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) & ~WS_VISIBLE); GetWindowRect(hwnd,&rect); SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED); break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case WM_KILLFOCUS: // log_debug("KillFocus\n"); // infocus=0; // spdcount=0; if (mousecapture) { ClipCursor(&oldclip); mousecapture = 0; updatewindowtitle(); } break; case WM_LBUTTONUP: if (!mousecapture && (curtube == 3 || mouse_amx)) { GetClipCursor(&oldclip); GetWindowRect(hwnd, &newclip); newclip.left += GetSystemMetrics(SM_CXFIXEDFRAME) + 10; newclip.right -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; newclip.top += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 10; newclip.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10; ClipCursor(&newclip); mousecapture = 1; updatewindowtitle(); } break; case WM_ENTERMENULOOP: // log_debug("EnterMenuLoop\n"); bempause = 1; //EnterCriticalSection(&cs); break; case WM_EXITMENULOOP: // log_debug("ExitMenuLoop\n"); bempause = 0; key_clear(); for (c = 0; c < 128; c++) key[c] = 0; //LeaveCriticalSection(&cs); break; case WM_SETFOCUS: // log_debug("SetFocus\n"); key_clear(); for (c = 0; c < 128; c++) key[c] = 0; bempause = 0; break; case WM_SIZE: winsizex = lParam & 0xFFFF; winsizey = lParam >> 16; break; case WM_SYSKEYDOWN: case WM_KEYDOWN: if (LOWORD(wParam) != 255) { //log_debug("Key %04X %04X\n",LOWORD(wParam),VK_LEFT); c = MapVirtualKey(LOWORD(wParam),0); c = hw_to_mycode[c]; // log_debug("MVK %i %i %i\n",c,hw_to_mycode[c],KEY_PGUP); if (LOWORD(wParam) == VK_LEFT) c = KEY_LEFT; if (LOWORD(wParam) == VK_RIGHT) c = KEY_RIGHT; if (LOWORD(wParam) == VK_UP) c = KEY_UP; if (LOWORD(wParam) == VK_DOWN) c = KEY_DOWN; if (LOWORD(wParam) == VK_HOME) c = KEY_HOME; if (LOWORD(wParam) == VK_END) c = KEY_END; if (LOWORD(wParam) == VK_INSERT) c = KEY_INSERT; if (LOWORD(wParam) == VK_DELETE) c = KEY_DEL; if (LOWORD(wParam) == VK_PRIOR) c = KEY_PGUP; if (LOWORD(wParam) == VK_NEXT) c = KEY_PGDN; //log_debug("MVK2 %i %i %i\n",c,hw_to_mycode[c],KEY_PGUP); key[c]=1; } break; case WM_SYSKEYUP: case WM_KEYUP: if (LOWORD(wParam) != 255) { // log_debug("Key %04X %04X\n",LOWORD(wParam),VK_LEFT); c = MapVirtualKey(LOWORD(wParam), 0); c = hw_to_mycode[c]; if (LOWORD(wParam) == VK_LEFT) c = KEY_LEFT; if (LOWORD(wParam) == VK_RIGHT) c = KEY_RIGHT; if (LOWORD(wParam) == VK_UP) c = KEY_UP; if (LOWORD(wParam) == VK_DOWN) c = KEY_DOWN; if (LOWORD(wParam) == VK_HOME) c = KEY_HOME; if (LOWORD(wParam) == VK_END) c = KEY_END; if (LOWORD(wParam) == VK_INSERT) c = KEY_INSERT; if (LOWORD(wParam) == VK_DELETE) c = KEY_DEL; if (LOWORD(wParam) == VK_PRIOR) c = KEY_PGUP; if (LOWORD(wParam) == VK_NEXT) c = KEY_PGDN; // log_debug("MVK %i\n",c); key[c] = 0; } break; case WM_CREATE: // initbbc(argc,argv); // free(argv); // mainthread=(HANDLE)_beginthread(_mainthread,0,NULL); break; default: r = DefWindowProc (hwnd, message, wParam, lParam); return r; } return 0; }
int gui_rewind() { tape_close(); tape_load(tape_fn); return D_CLOSE; }
void main_init(int argc, char *argv[]) { char t[512], *p; int c; int tapenext = 0, discnext = 0; startblit(); log_open(); log_info("main: starting %s", VERSION_STR); vid_fskipmax = 1; al_init_main(argc, argv); append_filename(t, exedir, "roms/tube/ReCo6502ROM_816", 511); if (!file_exists(t,FA_ALL,NULL) && selecttube == 4) selecttube = -1; curtube = selecttube; model_check(); for (c = 1; c < argc; c++) { // log_debug("%i : %s",c,argv[c]); /* if (!strcasecmp(argv[c],"-1770")) { I8271=0; WD1770=1; } else*/ //#ifndef WIN32 if (!strcasecmp(argv[c], "--help")) { printf("%s command line options :\n\n", VERSION_STR); printf("-mx - start as model x (see readme.txt for models)\n"); printf("-tx - start with tube x (see readme.txt for tubes)\n"); printf("-disc disc.ssd - load disc.ssd into drives :0/:2\n"); printf("-disc1 disc.ssd - load disc.ssd into drives :1/:3\n"); printf("-autoboot - boot disc in drive :0\n"); printf("-tape tape.uef - load tape.uef\n"); printf("-fasttape - set tape speed to fast\n"); printf("-s - scanlines display mode\n"); printf("-i - interlace display mode\n"); printf("-debug - start debugger\n"); printf("-allegro - use Allegro for video rendering\n"); exit(-1); } else //#endif if (!strcasecmp(argv[c], "-tape")) { tapenext = 2; } else if (!strcasecmp(argv[c], "-disc") || !strcasecmp(argv[c], "-disk")) { discnext = 1; } else if (!strcasecmp(argv[c], "-disc1")) { discnext = 2; } else if (argv[c][0] == '-' && (argv[c][1] == 'm' || argv[c][1] == 'M')) { sscanf(&argv[c][2], "%i", &curmodel); } else if (argv[c][0] == '-' && (argv[c][1] == 't' || argv[c][1] == 'T')) { sscanf(&argv[c][2], "%i", &curtube); } else if (!strcasecmp(argv[c], "-fasttape")) { fasttape = 1; } else if (!strcasecmp(argv[c], "-autoboot")) { autoboot = 150; } else if (argv[c][0] == '-' && (argv[c][1] == 'f' || argv[c][1]=='F')) { sscanf(&argv[c][2], "%i", &vid_fskipmax); if (vid_fskipmax < 1) vid_fskipmax = 1; if (vid_fskipmax > 9) vid_fskipmax = 9; } else if (argv[c][0] == '-' && (argv[c][1] == 's' || argv[c][1] == 'S')) { vid_scanlines = 1; } else if (!strcasecmp(argv[c], "-debug")) { debug_core = 1; } else if (!strcasecmp(argv[c], "-debugtube")) { debug_tube = 1; } else if (argv[c][0] == '-' && (argv[c][1] == 'i' || argv[c][1] == 'I')) { vid_interlace = 1; vid_linedbl = vid_scanlines = 0; } else if (tapenext) strcpy(tape_fn, argv[c]); else if (discnext) { strcpy(discfns[discnext-1], argv[c]); discnext = 0; } else { if ((p = strrchr(argv[c], '.')) && (!strcasecmp(p, ".uef") || !strcasecmp(p, ".csw"))) { strncpy(tape_fn, argv[c], sizeof tape_fn); tapenext = 0; } else { strncpy(discfns[0], argv[c], sizeof discfns[0]); discnext = 0; autoboot = 150; } } if (tapenext) tapenext--; } video_init(); mode7_makechars(); #ifndef WIN32 install_keyboard(); #endif install_timer(); mem_init(); ddnoise_init(); tapenoise_init(); sound_init(); al_init(); sid_init(); sid_settype(sidmethod, cursid); music5000_init(); adc_init(); #ifdef WIN32 pal_init(); #endif disc_init(); fdi_init(); scsi_init(); ide_init(); vdfs_init(); model_init(); midi_init(); main_reset(); install_int_ex(secint, MSEC_TO_TIMER(1000)); install_int_ex(int50, MSEC_TO_TIMER(20)); set_display_switch_mode(SWITCH_BACKGROUND); #ifdef WIN32 timeBeginPeriod(1); #endif oldmodel = curmodel; if (curtube == 3 || mouse_amx) install_mouse(); disc_load(0, discfns[0]); disc_load(1, discfns[1]); tape_load(tape_fn); if (defaultwriteprot) writeprot[0] = writeprot[1] = 1; endblit(); debug_start(); }