View | Details | Raw Unified | Return to bug 160217 | Differences between
and this patch

Collapse All | Expand All

(-)doscmd/Makefile (-4 / +11 lines)
Lines 6-16 Link Here
6
#
6
#
7
7
8
PORTNAME=	doscmd
8
PORTNAME=	doscmd
9
PORTVERSION=	20040330
9
PORTVERSION=	20110826
10
PORTREVISION=	3
11
CATEGORIES=	emulators
10
CATEGORIES=	emulators
12
MASTER_SITES=	${MASTER_SITE_LOCAL}
11
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
13
MASTER_SITE_SUBDIR=	des
12
MASTER_SITE_SUBDIR=	doscmd
14
13
15
MAINTAINER=	shurd@sasktel.net
14
MAINTAINER=	shurd@sasktel.net
16
COMMENT=	DOS emulator
15
COMMENT=	DOS emulator
Lines 27-30 Link Here
27
MAN1=		doscmd.1
26
MAN1=		doscmd.1
28
MANCOMPRESSED=	yes
27
MANCOMPRESSED=	yes
29
28
29
post-install:
30
	@${ECHO_MSG} NOTE:
31
	@${ECHO_MSG} =====
32
	@${ECHO_MSG} For security reasons, FreeBSD no longer allows mmap\(\) at zero.
33
	@${ECHO_MSG} To remove this security protection and allow doscmd to work, you will need
34
	@${ECHO_MSG} to set sysctl security.bsd.map_at_zero=1 either before running doscmd or
35
	@${ECHO_MSG} in /etc/sysctl.conf.
36
30
.include <bsd.port.mk>
37
.include <bsd.port.mk>
(-)doscmd/distinfo (-3 / +2 lines)
Lines 1-3 Link Here
1
MD5 (doscmd-20040330.tar.gz) = 41945d5b433c6dda3aec719ecb7bae13
1
SHA256 (doscmd-20110826.tar.gz) = bc9187427b381bf0c8aa2e07362db36ebe3582a855a7f1e08bb159d9707feaba
2
SHA256 (doscmd-20040330.tar.gz) = 8903166dda822457cf561f1b0f0cd27bec32e9a3dd422340be5dddfa66ec684a
2
SIZE (doscmd-20110826.tar.gz) = 189004
3
SIZE (doscmd-20040330.tar.gz) = 183364
(-)doscmd/files/patch-8.x (-629 lines)
Lines 1-629 Link Here
1
diff -rc ../../work.old/doscmd-20040330/dos.h ./dos.h
2
*** ../../work.old/doscmd-20040330/dos.h	Mon Mar 29 14:00:00 2004
3
--- ./dos.h	Tue Sep 15 16:22:30 2009
4
***************
5
*** 118,165 ****
6
   * use the first 21 bytes.
7
   */
8
  typedef struct {
9
!     u_char	drive		__attribute__ ((packed));
10
!     u_char      pattern[11]	__attribute__ ((packed));
11
!     u_char      flag		__attribute__ ((packed));
12
!     u_char      reserved1[4]	__attribute__ ((packed));
13
!     search_t    *searchptr	__attribute__ ((packed));
14
!     u_char      attr		__attribute__ ((packed));
15
!     u_short     time		__attribute__ ((packed));
16
!     u_short     date		__attribute__ ((packed));
17
!     u_long	size		__attribute__ ((packed));
18
!     u_char      name[13]	__attribute__ ((packed));
19
! }/*  __attribute__((__packed__))*/ find_block_t;
20
  
21
  /*
22
   * DOS directory entry structure
23
   */
24
  typedef struct {
25
!     u_char      name[8]		__attribute__ ((packed));
26
!     u_char      ext[3]		__attribute__ ((packed));
27
!     u_char      attr		__attribute__ ((packed));
28
!     u_char      reserved[10]	__attribute__ ((packed));
29
!     u_short     time		__attribute__ ((packed));
30
!     u_short     date		__attribute__ ((packed));
31
!     u_short     start		__attribute__ ((packed));
32
!     u_long      size		__attribute__ ((packed));
33
! } dosdir_t;
34
  
35
  /*
36
   * The Current Drive Structure
37
   */
38
  typedef struct {
39
! 	u_char	path[0x43]		__attribute__ ((packed));
40
! 	u_short	flag			__attribute__ ((packed));
41
! 	u_short	dpb_off			__attribute__ ((packed));
42
! 	u_short	dpb_seg			__attribute__ ((packed));
43
! 	u_short	redirector_off		__attribute__ ((packed));
44
! 	u_short	redirector_seg		__attribute__ ((packed));
45
! 	u_char	paramter_int21[2]	__attribute__ ((packed));
46
!         u_short	offset			__attribute__ ((packed));
47
! 	u_char	dummy			__attribute__ ((packed));
48
! 	u_char	ifs_driver[4]		__attribute__ ((packed));
49
! 	u_char	dummy2[2]		__attribute__ ((packed));
50
! }/* __attribute__((__packed__))*/ CDS;
51
  
52
  #define	CDS_remote	0x8000
53
  #define	CDS_ready	0x4000
54
--- 118,165 ----
55
   * use the first 21 bytes.
56
   */
57
  typedef struct {
58
!     u_char	drive;
59
!     u_char      pattern[11];
60
!     u_char      flag;
61
!     u_char      reserved1[4];
62
!     search_t    *searchptr;
63
!     u_char      attr;
64
!     u_short     time;
65
!     u_short     date;
66
!     u_long	size;
67
!     u_char      name[13];
68
! } __attribute__((packed)) find_block_t;
69
  
70
  /*
71
   * DOS directory entry structure
72
   */
73
  typedef struct {
74
!     u_char      name[8];
75
!     u_char      ext[3];
76
!     u_char      attr;
77
!     u_char      reserved[10];
78
!     u_short     time;
79
!     u_short     date;
80
!     u_short     start;
81
!     u_long      size;
82
! } __attribute__((packed)) dosdir_t;
83
  
84
  /*
85
   * The Current Drive Structure
86
   */
87
  typedef struct {
88
! 	u_char	path[0x43];
89
! 	u_short	flag;
90
! 	u_short	dpb_off;
91
! 	u_short	dpb_seg;
92
! 	u_short	redirector_off;
93
! 	u_short	redirector_seg;
94
! 	u_char	paramter_int21[2];
95
!         u_short	offset;
96
! 	u_char	dummy;
97
! 	u_char	ifs_driver[4];
98
! 	u_char	dummy2[2];
99
! } __attribute__((packed)) CDS;
100
  
101
  #define	CDS_remote	0x8000
102
  #define	CDS_ready	0x4000
103
***************
104
*** 172,333 ****
105
   * The List of Lists (used to get the CDS and a few other numbers)
106
   */
107
  typedef struct {
108
! 	u_char	dummy1[0x16]	__attribute__ ((packed));
109
! 	u_short	cds_offset	__attribute__ ((packed));
110
! 	u_short	cds_seg		__attribute__ ((packed));
111
! 	u_char  dummy2[6]	__attribute__ ((packed));
112
! 	u_char	numberbdev	__attribute__ ((packed));
113
! 	u_char	lastdrive	__attribute__ ((packed));
114
! } LOL;
115
  
116
  /*
117
   * The System File Table
118
   */
119
  typedef struct {
120
! /*00*/	u_short	nfiles		__attribute__ ((packed));	/* Number file handles referring to this file */
121
! /*02*/	u_short	open_mode	__attribute__ ((packed));	/* Open mode (bit 15 -> by FCB) */
122
! /*04*/	u_char	attribute	__attribute__ ((packed));
123
! /*05*/	u_short	info		__attribute__ ((packed));	/* 15 -> remote, 14 ->  dont set date */
124
! /*07*/	u_char	ddr_dpb[4]	__attribute__ ((packed));	/* Device Driver Header/Drive Paramter Block */
125
! /*0b*/	u_short	fd		__attribute__ ((packed));
126
! /*0d*/	u_short	time		__attribute__ ((packed));
127
! /*0f*/	u_short	date		__attribute__ ((packed));
128
! /*11*/	u_long	size		__attribute__ ((packed));
129
! /*15*/	u_long	offset		__attribute__ ((packed));
130
! /*19*/	u_short	rel_cluster	__attribute__ ((packed));
131
! /*1b*/	u_short	abs_cluster	__attribute__ ((packed));
132
! /*1d*/	u_char	dir_sector[2]	__attribute__ ((packed));
133
! /*1f*/	u_char	dir_entry	__attribute__ ((packed));
134
! /*20*/	u_char	name[8]		__attribute__ ((packed));
135
! /*28*/	u_char	ext[3]		__attribute__ ((packed));
136
! /*2b*/	u_char	sharesft[4]	__attribute__ ((packed));
137
! /*2f*/	u_char	sharenet[2]	__attribute__ ((packed));
138
! /*31*/	u_short	psp		__attribute__ ((packed));
139
! /*33*/	u_char	share_off[2]	__attribute__ ((packed));
140
! /*35*/	u_char	local_end[2]	__attribute__ ((packed));
141
! /*37*/	u_char	ifd_driver[4]	__attribute__ ((packed)); 
142
! } /*__attribute__((__packed__))*/ SFT;
143
  
144
  /*
145
   * Format of PCDOS 4.01 swappable data area
146
   * (Sorry, but you need a wide screen to make this look nice)
147
   */
