state.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /****************************************************************************
  2. * dcc project header
  3. * (C) Cristina Cifuentes, Mike van Emmerik
  4. ****************************************************************************/
  5. #pragma once
  6. #include <stdint.h>
  7. #include <cstring>
  8. #include "machine_x86.h"
  9. /* STATE TABLE */
  10. struct STATE
  11. {
  12. uint32_t IP; /* Offset into Image */
  13. uint16_t r[INDEX_BX_SI]; /* Value of segs and AX */
  14. bool f[INDEX_BX_SI]; /* True if r[.] has a value */
  15. struct
  16. { /* For case stmt indexed reg */
  17. uint8_t regi; /* Last conditional jump */
  18. int16_t immed; /* Contents of the previous register */
  19. } JCond;
  20. void setState(uint16_t reg, int16_t value);
  21. void checkStartup();
  22. bool isKnown(eReg v) {return f[v];}
  23. void kill(eReg v) { f[v]=false;}
  24. STATE() : IP(0)
  25. {
  26. JCond.regi=0;
  27. JCond.immed=0;
  28. memset(r,0,sizeof(int16_t)*INDEX_BX_SI); //TODO: move this to machine_x86
  29. memset(f,0,sizeof(uint8_t)*INDEX_BX_SI);
  30. }
  31. void setMemoryByte(uint32_t addr,uint8_t val)
  32. {
  33. //TODO: make this into a full scale value tracking class !
  34. }
  35. };