Article 8984 of comp.sys.amiga:
Path: mcdsun!noao!hao!oddjob!uwvax!rutgers!sri-spam!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!enea!ttds!draken!sics!jw
From: jw@sics.se (Johan Widen)
Newsgroups: comp.sys.amiga
Subject: VT100R2.7 fix: allow more than 24 rows (31 for PAL Amiga)
Message-ID: <1533@sics.se>
Date: 10 Oct 87 00:35:57 GMT
Reply-To: jw@sics.UUCP (Johan Widen)
Organization: Swedish Institute of Computer Science, Kista
Lines: 171

vt100 currently assumes that a non interlaced screen is 200 scan lines high.
This is not true for PAL Amigas and for Amigas with MoreRows. The following
diff will allow you to have as many rows as will fit on the screen. A PAL
Amiga vt100 can have 31 rows in non interlaced mode and 63 rows in interlaced
mode.

The algorithm for determining the screen size is not bullet proof but should
work fairly well: I stole it from mg (a.k.a. MicroGNUEmacs).

*** init.c	Wed Oct  7 17:14:42 1987
--- init.c.new	Fri Oct  9 18:52:02 1987
***************
*** 194,199 ****
--- 194,202 ----
      FILE    *fd = NULL;
      char    *p, *t, *ifile;
      int     l, dont_init = 0;
+     int	    screen_height, max_screen_lines, border_size;
+     int	    wb_lace;
+     register struct Screen *s;
  
      doing_init = 1;	/* make sure we only allow INIT script commands */
      if (argc > 1) {
***************
*** 242,258 ****
      doing_init = 0;
  
      /* Now set up all the screen info as necessary */
!     if (p_interlace == 0) {
! 	if (p_lines > 24) p_lines = 24;
! 	MINY = 14;
! 	NewWindow.Height    = (long)((p_lines*8)+8);
! 	}
!     else {
! 	if (p_lines > 48) p_lines = 48;
! 	MINY = 16;
  	NewScreen.ViewModes |= LACE;
! 	NewWindow.Height    = (long)((p_lines*8)+10);
! 	}
      NewWindow.MinHeight = NewWindow.Height;
      NewWindow.MaxHeight = NewWindow.Height;
      NewWindow.TopEdge	= 0L;
--- 245,277 ----
      doing_init = 0;
  
      /* Now set up all the screen info as necessary */
!     IntuitionBase = (struct IntuitionBase *)
! 	OpenLibrary("intuition.library", INTUITION_REV);
!     if( IntuitionBase == NULL )
! 	cleanup("can't open intuition",1);
! 
!     Forbid();	/* user might be moving screen */
!     for (s = IntuitionBase->FirstScreen; s ; s = s->NextScreen)
! 	if ((s->Flags & SCREENTYPE) == WBENCHSCREEN)
! 	    break;
!     screen_height = s->Height;
!     wb_lace = s->ViewPort.Modes & LACE;
!     Permit();
!     if(wb_lace)
! 	screen_height = screen_height/2;
!     if (p_interlace) {
!         max_screen_lines = (screen_height*2)/8 - 1;
! 	border_size = screen_height*2 - max_screen_lines*8;
  	NewScreen.ViewModes |= LACE;
!     } else {
!         max_screen_lines = screen_height/8 - 1;
! 	border_size = screen_height - max_screen_lines*8;
!     }
!     if (p_lines > max_screen_lines) p_lines = max_screen_lines;
!     if(border_size > 10)
! 	border_size = 10;
!     MINY = 14 + border_size - 8;
!     NewWindow.Height    = (long)((p_lines*8) + border_size);
      NewWindow.MinHeight = NewWindow.Height;
      NewWindow.MaxHeight = NewWindow.Height;
      NewWindow.TopEdge	= 0L;
***************
*** 265,275 ****
  	if (p_depth > 2) p_depth = 2;
  	if (p_depth < 1) p_depth = 1;
  	NewScreen.Depth     = (long)p_depth;
! 	NewScreen.Height    = (long)((p_lines*8)+16);
  	if (p_interlace == 1)
! 	    NewScreen.TopEdge	= (long)(400 - NewScreen.Height);
  	else
! 	    NewScreen.TopEdge	= (long)(208 - NewScreen.Height);
  	}
      else {
  	p_depth			= 2L;
--- 284,294 ----
  	if (p_depth > 2) p_depth = 2;
  	if (p_depth < 1) p_depth = 1;
  	NewScreen.Depth     = (long)p_depth;
! 	NewScreen.Height    = (long)NewWindow.Height;
  	if (p_interlace == 1)
! 	    NewScreen.TopEdge	= (long)(screen_height*2 - NewScreen.Height);
  	else
! 	    NewScreen.TopEdge	= (long)(screen_height - NewScreen.Height);
  	}
      else {
  	p_depth			= 2L;
***************
*** 308,318 ****
  int	i;
  BYTE	*b,*c;
  
- IntuitionBase = (struct IntuitionBase *)
-     OpenLibrary("intuition.library", INTUITION_REV);
- if( IntuitionBase == NULL )
-     cleanup("can't open intuition",1);
- 
  GfxBase = (struct GfxBase *)
      OpenLibrary("graphics.library",GRAPHICS_REV);
  if( GfxBase == NULL )
--- 327,332 ----
***************
*** 569,585 ****
  menu[3].FirstItem = &UtilItem[0];  /* pointer to first item in list*/
  }
  
! void do_menu_init(menuitem, menutext, initentry, max)
  struct MenuItem menuitem[];
  struct IntuiText menutext[];
  struct HowToInit *initentry;
! int max;
  {
      int n, nplus1;
      char **temp;
  
      /* initialize each menu item and IntuiText with loop */
!     for( n=0; n < max; n++ ) {
  	nplus1 = n + 1;
  	temp = initentry->text;
  	menutext[n].IText = (UBYTE *)temp[n];
--- 583,599 ----
  menu[3].FirstItem = &UtilItem[0];  /* pointer to first item in list*/
  }
  
! void do_menu_init(menuitem, menutext, initentry, maxValue)
  struct MenuItem menuitem[];
  struct IntuiText menutext[];
  struct HowToInit *initentry;
! int maxValue;
  {
      int n, nplus1;
      char **temp;
  
      /* initialize each menu item and IntuiText with loop */
!     for( n=0; n < maxValue; n++ ) {
  	nplus1 = n + 1;
  	temp = initentry->text;
  	menutext[n].IText = (UBYTE *)temp[n];
***************
*** 608,612 ****
  	menutext[n].ITextFont = NULL;
  	menutext[n].NextText = NULL;
  	}
!     menuitem[max-1].NextItem = NULL;
  }
--- 622,626 ----
  	menutext[n].ITextFont = NULL;
  	menutext[n].NextText = NULL;
  	}
!     menuitem[maxValue-1].NextItem = NULL;
  }

-- 
Johan Widen
SICS, PO Box 1263, S-163 13 SPANGA, SWEDEN
{mcvax,munnari,cernvax,diku,inria,prlb2,penet,ukc,unido}!enea!sics.se!jw
Internet: jw@sics.se


