reload.inc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. (*
  2. $Id: reload.inc 25 2007-12-10 21:06:46Z p4p3r0 $
  3. ------------------------------------------------------------------------------
  4. Copyright (C) 2005
  5. Jason Rogers (dovoto)
  6. Dave Murphy (WinterMute)
  7. This software is provided 'as-is', without any express or implied
  8. warranty. In no event will the authors be held liable for any
  9. damages arising from the use of this software.
  10. Permission is granted to anyone to use this software for any
  11. purpose, including commercial applications, and to alter it and
  12. redistribute it freely, subject to the following restrictions:
  13. 1. The origin of this software must not be misrepresented; you
  14. must not claim that you wrote the original software. If you use
  15. this software in a product, an acknowledgment in the product
  16. documentation would be appreciated but is not required.
  17. 2. Altered source versions must be plainly marked as such, and
  18. must not be misrepresented as being the original software.
  19. 3. This notice may not be removed or altered from any source
  20. distribution.
  21. ------------------------------------------------------------------------------
  22. Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
  23. (http://www.freepascal.org)
  24. Copyright (C) 2006 Francesco Lombardi
  25. Check http://sourceforge.net/projects/libndsfpc for updates
  26. ------------------------------------------------------------------------------
  27. $Log$
  28. *)
  29. {$ifdef NDS_INTERFACE}
  30. type
  31. COPYFUNC = function (const value: pcchar): pointer;
  32. QUERYFUNC = function(value: cuint32): pcuint32;
  33. LOADER_DATA = record
  34. VERSION: cuint32; // contains version information about loader
  35. QUERY: QUERYFUNC; // used to retreive extended information from loader
  36. ARM7FUNC: COPYFUNC; // a pointer to the ARM7 load function
  37. ARM9FUNC: COPYFUNC; // a pointer to the ARM9 load function
  38. PATH: pcchar; // THIS VALUE IS SET FOR YOU, DONT TOUCH IT
  39. RESERVED: cuint32; // reserved for future expansion
  40. end;
  41. TLOADER_DATA = LOADER_DATA;
  42. PLOADER_DATA = ^LOADER_DATA;
  43. const
  44. LOADNDS : PLOADER_DATA = pointer($02800000-48);
  45. BOOT_NDS = pcchar(-1);
  46. {$endif NDS_INTERFACE}
  47. (*
  48. dump this near the begining of your ARM7's main function
  49. LOADNDS->PATH = 0;
  50. inside of your ARM7's main loop or VBlank IRQ or what-ever, add this code:
  51. if (LOADNDS->PATH != 0) {
  52. LOADNDS->ARM7FUNC(LOADNDS->PATH);
  53. }
  54. //////////////////////////////////////
  55. in your ARM9 code, to return to the menu, call this function:
  56. WAIT_CR &= ~0x8080;
  57. LOADNDS->ARM9FUNC(BOOT_NDS);
  58. *)