Exemple #1
0
void Atari800_Warmstart(void)
{
#ifdef MACOSX
	MacCapsLockStateReset();
#endif	
	if (Atari800_machine_type == Atari800_MACHINE_OSA || Atari800_machine_type == Atari800_MACHINE_OSB) {
		/* A real Axlon homebanks on reset */
		/* XXX: what does Mosaic do? */
		if (MEMORY_axlon_enabled) MEMORY_PutByte(0xcfff, 0);
		/* RESET key in 400/800 does not reset chips,
		   but only generates RNMI interrupt */
		ANTIC_NMIST = 0x3f;
		CPU_NMI();
	}
	else {
		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 */
	}
	Devices_WarmCold_Start();
#ifdef __PLUS
	HandleResetEvent();
#endif
}
Exemple #2
0
/* 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);