Somone please explain the mechanism for software reset

Discussion in 'NDS - Emulation and Homebrew' started by ethanpet113, Oct 6, 2012.

  1. ethanpet113
    OP

    ethanpet113 Member

    Newcomer
    12
    0
    Sep 13, 2009
    Canada
    Ok, so first off, I am a programmer, I can program in several languages, although libnds and palib are C.

    My question is how does software reset work, it seems to recieve an interrupt, and then jump to an address, which I assume is a hook designed for something different. But how does the function for software reset get put at that location, does the flashcard put it there on load, do flashcards use known loaders that patch this, why is it exactly that said loading mechanism is incapable of patching homebrew on many cards?

    I have an origional model NDS, and an R4, as well as an R4 SDHC v1.43.

    It seems to me that most cards have something named aling the lines of swreset.sys which contains the mechanism for jumping back to the menu, and it gets loaded into the address space for this IRQ.

    It really isn't very well doccumented though, if you have any insight on the matter please post.
     
  2. Janthran

    Janthran Solarian

    Member
    3,777
    1,044
    Sep 17, 2011
    United States
    The Pacific Northwet
    If you have an original NDS then why are you posting in the 3DS section?
     
  3. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,668
    21,697
    Sep 13, 2009
    Poland
    Gaming Grotto
    If you don't have anything to say, don't say anything. Just report the post if you believe it's in the wrong section.

    The mechanism is pretty simple - a part of the menu remains in RAM and with a combination of keys, it can return you to the bootloader.

    http://devkitpro.org...o_Menu_Protocol
     
  4. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,705
    9,003
    Oct 27, 2002
    France
    Engine room, learning
    Maybe just a mistake.
    You could report the error instead of asking like that without helping him. he might take your comment as an attack.
    Topic moved to NDS section. :)

    Welcome on GBAtemp.
    I'm sure you'll find an answer from another developer.

    Edit:
    he posted before me :ph34r:
     
  5. ichichfly

    ichichfly GBAtemp Advanced Fan

    Member
    618
    159
    Sep 23, 2009
    Gambia, The
    actually the irq handler or swi(?) code gets patched and jumps to the region mentioned in the quote. The patch depend on the loader.
     
  6. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,668
    21,697
    Sep 13, 2009
    Poland
    Gaming Grotto
    SWI - Software Interrupt (ARM instruction), IRQ - Interrupt Request. ;)

    Either causes a jump to an earlier part of the memory, It's pretty well-explained on the Homebrew Launcher site, y'know. :P Of course it depends on the loader, but the base mechanism remains the same.
     
  7. ichichfly

    ichichfly GBAtemp Advanced Fan

    Member
    618
    159
    Sep 23, 2009
    Gambia, The
    That was not why I wrote the ? it is more like I don't know a way to hook the swi without having to patch more things.
     
  8. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,668
    21,697
    Sep 13, 2009
    Poland
    Gaming Grotto
    Ah, alrighty then. :)

    Well, I suppose it would be best if we actually ask Normatt or Smith about it, seeing that AKAIO supports both IRQ Hooks and SWI... I never really got into the issue.