Advertisement
xerpi

struct and union madness

Aug 26th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. struct gb_cpu {
  2.     union {
  3.         struct {
  4.             union {
  5.                 struct {
  6.                     uint8_t   : 4;
  7.                     uint8_t C : 1;
  8.                     uint8_t H : 1;
  9.                     uint8_t N : 1;
  10.                     uint8_t Z : 1;
  11.                 } flags;
  12.                 uint8_t F;
  13.             };
  14.             uint8_t A;
  15.         };
  16.         uint16_t AF;
  17.     };
  18.     union {
  19.         struct {
  20.             uint8_t C;
  21.             uint8_t B;
  22.         };
  23.         uint16_t BC;
  24.     };
  25.     union {
  26.         struct {
  27.             uint8_t E;
  28.             uint8_t D;
  29.         };
  30.         uint16_t DE;
  31.     };
  32.     union {
  33.         struct {
  34.             uint8_t L;
  35.             uint8_t H;
  36.         };
  37.         uint16_t HL;
  38.     };
  39.     uint16_t PC;
  40.     uint16_t SP;
  41. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement