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

  1.  
  2. /*
  3.         9900.H
  4.         ======
  5.  
  6. */
  7. #ifndef __9900_H__
  8. #define __9900_H__
  9.  
  10. #include "centry.h"
  11.  
  12. extern uaddr pc,wp;
  13. extern u16 *wpptr;
  14. extern uword status;
  15.  
  16. //    active interrupt pins
  17. enum         { INTPIN_RESET = 1, INTPIN_LOAD = 2, INTPIN_INTREQ = 4 };
  18. extern u8    intpins9900;        
  19. void        hold9900pin(u8 mask);
  20.  
  21. // interrupt mask from LIMI
  22. extern u8    intlevel9900;
  23.  
  24. #define ST_L    0x8000
  25. #define ST_A    0x4000
  26. #define    ST_E    0x2000
  27. #define    ST_C    0x1000
  28. #define    ST_O    0x800
  29. #define ST_P    0x400
  30. #define ST_X    0x200
  31. #define ST_INTLEVEL 0xf
  32.  
  33. /*    Fake opcodes for emulation */
  34. enum
  35. {
  36.     OP_DSR         = 0xC00,    /* if this changes, fix asm equate */
  37.     OP_KEYSLOW    = 0xD40,
  38.     OP_DBG        = 0xDE0,
  39. };
  40.  
  41. extern void set9900wp(u16 wp);
  42. void init9900(void);
  43. void emulateloop(void);
  44. void setup_status(void);
  45. void change9900intmask(u16 mask);
  46.  
  47. u16 fetch(void);
  48. void execute(uop op);
  49. void contextswitch(uaddr addr);
  50. bool verifypc(uaddr addr);
  51. bool verifywp(uaddr addr);
  52. void setandverifypc(uaddr addr);
  53. void setandverifywp(uaddr addr);
  54.  
  55. /******************************************/
  56.  
  57. #define register(reg) (wpptr[reg])
  58.  
  59. /*
  60.     wchange -- change a word in memory at 'addr'.  
  61.     'prewhat' is done to the word before the operation.
  62.     'what' is the operation.
  63.     'expr' is the operand,
  64.     'status' is the function that deciphers the answer.
  65. */
  66. #define wchange(addr,prewhat,what,expr,status) {  \
  67.     register u16 answer=prewhat (memory_read_word(addr)) what##expr; \
  68.     memory_write_word(addr,answer); \
  69.     status(answer); \
  70.     }
  71.  
  72. /*
  73.     rchange -- change register 'reg'.  
  74.     'prewhat' is done to the word before the operation.
  75.     'what' is the operation.
  76.     'expr' is the operand,
  77.     'status' is the function that deciphers the answer.
  78.     
  79.     This assumes 'wp' is in range.
  80. */
  81. #define rchange(reg,prewhat,what,expr,status) {  \
  82.     register u16 *raddr=wpptr+reg; \
  83.     register int answer=(prewhat (*raddr)) what expr; \
  84.     *raddr= answer; status(answer); } \
  85.  
  86.  
  87. #define wadd(addr,expr) {  \
  88.     memory_write_word(addr,setst_add_laeco(memory_read_word(addr),expr)); \
  89.     }
  90.     
  91. #define radd(reg,expr) {  \
  92.     register u16 *raddr = wpptr+reg; \
  93.     *raddr=setst_add_laeco(*raddr,expr); }
  94.  
  95.  
  96. #include "cexit.h"
  97.  
  98. #endif
  99.