[comp.os.minix] Turbo C diff's for Minix 1.2; here they are ! Part 1 of 9

evas@euraiv1.UUCP (10/02/87)

Sigh.
Remember my previous postings about the Minix 1.2 diff's for 
Turbo C ?  As you might recall, I first posted a message in which
I asked those interested to send me a message as I didn't want to
abuse previous net-bandwidth. Only a few people responded to that
posting so I announced that distribution of the diff's would be via
mail only. Boy, was I wrong; in the days after that posting, my 
mailbox was literally flooded with requests.....
So: I will post which has the additional advantage of entering the
stuff in the archives so that people not listening right now can
find them there.
I'm sorry for the confusion and changes of mind I've been through
but I hope I've done the right thing. 

Eelco van Asperen.

-----------------------------------------+------------------------------
Erasmus University Rotterdam             |uucp:mcvax!eurifb!euraiv1!evas
Fac. of Economics, Computer Science Dept.|earn:asperen@hroeur5
PO.box  1738 / 3000 DR  Rotterdam        |       
T H E    N E T H E R L A N D S           |Yet Another Silly Signature.
-----------------------------------------+------------------------------

[this is part 1 of 9:]

# This is a shar archive.  Extract with sh, not csh.
# This archive ends with exit, so do not worry about trailing junk.
# --------------------------- cut here --------------------------
PATH=/bin:/usr/bin
echo Extracting README
sed 's/^X//' > README << '+ END-OF-FILE 'README
X
XThis file describes how to change the MINIX sources so that you can
Xuse the Turbo C compiler from Borland Int. as a cross-development
Xsystem. These changes are relative to the orignal 1.1 release.
X
XIn the following, I'll assume you're using a hard disk system; if not,
Xyou're in for some copying much like the way you would have to when
Xusing Minix as a development system.
X
XFurthermore, the makefiles I use may not be right for you; especially
Xthe location of the Turbo C libraries, include files etc. may have to
Xbe changed. Check before use with 'make -n' to see if things are ok.
X
XFirst, make a complete copy of your current version; backup's can make
Xyour day (even though making them won't) !
X
XCreate a subdirectory under your MINIX directory (say UPDATE) that has
Xthe following subdirectories:
X
X        commands
X        commands\mined
X        commands\sh
X        fs
X        kernel
X        lib
X        mlib
X        mm
X        tools
X
X(I keep the source for mined and sh in the directories commands\mined
Xand commands\sh respectively.)
X
XUnshar this file and copy (or move) the files that don't have the
X.DIF-suffix to their respective directories.
X
XThe files with the .DIF suffix have been created with the DIFF-program
Xwritten by Eric Baalbergen and included in the 1.2 release. To apply
Xthe patches, you'll need the FIX-program (also in this release).
XCompile FIX with Turbo C and put it in a place where DOS can find it.
X
XTo apply the fixes you'll need to copy the files on the Minix
Xdistribution disks; boot Minix and use the doswrite program to copy
Xthe sources to DOS-formatted disks. The compiler-specific modules are
Xstored in subdirectories like MINIX, PCIX and C86; use the ones for the
XC86 compiler.  After this, reboot under DOS and copy the files to your 
XMinix-directory.
X
XApply the patches using FIX in the usual way, fe.
X
X        FIX original_file diff_file >new_file
X
XYou're now ready to build the Minix library; when Turbo C does long
Xarithmetic, it uses a number of library routines that are unique to
XTurbo C and therefore not included in the Minix library. These modules
Xwill have to be retrieved from the CS.LIB that came with your Turbo C
Xcompiler. To do this, you'll need the LIB-program; unfortunately,
XBorland did not distribute such a beast with their compiler so I hope
Xyou have the Microsoft Macro-Assembler or something else that does.
X(the one used by Lattice is no good.) If you don't have LIB and can't
Xfind someone near you that does, please drop me a line and I'll send
Xthe library to you by mail. I don't include them here since I'm not
Xquite sure whether that is allowed (copyrights and the like...); I
Xdon't think it will be a problem since these routines are also used in
Xbinaries of programs one writes using Turbo C and it is ok to
Xdistribute those.
X
XAssuming you have LIB, now use it to extract the following modules
Xfrom the CS.LIB;
X
X           ldiv
X           lrsh
X           lxmul
X           spush
X           scopy
X
XFor example;
X(you are supposed to type the stuff that is displayed in UPPERcase)
X
X           c> CD \MINIX\LIB
X
X           c> LIB
X           (bla bla bla)
X           Library file: \TC\LIB\CS
X           Operations:   *LDIV *LRSH *LXMUL *SPUSH *SCOPY
X           Listing file:
X           (more bla bla)
X
XAfter this, you'll have the corresponding .OBJ-files so you can go
Xahead and build the Minix library. Next step is compiling the files in
Xthe LIB-directory. You can do this by typing 'make all' but this will
Xload TCC for every file. As the source for the library consist of a
Xlot of small files, it is not very efficient to reload TCC for every
Xfile. To speed things up, you can use 'make fast' and 'make all'.
X'make all' will automatically call LIB to generate the Minix library.
X
XHaving created the library, you can proceed and compile FS, MM and the
XKERNEL by going to their respective directories and using 'make all'
Xto compile it all. The diffs for xt_wini.c in kernel are for the
Xversion with the patches for WD-controllers applied; the only change
Xwas to add the 's' to copy_params(). at_wini.c is not included as I
Xdon't use it (yet).
XFor some reason, in the 1.2 version of KLIB88.ASM (in the KERNEL
Xdirectory) two routines dma_read and dma_write are defined but they
Xare never used; is this an effort to make sure that all access to the
XDMA-chip will go via these routines in a future version or are they
Xjust a new service to those that have to write their own hard disk
Xdrivers ?
XAnyway, for the time being I've made these two routine depend on the
Xdefinition of the DMA_STUFF constant; if it's 0, then they're not
Xincluded (default), otherwize, they're assembled along with the rest.
X
XNext items are the files in the TOOLS directory; to write a boot-disk
Xyou'll need to compile BUILD, INIT and FSCK. Use MAKE IMAGE to compile
Xthese and to build a boot-disk; MAKE IMAGE also calls the formatter
Xprior to actually writing the image. It expects the diskette to be in
Xdrive A: and the standard pathname for the formatter is \ETC\FORMAT (I
Xput it there so I can not invoke it by accident as \ETC is not in my
Xpath).
X
XAfter experiencing some trouble in creating a bootable Minix, I found
Xout that Andy's advice to use a "Blank, formatted diskette" should be
Xtaken literaly; the disk should not have been used for anything else
Xsince it was formatted. Of course, this may depend on the computer,
XDOS version, ROM version etc. etc. etc. By the way, I use an Olivetti
XM21 PC (this is a luggable version of the Olivetti M24 aka. the AT&T
X6300 in the USA), 640K ram, 1x360K floppy, 1x20M hard disk (BASF drive+
XWD controller), BIOS version 1.43 and MS-DOS 3.21.
X
XTo create file-systems for Minix from DOS, you'll need MKFS; it's in
Xthe COMMANDS directory. Just copy it to the TOOLS dir and compile it
Xwith 'make dos_mkfs'
X
XI have no time to try every command but I haven't found any bugs yet.
X
XBEWARE:  Any program containing setjmp() and longjmp() *MUST* be
Xcompiled with the -r- option (note: that's "-r-" !) as Turbo C doesn't
Xstore it's register variables into memory before a setjmp()/longjmp().
XThis is a documented "feature" of the standard Turbo C library version
Xof setjmp() so you can use it to implement a kind of task-switches
X(co-routines).
X
XThe test programs AndyT provided on the user-disk all ran fine and
Xthey're a nice test to ensure that everything went ok in building the
Xkernel; test 9 had to be modified to make sure no register variables
Xwere used. I also tried the tests using the -O -G (optimize) compi
Xflags and they ran fine so I've now used these for all programs. Note
Xthat this may increase the size of the binaries; if you're very short
Xon memory, you may want to remove these flags to make Turbo C optimize
Xfor space.
X
XIn the part of the book concerned with using DOS as a development-
Xsystem for Minix, AST mentions the routines csv and cret. So far, I
Xhave used Turbo C with stack-overflow testing OFF so I haven't needed
Xthem. In case you would like to do this sort of checking, all you have
Xto do is write a replacement for the OVERFLOW@ routine that is called
Xjust after the routine is entered. You cannot use the Turbo C version
Xsince it does a direct DOS call if my memory is correct. You can
Xhowever use that version as a basis for further development; best
Xthing to do is to compile a short program with Stack Overflow Test ON
Xand Map File ON and then use SYMDEB or something like that to peek at
Xthe code generated.
X
XPlease post any corrections, changes, extensions etc. to the net so we
Xcan all benefit.
X
XGood luck and have fun,
X
XEelco van Asperen      87/09/28 22:38	(last minute updates)
X
XErasmus University Rotterdam
X Faculty of Economic Science     uucp:  seismo!mcvax!eurifb!euraiv1!evas
X  Dept. of Computer Science      earn/bitnet:   asperen@hroeur5
X         Rotterdam
XT H E   N E T H E R L A N D S
X
X
+ END-OF-FILE README
chmod u=rw,g=r,o=r README
set `sum README`
sum=$1
case $sum in
23353)	:;;
*)	echo 'Bad sum in 'README >&2
esac
if test -f fs
then	echo Removing   fs
	rm fs
