Calling Routine For Marquee
Kenneth Finn
Bedford, NY
Building on an intriguing video display technique ("Marquee," February 1982, p. 135), this program makes it easy to add horizontal scrolling which is independent of BASIC. Line 20 can accept a string either from the keyboard or a DATA statement READ. The rest is automatic and, because this routine uses interrupts, it is "transparent" to other things BASIC is doing at the time. It works as printed for Upgrade and 4.0 BASIC PET/CBM's. If you have an 80-column screen, change the 40 in line 864 to an 80. Change the speed by changing the five in line 864.
"Marquee." by Mark Bernstein (COMPUTE!, February 1982, #21), is an exciting program that gives the capability to make the top line of the screen into a billboard with strings moving from right to left across it.
Since the program is in machine language, it requires a special set-up to use from BASIC. The way the program was originally written, you load the Accumulator and X register of the 6502 with the address of the string you want printed before calling the routine. In his article he coded such a string for demonstration. However, when you are writing a BASIC program, setting up such a string is not so easy.
The following routine can be used in any BASIC program to make Marquee work simply and easily for you. The trick is that locations 68 and 69 contain an address for the location of the last referenced string in the BASIC program. Thus, we must make our BASIC program reference the correct string, then tack on a chr$(0) to it as an end marker, and then indirectly get its address. The following program does this for you in the form of a subroutine.
10 INPUT /ENTER STRING/;A$ 20 LET A$ = A$ + CHR$(0) : GOSUB100 30 REM 40 GOTO 10 50 END 60 REM 70 REM 100 REM MARQUE CALLING SUBROUTINE 103 REM 105 IF PEEK (145) <> 46 THEN 105 110 POKE1009,PEEK((PEEK (68) + 2 + PEEK (69) *256): REM HI BYTE 120 POKE 1011,PEEK((PEEK(68) + 1 + PEEK(69)*256): REM LO BYTE 130 SYS1008:RETURN 140 REM 150 REM
The above routine makes using Marquee from BASIC simple and makes the routine even more valuable.
10 GOSUB800 20 INPUT A$ : A$ = A$ + CHR$ (0) : REM OR READ A$ (FROM A DATA STATEMENT IN PROGRAM) 30 POKE1009, PEEK (PEEK (68) + PEEK (69) * 256 + 2) : REM HIGH BYTE 40 POKE1011, PEEK (PEEK (68) + PEEK (69) * 256 + 1) : REM LOW BYTE 50 SYS1008 60 END 800 REM MARQUEE MACHINE LANGUAGE 810 FOR ADRES = 864 TO 1015 : READ DATTA : POKE ADRES, DATTA : NEXT ADRES 820 RETURN 864 DATA 40, 0, 5,85, 228, 7 870 DATA 5, 40, 160, 1, 185, 0 876 DATA 128, 153, 255, 127, 200, 204 882 DATA 96, 3, 208, 97, 3, 240, 15 894 DATA 192, 255, 240, 11, 200, 140 900 DATA 101, 3, 172, 96, 3, 153 906 DATA 255, 127, 96, 172, 96, 3 912 DATA 169, 32, 153, 255, 127, 238 918 DATA 103, 3, 173, 103, 3, 205 924 DATA 96, 3, 176, 48, 96, 172 930 DATA 101, 3, 177, 0, 41, 191 936 DATA 96, 141, 0, 0, 142, 1 942 DATA 0, 169, 0, 141, 103, 3 948 DATA 141, 101, 3, 173, 144, 0 954 DATA 141, 99, 3, 173, 145, 0 960 DATA 141, 100, 3, 120, 169, 223 966 DATA 141, 144, 0, 169, 3, 141 972 DATA 145, 0, 88, 96, 120, 173 978 DATA 99, 3, 141, 144, 0, 173 984 DATA 100, 3, 141, 145, 0, 88 990 DATA 96, 206, 102, 3, 16, 9 996 DATA 32, 104, 3, 173, 98, 3 1002 DATA 141, 102, 3, 108, 99, 3 1008 DATA 162, 3, 169, 248, 32, 169 1014 DATA 3, 96