[net.sources] Jove Z100 mods

km@cadre.ARPA (Ken Mitchum) (05/20/85)

Here are the Z100 mods for JOVE/MSDOS from Jim Knutson. They replace
the corresponding files in the Jove sources.
NOTE: These mods are for the Z100 only. The Z150 and Z160 do not
need these mods.

  Ken Mitchum
  University of Pittsburgh


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by ut-ngp!knutson on Wed May  8 13:55:49 CDT 1985
# Contents:  h19.c jovelink.z10 makefile.z10 rawio.asm
 
echo x - h19.c
sed 's/^@//' > "h19.c" <<'@//E*O*F h19.c//'
/* terminal control for h19 */
/* after Trm.c */
/* K. Mitchum 6/84 */

#include "tm.h"
#include "jove.h"



/* define BIGH19 if using 25 lines */
#define BIGH19



#define NCOLS 80

/* local equates for h19 escape sequences */


#ifdef BIGH19

/* enable 25th line, restart block cursor, no autolf, no autocr */

#define H19INIT "\033x1\033x4\033y5\033y8\033y9\033x4\033E"
#define H19EXIT "\033y1\033y4\033E"
#define LINES 25
#else

/* same as above, disable 25th line */

#define H19INIT "\033y1\033x4\033y5\033y8\033y9\033E"
#define H19EXIT "\033y1\033y4\033E"
#define LINES 24
#endif


#define REVOFF "\033q"		/* reverse video off */
#define REVON "\033p"		/* reverse video on */
#define INSLN "\033L"		/* insert line */
#define DELLN "\033M"		/* delete line */
#define INSCHON "\033@"		/* enter insert character mode */
#define INSCHOFF "\033O"	/* exit insert character mode */
#define CURFWD "\033C"		/* cursor forward */
#define CURDWN "\033B"		/* cursor down */
#define CURUP "\033A"		/* cursor up */
#define CURPOS "\033Y%c%c"	/* cursor positioning sequence */
#define CURHOME "\033H"		/* cursor home, non destructive */
#define KILLN "\033K"		/* kill line */
#define DELCHR "\033N"		/* delete char */
#define CLRSCN "\033E"		/* erase screen and home */
#define BS 010			/* backspace char */


/* padding constants */

#define KILLNPAD 0.05
#define INSLNPAD 0.25
#define DELLNPAD 0.25
#define INSCHPAD 0.05
#define CURPAD 0.01
#define INITPAD 0.05
#define DELPAD 0.05
#define CLRSCNPAD 1.00
#define REVPAD 0.10


static int curX, curY, Baud, DesHL, CurHL;

static float BaudFactor;

#ifdef VAX
static
enum IDmode { m_insert = 1, m_overwrite = 0} DesiredMode;

static
enum Vmode { v_regular = 1, v_reverse = 0} Vimage;
#else
int DesiredMode, Vimage;
#define m_insert	1
#define	m_overwrite	0
#define v_regular	1
#define v_reverse	0
#endif

static
INSmode (new)
#ifdef VAX
enum IDmode new;
#else
int new;
#endif
{
	DesiredMode = new;
}

static HLmode (new)
{
	DesHL = new;
}


static SetHL (OverRide)
{


	register Des = OverRide ? 0 : DesHL;

	if (Des == CurHL)
		return;
	if (Vimage == v_reverse)
		printf (Des ? REVOFF : REVON);
	else
		printf (Des ? REVON : REVOFF);
	CurHL = Des;
	pad(1,REVPAD);


}


static inslines(n)
{
    SetHL(1);


    while(n--) {
	printf(INSLN);
	pad(1,INSLNPAD);
    }
}

static dellines(n)
{
    SetHL(1);

    while(n--) {
	printf(DELLN);
	pad(1,DELLNPAD);
    }
}

static writechars(start, end)
register char *start, *end;
{
    int insmode =0;
	    
	
    SetHL(0);
    if (DesiredMode == m_insert) {
	printf(INSCHON);
	insmode++;
    }
    while ((start <= end) && ((curY != (LINES -1)) || (curX < (NCOLS)))) {
	pch(*start++);
	curX++;
    }
}

