commit 4d56de2

zzo38  ·  2023-02-13 18:52:11 +0000 UTC
parent 8855b57
Implement exit codes from uxn programs.
5 files changed,  +19, -9
M main.c
+6, -1
 1@@ -69,7 +69,8 @@
 2   Set default screen width.
 3 
 4 -x
 5-  Enable extension device (only built-in extensions).
 6+  Enable extension device (only built-in extensions). (This feature is
 7+  deprecated; see varvara.doc and the mailing list.)
 8 
 9 -y
10   Enable read-only file system access.
11@@ -152,6 +153,8 @@ are being used, then this number may be set higher than 273.
12 
13 === Extension device ===
14 
15+(This section is deprecated; see varvara.doc and the mailing list.)
16+
17 Device fifteen is the extension device, which is defined as:
18   f0 = vector *
19   f1
20@@ -210,6 +213,8 @@ memory; some might be able to optionally use it.)
21 
22 === Extended file device ===
23 
24+(This section may be deprecated in future.)
25+
26 If the -x switch is used, then the delete and append ports of the file
27 device have a different meaning than usual.
28 
M main.c
+1, -1
1@@ -401,7 +401,7 @@ static void system_out(Device*dev,Uint8 id) {
2       }
3       break;
4     case 14: if(dev->d[14] && use_debug) debug(dev->d[14]); break;
5-    case 15: if(dev->d[15]) exit(0); break;
6+    case 15: if(dev->d[15]) exit(dev->d[15]&0x7F); break;
7   }
8 }
9 
+2, -2
 1@@ -22,7 +22,7 @@
 2 
 3   \\ Address
 4   #ac DEI
 5-  #a3 DEI [, JCN #010f DEO ]@
 6+  #a3 DEI [, JCN #800f DEO ]@
 7   LIT "| EQU [, JCN _error "Expected 20 "| 0a ]@
 8   ,rhex JSR ,rhex JSR #00 STZ2
 9   #0002 #ba DEO2
10@@ -43,7 +43,7 @@
11 
12 @error
13   #0001 SUB2 [@ INC2 LDAk DUP #19 DEO #0a EOR ], JCN
14-  #010f DEO
15+  #810f DEO
16 
17 @rhex1 ( -- number )
18   #ac DEI
+1, -1
1@@ -14,7 +14,7 @@
2   LITr 00
3   [@
4     #ac DEI
5-    #a3 DEI [, JCN #010f DEO ]@
6+    #a3 DEI [, JCN #800f DEO ]@
7     DUP #00 EQU ,end-name JCN
8     DUP #18 DEO
9     STHrk STZ INCr
+9, -4
 1@@ -50,14 +50,19 @@ The colours control the colours of the display, where the high nybble of
 2 each controls the value for colour index 0, and the low nybble of each
 3 controls the value for colour index 3.
 4 
 5-Writing nonzero to the debug port will display some debug info.
 6+Writing nonzero to the debug port will display some debug info or break
 7+into the debugger; the exact meaning is implementation-dependent, but it
 8+is used for debugging functions.
 9 
10-Writing nonzero to the quit port terminates the program.
11+Writing nonzero to the quit port terminates the program; the low seven bits
12+of the number written is the exit code (if exit code is meaningful for the
13+operating system that it is running on) (writing 0x80 exits with code 0
14+which means successful).
15 
16-In previous versions of this specification, port 02 is the data stack
17+(In previous versions of this specification, port 02 is the data stack
18 port and port 03 is the return stack port. The data stack and return stack
19 ports have a different meaning in different implementations, and probably
20-should not be used by most programs.
21+should not be used by most programs.)
22 
23 
24 === Standard I/O ===