[comp.os.minix] serial tty and new fs part 1 of 3

bing@galbp.LBP.HARRIS.COM (Bing Bang) (08/04/87)

Sorry Andy, but I looked at what it'd take to convert the tty driver to work
with the old fs and I just don't have the time for it now. Perhaps I'll
get to it later, after I take care of few more pressing details.

In the following postings, you'll find diffs for my multi-tasking fs, and the
tty.c file with the serial ports.

You should save this and call in README.

Ok, to start off, the following assembler routines must be placed in the
file mpx88.s, and _com1_int, _com2_int, _coms_int declared .globl

|*===========================================================================*
|*				com1_int				     *
|*===========================================================================*
_com1_int:			| Interrupt routine for terminal input.
	call save		| save the machine state
	mov ax,#0		| com1
	push ax
	call _coms_int		| process a 8250 interrupt
	jmp _restart		| continue execution

|*===========================================================================*
|*				com2_int				     *
|*===========================================================================*
_com2_int:			| Interrupt routine for terminal input.
	call save		| save the machine state
	mov ax,#1		| com2
	push ax
	call _coms_int		| process a 8250 interrupt
	jmp _restart		| continue execution




Step 2::

Since What I did was to incoporate the serial ttys to the virtual tty that
Larry Hubble posted a while back, you need to include his _scr_dn and
_scr_up routines into your klib88.s file. I nolonger have the original
posting of these routines, so I pulled them out of my klib88.s and that is
why there are no comments; libpack strips them. All the other requirements
to run his vtty is there if you updated to 1.2.

This means tty minor numbers 0-3 are the virtual screens and 4-5 are the
com1 and com2 ports. (If you don't want the virtual ttys, you can probably
change a few things, probably not toooo hard. :-)

_scr_up:
push bp 
mov bp,sp 
push si 
push di 
push cx 
push es 
push ds 
mov si,#160 
mov di,#0 
mov cx,#1920 

pushf 
cli
mov ax,4(bp)
mov es,ax 
mov ds,ax

rep 
movw 

popf 
pop ds 
pop es 
pop cx 
pop di 
pop si 
pop bp 
ret 

_scr_dn:
push bp 
mov bp,sp 
push si 
push di 
push cx 
push es 
push ds 
mov si,#3838 
mov di,#3998 
mov cx,#1920 

pushf 
cli
mov ax,4(bp)
mov es,ax 
mov ds,ax

std
rep 
movw 

popf 
pop ds 
pop es 
pop cx 
pop di 
pop si 
pop bp 
ret 


Don't  forget to declare these routines .globl, too.

Step 3::

In main.c under the kernel directory include
 
  set_vec(COMM1_VECTOR, com1_int, base_click);
  set_vec(COMM2_VECTOR, com2_int, base_click);

where all the other calls to set_vec are made.
You must also declare:

	extern int com1_int(), com2_int();

on the top of main.c.

Then into h/const.h add

#define COMM1_VECTOR 0x0c			/* int vector for com1 */
#define COMM2_VECTOR 0x0b			/* int vector for com2 */

where all the other vectors are defined.


Ok! that takes care of all the dirty work!

 
The diff files are relative to 1.2 sources. the fs*.diff files are for
files in fs. All other diff files are for files in kernel.

Good luck!!


-- 
Bing H. Bang                         +-------------------+
Harris/Lanier                        |MSDOS: just say no.|
Atlanta GA                           +-------------------+