Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/23/graphi.sim
There is 1 other file named graphi.sim in the archive. Click here to see a list.
OPTIONS(/E);
EXTERNAL CHARACTER PROCEDURE getch;

CLASS graphics;  COMMENT: Version 3, April 1977, $ke Blomberg;
BEGIN
    CHARACTER amode,gmode,enq,esc,cursor_char,hx,lx,hy,ly,bs,ht;
    CHARACTER oldhy,oldly,oldhx,oldlx,oldex;
    BOOLEAN after_cursor; INTEGER savei,savej;


procedure chooseandsend;
	begin
	if hy\=oldhy then
		begin
		outchar(hy); oldhy:=hy;
		end;

	if hx\=oldhx then
		begin
		outchar(ly); oldly:=ly;
		outchar(hx); oldhx:=hx;
		end
	else if ly\=oldly then
		begin
		outchar(ly); oldly:=ly;
		end;

	outchar(lx); oldlx:=lx;

	end***chooseandsend***;
    

    PROCEDURE reset_tty;
    BEGIN	Outchar(amode); Breakoutimage;
    END***RESET_TTY***;


    PROCEDURE transform(i,j); INTEGER i,j;
    BEGIN	INTEGER a,b;
	a:=i//32; b:=i-32*a; hx:=Char(32+a); lx:=Char(64+b);
	a:=j//32; b:=j-32*a; hy:=Char(32+a); ly:=Char(96+b);
    END***TRANSFORM***;


    PROCEDURE move(i,j); INTEGER i,j;
    BEGIN	transform(i,j); Outchar(gmode);
	chooseandsend; 	Breakoutimage;
        savei:=i; savej:=j; after_cursor:=false;
    END***MOVE***;


    PROCEDURE Draw(i,j); INTEGER i,j;
    BEGIN	
        If after_cursor then move(savei,savej);
        transform(i,j); 	chooseandsend;
	Breakoutimage;
        savei:=i; savej:=j; after_cursor:=false;
    END***DRAW***;
    PROCEDURE point(i,j);
    INTEGER i,j;

    BEGIN	transform(i,j); outchar(gmode);
		chooseandsend; outchar(oldlx); breakoutimage;
		savei:=i; savej:=j; after_cursor:=false;

    END***POINT***;

    

    PROCEDURE cursor (c,x,y);
    NAME c,x,y; CHARACTER c; INTEGER x,y;

    BEGIN	Outchar(esc); Outchar(cursor_char); Breakoutimage;

	c:=getch;
	hx:=Inchar; lx:=Inchar;
	hy:=Inchar; ly:=Inchar;
		
	x:=32*(Rank(hx)-33)+Rank(lx);
	y:=32*(Rank(hy)-33)+Rank(ly);
		
        reset_tty; after_cursor:=true;

    END***CURSOR***;
  PROCEDURE getpos(x,y);
  NAME x,y;  INTEGER x,y;
  BEGIN CHARACTER c;
    Outchar(esc); Outchar(enq); Breakoutimage;
    c:=getch; COMMENT:c is the terminal status byte and not used;

	hx:=getch; lx:=getch;
	hy:=getch; ly:=getch;
		
	x:=32*(Rank(hx)-33)+Rank(lx);
	y:=32*(Rank(hy)-33)+Rank(ly);
		
        reset_tty;

  END***getpos***;

  COMMENT: Ascii character definitions;

    amode:=Char(31); gmode:=Char(29); esc:=Char(27);
    cursor_char:=Char(26);  enq:=Char(5);


END***GRAPHICS***