void Atari800_Coldstart(void) { #ifdef MACOSX ANTIC_screenline_cpu_clock = 0; MacSoundReset(); MacCapsLockStateReset(); #endif PBI_Reset(); PIA_Reset(); ANTIC_Reset(); /* CPU_Reset() must be after PIA_Reset(), because Reset routine vector must be read from OS ROM */ CPU_Reset(); /* note: POKEY and GTIA have no Reset pin */ #ifdef __PLUS HandleResetEvent(); #endif /* reset cartridge to power-up state */ CARTRIDGE_Start(); /* set Atari OS Coldstart flag */ MEMORY_dPutByte(0x244, 1); /* handle Option key (disable BASIC in XL/XE) and Start key (boot from cassette) */ GTIA_consol_index = 2; GTIA_consol_table[2] = 0x0f; if (Atari800_disable_basic && !BINLOAD_loading_basic) { /* hold Option during reboot */ GTIA_consol_table[2] &= ~INPUT_CONSOL_OPTION; } if (CASSETTE_hold_start) { /* hold Start during reboot */ GTIA_consol_table[2] &= ~INPUT_CONSOL_START; } GTIA_consol_table[1] = GTIA_consol_table[2]; Devices_WarmCold_Start(); }
/* Start or continue loading */ static void loader_cont(void) { if (BINLOAD_bin_file == NULL) return; if (BINLOAD_start_binloading) { MEMORY_dPutByte(0x244, 0); MEMORY_dPutByte(0x09, 1); } else CPU_regS += 2; /* pop ESC code */ if (init2e3) MEMORY_dPutByte(0x2e3, 0xd7); init2e3=FALSE; do { if((!BINLOAD_wait_active || !BINLOAD_slow_xex_loading) && segfinished){ int temp; do temp = read_word(); while (temp == 0xffff); if (temp < 0) return; from = (UWORD) temp; temp = read_word(); if (temp < 0) return; to = (UWORD) temp; if (BINLOAD_start_binloading) { MEMORY_dPutWordAligned(0x2e0, from); BINLOAD_start_binloading = FALSE; } to++; segfinished = FALSE; } do { int byte; if (BINLOAD_slow_xex_loading) { instr_elapsed++; if ((instr_elapsed < 300) || BINLOAD_pause_loading) { CPU_regS--; ESC_Add((UWORD) (0x100 + CPU_regS), ESC_BINLOADER_CONT, loader_cont); CPU_regS--; CPU_regPC = CPU_regS + 1 + 0x100; BINLOAD_wait_active = TRUE; return; } instr_elapsed = 0; BINLOAD_wait_active = FALSE; } byte = fgetc(BINLOAD_bin_file); if (byte == EOF) { fclose(BINLOAD_bin_file); BINLOAD_bin_file = NULL; CPU_regPC = MEMORY_dGetWordAligned(0x2e0); if (MEMORY_dGetByte(0x2e3) != 0xd7) { /* run INIT routine which RTSes directly to RUN routine */ CPU_regPC--; MEMORY_dPutByte(0x0100 + CPU_regS--, CPU_regPC >> 8); /* high */ MEMORY_dPutByte(0x0100 + CPU_regS--, CPU_regPC & 0xff); /* low */ CPU_regPC = MEMORY_dGetWordAligned(0x2e2); } return; } MEMORY_PutByte(from, (UBYTE) byte); from++; } while (from != to);