invent 8bit

SAM Coupe Upward Scroller

Simple BASIC-based scroller routine

This is a simple upwards scroller written in SAM BASIC and included on FRED 59. There had been an upward scroller demo in a previous magazine, but I couldn't figure out how it worked so implemented my own. It generates double-height, double thickness characters scrolling up the screen.

Upscroller appeared in Bits & Bobs, Fred 59 Upscroller appeared in Bits & Bobs, Fred 59

The text from the info page is shown below.

The Amazingly Exciting Upwards Scroller

On issue 56 there was a demo which had been written in BASIC call 'Debut'. The demo had a upwards scrolling scroller (?) which unusually for basic was quite fast. When I first got issue 56 the disk was buggered and so nothing would load, so I sent it back. When it finally arrived and I read the debut scrollie it said something about the BIN$ command being used. I thought I'd try it out, seeing as the program was protected and I couldn't have a look at it I started from scratch.

Maybe I'm simple but I just can't see how the BIN$ command could be used. Instead I wrote a little program which displays the characters on screen one by one and maps them into a DIMensional array, ready to be poked onto screen. I then wrote the display program and as you can see (<) it works just fine. I think it's quite fast and for an hours work it's not too bad. But I'm not going to take any credit for the idea, because it wasn't my own... The whole point of this then?? It's just for anyone writing a demo e.t.c who wants a fast upwards scrolling scrollie. To take a look at the program press SPACE and the program will drop to BASIC for you. To get back to this just type START and the program will restart.

Do not type RUN or the program will have to remap all the characters in again and it takes a bit of time.... Well thats it.... Enjoy

In the magazine

Martin Fitzpatrick has written a simple upward scroller program, after being influenced by the Debut demo. Have a look and you too will be able to write BASIC upwards scrollies.

Retrospective (2022)

Looking at it now this is inefficient: to build the scroller there is a preparation routine which iterates across all the characters, printing them to the screen & then using POINT to read which pixels are set. This is then poked into memory, so we can retrieve it for output.

While that works we could instead use BIN to get the bit pattern for the character directly (without printing and the reading back from the screen) and then expand that 2x -- exactly as mentioned in the text.

I'm not sure, without testing, whether this would be quick enough to do while outputting: the current implementation can POKE an entire line in one go as the characters have been pre-doubled in width. If not, this would just speed up the cache generation.

Tiny games for your BBC micro:bit.

To support developers in [[ countryRegion ]] I give a [[ localizedDiscount[couponCode] ]]% discount on all books and courses.

[[ activeDiscount.description ]] I'm giving a [[ activeDiscount.discount ]]% discount on all books and courses.

Scroller Text

The included demo scroller text says:

HELLO EVERYONE.... HELLO EVERYONE.... HELLO EVERYONE.... HELLO EVERYONE.... REPETITIVE ISNT IT? HELLO EVERYBODY.... HELLO EVERYBODY.... HELLO EVERYBODY.... WELL IN GOOD SCROLLY FASHION I'LL DO SOMETHING INTERESTING..... LOOK I'M STANDING ON MY HEAD..... LOOK! LOOK! WEEEEEEEEEEEEHEEEEEHEEE! THUD!.... CHOOCHOO! HERMAN THE CATFISH DOG..... CHOOGLIENIGLE...... ARTHUR DENT IS GREEN..... HELLOS : RIK MOORE - WHAT A BLOODY COINCIDENCE, I MEAN , SOMEONE MY DAD WENT TO UNIVERSITY WITH LIVING TWO STREETS AWAY..... DEREK MORGAN - 99 CLUMP, 99 CLUMP, 99 CLUMP... SORRY, HOW GOES IT? COLIN M - HA HA HA HA HA HA HA HA HA, HO HO HO HO, HA... J CURRY, MICHAEL BOWEN, GRAHAM GORING - BLAST! BLOODY BUGS, AAARGH! COLIN A - HA HA, TESTS, HA HA, YOU POOR SOD.... WELL THATS THAT DONE, THERES MORE BUT I CANT BE BOTHERED TYPING THEM OUT... THIS SCROLLY GOES OOOP, THIS SCROLLY GOES DOOOOWN" RIGHT GET THIS, NEXT TRICK, NOW I CAN MAKE IT STOP.....5 4 3 2 1 0 DA DA DA DAAAA! WELL MUST GO HIGGLE GOING GOING GONE WRAP YOURSELF IN FOIL AND STAND IN A THUNDRSTORM GOODBYE

