⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 z80.h

📁 ESS3890+SL原代码(1*16内存)
💻 H
字号:
/* Copyright 2001, ESS Technology, Inc.     /* SCCSID @(#)z80.h	1.1 03/13/02 *//* Based on z80.h	1.4 12/07/01 *//* * $Log$ *//** VGB: portable GameBoy emulator ***************************//**                                                         **//**                           Z80.h                         **//**                                                         **//** This file contains declarations relevant to emulation   **//** of Z80 CPU. See GB.h for #defines related to drivers    **//** and GameBoy emulation.                                  **//**                                                         **//** Copyright (C) Marat Fayzullin 1994-2001                 **//**     The contents of this file are property of Marat     **//**     Fayzullin and should only be used as agreed with    **//**     him. The file is confidential. Absolutely no        **//**     distribution allowed.                               **//*************************************************************/#ifndef GBZ80_H#define GBZ80_H/* #define DEBUG */            /* Compile debugging version  *//* #define LSB_FIRST */        /* Compile for low-endian CPU *//* #define MSB_FIRST */        /* Compile for hi-endian CPU  */                               /* LoopZ80() may return:      */#define INT_VBLANK  0x01       /* VBlank interrupt           */#define INT_LCD     0x02       /* LCD interrupt              */#define INT_TIMER   0x04       /* Timer interrupt            */#define INT_SERIAL  0x08       /* Serial I/O interrupt       */#define INT_EXTERN  0x10       /* External interrupt         */#define INT_ALL     0x1F       /* All interrupts             */#define INT_NONE    0x00       /* No interrupts              */#define INT_QUIT    0xE0       /* Exit the emulation         */                               /* Interrupt vectors:         */#define VEC_VBLANK  0x0040     /* VBlank interrupt           */#define VEC_LCD     0x0048     /* LCD interrupt              */#define VEC_TIMER   0x0050     /* Timer interrupt            */#define VEC_SERIAL  0x0058     /* Serial I/O interrupt       */#define VEC_EXTERN  0x0060     /* External interrupt         */                               /* Bits in GBZ80 F register:  */#define Z_FLAG      0x40       /* 1: Result is zero          */#define H_FLAG      0x10       /* 1: Halfcarry/Halfborrow    */#define P_FLAG      0x04       /* 1: Result is even          */#define V_FLAG      0x04       /* 1: Overflow occured        */#define N_FLAG      0x02       /* 1: Subtraction occured     */#define C_FLAG      0x01       /* 1: Carry/Borrow occured    *//** Simple Datatypes *****************************************//** NOTICE: sizeof(byte)=1 and sizeof(word)=2               **//*************************************************************/#ifndef BYTE_TYPE_DEFINED#define BYTE_TYPE_DEFINEDtypedef unsigned char byte;#endif#ifndef WORD_TYPE_DEFINED#define WORD_TYPE_DEFINEDtypedef unsigned short word;#endif/** Structured Datatypes *************************************//** NOTICE: #define LSB_FIRST for machines where least      **//**         signifcant byte goes first.                     **//*************************************************************/typedef union{#ifdef LSB_FIRST  struct { byte l,h; } B;#else  struct { byte h,l; } B;#endif  word W;} pair;typedef struct{  pair AF,BC,DE,HL,IX,IY,SP;       /* Main registers      */  int IFF,I;                         /* Interrupt registers */  int  IPeriod;       /* Set IPeriod to number of CPU cycles */                      /* between calls to LoopZ80()          */  int  ICount;        /* Number of cycles to next LoopZ80()  */  int  IBackup;       /* Private, don't touch                */  int IRQs;          /* Set bits for pending IRQs           */} GBZ80;/** ResetZ80() ***********************************************//** This function can be used to reset the registers before **//** starting execution with RunZ80(). It sets registers to  **//** their initial values.                                   **//*************************************************************/void ResetZ80(register GBZ80 *R);  /** ExecZ80() ************************************************//** This function will execute a single Z80 opcode. It will **//** then return next PC, and current register values in R.  **//*************************************************************/#ifndef GAMEBOYword ExecZ80(register GBZ80 *R);#endif/** IntZ80() *************************************************//** This function will call the next pending interrupt      **//** based on priority.                                      **//*************************************************************/void IntZ80(register GBZ80 *R);/** RunZ80() *************************************************//** This function will run Z80 code until an LoopZ80() call **//** returns INT_QUIT. It will return the PC at which        **//** emulation stopped, and current register values in R.    **//*************************************************************/word RunZ80(register GBZ80 *R);/** RdZ80()/WrZ80() ******************************************//** These functions are called when access to RAM occurs.   **//** They allow to control memory access.                    **//************************************ TO BE WRITTEN BY USER **/void WrZ80(register int Addr,register int Value);int RdZ80(register int Addr);/** DebugZ80() ***********************************************//** This function should exist if DEBUG is #defined. When   **//** Trace!=0, it is called after each command executed by   **//** the CPU, and given the Z80 registers. Emulation exits   **//** if DebugZ80() returns 0.                                **//*************************************************************//** LoopZ80() ************************************************//** Z80 emulation calls this function periodically to check **//** if the system hardware requires any interrupts. This    **//** function must return one or more ORed interrupt bits    **//** (INT_VBLANK, INT_LCD, etc.) or INT_NONE for no intrpts. **//** Return INT_QUIT to exit the emulation loop.             **//************************************ TO BE WRITTEN BY USER **/int LoopZ80(register GBZ80 *R);#endif /* GBZ80_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -