commit 4a1134d
zzo38
·
2023-04-17 04:38:23 +0000 UTC
parent 79a7533
Move most of the nonstandard 0x17 port to the standard implementation. The EOF trigger remains nonstandard.
3 files changed,
+13,
-18
+2,
-9
1@@ -226,13 +226,6 @@ emulator to the program), ? for parameters that may be input and/or output,
2 Nonstandard ports of devices are:
3
4 17
5- Indicates type of input in the low nybble. The high bit is set if it
6- should execute the standard I/O vector for EOF and for the end of
7- command-line arguments (for compatibility, normally it will not do
8- this). The types of input are:
9- 0 = Standard input
10- 1 = EOF (*)
11- 2 = Command-line argument text
12- 3 = Delimiter of command-line arguments
13- 4 = End of command-line arguments (*)
14+ If the high bit is set, then it will trigger on EOF; the value of input
15+ will be zero and the value of this port will be 0x81.
16
M
main.c
+4,
-9
1@@ -1473,18 +1473,13 @@ int main(int argc,char**argv) {
2 ds.p=rs.p=0;
3 run(0x0100);
4 if(device[1].d[0] || device[1].d[1]) for(i=optind+1;i<argc;i++) {
5- if(use_extension) device[1].d[7]=(device[1].d[7]&0xF0)|0x02;
6 for(j=0;argv[i][j];j++) {
7 device[1].d[2]=argv[i][j];
8+ device[1].d[7]=(device[1].d[7]&0x80)|0x02;
9 run(GET16(device[1].d));
10 }
11 device[1].d[2]='\n';
12- if(use_extension) device[1].d[7]=(device[1].d[7]&0xF0)|0x03;
13- run(GET16(device[1].d));
14- }
15- if(use_extension && (device[1].d[7]&0x80)) {
16- device[1].d[2]=0;
17- device[1].d[7]=(device[1].d[7]&0xF0)|0x04;
18+ device[1].d[7]=(device[1].d[7]&0x80)|(i==argc-1?0x04:0x03);
19 run(GET16(device[1].d));
20 }
21 if(use_screen) {
22@@ -1498,14 +1493,14 @@ int main(int argc,char**argv) {
23 } else if(audio_option) {
24 run_audio();
25 } else {
26- if(use_extension) device[1].d[7]&=0xF0;
27+ device[1].d[7]&=0x80;
28 while((device[1].d[0] || device[1].d[1]) && ((i=getchar())>=0)) {
29 device[1].d[2]=i;
30 run(GET16(device[1].d));
31 }
32 if(use_extension && (device[1].d[7]&0x80)) {
33 device[1].d[2]=0;
34- device[1].d[7]=(device[1].d[7]&0xF0)|0x01;
35+ device[1].d[7]=(device[1].d[7]&0x80)|0x01;
36 run(GET16(device[1].d));
37 }
38 }
+7,
-0
1@@ -69,6 +69,7 @@ should not be used by most programs.)
2
3 10 = Vector *
4 12 = Input
5+17 = Type
6 18 = Output
7 19 = Error
8
9@@ -78,6 +79,12 @@ BRK (and before any other events), any command-line arguments are also
10 sent in this way as though each one is a line of input from stdin
11 terminated by a line feed.
12
13+On input, the type port is set to the type of input, where:
14+ 0 = stdin
15+ 2 = command-line argument text
16+ 3 = line break after command-line argument, other than the final one
17+ 4 = line break after the final command-line argument
18+
19 Writing to the output and error ports write a byte to stdout or stderr.
20
21