The way I handle this is, in initialization,
TM_NEW=0When reading the touchscreen
TM_OLD=TM_NEW TOUCH OUT TM_NEW,TX,TYTo see if the touch has just occurred,
IF (TM_NEW && !TM_OLD)This allows the main loop to keep looping while the stylus is held down, unlike the solution you show. It also has the bonus that if ever you want to do something for the moment the stylus is lifted from the touchscreen, you can use
IF (!TM_NEW && TM_OLD)