nds.inc 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. {
  2. This file is part of the Free Component Library (FCL)
  3. Copyright (c) 1999-2002 by the Free Pascal development team
  4. BIOS functions unit for Nintendo DS
  5. Copyright (c) 2006 by Francesco Lombardi
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *****************************************************************************}
  12. {
  13. NDS CPU detecting function
  14. --------------------------
  15. ARM946E-S processor can handle dsp extensions, but ARM7TDMI does not. FPC can
  16. detect dsp by catching a SIGILL that fires when ARM7 cpu tries to use a dsp
  17. command. Unfortunately, NDS' rtl does not have any error catching mechanism.
  18. This function takes care to check if the code is running on an ARM9 or on an
  19. ARM7 CPU, by checking the IRQ vector address ($0B003FFC for ARM9, 0380fff8
  20. for ARM7), declared in the linker script. This function is cleaner than the
  21. older one, because does not raise any memory writing error.
  22. It works on Nintendo DS only, I guess :)
  23. }
  24. function IsARM9(): boolean;
  25. begin
  26. IsARM9 := integer(@irq_vector) = $0B003FFC;
  27. end;