home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / emulaton / at2600 / !v2600 / h / vmachine < prev   
Text File  |  1998-03-16  |  3KB  |  142 lines

  1. /*****************************************************************************
  2.  
  3.    This file is part of x2600, the Atari 2600 Emulator
  4.    ===================================================
  5.    
  6.    Copyright 1996 Alex Hornby. For contributions see the file CREDITS.
  7.  
  8.    This software is distributed under the terms of the GNU General Public
  9.    License. This is free software with ABSOLUTELY NO WARRANTY.
  10.    
  11.    See the file COPYING for details.
  12.    
  13.    $Id: vmachine.h,v 2.13 1996/11/24 16:55:40 ahornby Exp $
  14. ******************************************************************************/
  15.  
  16.  
  17. /*
  18.    External definitions of the 2600 virtual machine.
  19. */
  20.  
  21.  
  22. #ifndef VMACHINE_H
  23. #define VMACHINE_H
  24.  
  25. #ifndef inline
  26. #define inline
  27. #endif
  28.  
  29. extern int rom_size;
  30. extern BYTE theCart[16384];
  31. extern BYTE *theRom;
  32. extern BYTE cartScratch[4096];
  33. extern BYTE cartRam[1024];
  34. extern BYTE theRam[128];
  35. extern BYTE riotRead[0x298];
  36. extern BYTE riotWrite[0x298];
  37. extern BYTE tiaWrite[0x2d];
  38. extern BYTE tiaRead[0x0e];
  39. extern BYTE keypad[2][4];
  40.  
  41. extern int reset_flag;
  42.  
  43. extern int ebeamx, ebeamy, sbeamx;
  44.  
  45. #define VSYNCSTATE 1
  46. #define VBLANKSTATE 2
  47. #define HSYNCSTATE 4
  48. #define DRAWSTATE 8
  49. #define OVERSTATE 16 
  50.  
  51. extern int vbeam_state, hbeam_state;
  52.  
  53. extern int tv_width, tv_height, tv_vsync, tv_vblank,
  54.     tv_overscan, tv_frame, tv_hertz, tv_hsync;
  55.  
  56. extern int timer_res, timer_count, timer_clks; 
  57.  
  58. extern struct PlayField {
  59.     BYTE pf0,pf1,pf2;
  60.     BYTE ref;
  61. } pf[2];  
  62.  
  63. extern struct Paddle {
  64.     int pos;
  65.     int val;
  66. } paddle[4];
  67.  
  68. extern struct Player {
  69.   int x;
  70.   BYTE grp;
  71.   BYTE hmm;
  72.   BYTE vdel;
  73.   BYTE vdel_flag;
  74.   BYTE nusize;
  75.   BYTE reflect;
  76.   BYTE mask;
  77. } pl[2];
  78.  
  79. struct RasterChange {
  80.   int x;     /* Position at which change happened */
  81.   int type;  /* Type of change */
  82.   int val;   /* Value of change */
  83. } ;
  84.  
  85. extern struct RasterChange pl_change[2][80], pf_change[1][80], unified[80];
  86.  
  87. extern int pl_change_count[2], pf_change_count[1], unified_count;
  88.  
  89. /* The missile and ball positions */
  90. extern struct Missile {
  91.     int x;
  92.     BYTE hmm;
  93.     BYTE locked;
  94.     BYTE enabled;
  95.     BYTE width;
  96.     BYTE vdel;
  97.     BYTE vdel_flag;
  98.     BYTE mask;
  99. } ml[3];
  100.  
  101. /****************************************************************************
  102.                               functions.
  103. *****************************************************************************/
  104.  
  105. inline void 
  106. do_plraster_change(int i, int type, int val);
  107.  
  108. inline void
  109. do_unified_change(int type, int val);
  110.  
  111. inline void
  112. use_unified_change( struct RasterChange *rc);
  113.  
  114. inline void 
  115. use_plraster_change( struct Player *pl, struct RasterChange *rc);
  116.  
  117. inline void
  118. do_pfraster_change(int i, int type, int val);
  119.  
  120. inline void
  121. use_pfraster_change( struct PlayField *pf, struct RasterChange *rc);
  122.  
  123. void init_hardware(void);
  124. void init_banking(void);
  125.  
  126. inline void set_timer(int res, int count, int clkadj);
  127. inline BYTE do_timer(int clkadj);
  128. inline void do_vblank(BYTE b);
  129. inline void do_hsync(void);
  130.  
  131. int  do_paddle(int padnum);
  132. BYTE do_keypad(int pad, int col);
  133. inline void do_screen(int clks);
  134.  
  135. #endif
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.