148
  typedef struct {
149
!     u_char	err_crit	__attribute__ ((packed));	/*   00h    BYTE    critical error flag */
150
!     u_char	InDOS		__attribute__ ((packed));	/*   01h    BYTE    InDOS flag (count of active INT 21 calls) */
151
!     u_char	err_drive	__attribute__ ((packed));	/*   02h    BYTE    ??? drive number or FFh */
152
!     u_char	err_locus	__attribute__ ((packed));	/*   03h    BYTE    locus of last error */
153
!     u_short	err_code	__attribute__ ((packed));	/*   04h    WORD    extended error code of last error */
154
!     u_char	err_suggest	__attribute__ ((packed));	/*   06h    BYTE    suggested action for last error */
155
!     u_char	err_class	__attribute__ ((packed));	/*   07h    BYTE    class of last error */
156
!     u_short	err_di		__attribute__ ((packed));
157
!     u_short	err_es		__attribute__ ((packed));	/*   08h    DWORD   ES:DI pointer for last error */
158
!     u_short	dta_off		__attribute__ ((packed));
159
!     u_short	dta_seg		__attribute__ ((packed));	/*   0Ch    DWORD   current DTA */
160
!     u_short	psp		__attribute__ ((packed));	/*   10h    WORD    current PSP */
161
!     u_short	int_23_sp	__attribute__ ((packed));	/*   12h    WORD    stores SP across an INT 23 */
162
!     u_short	wait_status	__attribute__ ((packed));	/*   14h    WORD    return code from last process termination (set to 0 after reading with AH=4Dh) */
163
!     u_char	current_drive	__attribute__ ((packed));	/*   16h    BYTE    current drive */
164
!     u_char	break_flag	__attribute__ ((packed));	/*   17h    BYTE    extended break flag */
165
!     u_char	unknown1[2]	__attribute__ ((packed));	/*   18h  2 BYTEs   ??? */
166
!     u_short	int_21_ax	__attribute__ ((packed));	/*   1Ah    WORD    value of AX on call to INT 21 */
167
!     u_short	net_psp		__attribute__ ((packed));	/*   1Ch    WORD    PSP segment for sharing/network */
168
!     u_short	net_number	__attribute__ ((packed));	/*   1Eh    WORD    network machine number for sharing/network (0000h = us) */
169
!     u_short	first_mem	__attribute__ ((packed));	/*   20h    WORD    first usable memory block found when allocating memory */
170
!     u_short	best_mem	__attribute__ ((packed));	/*   22h    WORD    best usable memory block found when allocating memory */
171
!     u_short	last_mem	__attribute__ ((packed));	/*   24h    WORD    last usable memory block found when allocating memory */
172
!     u_char	unknown[10]	__attribute__ ((packed));	/*   26h  2 BYTEs   ??? (don't seem to be referenced) */
173
!     u_char	monthday	__attribute__ ((packed));	/*   30h    BYTE    day of month */
174
!     u_char	month		__attribute__ ((packed));	/*   31h    BYTE    month */
175
!     u_short	year		__attribute__ ((packed));	/*   32h    WORD    year - 1980 */
176
!     u_short	days		__attribute__ ((packed));	/*   34h    WORD    number of days since 1-1-1980 */
177
!     u_char	weekday		__attribute__ ((packed));	/*   36h    BYTE    day of week (0 = Sunday) */
178
!     u_char	unknown2[3]	__attribute__ ((packed));	/*   37h    BYTE    ??? */
179
!     u_char	ddr_head[30]	__attribute__ ((packed));	/*   38h 30 BYTEs   device driver request header */
180
!     u_short	ddre_ip		__attribute__ ((packed));
181
!     u_short	ddre_cs		__attribute__ ((packed));	/*   58h    DWORD   pointer to device driver entry point (used in calling driver) */
182
!     u_char	ddr_head2[22]	__attribute__ ((packed));	/*   5Ch 22 BYTEs   device driver request header */
183
!     u_char	ddr_head3[30]	__attribute__ ((packed));	/*   72h 30 BYTEs   device driver request header */
184
!     u_char	unknown3[6]	__attribute__ ((packed));	/*   90h  6 BYTEs   ??? */
185
!     u_char	clock_xfer[6]	__attribute__ ((packed));	/*   96h  6 BYTEs   CLOCK$ transfer record (see AH=52h) */
186
!     u_char	unknown4[2]	__attribute__ ((packed));	/*   9Ch  2 BYTEs   ??? */
187
!     u_char	filename1[128]	__attribute__ ((packed));	/*   9Eh 128 BYTEs  buffer for filename */
188
!     u_char	filename2[128]	__attribute__ ((packed));	/*  11Eh 128 BYTEs  buffer for filename */
189
!     u_char	findfirst[21]	__attribute__ ((packed));	/*  19Eh 21 BYTEs   findfirst/findnext search data block (see AH=4Eh) */
190
!     u_char	foundentry[32]	__attribute__ ((packed));	/*  1B3h 32 BYTEs   directory entry for found file */
191
!     u_char	cds[88]		__attribute__ ((packed));	/*  1D3h 88 BYTEs   copy of current directory structure for drive being accessed */
192
!     u_char	fcbname[11]	__attribute__ ((packed));	/*  22Bh 11 BYTEs   ??? FCB-format filename */
193
!     u_char	unknown5	__attribute__ ((packed));	/*  236h    BYTE    ??? */
194
!     u_char	wildcard[11]	__attribute__ ((packed));	/*  237h 11 BYTEs   wildcard destination specification for rename (FCB format) */
195
!     u_char	unknown6[11]	__attribute__ ((packed));	/*  242h  2 BYTEs   ??? */
196
!     u_char	attrmask	__attribute__ ((packed));	/*  24Dh    BYTE    attribute mask for directory search??? */
197
!     u_char	open_mode	__attribute__ ((packed));	/*  24Eh    BYTE    open mode */
198
!     u_char	unknown7[3]	__attribute__ ((packed));	/*  24fh    BYTE    ??? */
199
!     u_char	virtual_dos	__attribute__ ((packed));	/*  252h    BYTE    flag indicating how DOS function was invoked (00h = direct INT 20/INT 21, FFh = server call AX=5D00h) */
200
!     u_char	unknown8[9]	__attribute__ ((packed));	/*  253h    BYTE    ??? */
201
!     u_char	term_type	__attribute__ ((packed));	/*  25Ch    BYTE    type of process termination (00h-03h) */
202
!     u_char	unknown9[3]	__attribute__ ((packed));	/*  25Dh    BYTE    ??? */
203
!     u_short	dpb_off		__attribute__ ((packed));
204
!     u_short	dpb_seg		__attribute__ ((packed));	/*  260h    DWORD   pointer to Drive Parameter Block for critical error invocation */
205
!     u_short	int21_sf_off	__attribute__ ((packed));
206
!     u_short	int21_sf_seg	__attribute__ ((packed));	/*  264h    DWORD   pointer to stack frame containing user registers on INT 21 */
207
!     u_short	store_sp	__attribute__ ((packed));	/*  268h    WORD    stores SP??? */
208
!     u_short	dosdpb_off	__attribute__ ((packed));
209
!     u_short	dosdpb_seg	__attribute__ ((packed));	/*  26Ah    DWORD   pointer to DOS Drive Parameter Block for ??? */
210
!     u_short	disk_buf_seg	__attribute__ ((packed));	/*  26Eh    WORD    segment of disk buffer */
211
!     u_short	unknown10[4]	__attribute__ ((packed));	/*  270h    WORD    ??? */
212
!     u_char	media_id	__attribute__ ((packed));	/*  278h    BYTE    Media ID byte returned by AH=1Bh,1Ch */
213
!     u_char	unknown11	__attribute__ ((packed));	/*  279h    BYTE    ??? (doesn't seem to be referenced) */
214
!     u_short	unknown12[2]	__attribute__ ((packed));	/*  27Ah    DWORD   pointer to ??? */
215
!     u_short	sft_off		__attribute__ ((packed));
216
!     u_short	sft_seg		__attribute__ ((packed));	/*  27Eh    DWORD   pointer to current SFT */
217
!     u_short	cds_off		__attribute__ ((packed));
218
!     u_short	cds_seg		__attribute__ ((packed));	/*  282h    DWORD   pointer to current directory structure for drive being accessed */
219
!     u_short	fcb_off		__attribute__ ((packed));
220
!     u_short	fcb_seg		__attribute__ ((packed));	/*  286h    DWORD   pointer to caller's FCB */
221
!     u_short	unknown13[2]	__attribute__ ((packed));	/*  28Ah    WORD    ??? */
222
!     u_short	jft_off		__attribute__ ((packed));
223
!     u_short	jft_seg		__attribute__ ((packed));	/*  28Eh    DWORD   pointer to a JFT entry in process handle table (see AH=26h) */
224
!     u_short	filename1_off	__attribute__ ((packed));	/*  292h    WORD    offset in DOS CS of first filename argument */
225
!     u_short	filename2_off	__attribute__ ((packed));	/*  294h    WORD    offset in DOS CS of second filename argument */
226
!     u_short	unknown14[12]	__attribute__ ((packed));	/*  296h    WORD    ??? */
227
!     u_short	file_offset_lo	__attribute__ ((packed));
228
!     u_short	file_offset_hi	__attribute__ ((packed));	/*  2AEh    DWORD   offset in file??? */
229
!     u_short	unknown15	__attribute__ ((packed));	/*  2B2h    WORD    ??? */
230
!     u_short	partial_bytes	__attribute__ ((packed));	/*  2B4h    WORD    bytes in partial sector */
231
!     u_short	number_sectors	__attribute__ ((packed));	/*  2B6h    WORD    number of sectors */
232
!     u_short	unknown16[3]	__attribute__ ((packed));	/*  2B8h    WORD    ??? */
233
!     u_short	nbytes_lo	__attribute__ ((packed));
234
!     u_short	nbytes_hi	__attribute__ ((packed));	/*  2BEh    DWORD   number of bytes appended to file */
235
!     u_short	qpdb_off	__attribute__ ((packed));
236
!     u_short	qpdb_seg	__attribute__ ((packed));	/*  2C2h    DWORD   pointer to ??? disk buffer */
237
!     u_short	asft_off	__attribute__ ((packed));
238
!     u_short	asft_seg	__attribute__ ((packed));	/*  2C6h    DWORD   pointer to ??? SFT */
239
!     u_short	int21_bx	__attribute__ ((packed));	/*  2CAh    WORD    used by INT 21 dispatcher to store caller's BX */
240
!     u_short	int21_ds	__attribute__ ((packed));	/*  2CCh    WORD    used by INT 21 dispatcher to store caller's DS */
241
!     u_short	temporary	__attribute__ ((packed));	/*  2CEh    WORD    temporary storage while saving/restoring caller's registers */
242
!     u_short	prevcall_off	__attribute__ ((packed));
243
!     u_short	prevcall_seg	__attribute__ ((packed));	/*  2D0h    DWORD   pointer to prev call frame (offset 264h) if INT 21 reentered also switched to for duration of INT 24 */
244
!     u_char	unknown17[9]	__attribute__ ((packed));	/*  2D4h    WORD    ??? */
245
!     u_short	ext_action	__attribute__ ((packed));	/*  2DDh    WORD    multipurpose open action */
246
!     u_short	ext_attr	__attribute__ ((packed));	/*  2DFh    WORD    multipurpose attribute */
247
!     u_short	ext_mode	__attribute__ ((packed));	/*  2E1h    WORD    multipurpose mode */
248
!     u_char	unknown17a[9]	__attribute__ ((packed));
249
!     u_short	lol_ds		__attribute__ ((packed));	/*  2ECh    WORD    stores DS during call to [List-of-Lists + 37h] */
250
!     u_char	unknown18[5]	__attribute__ ((packed));	/*  2EEh    WORD    ??? */
251
!     u_char	usernameptr[4]	__attribute__ ((packed));	/*  2F3h    DWORD   pointer to user-supplied filename */
252
!     u_char	unknown19[4]	__attribute__ ((packed));	/*  2F7h    DWORD   pointer to ??? */
253
!     u_char	lol_ss[2]	__attribute__ ((packed));	/*  2FBh    WORD    stores SS during call to [List-of-Lists + 37h] */
254
!     u_char	lol_sp[2]	__attribute__ ((packed));	/*  2FDh    WORD    stores SP during call to [List-of-Lists + 37h] */
255
!     u_char	lol_flag	__attribute__ ((packed));	/*  2FFh    BYTE    flag, nonzero if stack switched in calling [List-of-Lists+37h] */
256
!     u_char	searchdata[21]	__attribute__ ((packed));	/*  300h 21 BYTEs   FindFirst search data for source file(s) of a rename operation (see AH=4Eh) */
257
!     u_char	renameentry[32]	__attribute__ ((packed));	/*  315h 32 BYTEs   directory entry for file being renamed */
258
!     u_char	errstack[331]	__attribute__ ((packed));	/*  335h 331 BYTEs  critical error stack */
259
!     u_char	diskstack[384]	__attribute__ ((packed));	/*  480h 384 BYTEs  disk stack (functions greater than 0Ch, INT 25, INT 26) */
260
!     u_char	iostack[384]	__attribute__ ((packed));	/*  600h 384 BYTEs  character I/O stack (functions 01h through 0Ch) */
261
!     u_char	int_21_08_flag	__attribute__ ((packed));	/*  780h    BYTE    flag affecting AH=08h (see AH=64h) */
262
!     u_char	unknown20[11]	__attribute__ ((packed));	/*  781h    BYTE    ??? looks like a drive number */
263
! } /*__attribute__((__packed__))*/ SDA;
264
  
