Mercurial > vba-clojure
diff src/gb/GB.cpp @ 100:2090bcb78f44
created functions to get and set register values
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 12 Mar 2012 12:37:04 -0500 |
parents | cb487c4ce5c0 |
children | 893c753f8088 |
line wrap: on
line diff
1.1 --- a/src/gb/GB.cpp Mon Mar 12 09:59:26 2012 -0500 1.2 +++ b/src/gb/GB.cpp Mon Mar 12 12:37:04 2012 -0500 1.3 @@ -3934,6 +3934,7 @@ 1.4 } 1.5 } 1.6 1.7 + 1.8 void storeRegisters(int32* store){ 1.9 store[0] = (int32) PC.W; 1.10 store[1] = (int32) SP.W; 1.11 @@ -3941,28 +3942,64 @@ 1.12 store[3] = (int32) BC.W; 1.13 store[4] = (int32) DE.W; 1.14 store[5] = (int32) HL.W; 1.15 - store[6] = (int32) register_DIV; 1.16 - store[7] = (int32) register_TIMA; 1.17 - store[8] = (int32) register_TMA; 1.18 - store[9] = (int32) register_TAC; 1.19 - store[10] = (int32) register_IF; 1.20 - store[11] = (int32) register_LCDC; 1.21 - store[12] = (int32) register_STAT; 1.22 - store[13] = (int32) register_SCY; 1.23 - store[14] = (int32) register_SCX; 1.24 - store[15] = (int32) register_LY; 1.25 - store[16] = (int32) register_LYC; 1.26 - store[17] = (int32) register_DMA; 1.27 - store[18] = (int32) register_WY; 1.28 - store[19] = (int32) register_WX; 1.29 - store[20] = (int32) register_VBK; 1.30 - store[21] = (int32) register_HDMA1; 1.31 - store[22] = (int32) register_HDMA2; 1.32 - store[23] = (int32) register_HDMA3; 1.33 - store[24] = (int32) register_HDMA4; 1.34 - store[25] = (int32) register_HDMA5; 1.35 - store[26] = (int32) register_SVBK; 1.36 - store[27] = (int32) register_IE; 1.37 + 1.38 + store[6] = (int32) IFF; 1.39 + 1.40 + store[7] = (int32) register_DIV; 1.41 + store[8] = (int32) register_TIMA; 1.42 + store[9] = (int32) register_TMA; 1.43 + store[10] = (int32) register_TAC; 1.44 + store[11] = (int32) register_IF; 1.45 + store[12] = (int32) register_LCDC; 1.46 + store[13] = (int32) register_STAT; 1.47 + store[14] = (int32) register_SCY; 1.48 + store[15] = (int32) register_SCX; 1.49 + store[16] = (int32) register_LY; 1.50 + store[17] = (int32) register_LYC; 1.51 + store[18] = (int32) register_DMA; 1.52 + store[19] = (int32) register_WY; 1.53 + store[20] = (int32) register_WX; 1.54 + store[21] = (int32) register_VBK; 1.55 + store[22] = (int32) register_HDMA1; 1.56 + store[23] = (int32) register_HDMA2; 1.57 + store[24] = (int32) register_HDMA3; 1.58 + store[25] = (int32) register_HDMA4; 1.59 + store[26] = (int32) register_HDMA5; 1.60 + store[27] = (int32) register_SVBK; 1.61 + store[28] = (int32) register_IE; 1.62 +} 1.63 + 1.64 +void setRegisters(int32* registers){ 1.65 + PC.W = (u16) (0xFFFF & registers[0]); 1.66 + SP.W = (u16) (0xFFFF & registers[1]); 1.67 + AF.W = (u16) (0xFFFF & registers[2]); 1.68 + BC.W = (u16) (0xFFFF & registers[3]); 1.69 + DE.W = (u16) (0xFFFF & registers[4]); 1.70 + HL.W = (u16) (0xFFFF & registers[5]); 1.71 + IFF = (u16) (0xFFFF & registers[6]); 1.72 + 1.73 + register_DIV = (u8) (0xFF & registers[7]); 1.74 + register_TIMA = (u8) (0xFF & registers[8]); 1.75 + register_TMA = (u8) (0xFF & registers[9]); 1.76 + register_TAC = (u8) (0xFF & registers[10]); 1.77 + register_IF = (u8) (0xFF & registers[11]); 1.78 + register_LCDC = (u8) (0xFF & registers[12]); 1.79 + register_STAT = (u8) (0xFF & registers[13]); 1.80 + register_SCY = (u8) (0xFF & registers[14]); 1.81 + register_SCX = (u8) (0xFF & registers[15]); 1.82 + register_LY = (u8) (0xFF & registers[16]); 1.83 + register_LYC = (u8) (0xFF & registers[17]); 1.84 + register_DMA = (u8) (0xFF & registers[18]); 1.85 + register_WY = (u8) (0xFF & registers[19]); 1.86 + register_WX = (u8) (0xFF & registers[20]); 1.87 + register_VBK = (u8) (0xFF & registers[21]); 1.88 + register_HDMA1 = (u8) (0xFF & registers[22]); 1.89 + register_HDMA2 = (u8) (0xFF & registers[23]); 1.90 + register_HDMA3 = (u8) (0xFF & registers[24]); 1.91 + register_HDMA4 = (u8) (0xFF & registers[25]); 1.92 + register_HDMA5 = (u8) (0xFF & registers[26]); 1.93 + register_SVBK = (u8) (0xFF & registers[27]); 1.94 + register_IE = (u8) (0xFF & registers[28]); 1.95 } 1.96 1.97 struct EmulatedSystem GBSystem =