100 CALL CLEAR::DIM A$(10),C$(8)

$MLC F 110 10 3000

290 GOSUB 2500
300 RESTORE 1000::I=1
310 READ A$(I):: IF A$(I)="*" THEN A$(I)=""::GOTO 330
320 I=I+1::GOTO 310
330 CALL CLEAR::GOSUB 2000
340 CALL LINK("SCROL1",A$(),C$(),1000)
350 CALL CLEAR::END

; here the text to be scolled

1000 DATA "This is a Scroll made with MLC (My Little Compiler) "
1010 DATA "FULLY INTEGRATED INTO Extended BASIC and that SPEEDS "
1020 DATA "UP your programs!    "
1500 DATA "*"

; 

2000 CALL MAGNIFY(4)
2010 CALL SPRITE(#1,132,9,50,50,1,0)
2030 CALL SPRITE(#2,136,12,50,82,1,0)
2040 CALL SPRITE(#3,140,6,50,100,1,0)
2050 RETURN

; here the definitions of the three sprites

2500 CALL CHAR(132,"0000381C1C1C1626222323217171000000000E1C1C1C2C2E0E464686870F0000")
2510 CALL CHAR(136,"000078303030303030303030317F010000000000000000000000008080000000")
2520 CALL CHAR(140,"000007183020606060606030180F00000000C060200000000000002040000000")
2530 CALL SCREEN(1)::FOR I=1 TO 7::CALL COLOR(I,4,1)::NEXT I
2540 RETURN



$SCROL1
      STARTDATA
        WORDS &wI &wAM &wA1 &wTEXAS_INSTRUMENTS
        WORDS &wCOMPUTER &wUHOH &wWHAT_WAS_THAT
        WORDS &wI &wDO &wNOT &wKNOW &wFOR
        WORD 0
      ENDDATA D
      CLEAR K           ; pointer in D
	DIMTABLE C 6	; 6 words for sprite motions (x,y)
	FOR I 0 5
		RND
		DIV Z 64
		SUB Z 32
		PUTTABLE C(I) Z
	NEXT
	LET R 1        	; first string index for message
	LET U 1		; string table is parameter "1"
	GETPARAM 3 W	; wait loop
	IF=
		INC W	; at least W=1 !
	ENDIF
	DIMTABLE E 256	; enough for 8 lines
	BMOVEVTOC 448 256 E	; load 8 lines (adress 480) from screen to my buffer (E)
	DIMTABLE F 8	; to load one char definition
	LET B E
	INC B		; B = E+1 for one shift
	LET G 1
	COLOR 16 1 16
	FOR I 1 32
		PUTCHAR 14 I 128
		PUTCHAR 24 I 128
		PUTCHAR 1 I 129
		PUTCHAR 12 I 129
	NEXT
	FOR I 2 11
		PUTCHAR I 1 129
		PUTCHAR I 32 129
	NEXT
	LET I 5
	LET J 3
	INTERRUPT
	REPEAT
		GETTABLE C(I) X
		DEC I
		GETTABLE C(I) Y
		SMOTION J X Y
		DEC J
		DEC I
	UNTIL<
	DO
		GETTABLE U(R) M		; string address in M and len in Z compared to zero
	WHILE<>				; while len not null
	    DEC Z	    
	    FOR I 0 Z
		GETTABLE M(I) S		; one character from string
		ADD S 96
		MUL S 8			; s= VDP ram address of char definition
		BMOVEVTOC S 8 F		; take definition
		NDO N 8			; 8 columns
			BMOVE B 255 E		; shift one position to the left
			LET P 31	; fist position in table
			FOR J 0 7
				INTERRUPT
				GETTABLE F(J) A	; one def byte
				COMPARE A 128
				IF>=
					SUB A 128
					LET Q 138	; "*"
				ELSE
					LET Q 128	; " "
				ENDIF
				ADD A A	; shift A for next bit
				PUTTABLE F(J) A ; and stores it
				PUTTABLE E(P) Q	; correct char in table
				ADD P 32	; next line
			NEXT		
			NEG G
			IF<
				COLOR 16 1 16
			ELSE
				COLOR 16 16 1
			ENDIF			
			DEFCHAR 2(N) 42
			BMOVECTOV E 256 448	; copy to screen !!
			GOSUB c			; sprite managment
			NDO J W
			NLOOP			; wait loop
		NLOOP
	    NEXT
	    INC R		; next string
	LOOP
	SMAX 0			; stop all sprites
	GOTO x			; end

; this is the subroutine to verify the positions of the sprites and
; make them bounce

SLABEL c
      TALKING?
      IF<>
            GETTABLE D(K) H           ; next word to say
            IF=
                CLEAR K
                GETTABLE D(K) H
            ENDIF
            INC K
            SAY H
      ENDIF
	LET L 5                         ; index into C() table
	NDO H 3                         ; for 3 sprites
		LET Q 0                   ; default is no change
		GETTABLE C(L) T           ; current vertical motion
		SPOSITION H X Y           ; potition of sprite H (3, 2 or 1)
		LIMIT 8 60 X              ; vertical position into limits?
		IF<>
			NEG T               ; if not, change vertical speed
			PUTTABLE C(L) T     ; and store new motion
			INC Q               ; mark a change
		ENDIF
		DEC L
		GETTABLE C(L) V           ; current horizontal motion
		LIMIT 8 216 Y             ; horizontal position into limits?
		IF<>
			NEG V               ; if not, change horizontal motion
			PUTTABLE C(L) V     ; stores it
			INC Q               ; mark a change
		ENDIF
		DEC L
		ABS Q                     ; just to test Q
		IF<>
			SLOCATE H X Y       ; if a change, new position
			SMOTION H T V       ; and new motion
		ENDIF
		INTERRUPT                 ; to enable auto motion
	NLOOP
RETURN

LABEL x			
$$
$CHAR
        ; the 8 chars are the growing points that form letters in the scroll
        
	0000001818000000 0000183C3C180000 003C7E7E7E7E3C00 7EFFFFFFFFFFFF7E
	7EFFFFFFFFFFFF7E 003C7E7E7E7E3C00 0000183C3C180000 0000001818000000

        ; those two chars to surround the text and the bouncing MLC
        
	S128.0F1E3C78F0783C1EE7E7E7FFFFE7E7E7
$$
$END
; A = one def byte
; B = adress E+1 for scroll
; C = table for sprite motions
; D = table for speech sentence
; E = CPU RAM buffer for 8 lines (bytes)
; F = CPU RAM buffer for one char def (bytes)
; G = flag +/-1 to swap colors of char 128
; H = 
; I = character loop from 0 to len(string)-1
; J = loop for 8 definitions bytes when creating one column
; K = pointer in speech table D
; L =
; M = VDP RAM address of string (bytes)
; N = loop for 8 columns per character
; O =
; P = pointer into E buffer for the 8 new characters when creating a column
; Q = char "*" or " " / flag in subroutine
; R = string index
; S = VDP RAM address of one char definition
; T =
; U = 1 to access the first parameter in CALL LINK as a string array
; V =
; W = wait loop
; X =
; Y =
; Z = len of string



