Hacking can someone please test this

bazamuffin

RESIDENT HATER OF POLITICAL POSTING WANKSTAINS
Member
Joined
Feb 1, 2009
Messages
2,352
Trophies
1
Location
Shmashmortion Clinic
XP
1,456
Country
Uruguay
Lol, the famous ichichfly. Purely by chance we have the same avatar. I've been accused (on more than one occasion) of being you and you had changed your nick. Anyhoos, back on topic, what does the file do?

EDIT: Hopefully certain people will see this and believe me when I say we are two different people
 

Boriar

Well-Known Member
Member
Joined
Sep 22, 2008
Messages
316
Trophies
1
Age
52
Location
Spain
XP
695
Country
It's could be a test version of his new gbaemu4DS because the old one seems to not work anymore on DSi mode.
Sorry, i can't test it. I don't have a iEvo (by now ;) )
 

ichichfly

Well-Known Member
OP
Member
Joined
Sep 23, 2009
Messages
619
Trophies
1
XP
1,076
Country
Gambia, The
src

#include
#include

#include
#include
#include
#include



vu32 exeflashcmd(u32 a,u8 b,bool c, bool d, bool e,bool f)
{

*(vu8*)0x40001A8 = 0x78; //Gamecard bus 8-byte Command Out

u8 temp = c | (d > 0x10);

*(vu8*)0x40001AE = (u8)(a >> 0x8);

*(vu8*)0x40001AF = (u8)(a);

//code for settting NDS Slot Enabled + NDS Slot Mode Parallel/ROM + Transfer Ready IRQ off

*(vu32*)0x40001A4/*ROMCTRL*/ = 0xA7406000; //start 4 bytes cmd

while(!((*(vu32*)0x40001A4)&BIT(23)/*Ready/DRQ*/));//wait till ready

return *(vu32*)4100010;
}




//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------

// Initialise the console, required for printf
consoleDemoInit();

fatInitDefault();


REG_IME = 0;

exeflashcmd(0,0,1,1,1,0);
exeflashcmd(0,0,1,1,1,0);

//printf("%08X\n",exeflashcmd(0,0,1,1,1,0));
//printf("%08X\n",exeflashcmd(0,0,1,1,1,0));
printf("%08X\n",exeflashcmd(0,0,1,1,1,0));


printf("%08X\n",exeflashcmd(0,0,0,0,1,0));
printf("%08X\n",exeflashcmd(0,0,0,0,1,0));
printf("%08X\n",exeflashcmd(1,0,0,0,1,0));
printf("%08X\n",exeflashcmd(1,0,0,0,1,0));


while(1);

return 0;
}

It is yust a test if some things work the way I expect them to work this should read 2 Bytes from the ievo.
 

ichichfly

Well-Known Member
OP
Member
Joined
Sep 23, 2009
Messages
619
Trophies
1
XP
1,076
Country
Gambia, The
OK new test. I hope I get some better results now. I don't know why all printf after the first fail so I just do all prints in one prtintf.

http://www.mediafire...h41udy1t9na6tdh

#include
#include

#include
#include
#include
#include



u32 exeflashcmd(u32 a,u8 b,bool c, bool d, bool e,bool f)
{

*(vu8*)0x40001A8 = 0x78; //Gamecard bus 8-byte Command Out

u8 temp = c | (d > 0x10);

*(vu8*)0x40001AE = (u8)(a >> 0x8);

*(vu8*)0x40001AF = (u8)(a);

//code for settting NDS Slot Enabled + NDS Slot Mode Parallel/ROM + Transfer Ready IRQ off

*(vu32*)0x40001A4/*ROMCTRL*/ = 0xA7406000; //start 4 bytes cmd

while(!((*(vu32*)0x40001A4)&BIT(23)/*Ready/DRQ*/));//wait till ready

return *(vu32*)4100010;
}




//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------

// Initialise the console, required for printf
consoleDemoInit();

fatInitDefault();


REG_IME = 0;


//printf("%08X\n",exeflashcmd(0,0,1,1,1,0));
//printf("%08X\n",exeflashcmd(0,0,1,1,1,0));
exeflashcmd(0,0,1,1,1,0);
exeflashcmd(0,0,1,1,1,0);

//printf("%08X\n",exeflashcmd(0,0,1,1,1,0));
exeflashcmd(0,0,1,1,1,0);

//printf("%08X\n",exeflashcmd(0,0,0,0,1,0));
u32 a1 = exeflashcmd(0,0,0,0,1,0);

//printf("%08X\n",exeflashcmd(0,0,0,0,1,0));
u32 a2 = exeflashcmd(0,0,0,0,1,0);

//printf("%08X\n",exeflashcmd(1,0,0,0,1,0));
//printf("%08X\n",exeflashcmd(1,0,0,0,1,0));
u32 a3 = exeflashcmd(1,0,0,0,1,0);
u32 a4 = exeflashcmd(1,0,0,0,1,0);

printf("%08X %08X %08X %08X\n",a1,a2,a3,a4);

while(1);

return 0;
}
ADD: I am sorry but my ievo is broken so I have to so it this way

ADD2: I want to dump the ievo flash to get the dsi Blowfish codes
 

Normmatt

Former AKAIO Programmer
Member
Joined
Dec 14, 2004
Messages
2,161
Trophies
1
Age
33
Website
normmatt.com
XP
2,206
Country
New Zealand
Where are you getting these cart commands from? I've tried emulating the original cyclods as well as the cyclodsi in desmume I can read/write to the sd card but haven't managed to work out any of the flash memory reading/writing commands...
 

ichichfly

Well-Known Member
OP
Member
Joined
Sep 23, 2009
Messages
619
Trophies
1
XP
1,076
Country
Gambia, The
The dump is done now. The dump gave us informations about how to change the update to flash the ievo direct to dsi mode

link: http://www.teamcyclops.com/forum/showthread.php?t=11488
 

ichichfly

Well-Known Member
OP
Member
Joined
Sep 23, 2009
Messages
619
Trophies
1
XP
1,076
Country
Gambia, The
OK here are some informations about the ievo that are not in BOOTUPDT.TXT

The flash process copys BOOTUPDT.EVO(no encryption or any other change) to the flash and possibly do other things

000000-000000:STARTING MODE (05h = DS MODE / 02h = DSI MODE)
000001-000002:region (01 = USA firmware/02 = EUR firmware etc.)
000000-001FFF:UNKNOWN (ENCRYPTED?) (Is overwritten when changing the mode or region) (only difference between the bootstrap v1.0 and v1.1)
002000-010FFF:UNKNOWN2 (ENCRYPTED?)




The code to write and read to/from the ievo flash
Code:
#include <nds.h>
#include <fat.h>
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
 
 
 
 
 
 
 
vu32 exeflashcmd(u32 a,u8 b,bool c, bool d, bool e,bool f)
{
 
*(vu8*)0x40001A8 = 0x78; //Gamecard bus 8-byte Command Out
 
u8 temp = c | (d << 1) | (e << 2) | (f << 3);
 
*(vu8*)0x40001AA = temp;
 
*(vu8*)0x40001AB = b;
 
*(vu8*)0x40001AC = (u8)(a >> 0x18);
 
*(vu8*)0x40001AD = (u8)(a >> 0x10);
 
*(vu8*)0x40001AE = (u8)(a >> 0x8);
 
*(vu8*)0x40001AF = (u8)(a);
 
//code for settting NDS Slot Enabled + NDS Slot Mode Parallel/ROM + Transfer Ready IRQ off
 
*(vu32*)0x40001A4/*ROMCTRL*/ = 0xA7406000; //start 4 bytes cmd
 
while(!((*(vu32*)0x40001A4)&BIT(23)/*Ready/DRQ*/));//wait till ready
 
return *(vu32*)0x4100010;
}
void waitforflash()
{
start:
exeflashcmd(0,0x0,0,1,1,0);
exeflashcmd(0,0x0,0,0,1,0);
u32 temp = exeflashcmd(0,0x0,0,0,1,0);
exeflashcmd(0,0x0,0,1,1,0);
exeflashcmd(0,0x0,0,0,1,0);
u32 temp2 = exeflashcmd(0,0x0,0,0,1,0);
if(temp != temp2)goto start;
}
 
