Пример #1
0
void supervision_exec(unsigned short *backbuffer, unsigned char bRender)
{
	uint32 supervision_scanline, scan1=0;
	int i;

	for (supervision_scanline = 0; supervision_scanline < 160; supervision_scanline++)
	{
		m6502_registers.ICount = 512; 
		//Default is 512 
		timer_exec((m6502_registers.ICount));
			
#ifdef GP2X
		if(currentConfig.enable_sound) sound_exec(11025/160);
#else
		sound_exec(22050/160);
#endif
		Run6502(&m6502_registers);
			
#ifdef NDS
		gpu_render_scanline(supervision_scanline, backbuffer);
		backbuffer += 160+96;
#else
		gpu_render_scanline_fast(scan1, backbuffer);
		backbuffer += 160;
		scan1 += 0x30;
#endif
	}

	if (Rd6502(0x2026)&0x01)
		Int6502(supervision_get6502regs(), INT_NMI);
}
Пример #2
0
word Run6502(M6502 *R)
{
  register pair J,K;
  register byte I;

  for(;;)
  {
#ifdef S60
    Opt6502(R);
#else /* !S60 */

#ifdef DEBUG
    /* Turn tracing on when reached trap address */
    if(R->PC.W==R->Trap) R->Trace=1;
    /* Call single-step debugger, exit if requested */
    if(R->Trace)
      if(!Debug6502(R)) return(R->PC.W);
#endif

    I=Op6502(R->PC.W++);
    R->ICount-=Cycles[I];
    switch(I)
    {
#include "Codes.h"
    }

#endif /* !S60 */

    /* If cycle counter expired... */
    if(R->ICount<=0)
    {
      /* If we have come after CLI, get INT_? from IRequest */
      /* Otherwise, get it from the loop handler            */
      if(R->AfterCLI)
      {
        I=R->IRequest;            /* Get pending interrupt     */
        R->ICount+=R->IBackup-1;  /* Restore the ICount        */
        R->AfterCLI=0;            /* Done with AfterCLI state  */
      }
      else
      {
        I=Loop6502(R);            /* Call the periodic handler */
        R->ICount+=R->IPeriod;    /* Reset the cycle counter   */
        if(!I) I=R->IRequest;     /* Realize pending interrupt */
      }

      if(I==INT_QUIT) return(R->PC.W); /* Exit if INT_QUIT     */
      if(I) Int6502(R,I);              /* Interrupt if needed  */ 
    }
  }

  /* Execution stopped */
  return(R->PC.W);
}