diff options
author | tg <tg@FreeBSD.org> | 2001-07-30 12:03:38 +0000 |
---|---|---|
committer | tg <tg@FreeBSD.org> | 2001-07-30 12:03:38 +0000 |
commit | 23487998fa234b8dea09962c1b969747a6dad703 (patch) | |
tree | 0324beee141e4a0d226f079555fb4aae76dc5781 /usr.bin/doscmd/tty.c | |
parent | 3089204ae8c6197585a8754aabc7118502224609 (diff) | |
download | FreeBSD-src-23487998fa234b8dea09962c1b969747a6dad703.zip FreeBSD-src-23487998fa234b8dea09962c1b969747a6dad703.tar.gz |
- Add some more x86 instructions to emulate,
- emulate VGA read mode 0,
- emulate VGA write mode 1,
- minor cleanup.
Protel's Easytrax, a free PCB layout program, almost runs now; there are
still some problems with the keyboard emulation, but the graphics are fine
(albeit a bit slow).
Diffstat (limited to 'usr.bin/doscmd/tty.c')
-rw-r--r-- | usr.bin/doscmd/tty.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/usr.bin/doscmd/tty.c b/usr.bin/doscmd/tty.c index f6b9449..ceab613 100644 --- a/usr.bin/doscmd/tty.c +++ b/usr.bin/doscmd/tty.c @@ -115,7 +115,7 @@ typedef struct TextLine { u_char max_length; /* Not used, but here for future use */ u_char changed:1; } TextLine; -TextLine *lines; +TextLine *lines = NULL; int kbd_fd = -1; int kbd_read = 0; @@ -133,14 +133,14 @@ SetVREGCur() VGA_CRTC[CRTC_CurLocLo] = cp & 0xff; } -void _kbd_event(void *); -void debug_event(void *); -int video_event(); -void video_async_event(void *); -void tty_cooked(); -unsigned char inb_port60(int); -void kbd_event(int fd, REGISTERS); -u_short read_raw_kbd(int fd, u_short *code); +void _kbd_event(void *); +void debug_event(void *); +int video_event(); +void video_async_event(void *); +void tty_cooked(); +unsigned char inb_port60(int); +void kbd_event(int); +u_short read_raw_kbd(int, u_short *); /* Local functions */ #ifndef NO_X @@ -364,7 +364,7 @@ video_update(regcontext_t *REGS) static int icnt = 3; if (kbd_read) - kbd_event(kbd_fd, REGS); + kbd_event(kbd_fd); if (--icnt == 0) { icnt = 3; @@ -791,7 +791,7 @@ inb_port60(int port) } void -kbd_event(int fd, REGISTERS) +kbd_event(int fd) { kbd_read = 0; @@ -998,7 +998,7 @@ video_async_event(void *pfd) int x; fd_set fdset; XEvent ev; - static struct timeval tv = { 0 }; + static struct timeval tv; /* * Handle any events just sitting around... @@ -1042,7 +1042,7 @@ video_async_event(void *pfd) } void -kbd_async_event(int fd, REGISTERS) +kbd_async_event(int fd) { unsigned char c; @@ -2182,7 +2182,7 @@ get_ximage() XDestroyImage(xi); err(1, "Could not get memory for ximage data"); } - + return; #endif } @@ -2193,14 +2193,31 @@ get_lines() { int i; - if (!(lines = (TextLine *)malloc(sizeof(TextLine) * height))) - err(1, "Could not allocate data structure for text lines\n"); + if (lines == NULL) { + lines = (TextLine *)malloc(sizeof(TextLine) * height); + if (lines == NULL) + err(1, "Could not allocate data structure for text lines\n"); - for (i = 0; i < height; ++i) { - lines[i].max_length = width; - if (!(lines[i].data = (u_short *)malloc(width * sizeof(u_short)))) + for (i = 0; i < height; ++i) { + lines[i].max_length = width; + lines[i].data = (u_short *)malloc(width * sizeof(u_short)); + if (lines[i].data == NULL) + err(1, "Could not allocate data structure for text lines\n"); + lines[i].changed = 1; + } + } else { + lines = (TextLine *)realloc(lines, sizeof(TextLine) * height); + if (lines == NULL) err(1, "Could not allocate data structure for text lines\n"); - lines[i].changed = 1; + + for (i = 0; i < height; ++i) { + lines[i].max_length = width; + lines[i].data = (u_short *)realloc(lines[i].data, + width * sizeof(u_short)); + if (lines[i].data == NULL) + err(1, "Could not allocate data structure for text lines\n"); + lines[i].changed = 1; + } } } @@ -2258,7 +2275,8 @@ resize_window() sh->min_height = sh->max_height = sh->base_height; sh->flags = USSize | PMinSize | PMaxSize | PSize; - debug(D_VIDEO, "window size %dx%d\n", sh->base_width, sh->base_height); + debug(D_VIDEO, "VGA: Set window size %dx%d\n", + sh->base_width, sh->base_height); XSetWMNormalHints(dpy, win, sh); XResizeWindow(dpy, win, sh->base_width, sh->base_height); |