commit 6a0f816

zzo38  ·  2023-04-17 18:59:22 +0000 UTC
parent 4a1134d
Update the use of the type port with the changes made to the official version.
3 files changed,  +10, -5
M main.c
+3, -2
 1@@ -226,6 +226,7 @@ emulator to the program), ? for parameters that may be input and/or output,
 2 Nonstandard ports of devices are:
 3 
 4 17
 5-  If the high bit is set, then it will trigger on EOF; the value of input
 6-  will be zero and the value of this port will be 0x81.
 7+  If the high bit is set (by the uxn program), then it will trigger on
 8+  EOF; the value of input will be zero and the value of this port will
 9+  be 0x80. (The high bit will be preserved by the emulator.)
10 
M main.c
+3, -2
 1@@ -1471,6 +1471,7 @@ int main(int argc,char**argv) {
 2   restart:
 3   size_changed=1;
 4   ds.p=rs.p=0;
 5+  device[1].d[7]=(optind+1==argc)?0:1;
 6   run(0x0100);
 7   if(device[1].d[0] || device[1].d[1]) for(i=optind+1;i<argc;i++) {
 8     for(j=0;argv[i][j];j++) {
 9@@ -1493,14 +1494,14 @@ int main(int argc,char**argv) {
10   } else if(audio_option) {
11     run_audio();
12   } else {
13-    device[1].d[7]&=0x80;
14+    device[1].d[7]=(device[1].d[7]&0x80)|0x01;
15     while((device[1].d[0] || device[1].d[1]) && ((i=getchar())>=0)) {
16       device[1].d[2]=i;
17       run(GET16(device[1].d));
18     }
19     if(use_extension && (device[1].d[7]&0x80)) {
20       device[1].d[2]=0;
21-      device[1].d[7]=(device[1].d[7]&0x80)|0x01;
22+      device[1].d[7]=(device[1].d[7]&0x80)|0x00;
23       run(GET16(device[1].d));
24     }
25   }
+4, -1
 1@@ -80,11 +80,14 @@ sent in this way as though each one is a line of input from stdin
 2 terminated by a line feed.
 3 
 4 On input, the type port is set to the type of input, where:
 5-  0 = stdin
 6+  1 = stdin
 7   2 = command-line argument text
 8   3 = line break after command-line argument, other than the final one
 9   4 = line break after the final command-line argument
10 
11+During the startup (call to 0x0100), the type port will be 1 if there are
12+any command-line arguments and 0 if there are no arguments.
13+
14 Writing to the output and error ports write a byte to stdout or stderr.
15 
16