• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

supercard resets gba?!

Started by n00b, August 03, 2007, 03:45:34 PM

Previous topic - Next topic

n00b

I made a program to copy a save from a real cartridge to SuperCard's SRAM. However, I can unplug supercard and put in the game, but i cannot reinsert supercard. It resets the GBA. I tried the "insert right side first" method, but it still doesn't work. I tried handling the GamePak IRQ, but that doesnt work. Here is my source code for the SRAM copy program in case it matters.
------------------------------------------------------------------
.ALIGN
.CODE 32
.GLOBAL _start
_start:
b header_end
    @ Nintendo Logo Character Data (8000004h)
        .fill   156,1,0

    @ Game Title (80000A0h)
        .byte   0x52,0x4F,0x42,0x45,0x52,0x54,0x00,0x00
        .byte   0x00,0x00,0x00,0x00

    @ Game Code (80000ACh)
        .byte   0x52,0x42,0x52,0x54

    @ Maker Code (80000B0h)
        .byte   0x30,0x31

    @ Fixed Value (80000B2h)
        .byte   0x96

    @ Main Unit Code (80000B3h)
        .byte   0x00

    @ Device Type (80000B4h)
        .byte   0x00

    @ Unused Data (7Byte) (80000B5h)
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00

    @ Software Version No (80000BCh)
        .byte   0x00

    @ Complement Check (80000BDh)
        .byte   0xE8

    @ Checksum (80000BEh)
        .byte   0x00,0x00

    .ALIGN
    .ARM
header_end:
adr r0,main_code
adr r1,main_code_end
mov r2,#0x02000000
copy_loop:
ldr r3,[r0]
str r3,[r2]
add r0,r0,#4
add r2,r2,#4
cmp r0,r1
bne copy_loop
mov r0,#0x02000000
@b r0
mov pc,r0

.ALIGN
main_code:
mov r0,#0x03000000
add r0,r0,#0x7000
add r0,r0,#0xF00
add r0,r0,#0xFC
adr r1,interrupt
str r1,[r0]
mov r1,#1
mov r0,#0x04000000
str r1,[r0,#0x208]
mov r1,#8192
str r1,[r0,#0x200]
mov r1,#0x400
orr r1,r1,#3
str r1,[r0]
mov r0,#0x06000000
mov r1,#0x3E0
mov r2,#76800
mov r3,#0
fill_green_1:
strh r1,[r0]
add r0,r0,#2
add r3,r3,#2
cmp r2,r3
bne fill_green_1
mov r0,#0x04000000
add r0,r0,#0x130
button_loop_1:
ldrh r1,[r0]
mvn r1,r1
tst r1,#1
beq button_loop_1
mov r0,#0x06000000
mov r1,#0x1F
mov r2,#76800
mov r3,#0
fill_red_1:
strh r1,[r0]
add r0,r0,#2
add r3,r3,#2
cmp r2,r3
bne fill_red_1
mov r0,#0x0E000000
mov r1,#0x02000000
add r1,r1,#0x30000
mov r2,#0x10000
copy_sram_loop_1:
ldrb r3,[r0]
strb r3,[r1]
add r0,r0,#1
add r1,r1,#1
sub r2,r2,#1
cmp r2,#0
bne copy_sram_loop_1
mov r0,#0x06000000
mov r1,#0x3E0
mov r2,#76800
mov r3,#0
fill_green_2:
strh r1,[r0]
add r0,r0,#2
add r3,r3,#2
cmp r2,r3
bne fill_green_2
mov r0,#0x04000000
add r0,r0,#0x130
button_loop_2:
ldrh r1,[r0]
mvn r1,r1
tst r1,#1
beq button_loop_2
mov r0,#0x06000000
mov r1,#0x1F
mov r2,#76800
mov r3,#0
fill_red_2:
strh r1,[r0]
add r0,r0,#2
add r3,r3,#2
cmp r2,r3
bne fill_red_2
mov r1,#0x0E000000
mov r0,#0x02000000
add r0,r0,#0x30000
mov r2,#0x10000
copy_sram_loop_2:
ldrb r3,[r0]
strb r3,[r1]
add r0,r0,#1
add r1,r1,#1
sub r2,r2,#1
cmp r2,#0
bne copy_sram_loop_2
mov r0,#0x06000000
mov r1,#0x3E0
mov r2,#76800
mov r3,#0
fill_green_3:
strh r1,[r0]
add r0,r0,#2
add r3,r3,#2
cmp r2,r3
bne fill_green_3
infin:
b infin

interrupt:
mov r0,#0x04000000
add r0,r0,#0x200
add r0,r0,#2
ldr r1,[r0]
str r1,[r0]
bx lr
main_code_end:
------------------------------------------------------------------

Devil_Spawn

try inserting your supercard without the SD card in

n00b

#2
I tried removing the SD card: didn't work. I covered up all the pins on the cartridge with tape except VCC and GND: still resets >:( >:( >:( >:( >:( Is it because SuperCard is sucking up too much power?I found that my fake pokemon ruby cart (from China, as usual) has a flash chip, not a rom chip. The number on the chip is M5M29GB640VP. Can anyone tell me how to program it? I'm too lazy.;D I can use it to help me dump the save. My idea is to flash that cartridge to read the save and send it across the link cable to another program that will copy it onto SuperCard's SRAM. [edit]I just took a look at the datasheet, and it says the chip supports "Common Flash Interface." Should I read the document about that first? ;DNew idea. I think it will work this time. I put a program into ram at 0x02000000 on one GBA, then I unplug supercard and put a different program on another gba. I can send save across link. My new program works! I read the save on one GBA and send it to another across link. The other GBA writes it onto SuperCard. The only problem is that one thinks the checksum is valid and the other thinks the checksum is wrong. Oh well... At least it works ;D btw the save i was copying is for FFTA

dantheman

It's a known hardware problem.  Mine resets each time as well.  I got the "insert right side first" method to work a couple of times, but it's difficult.

n00b

I figured out the problem (I think). It's supercard's huge power consumption.

Devil_Spawn

my supercard inserts as many times as u want, whenever you want, without rebooting :/

n00b

weird. mine always resets. Its the purple SuperCard SD with firmware 1.81.