exceptionTest.pp 664 B

12345678910111213141516171819202122232425
  1. program main;
  2. {$apptype arm9}
  3. {$mode objfpc}
  4. uses
  5. ctypes, nds9;
  6. // The default exception handler displays the exception type - data abort or undefined instruction
  7. // you can relate the exception to your code using arm-eabi-addr2line -e <elf file> <address>
  8. // assuming you built with debug info this will display a source file and a line number
  9. // The address of the instruction is shown as pc, beside the address which faulted
  10. // the rest of the screen is a dump of the registers.
  11. begin
  12. // install the default exception handler
  13. defaultExceptionHandler();
  14. // generate an exception
  15. pu32(250)^ := 100;
  16. while true do
  17. swiWaitForVBlank();
  18. end.