main pita/uxn12 / etc / ext / xclock.tal
 1( xclock.tal )
 2( )
 3( runs xclock. )
 4( )
 5( on some systems, exiting the ROM will kill the xclock process. )
 6( on others it won't. if the ROM exits via the system device then )
 7( the process will be properly killed. )
 8
 9@Console
10    |10 &vector $2 ( called when input is ready )
11    |12 &read $1 ( read an input byte, e.g. from stdin )
12    ( 13 - 14 padding )
13    |15 &live $1 ( subprocess: 01 alive, ff dead, 00 not running )
14    |15 &exit $1 ( subprocess: exit code if dead )
15    |17 &type $1 ( input type: 01 stdin, 02 arg, 03 end of arg, 04 end of args )
16    |18 &write $1 ( byte to write to stdout )
17    |19 &error $1 ( byte to write to stderr )
18    ( 1a - 1b padding )
19    |1c &addr $2 ( subprocess: addr of string to run with /bin/sh -c )
20    |1e &mode $1 ( mode bits: 01 write stdin, 02 read stdout, 04 read stderr, 08 kill only )
21    |1f &exec $1 ( subprocess: run command )
22
23|0100
24    ;cmd .Console/addr DEO2
25    #00 .Console/mode DEO
26    #01 .Console/exec DEO
27    BRK
28
29@cmd "xclock 00