void erase(u32 addr)
{
//maker stor r0 on stack with offset 0xC
exeflashcmd(0xAAA,0xAA,0,1,1,1);
exeflashcmd(0xAAA,0xAA,0,1,0,1);
exeflashcmd(0xAAA,0xAA,0,1,1,1);
 
exeflashcmd(0x555,0x55,0,1,1,1);
exeflashcmd(0x555,0x55,0,1,0,1);
exeflashcmd(0x555,0x55,0,1,1,1);
 
exeflashcmd(0xAAA,0x80,0,1,1,1);
exeflashcmd(0xAAA,0x80,0,1,0,1);
exeflashcmd(0xAAA,0x80,0,1,1,1);
 
exeflashcmd(0xAAA,0xAA,0,1,1,1);
exeflashcmd(0xAAA,0xAA,0,1,0,1);
exeflashcmd(0xAAA,0xAA,0,1,1,1);
 
exeflashcmd(0x555,0x55,0,1,1,1);
exeflashcmd(0x555,0x55,0,1,0,1);
exeflashcmd(0x555,0x55,0,1,1,1);
 
exeflashcmd(addr,0x30,0,1,1,1);
exeflashcmd(addr,0x30,0,1,0,1);
exeflashcmd(addr,0x30,0,1,1,1);
waitforflash();
 
}
void writeopen()
{
 
exeflashcmd(0xAAA,0xAA,0,1,1,1);
exeflashcmd(0xAAA,0xAA,0,1,0,1);
exeflashcmd(0xAAA,0xAA,0,1,1,1);
 
exeflashcmd(0x555,0x55,0,1,1,1);
exeflashcmd(0x555,0x55,0,1,0,1);
exeflashcmd(0x555,0x55,0,1,1,1);
 
exeflashcmd(0xAAA,0x20,0,1,1,1);
exeflashcmd(0xAAA,0x20,0,1,0,1);
exeflashcmd(0xAAA,0x20,0,1,1,1);
}
 
void write(u8 Byte, u32 addr)
{
exeflashcmd(0x0,0xA0,0,1,0,1);
exeflashcmd(0x0,0xA0,0,1,1,1);
exeflashcmd(addr,Byte,0,1,0,1);
exeflashcmd(addr,Byte,0,1,1,1);
waitforflash();
}
 
void writeclose()
{
exeflashcmd(0x0,0x90,0,1,1,1);
exeflashcmd(0x0,0x90,0,1,0,1);
exeflashcmd(0x0,0x90,0,1,1,1);
 
exeflashcmd(0x0,0x0,0,1,1,1);
exeflashcmd(0x0,0x0,0,1,0,1);
exeflashcmd(0x0,0x0,0,1,1,1);
 
}
 
 
u8 readbyte(u32 addr)
{
exeflashcmd(addr,0,0,0,1,0);
u32 temp = exeflashcmd(addr,0,0,0,1,0);
return (temp >> 0x8) & 0xFF;
}
 
void readar(u8* dest,uint src,uint size)
{
int i = 0;
while(i < size)
{
dest[I] = readbyte(src + i);[/I]
[I] i++;[/I]
[I] }[/I]
[I]}[/I]
 
[I]void UIwrite(u32 addr)[/I]
[I]{[/I]
[I] writeopen();[/I]
[I] u8 Byte = 0;[/I]
[I] u8 othermul = 1;[/I]
[I] while(1) [/I]
[I] {[/I]
[I] iprintf("\x1b[2J");[/I]
[I] iprintf("write flash\n");[/I]
[I] iprintf("%02X %02X\n",Byte,othermul);[/I]
[I] swiWaitForVBlank();[/I]
[I] scanKeys();[/I]
[I] int isdaas = keysDownRepeat();[/I]
[I] if (isdaas&KEY_UP) Byte+=othermul;[/I]
[I] if (isdaas&KEY_DOWN) Byte-=othermul;[/I]
[I] if (isdaas&KEY_RIGHT) othermul*=2;[/I]
[I] if (isdaas&KEY_LEFT && othermul != 1) othermul/=2;[/I]
[I] if (isdaas&KEY_SELECT) [/I]
[I] {[/I]
[I] write(Byte,addr);[/I]
[I] writeclose();[/I]
[I] return;[/I]
[I] }[/I]
[I] }[/I]
[I]}[/I]
 
[I]//---------------------------------------------------------------------------------[/I]
[I]int main(int argc, char **argv) {[/I]
[I]//---------------------------------------------------------------------------------[/I]
 
[I] // Initialise the console, required for printf[/I]
[I] consoleDemoInit();[/I]
 
[I] fatInitDefault();[/I]
 
 
[I] REG_IME = 0;[/I]
 
 
[I] //start flash[/I]
[I] exeflashcmd(0,0,1,1,1,0);[/I]
[I] exeflashcmd(0,0,1,1,1,0);[/I]
[I] exeflashcmd(0,0,1,1,1,0);[/I]
 
[I] u32 addr = 0;[/I]
[I] u32 mul = 1;[/I]
[I] u8 test[20];[/I]
[I] readar(test,0,2); //read 2 Byte from 0 to test[/I]
[I] while(1) [/I]
[I] {[/I]
[I] iprintf("\x1b[2J");[/I]
[I] iprintf("erase flash %02X %02X\n",test[0],test[1]);[/I]
[I] iprintf("%08X %08X\n",addr,mul);[/I]
[I] swiWaitForVBlank();[/I]
[I] scanKeys();[/I]
[I] int isdaas = keysDownRepeat();[/I]
[I] if (isdaas&KEY_A) erase(addr);[/I]
[I] if (isdaas&KEY_UP) addr+=mul;[/I]
[I] if (isdaas&KEY_DOWN) addr-=mul;[/I]
[I] if (isdaas&KEY_RIGHT) mul*=2;[/I]
[I] if (isdaas&KEY_LEFT && mul != 1) mul/=2;[/I]
[I] if (isdaas&KEY_START) UIwrite(addr);[/I]
[I] }[/I]
 
[I] return 0;[/I]
[I]}[/I]
A patch for an DS emulator so the ievo.nds runs on the emulator (warning not really clean code )
Code:
[I]Index: src/addons/slot1_r4.cpp[/I]
[I]===================================================================[/I]
[I]--- src/addons/slot1_r4.cpp (revision 4204)[/I]
[I]+++ src/addons/slot1_r4.cpp (working copy)[/I]
[I]@@ -222,8 +222,8 @@[/I]
[I] }[/I]
[I] }[/I]
 
