1	SUB SMG_SET_SCROLL(LONG Top_row,LONG Bottom_row,BYTE Vir_disp_num)

	!---------------------------------------------------------------&
	!								&
	!			SMG_SET_SCROLL				&
	!								&
	!		Creation Date:  3-July-1985			&
	!		Author:		Ken Messer			&
	! 		Purpose:        Set a scrolling region within	&
	!				a virtual display		&
	!								&
	!		Modification history				&
	!								&
	!	Date	Description of change(s)			&
	!								&
	!---------------------------------------------------------------&
	!								&
	! Copyright (c) 1985 -	Ken Messer, Allied Electronics, Inc.,	&
	!			401 E. 8th St., Ft. Worth, TX  76102	&
	!								&
	! This software may be copied and distributed freely to anyone	&
	! for non-commerical use provided that this copyright notice is &
	! included.							&
	!---------------------------------------------------------------&

	OPTION TYPE = INTEGER, SIZE = INTEGER LONG

	%include "SMG$LIBRARY:SMG.DFN"


	DECLARE LONG			RS

	EXTERNAL LONG FUNCTION		SMG$Set_display_scroll_region

	EXTERNAL LONG CONSTANT		SS$_Normal,			&
					SMG$_Invrow

	EXTERNAL STRING FUNCTION	Get_Error_Message(LONG)

	!---------------------------------------------------------------&
	!								&
	!		M a i n   P r o g r a m   L o g i c		&
	!								&
	!---------------------------------------------------------------&

	! Set the scrolling region

	RS = SMG$Set_display_scroll_region(Display_id(Vir_disp_num),Top_row, &
		Bottom_row)

	! If the row(s) are invalid, set the entire display

	SELECT RS

	   CASE SS$_Normal

		! ok

	   CASE SMG$_Invrow   ! if invalid row, set the entire display
			      ! as a scrolling region and exit

		RS = SMG$Set_display_scroll_region(Display_id(Vir_disp_num),,)

	   CASE ELSE

		IF RS AND SS$_Normal = 0   THEN
			PRINT Get_Error_Message(RS)
			STOP
		END IF

	END SELECT

32767	SUBEXIT

	END SUB
