• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

Download SuperCard source code

Started by mysql, October 20, 2005, 03:51:33 AM

Previous topic - Next topic

mat

This is great! Mr SCUMM promised he'd make scumm compatible with supercard if he could have the source... I'll send him these links now :D
img]http://img129.imageshack.us/img129/7493/oblivionsigsmaller6ry.png[/img]
Unfortunately, unlike the ball, people do not bounce.

BLYND

Will this open the way for sc trojan writers? – wouldn’t put it past the m3 a$$holes

Dudu.exe

Quote from: "BLYND"Will this open the way for sc trojan writers? â€" wouldn’t put it past the m3 a$$holes

This patch is aread open ( Ds.Briker )..  you just have to pay attention to where are you download the homebrew!

larryli

The following code does not succeed in reading Boot Secter, Why?
/* Routines for reading/writing a CF/SD card using the SuperCard.
This code must run in GBA(or NDS)'s RAM.
you may use "mpcfio.c" code also, but fisrt you must run "InitSCMode()" function.
ROM memory map: 0x8000000-0x9000000
MemoryCard memory map: 0x9000000-0xa000000
*/

#include <gba_console.h>
#include <gba_video.h>
#include <gba_interrupt.h>
#include <gba_input.h>

#include <stdio.h>

extern void ReadSector(u16 *buff, u32 sector, u8 ReadNumber);
extern void WriteSector(u16 *buff, u32 sector, u8 RriteNumber);
extern void InitSCMode(void);
extern bool MemoryCard_IsInserted(void);

void todo(void)
{
int i, j;
u8 buf[512] = {0};

ReadSector((u16 *)buf, 0, 1);
for (i = 0; i < 20; i++) {
iprintf("\x1b[%d;0H%04X:", i, i * 8);
for (j = 0; j < 8; j++)
iprintf(" %02X", buf[i * 8 + j]);
}
}

int main(void)
{
//must run InitSCMode(),first
InitSCMode();
//add user code

InitInterrupt();
EnableInterrupt(Int_Vblank);

consoleInit(0, 4, 0, NULL, 0, 15);

BG_COLORS[0] = RGB8(58, 110, 165);
BG_COLORS[241] = RGB5(31, 31, 31);

SetMode(MODE_0 | BG0_ON);

// ansi escape sequence to set print co-ordinates
// /x1b[line;columnH
iprintf("\x1b[10;10HHello World!");

todo();

while (1) {
VBlankIntrWait();
}
}
[/code]

creepyplaidman

I hope Chrism add's this to his library, he already has m3 and gbamp in his library, if developers could access all 3 of these readers with ease that'd make developers alot more interested in making direct cf access applications. I heard that pepsiman from Dslinux is already adding the api to dslinux.

DarkKiller

Don't forget the most important thing... NDS Game Backup ;) Someone should make such a program, compat' with the SC SD/CF.

..::||DarkKiller||::..
urrently running DSLinux... ! :D

Koji

Quote from: "DarkKiller"Don't forget the most important thing... NDS Game Backup ;) Someone should make such a program, compat' with the SC SD/CF.

..::||DarkKiller||::..

I agree! Then I could backup my original carts to go with my original saves since it seems like my version of Bokujou Monogatari is different from the already dumped version making my save incompatible.

mysql

This code must run in GBA(or NDS)'s RAM.

Plese run program at address :0x2000000---0x4000000 (GBA or NDS RAM)

equalizr

wow..that was fast.

I was the only person asking when and if the source code will be released just a few weeks ago and here it is.

also posted the same thing on supercard.cn

way to go romman  :D

cory1492

Really? I asked for a direct method of accessing the MM card along with an NDS menu/kernel or at least a hack like GBAMP back when I started working on DSBook a couple months ago ;)

Although you are right, it was bloody fast (all my requests towarads non-illegal things like this have been fulfilled in 2 months  :D  not to mention the bonus updated NDS patcher)

mysql, can you confirm it is infact workable/working code for both GBA and NDS? Wouldnt the devkitARM dsbuild loader already take care of loading the code into the correct memory area? If not how would the above sample need to be modified to put it into the proper memory locations...?

sWampy

Quote from: "cory1492"Although you are right, it was bloody fast (all my requests towarads non-illegal things like this have been fulfilled in 2 months  :D  not to mention the bonus updated NDS patcher)

?? Did I miss a new updated NDS patcher?

MisterJP

larryli, did you managed to make your code work ?