[I]-SLOT1INTERFACE slot1R4 = {[/I]
[I]- "R4",[/I]
[I]+SLOT1INTERFACE slot1Retail = {[/I]
[I]+ "R4(wtf)",[/I]
[I] init,[/I]
[I] reset,[/I]
[I] close,[/I]
[I]Index: src/addons/slot1_retail.cpp[/I]
[I]===================================================================[/I]
[I]--- src/addons/slot1_retail.cpp (revision 4204)[/I]
[I]+++ src/addons/slot1_retail.cpp (working copy)[/I]
[I]@@ -21,12 +21,52 @@[/I]
[I] #include "../registers.h"[/I]
[I] #include "../MMU.h"[/I]
[I] #include "../NDSSystem.h"[/I]
[I]+#include "../emufile.h"[/I]
 
[I]+[/I]
[I]+#include <stdio.h>[/I]
[I]+#include <stdexcept>[/I]
[I]+#include <string>[/I]
[I]+#include <assert.h>[/I]
[I]+#include <limits.h>[/I]
[I]+[/I]
[I]+#include <cstdlib>[/I]
[I]+#include <cstring>[/I]
[I]+[/I]
[I]+static EMUFILE *img = NULL;[/I]
[I]+[/I]
[I]+int lastsubcmd = 0;[/I]
[I]+[/I]
[I]+bool write_enabled = false;[/I]
[I]+int write_count = 0;[/I]
[I]+[/I]
[I] static void info(char *info) { strcpy(info, "Slot1 Retail card emulation"); }[/I]
[I] static void config(void) {}[/I]
 
[I]-static BOOL init() { return (TRUE); }[/I]
[I]+static FILE* debugfile1;[/I]
 
[I]+int fsize(FILE *fp){[/I]
[I]+ int prev=ftell(fp);[/I]
[I]+ fseek(fp, 0L, SEEK_END);[/I]
[I]+ int sz=ftell(fp);[/I]
[I]+ fseek(fp,prev,SEEK_SET); //go back to where we were[/I]
[I]+ return sz;[/I]
[I]+}[/I]
[I]+[/I]
[I]+static BOOL init() {[/I]
[I]+[/I]
[I]+ //if (!img)[/I]
[I]+ img = slot1GetFatImage();[/I]
[I]+ if(!debugfile1)debugfile1 = fopen("C:/Users/entwickler/Documents/debugfile1","w+");[/I]
[I]+[/I]
[I]+ /*if(!img)[/I]
[I]+ {[/I]
[I]+ INFO("slot1 fat not successfully mounted\n");[/I]
[I]+ }*/[/I]
[I]+ return true;[/I]
[I]+[/I]
[I]+}[/I]
[I]+[/I]
[I] static void reset() {}[/I]
 
[I] static void close() {}[/I]
[I]@@ -35,30 +75,101 @@[/I]
[I] static void write08(u8 PROCNUM, u32 adr, u8 val) {}[/I]
[I] static void write16(u8 PROCNUM, u32 adr, u16 val) {}[/I]
 
[I]+int counter = 0;[/I]
[I]+[/I]
[I] static void write32_GCROMCTRL(u8 PROCNUM, u32 val)[/I]
[I] {[/I]
[I] nds_dscard& card = MMU.dscard[PROCNUM];[/I]
[I]-[/I]
[I]- switch(card.command[0])[/I]
[I]+ int temp = card.command[0];[/I]
[I]+ //MMU.MAIN_MEM[0x24DA8] = 0x1;[/I]
[I]+ //MMU.MAIN_MEM[0x24DA9] = 0x20;[/I]
[I]+ switch(temp)[/I]
[I] {[/I]
[I]- case 0x00: //Data read[/I]
[I]- case 0xB7:[/I]
[I]- card.address = (card.command[1] << 24) | (card.command[2] << 16) | (card.command[3] << 8) | card.command[4];[/I]
[I]- card.transfer_count = 0x80;[/I]
[I]+ case 0x78: //ievo flash???[/I]
[I]+ //NDS_debug_break();[/I]
[I]+ printf("flash %02X %02X %02X%02X%02X%02X\r\n",card.command[2],card.command[3],card.command[4],card.command[5],card.command[6],card.command[7]);[/I]
[I]+ card.transfer_count = 0x4;[/I]
[I] break;[/I]
[I]+ case 0x81: //ievo cpu[/I]
[I]+ if(card.command[1] == 0x52)[/I]
[I]+ {[/I]
[I]+ card.address = (card.command[2] << 24) | (card.command[3] << 16) | (card.command[4] << 8) | card.command[5];[/I]
[I]+ img->fseek(card.address,SEEK_SET);[/I]
[I]+ printf("\r\nsetread %02X%02X%02X%02X(%08X)",card.command[2],card.command[3],card.command[4],card.command[5],fsize(debugfile1));[/I]
[I]+ }[/I]
[I]+ break;[/I]
[I]+ case 0x80: //ievo[/I]
[I]+ if(card.command[1] == 0x59)[/I]
[I]+ {[/I]
[I]+ card.address = (card.command[2] << 24) | (card.command[3] << 16) | (card.command[4] << 8) | card.command[5];[/I]
[I]+ img->fseek(card.address,SEEK_SET);[/I]
[I]+ printf("\r\nsetwrite %02X%02X%02X%02X",card.command[2],card.command[3],card.command[4],card.command[5]);[/I]
[I]+ }[/I]
[I]+ lastsubcmd = card.command[1];[/I]
[I]+ break;[/I]
 
[I]- case 0xB8: // Chip ID[/I]
[I]- card.address = 0;[/I]
[I]- card.transfer_count = 1;[/I]
[I]+ case 0x7E: //ievo cpu sd response[/I]
[I]+ card.transfer_count = 0x80;[/I]
[I]+ write_count = 0x80;[/I]
[I]+ write_enabled = true;[/I]
[I]+ printf(".");[/I]
[I]+ break;[/I]
[I]+ case 0x7D: //ievo cpu sd incomming[/I]
[I]+ card.transfer_count = 0x80;[/I]
[I]+ printf(".");[/I]
[I]+ break;[/I]
[I]+ case 0x7B: //ievo raw sd response[/I]
[I]+ card.transfer_count = 6;[/I]
[I]+ break;[/I]
[I]+ case 0x7C: //ievo check ready[/I]
[I]+ card.transfer_count = 1;[/I]
[I]+ break;[/I]
[I] break;[/I]
 
[I] default:[/I]
[I]+ printf("unkcmd %02X %02X %02X%02X%02X%02X%02X%02X\r\n",card.command[0],card.command[1],card.command[2],card.command[3],card.command[4],card.command[5],card.command[6],card.command[7]);[/I]
[I] card.address = 0;[/I]
[I] card.transfer_count = 0;[/I]
[I] break;[/I]
[I] }[/I]
[I] }[/I]
 
[I]+static void write32_GCDATAIN(u8 PROCNUM,u32 val)[/I]
[I]+{[/I]
[I]+ nds_dscard& card = MMU.dscard[PROCNUM];[/I]
[I]+[/I]
[I]+ switch(card.command[0])[/I]
[I]+ {[/I]
[I]+ case 0x7E:[/I]
[I]+ {[/I]
[I]+ if(write_count && write_enabled)[/I]
[I]+ {[/I]
[I]+ img->fwrite(&val, 4);[/I]
[I]+ img->fflush();[/I]
[I]+ write_count--;[/I]
[I]+ }[/I]
[I]+ break;[/I]
[I]+ }[/I]
[I]+ default:[/I]
[I]+ break;[/I]
[I]+ }[/I]
[I]+[/I]
[I]+ if(write_count==0)[/I]
[I]+ {[/I]
[I]+ write_enabled = false;[/I]
[I]+[/I]
[I]+ // transfer is done[/I]
[I]+ T1WriteLong(MMU.MMU_MEM[PROCNUM][0x40], 0x1A4,val & 0x7F7FFFFF);[/I]
[I]+[/I]
[I]+ // if needed, throw irq for the end of transfer[/I]
[I]+ if(MMU.AUX_SPI_CNT & 0x4000)[/I]
[I]+ NDS_makeIrq(ARMCPU_ARM9, IRQ_BIT_GC_TRANSFER_COMPLETE);[/I]
[I]+ }[/I]
[I]+}[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I] static void write32(u8 PROCNUM, u32 adr, u32 val)[/I]
[I] {[/I]
[I] switch(adr)[/I]
[I]@@ -66,9 +177,13 @@[/I]
[I] case REG_GCROMCTRL:[/I]
[I] write32_GCROMCTRL(PROCNUM, val);[/I]
[I] break;[/I]
[I]+ case REG_GCDATAIN:[/I]
[I]+ write32_GCDATAIN(PROCNUM,val);[/I]
[I]+ break;[/I]
[I] }[/I]
[I] }[/I]
 
[I]+[/I]
[I] static u8 read08(u8 PROCNUM, u32 adr)[/I]
[I] {[/I]
[I] return 0xFF;[/I]
[I]@@ -78,13 +193,41 @@[/I]
[I] return 0xFFFF;[/I]
[I] }[/I]
 
[I]+int debug_counter = 0;[/I]
[I] static u32 read32_GCDATAIN(u8 PROCNUM)[/I]
[I] {[/I]
[I] nds_dscard& card = MMU.dscard[PROCNUM];[/I]
[I]-[/I]
[I]+ //NDS_debug_break();[/I]
[I] switch(card.command[0])[/I]
[I] {[/I]
[I]- //Get ROM chip ID[/I]
[I]+ case 0x78:[/I]
[I]+ {[/I]
[I]+ //NDS_debug_break();[/I]
[I]+ debug_counter++;[/I]
[I]+ //if(debug_counter == 35)NDS_debug_break();[/I]
[I]+ if(card.command[7] == 0)[/I]
[I]+ {[/I]
[I]+ return 0x05*0x01010101; //only get the 0x3F from 0x1F2F3F4F why? //flash mode 0x02 DSi mode 0x05 DS mode[/I]
[I]+ }[/I]
[I]+ else return 0x1*0x01010101; //region[/I]
[I]+ }[/I]
[I]+[/I]
[I]+[/I]
[I]+ case 0x7D: //ievo raw card response[/I]
[I]+ {[/I]
[I]+ u32 val;[/I]
[I]+ img->fread(&val, 4);[/I]
[I]+ fwrite(&val, sizeof(val), 1, debugfile1);[/I]
[I]+ return val;[/I]
[I]+ }[/I]
[I]+[/I]
[I]+ case 0x7B: //ievo raw card response[/I]
[I]+ return 0x0900803F; [/I]
[I]+[/I]
[I]+ case 0x7C: //ievo check state[/I]
[I]+ if(lastsubcmd == 0x48) return 0x0; //go away[/I]
[I]+ return 0x51; //cmd done/ Data readed stream inited[/I]
[I]+ //Get ROM chip ID[/I]
[I] case 0x90:[/I]
[I] case 0xB8:[/I]
[I] {[/I]
[I]@@ -147,14 +290,17 @@[/I]
[I] {[/I]
[I] case REG_GCDATAIN:[/I]
[I] return read32_GCDATAIN(PROCNUM);[/I]
[I]+ case REG_GCROMCTRL:[/I]
[I]+ return T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]) | 0x800000; //always ready for data incoming[/I]
[I]+[/I]
[I] default:[/I]
[I] return 0;[/I]
[I] }[/I]
[I] }[/I]
 
 
[I]-SLOT1INTERFACE slot1Retail = {[/I]
[I]- "Retail",[/I]
[I]+SLOT1INTERFACE slot1R4 = {[/I]
[I]+ "R4",[/I]
[I] init,[/I]
[I] reset,[/I]
[I] close,[/I]
[I]Index: src/MMU.cpp[/I]
[I]===================================================================[/I]
[I]--- src/MMU.cpp (revision 4204)[/I]
[I]+++ src/MMU.cpp (working copy)[/I]
[I]@@ -23,6 +23,8 @@[/I]
[I] #include <assert.h>[/I]
[I] #include <sstream>[/I]
 
[I]+#include "i2c.h"[/I]
[I]+[/I]
[I] #include "common.h"[/I]
[I] #include "debug.h"[/I]
[I] #include "NDSSystem.h"[/I]
[I]@@ -40,6 +42,10 @@[/I]
[I] #include "readwrite.h"[/I]
[I] #include "MMU_timing.h"[/I]
 
[I]+#define LOGo_CARD[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I] #ifdef DO_ASSERT_UNALIGNED[/I]
[I] #define ASSERT_UNALIGNED(x) assert(x)[/I]
[I] #else[/I]
[I]@@ -144,7 +150,6 @@[/I]
[I] #endif[/I]
 
 
[I]-//#define LOG_CARD[/I]
[I] //#define LOG_GPU[/I]
[I] //#define LOG_DMA[/I]
[I] //#define LOG_DMA2[/I]
[I]@@ -382,7 +387,7 @@[/I]
[I] }[/I]
 
 
[I]-#define LOG_VRAM_ERROR() LOG("No data for block %i MST %i\n", block, VRAMBankCnt & 0x07);[/I]
[I]+#define LOG_VRAM_ERROR() printf("No data for block %i MST %i\n", block, VRAMBankCnt & 0x07);[/I]
 
[I] VramConfiguration vramConfiguration;[/I]
 
[I]@@ -827,7 +832,7 @@[/I]
 
 
[I] void MMU_Init(void) {[/I]
[I]- LOG("MMU init\n");[/I]
[I]+ printf("MMU init\n");[/I]
 
[I] memset(&MMU, 0, sizeof(MMU_struct));[/I]
 
[I]@@ -864,7 +869,7 @@[/I]
[I] } [/I]
 
[I] void MMU_DeInit(void) {[/I]
[I]- LOG("MMU deinit\n");[/I]
[I]+ printf("MMU deinit\n");[/I]
[I] if (MMU.fw.fp)[/I]
[I] fclose(MMU.fw.fp);[/I]
[I] mc_free(&MMU.fw); [/I]
[I]@@ -1300,8 +1305,8 @@[/I]
[I] nds_dscard& card = MMU.dscard[TEST_PROCNUM];[/I]
[I] u32 val = 0;[/I]
 
[I]- if(card.transfer_count == 0)[/I]
[I]- return 0;[/I]
[I]+ /*if(card.transfer_count == 0)[/I]
[I]+ return 0;*/[/I]
 
[I] switch(card.command[0])[/I]
[I] {[/I]
[I]@@ -2359,9 +2364,14 @@[/I]
[I] break;[/I]
 
[I] case REG_AUXSPICNT:[/I]
[I]+ [/I]
[I]+ //printf("%08X : %02X\r\n", adr, val);[/I]
[I] write_auxspicnt(9,8,0,val);[/I]
[I] return;[/I]
[I] case REG_AUXSPICNT+1:[/I]
[I]+ [/I]
[I]+ //printf("%08X : %02X\r\n", adr, val); //ichfly[/I]
[I]+[/I]
[I] write_auxspicnt(9,8,1,val);[/I]
[I] return;[/I]
 
[I]@@ -2369,6 +2379,8 @@[/I]
[I] if(val!=0) MMU.AUX_SPI_CMD = val & 0xFF;[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM9));[/I]
[I] MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag[/I]
[I]+ [/I]
[I]+ //printf("%08X : %02X\r\n", adr, val);[/I]
[I] return;[/I]
 
[I] case REG_WRAMCNT: [/I]
[I]@@ -2407,21 +2419,56 @@[/I]
[I] DISP_FIFOsend(val);[/I]
[I] return;[/I]
[I] }[/I]
[I]- #ifdef LOG_CARD[/I]
[I]- case 0x040001A0 : /* TODO (clear): ??? */[/I]
[I]- case 0x040001A1 :[/I]
[I]- case 0x040001A2 :[/I]
[I]- case 0x040001A8 :[/I]
[I]- case 0x040001A9 :[/I]
[I]- case 0x040001AA :[/I]
[I]- case 0x040001AB :[/I]
[I]- case 0x040001AC :[/I]
[I]- case 0x040001AD :[/I]
[I]- case 0x040001AE :[/I]
[I]- case 0x040001AF :[/I]
[I]- LOG("%08X : %02X\r\n", adr, val);[/I]
[I]- #endif[/I]
[I]+ [/I]
 
[I]+[/I]
[I]+ case REG_GCDATAIN:[/I]
[I]+ case REG_GCROMCTRL: [/I]
[I]+ //case REG_GCCMDOUT: //ichfly alle [/I]
[I]+ case REG_ENCSEED0L: [/I]
[I]+ case REG_ENCSEED1L: [/I]
[I]+ case REG_ENCSEED0H: [/I]
[I]+ case REG_ENCSEED1H: [/I]
[I]+ case REG_SPICNT: [/I]
[I]+ case REG_SPIDATA: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN +2:[/I]
[I]+ case REG_GCROMCTRL +2: [/I]
[I]+ //case REG_GCCMDOUT +2 : [/I]
[I]+ case REG_ENCSEED0L +2 : [/I]
[I]+ case REG_ENCSEED1L +2: [/I]
[I]+ case REG_ENCSEED0H +2: [/I]
[I]+ case REG_ENCSEED1H +2: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN + 1:[/I]
[I]+ case REG_AUXSPIDATA +1: [/I]
[I]+ case REG_GCROMCTRL +1: [/I]
[I]+ //case REG_GCCMDOUT +1: [/I]
[I]+ case REG_ENCSEED0L + 1: [/I]
[I]+ case REG_ENCSEED1L +1: [/I]
[I]+ case REG_ENCSEED0H +1: [/I]
[I]+ case REG_ENCSEED1H +1: [/I]
[I]+ case REG_SPICNT + 1: [/I]
[I]+ case REG_SPIDATA +1: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN +3:[/I]
[I]+ case REG_GCROMCTRL +3: [/I]
[I]+ //case REG_GCCMDOUT +3 : [/I]
[I]+ case REG_ENCSEED0L +3 : [/I]
[I]+ case REG_ENCSEED1L +3: [/I]
[I]+ case REG_ENCSEED0H +3: [/I]
[I]+ case REG_ENCSEED1H +3: [/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+// case 0x040001AC : //ichfly[/I]
[I]+// case 0x040001AD :[/I]
[I]+// case 0x040001AE :[/I]
[I]+// case 0x040001AF :[/I]
[I]+ printf("%08X : %02X\r\n", adr, val);[/I]
[I]+[/I]
[I] }[/I]
 
[I] MMU.MMU_MEM[ARMCPU_ARM9][adr>>20][adr&MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]]=val;[/I]
[I]@@ -2716,54 +2763,60 @@[/I]
 
[I] case REG_AUXSPICNT:[/I]
[I] write_auxspicnt(9,16,0,val);[/I]
[I]+[/I]
[I]+ //printf("%08X : %04X\r\n", adr, val); //ichfly[/I]
[I] return;[/I]
 
[I] case REG_AUXSPIDATA:[/I]
[I] if(val!=0)[/I]
[I] MMU.AUX_SPI_CMD = val & 0xFF;[/I]
 
[I]+[/I]
[I]+ //printf("%08X : %04X\r\n", adr, val); //ichfly[/I]
[I]+[/I]
[I]+[/I]
[I] //T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, bm_transfer(&MMU.bupmem, val));[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM9));[/I]
[I] MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag[/I]
[I] return;[/I]
 
[I] case REG_DISPA_BG0CNT :[/I]
[I]- //GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("MAIN BG0 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(MainScreen.gpu, 0, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x8, val);[/I]
[I] return;[/I]
[I] case REG_DISPA_BG1CNT :[/I]
[I]- //GPULOG("MAIN BG1 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("MAIN BG1 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(MainScreen.gpu, 1, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0xA, val);[/I]
[I] return;[/I]
[I] case REG_DISPA_BG2CNT :[/I]
[I]- //GPULOG("MAIN BG2 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("MAIN BG2 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(MainScreen.gpu, 2, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0xC, val);[/I]
[I] return;[/I]
[I] case REG_DISPA_BG3CNT :[/I]
[I]- //GPULOG("MAIN BG3 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("MAIN BG3 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(MainScreen.gpu, 3, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0xE, val);[/I]
[I] return;[/I]
[I] case REG_DISPB_BG0CNT :[/I]
[I]- //GPULOG("SUB BG0 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("SUB BG0 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(SubScreen.gpu, 0, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1008, val);[/I]
[I] return;[/I]
[I] case REG_DISPB_BG1CNT :[/I]
[I]- //GPULOG("SUB BG1 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("SUB BG1 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(SubScreen.gpu, 1, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x100A, val);[/I]
[I] return;[/I]
[I] case REG_DISPB_BG2CNT :[/I]
[I]- //GPULOG("SUB BG2 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("SUB BG2 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(SubScreen.gpu, 2, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x100C, val);[/I]
[I] return;[/I]
[I] case REG_DISPB_BG3CNT :[/I]
[I]- //GPULOG("SUB BG3 SETPROP 16B %08X\r\n", val);[/I]
[I]+ //GPUprintf("SUB BG3 SETPROP 16B %08X\r\n", val);[/I]
[I] GPU_setBGProp(SubScreen.gpu, 3, val);[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x100E, val);[/I]
[I] return;[/I]
[I]@@ -2875,11 +2928,42 @@[/I]
[I] }[/I]
 
