void cpu_z80_set_state(Z80_STATE *st) { z80_set_reg(Z80_REG_PC,st->PC); z80_set_reg(Z80_REG_SP,st->SP); z80_set_reg(Z80_REG_AF,st->AF); z80_set_reg(Z80_REG_BC,st->BC); z80_set_reg(Z80_REG_DE,st->DE); z80_set_reg(Z80_REG_HL,st->HL); z80_set_reg(Z80_REG_IX,st->IX); z80_set_reg(Z80_REG_IY,st->IY); z80_set_reg(Z80_REG_AF2,st->AF2); z80_set_reg(Z80_REG_BC2,st->BC2); z80_set_reg(Z80_REG_DE2,st->DE2); z80_set_reg(Z80_REG_HL2,st->HL2); // z80_set_reg(Z80_REG_R,st->R); // z80_set_reg(Z80_REG_R2,st->R2); z80_set_reg(Z80_REG_IFF1,st->IFF1); z80_set_reg(Z80_REG_IFF2,st->IFF2); z80_set_reg(Z80_REG_IM,st->IM); // z80_set_reg(Z80_REG_I,st->I); }
void cpu_z80_post_load_state(void) { int i; #if 1 z80_set_reg(Z80_REG_PC,z80_st.PC); z80_set_reg(Z80_REG_SP,z80_st.SP); z80_set_reg(Z80_REG_AF,z80_st.AF); z80_set_reg(Z80_REG_BC,z80_st.BC); z80_set_reg(Z80_REG_DE,z80_st.DE); z80_set_reg(Z80_REG_HL,z80_st.HL); z80_set_reg(Z80_REG_IX,z80_st.IX); z80_set_reg(Z80_REG_IY,z80_st.IY); z80_set_reg(Z80_REG_AF2,z80_st.AF2); z80_set_reg(Z80_REG_BC2,z80_st.BC2); z80_set_reg(Z80_REG_DE2,z80_st.DE2); z80_set_reg(Z80_REG_HL2,z80_st.HL2); // z80_set_reg(Z80_REG_R,z80_st.R); // z80_set_reg(Z80_REG_R2,z80_st.R2); z80_set_reg(Z80_REG_IFF1,z80_st.IFF1); z80_set_reg(Z80_REG_IFF2,z80_st.IFF2); z80_set_reg(Z80_REG_IM,z80_st.IM); z80_set_reg(Z80_REG_IRQVector,z80_st.IRQV); z80_set_reg(Z80_REG_IRQLine,z80_st.IRQL); // z80_set_reg(Z80_REG_I,z80_st.I); #endif /* z80_reset(); z80_set_context(raze_context); */ for (i=0;i<4;i++) { cpu_z80_switchbank(i,z80_bank[i]); } // z80dumpreg(); }
void load_snap(struct z80snapshot *snap) { int bucle; switch(snap->type) { case 0: // 48k cmpt.mode128k=0; // 48K mode cmpt.issue=snap->issue; ResetComputer(); break; case 1: // 128k cmpt.mode128k=1; //2; // +2 mode cmpt.issue=3; ResetComputer(); // printf("Pager: %X\n",snap->pager); OutZ80(0x7FFD,snap->pager); break; default: break; } _z80_set_A(snap->A); #ifdef MASCARA_AF _z80_set_F(snap->F&MASCARA_AF); #else _z80_set_F(snap->F); #endif _z80_set_B(snap->B); _z80_set_C(snap->C); _z80_set_D(snap->D); _z80_set_E(snap->E); _z80_set_H(snap->H); _z80_set_L(snap->L); _z80_set_A1(snap->AA); _z80_set_F1(snap->FF); _z80_set_B1(snap->BB); _z80_set_C1(snap->CC); _z80_set_D1(snap->DD); _z80_set_E1(snap->EE); _z80_set_H1(snap->HH); _z80_set_L1(snap->LL); _z80_set_IX(snap->IX); _z80_set_IY(snap->IY); _z80_set_SP(snap->SP); _z80_set_PC(snap->PC); _z80_set_I(snap->I); _z80_set_R(snap->R&0x7F); #ifdef USE_RAZE z80_set_reg(Z80_REG_IFF1,snap->IFF1); z80_set_reg(Z80_REG_IFF2,snap->IFF2); z80_set_reg(Z80_REG_IM,snap->Imode); if (snap->IFF1) z80_set_reg(Z80_REG_IRQLine,1); #else if(snap->IFF1) #ifdef USE_YAZE yaze_IFF|=3; #else procesador.IFF|=(IFF_1|IFF_EI); #endif if(snap->IFF2) #ifdef USE_YAZE yaze_IFF|=2; #else procesador.IFF|=IFF_2; #endif switch(snap->Imode) { case 0: #ifdef USE_YAZE yaze_IFF&=~3; #else procesador.IFF&=~(IFF_IM1|IFF_IM2); #endif break; case 1: #ifdef USE_YAZE yaze_IFF=(yaze_IFF&~2)|1; #else procesador.IFF=(procesador.IFF&~IFF_IM2)|IFF_IM1; #endif break; case 2: #ifdef USE_YAZE yaze_IFF=(yaze_IFF&~1)|2; #else procesador.IFF=(procesador.IFF&~IFF_IM1)|IFF_IM2; #endif break; } #endif cmpt.border=snap->border+16; switch(snap->type) { case 0: // 48K for(bucle=0;bucle<16384;bucle++) { cmpt.memoria[bucle+147456]=snap->page[0][bucle]; cmpt.memoria[bucle+98304]=snap->page[1][bucle]; cmpt.memoria[bucle+114688]=snap->page[2][bucle]; } cmpt.ay_emul=0; break; case 1: // 128K for(bucle=0;bucle<16384;bucle++) { cmpt.memoria[bucle+65536]=snap->page[0][bucle]; cmpt.memoria[bucle+81920]=snap->page[1][bucle]; cmpt.memoria[bucle+98304]=snap->page[2][bucle]; cmpt.memoria[bucle+114688]=snap->page[3][bucle]; cmpt.memoria[bucle+131072]=snap->page[4][bucle]; cmpt.memoria[bucle+147456]=snap->page[5][bucle]; cmpt.memoria[bucle+163840]=snap->page[6][bucle]; cmpt.memoria[bucle+180224]=snap->page[7][bucle]; } cmpt.ay_emul=-1; for(bucle=0;bucle<16;bucle++) cmpt.ay_registers[bucle]=snap->ay_regs[bucle]; cmpt.ay_latch=snap->ay_latch; break; default: break; } setChanges(); }