diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2007-09-23 12:48:46 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2007-09-23 12:48:46 +0000 |
commit | d2e53c6719dff0f9d67c40cea76515508559a4ef (patch) | |
tree | ec3b5b402ac9cd46ab88926b66fe5802f5a16cbb /emulators | |
parent | bd519e53d3a3998dec48a0b3b03710dc3b0a0d27 (diff) | |
download | ports-d2e53c6719dff0f9d67c40cea76515508559a4ef.tar.gz ports-d2e53c6719dff0f9d67c40cea76515508559a4ef.zip |
Notes
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/doscmd/Makefile | 2 | ||||
-rw-r--r-- | emulators/doscmd/files/patch-bioscursor | 114 | ||||
-rw-r--r-- | emulators/doscmd/files/patch-desqview-timeslice | 36 | ||||
-rw-r--r-- | emulators/doscmd/files/patch-doscmd.1 | 36 | ||||
-rw-r--r-- | emulators/doscmd/files/patch-fossil-support | 409 | ||||
-rw-r--r-- | emulators/doscmd/files/patch-quietmode | 317 |
6 files changed, 910 insertions, 4 deletions
diff --git a/emulators/doscmd/Makefile b/emulators/doscmd/Makefile index e253008a8177..80480ba61464 100644 --- a/emulators/doscmd/Makefile +++ b/emulators/doscmd/Makefile @@ -7,7 +7,7 @@ PORTNAME= doscmd PORTVERSION= 20040330 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= emulators MASTER_SITES= ${MASTER_SITE_LOCAL} MASTER_SITE_SUBDIR= des diff --git a/emulators/doscmd/files/patch-bioscursor b/emulators/doscmd/files/patch-bioscursor new file mode 100644 index 000000000000..1edff89efdc9 --- /dev/null +++ b/emulators/doscmd/files/patch-bioscursor @@ -0,0 +1,114 @@ +--- /usr/ports/emulators/doscmd/work/doscmd-20040330/tty.c Mon May 1 18:38:07 2006 ++++ tty.c Mon May 1 18:38:51 2006 +@@ -125,6 +125,7 @@ + #define row (CursRow0) + #define col (CursCol0) + ++ + /* Local functions */ + static void _kbd_event(int, int, void *, regcontext_t *); + static void Failure(void *); +@@ -1427,7 +1428,9 @@ + tty_move(int r, int c) + { + row = r; ++ BIOS_CursRow0 = r; + col = c; ++ BIOS_CursCol0 = c; + SetVREGCur(); + } + +@@ -1459,6 +1462,7 @@ + vmem[(height - 1) * width + i] = vattr | ' '; + } + } ++ BIOS_CursRow0 = row; /* Sync back with row */ + SetVREGCur(); + } + +@@ -1489,21 +1493,27 @@ + case 0x08: + if (row > (height - 1) || col > width) + break; +- if (col > 0) ++ if (col > 0) { + --col; ++ BIOS_CursCol0 = col; ++ } + vmem[row * width + col] &= 0xff00; + break; + case '\t': +- if (row > (height - 1)) ++ if (row > (height - 1)) { + row = 0; ++ BIOS_CursRow0 = 0; ++ } + col = (col + 8) & ~0x07; + if (col > width) { + col = 0; + tty_index(1); + } ++ BIOS_CursCol0 = col; + break; + case '\r': + col = 0; ++ BIOS_CursCol0 = col; + break; + case '\n': + tty_index(1); +@@ -1511,10 +1521,13 @@ + default: + if (col >= width) { + col = 0; ++ BIOS_CursCol0 = 0; + tty_index(1); + } +- if (row > (height - 1)) ++ if (row > (height - 1)) { + row = 0; ++ BIOS_CursRow0 = 0; ++ } + if (attr >= 0) + vmem[row * width + col] = attr & 0xff00; + else +@@ -1554,7 +1567,9 @@ + vmem[row * width + col++] |= c; + } + row = srow; ++ BIOS_CursRow0 = srow; + col = scol; ++ BIOS_CursCol0 = scol; + SetVREGCur(); + } + +@@ -1582,7 +1597,9 @@ + col++; + } + row = srow; ++ BIOS_CursRow0 = srow; + col = scol; ++ BIOS_CursCol0 = scol; + SetVREGCur(); + + return; +--- /home/admin/doscmd-20040330/video.c Mon May 1 17:41:16 2006 ++++ video.c Mon May 1 18:08:12 2006 +@@ -167,14 +167,18 @@ + cp &= 0xff; + cp |= value << 8; + row = cp / DpyCols; ++ BIOS_CursRow0 = row; + col = cp % DpyCols; ++ BIOS_CursCol0 = col; + break; + case CRTC_CurLocLo: /* Update cursor position in BIOS */ + cp = row * DpyCols + col; + cp &= 0xff00; + cp |= value; + row = cp / DpyCols; ++ BIOS_CursRow0 = row; + col = cp % DpyCols; ++ BIOS_CursCol0 = col; + break; + default: + debug(D_VIDEO, "VGA: outb 0x%04x, 0x%02x at index 0x%02x\n", diff --git a/emulators/doscmd/files/patch-desqview-timeslice b/emulators/doscmd/files/patch-desqview-timeslice new file mode 100644 index 000000000000..0e5c085f5f60 --- /dev/null +++ b/emulators/doscmd/files/patch-desqview-timeslice @@ -0,0 +1,36 @@ +--- /usr/ports/emulators/doscmd/work/doscmd-20040330/bios.c Mon Mar 29 16:00:00 2004 ++++ bios.c Mon May 1 18:39:31 2006 +@@ -31,6 +31,7 @@ + */ + + #include <sys/cdefs.h> ++#include <time.h> + __FBSDID("$FreeBSD: projects/doscmd/bios.c,v 1.9 2002/03/07 12:52:26 obrien Exp $"); + + #include "doscmd.h" +@@ -110,6 +111,7 @@ + static void + int15(regcontext_t *REGS) + { ++ const struct timespec rqtp={0,1}; + R_FLAGS &= ~PSL_C; + + switch (R_AH) { +@@ -119,6 +121,17 @@ + break; + case 0x04: /* Set ABIOS table */ + R_FLAGS |= PSL_C; /* We don't support it */ ++ break; ++ case 0x10: /* DesqView */ ++ switch (R_AL) { ++ case 0x00: /* Give up CPU time */ ++ nanosleep(&rqtp, NULL); ++ break; ++ case 0x22: /* Get version */ ++ R_BH = 0x0a; /* Use v2.0 for timeslice support */ ++ R_BL = 0x01; ++ break; ++ } + break; + case 0x4f: /* Keyboard intercept */ + debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n"); diff --git a/emulators/doscmd/files/patch-doscmd.1 b/emulators/doscmd/files/patch-doscmd.1 index 12b8950a8e7c..84037ae20d20 100644 --- a/emulators/doscmd/files/patch-doscmd.1 +++ b/emulators/doscmd/files/patch-doscmd.1 @@ -1,6 +1,36 @@ ---- doscmd.1.orig Sun Dec 4 11:02:22 2005 -+++ doscmd.1 Sun Dec 4 11:03:13 2005 -@@ -754,7 +754,7 @@ +--- doscmd.1.orig Tue Mar 30 08:00:00 2004 ++++ doscmd.1 Sun Sep 23 22:46:19 2007 +@@ -38,7 +38,7 @@ + .Nd run a subset of real-mode DOS programs + .Sh SYNOPSIS + .Nm +-.Fl 23AbDEfGHIMOPRrtVvXxYz ++.Fl 23AbDEFfGHIMOPQRrtVvXxYz + .Fl c Ar file + .Fl d Ar file + .Fl i Ar port Ns Xo +@@ -139,6 +139,9 @@ + .\" + .\" + .\" ++.It Fl F ++Enables support for FOSSIL IO using stdio. ++.\" + .It Fl G + Enable debugging of the video (graphics) routines. + .\" +@@ -212,6 +215,10 @@ + .Li outb , + etc). + .\" ++.It Fl Q ++Suppresses all video IO. Helps optimize the input behavior especially ++when polling for input. ++.\" + .\" + .\" + .It Fl R +@@ -754,7 +761,7 @@ and then typing .Ic make install in the source directory (normally diff --git a/emulators/doscmd/files/patch-fossil-support b/emulators/doscmd/files/patch-fossil-support new file mode 100644 index 000000000000..b35b13e56044 --- /dev/null +++ b/emulators/doscmd/files/patch-fossil-support @@ -0,0 +1,409 @@ +diff -u /root/doscmd-20040330/bios.c ./bios.c +--- /root/doscmd-20040330/bios.c Fri May 5 19:34:31 2006 ++++ ./bios.c Fri May 5 19:39:27 2006 +@@ -297,7 +297,10 @@ + ivec[0x12] = vec; + register_callback(vec, int12, "int 12"); + +- vec = insert_softint_trampoline(); ++ if(fossil) ++ vec = insert_fossil_softint_trampoline(); ++ else ++ vec = insert_softint_trampoline(); + ivec[0x14] = vec; + register_callback(vec, int14, "int 14"); + +diff -u /root/doscmd-20040330/callback.c ./callback.c +--- /root/doscmd-20040330/callback.c Fri May 5 19:34:31 2006 ++++ ./callback.c Fri May 5 19:39:27 2006 +@@ -76,6 +76,25 @@ + 2, + 0, + }; ++/* ++ * From the FOSSIL spec: ++ * The driver has a "signature" that can be used to determine whether it is ++ * present in memory. At offset 6 in the INT 14h service routine is a word, ++ * 1954h, followed by a byte that specifies the maximum function number ++ * supported by the driver. This is to make it possible to determine when a ++ * driver is present and what level of functionality it provides. ++ */ ++u_char fossil_softint_trampoline[] = { ++ 0xf4, /* HLT */ ++ 0xfb, /* STI */ ++ 0xca, /* RETF 2 */ ++ 2, ++ 0, ++ 0, ++ 0x54, ++ 0x19, ++ 0x1b, /* Max. Supported FOSSIL AH */ ++}; + u_char hardint_trampoline[] = { + 0xf4, /* HLT */ + 0xcf, /* IRET */ +@@ -102,6 +121,13 @@ + { + return (insert_generic_trampoline( + sizeof(softint_trampoline), softint_trampoline)); ++} ++ ++u_long ++insert_fossil_softint_trampoline(void) ++{ ++ return (insert_generic_trampoline( ++ sizeof(fossil_softint_trampoline), fossil_softint_trampoline)); + } + + u_long +diff -u /root/doscmd-20040330/callback.h ./callback.h +--- /root/doscmd-20040330/callback.h Fri May 5 19:34:31 2006 ++++ ./callback.h Fri May 5 19:39:27 2006 +@@ -9,5 +9,6 @@ + callback_t find_callback(u_long); + u_long insert_generic_trampoline(size_t, u_char *); + u_long insert_softint_trampoline(void); ++u_long insert_fossil_softint_trampoline(void); + u_long insert_hardint_trampoline(void); + u_long insert_null_trampoline(void); +diff -u /root/doscmd-20040330/doscmd.c ./doscmd.c +--- /root/doscmd-20040330/doscmd.c Fri May 5 19:34:31 2006 ++++ ./doscmd.c Fri May 5 19:39:27 2006 +@@ -511,7 +511,7 @@ + FILE *fp; + char *col; + +- while ((c = getopt(argc, argv, "234AbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) { ++ while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) { + switch (c) { + case '2': + debug_flags |= D_TRAPS2; +@@ -551,6 +551,9 @@ + break; + case 'E': + debug_flags |= D_EXEC; ++ break; ++ case 'F': ++ fossil = 1; + break; + case 'G': + debug_flags |= D_VIDEO; +diff -u /root/doscmd-20040330/doscmd.h ./doscmd.h +--- /root/doscmd-20040330/doscmd.h Fri May 5 19:34:31 2006 ++++ ./doscmd.h Fri May 5 19:39:27 2006 +@@ -224,6 +224,9 @@ + extern int search_floppy(int i); + extern void disk_bios_init(void); + ++/* int14.c */ ++extern int fossil; ++ + /* int16.c */ + void int16(regcontext_t *); + +diff -u /root/doscmd-20040330/int14.c ./int14.c +--- /root/doscmd-20040330/int14.c Fri May 5 19:34:31 2006 ++++ ./int14.c Fri May 5 20:23:09 2006 +@@ -46,6 +46,9 @@ + #include "AsyncIO.h" + #include "com.h" + ++/* exports */ ++int fossil = 0; ++ + #define N_BYTES 1024 + + struct com_data_struct { +@@ -58,7 +61,9 @@ + int ids; /* input data size */ + int ods; /* output data size */ + int emptyint; ++ int fossil_mode; /* FOSSIL has been enabled */ + struct termios tty; ++ unsigned char param; /* Copy of init params */ + unsigned char div_latch[2]; /* mirror of 16550 R0':R1' + read/write */ + unsigned char int_enable; /* mirror of 16550 R1 read/write */ +@@ -257,7 +262,7 @@ + struct com_data_struct *cdsp; + int i; + +- debug(D_PORT, "int14: dl = 0x%02X, al = 0x%02X.\n", R_DL, R_AL); ++ debug(D_PORT, "int14: ah = 0x%02X, dl = 0x%02X, al = 0x%02X.\n", R_AH, R_DL, R_AL); + if (R_DL >= N_COMS_MAX) { + if (vflag) + dump_regs(REGS); +@@ -269,16 +274,31 @@ + case 0x00: /* Initialize Serial Port */ + com_set_line(cdsp, R_DL + 1, R_AL); + R_AH = get_status(cdsp); +- R_AL = 0; ++ if (cdsp->fossil_mode) { ++ R_AL = 0x08; ++ R_AL |= 0x80; ++ } ++ else ++ R_AL = 0; + break; + + case 0x01: /* Write Character */ + if (write_char(cdsp, R_AL)) { +- R_AH = get_status(cdsp); ++ R_AH = get_status(cdsp); ++ if (cdsp->fossil_mode) { ++ R_AL = 0x08; ++ R_AL |= 0x80; ++ } ++ else + R_AL = 0; + } else { +- debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL); +- R_AH = LS_SW_TIME_OUT; ++ debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL); ++ R_AH = LS_SW_TIME_OUT; ++ if (cdsp->fossil_mode) { ++ R_AL = 0x08; ++ R_AL |= 0x80; ++ } ++ else + R_AL = 0; + } + break; +@@ -296,28 +316,193 @@ + + case 0x03: /* Status Request */ + R_AH = get_status(cdsp); +- R_AL = 0; ++ if (cdsp->fossil_mode) { ++ R_AL = 0x08; ++ R_AL |= 0x80; ++ } ++ else ++ R_AL = 0; + break; + + case 0x04: /* Extended Initialization */ +- R_AX = (LS_SW_TIME_OUT) << 8; ++ if (fossil) { ++ cdsp->fossil_mode = 1; ++ R_AX = 0x1954; ++ R_BL = 0x1b; /* Max supported FOSSIL AH */ ++ R_BH = 5; ++ } ++ else ++ R_AX = (LS_SW_TIME_OUT) << 8; + break; + +- case 0x05: /* Modem Control Register operations */ +- switch (R_AH) { +- case 0x00: /* Read Modem Control Register */ ++ case 0x05: /* Modem Control Register operations/FOSSIL deinit */ ++ if (fossil && cdsp->fossil_mode) ++ cdsp->fossil_mode = 0; ++ else { ++ switch (R_AH) { ++ case 0x00: /* Read Modem Control Register */ + R_AX = (LS_SW_TIME_OUT) << 8; + break; + +- case 0x01: /* Write Modem Control Register */ ++ case 0x01: /* Write Modem Control Register */ + R_AX = (LS_SW_TIME_OUT) << 8; + break; + +- default: ++ default: + unknown_int3(0x14, 0x05, R_AL, REGS); + break; ++ } + } + break; ++ ++ case 0x06: /* FOSSIL raise/lower DTR */ ++ if(cdsp->fossil_mode) { ++ switch (R_AL) { ++ case 0: ++ ioctl(cdsp->fd, TIOCCDTR); ++ break; ++ case 1: ++ ioctl(cdsp->fd, TIOCSDTR); ++ break; ++ } ++ break; ++ } ++ ++ case 0x08: /* FOSSIL Flush output buffer */ ++ if(cdsp->fossil_mode) { ++ flush_out(cdsp); ++ break; ++ } ++ ++ case 0x09: /* FOSSIL Purge output buffer */ ++ if(cdsp->fossil_mode) { ++ cdsp->ods = 0; ++ break; ++ } ++ ++ case 0x0a: /* FOSSIL Purge input buffer */ ++ if(cdsp->fossil_mode) { ++ cdsp->ids = 0; ++ break; ++ } ++ ++ case 0x0b: /* FOSSIL Transmit no wait */ ++ if(cdsp->fossil_mode) { ++ if (cdsp->ods < N_BYTES) { ++ if (write_char(cdsp, R_AL)) ++ R_AX = 1; ++ else ++ R_AX = 0; ++ } ++ else ++ R_AX = 0; ++ break; ++ } ++ ++ case 0x0c: /* FOSSIL Non-destructive read-ahead */ ++ if(cdsp->fossil_mode) { ++ if(cdsp->ods) { ++ R_AH = 0; ++ R_AL = cdsp->inbuf[0]; ++ } else ++ R_AX = 0xffff; ++ break; ++ } ++ ++ case 0x0f: /* FOSSIL Set flow control */ ++ if(cdsp->fossil_mode) { ++ if(R_AL & 0x01) /* Enable output Xon/Xoff */ ++ cdsp->tty.c_iflag |= IXON; ++ else ++ cdsp->tty.c_iflag &= ~(IXON); ++ ++ if(R_AL & 0x02) /* Enable CTR/RTS */ ++ cdsp->tty.c_cflag |= CCTS_OFLOW|CRTS_IFLOW; ++ else ++ cdsp->tty.c_iflag &= ~(CCTS_OFLOW|CRTS_IFLOW); ++ ++ if(R_AL & 0x08) /* Enable input Xon/Xoff */ ++ cdsp->tty.c_iflag |= IXOFF; ++ else ++ cdsp->tty.c_iflag &= ~(IXOFF); ++ ++ tcsetattr(cdsp->fd, 0, &cdsp->tty); ++ break; ++ } ++ ++ case 0x18: /* FOSSIL Read block */ ++ if(cdsp->fossil_mode) { ++ int rd = R_CX; ++ ++ input(cdsp, 0); ++ if(rd > cdsp->ids) ++ rd=cdsp->ids; ++ if(rd) { ++ memmove((char *)MAKEPTR(R_ES, R_DI), cdsp->inbuf, rd); ++ if(rd < cdsp->ids) ++ memmove(cdsp->inbuf, cdsp->inbuf + rd, N_BYTES - rd); ++ cdsp->ids -= rd; ++ R_AX = rd; ++ } else ++ R_AX = 0; ++ break; ++ } ++ ++ case 0x19: /* FOSSIL Write block */ ++ if(cdsp->fossil_mode) { ++ int wr = R_CX; ++ if(wr > N_BYTES - cdsp->ods) ++ wr=N_BYTES - cdsp->ods; ++ if(wr) { ++ memcpy(cdsp->outbuf + cdsp->ods, (char *)MAKEPTR(R_ES, R_DI), wr); ++ cdsp->ods += wr; ++ output(cdsp); ++ R_AX = wr; ++ } else ++ R_AX = 0; ++ break; ++ } ++ ++ case 0x1a: /* FOSSIL Break begin/end */ ++ if(cdsp->fossil_mode) { ++ switch(R_AL) { ++ case 0: ++ ioctl(cdsp->fd, TIOCCBRK); ++ break; ++ case 1: ++ ioctl(cdsp->fd, TIOCSBRK); ++ break; ++ } ++ break; ++ } ++ ++ case 0x1b: /* FOSSIL Driver information */ ++ if(cdsp->fossil_mode) { ++ unsigned char *p; ++ int bufpos=0; ++ int info_size=19; ++ const char *id_string="doscmd FOSSIL"; ++ p = (unsigned char *)MAKEPTR(R_ES, R_DI); ++ p[bufpos++]=info_size&0xff; ++ p[bufpos++]=(info_size>>8)&0xff; ++ p[bufpos++]=5; ++ p[bufpos++]=0; ++ PUTVEC(*(u_short *)p, *(ushort *)(p + sizeof(u_short)), (u_long)id_string); ++ bufpos+=sizeof(u_short)*2; ++ p[bufpos++]=N_BYTES & 0xff; ++ p[bufpos++]=(N_BYTES>>8) & 0xff; ++ p[bufpos++]=(N_BYTES - cdsp->ids) & 0xff; ++ p[bufpos++]=((N_BYTES - cdsp->ids) >> 8) & 0xff; ++ p[bufpos++]=N_BYTES & 0xff; ++ p[bufpos++]=(N_BYTES>>8) & 0xff; ++ p[bufpos++]=(N_BYTES - cdsp->ods) & 0xff; ++ p[bufpos++]=((N_BYTES - cdsp->ods) >> 8) & 0xff; ++ p[bufpos++]=80; ++ p[bufpos++]=25; ++ p[bufpos++]=cdsp->param & BITRATE_9600; ++ break; ++ } ++ + default: + unknown_int2(0x14, R_AH, REGS); + break; +@@ -353,6 +538,7 @@ + port, cdsp->path); + return; + } ++ cdsp->param = param; + + cdsp->ids = cdsp->ods = cdsp->emptyint = 0; + cdsp->int_enable = 0; +@@ -402,12 +588,24 @@ + } + switch (param & BITRATE_9600) { + case BITRATE_110: +- speed = B110; +- spd = 110; ++ if (fossil) { ++ speed = B19200; ++ spd = 19200; ++ } ++ else { ++ speed = B110; ++ spd = 110; ++ } + break; + case BITRATE_150: +- speed = B150; +- spd = 150; ++ if (fossil) { ++ speed = B38400; ++ spd = 38400; ++ } ++ else { ++ speed = B150; ++ spd = 150; ++ } + break; + case BITRATE_300: + speed = B300; diff --git a/emulators/doscmd/files/patch-quietmode b/emulators/doscmd/files/patch-quietmode new file mode 100644 index 000000000000..c0776359fe0f --- /dev/null +++ b/emulators/doscmd/files/patch-quietmode @@ -0,0 +1,317 @@ +diff -u ./debug.c /home/admin/doscmd.working/doscmd-20040330/debug.c +--- ./debug.c Mon Mar 29 16:00:00 2004 ++++ /home/admin/doscmd.working/doscmd-20040330/debug.c Wed May 3 13:58:35 2006 +@@ -106,7 +106,7 @@ + + dead = 1; + +- if (xmode) { ++ if (xmode && !quietmode) { + char buf[1024]; + const char *m; + +diff -u ./dos.c /home/admin/doscmd.working/doscmd-20040330/dos.c +--- ./dos.c Mon Mar 29 16:00:00 2004 ++++ /home/admin/doscmd.working/doscmd-20040330/dos.c Wed May 3 13:58:35 2006 +@@ -625,9 +625,12 @@ + { + int n; + +- /* XXX this is pretty bogus, actually */ +- if (!xmode) { +- R_AL = 0xff; /* no X mode, always claim data available */ ++ if (quietmode && !xmode) { ++ const struct timespec rqtp={0,1}; ++ ++ /* In case of camping */ ++ nanosleep(&rqtp, NULL); ++ R_AL = 0; + return(0); + } + /* XXX tty_peek is broken */ +diff -u ./doscmd.c /home/admin/doscmd.working/doscmd-20040330/doscmd.c +--- ./doscmd.c Wed May 3 14:06:55 2006 ++++ /home/admin/doscmd.working/doscmd-20040330/doscmd.c Wed May 3 13:58:35 2006 +@@ -64,6 +64,7 @@ + int capture_fd = -1; + int dead = 0; + int xmode = 0; ++int quietmode = 0; + int booting = 0; + int raw_kbd = 0; + int timer_disable = 0; +@@ -226,7 +227,7 @@ + kbd_init(); + kbd_bios_init(); + video_init(); +- if (xmode) ++ if (xmode || quietmode) + mouse_init(); + video_bios_init(); + disk_bios_init(); +@@ -511,7 +512,7 @@ + FILE *fp; + char *col; + +- while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) { ++ while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:PpQ:RrS:TtU:vVxXYz")) != -1) { + switch (c) { + case '2': + debug_flags |= D_TRAPS2; +@@ -620,6 +621,9 @@ + define_output_port_handler(p++, outb_port); + } + break; ++ case 'Q': ++ quietmode = 1; ++ break; + case 'R': + debug_flags |= D_REDIR; + break; +@@ -826,7 +830,7 @@ + done(regcontext_t *REGS, int val) + { + if (curpsp < 2) { +- if (xmode) { ++ if (xmode && !quietmode) { + const char *m; + + tty_move(24, 0); +@@ -861,7 +865,7 @@ + coq = coq->next; + c->func(c->arg); + } +- if (!xmode) /* XXX not for bootmode */ ++ if (!(xmode || quietmode)) /* XXX not for bootmode */ + puts("\n"); + exit(status); + } +diff -u ./doscmd.h /home/admin/doscmd.working/doscmd-20040330/doscmd.h +--- ./doscmd.h Wed May 3 14:06:55 2006 ++++ /home/admin/doscmd.working/doscmd-20040330/doscmd.h Wed May 3 13:58:35 2006 +@@ -175,6 +175,7 @@ + extern int capture_fd; + extern int dead; + extern int xmode; ++extern int quietmode; + extern int booting; + extern int raw_kbd; + extern int timer_disable; +diff -u ./int10.c /home/admin/doscmd.working/doscmd-20040330/int10.c +--- ./int10.c Mon Mar 29 16:00:00 2004 ++++ /home/admin/doscmd.working/doscmd-20040330/int10.c Wed May 3 13:58:35 2006 +@@ -57,7 +57,7 @@ + + switch (R_AH) { + case 0x00: /* Set display mode */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + init_mode(R_AL); + break; +@@ -94,12 +94,12 @@ + break; + } + case 0x02: /* Position cursor */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + tty_move(R_DH, R_DL); + break; + case 0x03: /* Read cursor position */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + tty_report(&i, &j); + R_DH = i; +@@ -111,7 +111,7 @@ + debug(D_VIDEO, "Select current display page %d\n", R_AL); + break; + case 0x06: /* initialize window/scroll text upward */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + if (R_AL == 0) /* clear screen */ + R_AL = DpyRows + 1; +@@ -120,7 +120,7 @@ + R_AL, R_BH << 8); + break; + case 0x07: /* initialize window/scroll text downward */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + if (R_AL == 0) /* clear screen */ + R_AL = DpyRows + 1; +@@ -129,24 +129,24 @@ + R_AL, R_BH << 8); + break; + case 0x08: /* read character/attribute */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + i = tty_char(-1, -1); + R_AX = i; + break; + case 0x09: /* write character/attribute */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + tty_rwrite(R_CX, R_AL, R_BL << 8); + break; + case 0x0a: /* write character */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + debug(D_HALF, "Int 10:0a: Write char: %02x\n", R_AL); + tty_rwrite(R_CX, R_AL, -1); + break; + case 0x0b: /* set border color */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + video_setborder(R_BL); + break; +@@ -165,7 +165,7 @@ + R_BH = 0;/*ActivePage *//* display page */ + break; + case 0x10: +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + switch (R_AL) { + case 0x00: /* Set single palette register */ +@@ -350,7 +350,7 @@ + } + break; + case 0x12: /* Alternate function select */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + switch (R_BL) { + case 0x10: /* Read EGA/VGA config */ +@@ -372,7 +372,7 @@ + } + break; + case 0x13: /* write character string */ +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + addr = (char *)MAKEPTR(R_ES, R_BP); + switch (R_AL & 0x03) { +@@ -407,7 +407,7 @@ + } + break; + case 0x1a: +- if (!xmode) ++ if (!(xmode || quietmode)) + goto unsupported; + R_AL = 0x1a; /* I am VGA */ + R_BL = 8; /* Color VGA */ +diff -u ./int16.c /home/admin/doscmd.working/doscmd-20040330/int16.c +--- ./int16.c Mon Mar 29 16:00:00 2004 ++++ /home/admin/doscmd.working/doscmd-20040330/int16.c Wed May 3 13:58:35 2006 +@@ -78,7 +78,7 @@ + void + int16(regcontext_t *REGS) + { +- if (!xmode && !raw_kbd) { ++ if (!(xmode || raw_kbd || quietmode)) { + if (vflag) dump_regs(REGS); + fatal ("int16 func 0x%x only supported in X mode\n", R_AH); + } +diff -u ./tty.c /home/admin/doscmd.working/doscmd-20040330/tty.c +--- ./tty.c Wed May 3 14:06:55 2006 ++++ /home/admin/doscmd.working/doscmd-20040330/tty.c Wed May 3 13:58:35 2006 +@@ -34,6 +34,7 @@ + __FBSDID("$FreeBSD: projects/doscmd/tty.c,v 1.25 2002/04/12 21:18:05 charnier Exp $"); + + #include <sys/ioctl.h> ++#include <sys/select.h> + #include <sys/time.h> + #include <sys/types.h> + #include <sys/mman.h> +@@ -1471,7 +1472,8 @@ + { + if (attr == TTYF_REDIRECT) { + if (redirect1) { +- write(1, &c, 1); ++ if(!quietmode) ++ write(1, &c, 1); + return; + } + attr = -1; +@@ -1487,8 +1489,10 @@ + #ifndef NO_X + XBell(dpy, 0); + #endif +- } else ++ } else { ++ if(!quietmode) + write(1, "\007", 1); ++ } + break; + case 0x08: + if (row > (height - 1) || col > width) +@@ -1658,20 +1662,14 @@ + { + int r; + ++ if(quietmode && !xmode) ++ return(0); ++ + if ((r = nextchar) != 0) { + nextchar = 0; + return(r & 0xff); + } + +- if ((flag & TTYF_REDIRECT) && redirect0) { +- char c; +- if (read(STDIN_FILENO, &c, 1) != 1) +- return(-1); +- if (c == '\n') +- c = '\r'; +- return(c); +- } +- + if (KbdEmpty()) { + if (flag & TTYF_BLOCK) { + while (KbdEmpty()) +@@ -1858,6 +1856,22 @@ + int + KbdEmpty() + { ++ if(!xmode) { ++ fd_set rd; ++ struct timeval tv; ++ ++ FD_ZERO(&rd); ++ FD_SET(STDIN_FILENO, &rd); ++ tv.tv_sec=0; ++ tv.tv_usec=0; ++ if(select(STDIN_FILENO+1, &rd, NULL, NULL, &tv)==1) { ++ char ch=0; ++ read(STDIN_FILENO, &ch, 1); ++ if(ch == '\n') ++ ch = '\r'; ++ KbdWrite(ch); ++ } ++ } + return(K_NEXT == K_FREE); + } + +diff -u ./video.c /home/admin/doscmd.working/doscmd-20040330/video.c +--- ./video.c Wed May 3 14:06:55 2006 ++++ /home/admin/doscmd.working/doscmd-20040330/video.c Wed May 3 13:58:35 2006 +@@ -276,9 +276,9 @@ + define_output_port_handler(GDC_DataPort, video_outb); + } + +- redirect0 = isatty(0) == 0 || !xmode ; +- redirect1 = isatty(1) == 0 || !xmode ; +- redirect2 = isatty(2) == 0 || !xmode ; ++ redirect0 = isatty(0) == 0 || !(xmode || quietmode); ++ redirect1 = isatty(1) == 0 || !(xmode || quietmode); ++ redirect2 = isatty(2) == 0 || !(xmode || quietmode); + + return; + } |