[I] case REG_GCROMCTRL :[/I]
[I]- MMU_writeToGCControl<ARMCPU_ARM9>( (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1A4) & 0xFFFF0000) | val);[/I]
[I]+ [/I]
[I]+ //printf("%08X : %04X\r\n", adr, val); //ichfly[/I]
[I]+ MMU_writeToGCControl<ARMCPU_ARM9>( (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1A4) & 0xFFFF0000) | val);[/I]
[I] return;[/I]
[I] case REG_GCROMCTRL+2 :[/I]
[I]+ [/I]
[I]+ //printf("%08X : %04X\r\n", adr, val); //ichfly[/I]
[I] MMU_writeToGCControl<ARMCPU_ARM9>( (T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1A4) & 0xFFFF) | ((u32) val << 16));[/I]
[I] return;[/I]
[I]+[/I]
[I]+[/I]
[I]+ [/I]
[I]+ case REG_GCDATAIN:[/I]
[I]+ case REG_GCCMDOUT: [/I]
[I]+ case REG_ENCSEED0L: [/I]
[I]+ case REG_ENCSEED1L: [/I]
[I]+ case REG_ENCSEED0H: [/I]
[I]+ case REG_ENCSEED1H: [/I]
[I]+ case REG_SPICNT: [/I]
[I]+ case REG_SPIDATA: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN +2:[/I]
[I]+ case REG_GCCMDOUT +2 : [/I]
[I]+ case REG_ENCSEED0L +2 : [/I]
[I]+ case REG_ENCSEED1L +2: [/I]
[I]+ case REG_ENCSEED0H +2: [/I]
[I]+ case REG_ENCSEED1H +2: [/I]
[I]+[/I]
[I]+ case 0x040001AC :[/I]
[I]+ case 0x040001AD :[/I]
[I]+ case 0x040001AE :[/I]
[I]+ case 0x040001AF :[/I]
[I]+ //printf("%08X : %04\r\n", adr, val); //ichfly[/I]
[I]+ T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM9][adr>>20], val); [/I]
[I]+[/I]
[I]+[/I]
[I] }[/I]
 
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM9][adr>>20], val); [/I]
[I]@@ -3179,13 +3263,13 @@[/I]
 