fi
if test -d fs
then	:
else	echo Creating   fs
	mkdir fs
fi
echo Extracting fs/link.dif
sed 's/^X//' > fs/link.dif << '+ END-OF-FILE 'fs/link.dif
X55c55,58
X<   if (fetch_name(name2, name2_length, M1) != OK) return(err_code);
X---
X>   if (fetch_name(name2, name2_length, M1) != OK) {
X> 	put_inode(rip);
X> 	return(err_code);
X>   }
+ END-OF-FILE fs/link.dif
chmod u=rw,g=r,o=r fs/link.dif
set `sum fs/link.dif`
sum=$1
case $sum in
13783)	:;;
*)	echo 'Bad sum in 'fs/link.dif >&2
esac
echo Extracting fs/linklist
sed 's/^X//' > fs/linklist << '+ END-OF-FILE 'fs/linklist
X..\mlib\head+
Xmain+open+read+write+pipe+device+path+
Xmount+link+super+inode+cache+filedes+stadir+
Xprotect+time+misc+utility+table+putc
Xfs
Xfs
X..\mlib\minix
+ END-OF-FILE fs/linklist
chmod u=rw,g=r,o=r fs/linklist
set `sum fs/linklist`
sum=$1
case $sum in
14350)	:;;
*)	echo 'Bad sum in 'fs/linklist >&2
esac
echo Extracting fs/makefile
sed 's/^X//' > fs/makefile << '+ END-OF-FILE 'fs/makefile
XCC=tcc
XCCOPTS=-A -mt -I..\include -Di8088 -DTURBO -G -O -c
XLN=tlink
XLNOPTS=/x/d/c           # no map file; warn for duplicates; case is significant
X
XOBJS=	write.obj cache.obj device.obj filedes.obj \
X	inode.obj main.obj link.obj misc.obj mount.obj open.obj \
X	path.obj pipe.obj protect.obj putc.obj read.obj stadir.obj \
X	super.obj table.obj time.obj utility.obj
X
X.c.obj:
X	$(CC) $(CCOPTS) $<
X
Xfs.out:	$(OBJS) ..\mlib\head.obj
X	$(LN) $(LNOPTS) @linklist
X	dos2out -d fs
X
Xall:	fs.out
X
Xfast:	*.c
X	$(CC) $(CCOPTS) *.c
+ END-OF-FILE fs/makefile
chmod u=rw,g=r,o=r fs/makefile
set `sum fs/makefile`
sum=$1
case $sum in
40443)	:;;
*)	echo 'Bad sum in 'fs/makefile >&2
esac
echo Extracting fs/misc.dif
sed 's/^X//' > fs/misc.dif << '+ END-OF-FILE 'fs/misc.dif
X169a170,176
X>   if (fp->fp_suspended == SUSPENDED) {
X> 	if (fp->fp_task == XPIPE) susp_count--;
X> 	pro = exitee;
X> 	do_unpause();
X> 	fp->fp_suspended = NOT_SUSPENDED;
X>   }
X> 
X180,185d186
X<   if (fp->fp_suspended == SUSPENDED) {
X< 	if (fp->fp_task == XPIPE) susp_count--;
X< 	pro = exitee;
X< 	do_unpause();
X< 	fp->fp_suspended = NOT_SUSPENDED;
X<   }
+ END-OF-FILE fs/misc.dif
chmod u=rw,g=r,o=r fs/misc.dif
set `sum fs/misc.dif`
sum=$1
case $sum in
25919)	:;;
*)	echo 'Bad sum in 'fs/misc.dif >&2
esac
echo Extracting fs/open.dif
sed 's/^X//' > fs/open.dif << '+ END-OF-FILE 'fs/open.dif
X39c39
X<   extern struct inode *new_node();
X---
X>   struct inode *new_node();
X94a95
X>   struct inode *new_node();
+ END-OF-FILE fs/open.dif
chmod u=rw,g=r,o=r fs/open.dif
set `sum fs/open.dif`
sum=$1
case $sum in
8883)	:;;
*)	echo 'Bad sum in 'fs/open.dif >&2
esac
echo Extracting fs/pipe.dif
sed 's/^X//' > fs/pipe.dif << '+ END-OF-FILE 'fs/pipe.dif
X201c201
X<   if (rfp->fp_suspended == NOT_SUSPENDED) return;
X---
X>   if (rfp->fp_suspended == NOT_SUSPENDED || rfp->fp_revived == REVIVING)return;
X231c231
X<   int proc_nr, task;
X---
X>   int proc_nr, task, fild;
X244c244,246
X< 	f = get_filp(rfp->fp_fd);
X---
X> 	fild = (rfp->fp_fd >> 8) & BYTE;	/* extract file descriptor */
X> 	if (fild < 0 || fild >= NR_FDS) panic("unpause err 2", NO_NUM);
X> 	f = rfp->fp_filp[fild];
X249,252c251,254
X< 	if (sendrec(task, &mess) != OK) panic("unpause err 2", NO_NUM);
X< 	while (mess.REP_PROC_NR != proc_nr) {
X< 		revive(mess.REP_PROC_NR, mess.REP_STATUS);
X< 		if (receive(task, &m) != OK) panic("unpause err 3", NO_NUM);
X---
X> 	if (sendrec(task, &mess) != OK) panic("unpause err 3", NO_NUM);
X> 	while (mess.REP_PROC_NR != proc_nr) {
X> 		revive(mess.REP_PROC_NR, mess.REP_STATUS);
X> 		if (receive(task, &m) != OK) panic("unpause err 4", NO_NUM);
+ END-OF-FILE fs/pipe.dif
chmod u=rw,g=r,o=r fs/pipe.dif
set `sum fs/pipe.dif`
sum=$1
case $sum in
264)	:;;
*)	echo 'Bad sum in 'fs/pipe.dif >&2
esac
echo Extracting fs/protect.dif
sed 's/^X//' > fs/protect.dif << '+ END-OF-FILE 'fs/protect.dif
X151c151
X<   if (super_user) {
X---
X>   if (test_uid == SU_UID) {
+ END-OF-FILE fs/protect.dif
chmod u=rw,g=r,o=r fs/protect.dif
set `sum fs/protect.dif`
sum=$1
case $sum in
4481)	:;;
*)	echo 'Bad sum in 'fs/protect.dif >&2
esac
if test -f kernel
then	echo Removing   kernel
	rm kernel
