' Rain Program
' Made for qbasic and gbasic
' Gab 2000
' Qb Version

DEFINT A-Z

max = 400       ' Max
endloop = 0

DIM RainX(max) AS INTEGER
DIM RainY(max) AS INTEGER
DIM RainC(max) AS INTEGER
DIM RainP(max) AS INTEGER

SCREEN 13

' --- Lets create the palette
i = 0
c = 65

FOR i = 0 TO 63
  c = c - 1
  OUT &H3C8, c
  OUT &H3C9, 0
  OUT &H3C9, i \ 2
  OUT &H3C9, i
NEXT i

' Random

FOR i = 0 TO max
  RainX(i) = RND * 300
  RainY(i) = RND * 190
  RainC(i) = RND * 63 + 1
  RainC(i) = RainC(i)
  RainP(i) = RainC(i) \ 16
NEXT i

DO WHILE NOT endloop = 1

  IF INKEY$ = CHR$(27) THEN
    endloop = 1
    GOTO Loop1
  END IF

  FOR i = 0 TO max
    RainY(i) = RainY(i) + 1

    IF NOT RainP(i) = 0 THEN
    IF RainY(i) \ RainP(i) > 195 THEN
      RainX(i) = RND * 300
      RainY(i) = 0
      RainC(i) = RND * 63 + 1
      RainC(i) = RainC(i)
      RainP(i) = RainC(i) \ 16
    END IF
    END IF
  NEXT i

  CLS

  FOR i = 0 TO max
  IF NOT RainP(i) = 0 THEN
    PSET (RainX(i), RainY(i) \ RainP(i)), RainC(i)
  ELSE
    PSET (RainX(i), RainY(i)), RainC(i)
  END IF
  NEXT i

Loop1:
LOOP

SCREEN 0: WIDTH 80

