#include <winscroll.bas>
#include <input.bas>
dim myScreen(22,32,3) as ubyte

starting:
' MODIFY values for scrolling box
miX=6:miY=6:cuantoX=22:cuantoY=12
cls:ink 7
print"Enter Box X: ";:miX=val(input(2)):print miX
print"Enter Box Y: ";:miY=val(input(2)):print miY
print"Enter Box Width: ";:cuantoX=val(input(2)):print cuantoX
print"Enter Box Height: ";:cuantoY=val(input(2)):print cuantoY

for y=0 to 21
	for x=0 to 31
	  myRandom=int(rnd*9)+48
		myInk=int(rnd*7)+1
		myPaper=int(rnd*7)+1
		myScreen(y,x,0)=myRandom
		myScreen(y,x,1)=myInk
		myScreen(y,x,2)=myPaper
		print ink myInk;paper myPaper;at y,x;chr(myRandom)
	next x
next y

PaintAll()
PRINT AT 0,10;"WinScrollUp"
PAUSE 0

dim dir as ubyte

for TIMES=1 to cuantoY
		WinScrollUp(miX,miY,cuantoX,cuantoY)
		for x=miX to miX+cuantoX-1
			print paper 0;at miY+cuantoY-1,x;"."
		next x
		PAUSE 0
next TIMES

PaintAll()
PRINT AT 0,10;"WinScrollDown"

for TIMES=1 to cuantoY
		WinScrollDown(miX,miY,cuantoX,cuantoY)
		for x=miX to miX+cuantoX-1
			print paper 0;at miY,x;"."
		next x
		PAUSE 0
next TIMES

PaintAll()
PRINT AT 0,10;"WinScrollLeft"
		
for TIMES=1 to cuantoX
		WinScrollLeft(miX,miY,cuantoX,cuantoY)
		for y=miY to miY+cuantoY-1
			print at y,miX+cuantoX-1;"."
		next y
		PAUSE 0
next TIMES

PaintAll()
PRINT AT 0,10;"WinScrollRight"
for TIMES=1 to cuantoX
		WinScrollRight(miX,miY,cuantoX,cuantoY)
		for y=miY to miY+cuantoY-1
			print at y,miX;"."
		next y
		PAUSE 0
next TIMES
PaintAll
PRINT AT 21,10;"    END    "
goto starting

sub PaintAll()
	for y=miY to miY+cuantoY-1
		for x=miX to miX+cuantoX-1
			print FLASH 1;ink myScreen(y,x,1);paper myScreen(y,x,2);at y,x;chr(myScreen(y,x,0))
		next x
	next y
	PRINT AT 21,10;"Press any key"
	pause 0
end sub