fi
if test -d kernel
then	:
else	echo Creating   kernel
	mkdir kernel
fi
echo Extracting kernel/floppy.dif
sed 's/^X//' > kernel/floppy.dif << '+ END-OF-FILE 'kernel/floppy.dif
X108c108
X< #define NT                 4	/* number of diskette/drive combinations */
X---
X> #define NT                 6	/* number of diskette/drive combinations */
X141,153c141,161
X< /* Four combinations of diskette/drive are supported:
X<  * # Drive  diskette  Sectors  Tracks  Rotation Data-rate  Comment
X<  * 0  360K    360K      9       40     300 RPM  250 kbps   Standard PC DSDD
X<  * 1  720K    360K      9       40     300 RPM  250 kbps   Quad density PC
X<  * 2  1.2M    360K      9       40     360 RPM  300 kbps   PC disk in AT drive
X<  * 3  1.2M    1.2M     15       80     360 RPM  500 kbps   AT disk in AT drive
X<  */
X< PRIVATE int gap[NT]           = {0x2A, 0x2A, 0x23, 0x1B}; /* gap size */
X< PRIVATE int rate[NT]          = {0x02, 0x02, 0x01, 0x00}; /* 250,300,500 kbps*/
X< PRIVATE int nr_sectors[NT]    = {9,    9,    9,    15};   /* sectors/track */
X< PRIVATE int nr_blocks[NT]     = {720,  720,  720,  2400}; /* sectors/diskette*/
X< PRIVATE int steps_per_cyl[NT] = {1,    2,    2,    1};	  /* 2 = dbl step */
X< PRIVATE int mtr_setup[NT]     = {HZ/4,HZ/4,3*HZ/4,3*HZ/4};/* in ticks */
X---
X> /* Six combinations of diskette/drive are supported:
X>  * # Drive  diskette  Sectors  Tracks  Rotation Data-rate  Comment
X>  * 0  360K    360K      9       40     300 RPM  250 kbps   Standard PC DSDD
X>  * 1  1.2M    1.2M     15       80     360 RPM  500 kbps   AT disk in AT drive
X>  * 2  720K    360K      9       40     300 RPM  250 kbps   Quad density PC
X>  * 3  720K    720K      9       80     300 RPM  250 kbps   Toshiba, et al.
X>  * 4  1.2M    360K      9       40     360 RPM  300 kbps   PC disk in AT drive
X>  * 5  1.2M    720K      9       80     360 RPM  300 kbps   Toshiba in AT drive
X>  */
X> PRIVATE int gap[NT] =
X> 	{0x2A, 0x1B, 0x2A, 0x2A, 0x23, 0x23}; /* gap size */
X> PRIVATE int rate[NT] = 
X> 	{0x02, 0x00, 0x02, 0x02, 0x01, 0x01}; /* 250,300,500 kbps*/
X> PRIVATE int nr_sectors[NT] = 
X> 	{9,    15,   9,    9,    9,    9};   /* sectors/track */
X> PRIVATE int nr_blocks[NT] = 
X> 	{720,  2400, 720,  1440, 720,  1440}; /* sectors/diskette*/
X> PRIVATE int steps_per_cyl[NT] = 
X> 	{1,    1,    2,    1,    2,    1};   /* 2 = dbl step */
X> PRIVATE int mtr_setup[NT] = 
X> 	{HZ/4,3*HZ/4,HZ/4,HZ/4,3*HZ/4,3*HZ/4};/* in ticks */
+ END-OF-FILE kernel/floppy.dif
chmod u=rw,g=r,o=r kernel/floppy.dif
set `sum kernel/floppy.dif`
sum=$1
case $sum in
13353)	:;;
*)	echo 'Bad sum in 'kernel/floppy.dif >&2
esac
echo Extracting kernel/klib88.dif
sed 's/^X//' > kernel/klib88.dif << '+ END-OF-FILE 'kernel/klib88.dif
X20,31c20,46
X< 
X< ; The following	procedures are defined in this file and	called from outside it.
X< PUBLIC phys_cop, cp_mess, port_out, port_in, lock, unlock, restore
X< PUBLIC build_si, csv, cret, get_chro, vid_copy,	get_byte
X< PUBLIC reboot, wreboot
X< 
X< ; The following	external procedure is called in	this file.
X< EXTRN panic:NEAR
X< 
X< ; Variables and	data structures
X< EXTRN color:WORD, cur_proc:WORD, proc_ptr:WORD,	splimit:WORD
X< PUBLIC vec_tabl
X---
X> ;   dma_read:	transfer data between HD controller and memory
X> ;   dma_write:	transfer data between memory and HD controller
X> 
X> 
X> TURBO     equ 1
X> DMA_STUFF equ 0         ; make this 1 if you want to use dma_read and dma_write
X> 
X> ; The following	procedures are defined in this file and	called from outside it.
X> PUBLIC _phys_copy, _cp_mess, _port_out, _port_in, _lock, _unlock, _restore
X> PUBLIC _build_sig, _get_chrome, _vid_copy, _get_byte
X> 
X> ifndef TURBO
X> PUBLIC_csv, _cret
X> endif
X> 
X> PUBLIC _reboot, _wreboot
X> if DMA_STUFF
X> PUBLIC _dma_read, _dma_write
X> endif
X> 
X> ; The following	external procedure is called in	this file.
X> EXTRN _panic:NEAR
X> 
X> ; Variables and	data structures
X> EXTRN _color:WORD, _cur_proc:WORD, _proc_ptr:WORD, _splimit:WORD
X> EXTRN _vid_mask:WORD		; declared in tty.c
X> PUBLIC _vec_table
X36,37c51,52
X< @CODE	SEGMENT
X< 	assume	cs:@code,ds:dgroup
X---
X> _TEXT	SEGMENT
X> 	assume	cs:_TEXT,ds:dgroup
X45c60
X< phys_cop:
X---
X> _phys_copy:
X146c161
X< cp_mess:
X---
X> _cp_mess:
X183c198
X< port_out:
X---
X> _port_out:
X201c216
X< port_in:
X---
X> _port_in:
X221c236
X< lock:
X---
X> _lock:
X232c247
X< unlock:
X---
X> _unlock:
X241c256
X< restore:
X---
X> _restore:
X266c281
X< build_si:
X---
X> _build_sig:
X285a301
X> ifndef TURBO
X292c308
X< csv:
X---
X> _csv:
X299c315
X< 	cmp sp,dgroup:splimit	; has kernel stack grown too large
X---
X> 	cmp sp,dgroup:_splimit	; has kernel stack grown too large
X304,310c320,326
X< 	mov dgroup:splimit,0		; prevent call to panic	from aborting in csv
X< 	mov bx,dgroup:proc_ptr		; update rp->p_splimit
X< 	mov WORD PTR 50[bx],0		; rp->sp_limit = 0
X< 	push dgroup:cur_proc		; task number
X< 	mov ax,offset dgroup:stkoverrun	; stack	overran	the kernel stack area
X< 	push ax				; push first parameter
X< 	call panic		; call is: panic(stkoverrun, cur_proc)
X---
X> 	mov dgroup:_splimit,0		; prevent call to panic	from aborting in csv
X> 	mov bx,dgroup:_proc_ptr		; update rp->p_splimit
X> 	mov WORD PTR 50[bx],0		; rp->sp_limit = 0
X> 	push dgroup:_cur_proc		; task number
X> 	mov ax,offset dgroup:stkoverrun ; stack overran the kernel stack area
X> 	push ax				; push first parameter
X> 	call _panic		; call is: panic(stkoverrun, cur_proc)
X314c330
X< cret:
X---
X> _cret:
X320a337,390
X> endif
X> 
X> if DMA_STUFF
X> 
X> ;*===========================================================================*
X> ;*				dma_read				     *
X> ;*===========================================================================*
X> _dma_read:
X> 	push	bp
X> 	mov	bp,sp
X> 	push	cx
X> 	push	dx
X> 	push	di
X> 	push	es
X> 	mov	cx,256		; transfer 256 words
X> 	mov	dx,1F0h	; from/to port 1f0
X> 	cld
X> 	mov	es,4[bp]	; segment in es
X> 	mov	di,6[bp]	; offset in di
X> 	db	0F3h, 06Dh	; opcode for 'rep insw'
X> 	pop	es
X> 	pop	di
X> 	pop	dx
X> 	pop	dx
X> 	mov	sp,bp
X> 	pop	bp
X> 	ret
X> 
X> ;*===========================================================================*
X> ;*				dma_write				     *
X> ;*===========================================================================*
X> _dma_write:
X> 	push	bp
X> 	mov	bp,sp
X> 	push	cx
X> 	push	dx
X> 	push	si
X> 	push	ds
X> 	mov	cx,256		; transfer 256 words
X> 	mov	dx,01F0h	; from/to port 1f0
X> 	cld
X> 	mov	ds,4[bp]	; segment in ds
X> 	mov	si,6[bp]	; offset in si
X> 	db	0F3h, 06Fh	; opcode for 'rep outsw'
X> 	pop	ds
X> 	pop	si
X> 	pop	dx
X> 	pop	dx
X> 	mov	sp,bp
X> 	pop	bp
X> 	ret
X> 
X> endif  ; DMA_STUFF
X> 
X327c397
X< get_chro:
X---
X> _get_chrome:
X355c425
X< vid_copy:
X---
X> _vid_copy:
X366c436
X< 	and di,dgroup:vid_mask	; only 4K or 16K counts
X---
X> 	and di,dgroup:_vid_mask	; only 4K or 16K counts
X373,375c443,445
X< 	sub bx,dgroup:vid_mask	; bx = # characters beyond end of video ram
X< 	sub bx,1		; note: dec bx doesn't set flags properly
X< 	jle vid.1		; jump if no overrun
X---
X> 	sub bx,dgroup:_vid_mask	; bx = # characters beyond end of video ram
X> 	sub bx,1		; note: dec bx doesn't set flags properly
X> 	jle vid1		; jump if no overrun
X380c450
X< vid1:	test dgroup:color,1	; skip vertical	retrace	test if	display	is mono
X---
X> vid1:	test dgroup:_color,1	; skip vertical	retrace	test if	display	is mono
X404,405c474,475
X< 	mov 8[bp],0		; start copying at base of video ram
X< 	cmp 4[bp],0		; NIL_PTR means store blanks
X---
X> 	mov word ptr 8[bp],0	; start copying at base of video ram
X> 	cmp word ptr 4[bp],0	; NIL_PTR means store blanks
X412c482,484
X< 	pop es			; restore registers
X---
X> ; the vid6-label was missing !! [EVAS]
X> ;
X> vid6:	pop es			; restore registers
X434c506
X< get_byte:
X---
X> _get_byte:
X453c525
X< reboot:
X---
X> _reboot:
X458,460c530,542
X< 	int 19h			; reboot the PC
X< 
X< wreboot:
X---
X> 	mov ax,040h
X> 	mov ds,ax
X> 	mov ax,01234h
X> 	mov ds:[0072h],ax
X> 	mov ax,0FFFFh
X> 	mov ds,ax
X> 	mov ax,3
X> 	push ax
X> 	mov ax,1
X> 	push ax
X> 	iret
X> 
X> _wreboot:
X467c549,559
X< 	int 19h			; reboot the PC
X---
X> 	mov ax,040h
X> 	mov ds,ax
X> 	mov ax,01234h
X> 	mov ds:[072h],ax
X> 	mov ax,0FFFFh
X> 	mov ds,ax
X> 	mov ax,3
X> 	push ax
X> 	mov ax,1
X> 	push ax
X> 	iret
X473c565
X< 	mov si,offset dgroup:vec_tabl
X---
X> 	mov si,offset dgroup:_vec_table
X479c571
X< @CODE	ENDS
X---
X> _TEXT	ENDS
X483,492c575,582
X< @DATAI	SEGMENT
X< lockvar	   DW	 0		; place	to store flags for lock()/restore()
X< tmp        DW    0		; count of bytes already copied
X< vec_tabl   DW	 130 dup(0)	; storage for interrupt	vectors
X< stkoverrun DB	 "Kernel stack overrun,	task = ",0
X< @DATAI	ENDS
X< 
X< 	END	; end of assembly
X< 
X< 
X---
X> _BSS	SEGMENT
X> lockvar	   DW	 0		; place	to store flags for lock()/restore()
X> tmp        DW    0		; count of bytes already copied
X> _vec_table   DW	 130 dup(0)	; storage for interrupt	vectors
X> stkoverrun DB	 "Kernel stack overrun,	task = ",0
X> _BSS	ENDS
X> 
X> 	END	; end of assembly
+ END-OF-FILE kernel/klib88.dif
chmod u=rw,g=r,o=r kernel/klib88.dif
set `sum kernel/klib88.dif`
sum=$1
case $sum in
4344)	:;;
*)	echo 'Bad sum in 'kernel/klib88.dif >&2
esac
echo Extracting kernel/linklist
sed 's/^X//' > kernel/linklist << '+ END-OF-FILE 'kernel/linklist
X..\mlib\head+
Xmain+open+read+write+pipe+device+path+
Xmount+link+super+inode+cache+filedes+stadir+
Xprotect+time+misc+utility+table+putc
Xfs
Xfs
X..\mlib\minix
+ END-OF-FILE kernel/linklist
chmod u=rw,g=r,o=r kernel/linklist
set `sum kernel/linklist`
sum=$1
case $sum in
14350)	:;;
*)	echo 'Bad sum in 'kernel/linklist >&2
esac
echo Extracting kernel/makefile
sed 's/^X//' > kernel/makefile << '+ END-OF-FILE 'kernel/makefile
X#
X# Makefile for tools directory. (C) 1987 Eelco van Asperen.
X#
XTCINCLUDE=\tc\include
XINCLUDE=..\include
XCC=tcc
XCCOPTS=-Di8088 -DTURBO -DSTANDALONE
X#
X# these are to make mkfs under DOS:
X#
XMKFSOPTS=-Di8088 -DTURBO -DSTANDALONE -DDOS -I$(TCINCLUDE)
XTCLIB=\tc\lib
XLN=tlink
XLNOPTS=/x/d/c
XFORMATTER=c:\etc\format
X
X.c.obj:
X	$(CC) -A -mt -I$(INCLUDE) $(CCOPTS) -c $<
X
X.asm.obj:
X	masm /mx $<,,nul,nul
X
X.obj.exe:
X	$(LN) $(LNOPTS) ..\mlib\head $<,$*,$*,..\mlib\minix
X
X.exe.out:
X	dos2out -d $*
X
X#
X# create a boot-disk;
X#
Xminix:	bootblok.bin ..\kernel\kernel.out ..\mm\mm.out ..\fs\fs.out init.out fsck.out build.exe
X	build bootblok.bin ..\kernel\kernel.out ..\mm\mm.out ..\fs\fs.out init.out fsck.out a:
X
X#
X# idem, but format the disk first;
X#
X# (the @*#*&!!?@#$!% DOS-formatter doesn't return a proper error-code !!)
X#
Ximage:	bootblok.bin ..\kernel\kernel.out ..\mm\mm.out ..\fs\fs.out init.out fsck.out build.exe
X	- $(FORMATTER) a:
X	build bootblok.bin ..\kernel\kernel.out ..\mm\mm.out ..\fs\fs.out init.out fsck.out a:
X
X#
X# create the bootblok;
X#
Xbootblok.bin:	bootblok.asm
X	masm /mx bootblok,,nul,nul
X	link bootblok,,nul,nul
X	exe2bin bootblok.exe bootblok.bin
X	del bootblok.exe
X	del bootblok.obj
X
X#
X# make 'fsck'; does not use crtso.obj nor head.obj.
X#
Xfsck.out:	fsck1.obj fsck.obj
X	$(LN) $(LNOPTS) fsck1 fsck,fsck,fsck,..\mlib\minix
X	dos2out -d fsck.exe
X
X#
X# make 'init'; uses special startup module head.obj.
X#
Xinit.out:	init.obj
X	$(LN) $(LNOPTS) ..\mlib\head init,init,init,..\mlib\minix
X	dos2out -d init.exe
X
X#
X# build 'build' for use under MS-DOS;
X#
Xbuild.exe:	build.obj
X	$(LN) $(LNOPTS) $(TCLIB)\c0s build,build,build,$(TCLIB)\cs
X
Xbuild.obj:	build.c
X	$(CC) -ms -I$(TCINCLUDE) -Di8088 -DTURBO -DSTANDALONE -DDOS -c $*
X
X#
X# make for version of 'mkfs' for use under MS-DOS;
X# (a complicated 'minixwrite')
X#
Xdos_mkfs:	mkfs.c
X	$(CC) $(MKFSOPTS) -c mkfs.c
X	$(LN) $(LNOPTS) $(TCLIB)\c0s mkfs,mkfs,mkfs,$(TCLIB)\cs
X
+ END-OF-FILE kernel/makefile
chmod u=rw,g=r,o=r kernel/makefile
set `sum kernel/makefile`
sum=$1
case $sum in
20401)	:;;
*)	echo 'Bad sum in 'kernel/makefile >&2
esac
exit 0