static blanks(n)
register int n;
{
    int insmode;
    int len = n;

    insmode = 0;
    SetHL(0);
    curX += n;
    if (DesiredMode == m_insert) {
	printf(INSCHON);
	insmode++;
    }
    while(n--) pch(' ');
}

static
pad (n, f)
float f; {
return;
}

static topos(row,column)
register int row, column;
{
    SetHL(1);
	row++;
	column++;
    if(curX != column || curY != row) {
	if(cur););;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	    else if(curX == column -1) printf(CURFWD);
	    else if(curY == row +1) printf(CURUP);
	    else if(curY == row -1) printf(CURDWN);
	    else printf(CURPOS,row+31,column+31);
	}
	else {
	    if(row == 1 && column == 1) {
		printf(CURHOME);
	    }
	    else printf(CURPOS,(row+31)&0x7f,(column+31)&0x7f);
	}
	curX = column;
	curY = row;
/*	pad(1,CURPAD);*/
    }
}


static init (BaudRate)
{
	BaudFactor = BaudRate / 100.;
	Baud = BaudRate;
/*	MetaFlag++; */
}

static reset()
{
    printf(H19INIT);
    curX = curY = 1;
    CurHL = 0;
    DesiredMode = m_overwrite;
    pad(1,INITPAD);
    wipescreen();
}

cleanup()
{
    SetHL(1);
    printf(H19EXIT);
    topos(24,1);
    sleep(1);
}

static wipeline()
{
    SetHL(1);
    printf(KILLN);
    pad(1,KILLNPAD);
}

static wipescreen()
{
    SetHL(1);

/*
#ifdef BIGH19
    topos(25,1);
    printf(KILLN);
    topos(1,1);
#endif
*/
    printf(CLRSCN);
    pad(1,CLRSCNPAD);
}
    
static delchars(n)
{
    int len = n;
	
    SetHL(1);
    while(n--) printf(DELCHR);
    pad(len,DELPAD);
}


Trm()
{
    Vimage = v_regular;

    tt.t_length = LINES;
    tt.t_INSmode = INSmode;
	tt.t_HLmode = HLmode;
	tt.t_inslines = inslines;
	tt.t_dellines = dellines;
	tt.t_blanks = blanks;
	tt.t_init = init;
	tt.t_cleanup = cleanup;
	tt.t_wipeline = wipeline;
	tt.t_wipescreen = wipescreen;
	tt.t_topos = topos;
	tt.t_reset = reset;
	tt.t_delchars = delchars;
	tt.t_writechars = writechars;
	tt.t_window = NULL;
	reset();
	return(tt.t_length);
}



	
    
pch(c)
{
#ifdef VAX
    Putc(c,&termout);
#else
	write(1,&c,1);
#endif
}



