+#ifdef ASM_6502
+static void asmcpu_update(int32 cycles)
+{
+ // some code from x6502.c
+ fhcnt-=cycles;
+ if(fhcnt<=0)
+ {
+ FrameSoundUpdate();
+ fhcnt+=fhinc;
+ }
+
+ if(PCMIRQCount>0)
+ {
+ PCMIRQCount-=cycles;
+ if(PCMIRQCount<=0)
+ {
+ vdis=1;
+ if((PSG[0x10]&0x80) && !(PSG[0x10]&0x40))
+ {
+ extern uint8 SIRQStat;
+ SIRQStat|=0x80;
+ X6502_IRQBegin(FCEU_IQDPCM);
+ }
+ }
+ }
+}
+
+void asmcpu_unpack(void)
+{
+ nes_registers[0] = X.A << 24;
+ nes_registers[1] = X.X;
+ nes_registers[2] = X.Y;
+ pc_base = 0;
+ nes_registers[3] = X.PC;
+ X6502_Rebase_a();
+ nes_registers[4] = X.S << 24;
+ nes_registers[4]|= X.IRQlow << 8;
+ nes_registers[7] = (uint32)X.count << 16;
+
+ // NVUB DIZC
+ nes_registers[4]|= X.P & 0x5d;
+ nes_registers[5] = X.P << 24; // N
+ if (!(X.P&0x02)) nes_registers[5] |= 1; // Z
+}
+
+void asmcpu_pack(void)
+{
+ X.A = nes_registers[0] >> 24;
+ X.X = nes_registers[1];
+ X.Y = nes_registers[2];
+ X.PC= nes_registers[3] - pc_base;
+ X.S = nes_registers[4] >> 24;
+ X.IRQlow = nes_registers[4] >> 8;
+ X.count = (int32) nes_registers[7] >> 16;
+
+ // NVUB DIZC
+ X.P = nes_registers[4] & 0x5d;
+ if ( nes_registers[5]&0x80000000) X.P |= 0x80; // N
+ if (!(nes_registers[5]&0x000000ff)) X.P |= 0x02; // Z
+}
+#endif
+