helloWorld.pp 705 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. program hello_world;
  2. {$mode objfpc}
  3. uses
  4. ctypes, nds9;
  5. var
  6. frame: integer;
  7. touchXY: touchPosition;
  8. procedure Vblank();
  9. begin
  10. inc(frame);
  11. end;
  12. begin
  13. irqSet(IRQ_VBLANK, @Vblank);
  14. consoleDemoInit();
  15. iprintf(' Hello DS dev''rs'#10);
  16. iprintf(#27'[32m' + 'www.devkitpro.org'#10);
  17. iprintf(#27'[32;1m' + 'www.drunkencoders.com'#27'[39m');
  18. while true do
  19. begin
  20. swiWaitForVBlank();
  21. touchRead(touchXY);
  22. // print at using ansi escape sequence \x1b[line;columnH
  23. iprintf(#27'[10;0H' + 'Frame = %d', frame);
  24. iprintf(#27'[16;0H' + 'Touch x = %04X, %04X'#10, touchXY.rawx, touchXY.px);
  25. iprintf('Touch y = %04X, %04X'#10, touchXY.rawy, touchXY.py);
  26. end;
  27. end.