1 /** ADAMEm: Coleco ADAM emulator ********************************************/ 2 /** **/ 3 /** Coleco.h **/ 4 /** **/ 5 /** This file contains generic Coleco related definitions **/ 6 /** **/ 7 /** Copyright (C) Marcel de Kogel 1996,1997,1998,1999 **/ 8 /** You are not allowed to distribute this software commercially **/ 9 /** Please, notify me, if you make any changes to this file **/ 10 /****************************************************************************/ 11 12 #include "Z80.h" /* Z80 emulation declarations */ 13 14 #define BigSprites (VDP.Reg[1]&0x01) /* Magnified sprites */ 15 #define Sprites16x16 (VDP.Reg[1]&0x02) /* Sprite size */ 16 #define ScreenON (VDP.Reg[1]&0x40) /* Show screen */ 17 18 typedef struct 19 { 20 int Reg[8]; /* VDP registers */ 21 int Status; /* VDP status register */ 22 int Addr; /* Current memory offset */ 23 int Mode; /* 0=Read VRAM, 1=Write VRAM */ 24 byte *VRAM; /* VRAM pointer */ 25 int VRAMSize; /* Either 0x3FFF or 0x0FFF */ 26 int FGColour,BGColour; /* Current colours */ 27 int VKey; /* If 0, VDP is being accessed */ 28 int VR; /* Last value written to VDP */ 29 int ScreenChanged; /* 1 if VRAM or VDP regs are changed */ 30 } VDP_t; 31 32 extern VDP_t VDP; /* VDP parameters */ 33 extern int Verbose; /* Debug msgs ON/OFF */ 34 extern int EmuMode; /* 0=ColecoVision, 1=ADAM */ 35 extern int IFreq; /* VDP interrupt frequency */ 36 extern int UPeriod; /* Number of interrupts/screen update */ 37 extern int PrnType; /* Type of printer attached */ 38 extern int DiskSpeed; /* Time in ms it takes to read one... */ 39 extern int TapeSpeed; /* ... block */ 40 extern char *CartName; /* Cartridge ROM file */ 41 extern char *OS7File,*EOSFile,*WPFile;/* Main ROMs */ 42 extern int RAMPages; /* Number of 64K expansion RAM pages */ 43 extern char *DiskName[4]; /* Disk image file names */ 44 extern char *TapeName[4]; /* Tape image file names */ 45 extern char *PrnName; /* Printer log file */ 46 extern char *LPTName; /* Parallel port log file */ 47 extern char *SoundName; /* Sound log file */ 48 extern int JoyState[2]; /* Joystick status */ 49 extern int SpinnerPosition[2]; /* Spinner positions [0..500] */ 50 extern int LastSprite[256]; /* Last sprite to be displayed */ 51 extern int Support5thSprite; /* Show only 4 sprites per row */ 52 #define NR_PALETTES 4 53 extern byte Palettes[NR_PALETTES][16*3]; 54 extern int PalNum; /* Palette number */ 55 #define Coleco_Palette Palettes[PalNum] 56 extern int SaveSnapshot; /* If 1, auto-save snapshot */ 57 extern char *SnapshotName; /* Snapshot file name */ 58 #define MAX_CHEATS 16 /* Maximum number of cheat codes */ 59 /* supported */ 60 extern int Cheats[16]; /* Cheats to patch into game ROM */ 61 extern int CheatCount; /* Number of cheats */ 62 extern byte *AddrTabl[256]; /* Currently mapped in pages */ 63 extern byte *WriteAddrTabl[256]; /* Used to write protect ROM */ 64 65 /****************************************************************************/ 66 /*** Save current emulation status to snapshot file ***/ 67 /****************************************************************************/ 68 int SaveSnapshotFile (char *filename); 69 70 /****************************************************************************/ 71 /*** This function puts a character in the keyboard buffer ***/ 72 /****************************************************************************/ 73 void AddToKeyboardBuffer (byte ch); 74 75 /****************************************************************************/ 76 /*** Change disk and tape images, printer log file, etc. ***/ 77 /****************************************************************************/ 78 #ifndef NO_OPTIONS_DIALOGUE 79 void OptionsDialogue (void); 80 #endif 81 82 /****************************************************************************/ 83 /*** Reset the Coleco ***/ 84 /*** If mode==0, EOS is booted. If mode==1, the cartridge is booted ***/ 85 /****************************************************************************/ 86 void ResetColeco (int mode); 87 88 /****************************************************************************/ 89 /*** This function allocates all resources necessary for the ***/ 90 /*** hardware-independent part of the code and starts the emulation. In ***/ 91 /*** case of a failure, this function returns 0 ***/ 92 /****************************************************************************/ 93 int StartColeco(void); 94 95 /****************************************************************************/ 96 /*** Free memory allocated by StartColeco() ***/ 97 /****************************************************************************/ 98 void TrashColeco(void); 99 100 /****************************************************************************/ 101 /*** Allocate resources needed by the machine-dependent code ***/ 102 /************************************************** TO BE WRITTEN BY USER ***/ 103 int InitMachine(void); 104 105 /****************************************************************************/ 106 /*** Deallocate all resources taken by InitMachine() ***/ 107 /************************************************** TO BE WRITTEN BY USER ***/ 108 void TrashMachine(void); 109 110 /****************************************************************************/ 111 /*** These functions are called to initialise the various screen modes ***/ 112 /*** and refresh the screen ***/ 113 /************************************************** TO BE WRITTEN BY USER ***/ 114 void ColourScreen (void); 115 void RefreshScreen (int ScreenChanged); 116 117 /****************************************************************************/ 118 /*** These functions are called when the modem I/O ports are accessed ***/ 119 /************************************************** TO BE WRITTEN BY USER ***/ 120 void ModemOut (int reg,int value); 121 int ModemIn (int reg); 122 123 /****************************************************************************/ 124 /*** This function is called to poll keyboard and joysticks ***/ 125 /************************************************** TO BE WRITTEN BY USER ***/ 126 void Keyboard (void); 127 128 /****************************************************************************/ 129 /*** This function is called on every VDP interrupt. It should return 0 ***/ 130 /*** if the screen should not be refreshed, 1 if the screen should be ***/ 131 /*** refreshed, or 2 if the screen should be refreshed according to ***/ 132 /*** UPeriod setting ***/ 133 /************************************************** TO BE WRITTEN BY USER ***/ 134 int CheckScreenRefresh (void); 135 136 /****************************************************************************/ 137 /*** Sound routines ***/ 138 /****************************************************************************/ 139 #include "Sound.h" 140