{***********************************************************************}
{									}
{ __CSetScn  Set one of 5 specific cursor types 			}
{									}
{ procedure __CSetScn(CType : _CursorType);				}
{									}
{	      CType	One of 7 predefined cursor appearance types:	}
{									}
{			_CBottom    Standard 2-scan lines at bottom	}
{			_CTop	    2 scan lines at top of box		}
{			_CBlock     All scan lines: blinking box	}
{			_CLowBlock  Low half of the box 		}
{			_CHighBlock High half of the box		}
{			_CDash	    Hyphen position			}
{			_COff	    Turn the cursor off 		}
{			_COn	    Turn the cursor on			}
{									}
{ Description This procedure sets the appearance of the cursor to one	}
{	      of the above predefined values, including turning the cur-}
{	      sor on or off.  Because the EGA and VGA require specific	}
{	      settings for the different number of scan lines and when	}
{	      cursor emulation is enabled, the settings are handled via }
{	      a case statement.  This procedure calls __CSizeScn to set }
{	      the starting and ending scan lines and __COffScn to	}
{	      toggle the cursor on and off.				}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

procedure __CSetScn(CType : _CursorType);

  var
    CTop,CBot : byte;
    CHalf     : byte;
    CMaxLine  : byte;
    IsEmulOn  : boolean;

  begin {__CSetScn}

    IsEmulOn := __IsEmScn;	       { Determine emulation state	}
    if (IsEmulOn) then
       CMaxLine := 7
    else
       CMaxLine := MaxScanLine_;
    CHalf := (CMaxLine div 2) + 1;

    case Ctype of
      _CBottom	  : begin
		      if ((_CurDevice = _EgaAdapter) or
					 (_CurDevice = _VgaAdapter)) then
			 if (IsEmulOn) then
			    if (_CurRows = 25) then
			       begin
				 CTop := 6;
				 CBot := 7
			       end
			    else
			       begin
				 CTop := CMaxLine - 3;
				 CBot := CMaxLine - 1
			       end
			 else
			    begin
			      CTop := CMaxLine - 2;
			      CBot := CMaxLine
			    end
		      else
			 begin
			   CTop := CMaxLine -1;
			   CBot := CMaxLine
			 end;
		    end;
      _CTop	  : begin
		      CTop := 0;
		      if ( ((_CurDevice = _EgaAdapter) or
					(_CurDevice = _VgaAdapter))
						and (not IsEmulOn)) then
			 CBot := 2
		      else
			 CBot := 1;
		    end;
      _CBlock	  : begin
		      CTop := 0;
		      CBot := CMaxLine;
		    end;
      _CLowBlock  : begin
		      CTop := CHalf;
		      CBot := CMaxLine;
		    end;
      _CHighBlock : begin
		      CBot := CHalf - 1;
		      CTop := 0;
		      if ((_CurDevice = _VgaAdapter) and (IsEmulOn)) then
			 begin
			   CTop := 0;
			   CBot := 3
			 end
		    end;
      _CDash	  : begin
		      CTop := CHalf - 1;
		      CBot := CHalf;
		      if (IsEmulOn) then
			 if (_CurDevice = _VgaAdapter) then
			    begin
			      CTop := 2; { Best that can be done.	}
			      CBot := 3
			    end
			 else
			    begin end
		      else if (_CurDevice = _EgaAdapter) then
			 Inc(CBot)
		    end;
      _COff	  :
		    begin
		      __COffScn(TRUE);
		      Exit
		    end;
      _COn	  :
		    begin
		      __COffScn(FALSE);
		      Exit
		    end;
      else
	Exit
    end; {case CType}

    __CSizeScn(CTop,CBot);

  end;	{__CSetScn}