I have the same problem (whith a SD version); it seems that the initialization function (InitSCMode) does not work.
It is supposed to send two times 0x0A55A and two times 0x3 to 0x09FFFFFE, then it should unlock the SD access mechanism, but it doesn't.
We are also supposed to read the status of the Supercard SD (ready, inserted...) from 0x09800000, but i always get 0...

If mysql is around here, maybe he could help...

cory1492

Quote from: "sWampy"
Quote from: "cory1492"Although you are right, it was bloody fast (all my requests towarads non-illegal things like this have been fulfilled in 2 months  :D  not to mention the bonus updated NDS patcher)

?? Did I miss a new updated NDS patcher?
The latest update to the SuperCard software contains updated NDS patcher... as far as I know ndspatch 0.1 and GST universal patcher 3.1 are the only currently available stand-alone NDS patchers though.

lycos89

I get this error message when I try to build

arm9_main.cpp:36: undefined reference to `InitSCMode()'
arm9_main.cpp:38: undefined reference to `MemoryCard_IsInserted()'

Makefile

# Makefile for fat1.nds
# lycos89@hotmail.com

PROG_NAME=fat1

NDSLIB_INCLUDE=$(DEVKITPRO)/libndsold/include
NDSLIB_LIB=$(DEVKITPRO)/libndsold/lib

all: final.nds

cf.o: cf.s
arm-elf-as -mcpu=arm9tdmi -mthumb-interwork cf.s -ocf.o

mpcfio.o: mpcfio.cpp
arm-elf-g++ -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I$(NDSLIB_INCLUDE) -DARM9 -c mpcfio.cpp -ompcfio.o

arm7_main.o: arm7_main.cpp
arm-elf-g++ -g -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I$(NDSLIB_INCLUDE) -DARM7 -c arm7_main.cpp -oarm7_main.o

arm7.elf: arm7_main.o
arm-elf-g++ -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs arm7_main.o -L$(NDSLIB_LIB) -lnds7 -oarm7.elf

arm7.bin: arm7.elf
arm-elf-objcopy -O binary arm7.elf arm7.bin

arm9_main.o: arm9_main.cpp
arm-elf-g++ -g -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I$(NDSLIB_INCLUDE) -DARM9 -c arm9_main.cpp -oarm9_main.o

arm9.elf: arm9_main.o mpcfio.o cf.o
arm-elf-g++ -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs arm9_main.o cf.o mpcfio.o -L$(NDSLIB_LIB) -lnds9 -o arm9.elf

arm9.bin: arm9.elf
arm-elf-objcopy -O binary arm9.elf arm9.bin

emu.nds: arm7.bin arm9.bin
ndstool -c $(PROG_NAME).emu.nds -9 arm9.bin -7 arm7.bin

final.nds: emu.nds
dsbuild $(PROG_NAME).emu.nds -o $(PROG_NAME).nds

clean:
rm -f *.nds
rm -f *.bin
rm -f *.elf
rm -f *.o
rm -f *~



arm9_main.cpp

//////////////////////////////////////////////////////////////////////

// Demo1 ARM9 Code - Based on an example shipped with NDSLIB.

// Chris Double (chris.double@double.co.nz)

//////////////////////////////////////////////////////////////////////


#include <nds.h>
#include "nds/arm9/console.h"
#include "mpcfio.h"

/*
extern void ReadSector(u16 *buff,u32 sector,u8 ReadNumber);

extern void WriteSector(u16 *buff,u32 sector,u8 RriteNumber);

*/
extern void InitSCMode(void);

extern bool MemoryCard_IsInserted(void);

int main(void)
{
 powerON(POWER_ALL);
 
 // Use the main screen for output
 videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);
 vramSetBankA(VRAM_A_MAIN_BG);
 BG0_CR = BG_MAP_BASE(31);

 // Set the colour of the font to White.
 BG_PALETTE[255] = RGB15(31,31,31);

 // Swap the screens so the main screen is the bottom screen.
 lcdSwap();

 consoleInitDefault((u16*)SCREEN_BASE_BLOCK(31), (u16*)CHAR_BASE_BLOCK(0), 16);

 WAIT_CR &=~0x80;
 
 InitSCMode();
 
 if (MemoryCard_IsInserted())
 {
 consolePrintf("CF detectee!\n");

 /*
 unsigned char rom_data[512];
 ReadSector(0,rom_data,sizeof(rom_data));

 int i=0;
 for (i=0;i<sizeof(rom_data);i++) consolePrintf("%c",rom_data[i]);
 */
 }

 while(1) {

 }

 return 0;
}


Thanks for your help

Dudu.exe

you tried to include thee others files on the zip file?