[I] case REG_DISPA_DISPCNT :[/I]
[I] GPU_setVideoProp(MainScreen.gpu, val);[/I]
[I]- //GPULOG("MAIN INIT 32B %08X\r\n", val);[/I]
[I]+ //GPUprintf("MAIN INIT 32B %08X\r\n", val);[/I]
[I] T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0, val);[/I]
[I] return;[/I]
 
[I] case REG_DISPB_DISPCNT : [/I]
[I] GPU_setVideoProp(SubScreen.gpu, val);[/I]
[I]- //GPULOG("SUB INIT 32B %08X\r\n", val);[/I]
[I]+ //GPUprintf("SUB INIT 32B %08X\r\n", val);[/I]
[I] T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x1000, val);[/I]
[I] return;[/I]
 
[I]@@ -3277,6 +3361,10 @@[/I]
 
 
[I] case REG_GCROMCTRL :[/I]
[I]+[/I]
[I]+ [/I]
[I]+ //printf("%08X : %08X\r\n", adr, val); //ichfly[/I]
[I]+[/I]
[I] MMU_writeToGCControl<ARMCPU_ARM9>(val);[/I]
[I] return;[/I]
[I] case REG_DISPA_DISPCAPCNT :[/I]
[I]@@ -3316,7 +3404,28 @@[/I]
 
[I] case REG_GCDATAIN:[/I]
[I] slot1_device.write32(ARMCPU_ARM9, REG_GCDATAIN,val);[/I]
[I]+[/I]
[I]+ //printf("%08X : %08X\r\n", adr, val); //ichfly[/I]
[I]+[/I]
[I] return;[/I]
[I]+[/I]
[I]+[/I]
[I]+ [/I]
[I]+ case REG_AUXSPICNT:[/I]
[I]+ case REG_AUXSPIDATA: [/I]
[I]+ case REG_GCCMDOUT: [/I]
[I]+ case REG_ENCSEED0L: [/I]
[I]+ case REG_ENCSEED1L: [/I]
[I]+ case REG_ENCSEED0H: [/I]
[I]+ case REG_ENCSEED1H: [/I]
[I]+ case REG_SPICNT: [/I]
[I]+ case REG_SPIDATA: [/I]
[I]+ case 0x040001AC :[/I]
[I]+ case 0x040001AD :[/I]
[I]+ case 0x040001AE :[/I]
[I]+ case 0x040001AF :[/I]
[I]+ //printf("%08X : %08X\r\n", adr, val); //ichfly[/I]
[I]+ T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20], val);[/I]
[I] }[/I]
 