265
  struct exehdr {
266
  	u_short magic;
267
--- 172,333 ----
268
   * The List of Lists (used to get the CDS and a few other numbers)
269
   */
270
  typedef struct {
271
! 	u_char	dummy1[0x16];
272
! 	u_short	cds_offset;
273
! 	u_short	cds_seg;
274
! 	u_char  dummy2[6];
275
! 	u_char	numberbdev;
276
! 	u_char	lastdrive;
277
! } __attribute__((packed)) LOL;
278
  
279
  /*
280
   * The System File Table
281
   */
282
  typedef struct {
283
! /*00*/	u_short	nfiles;	/* Number file handles referring to this file */
284
! /*02*/	u_short	open_mode;	/* Open mode (bit 15 -> by FCB) */
285
! /*04*/	u_char	attribute;
286
! /*05*/	u_short	info;	/* 15 -> remote, 14 ->  dont set date */
287
! /*07*/	u_char	ddr_dpb[4];	/* Device Driver Header/Drive Paramter Block */
288
! /*0b*/	u_short	fd;
289
! /*0d*/	u_short	time;
290
! /*0f*/	u_short	date;
291
! /*11*/	u_long	size;
292
! /*15*/	u_long	offset;
293
! /*19*/	u_short	rel_cluster;
294
! /*1b*/	u_short	abs_cluster;
295
! /*1d*/	u_char	dir_sector[2];
296
! /*1f*/	u_char	dir_entry;
297
! /*20*/	u_char	name[8];
298
! /*28*/	u_char	ext[3];
299
! /*2b*/	u_char	sharesft[4];
300
! /*2f*/	u_char	sharenet[2];
301
! /*31*/	u_short	psp;
302
! /*33*/	u_char	share_off[2];
303
! /*35*/	u_char	local_end[2];
304
! /*37*/	u_char	ifd_driver[4]; 
305
! } __attribute__((packed)) SFT;
306
  
307
  /*
308
   * Format of PCDOS 4.01 swappable data area
309
   * (Sorry, but you need a wide screen to make this look nice)
310
   */
311
  typedef struct {
312
!     u_char	err_crit;	/*   00h    BYTE    critical error flag */
313
!     u_char	InDOS;	/*   01h    BYTE    InDOS flag (count of active INT 21 calls) */
314
!     u_char	err_drive;	/*   02h    BYTE    ??? drive number or FFh */
315
!     u_char	err_locus;	/*   03h    BYTE    locus of last error */
316
!     u_short	err_code;	/*   04h    WORD    extended error code of last error */
317
!     u_char	err_suggest;	/*   06h    BYTE    suggested action for last error */
318
!     u_char	err_class;	/*   07h    BYTE    class of last error */
319
!     u_short	err_di;
320
!     u_short	err_es;	/*   08h    DWORD   ES:DI pointer for last error */
321
!     u_short	dta_off;
322
!     u_short	dta_seg;	/*   0Ch    DWORD   current DTA */
323
!     u_short	psp;	/*   10h    WORD    current PSP */
324
!     u_short	int_23_sp;	/*   12h    WORD    stores SP across an INT 23 */
325
!     u_short	wait_status;	/*   14h    WORD    return code from last process termination (set to 0 after reading with AH=4Dh) */
326
!     u_char	current_drive;	/*   16h    BYTE    current drive */
327
!     u_char	break_flag;	/*   17h    BYTE    extended break flag */
328
!     u_char	unknown1[2];	/*   18h  2 BYTEs   ??? */
329
!     u_short	int_21_ax;	/*   1Ah    WORD    value of AX on call to INT 21 */
330
!     u_short	net_psp;	/*   1Ch    WORD    PSP segment for sharing/network */
331
!     u_short	net_number;	/*   1Eh    WORD    network machine number for sharing/network (0000h = us) */
332
!     u_short	first_mem;	/*   20h    WORD    first usable memory block found when allocating memory */
333
!     u_short	best_mem;	/*   22h    WORD    best usable memory block found when allocating memory */
334
!     u_short	last_mem;	/*   24h    WORD    last usable memory block found when allocating memory */
335
!     u_char	unknown[10];	/*   26h  2 BYTEs   ??? (don't seem to be referenced) */
336
!     u_char	monthday;	/*   30h    BYTE    day of month */
337
!     u_char	month;	/*   31h    BYTE    month */
338
!     u_short	year;	/*   32h    WORD    year - 1980 */
339
!     u_short	days;	/*   34h    WORD    number of days since 1-1-1980 */
340
!     u_char	weekday;	/*   36h    BYTE    day of week (0 = Sunday) */
341
!     u_char	unknown2[3];	/*   37h    BYTE    ??? */
342
!     u_char	ddr_head[30];	/*   38h 30 BYTEs   device driver request header */
343
!     u_short	ddre_ip;
344
!     u_short	ddre_cs;	/*   58h    DWORD   pointer to device driver entry point (used in calling driver) */
345
!     u_char	ddr_head2[22];	/*   5Ch 22 BYTEs   device driver request header */
346
!     u_char	ddr_head3[30];	/*   72h 30 BYTEs   device driver request header */
347
!     u_char	unknown3[6];	/*   90h  6 BYTEs   ??? */
348
!     u_char	clock_xfer[6];	/*   96h  6 BYTEs   CLOCK$ transfer record (see AH=52h) */
349
!     u_char	unknown4[2];	/*   9Ch  2 BYTEs   ??? */
350
!     u_char	filename1[128];	/*   9Eh 128 BYTEs  buffer for filename */
351
!     u_char	filename2[128];	/*  11Eh 128 BYTEs  buffer for filename */
352
!     u_char	findfirst[21];	/*  19Eh 21 BYTEs   findfirst/findnext search data block (see AH=4Eh) */
353
!     u_char	foundentry[32];	/*  1B3h 32 BYTEs   directory entry for found file */
354
!     u_char	cds[88];	/*  1D3h 88 BYTEs   copy of current directory structure for drive being accessed */
355
!     u_char	fcbname[11];	/*  22Bh 11 BYTEs   ??? FCB-format filename */
356
!     u_char	unknown5;	/*  236h    BYTE    ??? */
357
!     u_char	wildcard[11];	/*  237h 11 BYTEs   wildcard destination specification for rename (FCB format) */
358
!     u_char	unknown6[11];	/*  242h  2 BYTEs   ??? */
359
!     u_char	attrmask;	/*  24Dh    BYTE    attribute mask for directory search??? */
360
!     u_char	open_mode;	/*  24Eh    BYTE    open mode */
361
!     u_char	unknown7[3];	/*  24fh    BYTE    ??? */
362
!     u_char	virtual_dos;	/*  252h    BYTE    flag indicating how DOS function was invoked (00h = direct INT 20/INT 21, FFh = server call AX=5D00h) */
363
!     u_char	unknown8[9];	/*  253h    BYTE    ??? */
364
!     u_char	term_type;	/*  25Ch    BYTE    type of process termination (00h-03h) */
365
!     u_char	unknown9[3];	/*  25Dh    BYTE    ??? */
366
!     u_short	dpb_off;
367
!     u_short	dpb_seg;	/*  260h    DWORD   pointer to Drive Parameter Block for critical error invocation */
368
!     u_short	int21_sf_off;
369
!     u_short	int21_sf_seg;	/*  264h    DWORD   pointer to stack frame containing user registers on INT 21 */
370
!     u_short	store_sp;	/*  268h    WORD    stores SP??? */
371
!     u_short	dosdpb_off;
372
!     u_short	dosdpb_seg;	/*  26Ah    DWORD   pointer to DOS Drive Parameter Block for ??? */
373
!     u_short	disk_buf_seg;	/*  26Eh    WORD    segment of disk buffer */
374
!     u_short	unknown10[4];	/*  270h    WORD    ??? */
375
!     u_char	media_id;	/*  278h    BYTE    Media ID byte returned by AH=1Bh,1Ch */
376
!     u_char	unknown11;	/*  279h    BYTE    ??? (doesn't seem to be referenced) */
377
!     u_short	unknown12[2];	/*  27Ah    DWORD   pointer to ??? */
378
!     u_short	sft_off;
379
!     u_short	sft_seg;	/*  27Eh    DWORD   pointer to current SFT */
380
!     u_short	cds_off;
381
!     u_short	cds_seg;	/*  282h    DWORD   pointer to current directory structure for drive being accessed */
382
!     u_short	fcb_off;
383
!     u_short	fcb_seg;	/*  286h    DWORD   pointer to caller's FCB */
384
!     u_short	unknown13[2];	/*  28Ah    WORD    ??? */
385
!     u_short	jft_off;
386
!     u_short	jft_seg;	/*  28Eh    DWORD   pointer to a JFT entry in process handle table (see AH=26h) */
387
!     u_short	filename1_off;	/*  292h    WORD    offset in DOS CS of first filename argument */
388
!     u_short	filename2_off;	/*  294h    WORD    offset in DOS CS of second filename argument */
389
!     u_short	unknown14[12];	/*  296h    WORD    ??? */
390
!     u_short	file_offset_lo;
391
!     u_short	file_offset_hi;	/*  2AEh    DWORD   offset in file??? */
392
!     u_short	unknown15;	/*  2B2h    WORD    ??? */
393
!     u_short	partial_bytes;	/*  2B4h    WORD    bytes in partial sector */
394
!     u_short	number_sectors;	/*  2B6h    WORD    number of sectors */
395
!     u_short	unknown16[3];	/*  2B8h    WORD    ??? */
396
!     u_short	nbytes_lo;
397
!     u_short	nbytes_hi;	/*  2BEh    DWORD   number of bytes appended to file */
398
!     u_short	qpdb_off;
399
!     u_short	qpdb_seg;	/*  2C2h    DWORD   pointer to ??? disk buffer */
400
!     u_short	asft_off;
401
!     u_short	asft_seg;	/*  2C6h    DWORD   pointer to ??? SFT */
402
!     u_short	int21_bx;	/*  2CAh    WORD    used by INT 21 dispatcher to store caller's BX */
403
!     u_short	int21_ds;	/*  2CCh    WORD    used by INT 21 dispatcher to store caller's DS */
404
!     u_short	temporary;	/*  2CEh    WORD    temporary storage while saving/restoring caller's registers */
405
!     u_short	prevcall_off;
406
!     u_short	prevcall_seg;	/*  2D0h    DWORD   pointer to prev call frame (offset 264h) if INT 21 reentered also switched to for duration of INT 24 */
407
!     u_char	unknown17[9];	/*  2D4h    WORD    ??? */
408
!     u_short	ext_action;	/*  2DDh    WORD    multipurpose open action */
409
!     u_short	ext_attr;	/*  2DFh    WORD    multipurpose attribute */
410
!     u_short	ext_mode;	/*  2E1h    WORD    multipurpose mode */
411
!     u_char	unknown17a[9];
412
!     u_short	lol_ds;	/*  2ECh    WORD    stores DS during call to [List-of-Lists + 37h] */
413
!     u_char	unknown18[5];	/*  2EEh    WORD    ??? */
414
!     u_char	usernameptr[4];	/*  2F3h    DWORD   pointer to user-supplied filename */
415
!     u_char	unknown19[4];	/*  2F7h    DWORD   pointer to ??? */
416
!     u_char	lol_ss[2];	/*  2FBh    WORD    stores SS during call to [List-of-Lists + 37h] */
417
!     u_char	lol_sp[2];	/*  2FDh    WORD    stores SP during call to [List-of-Lists + 37h] */
418
!     u_char	lol_flag;	/*  2FFh    BYTE    flag, nonzero if stack switched in calling [List-of-Lists+37h] */
419
!     u_char	searchdata[21];	/*  300h 21 BYTEs   FindFirst search data for source file(s) of a rename operation (see AH=4Eh) */
420
!     u_char	renameentry[32];	/*  315h 32 BYTEs   directory entry for file being renamed */
421
!     u_char	errstack[331];	/*  335h 331 BYTEs  critical error stack */
422
!     u_char	diskstack[384];	/*  480h 384 BYTEs  disk stack (functions greater than 0Ch, INT 25, INT 26) */
423
!     u_char	iostack[384];	/*  600h 384 BYTEs  character I/O stack (functions 01h through 0Ch) */
424
!     u_char	int_21_08_flag;	/*  780h    BYTE    flag affecting AH=08h (see AH=64h) */
425
!     u_char	unknown20[11];	/*  781h    BYTE    ??? looks like a drive number */
426
! } __attribute__((packed)) SDA;
427
  
428
  struct exehdr {
429
  	u_short magic;
430
Only in .: dos.h.orig
431
diff -rc ../../work.old/doscmd-20040330/ems.h ./ems.h
432
*** ../../work.old/doscmd-20040330/ems.h	Mon Mar 29 14:00:00 2004
433
--- ./ems.h	Tue Sep 15 16:24:00 2009
434
***************
435
*** 242,250 ****
436
   */
437
  
438
  typedef struct {
439
!     u_short handle __attribute__ ((packed));   /* handle */
440
!     u_short npages __attribute__ ((packed));   /* pages allocated */
441
! } EMShandlepage;
442
  
443
  /*
444
   * EMS map/unmap multiple, only used to pass information to and from
445
--- 242,250 ----
446
   */
447
  
448
  typedef struct {
449
!     u_short handle;   /* handle */
450
!     u_short npages;   /* pages allocated */
451
! } __attribute__((packed)) EMShandlepage;
452
  
453
  /*
454
   * EMS map/unmap multiple, only used to pass information to and from
455
***************
456
*** 252,261 ****
457
   */
458
  
459
  typedef struct {
460
!     u_short log __attribute__ ((packed));   /* logical page number */
461
!     u_short phys __attribute__ ((packed));  /* physical page (position) or
462
  					      segment address inside frame */
463
! } EMSmapunmap;
464
  
465
  /*
466
   * EMS handle directory, only used to pass information to and from
467
--- 252,261 ----
468
   */
469
  
470
  typedef struct {
471
!     u_short log;   /* logical page number */
472
!     u_short phys;  /* physical page (position) or
473
  					      segment address inside frame */
474
! } __attribute__ ((packed)) EMSmapunmap;
475
  
476
  /*
477
   * EMS handle directory, only used to pass information to and from
478
***************
479
*** 263,272 ****
480
   */
481
  
482
  typedef struct {
483
!    u_short log  __attribute__ ((packed));   /* logical page number */
484
!    Hname   name __attribute__ ((packed));   /* Handle name */
485
  
486
! } EMShandledir;
487
  
488
  /*
489
   * Structure for get/set page map: This structure is used to save and
490
--- 263,272 ----
491
   */
492
  
493
  typedef struct {
494
!    u_short log;   /* logical page number */
495
!    Hname   name;   /* Handle name */
496
  
497
! } __attribute__ ((packed)) EMShandledir;
498
  
499
  /*
500
   * Structure for get/set page map: This structure is used to save and
501
***************
502
*** 287,295 ****
503
   */
504
  
505
  typedef struct {
506
!    u_short segm __attribute__ ((packed));  /* segment address inside frame */
507
!    u_short phys __attribute__ ((packed));  /* physical page (position) */
508
! } EMSaddrarray;
509
  
510
  /*
511
   * EMS move memory call structure, only used to pass information to and from
512
--- 287,295 ----
513
   */
514
  
515
  typedef struct {
516
!    u_short segm;  /* segment address inside frame */
517
!    u_short phys;  /* physical page (position) */
518
! } __attribute__ ((packed)) EMSaddrarray;
519
  
520
  /*
521
   * EMS move memory call structure, only used to pass information to and from
522
***************
523
*** 297,313 ****
524
   */
525
  
526
  typedef struct {
527
!    u_long  length __attribute__ ((packed));      /* length of region */
528
  #define EMS_MOVE_CONV 0
529
  #define EMS_MOVE_EMS  1
530
!    u_char  src_type __attribute__ ((packed));    /* source type (0,1) */
531
!    u_short src_handle __attribute__ ((packed));  /* source handle */
532
!    u_short src_offset __attribute__ ((packed));  /* source offset */
533
!    u_short src_seg __attribute__ ((packed));     /* source type  */
534
!    u_char  dst_type __attribute__ ((packed));    /* destination type (0,1) */
535
!    u_short dst_handle __attribute__ ((packed));  /* destination handle */
536
!    u_short dst_offset __attribute__ ((packed));  /* destination offset */
537
!    u_short dst_seg __attribute__ ((packed));     /* destination type  */
538
! } EMSmovemem;
539
  
540
  #endif /* EMS_H */
541
--- 297,313 ----
542
   */
543
  
544
  typedef struct {
545
!    u_long  length;      /* length of region */
546
  #define EMS_MOVE_CONV 0
547
  #define EMS_MOVE_EMS  1
548
!    u_char  src_type;    /* source type (0,1) */
549
!    u_short src_handle;  /* source handle */
550
!    u_short src_offset;  /* source offset */
551
!    u_short src_seg;     /* source type  */
552
!    u_char  dst_type;    /* destination type (0,1) */
553
!    u_short dst_handle;  /* destination handle */
554
!    u_short dst_offset;  /* destination offset */
555
!    u_short dst_seg;     /* destination type  */
556
! } __attribute__ ((packed)) EMSmovemem;
557
  
558
  #endif /* EMS_H */
559
diff -rc ../../work.old/doscmd-20040330/int14.c ./int14.c
560
*** ../../work.old/doscmd-20040330/int14.c	Tue Sep 15 16:26:36 2009
561
--- ./int14.c	Tue Sep 15 16:25:04 2009
562
***************
563
*** 636,642 ****
564
  	"com_set_line: going with cflag 0x%X iflag 0x%X speed %d.\n",
565
  	cdsp->tty.c_cflag, cdsp->tty.c_iflag, speed);
566
      div_lo = (115200 / spd) & 0x00ff;
567
!     div_hi = (115200 / spd) & 0xff00;
568
      cdsp->div_latch[DIV_LATCH_LOW] = div_lo;
569
      cdsp->div_latch[DIV_LATCH_HIGH] = div_hi;
570
      errno = 0;
571
--- 636,642 ----
572
  	"com_set_line: going with cflag 0x%X iflag 0x%X speed %d.\n",
573
  	cdsp->tty.c_cflag, cdsp->tty.c_iflag, speed);
