about summary refs log tree commit diff stats
path: root/gba/source
diff options
context:
space:
mode:
authorFIX94 <fix94.1@gmail.com>2016-04-10 16:14:38 +0200
committerFIX94 <fix94.1@gmail.com>2016-04-10 16:14:38 +0200
commit089ba86faf70be52e25eef5bbfbeb54439ea67f6 (patch)
tree851b0142a0a55139d9ba529938555b75b8f1d620 /gba/source
parent378d297c658754980a03df1dbd7ff141ee59ae81 (diff)
downloadgen3uploader-089ba86faf70be52e25eef5bbfbeb54439ea67f6.tar.gz
gen3uploader-089ba86faf70be52e25eef5bbfbeb54439ea67f6.tar.bz2
gen3uploader-089ba86faf70be52e25eef5bbfbeb54439ea67f6.zip
added gba bios dumping
Diffstat (limited to 'gba/source')
-rw-r--r--gba/source/main.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/gba/source/main.c b/gba/source/main.c index 49cf2a1..d3782a6 100644 --- a/gba/source/main.c +++ b/gba/source/main.c
@@ -56,7 +56,7 @@ int main(void) {
56 // ansi escape sequence to set print co-ordinates 56 // ansi escape sequence to set print co-ordinates
57 // /x1b[line;columnH 57 // /x1b[line;columnH
58 u32 i; 58 u32 i;
59 iprintf("\x1b[9;2HGBA Link Cable Dumper v1.3\n"); 59 iprintf("\x1b[9;2HGBA Link Cable Dumper v1.4\n");
60 iprintf("\x1b[10;4HPlease look at the TV\n"); 60 iprintf("\x1b[10;4HPlease look at the TV\n");
61 // disable this, needs power 61 // disable this, needs power
62 SNDSTAT = 0; 62 SNDSTAT = 0;
@@ -66,7 +66,7 @@ int main(void) {
66 //clear out previous messages 66 //clear out previous messages
67 REG_HS_CTRL |= JOY_RW; 67 REG_HS_CTRL |= JOY_RW;
68 while (1) { 68 while (1) {
69 if((REG_HS_CTRL&JOY_READ)) 69 if(REG_HS_CTRL&JOY_READ)
70 { 70 {
71 REG_HS_CTRL |= JOY_RW; 71 REG_HS_CTRL |= JOY_RW;
72 s32 gamesize = getGameSize(); 72 s32 gamesize = getGameSize();
@@ -199,6 +199,32 @@ int main(void) {
199 } 199 }
200 REG_JOYTR = 0; 200 REG_JOYTR = 0;
201 } 201 }
202 else if(REG_HS_CTRL&JOY_WRITE)
203 {
204 REG_HS_CTRL |= JOY_RW;
205 u32 choseval = REG_JOYRE;
206 if(choseval == 4)
207 {
208 //disable interrupts
209 u32 prevIrqMask = REG_IME;
210 REG_IME = 0;
211 //dump BIOS
212 for (i = 0; i < 0x4000; i+=4)
213 {
214 // the lower bits are inaccurate, so just get it four times :)
215 u32 a = MidiKey2Freq((WaveData *)(i-4), 180-12, 0) * 2;
216 u32 b = MidiKey2Freq((WaveData *)(i-3), 180-12, 0) * 2;
217 u32 c = MidiKey2Freq((WaveData *)(i-2), 180-12, 0) * 2;
218 u32 d = MidiKey2Freq((WaveData *)(i-1), 180-12, 0) * 2;
219 REG_JOYTR = ((a>>24<<24) | (d>>24<<16) | (c>>24<<8) | (b>>24));
220 while((REG_HS_CTRL&JOY_READ) == 0) ;
221 REG_HS_CTRL |= JOY_RW;
222 }
223 //restore interrupts
224 REG_IME = prevIrqMask;
225 }
226 REG_JOYTR = 0;
227 }
202 Halt(); 228 Halt();
203 } 229 }
204} 230}