putp(p)
char p;
{
	writechars(&p,&p);
@//E*O*F h19.c//
chmod u=rw,g=r,o= h19.c
 
echo x - jovelink.z10
sed 's/^@//' > "jovelink.z10" <<'@//E*O*F jovelink.z10//'
main+extend+funcs+buf+case+cmode+
curs+delete+disp+draw+strncpy+
inc+insert+io+marks+meta+misc+
move+proc+re+screen+rawio+
tag+temp+h19+term+terms+ttout+
wind+inter+format+stat+gcsec
jove
jove
\c86\lib\c86b2s
@//E*O*F jovelink.z10//
chmod u=rw,g=r,o= jovelink.z10
 
echo x - makefile.z10
sed 's/^@//' > "makefile.z10" <<'@//E*O*F makefile.z10//'
jove.exe part1 part2 part3
	link @jovelink.z10

part1 buf.obj case.obj cmode.obj curs.obj delete.obj disp.obj draw.obj extend.obj funcs.obj inc.obj insert.obj io.obj

part2 main.obj marks.obj meta.obj misc.obj move.obj proc.obj re.obj screen.obj tag.obj temp.obj h19.obj term.obj rawio.obj

part3 terms.obj ttout.obj wind.obj format.obj inter.obj stat.obj strncpy.obj gcsec.obj

install
	copy jove.exe \bin

clean
	del *.obj
	del jove.exe

backup
	copy *.h a:/v
	copy *.c a:/v
	copy *.asm a:/v

buf.obj buf.c stat.h
	cc  buf -ib -h\c86\include\
case.obj case.c
	cc  case -ib -h\c86\include\
cmode.obj cmode.c
	cc  cmode -ib -h\c86\include\
curs.obj curs.c tm.h screen.h
	cc  curs -ib -h\c86\include\
delete.obj delete.c
	cc  delete -ib -h\c86\include\
disp.obj disp.c term.h screen.h signal.h
	cc  disp -ib -h\c86\include\
draw.obj draw.c term.h screen.h
	cc  draw -ib -h\c86\include\
extend.obj extend.c
	cc  extend -ib -h\c86\include\
funcs.obj funcs.c funcs.h files.h
	cc  funcs -ib -h\c86\include\
inc.obj inc.c 
	cc  inc -ib -h\c86\include\
insert.obj insert.c
	cc  insert -ib -h\c86\include\
io.obj io.c files.h term.h stat.h
	cc  io -ib -h\c86\include\
main.obj main.c signal.h
	cc  main -ib -h\c86\include\
marks.obj marks.c
	cc  marks -ib -h\c86\include\
meta.obj meta.c
	cc  meta -ib -h\c86\include\
misc.obj misc.c signal.h
	cc  misc -ib -h\c86\include\
move.obj move.c
	cc  move -ib -h\c86\include\
proc.obj proc.c whoami.h
	cc  proc -ib -h\c86\include\
re.obj re.c
	cc  re -ib -h\c86\include\
screen.obj screen.c temp.h term.h screen.h
	cc  screen -ib -h\c86\include\
tag.obj tag.c
	cc  tag -ib -h\c86\include\
temp.obj temp.c temp.h files.h
	cc  temp -ib -h\c86\include\
h19.obj h19.c jove.h tm.h
	cc  h19 -ib -h\c86\include\
term.obj term.c term.h tune.h
	cc  term -ib -h\c86\include\
terms.obj terms.c tm.h termcap.h term.h screen.h
	cc  terms -ib -h\c86\include\
ttout.obj ttout.c term.h
	cc  ttout -ib -h\c86\include\
wind.obj wind.c term.h screen.h
	cc  wind -ib -h\c86\include\
inter.obj inter.c screen.h
	cc  inter -ib -h\c86\include\
format.obj format.c
	cc format -ib -h\c86\include\
stat.obj stat.c stat.h
	cc stat -ib -h\c86\include\
strncpy.obj strncpy.c
	cc strncpy -ib -h\c86\include\
gcsec.obj gcsec.asm
	masm gcsec,,,.
rawio.obj rawio.asm
	masm rawio,,,.


@//E*O*F makefile.z10//
chmod u=rw,g=r,o= makefile.z10
 
echo x - rawio.asm
sed 's/^@//' > "rawio.asm" <<'@//E*O*F rawio.asm//'
; raw i/o returns using ibm bios ints.
; k. mitchum 12/84.

	include model.h
	include prologue.h

@@z100	equ	TRUE

	public rawgetc, rawchkc

if @bigmodel
rawchkc	proc far
else
rawchkc	proc near
endif
if @z100
		mov dl,0ffh
		mov	ah,6
		int 21h
else
		mov	ah,1
		int	16h
endif
		jz	rawchk1	;if no character
		mov	ax,1
		ret
rawchk1:
		mov	ax,0
		ret
rawchkc	endp

if @bigmodel
rawgetc	proc far
else
rawgetc	proc near
endif
if @z100
		mov	ah,7
		int	21h
else
		mov	ah,0
		int	16h
endif
		ret
rawgetc	endp

	include epilogue.h

	end

@//E*O*F rawio.asm//
chmod u=rw,g=r,o= rawio.asm
 
exit 0