The program:

 

! Write a subroutine to clear the entire screen and

! fill it with an 80 by 24 grid of dots.

! Such a subroutine might be used in a

! computer graphics program.

! Test the program with i >= 3, j >= 5 first, do trace, slow (i,j)

! Set i >= 24, j >= 80

! Test the program with do trace, fast(i,j)

 

! For the subroutine:

! pseudocode:

! 1. clear the screen

! 2. write a line of dots

! 3. go to the next line

! 4. loop till through

! try the program for various lines and dots

 

LET lines = 24

LET dots = 80

 

CALL screen (lines,dots)

END

 

 

SUB screen (LINES,DOTS)

CLEAR

DO until i >= LINES

LET j= 0

DO until j >= DOTS !write a row of periods

LET j=j+1

PRINT ".";

LOOP

PRINT !go to the next line

LET i = i + 1

IF mod(i,2) > 0 then

SET COLOR "red"

ELSE

SET COLOR "blue"

END IF

LOOP

SOUND 1000 ,.1

END SUB

Same output as PP7.8.1:

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................

................................................................................