📄 k6502.h
字号:
/*===================================================================*//* *//* K6502.h : Header file for K6502 *//* *//* 2000/05/29 InfoNES Project ( based on pNesX ) *//* *//*===================================================================*/#ifndef K6502_H_INCLUDED#define K6502_H_INCLUDED/* Type definition */#ifndef DWORDtypedef unsigned long DWORD;#endif#ifndef WORDtypedef unsigned short WORD;#endif#ifndef BYTEtypedef unsigned char BYTE;#endif#ifndef NULL#define NULL 0#endif/* 6502 Flags */#define FLAG_C 0x01#define FLAG_Z 0x02
#define FLAG_B 0x10 //遇到指令BRK时,该位被置位#define FLAG_I 0x04#define FLAG_D 0x08#define FLAG_R 0x20#define FLAG_V 0x40#define FLAG_N 0x80/* Stack Address */#define BASE_STACK 0x100 //堆栈地址从0x0100到0x01ff,栈底是0x01ff,
//但由于系统占用了一些堆栈,实际上堆栈指针刚开始是指向0x01b4的而不是0x01ff/* Interrupt Vectors */#define VECTOR_NMI 0xfffa#define VECTOR_RESET 0xfffc#define VECTOR_IRQ 0xfffe/* NMI Request */#define NMI_REQ NMI_State = 0;/* IRQ Request */#define IRQ_REQ IRQ_State = 0;/* Emulator Operation */void K6502_Init();void K6502_Reset();void K6502_Set_Int_Wiring( BYTE byNMI_Wiring, BYTE byIRQ_Wiring );void K6502_Step( register WORD wClocks );/* I/O Operation (User definition) */static BYTE K6502_Read( WORD wAddr );
static WORD K6502_ReadW2( WORD wAddr );
#if 1static WORD K6502_ReadZpW( BYTE byAddr );
#endifstatic BYTE K6502_ReadAbsX();static BYTE K6502_ReadAbsY();static BYTE K6502_ReadIY();static BYTE K6502_Read_Code( WORD wAddr );
static WORD K6502_ReadW_Code( WORD wAddr );static void K6502_Write( WORD wAddr, BYTE byData );
/* The state of the IRQ pin */extern BYTE IRQ_State;/* The state of the NMI pin */extern BYTE NMI_State;/* The number of the clocks that it passed */extern WORD g_wPassedClocks;
#define K6502_ReadZp(byAddr) (RAM[ byAddr ])
#if 0
#define K6502_ReadZpW(wAddr) ((WORD)RAM[wAddr & 0x7ff ])
#endif
#define K6502_WriteZp(byAddr,byData) (RAM[ byAddr ] = byData)
#define K6502_ReadW(wAddr) (*(WORD *)&RAM[wAddr & 0x7ff ])
#define K6502_WriteW(wAddr, wData) ((WORD)RAM[wAddr & 0x7ff] = wData)
#endif /* !K6502_H_INCLUDED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -