Quote Originally Posted by 21o6
i have fiddled around a bit with the coordinates.

it's not 100% exact, but it's waay better than only doing div 16 and really
sufficient when used on hardware.

Code:
touchxy.px := (touchxy.px div 14) - 19;
touchxy.py := (touchxy.py div 19) - 10;
this gives me the best result, the X/Y-range goes from 0..251:0..191.

Tested with no$gba and my phat NDS.
Please note that your emulator will probably give slightly different results.

i hope this will get obselete soon

oh and... does anybody actually need this stuff? 100+ views but nobody's posting.
Sorry, but I don't get the clue... This code:

[pascal]Program Touch;
{$APPTYPE ARM9}
{$DEFINE ARM9}
{$MODE OBJFPC}
uses
cTypes;
{$INCLUDE NDS.INC}
var
touchXY: touchPosition;
begin
irqInit();
irqSet(IRQ_VBLANK, nil);
irqEnable(IRQ_VBLANK);
videoSetMode(0);
videoSetModeSub(MODE_0_2D or DISPLAY_BG0_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG);
SUB_BG0_CR^ := BG_MAP_BASE(31);
BG_PALETTE_SUB[255] := RGB15(31,31,31);
consoleInitDefault(pu16(SCREEN_BASE_BLOCK_SUB(31)) , pu16(CHAR_BASE_BLOCK_SUB(0)), 16);
while true do
begin
swiWaitForVBlank();
touchXY := touchReadXY();
iprintf(#27 + '[16;0H' + 'Touch x, px = %04X, %03i' + #10, [touchXY.x, touchXY.px]);
iprintf('Touch y, py = %04X, %03i' + #10, [touchXY.y, touchXY.py]);
end;
end.[/pascal]

gives to me your same results without dividing anything. On DS phat, for px and py I get values in the range 1-252, 1-192 :scratch: