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

Collapse All | Expand All

(-)doscmd.bbs/doscmd.c (-3 / +12 lines)
Lines 31-37 Link Here
31
 */
31
 */
32
32
33
#include <sys/cdefs.h>
33
#include <sys/cdefs.h>
34
__FBSDID("$FreeBSD: projects/doscmd/doscmd.c,v 1.25 2002/03/07 12:52:26 obrien Exp $");
34
__FBSDID("$FreeBSD: src/usr.bin/doscmd/doscmd.c,v 1.13.2.6 2002/04/25 11:04:51 tg Exp $");
35
35
36
#include <sys/types.h>
36
#include <sys/types.h>
37
#include <sys/param.h>
37
#include <sys/param.h>
Lines 53-58 Link Here
53
#include <sys/proc.h>
53
#include <sys/proc.h>
54
#include <machine/sysarch.h>
54
#include <machine/sysarch.h>
55
#include <machine/vm86.h>
55
#include <machine/vm86.h>
56
#include <termios.h>
56
57
57
#include "doscmd.h"
58
#include "doscmd.h"
58
#include "cwd.h"
59
#include "cwd.h"
Lines 67-72 Link Here
67
int		booting = 0;
68
int		booting = 0;
68
int		raw_kbd = 0;
69
int		raw_kbd = 0;
69
int		timer_disable = 0;
70
int		timer_disable = 0;
71
int		doormode = 0;
70
struct timeval	boot_time;
72
struct timeval	boot_time;
71
unsigned long	*ivec = (unsigned long *)0;
73
unsigned long	*ivec = (unsigned long *)0;
72
74
Lines 510-517 Link Here
510
    int 	i,c,p;
512
    int 	i,c,p;
511
    FILE	*fp;
513
    FILE	*fp;
512
    char 	*col;
514
    char 	*col;
515
	struct termios tio_raw;
