home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / emulate.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-10-19  |  2.4 KB  |  95 lines

  1.  
  2. /*
  3.  
  4. */
  5. #ifndef __EMULATE_H__
  6. #define __EMULATE_H__
  7.  
  8. #include "v9t9_module.h"
  9.  
  10. #include "centry.h"
  11.  
  12. extern    vmModule emulate9900CPU;
  13.  
  14. extern     u32    stateflag;
  15.  
  16. #define    ST_DEBUG        0x1
  17. #define    ST_TERMINATE     0x2
  18. #define ST_INTERRUPT    0x8
  19. #define    ST_REBOOT        0x10
  20. #define ST_PAUSE        0x20
  21. //#define ST_RESTART        0x80
  22. #define ST_STOP            0x100        // interrupt execution
  23. #define ST_INTERACTIVE    0x200        // ask for user commands
  24. #define ST_SINGLESTEP    0x400           // step once
  25. #define ST_DEMOING        0x800        // recording a demo
  26.  
  27. #define FE_SOUND        0x1
  28. #define FE_PLAYSOUND    0x2
  29. #define FE_SPEECH        0x4
  30. #define FE_PLAYSPEECH    0x8
  31. #define FE_VIDEO        0x10
  32. #define FE_SHOWVIDEO    0x20
  33. #define FE_KEYBOARD        0x40
  34. #define FE_CSXREAD        0x80
  35. #define FE_CSXWRITE        0x100
  36. #define FE_CASSETTE        (FE_CSXREAD|FE_CSXWRITE)
  37.  
  38. #ifdef REAL_DISK_DSR
  39. #define FE_realdisk        0x1000
  40. #endif
  41. #ifdef EMU_DISK_DSR
  42. #define FE_emudisk        0x2000
  43. #endif
  44.  
  45. extern u32    features;
  46.  
  47. void    execution_pause(bool enable);
  48. INLINE bool execution_paused(void) { return !!(stateflag & ST_PAUSE); }
  49.  
  50. //    basic divisor for handling time functions
  51. #define BASE_EMULATOR_HZ     100
  52. //    clock speed of CPU -- 3.0 MHz 
  53. extern u32 baseclockhz;
  54.  
  55. extern u32 currenttime;        /* time, [0..baseclockhz / BASE_EMULATOR_HZ) */
  56. extern u64 totalticks;        /* total number of BASE_EMULATOR_HZ events passed */
  57.  
  58. extern u64 currentcycles;    // current cycles per 1/BASE_EMULATOR_HZ second
  59. extern u64 totalcurrentcycles;    // total # current cycles executed
  60.  
  61.  
  62. //    Utility function to make a hex string for machine_state routines
  63. //    If '*hex' is NULL, we xmalloc() space and return a pointer to it,
  64. //    else the buffer at 'hex' should have size*2+1 bytes available.
  65. char    *emulate_bin2hex(u8 *mem, char *hex, int size);
  66.  
  67. //    Utility for converting hex string to binary.
  68. //    size is the upper limit on the expected size of the
  69. //    string.  If 'hex' is smaller, we zero-fill the memory.
  70. void emulate_hex2bin(char *hex, u8 *mem, int size);
  71.  
  72. /*
  73.  *    Attempt to RLE compress 'len' bytes of 'data' 
  74.  *    into 'compress' but not using more than 'maxlen' bytes.
  75.  *
  76.  *    Returns length of 'compress' or 0 if compression failed.
  77.  */
  78. int rle_compress(u8 *data, int len, u8 *compress, int maxlen);
  79.  
  80. /*
  81.  *    Attempt to RLE uncompress 'len' bytes of 'data' 
  82.  *    into 'uncompress' using at most 'maxlen' bytes.
  83.  *
  84.  *    Returns zero if uncompressed data cannot fit, else 
  85.  *    the length of that data.
  86.  */
  87. int rle_uncompress(u8 *data, int len, u8 *uncompress, int maxlen);
  88.  
  89. void    emulate_setup_for_restore(void);
  90.  
  91. #include "cexit.h"
  92. #endif
  93.  
  94.     
  95.