[I] T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20], val);[/I]
[I]@@ -3413,6 +3522,65 @@[/I]
[I] case REG_KEYINPUT:[/I]
[I] LagFrameFlag=0;[/I]
[I] break;[/I]
[I]+[/I]
[I]+ case REG_AUXSPICNT:[/I]
[I]+ case REG_AUXSPICNT+1:[/I]
[I]+ case REG_AUXSPIDATA:[/I]
[I]+ case REG_GCDATAIN:[/I]
[I]+ case REG_GCROMCTRL: [/I]
[I]+ case REG_GCCMDOUT: [/I]
[I]+ case REG_ENCSEED0L: [/I]
[I]+ case REG_ENCSEED1L: [/I]
[I]+ case REG_ENCSEED0H: [/I]
[I]+ case REG_ENCSEED1H: [/I]
[I]+ case REG_SPICNT: [/I]
[I]+ case REG_SPIDATA: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN +2:[/I]
[I]+ case REG_GCROMCTRL +2: [/I]
[I]+ case REG_GCCMDOUT +2 : [/I]
[I]+ case REG_ENCSEED0L +2 : [/I]
[I]+ case REG_ENCSEED1L +2: [/I]
[I]+ case REG_ENCSEED0H +2: [/I]
[I]+ case REG_ENCSEED1H +2: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN + 1:[/I]
[I]+ case REG_AUXSPIDATA +1: [/I]
[I]+ case REG_GCROMCTRL +1: [/I]
[I]+ case REG_GCCMDOUT +1: [/I]
[I]+ case REG_ENCSEED0L + 1: [/I]
[I]+ case REG_ENCSEED1L +1: [/I]
[I]+ case REG_ENCSEED0H +1: [/I]
[I]+ case REG_ENCSEED1H +1: [/I]
[I]+ case REG_SPICNT + 1: [/I]
[I]+ case REG_SPIDATA +1: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN +3:[/I]
[I]+ case REG_GCROMCTRL +3: [/I]
[I]+ case REG_GCCMDOUT +3 : [/I]
[I]+ case REG_ENCSEED0L +3 : [/I]
[I]+ case REG_ENCSEED1L +3: [/I]
[I]+ case REG_ENCSEED0H +3: [/I]
[I]+ case REG_ENCSEED1H +3: [/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+ case 0x040001AC :[/I]
[I]+ case 0x040001AD :[/I]
[I]+ case 0x040001AE :[/I]
[I]+ case 0x040001AF :[/I]
[I]+ //printf("Byte %08X\r\n", adr); // //ichfly[/I]
[I]+ {[/I]
[I]+ bool unmapped, restricted; [/I]
[I]+ adr = MMU_LCDmap<ARMCPU_ARM9>(adr, unmapped, restricted);[/I]
[I]+ if(unmapped) return 0;[/I]
[I]+[/I]
[I]+ return MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF][adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF]];[/I]
[I]+ }[/I]
[I]+[/I]
[I]+[/I]
[I] }[/I]
[I] }[/I]
 
[I]@@ -3490,6 +3658,7 @@[/I]
[I] return read_timer(ARMCPU_ARM9,(adr&0xF)>>2);[/I]
 
[I] case REG_AUXSPICNT:[/I]
[I]+ //printf("Hword %08X\r\n", adr); //ichfly[/I]
[I] return MMU.AUX_SPI_CNT;[/I]
 
[I] case REG_POWCNT1: [/I]
[I]@@ -3509,6 +3678,40 @@[/I]
[I] case eng_3D_FOG_TABLE+0x10: case eng_3D_FOG_TABLE+0x12: case eng_3D_FOG_TABLE+0x14: case eng_3D_FOG_TABLE+0x16:[/I]
[I] case eng_3D_FOG_TABLE+0x18: case eng_3D_FOG_TABLE+0x1A: case eng_3D_FOG_TABLE+0x1C: case eng_3D_FOG_TABLE+0x1E:[/I]
[I] return 0;[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I]+ case REG_AUXSPIDATA:[/I]
[I]+ case REG_GCROMCTRL+2 :[/I]
[I]+[/I]
[I]+ case REG_GCROMCTRL :[/I]
[I]+ case REG_GCDATAIN:[/I]
[I]+ case REG_GCCMDOUT: [/I]
[I]+ case REG_ENCSEED0L: [/I]
[I]+ case REG_ENCSEED1L: [/I]
[I]+ case REG_ENCSEED0H: [/I]
[I]+ case REG_ENCSEED1H: [/I]
[I]+ case REG_SPICNT: [/I]
[I]+ case REG_SPIDATA: [/I]
[I]+[/I]
[I]+ case REG_GCDATAIN +2:[/I]
[I]+ case REG_GCCMDOUT +2 : [/I]
[I]+ case REG_ENCSEED0L +2 : [/I]
[I]+ case REG_ENCSEED1L +2: [/I]
[I]+ case REG_ENCSEED0H +2: [/I]
[I]+ case REG_ENCSEED1H +2: [/I]
[I]+[/I]
[I]+ case 0x040001AC :[/I]
[I]+ case 0x040001AD :[/I]
[I]+ case 0x040001AE :[/I]
[I]+ case 0x040001AF :[/I]
[I]+ //printf("Hword %08X\r\n", adr); // //ichfly[/I]
[I]+ {[/I]
[I]+ return T1ReadWord_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]);[/I]
[I]+[/I]
[I]+ }[/I]
[I]+[/I]
[I]+[/I]
[I] }[/I]
 
[I] return T1ReadWord_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]);[/I]
[I]@@ -3586,7 +3789,7 @@[/I]
[I] case eng_3D_CLIPMTX_RESULT+56:[/I]
[I] case eng_3D_CLIPMTX_RESULT+60:[/I]
[I] {[/I]
[I]- //LOG("4000640h..67Fh - CLIPMTX_RESULT - Read Current Clip Coordinates Matrix (R)");[/I]
[I]+ //printf("4000640h..67Fh - CLIPMTX_RESULT - Read Current Clip Coordinates Matrix (R)");[/I]
[I] return gfx3d_GetClipMatrix ((adr-0x04000640)/4);[/I]
[I] }[/I]
[I] case eng_3D_VECMTX_RESULT:[/I]
[I]@@ -3599,7 +3802,7 @@[/I]
[I] case eng_3D_VECMTX_RESULT+28:[/I]
[I] case eng_3D_VECMTX_RESULT+32:[/I]
[I] {[/I]
[I]- //LOG("4000680h..6A3h - VECMTX_RESULT - Read Current Directional Vector Matrix (R)");[/I]
[I]+ //printf("4000680h..6A3h - VECMTX_RESULT - Read Current Directional Vector Matrix (R)");[/I]
[I] return gfx3d_GetDirectionalMatrix ((adr-0x04000680)/4);[/I]
[I] }[/I]
 
[I]@@ -3639,13 +3842,43 @@[/I]
[I] return MMU.timer[ARMCPU_ARM9][(adr&0xF)>>2] | (val<<16);[/I]
[I] } [/I]
 
[I]- case REG_GCDATAIN: return MMU_readFromGC<ARMCPU_ARM9>();[/I]
[I]+ case REG_GCDATAIN:[/I]
[I]+ //printf("word %08X\r\n", adr); //ichfly[/I]
[I]+[/I]
[I]+ return MMU_readFromGC<ARMCPU_ARM9>();[/I]
[I] case REG_POWCNT1: return readreg_POWCNT1(32,adr);[/I]
[I] case REG_DISPA_DISP3DCNT: return readreg_DISP3DCNT(32,adr);[/I]
 
[I] case REG_KEYINPUT:[/I]
[I] LagFrameFlag=0;[/I]
[I] break;[/I]
[I]+[/I]
[I]+[/I]
[I]+ case REG_GCROMCTRL :[/I]
[I]+[/I]
[I]+ //printf("word %08X\r\n", adr); //ichfly[/I]
[I]+[/I]
[I]+[/I]
[I]+ return slot1_device.read32(/*wtf*/ARMCPU_ARM9, REG_GCROMCTRL);[/I]
[I]+[/I]
[I]+ case REG_AUXSPICNT:[/I]
[I]+ case REG_AUXSPIDATA: [/I]
[I]+ case REG_GCCMDOUT: [/I]
[I]+ case REG_ENCSEED0L: [/I]
[I]+ case REG_ENCSEED1L: [/I]
[I]+ case REG_ENCSEED0H: [/I]
[I]+ case REG_ENCSEED1H: [/I]
[I]+ case REG_SPICNT: [/I]
[I]+ case REG_SPIDATA: [/I]
[I]+ case 0x040001AC :[/I]
[I]+ case 0x040001AD :[/I]
[I]+ case 0x040001AE :[/I]
[I]+ case 0x040001AF :[/I]
[I]+ //printf("word %08X\r\n", adr);[/I]
[I]+ return T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]);[/I]
[I]+[/I]
[I]+[/I]
[I]+[/I]
[I] }[/I]
[I] return T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]);[/I]
[I] }[/I]
[I]@@ -3715,7 +3948,7 @@[/I]
[I] break;[/I]
 
[I] case REG_HALTCNT:[/I]
[I]- //printf("halt 0x%02X\n", val);[/I]
[I]+ printf("halt 0x%02X\n", val);[/I]
[I] switch(val)[/I]
[I] {[/I]
[I] case 0xC0: NDS_Sleep(); break;[/I]
[I]@@ -3739,6 +3972,13 @@[/I]
[I] T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_AUXSPIDATA >> 20) & 0xff], REG_AUXSPIDATA & 0xfff, MMU_new.backupDevice.data_command((u8)val,ARMCPU_ARM7));[/I]
[I] MMU.AUX_SPI_CNT &= ~0x80; //remove busy flag[/I]
[I] return;[/I]
[I]+[/I]
[I]+ case REG_I2CDATA:[/I]
[I]+ i2cDatawriteB(val);[/I]
[I]+ return;[/I]
[I]+ case REG_I2CCNT:[/I]
[I]+ i2ccntwriteB(val);[/I]
[I]+ return;[/I]
[I] }[/I]
[I] MMU.MMU_MEM[ARMCPU_ARM7][adr>>20][adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20]]=val;[/I]
[I] return;[/I]
[I]Index: src/NDSSystem.cpp[/I]
[I]===================================================================[/I]
[I]--- src/NDSSystem.cpp (revision 4204)[/I]
[I]+++ src/NDSSystem.cpp (working copy)[/I]
[I]@@ -245,6 +245,8 @@[/I]
 
