home *** CD-ROM | disk | FTP | other *** search
- /*
- * gbe - gameboy emulator
- * Copyright (C) 1999 Chuck Mason, Steven Fuller
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * Chuck Mason <chuckjr@sinclair.net>
- * Steven Fuller <relnev@atdot.org>
- */
- #ifndef __CPU_H
- #define __CPU_H
-
- #include "data.h"
-
- #define FLAGS_ZERO 0x80
- #define FLAGS_NEGATIVE 0x40
- #define FLAGS_HALFCARRY 0x20
- #define FLAGS_CARRY 0x10
-
- #define FLAGS_ISZERO(proc) (proc->AF.b.l & FLAGS_ZERO)
- #define FLAGS_ISNEGATIVE(proc) (proc->AF.b.l & FLAGS_NEGATIVE)
- #define FLAGS_ISCARRY(proc) (proc->AF.b.l & FLAGS_CARRY)
- #define FLAGS_ISHALFCARRY(proc) (proc->AF.b.l& FLAGS_HALFCARRY)
-
- #define FLAGS_ISSET(proc,x) (proc->AF.b.l & x)
- #define FLAGS_SET(proc,x) (proc->AF.b.l |= x)
- #define FLAGS_CLEAR(proc,x) (proc->AF.b.l &= ~(x))
-
- #define MORE_CYCLES2(m) {gameboy_proc->machine_cycles += m;}
-
- typedef struct _gameboy_proc_t {
- wordun AF;
- wordun BC;
- wordun DE;
- wordun HL;
- wordun SP;
- wordun PC;
- unsigned char IFF : 1;
- unsigned char running;
- unsigned long tim_cycles;
- unsigned long machine_cycles;
- } gameboy_proc_t;
-
- extern gameboy_proc_t *gameboy_proc;
-
- gameboy_proc_t *gameboy_cpu_hardreset();
- void gameboy_cpu_run(gameboy_proc_t *);
- void gameboy_cpu_execute_opcode();
- void gameboy_cpu_create_instruction(char *, gameboy_proc_t *);
- void gameboy_stack_write_word(unsigned short int val); /* 092299 */
-
- #endif
-