I no longer recommend standing in a thunderstorm.

Source Code

basic
   10 WINDOW : MODE 4: CLS :biggles
   20 LOAD "uptext"  CODE 100000
   30 MODE 3: CSIZE 6,8
   32 LET xrg=512,yrg=192
   35 SETTEXT
   36 PRINT AT 21,27;"<<<Use Cursors To Change Page>>>"
   40 WINDOW 6,69,0,21
   45 LET P=0
   50 TEXTON P
   55 LET Di=0
   70 DO
   80 FOR A=1 TO LEN A$
   90 LET B$=A$(A),d= CODE b$
   95 IF CODE B$=255 THEN LET DI=1: ELSE LET DI=0
  100 FOR B=1 TO 8
  105 LET COD= CODE INKEY$
  106 IF COD=8 THEN LET P=0:TEXTON P
  107 IF COD=9 THEN LET P=1:TEXTON P
  108 IF COD=32 THEN STOP
  110 LET pp$=poke$(d,b)
  120 IF Di=0 THEN POKE 532352,PP$
  125 IF Di=0 THEN POKE 532340,PP$
  130 IF di=0 THEN SCROLL 2,1,0,175,16,192
  135 IF di=0 THEN SCROLL 2,1,466,175,16,192
  140 NEXT B
  150 NEXT A
  160 LOOP
  170 DEF PROC biggles
  180 DIM poke$(255,8,8)
  190 FOR a=32 TO 90: REM alter FOR letters covered (ASCII character CODE )
  200 PRINT AT 0,0; CHR$ a
  210 FOR b=1 TO 8
  220 FOR c=1 TO 8
  230 LET v= POINT (c,174-b)
  240 IF v <> 0 THEN LET poke$(a,b,c)= CHR$ 255: ELSE LET poke$(a,b,c)= CHR$ 0
  250 NEXT C
  260 NEXT b
  270 NEXT a
  280 END PROC
 1000 DEF PROC START: GO TO 30: END PROC
 1010 DEF PROC TEXTON PAGE
 1015 LET F=PAGE*1344
 1016 FOR XX=0 TO 20
 1017 LET X=XX*64
 1020 PRINT AT XX,0; MEM$ (100000+F+X TO 100000+F+X+64)
 1025 NEXT XX
 1030 END PROC
 2000 DEF PROC SETTEXT
 2010 LET a$="HELLO EVERYONE.... HELLO EVERYONE.... HELLO EVERYONE.... HELLO EVERYONE.... REPETITIVE ISNT IT? HELLO EVERYBODY.... HELLO EVERYBODY.... HELLO EVERYBODY.... WELL IN GOOD SCROLLY FASHION I'LL DO SOMETHING INTERESTING..... LOOK I'M STANDING ON MY HEAD..... LOOK! LOOK! WEEEEEEEEEEEEHEEEEEHEEE! THUD!.... CHOOCHOO! HERMAN THE CATFISH DOG..... CHOOGLIENIGLE...... ARTHUR DENT IS GREEN..... HELLOS : RIK MOORE - WHAT A BLOODY COINCIDENCE, I MEAN , SOMEONE MY DAD WENT TO UNIVERSITY WITH LIVING TWO STREETS AWAY..... "
 2020 LET A$=A$+"DEREK MORGAN - 99 CLUMP, 99 CLUMP, 99 CLUMP... SORRY, HOW GOES IT?  COLIN M - HA HA HA HA HA HA HA HA HA, HO HO HO HO, HA...   J CURRY, MICHAEL BOWEN, GRAHAM GORING - BLAST! BLOODY BUGS, AAARGH!  COLIN A - HA HA, TESTS, HA HA, YOU POOR SOD....   WELL THATS THAT DONE, THERES MORE BUT I CANT BE BOTHERED TYPING THEM OUT...  THIS SCROLLY GOES OOOP,  THIS SCROLLY GOES DOOOOWN"
 2030 LET a$=a$+" RIGHT GET THIS, NEXT TRICK, NOW I CAN MAKE IT STOP.....5  4  3  2  1  0 "+ STRING$ (10, CHR$ 255)+" DA DA DA DAAAA!  WELL MUST GO HIGGLE"+ CHR$ 255+" GOING GOING GONE     WRAP YOURSELF IN FOIL AND STAND IN A THUNDRSTORM   "+ CHR$ 255+"      GOODBYE                         "+ STRING$ (10, CHR$ 255)
 2050 END PROC