574
      div_lo = (115200 / spd) & 0x00ff;
575
!     div_hi = ((115200 / spd) & 0xff00) >> 8;
576
      cdsp->div_latch[DIV_LATCH_LOW] = div_lo;
577
      cdsp->div_latch[DIV_LATCH_HIGH] = div_hi;
578
      errno = 0;
579
diff -rc ../../work.old/doscmd-20040330/xms.h ./xms.h
580
*** ../../work.old/doscmd-20040330/xms.h	Mon Mar 29 14:00:00 2004
581
--- ./xms.h	Tue Sep 15 16:26:02 2009
582
***************
583
*** 99,109 ****
584
  
585
  struct EMM {
586
     u_long  nbytes;
587
!    u_short src_handle __attribute__ ((packed));
588
!    u_long  src_offset __attribute__ ((packed));
589
!    u_short dst_handle __attribute__ ((packed));
590
!    u_long  dst_offset __attribute__ ((packed));
591
! } ;
592
  
593
  /*
594
   * XMS info structure, only used to pass information to and from
595
--- 99,109 ----
596
  
597
  struct EMM {
598
     u_long  nbytes;
599
!    u_short src_handle;
600
!    u_long  src_offset;
601
!    u_short dst_handle;
602
!    u_long  dst_offset;
603
! } __attribute__ ((packed));
604
  
605
  /*
606
   * XMS info structure, only used to pass information to and from
607
***************
608
*** 112,121 ****
609
  
610
  struct XMSinfo {
611
     u_char handle;				/* the handle */