513
516
514
    while ((c = getopt(argc, argv, "234AbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
517
    while ((c = getopt(argc, argv, "234ABbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
515
	switch (c) {
518
	switch (c) {
516
	case '2':
519
	case '2':
517
	    debug_flags |= D_TRAPS2;
520
	    debug_flags |= D_TRAPS2;
Lines 527-532 Link Here
527
	    for (c = 0; c < 256; ++c)
530
	    for (c = 0; c < 256; ++c)
528
		debug_set(c);
531
		debug_set(c);
529
	    break;
532
	    break;
533
	case 'B':	/* "BBS" mode */
534
		doormode = 1;
535
	tcgetattr(fileno(stdin),&tio_raw);
536
	cfmakeraw(&tio_raw);
537
	tcsetattr(fileno(stdin),TCSANOW,&tio_raw);
538
		break;
530
	case 'b':
539
	case 'b':
531
	    booting = 1;
540
	    booting = 1;
532
	    break;
541
	    break;
Lines 823-829 Link Here
823
done(regcontext_t *REGS, int val)
832
done(regcontext_t *REGS, int val)
824
{
833
{
825
    if (curpsp < 2) {
834
    if (curpsp < 2) {
826
	if (xmode) {
835
	if (xmode && !doormode) {
827
	    const char *m;
836
	    const char *m;
828
837
829
	    tty_move(24, 0);
838
	    tty_move(24, 0);
(-)doscmd.bbs/doscmd.h (-1 / +2 lines)
Lines 29-35 Link Here
29
 *
29
 *
30
 *	BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
30
 *	BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
31
 *
31
 *
32
 * $FreeBSD: projects/doscmd/doscmd.h,v 1.14 2002/02/17 17:18:04 deischen Exp $
32
 * $FreeBSD: src/usr.bin/doscmd/doscmd.h,v 1.7.2.1 2002/04/25 11:04:51 tg Exp $
33
 */
33
 */
34
34
35
35
Lines 178-183 Link Here
178
extern int		booting;
178
extern int		booting;
179
extern int		raw_kbd;
179
extern int		raw_kbd;
180
extern int		timer_disable;
180
extern int		timer_disable;
181
extern int		doormode;
181
extern char		cmdname[];
182
extern char		cmdname[];
182
extern struct timeval	boot_time;
183
extern struct timeval	boot_time;
183
extern unsigned long	*ivec;
184
extern unsigned long	*ivec;
(-)doscmd.bbs/int14.c (-17 / +63 lines)
Lines 34-43 Link Here
34
 */
34
 */
35
35
36
#include <sys/cdefs.h>
36
#include <sys/cdefs.h>
37
__FBSDID("$FreeBSD: projects/doscmd/int14.c,v 1.9 2002/03/30 13:51:40 dwmalone Exp $");
37
__FBSDID("$FreeBSD: src/usr.bin/doscmd/int14.c,v 1.2.2.1 2002/04/25 11:04:51 tg Exp $");
38
38
39
#include <sys/ioctl.h>
39
#include <sys/ioctl.h>
40
#include <sys/types.h>
40
#include <sys/types.h>
41
#include <sys/time.h>
41
#include <sys/uio.h>
42
#include <sys/uio.h>
42
#include <termios.h>
43
#include <termios.h>
43
#include <unistd.h>
44
#include <unistd.h>
Lines 113-119 Link Here
113
input(struct com_data_struct *cdsp, int force_read)
114
input(struct com_data_struct *cdsp, int force_read)
114
{
115
{
115
 	int nbytes;
116
 	int nbytes;
117
	fd_set	rfds;
118
	struct timeval timeout={0,0};
116
 
119
 
120
	if(doormode)  {
121
		cdsp->fd = STDIN_FILENO;
122
	}
123
	
117
 	if (cdsp->ids < N_BYTES && (force_read || !has_enough_data(cdsp))) {
124
 	if (cdsp->ids < N_BYTES && (force_read || !has_enough_data(cdsp))) {
118
 		nbytes = read(cdsp->fd, &cdsp->inbuf[cdsp->ids],
125
 		nbytes = read(cdsp->fd, &cdsp->inbuf[cdsp->ids],
119
		    N_BYTES - cdsp->ids);
126
		    N_BYTES - cdsp->ids);
Lines 130-135 Link Here
130
{
137
{
131
 	int nbytes;
138
 	int nbytes;
132
 
139
 
140
 	if(doormode)  {
141
		cdsp->fd = STDOUT_FILENO;
142
	}
143
	
133
 	if (cdsp->ods > 0) {
144
 	if (cdsp->ods > 0) {
134
 		nbytes = write(cdsp->fd, &cdsp->outbuf[0], cdsp->ods);
145
 		nbytes = write(cdsp->fd, &cdsp->outbuf[0], cdsp->ods);
135
 		debug(D_PORT, "write of fd %d on '%s' returned %d (%s)\n",
146
 		debug(D_PORT, "write of fd %d on '%s' returned %d (%s)\n",
Lines 206-218 Link Here
206
get_status(struct com_data_struct *cdsp)
217
get_status(struct com_data_struct *cdsp)
207
{
218
{
208
 	unsigned char s = (LS_X_DATA_E | LS_X_HOLD_E);
219
 	unsigned char s = (LS_X_DATA_E | LS_X_HOLD_E);
209
 	if (cdsp->ids > 0)
220
	fd_set	rfds;
210
 		s |= LS_RCV_DATA_RD;
221
	struct timeval timeout={0,0};
211
 	if (cdsp->ods > 0) {
222
	
212
 		s &= ~LS_X_DATA_E;
223
	if (doormode)  {
213
 		if (cdsp->ods >= N_BYTES)
224
		FD_ZERO(&rfds);
214
 			s &= ~LS_X_HOLD_E;
225
		FD_SET(STDIN_FILENO,&rfds);
215
 	}
226
		if(select(STDIN_FILENO+1,&rfds,NULL,NULL,&timeout)!=0)  {
227
			s |= LS_RCV_DATA_RD;
228
			debug(D_PORT,"READ away!");
229
		}
230
	}
231
	else  {
232
 		if (cdsp->ids > 0)
233
 			s |= LS_RCV_DATA_RD;
234
 		if (cdsp->ods > 0) {
235
 			s &= ~LS_X_DATA_E;
236
 			if (cdsp->ods >= N_BYTES)
237
 				s &= ~LS_X_HOLD_E;
238
 		}
239
	}
216
 	debug(D_PORT, "get_status: %x\n", (unsigned)s);
240
 	debug(D_PORT, "get_status: %x\n", (unsigned)s);
217
 	return s;
241
 	return s;
218
}
242
}
Lines 238-244 Link Here
238
}
262
}
239
 
263
 
240
static void
264
static void
241
com_async(int fd __unused, int cond, void *arg, regcontext_t *REGS __unused)
265
com_async(int fd, int cond, void *arg, regcontext_t *REGS)
242
{
266
{
243
 	struct com_data_struct *cdsp = (struct com_data_struct*) arg;
267
 	struct com_data_struct *cdsp = (struct com_data_struct*) arg;
244
 
268
 
Lines 257-263 Link Here
257
    struct com_data_struct *cdsp;
281
    struct com_data_struct *cdsp;
258
    int i;
282
    int i;
259
283
260
    debug(D_PORT, "int14: dl = 0x%02X, al = 0x%02X.\n", R_DL, R_AL);
284
    debug(D_PORT, "int14: dl = 0x%02X, ah= 0x%02X, al = 0x%02X.\n", R_DL, R_AH, R_AL);
261
    if (R_DL >= N_COMS_MAX) {
285
    if (R_DL >= N_COMS_MAX) {
262
	if (vflag)
286
	if (vflag)
263
	    dump_regs(REGS);
287
	    dump_regs(REGS);
Lines 267-275 Link Here
267
291
268
    switch (R_AH) {
292
    switch (R_AH) {
269
    case 0x00:	/* Initialize Serial Port */
293
    case 0x00:	/* Initialize Serial Port */
270
	com_set_line(cdsp, R_DL + 1, R_AL);
294
	if (doormode)  {
271
	R_AH = get_status(cdsp);
295
	    R_AH=0x19;
272
	R_AL = 0;
296
	    R_AL=0x54;
297
	    R_BL=0x10;
298
	    R_BH=5;
299
	}
300
	else  {
301
	    com_set_line(cdsp, R_DL + 1, R_AL);
302
	    R_AH = get_status(cdsp);
303
	    R_AL = 0;
304
	}
273
	break;
305
	break;
274
306
275
    case 0x01:	/* Write Character */
307
    case 0x01:	/* Write Character */
Lines 295-302 Link Here
295
	break;
327
	break;
296
328
297
    case 0x03:	/* Status Request */
329
    case 0x03:	/* Status Request */
330
	cdsp->fd=STDIN_FILENO;
298
	R_AH = get_status(cdsp);
331
	R_AH = get_status(cdsp);
299
	R_AL = 0;
332
	R_AL = 128;
300
	break;
333
	break;
301
334
302
    case 0x04:	/* Extended Initialization */
335
    case 0x04:	/* Extended Initialization */
Lines 318-323 Link Here
318
		break;
351
		break;
319
	}
352
	}
320
	break;
353
	break;
354
    case 0x08:	/* Flush output buffer */
355
	flush_out(cdsp);
356
    	break;
357
    case 0x09:	/* Purge output buffer */
358
	if (doormode)  {
359
		fpurge(stdout);
360
	}
361
    	break;
362
    case 0x0a:	/* Flush output buffer */
363
	if (doormode)  {
364
		fpurge(stdin);
365
	}
366
    	break;
321
    default:
367
    default:
322
	unknown_int2(0x14, R_AH, REGS);
368
	unknown_int2(0x14, R_AH, REGS);
323
	break;
369
	break;
Lines 353-359 Link Here
353
	      port, cdsp->path);
399
	      port, cdsp->path);
354
	return;
400
	return;
355
    }
401
    }
356
    
402
357
    cdsp->ids = cdsp->ods = cdsp->emptyint = 0;
403
    cdsp->ids = cdsp->ods = cdsp->emptyint = 0;
358
    cdsp->int_enable = 0;
404
    cdsp->int_enable = 0;
359
    cdsp->fifo_ctrl = 0;
405
    cdsp->fifo_ctrl = 0;
Lines 384-390 Link Here
384
    } else {
430
    } else {
385
	cdsp->tty.c_cflag &= ~CSTOPB;
431
	cdsp->tty.c_cflag &= ~CSTOPB;
386
	cdsp->line_ctrl &= ~LC_STOP_B;
432
	cdsp->line_ctrl &= ~LC_STOP_B;
387
    }    
433
    }
388
    switch (param & PARITY_EVEN) {
434
    switch (param & PARITY_EVEN) {
389
    case PARITY_ODD:
435
    case PARITY_ODD:
390
	cdsp->tty.c_cflag |= (PARENB | PARODD);
436
	cdsp->tty.c_cflag |= (PARENB | PARODD);
Lines 448-454 Link Here
448
    ret_val = cfsetospeed(&cdsp->tty, speed);
494
    ret_val = cfsetospeed(&cdsp->tty, speed);
449
    debug(D_PORT, "com_set_line: cfsetospeed returned 0x%X.\n", ret_val);
495
    debug(D_PORT, "com_set_line: cfsetospeed returned 0x%X.\n", ret_val);
450
    errno = 0;
496
    errno = 0;
451
    ret_val = tcsetattr(cdsp->fd, 0, &cdsp->tty);
497
    ret_val = tcsetattr(cdsp->fd, 0, &cdsp->tty);	/* Causes an xterm to close */
452
    debug(D_PORT, "com_set_line: tcsetattr returned 0x%X (%s).\n",
498
    debug(D_PORT, "com_set_line: tcsetattr returned 0x%X (%s).\n",
453
	ret_val, ret_val == -1 ? strerror(errno) : "");
499
	ret_val, ret_val == -1 ? strerror(errno) : "");
454
    errno = 0;
500
    errno = 0;
(-)doscmd.bbs/tty.c (-31 / +50 lines)
Lines 31-37 Link Here
31
 */
31
 */
32
32
33
#include <sys/cdefs.h>
33
#include <sys/cdefs.h>
34
__FBSDID("$FreeBSD: projects/doscmd/tty.c,v 1.25 2002/04/12 21:18:05 charnier Exp $");
34
__FBSDID("$FreeBSD: src/usr.bin/doscmd/tty.c,v 1.8.2.2 2002/04/25 11:04:51 tg Exp $");
35
35
36
#include <sys/ioctl.h>
36
#include <sys/ioctl.h>
37
#include <sys/time.h>
37
#include <sys/time.h>
Lines 124-145 Link Here
124
124
125
#define	row (CursRow0)
125
#define	row (CursRow0)
126
#define	col (CursCol0)
126
#define	col (CursCol0)
127
#define BIOSrow (BIOS_CursRow0)
128
#define	BIOScol (BIOS_CursCol0)
129
127
130
128
/* Local functions */
131
/* Local functions */
129
static void	_kbd_event(int, int, void *, regcontext_t *);
132
static void	_kbd_event(int, int, void *, regcontext_t *);
130
static void	Failure(void *);
133
static void	Failure(void *);
131
static void	SetVREGCur(void);
134
static void	SetVREGCur(void);
132
#ifndef NO_X
133
static void	debug_event(int, int, void *, regcontext_t *);
135
static void	debug_event(int, int, void *, regcontext_t *);
134
#endif
135
static unsigned char	inb_port60(int);
136
static unsigned char	inb_port60(int);
136
static int	inrange(int, int, int);
137
static int	inrange(int, int, int);
137
#ifndef NO_X
138
static void	kbd_event(int, int, void *, regcontext_t *);
138
static void	kbd_event(int, int, void *, regcontext_t *);
139
static u_short	read_raw_kbd(int, u_short *);
139
static u_short	read_raw_kbd(int, u_short *);
140
static void	setgc(u_short);
140
static void	setgc(u_short);
141
static void	video_async_event(int, int, void *, regcontext_t *);
141
static void	video_async_event(int, int, void *, regcontext_t *);
142
#endif
143
142
144
#ifndef NO_X
143
#ifndef NO_X
145
static void	dac2rgb(XColor *, int);
144
static void	dac2rgb(XColor *, int);
Lines 197-204 Link Here
197
#define	K4_SLOCK_LED	0x01
196
#define	K4_SLOCK_LED	0x01
198
#define	K4_NLOCK_LED	0x02
197
#define	K4_NLOCK_LED	0x02
199
#define	K4_CLOCK_LED	0x04
198
#define	K4_CLOCK_LED	0x04
200
#define	K4_ACK		0x10		/* ACK received from keyboard */
199
#define	K4_ACK		0x10		/* ACK recieved from keyboard */
201
#define	K4_RESEND	0x20		/* RESEND received from keyboard */
200
#define	K4_RESEND	0x20		/* RESEND recieved from keyboard */
202
#define	K4_LED		0x40		/* LED update in progress */
201
#define	K4_LED		0x40		/* LED update in progress */
203
#define	K4_ERROR	0x80
202
#define	K4_ERROR	0x80
204
203
Lines 329-335 Link Here
329
}
328
}
330
329
331
void
330
void
332
video_setborder(int color __unused)
331
video_setborder(int color)
333
{
332
{
334
#ifndef NO_X
333
#ifndef NO_X
335
	XSetWindowBackground(dpy, win, pixels[color & 0xf]);
334
	XSetWindowBackground(dpy, win, pixels[color & 0xf]);
Lines 341-350 Link Here
341
	blink = mode;
340
	blink = mode;
342
}
341
}
343
342
344
#ifndef NO_X
345
static void
343
static void
346
setgc(u_short attr)
344
setgc(u_short attr)
347
{
345
{
346
#ifndef NO_X
348
	XGCValues v;
347
	XGCValues v;
349
	if (blink && !show && (attr & 0x8000))
348
	if (blink && !show && (attr & 0x8000))
350
		v.foreground = pixels[(attr >> 12) & 0x07];
349
		v.foreground = pixels[(attr >> 12) & 0x07];
Lines 353-360 Link Here
353
352
354
	v.background = pixels[(attr >> 12) & (blink ? 0x07 : 0x0f)];
353
	v.background = pixels[(attr >> 12) & (blink ? 0x07 : 0x0f)];
355
	XChangeGC(dpy, gc, GCForeground|GCBackground, &v);
354
	XChangeGC(dpy, gc, GCForeground|GCBackground, &v);
356
}
357
#endif
355
#endif
356
}
358
357
359
void
358
void
360
video_update(regcontext_t *REGS __unused)
359
video_update(regcontext_t *REGS __unused)
Lines 535-540 Link Here
535
    
534
    
536
    return;
535
    return;
537
}
536
}
537
#endif
538
538
539
static u_short Ascii2Scan[] = {
539
static u_short Ascii2Scan[] = {
540
 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
540
 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
Lines 554-560 Link Here
554
 0x0019, 0x0010, 0x0013, 0x001f, 0x0014, 0x0016, 0x002f, 0x0011,
554
 0x0019, 0x0010, 0x0013, 0x001f, 0x0014, 0x0016, 0x002f, 0x0011,
555
 0x002d, 0x0015, 0x002c, 0x011a, 0x012b, 0x011b, 0x0129, 0xffff,
555
 0x002d, 0x0015, 0x002c, 0x011a, 0x012b, 0x011b, 0x0129, 0xffff,
556
};
556
};
557
#endif
558
557
559
struct {
558
struct {
560
    u_short	base;
559
    u_short	base;
Lines 653-661 Link Here
653
    {	0x8600, 0x5888, 0x8a00, 0x8c00 }, /* key 88 - F12 */
652
    {	0x8600, 0x5888, 0x8a00, 0x8c00 }, /* key 88 - F12 */
654
};
653
};
655
654
656
#ifndef NO_X
657
void
655
void
658
debug_event(int fd __unused, int cond, void *arg __unused, regcontext_t *REGS)
656
debug_event(int fd, int cond, void *arg, regcontext_t *REGS)
659
{
657
{
660
    static char ibuf[1024];
658
    static char ibuf[1024];
661
    static int icnt = 0;
659
    static int icnt = 0;
Lines 667-674 Link Here
667
    
665
    
668
    if (!(cond & AS_RD))
666
    if (!(cond & AS_RD))
669
    	return;
667
    	return;
670
668
    if(!doormode)
671
    r = read(STDIN_FILENO, ibuf + icnt, sizeof(ibuf) - icnt);
669
        r = read(STDIN_FILENO, ibuf + icnt, sizeof(ibuf) - icnt);
672
    if (r <= 0)
670
    if (r <= 0)
673
	return;
671
	return;
674
672
Lines 773-779 Link Here
773
	ibuf[icnt] = 0;
771
	ibuf[icnt] = 0;
774
    }
772
    }
775
}
773
}
776
#endif
777
774
778
unsigned char
775
unsigned char
779
inb_port60(int port __unused)
776
inb_port60(int port __unused)
Lines 784-792 Link Here
784
    return(r);
781
    return(r);
785
}       
782
}       
786
783
787
#ifndef NO_X
788
void
784
void
789
kbd_event(int fd, int cond, void *arg __unused, regcontext_t *REGS __unused)
785
kbd_event(int fd, int cond, void *arg, regcontext_t *REGS)
790
{
786
{
791
    if (!(cond & AS_RD))
787
    if (!(cond & AS_RD))
792
       return;
788
       return;
Lines 797-803 Link Here
797
    if ((break_code = read_raw_kbd(fd, &scan_code)) != 0xffff)
793
    if ((break_code = read_raw_kbd(fd, &scan_code)) != 0xffff)
798
	hardint(0x01);
794
	hardint(0x01);
799
}
795
}
800
#endif
801
796
802
void
797
void
803
int09(REGISTERS __unused)
798
int09(REGISTERS __unused)
Lines 815-821 Link Here
815
    send_eoi();
810
    send_eoi();
816
}
811
}
817
812
818
#ifndef NO_X
819
u_short
813
u_short
820
read_raw_kbd(int fd, u_short *code)
814
read_raw_kbd(int fd, u_short *code)
821
{
815
{
Lines 987-998 Link Here
987
	return(0xffff);
981
	return(0xffff);
988
    }
982
    }
989
}
983
}
990
#endif
991
984
992
#ifndef NO_X
993
void
985
void
994
video_async_event(int fd, int cond, void *arg __unused, regcontext_t *REGS __unused)
986
video_async_event(int fd, int cond, void *arg, regcontext_t *REGS)
995
{
987
{
988
#ifndef NO_X
996
    	int int9 = 0;
989
    	int int9 = 0;
997
990
998
	if (!(cond & AS_RD))
991
	if (!(cond & AS_RD))
Lines 1042-1049 Link Here
1042
                        break;
1035
                        break;
1043
                }
1036
                }
1044
        }
1037
        }
1045
}
1046
#endif
1038
#endif
1039
}
1047
1040
1048
#ifndef NO_X
1041
#ifndef NO_X
1049
static int
1042
static int
Lines 1427-1433 Link Here
1427
tty_move(int r, int c)
1420
tty_move(int r, int c)
1428
{
1421
{
1429
	row = r;
1422
	row = r;
1423
	BIOSrow=r;
1430
	col = c;
1424
	col = c;
1425
	BIOScol=c;
1431
	SetVREGCur();
1426
	SetVREGCur();
1432
}
1427
}
1433
1428
Lines 1449-1458 Link Here
1449
{
1444
{
1450
	int i;
1445
	int i;
1451
1446
1452
	if (row > (height - 1))
1447
	if (row > (height - 1))  {
1453
		row = 0;
1448
		row = 0;
1449
		BIOSrow=0;
1450
	}
1454
	else if (++row >= height) {
1451
	else if (++row >= height) {
1455
		row = height - 1;
1452
		row = height - 1;
1453
		BIOSrow = height = 1;
1456
		if (scroll) {
1454
		if (scroll) {
1457
			memcpy(vmem, &vmem[width], 2 * width * (height - 1));
1455
			memcpy(vmem, &vmem[width], 2 * width * (height - 1));
1458
			for (i = 0; i < width; ++i)
1456
			for (i = 0; i < width; ++i)
Lines 1494-1509 Link Here
1494
		vmem[row * width + col] &= 0xff00;
1492
		vmem[row * width + col] &= 0xff00;
1495
		break;
1493
		break;
1496
	case '\t':
1494
	case '\t':
1497
		if (row > (height - 1))
1495
		if (row > (height - 1))  {
1498
			row = 0;
1496
			row = 0;
1497
			BIOSrow = 0;
1498
		}
1499
		col = (col + 8) & ~0x07;
1499
		col = (col + 8) & ~0x07;
1500
		BIOScol = col;
1500
		if (col > width) {
1501
		if (col > width) {
1501
			col = 0;
1502
			col = 0;
1503
			BIOScol = 0;
1502
			tty_index(1);
1504
			tty_index(1);
1503
		}
1505
		}
1504
		break;
1506
		break;
1505
	case '\r':
1507
	case '\r':
1506
		col = 0;
1508
		col = 0;
1509
		BIOScol = 0;
1507
		break;
1510
		break;
1508
	case '\n':
1511
	case '\n':
1509
		tty_index(1);
1512
		tty_index(1);
Lines 1511-1520 Link Here
1511
	default:
1514
	default:
1512
		if (col >= width) {
1515
		if (col >= width) {
1513
			col = 0;
1516
			col = 0;
1517
			BIOScol = 0;
1514
			tty_index(1);
1518
			tty_index(1);
1515
		}
1519
		}
1516
		if (row > (height - 1))
1520
		if (row > (height - 1))  {
1517
			row = 0;
1521
			row = 0;
1522
			BIOSrow = 0;
1523
		}
1518
		if (attr >= 0)
1524
		if (attr >= 0)
1519
			vmem[row * width + col] = attr & 0xff00;
1525
			vmem[row * width + col] = attr & 0xff00;
1520
		else
1526
		else
Lines 1543-1552 Link Here
1543
    while (n--) {
1549
    while (n--) {
1544
	if (col >= width) {
1550
	if (col >= width) {
1545
	    col = 0;
1551
	    col = 0;
1552
		BIOScol = 0;
1546
	    tty_index(0);
1553
	    tty_index(0);
1547
	}
1554
	}
1548
	if (row > (height - 1))
1555
	if (row > (height - 1))  {
1549
	    row = 0;
1556
	    row = 0;
1557
		BIOSrow = 0;
1558
	}
1550
	if (attr >= 0)
1559
	if (attr >= 0)
1551
	    vmem[row * width + col] = attr & 0xff00;
1560
	    vmem[row * width + col] = attr & 0xff00;
1552
	else
1561
	else
Lines 1554-1560 Link Here
1554
	vmem[row * width + col++] |= c;
1563
	vmem[row * width + col++] |= c;
1555
    }
1564
    }
1556
    row = srow;
1565
    row = srow;
1566
	BIOSrow = srow;
1557
    col = scol;
1567
    col = scol;
1568
	BIOScol = scol;
1558
    SetVREGCur();
1569
    SetVREGCur();
1559
}
1570
}
1560
1571
Lines 1574-1588 Link Here
1574
    while (n--) {
1585
    while (n--) {
1575
	if (col >= wd) {
1586
	if (col >= wd) {
1576
	    col = 0;
1587
	    col = 0;
1588
		BIOScol = 0;
1577
	    /* tty_index(0); *//* scroll up if last line is filled */
1589
	    /* tty_index(0); *//* scroll up if last line is filled */
1578
	}
1590
	}
1579
	if (row > (ht - 1))
1591
	if (row > (ht - 1))  {
1580
	    row = 0;
1592
	    row = 0;
1593
		BIOSrow = 0;
1594
	}
1581
	putchar_graphics(row * wd * CharHeight + col, c, attr);
1595
	putchar_graphics(row * wd * CharHeight + col, c, attr);
1582
	col++;
1596
	col++;
1583
    }
1597
    }
1584
    row = srow;
1598
    row = srow;
1599
	BIOSrow = 0;
1585
    col = scol;
1600
    col = scol;
1601
	BIOScol = scol;
1586
    SetVREGCur();
1602
    SetVREGCur();
1587
1603
1588
    return;
1604
    return;
Lines 1641-1646 Link Here
1641
{
1657
{
1642
    int r;
1658
    int r;
1643
1659
1660
    if(doormode)
1661
    	return(0);
1644
    if ((r = nextchar) != 0) {
1662
    if ((r = nextchar) != 0) {
1645
	nextchar = 0;
1663
	nextchar = 0;
1646
	return(r & 0xff);
1664
	return(r & 0xff);
Lines 1648-1654 Link Here
1648
1666
1649
    if ((flag & TTYF_REDIRECT) && redirect0) {
1667
    if ((flag & TTYF_REDIRECT) && redirect0) {
1650
	char c;
1668
	char c;
1651
    	if (read(STDIN_FILENO, &c, 1) != 1)
1669
    	if (! doormode && read(STDIN_FILENO, &c, 1) != 1)
1652
	    return(-1);
1670
	    return(-1);
1653
	if (c == '\n')
1671
	if (c == '\n')
1654
	    c = '\r';
1672
	    c = '\r';
Lines 2041-2047 Link Here
2041
	font = XLoadQueryFont(dpy, FONTVGA);
2059
	font = XLoadQueryFont(dpy, FONTVGA);
2042
2060
2043
    if (font == NULL)
2061
    if (font == NULL)
2044
	err(1, "Could not open font ``%s''\n", xfont);
2062
//	err(1, "Could not open font ``%s''\n", xfont);
2063
	font = XLoadQueryFont(dpy, "fixed");
2045
2064
2046
    gcv.font = font->fid;
2065
    gcv.font = font->fid;
2047
    XChangeGC(dpy, gc, GCFont, &gcv);
2066
    XChangeGC(dpy, gc, GCFont, &gcv);

Return to bug 160217