notaz.gp2x.de
/
fceu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated bords/mappers/stuff to 0.98.15, lots of them got broken, asmcore support...
[fceu.git]
/
x6502.c
diff --git
a/x6502.c
b/x6502.c
index
b428056
..
7ec04ef
100644
(file)
--- a/
x6502.c
+++ b/
x6502.c
@@
-26,6
+26,8
@@
#include "sound.h"
#include "cart.h"
#include "sound.h"
#include "cart.h"
+#include "dprintf.h"
+
#ifdef DEBUG_ASM_6502
#include <stdio.h>
#include <stdlib.h>
#ifdef DEBUG_ASM_6502
#include <stdio.h>
#include <stdlib.h>
@@
-33,14
+35,16
@@
extern uint32 PC_prev, OP_prev;
extern uint8 dreads[4];
extern uint32 dwrites_c[2];
extern int dread_count_c, dwrite_count_c;
extern uint8 dreads[4];
extern uint32 dwrites_c[2];
extern int dread_count_c, dwrite_count_c;
+extern int mapirq_cyc_c;
+extern void (*MapIRQHook)(int a);
#define DummyRdMem(...)
#else
#define DummyRdMem RdMem
#define DummyRdMem(...)
#else
#define DummyRdMem RdMem
+void FP_FASTAPASS(1) (*MapIRQHook)(int a);
#endif
X6502 X;
uint32 timestamp;
#endif
X6502 X;
uint32 timestamp;
-void FP_FASTAPASS(1) (*MapIRQHook)(int a);
#define _PC X.PC
#define _A X.A
#define _PC X.PC
#define _A X.A
@@
-84,6
+88,7
@@
static INLINE uint8 RdMem(unsigned int A)
static INLINE void WrMem(unsigned int A, uint8 V)
{
static INLINE void WrMem(unsigned int A, uint8 V)
{
+ //printf("w [%04x] %02x\n", A, V);
if ((A&0xe000) == 0) { // RAM area (always 0-0x1fff)
RAM[A&0x7FF] = V;
return;
if ((A&0xe000) == 0) { // RAM area (always 0-0x1fff)
RAM[A&0x7FF] = V;
return;
@@
-107,7
+112,7
@@
static INLINE void WrRAM(unsigned int A, uint8 V)
static INLINE void ADDCYC(int x)
{
static INLINE void ADDCYC(int x)
{
-
//
_tcount+=x;
+ _tcount+=x;
_count-=x*48;
timestamp+=x;
}
_count-=x*48;
timestamp+=x;
}
@@
-423,6
+428,7
@@
static void TriggerNMIReal(void)
{
if(!_jammed)
{
{
if(!_jammed)
{
+ dprintf("NMI");
ADDCYC(7);
PUSH(_PC>>8);
PUSH(_PC);
ADDCYC(7);
PUSH(_PC>>8);
PUSH(_PC);
@@
-441,6
+447,7
@@
void TriggerIRQReal(void)
{
if(!(_PI&I_FLAG) && !_jammed)
{
{
if(!(_PI&I_FLAG) && !_jammed)
{
+ dprintf("IRQ");
ADDCYC(7);
PUSH(_PC>>8);
PUSH(_PC);
ADDCYC(7);
PUSH(_PC>>8);
PUSH(_PC);
@@
-499,17
+506,20
@@
void X6502_Run_c(void/*int32 cycles*/)
TriggerIRQReal();
_IRQlow&=~(FCEU_IQTEMP|FCEU_IQNMI);
TriggerIRQReal();
_IRQlow&=~(FCEU_IQTEMP|FCEU_IQNMI);
- if(_count<=0) {_PI=_P;return;} /* Should increase accuracy without a */
- /* major speed hit. */
+ if(_count<=0)
+ {
+#ifdef DEBUG_ASM_6502
+ if(MapIRQHook) mapirq_cyc_c = _tcount;
+ _tcount=0;
+#endif
+ _PI=_P;
+ return; /* Should increase accuracy without a major speed hit. */
+ }
}
_PI=_P;
b1=RdMem(_PC);
}
_PI=_P;
b1=RdMem(_PC);
- temp=CycTable[b1];
- ADDCYC(temp);
- //temp=_tcount;
- //_tcount=0;
-
- if(MapIRQHook) MapIRQHook(temp);
+ ADDCYC(CycTable[b1]);
+ temp=_tcount;
temp*=48;
temp*=48;
@@
-548,6
+558,16
@@
void X6502_Run_c(void/*int32 cycles*/)
#include "ops.h"
}
#include "ops.h"
}
+ temp=_tcount; /* Gradius II (J) glitches if _tcount is not used */
+ _tcount=0;
+
+ if(MapIRQHook) {
+#ifdef DEBUG_ASM_6502
+ mapirq_cyc_c = temp;
+#endif
+ MapIRQHook(temp);
+ }
+
#ifdef DEBUG_ASM_6502
_PI=_P;
#endif
#ifdef DEBUG_ASM_6502
_PI=_P;
#endif