612
!    u_char num_locks __attribute__ ((packed));   /* number of locks */
613
!    u_long size __attribute__ ((packed));	/* size of memory */
614
!    u_long phys_addr __attribute__ ((packed));   /* "physical" address */
615
! };
616
  
617
  /*
618
   * Handle management inside the emulator for extended memory pages, 
619
--- 112,121 ----
620
  
621
  struct XMSinfo {
622
     u_char handle;				/* the handle */
623
!    u_char num_locks;   /* number of locks */
624
!    u_long size;	/* size of memory */
625
!    u_long phys_addr;   /* "physical" address */
626
! } __attribute__ ((packed));
627
  
628
  /*
629
   * Handle management inside the emulator for extended memory pages, 
(-)doscmd/files/patch-bioscursor (-114 lines)
Lines 1-114 Link Here
1
--- /usr/ports/emulators/doscmd/work/doscmd-20040330/tty.c	Mon May  1 18:38:07 2006
2
+++ tty.c	Mon May  1 18:38:51 2006
3
@@ -125,6 +125,7 @@
4
 #define	row (CursRow0)
5
 #define	col (CursCol0)
6
 
7
+
8
 /* Local functions */
9
 static void	_kbd_event(int, int, void *, regcontext_t *);
10
 static void	Failure(void *);
11
@@ -1427,7 +1428,9 @@
12
 tty_move(int r, int c)
13
 {
14
 	row = r;
15
+	BIOS_CursRow0 = r;
16
 	col = c;
17
+	BIOS_CursCol0 = c;
18
 	SetVREGCur();
19
 }
20
 
21
@@ -1459,6 +1462,7 @@
22
 				vmem[(height - 1) * width + i] = vattr | ' ';
23
 		}
24
 	}
25
+	BIOS_CursRow0 = row;	/* Sync back with row */
26
 	SetVREGCur();
27
 }
28
 
29
@@ -1489,21 +1493,27 @@
30
 	case 0x08:
31
 		if (row > (height - 1) || col > width)
32
 			break;
33
-		if (col > 0)
34
+		if (col > 0) {
35
 			--col;
36
+			BIOS_CursCol0 = col;
37
+		}
38
 		vmem[row * width + col] &= 0xff00;
39
 		break;
40
 	case '\t':
41
-		if (row > (height - 1))
42
+		if (row > (height - 1)) {
43
 			row = 0;
44
+			BIOS_CursRow0 = 0;
45
+		}
46
 		col = (col + 8) & ~0x07;
47
 		if (col > width) {
48
 			col = 0;
49
 			tty_index(1);
50
 		}
51
+		BIOS_CursCol0 = col;
52
 		break;
53
 	case '\r':
54
 		col = 0;
55
+		BIOS_CursCol0 = col;
56
 		break;
57
 	case '\n':
58
 		tty_index(1);
59
@@ -1511,10 +1521,13 @@
60
 	default:
61
 		if (col >= width) {
62
 			col = 0;
63
+			BIOS_CursCol0 = 0;
64
 			tty_index(1);
65
 		}
66
-		if (row > (height - 1))
67
+		if (row > (height - 1)) {
68
 			row = 0;
69
+			BIOS_CursRow0 = 0;
70
+		}
71
 		if (attr >= 0)
72
 			vmem[row * width + col] = attr & 0xff00;
73
 		else
74
@@ -1554,7 +1567,9 @@
75
 	vmem[row * width + col++] |= c;
76
     }
77
     row = srow;
78
+    BIOS_CursRow0 = srow;
79
     col = scol;
80
+    BIOS_CursCol0 = scol;
81
     SetVREGCur();
82
 }
83
 
84
@@ -1582,7 +1597,9 @@
85
 	col++;
86
     }
87
     row = srow;
88
+    BIOS_CursRow0 = srow;
89
     col = scol;
90
+    BIOS_CursCol0 = scol;
91
     SetVREGCur();
92
 
93
     return;
94
--- /home/admin/doscmd-20040330/video.c	Mon May  1 17:41:16 2006
95
+++ video.c	Mon May  1 18:08:12 2006
96
@@ -167,14 +167,18 @@
97
 	    cp &= 0xff;
98
 	    cp |= value << 8;
99
 	    row = cp / DpyCols;
100
+	    BIOS_CursRow0 = row;
101
 	    col = cp % DpyCols;
102
+	    BIOS_CursCol0 = col;
103
 	    break;
104
 	case CRTC_CurLocLo:	/* Update cursor position in BIOS */
105
 	    cp = row * DpyCols + col;
106
 	    cp &= 0xff00;
107
 	    cp |= value;
108
 	    row = cp / DpyCols;
109
+	    BIOS_CursRow0 = row;
110
 	    col = cp % DpyCols;
111
+	    BIOS_CursCol0 = col;
112
 	    break;
113
 	default:
114
 	    debug(D_VIDEO, "VGA: outb 0x%04x, 0x%02x at index 0x%02x\n",
(-)doscmd/files/patch-desqview-timeslice (-36 lines)
Lines 1-36 Link Here
1
--- /usr/ports/emulators/doscmd/work/doscmd-20040330/bios.c	Mon Mar 29 16:00:00 2004
2
+++ bios.c	Mon May  1 18:39:31 2006
3
@@ -31,6 +31,7 @@
4
  */
5
 
6
 #include <sys/cdefs.h>
7
+#include <time.h>
8
 __FBSDID("$FreeBSD: projects/doscmd/bios.c,v 1.9 2002/03/07 12:52:26 obrien Exp $");
9
 
10
 #include "doscmd.h"
11
@@ -110,6 +111,7 @@
12
 static void
13
 int15(regcontext_t *REGS)
14
 {
15
+    const struct timespec rqtp={0,1};
16
     R_FLAGS &= ~PSL_C;
17
 
18
     switch (R_AH) {
19
@@ -119,6 +121,17 @@
20
 	break;
21
     case 0x04:			/* Set ABIOS table */
22
 	R_FLAGS |= PSL_C;	/* We don't support it */
23
+	break;
24
+    case 0x10:			/* DesqView */
25
+	switch (R_AL) {
26
+	    case 0x00:		/* Give up CPU time */
27
+		nanosleep(&rqtp, NULL);
28
+		break;
29
+	    case 0x22:		/* Get version */
30
+		R_BH = 0x0a;	/* Use v2.0 for timeslice support */
31
+		R_BL = 0x01;
32
+		break;
33
+	}
34
 	break;
35
     case 0x4f:			/* Keyboard intercept */
36
 	debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n");
(-)doscmd/files/patch-doscmd.1 (-41 lines)
Lines 1-41 Link Here
1
--- doscmd.1.orig	Tue Mar 30 08:00:00 2004
2
+++ doscmd.1	Sun Sep 23 22:46:19 2007
3
@@ -38,7 +38,7 @@
4
 .Nd run a subset of real-mode DOS programs
5
 .Sh SYNOPSIS
6
 .Nm
7
-.Fl 23AbDEfGHIMOPRrtVvXxYz
8
+.Fl 23AbDEFfGHIMOPQRrtVvXxYz
9
 .Fl c Ar file
10
 .Fl d Ar file
11
 .Fl i Ar port Ns Xo
12
@@ -139,6 +139,9 @@
13
 .\"
14
 .\"
15
 .\"
16
+.It Fl F
17
+Enables support for FOSSIL IO using stdio.
18
+.\"
19
 .It Fl G
20
 Enable debugging of the video (graphics) routines.
21
 .\"
22
@@ -212,6 +215,10 @@
23
 .Li outb ,
24
 etc).
25
 .\"
26
+.It Fl Q
27
+Suppresses all video IO. Helps optimize the input behavior especially
28
+when polling for input.
29
+.\"
30
 .\"
31
 .\"
32
 .It Fl R
33
@@ -754,7 +761,7 @@
34
 and then typing
35
 .Ic make install
36
 in the source directory (normally
37
-.Pa /usr/src/usr.bin/doscmd ) .
38
+.Pa /usr/ports/emulators/doscmd ) .
39
 For this to work, the X programmer's kit must have been installed.
40
 .Sh AUTHORS
41
 .An Pace Willisson ,
(-)doscmd/files/patch-fossil-support (-409 lines)
Lines 1-409 Link Here
1
diff -u /root/doscmd-20040330/bios.c ./bios.c
2
--- /root/doscmd-20040330/bios.c	Fri May  5 19:34:31 2006
3
+++ ./bios.c	Fri May  5 19:39:27 2006
4
@@ -297,7 +297,10 @@
5
     ivec[0x12] = vec;
6
     register_callback(vec, int12, "int 12");
7
 
8
-    vec = insert_softint_trampoline();
9
+    if(fossil)
10
+	vec = insert_fossil_softint_trampoline();
11
+    else
12
+	vec = insert_softint_trampoline();
13
     ivec[0x14] = vec;
14
     register_callback(vec, int14, "int 14");
15
 
16
diff -u /root/doscmd-20040330/callback.c ./callback.c
17
--- /root/doscmd-20040330/callback.c	Fri May  5 19:34:31 2006
18
+++ ./callback.c	Fri May  5 19:39:27 2006
19
@@ -76,6 +76,25 @@
20
     2,
21
     0,
22
 };
