home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 13 / MA_Cover_13.bin / source / c / gbe / cpu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-12  |  2.0 KB  |  66 lines

  1. /*
  2.  *  gbe - gameboy emulator
  3.  *  Copyright (C) 1999  Chuck Mason, Steven Fuller
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with this program; if not, write to the Free Software
  17.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  18.  *
  19.  *
  20.  *  Chuck Mason <chuckjr@sinclair.net>
  21.  *  Steven Fuller <relnev@atdot.org>
  22.  */
  23. #ifndef __CPU_H
  24. #define __CPU_H
  25.  
  26. #include "data.h"
  27.  
  28. #define FLAGS_ZERO 0x80
  29. #define FLAGS_NEGATIVE 0x40
  30. #define FLAGS_HALFCARRY 0x20
  31. #define FLAGS_CARRY 0x10
  32.  
  33. #define FLAGS_ISZERO(proc)     (proc->AF.b.l & FLAGS_ZERO)
  34. #define FLAGS_ISNEGATIVE(proc) (proc->AF.b.l & FLAGS_NEGATIVE)
  35. #define FLAGS_ISCARRY(proc)    (proc->AF.b.l & FLAGS_CARRY)
  36. #define FLAGS_ISHALFCARRY(proc) (proc->AF.b.l& FLAGS_HALFCARRY)
  37.  
  38. #define FLAGS_ISSET(proc,x)    (proc->AF.b.l & x)
  39. #define FLAGS_SET(proc,x)      (proc->AF.b.l |= x)
  40. #define FLAGS_CLEAR(proc,x)    (proc->AF.b.l &= ~(x))
  41.  
  42. #define MORE_CYCLES2(m) {gameboy_proc->machine_cycles += m;}
  43.  
  44. typedef struct _gameboy_proc_t {
  45.      wordun   AF;   
  46.      wordun     BC;
  47.      wordun   DE;
  48.      wordun   HL;
  49.      wordun   SP;
  50.      wordun   PC;
  51.      unsigned char IFF : 1;
  52.      unsigned char running;
  53.      unsigned long tim_cycles;
  54.      unsigned long machine_cycles;
  55. } gameboy_proc_t;
  56.  
  57. extern gameboy_proc_t *gameboy_proc;
  58.  
  59. gameboy_proc_t *gameboy_cpu_hardreset();
  60. void gameboy_cpu_run(gameboy_proc_t *);
  61. void gameboy_cpu_execute_opcode();
  62. void gameboy_cpu_create_instruction(char *, gameboy_proc_t *);
  63. void gameboy_stack_write_word(unsigned short int val); /* 092299 */
  64.  
  65. #endif
  66.