[I] void debug()[/I]
[I] {[/I]
[I]+ //ievo[/I]
[I]+[/I]
[I] //if(NDS_ARM9.R[15]==0x020520DC) emu_halt();[/I]
[I] //DSLinux[/I]
[I] //if(NDS_ARM9.CPSR.bits.mode == 0) emu_halt();[/I]
[I]@@ -1869,6 +1871,7 @@[/I]
[I] {[/I]
[I] arm9log();[/I]
[I] debug();[/I]
[I]+ //if(NDS_ARM9.R[15]==0x20130D0)NDS_debug_break();[/I]
[I] arm9 += armcpu_exec<ARMCPU_ARM9>();[/I]
[I] #ifdef DEVELOPER[/I]
[I] nds_debug_continuing[0] = false;[/I]
[I]Index: src/registers.h[/I]
[I]===================================================================[/I]
[I]--- src/registers.h (revision 4204)[/I]
[I]+++ src/registers.h (working copy)[/I]
[I]@@ -350,7 +350,10 @@[/I]
 
[I] //DSI[/I]
[I] #define REG_DSIMODE 0x04004000[/I]
[I]+#define REG_I2CDATA 0x04004500[/I]
[I]+#define REG_I2CCNT 0x04004501[/I]
 
[I]+[/I]
[I] #define IPCFIFOCNT_SENDEMPTY 0x0001[/I]
[I] #define IPCFIFOCNT_SENDFULL 0x0002[/I]
[I] #define IPCFIFOCNT_SENDIRQEN 0x0004[/I]
[I]Index: src/utils/decrypt/decrypt.cpp[/I]
[I]===================================================================[/I]
[I]--- src/utils/decrypt/decrypt.cpp (revision 4204)[/I]
[I]+++ src/utils/decrypt/decrypt.cpp (working copy)[/I]
[I]@@ -434,7 +434,7 @@[/I]
[I] if (p[0] != MAGIC30 || p[1] != MAGIC34)[/I]
[I] {[/I]
[I] fprintf(stderr, "Decryption failed!\n");[/I]
[I]- exit(1);[/I]
[I]+ //exit(1); //ichfly[/I]
[I] }[/I]
 
[I] *p++ = 0xE7FFDEFF;[/I]
[I]Index: src/utils/emufat.cpp[/I]
[I]===================================================================[/I]
[I]--- src/utils/emufat.cpp (revision 4204)[/I]
[I]+++ src/utils/emufat.cpp (working copy)[/I]
[I]@@ -17,11 +17,11 @@[/I]
[I] //based on Arduino SdFat Library ( http://code.google.com/p/sdfatlib/ )[/I]
[I] //Copyright (C) 2009 by William Greiman[/I]
 
[I]-//based on mkdosfs - utility to create FAT/MS-DOS filesystems[/I]
[I]-//Copyright (C) 1991 Linus Torvalds <[email protected]>[/I]
[I]-//Copyright (C) 1992-1993 Remy Card <[email protected]>[/I]
[I]-//Copyright (C) 1993-1994 David Hudson <[email protected]>[/I]
[I]-//Copyright (C) 1998 H. Peter Anvin <[email protected]>[/I]
[I]+//based on mkdosfs - utility to create FAT/MS-DOS filesystems[/I]
[I]+//Copyright (C) 1991 Linus Torvalds <[email protected]>[/I]
[I]+//Copyright (C) 1992-1993 Remy Card <[email protected]>[/I]
[I]+//Copyright (C) 1993-1994 David Hudson <[email protected]>[/I]
[I]+//Copyright (C) 1998 H. Peter Anvin <[email protected]>[/I]
[I] //Copyright (C) 1998-2005 Roman Hodek <[email protected]>[/I]
 
[I] #include "emufat.h"[/I]
[I]Index: src/utils/libfat/libfat_public_api.cpp[/I]
[I]===================================================================[/I]
[I]--- src/utils/libfat/libfat_public_api.cpp (revision 4204)[/I]
[I]+++ src/utils/libfat/libfat_public_api.cpp (working copy)[/I]
[I]@@ -18,55 +18,55 @@[/I]
[I] Instance sInstance;[/I]
[I] Instance* gInstance = NULL;[/I]
 
[I]-bool MEDIUM_STARTUP(void)[/I]
[I]-{[/I]
[I]- return true;[/I]
[I]-}[/I]
[I]-bool MEDIUM_ISINSERTED(void)[/I]
[I]-{[/I]
[I]- return true;[/I]
[I]-}[/I]
[I]-bool MEDIUM_io(bool write, sec_t sector, sec_t numSectors, void* buffer)[/I]
[I]-{[/I]
[I]- int todo = (int)numSectors*512;[/I]
[I]- int loc = (int)sector*512;[/I]
[I]- int have = gInstance->size_bytes - loc;[/I]
[I]- if(todo>have) [/I]
[I]- return false;[/I]
[I]- if(write)[/I]
[I]- memcpy((u8*)gInstance->buffer + loc,buffer,todo);[/I]
[I]- else[/I]
[I]- memcpy(buffer,(u8*)gInstance->buffer + loc,todo);[/I]
[I]- return true;[/I]
[I]-}[/I]
[I]-[/I]
[I]-bool MEDIUM_READSECTORS(sec_t sector, sec_t numSectors, void* buffer)[/I]
[I]-{[/I]
[I]- return MEDIUM_io(false,sector,numSectors,buffer);[/I]
[I]-}[/I]
[I]-bool MEDIUM_WRITESECTORS(sec_t sector, sec_t numSectors, const void* buffer)[/I]
[I]-{[/I]
[I]- return MEDIUM_io(true,sector,numSectors,(void*)buffer);[/I]
[I]-}[/I]
[I]-bool MEDIUM_CLEARSTATUS(void)[/I]
[I]-{[/I]
[I]- return true;[/I]
[I]-}[/I]
[I]+bool MEDIUM_STARTUP(void)[/I]
[I]+{[/I]
[I]+ return true;[/I]
[I]+}[/I]
[I]+bool MEDIUM_ISINSERTED(void)[/I]
[I]+{[/I]
[I]+ return true;[/I]
[I]+}[/I]
[I]+bool MEDIUM_io(bool write, sec_t sector, sec_t numSectors, void* buffer)[/I]
[I]+{[/I]
[I]+ int todo = (int)numSectors*512;[/I]
[I]+ int loc = (int)sector*512;[/I]
[I]+ int have = gInstance->size_bytes - loc;[/I]
[I]+ if(todo>have) [/I]
[I]+ return false;[/I]
[I]+ if(write)[/I]
[I]+ memcpy((u8*)gInstance->buffer + loc,buffer,todo);[/I]
[I]+ else[/I]
[I]+ memcpy(buffer,(u8*)gInstance->buffer + loc,todo);[/I]
[I]+ return true;[/I]
[I]+}[/I]
[I]+[/I]
[I]+bool MEDIUM_READSECTORS(sec_t sector, sec_t numSectors, void* buffer)[/I]
[I]+{[/I]
[I]+ return MEDIUM_io(false,sector,numSectors,buffer);[/I]
[I]+}[/I]
[I]+bool MEDIUM_WRITESECTORS(sec_t sector, sec_t numSectors, const void* buffer)[/I]
[I]+{[/I]
[I]+ return MEDIUM_io(true,sector,numSectors,(void*)buffer);[/I]
[I]+}[/I]
[I]+bool MEDIUM_CLEARSTATUS(void)[/I]
[I]+{[/I]
[I]+ return true;[/I]
[I]+}[/I]
[I] bool MEDIUM_SHUTDOWN(void)[/I]
[I] {[/I]
[I] return true;[/I]
[I] }[/I]
 
[I]-DISC_INTERFACE_STRUCT discio = {[/I]
[I]- 0, //unsigned long ioType ;[/I]
[I]- FEATURE_MEDIUM_CANWRITE | FEATURE_MEDIUM_CANREAD, //unsigned long features ;[/I]
[I]- MEDIUM_STARTUP, // FN_MEDIUM_STARTUP startup ;[/I]
[I]- MEDIUM_ISINSERTED, //FN_MEDIUM_ISINSERTED isInserted ;[/I]
[I]- MEDIUM_READSECTORS, //FN_MEDIUM_READSECTORS readSectors ;[/I]
[I]- MEDIUM_WRITESECTORS, //FN_MEDIUM_WRITESECTORS writeSectors ;[/I]
[I]- MEDIUM_CLEARSTATUS, //FN_MEDIUM_CLEARSTATUS clearStatus ;[/I]
[I]- MEDIUM_SHUTDOWN, //FN_MEDIUM_SHUTDOWN shutdown ;[/I]
[I]-} ;[/I]
[I]+DISC_INTERFACE_STRUCT discio = {[/I]
[I]+ 0, //unsigned long ioType ;[/I]
[I]+ FEATURE_MEDIUM_CANWRITE | FEATURE_MEDIUM_CANREAD, //unsigned long features ;[/I]
[I]+ MEDIUM_STARTUP, // FN_MEDIUM_STARTUP startup ;[/I]
[I]+ MEDIUM_ISINSERTED, //FN_MEDIUM_ISINSERTED isInserted ;[/I]
[I]+ MEDIUM_READSECTORS, //FN_MEDIUM_READSECTORS readSectors ;[/I]
[I]+ MEDIUM_WRITESECTORS, //FN_MEDIUM_WRITESECTORS writeSectors ;[/I]
[I]+ MEDIUM_CLEARSTATUS, //FN_MEDIUM_CLEARSTATUS clearStatus ;[/I]
[I]+ MEDIUM_SHUTDOWN, //FN_MEDIUM_SHUTDOWN shutdown ;[/I]
[I]+} ;[/I]
 
 
[I] //not declared in any libfat headers...?[/I]
[I]Index: src/utils/tinyxml/tinyxml.h[/I]
[I]===================================================================[/I]
[I]--- src/utils/tinyxml/tinyxml.h (revision 4204)[/I]
[I]+++ src/utils/tinyxml/tinyxml.h (working copy)[/I]
[I]@@ -39,9 +39,9 @@[/I]
[I] #include <assert.h>[/I]
 
[I] // Help out windows:[/I]
[I]-#if defined( _DEBUG ) && !defined( DEBUG )[/I]
[I]+//#if defined( _DEBUG ) && !defined( DEBUG ) //ichfly [/I]
[I] #define DEBUG[/I]
[I]-#endif[/I]
[I]+//#endif[/I]
 
[I] #ifdef TIXML_USE_STL[/I]
[I] #include <string>[/I]
[I]Index: src/windows/DeSmuME_2008.vcproj[/I]
[I]===================================================================[/I]
[I]--- src/windows/DeSmuME_2008.vcproj (revision 4204)[/I]
[I]+++ src/windows/DeSmuME_2008.vcproj (working copy)[/I]
[I]@@ -1,7 +1,7 @@[/I]
[I] <?xml version="1.0" encoding="Windows-1252"?>[/I]
[I] <VisualStudioProject[/I]
[I] ProjectType="Visual C++"[/I]
[I]- Version="9.00"[/I]
[I]+ Version="9,00"[/I]
[I] Name="DeSmuME_VS2008"[/I]
[I] ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"[/I]
[I] RootNamespace="DeSmuME"[/I]
[I]@@ -779,6 +779,10 @@[/I]
[I] >[/I]
[I] </File>[/I]
[I] <File[/I]
[I]+ RelativePath=".\i2c.cpp"[/I]
[I]+ >[/I]
[I]+ </File>[/I]
[I]+ <File[/I]
[I] RelativePath="..\instruction_tabdef.inc"[/I]
[I] >[/I]
[I] </File>[/I]
[I]@@ -2201,6 +2205,10 @@[/I]
[I] </Filter>[/I]
[I] </Filter>[/I]
[I] <File[/I]
[I]+ RelativePath=".\i2c.h"[/I]
[I]+ >[/I]
[I]+ </File>[/I]
[I]+ <File[/I]
[I] RelativePath=".\bitmaps\IDB_FRAMEADVANCE.bmp"[/I]
[I] >[/I]
[I] </File>[/I]
[I]Index: src/windows/i2c.cpp[/I]
[I]===================================================================[/I]
[I]--- src/windows/i2c.cpp (revision 0)[/I]
[I]+++ src/windows/i2c.cpp (working copy)[/I]
[I]@@ -0,0 +1,37 @@[/I]
[I]+[/I]
[I]+#include <stdlib.h>[/I]
[I]+#include <string.h>[/I]
[I]+#include <sstream>[/I]
[I]+[/I]
[I]+#include "i2c.h"[/I]
[I]+[/I]
[I]+#include "common.h"[/I]
[I]+#include "debug.h"[/I]
[I]+#include "NDSSystem.h"[/I]
[I]+#include "cp15.h"[/I]
[I]+#include "wifi.h"[/I]
[I]+#include "registers.h"[/I]
[I]+#include "render3D.h"[/I]
[I]+#include "gfx3d.h"[/I]
[I]+#include "rtc.h"[/I]
[I]+#include "mc.h"[/I]
[I]+#include "addons.h"[/I]
[I]+#include "slot1.h"[/I]
[I]+#include "mic.h"[/I]
[I]+#include "movie.h"[/I]
[I]+#include "readwrite.h"[/I]
[I]+#include "MMU_timing.h"[/I]
[I]+[/I]
[I]+int phase = 0;[/I]
[I]+u8 device = 0;[/I]
[I]+[/I]
[I]+void i2cDatawriteB(u8 val) //not right but it works[/I]
[I]+{[/I]
[I]+ if(phase == 0)device = val;[/I]
[I]+ MMU.MMU_MEM[ARMCPU_ARM7][0x04004500>>20][0x04004500&MMU.MMU_MASK[ARMCPU_ARM7][0x04004500>>20]]=val;[/I]
[I]+}[/I]
[I]+void i2ccntwriteB(u8 val)[/I]
[I]+{[/I]
[I]+ if(phase == 0)phase++;[/I]
[I]+ MMU.MMU_MEM[ARMCPU_ARM7][0x04004501>>20][0x04004501&MMU.MMU_MASK[ARMCPU_ARM7][0x04004501>>20]]=((val | 0x10) & ~0x80); //instant ready and and instant SCL hold[/I]
[I]+}[/I]
[I]\ No newline at end of file[/I]
[I]Index: src/windows/i2c.h[/I]
[I]===================================================================[/I]
[I]--- src/windows/i2c.h (revision 0)[/I]
[I]+++ src/windows/i2c.h (working copy)[/I]
[I]@@ -0,0 +1,26 @@[/I]
[I]+[/I]
[I]+#include <stdlib.h>[/I]
[I]+#include <string.h>[/I]
[I]+#include <sstream>[/I]
[I]+[/I]
[I]+[/I]
[I]+#include "common.h"[/I]
[I]+#include "debug.h"[/I]
[I]+#include "NDSSystem.h"[/I]
[I]+#include "cp15.h"[/I]
[I]+#include "wifi.h"[/I]
[I]+#include "registers.h"[/I]
[I]+#include "render3D.h"[/I]
[I]+#include "gfx3d.h"[/I]
[I]+#include "rtc.h"[/I]
[I]+#include "mc.h"[/I]
[I]+#include "addons.h"[/I]
[I]+#include "slot1.h"[/I]
[I]+#include "mic.h"[/I]
[I]+#include "movie.h"[/I]
[I]+#include "readwrite.h"[/I]
[I]+#include "MMU_timing.h"[/I]
[I]+[/I]
[I]+[/I]
[I]+void i2cDatawriteB(u8 val);[/I]
[I]+void i2ccntwriteB(u8 val);[/I]
[I]\ No newline at end of file[/I]
[I]Index: src/windows/userconfig/svnrev.h[/I]
[I]===================================================================[/I]
[I]--- src/windows/userconfig/svnrev.h (revision 0)[/I]
[I]+++ src/windows/userconfig/svnrev.h (working copy)[/I]
[I]@@ -0,0 +1,2 @@[/I]
[I]+#define SVN_REV 4204[/I]
[I]+#define SVN_REV_STR "4204"[/I]
[I]\ No newline at end of file[/I]

ADD: not all informations are found by me
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: Lol