23
+/*
24
+ * From the FOSSIL spec:
25
+ * The driver has a "signature" that can be used to determine whether it is
26
+ * present in memory. At offset 6 in the INT 14h service routine is a word,
27
+ * 1954h,  followed  by a  byte that  specifies the maximum function number
28
+ * supported by the driver. This is to make it possible to determine when a
29
+ * driver is present and what level of functionality it provides.
30
+ */
31
+u_char fossil_softint_trampoline[] = {
32
+    0xf4,	/* HLT */
33
+    0xfb,	/* STI */
34
+    0xca,	/* RETF 2 */
35
+    2,
36
+    0,
37
+    0,
38
+    0x54,
39
+    0x19,
40
+    0x1b,	/* Max. Supported FOSSIL AH */
41
+};
42
 u_char hardint_trampoline[] = {
43
     0xf4,	/* HLT */
44
     0xcf,	/* IRET */
45
@@ -102,6 +121,13 @@
46
 {
47
     return (insert_generic_trampoline(
48
 	sizeof(softint_trampoline), softint_trampoline));
49
+}
50
+
51
+u_long
52
+insert_fossil_softint_trampoline(void)
53
+{
54
+    return (insert_generic_trampoline(
55
+	sizeof(fossil_softint_trampoline), fossil_softint_trampoline));
56
 }
57
 
58
 u_long
59
diff -u /root/doscmd-20040330/callback.h ./callback.h
60
--- /root/doscmd-20040330/callback.h	Fri May  5 19:34:31 2006
61
+++ ./callback.h	Fri May  5 19:39:27 2006
62
@@ -9,5 +9,6 @@
63
 callback_t	find_callback(u_long);
64
 u_long		insert_generic_trampoline(size_t, u_char *);
65
 u_long		insert_softint_trampoline(void);
66
+u_long		insert_fossil_softint_trampoline(void);
67
 u_long		insert_hardint_trampoline(void);
68
 u_long		insert_null_trampoline(void);
69
diff -u /root/doscmd-20040330/doscmd.c ./doscmd.c
70
--- /root/doscmd-20040330/doscmd.c	Fri May  5 19:34:31 2006
71
+++ ./doscmd.c	Fri May  5 19:39:27 2006
72
@@ -511,7 +511,7 @@
73
     FILE	*fp;
74
     char 	*col;
75
 
76
-    while ((c = getopt(argc, argv, "234AbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
77
+    while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
78
 	switch (c) {
79
 	case '2':
80
 	    debug_flags |= D_TRAPS2;
81
@@ -551,6 +551,9 @@
82
 	    break;
83
 	case 'E':
84
 	    debug_flags |= D_EXEC;
85
+	    break;
86
+	case 'F':
87
+	    fossil = 1;
88
 	    break;
89
 	case 'G':
90
 	    debug_flags |= D_VIDEO;
91
diff -u /root/doscmd-20040330/doscmd.h ./doscmd.h
92
--- /root/doscmd-20040330/doscmd.h	Fri May  5 19:34:31 2006
93
+++ ./doscmd.h	Fri May  5 19:39:27 2006
94
@@ -224,6 +224,9 @@
95
 extern int	search_floppy(int i);
96
 extern void	disk_bios_init(void);
97
 
98
+/* int14.c */
99
+extern int	fossil;
100
+
101
 /* int16.c */
102
 void	int16(regcontext_t *);
103
 
104
diff -u /root/doscmd-20040330/int14.c ./int14.c
105
--- /root/doscmd-20040330/int14.c	Fri May  5 19:34:31 2006
106
+++ ./int14.c	Fri May  5 20:23:09 2006
107
@@ -46,6 +46,9 @@
108
 #include "AsyncIO.h"
109
 #include "com.h"
110
 
111
+/* exports */
112
+int fossil = 0;
113
+
114
 #define N_BYTES	1024
115
 
116
 struct com_data_struct {
117
@@ -58,7 +61,9 @@
118
 	int		ids;            /* input data size */
119
 	int		ods;            /* output data size */
120
 	int		emptyint;
121
+	int		fossil_mode;	/* FOSSIL has been enabled */
122
 	struct termios	tty;
123
+	unsigned char	param;		/* Copy of init params */
124
 	unsigned char	div_latch[2];	/* mirror of 16550 R0':R1'
125
 					   read/write */
126
 	unsigned char	int_enable;	/* mirror of 16550 R1 read/write */
127
@@ -257,7 +262,7 @@
128
     struct com_data_struct *cdsp;
129
     int i;
130
 
131
-    debug(D_PORT, "int14: dl = 0x%02X, al = 0x%02X.\n", R_DL, R_AL);
132
+    debug(D_PORT, "int14: ah = 0x%02X, dl = 0x%02X, al = 0x%02X.\n", R_AH, R_DL, R_AL);
133
     if (R_DL >= N_COMS_MAX) {
134
 	if (vflag)
135
 	    dump_regs(REGS);
136
@@ -269,16 +274,31 @@
137
     case 0x00:	/* Initialize Serial Port */
138
 	com_set_line(cdsp, R_DL + 1, R_AL);
139
 	R_AH = get_status(cdsp);
140
-	R_AL = 0;
141
+	if (cdsp->fossil_mode) {
142
+	    R_AL = 0x08;
143
+	    R_AL |= 0x80;
144
+	}
145
+	else
146
+	    R_AL = 0;
147
 	break;
148
 
149
     case 0x01:	/* Write Character */
150
     	if (write_char(cdsp, R_AL)) {
151
-		R_AH = get_status(cdsp);
152
+	    R_AH = get_status(cdsp);
153
+	    if (cdsp->fossil_mode) {
154
+		R_AL = 0x08;
155
+		R_AL |= 0x80;
156
+	    }
157
+	    else
158
 		R_AL = 0;
159
 	} else {
160
-		debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL);
161
-		R_AH = LS_SW_TIME_OUT;
162
+	    debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL);
163
+	    R_AH = LS_SW_TIME_OUT;
164
+	    if (cdsp->fossil_mode) {
165
+		R_AL = 0x08;
166
+		R_AL |= 0x80;
167
+	    }
168
+	    else
169
 		R_AL = 0;
170
 	}
171
 	break;
172
@@ -296,28 +316,193 @@
173
 
174
     case 0x03:	/* Status Request */
175
 	R_AH = get_status(cdsp);
176
-	R_AL = 0;
177
+	if (cdsp->fossil_mode) {
178
+	    R_AL = 0x08;
179
+	    R_AL |= 0x80;
180
+	}
181
+	else
182
+	    R_AL = 0;
183
 	break;
184
 
185
     case 0x04:	/* Extended Initialization */
186
-	R_AX = (LS_SW_TIME_OUT) << 8;
187
+	if (fossil) {
188
+	    cdsp->fossil_mode = 1;
189
+	    R_AX = 0x1954;
190
+	    R_BL = 0x1b;	/* Max supported FOSSIL AH */
191
+	    R_BH = 5;
192
+	}
193
+	else
194
+	    R_AX = (LS_SW_TIME_OUT) << 8;
195
 	break;
196
 
197
-    case 0x05:	/* Modem Control Register operations */
198
-	switch (R_AH) {
199
-	case 0x00:	/* Read Modem Control Register */
200
+    case 0x05:	/* Modem Control Register operations/FOSSIL deinit */
201
+	if (fossil && cdsp->fossil_mode)
202
+	    cdsp->fossil_mode = 0;
203
+	else {
204
+	    switch (R_AH) {
205
+	    case 0x00:	/* Read Modem Control Register */
206
 		R_AX = (LS_SW_TIME_OUT) << 8;
207
 		break;
208
 
209
-	case 0x01:	/* Write Modem Control Register */
210
+	    case 0x01:	/* Write Modem Control Register */
211
 		R_AX = (LS_SW_TIME_OUT) << 8;
212
 		break;
213
 
214
-	default:
215
+	    default:
216
 		unknown_int3(0x14, 0x05, R_AL, REGS);
217
 		break;
218
+	    }
219
 	}
220
 	break;
221
+
222
+    case 0x06:	/* FOSSIL raise/lower DTR */
223
+	if(cdsp->fossil_mode) {
224
+	    switch (R_AL) {
225
+	    case 0:
226
+		ioctl(cdsp->fd, TIOCCDTR);
227
+		break;
228
+	    case 1:
229
+		ioctl(cdsp->fd, TIOCSDTR);
230
+		break;
231
+	    }
232
+	    break;
233
+	}
234
+
235
+    case 0x08:	/* FOSSIL Flush output buffer */
236
+	if(cdsp->fossil_mode) {
237
+	    flush_out(cdsp);
238
+	    break;
239
+	}
240
+
241
+    case 0x09:	/* FOSSIL Purge output buffer */
242
+	if(cdsp->fossil_mode) {
243
+	    cdsp->ods = 0;
244
+	    break;
245
+	}
246
+
247
+    case 0x0a:	/* FOSSIL Purge input buffer */
248
+	if(cdsp->fossil_mode) {
249
+	    cdsp->ids = 0;
250
+	    break;
251
+	}
252
+
253
+    case 0x0b:	/* FOSSIL Transmit no wait */
254
+	if(cdsp->fossil_mode) {
255
+	    if (cdsp->ods < N_BYTES) {
256
+		if (write_char(cdsp, R_AL))
257
+		    R_AX = 1;
258
+	        else
259
+		    R_AX = 0;
260
+	    }
261
+	    else
262
+		R_AX = 0;
263
+	    break;
264
+	}
265
+
266
+    case 0x0c:	/* FOSSIL Non-destructive read-ahead */
267
+	if(cdsp->fossil_mode) {
268
+	    if(cdsp->ods) {
269
+		R_AH = 0;
270
+		R_AL = cdsp->inbuf[0];
271
+	    } else
272
+		R_AX = 0xffff;
273
+	    break;
274
+	}
275
+
276
+    case 0x0f:	/* FOSSIL Set flow control */
277
+	if(cdsp->fossil_mode) {
278
+	    if(R_AL & 0x01)	/* Enable output Xon/Xoff */
279
+		cdsp->tty.c_iflag |= IXON;
280
+	    else
281
+		cdsp->tty.c_iflag &= ~(IXON);
282
+
283
+	    if(R_AL & 0x02)	/* Enable CTR/RTS */
284
+		cdsp->tty.c_cflag |= CCTS_OFLOW|CRTS_IFLOW;
285
+	    else
286
+		cdsp->tty.c_iflag &= ~(CCTS_OFLOW|CRTS_IFLOW);
287
+
288
+	    if(R_AL & 0x08)	/* Enable input Xon/Xoff */
289
+		cdsp->tty.c_iflag |= IXOFF;
290
+	    else
291
+		cdsp->tty.c_iflag &= ~(IXOFF);
292
+
293
+	    tcsetattr(cdsp->fd, 0, &cdsp->tty);
294
+	    break;
295
+	}
296
+
297
+    case 0x18:	/* FOSSIL Read block */
298
+	if(cdsp->fossil_mode) {
299
+	    int rd = R_CX;
300
+
301
+ 	    input(cdsp, 0);
302
+	    if(rd > cdsp->ids)
303
+		rd=cdsp->ids;
304
+	    if(rd) {
305
+		memmove((char *)MAKEPTR(R_ES, R_DI), cdsp->inbuf, rd);
306
+		if(rd < cdsp->ids)
307
+		    memmove(cdsp->inbuf, cdsp->inbuf + rd, N_BYTES - rd);
308
+		cdsp->ids -= rd;
309
+		R_AX = rd;
310
+	    } else
311
+		R_AX = 0;
312
+	    break;
313
+	}
314
+
315
+    case 0x19:	/* FOSSIL Write block */
316
+	if(cdsp->fossil_mode) {
317
+	    int wr = R_CX;
318
+	    if(wr > N_BYTES - cdsp->ods)
319
+		wr=N_BYTES - cdsp->ods;
320
+	    if(wr) {
321
+		memcpy(cdsp->outbuf + cdsp->ods, (char *)MAKEPTR(R_ES, R_DI), wr);
322
+		cdsp->ods += wr;
323
+		output(cdsp);
324
+		R_AX = wr;
325
+	    } else
326
+		R_AX = 0;
327
+	    break;
328
+	}
329
+
330
+    case 0x1a:	/* FOSSIL Break begin/end */
331
+	if(cdsp->fossil_mode) {
332
+	    switch(R_AL) {
333
+	    case 0:
334
+		ioctl(cdsp->fd, TIOCCBRK);
335
+		break;
336
+	    case 1:
337
+		ioctl(cdsp->fd, TIOCSBRK);
338
+		break;
339
+	    }
340
+	    break;
341
+	}
342
+
343
+    case 0x1b:	/* FOSSIL Driver information */
344
+	if(cdsp->fossil_mode) {
345
+	    unsigned char *p;
346
+	    int  bufpos=0;
347
+	    int  info_size=19;
348
+	    const char *id_string="doscmd FOSSIL";
349
+	    p = (unsigned char *)MAKEPTR(R_ES, R_DI);
350
+	    p[bufpos++]=info_size&0xff;
351
+	    p[bufpos++]=(info_size>>8)&0xff;
352
+	    p[bufpos++]=5;
353
+	    p[bufpos++]=0;
354
+	    PUTVEC(*(u_short *)p, *(ushort *)(p + sizeof(u_short)), (u_long)id_string);
355
+	    bufpos+=sizeof(u_short)*2;
356
+	    p[bufpos++]=N_BYTES & 0xff;
357
+	    p[bufpos++]=(N_BYTES>>8) & 0xff;
358
+	    p[bufpos++]=(N_BYTES - cdsp->ids) & 0xff;
359
+	    p[bufpos++]=((N_BYTES - cdsp->ids) >> 8) & 0xff;
360
+	    p[bufpos++]=N_BYTES & 0xff;
361
+	    p[bufpos++]=(N_BYTES>>8) & 0xff;
362
+	    p[bufpos++]=(N_BYTES - cdsp->ods) & 0xff;
363
+	    p[bufpos++]=((N_BYTES - cdsp->ods) >> 8) & 0xff;
364
+	    p[bufpos++]=80;
365
+	    p[bufpos++]=25;
366
+	    p[bufpos++]=cdsp->param & BITRATE_9600;
367
+	    break;
368
+	}
369
+
370
     default:
371
 	unknown_int2(0x14, R_AH, REGS);
372
 	break;
373
@@ -353,6 +538,7 @@
374
 	      port, cdsp->path);
375
 	return;
376
     }
377
+    cdsp->param = param;
378
     
379
     cdsp->ids = cdsp->ods = cdsp->emptyint = 0;
380
     cdsp->int_enable = 0;
381
@@ -402,12 +588,24 @@
382
     }
383
     switch (param & BITRATE_9600) {
384
     case BITRATE_110:
385
-	speed = B110;
386
-	spd = 110;
387
+	if (fossil) {
388
+	    speed = B19200;
389
+	    spd = 19200;
390
+	}
391
+	else {
392
+	    speed = B110;
393
+	    spd = 110;
394
+	}
395
 	break;
396
     case BITRATE_150:
397
-	speed = B150;
398
-	spd = 150;
399
+	if (fossil) {
400
+	    speed = B38400;
401
+	    spd = 38400;
402
+	}
403
+	else {
404
+	    speed = B150;
405
+	    spd = 150;
406
+	}
407
 	break;
408
     case BITRATE_300:
409
 	speed = B300;
(-)doscmd/files/patch-quietmode (-317 lines)
Lines 1-317 Link Here
1
diff -u ./debug.c /home/admin/doscmd.working/doscmd-20040330/debug.c
2
--- ./debug.c	Mon Mar 29 16:00:00 2004
3
+++ /home/admin/doscmd.working/doscmd-20040330/debug.c	Wed May  3 13:58:35 2006
4
@@ -106,7 +106,7 @@
5
 
6
     dead = 1;
7
 
8
-    if (xmode) {
9
+    if (xmode && !quietmode) {
10
 	char buf[1024];
11
 	const char *m;
12
 
13
diff -u ./dos.c /home/admin/doscmd.working/doscmd-20040330/dos.c
14
--- ./dos.c	Mon Mar 29 16:00:00 2004
15
+++ /home/admin/doscmd.working/doscmd-20040330/dos.c	Wed May  3 13:58:35 2006
16
@@ -625,9 +625,12 @@
17
 {
18
     int		n;
19
     
20
-    /* XXX this is pretty bogus, actually */
21
-    if (!xmode) {
22
-	R_AL = 0xff;		/* no X mode, always claim data available */
23
+    if (quietmode && !xmode) {
24
+	const struct timespec rqtp={0,1};
25
+
26
+	/* In case of camping */
27
+	nanosleep(&rqtp, NULL);
28
+	R_AL = 0;
29
 	return(0);
30
     }
31
     /* XXX tty_peek is broken */
32
diff -u ./doscmd.c /home/admin/doscmd.working/doscmd-20040330/doscmd.c
33
--- ./doscmd.c	Wed May  3 14:06:55 2006
34
+++ /home/admin/doscmd.working/doscmd-20040330/doscmd.c	Wed May  3 13:58:35 2006
35
@@ -64,6 +64,7 @@
36
 int		capture_fd = -1;
37
 int		dead = 0;
38
 int		xmode = 0;
39
+int		quietmode = 0;
40
 int		booting = 0;
41
 int		raw_kbd = 0;
42
 int		timer_disable = 0;
43
@@ -226,7 +227,7 @@
44
     kbd_init();
45
     kbd_bios_init();
46
     video_init();
47
-    if (xmode)
48
+    if (xmode || quietmode)
49
 	mouse_init();
50
     video_bios_init();
51
     disk_bios_init();
52
@@ -511,7 +512,7 @@
53
     FILE	*fp;
54
     char 	*col;
55
 
56
-    while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
57
+    while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:PpQ:RrS:TtU:vVxXYz")) != -1) {
58
 	switch (c) {
59
 	case '2':
60
 	    debug_flags |= D_TRAPS2;
61
@@ -620,6 +621,9 @@
62
 		define_output_port_handler(p++, outb_port);
63
 	    }
64
 	    break;
65
+	case 'Q':
66
+	    quietmode = 1;
67
+	    break;
68
 	case 'R':
69
 	    debug_flags |= D_REDIR;
70
 	    break;
71
@@ -826,7 +830,7 @@
72
 done(regcontext_t *REGS, int val)
73
 {
74
     if (curpsp < 2) {
75
-	if (xmode) {
76
+	if (xmode && !quietmode) {
77
 	    const char *m;
78
 
79
 	    tty_move(24, 0);
80
@@ -861,7 +865,7 @@
81
 	coq = coq->next;
82
 	c->func(c->arg);
83
     }
84
-    if (!xmode)		/* XXX not for bootmode */
85
+    if (!(xmode || quietmode))		/* XXX not for bootmode */
86
 	puts("\n");
87
     exit(status);
88
 }
89
diff -u ./doscmd.h /home/admin/doscmd.working/doscmd-20040330/doscmd.h
90
--- ./doscmd.h	Wed May  3 14:06:55 2006
91
+++ /home/admin/doscmd.working/doscmd-20040330/doscmd.h	Wed May  3 13:58:35 2006
92
@@ -175,6 +175,7 @@
93
 extern int		capture_fd;
94
 extern int		dead;
95
 extern int		xmode;
96
+extern int		quietmode;
97
 extern int		booting;
98
 extern int		raw_kbd;
99
 extern int		timer_disable;
100
diff -u ./int10.c /home/admin/doscmd.working/doscmd-20040330/int10.c
101
--- ./int10.c	Mon Mar 29 16:00:00 2004
102
+++ /home/admin/doscmd.working/doscmd-20040330/int10.c	Wed May  3 13:58:35 2006
103
@@ -57,7 +57,7 @@
104
 
105
 	switch (R_AH) {
106
 	case 0x00:		/* Set display mode */
107
-		if (!xmode)
108
+		if (!(xmode || quietmode))
109
 			goto unsupported;
110
 		init_mode(R_AL);
111
 		break;
112
@@ -94,12 +94,12 @@
113
 		break;
114
 	}
115
 	case 0x02:		/* Position cursor */
116
-		if (!xmode)
117
+		if (!(xmode || quietmode))
118
 			goto unsupported;
119
 		tty_move(R_DH, R_DL);
120
 		break;
121
 	case 0x03:		/* Read cursor position */
122
-		if (!xmode)
123
+		if (!(xmode || quietmode))
124
 			goto unsupported;
125
 		tty_report(&i, &j);
126
 		R_DH = i;
127
@@ -111,7 +111,7 @@
128
 		debug(D_VIDEO, "Select current display page %d\n", R_AL);
129
 		break;
130
 	case 0x06:		/* initialize window/scroll text upward */
131
-		if (!xmode)
132
+		if (!(xmode || quietmode))
133
 			goto unsupported;
134
 		if (R_AL == 0)		/* clear screen */
135
 			R_AL = DpyRows + 1;
136
@@ -120,7 +120,7 @@
137
 		    R_AL, R_BH << 8);
138
 		break;
139
 	case 0x07:		/* initialize window/scroll text downward */
140
-		if (!xmode)
141
+		if (!(xmode || quietmode))
142
 			goto unsupported;
143
 		if (R_AL == 0)		/* clear screen */
144
 			R_AL = DpyRows + 1;
145
@@ -129,24 +129,24 @@
146
 		    R_AL, R_BH << 8);
147
 		break;
148
 	case 0x08:		/* read character/attribute */
149
-		if (!xmode)
150
+		if (!(xmode || quietmode))
151
 			goto unsupported;
152
 		i = tty_char(-1, -1);
153
 		R_AX = i;
154
 		break;
155
 	case 0x09:		/* write character/attribute */
156
-		if (!xmode)
157
+		if (!(xmode || quietmode))
158
 			goto unsupported;
159
 		tty_rwrite(R_CX, R_AL, R_BL << 8);
160
 		break;
161
 	case 0x0a:		/* write character */
162
-		if (!xmode)
163
+		if (!(xmode || quietmode))
164
 			goto unsupported;
165
 		debug(D_HALF, "Int 10:0a: Write char: %02x\n", R_AL);
166
 		tty_rwrite(R_CX, R_AL, -1);
167
 		break;
168
 	case 0x0b:		/* set border color */
169
-		if (!xmode)
170
+		if (!(xmode || quietmode))
171
 			goto unsupported;
172
 		video_setborder(R_BL);
173
 		break;
174
@@ -165,7 +165,7 @@
175
 		R_BH = 0;/*ActivePage *//* display page */
176
 		break;
177
 	case 0x10:
178
-		if (!xmode)
179
+		if (!(xmode || quietmode))
180
 			goto unsupported;
181
 		switch (R_AL) {
182
 		case 0x00:		/* Set single palette register */
183
@@ -350,7 +350,7 @@
184
 		}
185
 		break;
186
 	case 0x12:		/* Alternate function select */
187
-		if (!xmode)
188
+		if (!(xmode || quietmode))
189
 			goto unsupported;
190
 		switch (R_BL) {
191
 		case 0x10:	/* Read EGA/VGA config */
192
@@ -372,7 +372,7 @@
193
 		}
194
 		break;
195
 	case 0x13: /* write character string */
196
-		if (!xmode)
197
+		if (!(xmode || quietmode))
198
 			goto unsupported;
199
                 addr = (char *)MAKEPTR(R_ES, R_BP);
200
 		switch (R_AL & 0x03) {
201
@@ -407,7 +407,7 @@
202
 		}
203
 		break;
204
 	case 0x1a:
205
-		if (!xmode)
206
+		if (!(xmode || quietmode))
207
 			goto unsupported;
208
 		R_AL = 0x1a;		/* I am VGA */
209
 		R_BL = 8;		/* Color VGA */
210
diff -u ./int16.c /home/admin/doscmd.working/doscmd-20040330/int16.c
211
--- ./int16.c	Mon Mar 29 16:00:00 2004
212
+++ /home/admin/doscmd.working/doscmd-20040330/int16.c	Wed May  3 13:58:35 2006
213
@@ -78,7 +78,7 @@
214
 void
215
 int16(regcontext_t *REGS)
216
 {               
217
-    if (!xmode && !raw_kbd) {
218
+    if (!(xmode || raw_kbd || quietmode)) {
219
 	if (vflag) dump_regs(REGS);
220
 	fatal ("int16 func 0x%x only supported in X mode\n", R_AH);
221
     }
222
diff -u ./tty.c /home/admin/doscmd.working/doscmd-20040330/tty.c
223
--- ./tty.c	Wed May  3 14:06:55 2006
224
+++ /home/admin/doscmd.working/doscmd-20040330/tty.c	Wed May  3 13:58:35 2006
225
@@ -34,6 +34,7 @@
226
 __FBSDID("$FreeBSD: projects/doscmd/tty.c,v 1.25 2002/04/12 21:18:05 charnier Exp $");
227
 
228
 #include <sys/ioctl.h>
229
+#include <sys/select.h>
230
 #include <sys/time.h>
231
 #include <sys/types.h>
232
 #include <sys/mman.h>
233
@@ -1471,7 +1472,8 @@
234
 {
235
     	if (attr == TTYF_REDIRECT) {
236
 		if (redirect1) {
237
-		    write(1, &c, 1);
238
+		    if(!quietmode)
239
+			write(1, &c, 1);
240
 		    return;
241
 		}
242
 		attr = -1;
243
@@ -1487,8 +1489,10 @@
244
 #ifndef NO_X
245
 			XBell(dpy, 0);
246
 #endif
247
-		} else
248
+		} else {
249
+		    if(!quietmode)
250
 			write(1, "\007", 1);
251
+		}
252
 		break;
253
 	case 0x08:
254
 		if (row > (height - 1) || col > width)
255
@@ -1658,20 +1662,14 @@
256
 {
257
     int r;
258
 
259
+    if(quietmode && !xmode)
260
+	return(0);
261
+
262
     if ((r = nextchar) != 0) {
263
 	nextchar = 0;
264
 	return(r & 0xff);
265
     }
266
 
267
-    if ((flag & TTYF_REDIRECT) && redirect0) {
268
-	char c;
269
-    	if (read(STDIN_FILENO, &c, 1) != 1)
270
-	    return(-1);
271
-	if (c == '\n')
272
-	    c = '\r';
273
-	return(c);
274
-    }
275
-
276
     if (KbdEmpty()) {
277
 	if (flag & TTYF_BLOCK) {
278
 	    while (KbdEmpty())
279
@@ -1858,6 +1856,22 @@
280
 int
281
 KbdEmpty()
282
 {
283
+	if(!xmode) {
284
+	    fd_set rd;
285
+	    struct timeval tv;
286
+
287
+	    FD_ZERO(&rd);
288
+	    FD_SET(STDIN_FILENO, &rd);
289
+	    tv.tv_sec=0;
290
+	    tv.tv_usec=0;
291
+	    if(select(STDIN_FILENO+1, &rd, NULL, NULL, &tv)==1) {
292
+		char ch=0;
293
+		read(STDIN_FILENO, &ch, 1);
294
+		if(ch == '\n')
295
+			ch = '\r';
296
+		KbdWrite(ch);
297
+	    }
298
+	}
299
 	return(K_NEXT == K_FREE);
300
 }
301
 
302
diff -u ./video.c /home/admin/doscmd.working/doscmd-20040330/video.c
303
--- ./video.c	Wed May  3 14:06:55 2006
304
+++ /home/admin/doscmd.working/doscmd-20040330/video.c	Wed May  3 13:58:35 2006
305
@@ -276,9 +276,9 @@
306
 	define_output_port_handler(GDC_DataPort, video_outb);
307
     }
308
 	
309
-    redirect0 = isatty(0) == 0 || !xmode ;
310
-    redirect1 = isatty(1) == 0 || !xmode ;
311
-    redirect2 = isatty(2) == 0 || !xmode ;
312
+    redirect0 = isatty(0) == 0 || !(xmode || quietmode);
313
+    redirect1 = isatty(1) == 0 || !(xmode || quietmode);
314
+    redirect2 = isatty(2) == 0 || !(xmode || quietmode);
315
 
316
     return;
317
 }
(-)doscmd/pkg-message (+6 lines)
Line 0 Link Here
1
NOTE:
2
=====
3
For security reasons, FreeBSD no longer allows mmap() at zero.
4
To remove this security protection and allow doscmd to work, you will need
5
to set sysctl security.bsd.map_at_zero=1 either before running doscmd or
6
in /etc/sysctl.conf.

Return to bug 160217