exceptionTest.pp 657 B

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