home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The AGA Experience 2
/
agavol2.iso
/
software
/
utilities
/
emulation
/
gameboy
/
vgb_amiga
/
vgb_amiga_0.3
/
gb.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-10-19
|
6KB
|
137 lines
/** VGB: portable GameBoy emulator ***************************/
/** **/
/** GB.h **/
/** **/
/** This file contains definitions for the GameBoy hardware **/
/** emulation. **/
/** **/
/** Copyright (C) Marat Fayzullin 1995 **/
/** You are not allowed to distribute this software **/
/** commercially. Please, notify me, if you make any **/
/** changes to this file. **/
/*************************************************************/
/* Amiga includes */
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/asl.h>
#include <dos/rdargs.h>
#include <exec/memory.h>
#include "Z80.h"
#define NORAM 0xFF
#define MAXCHEAT 256
#define VBL_IFLAG 0x01
#define LCD_IFLAG 0x02
#define TIM_IFLAG 0x04
#define SIO_IFLAG 0x08
#define JOY_IFLAG 0x10
#define JOYPAD RAM[0xFF00] /* Joystick: 1.1.P15.P14.P13.P12.P11.P10 */
#define SIODATA RAM[0xFF01] /* Serial IO data buffer */
#define SIOCONT RAM[0xFF02] /* Serial IO control register */
#define DIVREG RAM[0xFF04] /* Divider register (???) */
#define TIMECNT RAM[0xFF05] /* Timer counter. Gen. int. when it overflows */
#define TIMEMOD RAM[0xFF06] /* New value of TimeCount after it overflows */
#define TIMEFRQ RAM[0xFF07] /* Timer frequency and start/stop switch */
#define IFLAGS RAM[0xFF0F] /* Interrupt flags: 0.0.0.JST.SIO.TIM.LCD.VBL */
#define ISWITCH RAM[0xFFFF] /* Switches to enable/disable interrupts */
#define LCDCONT RAM[0xFF40] /* LCD control register */
#define LCDSTAT RAM[0xFF41] /* LCD status register */
#define SCROLLY RAM[0xFF42] /* Starting Y position of the background */
#define SCROLLX RAM[0xFF43] /* Starting X position of the background */
#define CURLINE RAM[0xFF44] /* Current screen line being scanned */
#define CMPLINE RAM[0xFF45] /* Gen. int. when scan reaches this line */
#define BGRDPAL RAM[0xFF47] /* Background palette */
#define SPR0PAL RAM[0xFF48] /* Sprite palette #0 */
#define SPR1PAL RAM[0xFF49] /* Sprite palette #1 */
#define WNDPOSY RAM[0xFF4A] /* Window Y position */
#define WNDPOSX RAM[0xFF4B] /* Window X position */
extern byte Verbose; /* Verboseness level */
extern byte *RAM; /* Pointer to Z80 address space (64kB) */
extern int UPeriod; /* Number of VBlanks per screen update */
extern int VPeriod; /* Number of Z80 cycles between VBlanks */
extern byte LineDelay; /* When 1, CMPLINE interrupts are delayed */
extern int ROMBanks; /* Total number of ROM banks */
extern int RAMBanks; /* Total number of RAM banks */
extern byte BPal[4]; /* Background palette */
extern byte SPal0[4],SPal1[4];/* Sprite palettes */
extern byte *ChrGen; /* Character generator */
extern byte *BgdTab,*WndTab; /* Background and window character tables */
void M_WRMEM(word A,byte V);
/****************************************************************/
/*** Initialize and start GameBoy emulation. This function ***/
/*** returns 0 in the case of failure. ***/
/****************************************************************/
int StartGB(char *CartName);
/****************************************************************/
/*** Free resources allocated by StartGB(). ***/
/****************************************************************/
void TrashGB(void);
/****************************************************************/
/*** Add a cheat to the cheat list [call before StartGB()]. ***/
/****************************************************************/
int AddCheat(char *Cheat);
/****************************************************************/
/*** Allocate resources needed by the machine-dependent code. ***/
/************************************** TO BE WRITTEN BY USER ***/
int InitMachine(void);
/****************************************************************/
/*** Deallocate all resources taken by InitMachine(). ***/
/************************************** TO BE WRITTEN BY USER ***/
void TrashMachine(void);
/****************************************************************/
/*** Refresh screen. ***/
/************************************** TO BE WRITTEN BY USER ***/
void RefreshScreen(void);
/****************************************************************/
/*** Refresh line Y [0-143]. ***/
/************************************** TO BE WRITTEN BY USER ***/
void RefreshLine(byte Y);
/****************************************************************/
/*** Refresh sprites. ***/
/************************************** TO BE WRITTEN BY USER ***/
void RefreshSprites(void);
/****************************************************************/
/*** Get joystick state: START.SELECT.B.A.D.U.L.R. ***/
/************************************** TO BE WRITTEN BY USER ***/
byte Joystick(void);
/****************************************************************/
/*** Amiga specific functions and defines ***/
/************************************** TO BE WRITTEN BY USER ***/
void AllocatePens(void);
STRPTR ReqFile(void);
#define OPT_VERBOSE ((ULONG*)(ArgPtrs[0]))
#define OPT_VPER ((ULONG*)(ArgPtrs[1]))
#define OPT_UPER ((ULONG*)(ArgPtrs[2]))
#define OPT_TRAP ((STRPTR)(ArgPtrs[3]))
#define OPT_HELP ((BOOL)(ArgPtrs[4]))