home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-02-26 | 4.4 KB | 150 lines |
- ' Message scroller by PAUL OVERY
- '
- ' Paul Overy
- ' "Fryup Productions"
- ' 27 Barton Rd
- ' Maidstone
- ' Kent ME15 7BU
- '
- ' Please don't forget to include my name in your programs when using my algo.
- '----------------------------------------------------------
- Set Buffer 100 : Hide
- Dim A$(900) : Rem increase this for large text files
- Global A$(),_NEXT_BLOCK_Y,_TEXT_BASE,_TEXT_BASE2,MORE_TEXT
- '----------------------------------------------------------
- Screen Open 0,640,256+16,2,Hires : Flash Off : Curs Off : Cls 0
- ' Try using a dual playfield for a background screen.
- Screen Display 0,128,38,320,256
- Palette 0,$FFF : Double Buffer : Autoback 0
- Wait Vbl : Auto View Off
- '--------------------
- FILE$="cpu.asc"
- '--------------------
- Open In 1,FILE$
- Set Input 10,-1 : Rem <line feed>
- L=0
- Repeat
- Line Input #1,A$(L) : Inc L
- Until Eof(1)
- Close 1
- '
- LAST=L+2 : OFFSET_Y=0 : LINE=-2
- _TEXT_BASE=Text Base+256 : _TEXT_BASE2=_TEXT_BASE+8
- '
- ' ***** YOU MUST USE A FONT THATS 8 by 8 ******
- '------------------------------------------------------
- 'Find the small font, tested on A500 & A1200.
- Get Rom Fonts : Set Font 2
- Text 0,Text Base,"#" : If Point(8,2)=1 Then Set Font 1
- Cls 0,0,0 To 9,8
- '------------------------------------------------------
- Text 112,64,"Use mouse button to scroll. Left=Slow / Right=Fast"
- Screen Swap : Screen Copy Physic To Logic
- '
- Colour 18,$F : Colour 22,$F : Sprite 0,X Hard(0),Y Hard(0),1
- Repeat
- '
- SPEED=Min(Mouse Key,2)
- CUT_SIZE=18*SPEED
- '
- If SPEED>0
- '
- MORE_TEXT=True : Rem time to update new text
- OFFSET_Y=0 : Rem move screen offset back
- Add LINE,2 : Rem Move through text, by two lines.
- Y=0 : Rem start copying at the top of the screen.
- OK_SWAP=True : Rem do a screen swap later on.
- '
- While OFFSET_Y<16
- Add OFFSET_Y,SPEED
- Screen Offset 0,,OFFSET_Y
- View
- If OK_SWAP=True
- Screen Swap
- 'logical screen now has the next scroll position ready.
- OK_SWAP=False
- End If
- Wait Vbl
- 'Gradually update the screen in the background.
- Screen Copy Physic(0),0,Y,640,Y+CUT_SIZE To Logic(0),OX,Y-16
- Add Y,CUT_SIZE : Rem work down the physical screen
- '----------------
- If MORE_TEXT=True
- _SCENE_BOTTOM[LINE]
- End If
- '----------------
- Wend
- Else
- View : Wait Vbl
- End If
- If Key State(69) Then Stop
- Until LINE>LAST
- '
- 'YET AGAIN:The below procedures only support stepping speeds of 1 & 2.
- 'When using faster speeds, less block sections must be used.
- 'i.e. just delete some lables, and renumber them. Don't forget to change
- 'the CUT_SIZE and the SPEED.
- '
- Procedure _SCENE_BOTTOM[LINE]
- '
- ' I don't know why I've used a bottom 16 pixel update area.
- ' It should be the same size as the font height, oops.
- '
- ' So delete P5 to P8, change
- '
- ' Screen Open 0,640,256+font_size,2,Screen
- ' .
- ' .
- ' Inc LINE (not Add LINE,2)
- ' .
- ' .
- ' While OFFSET_Y<8
- ' .
- ' .
- ' bla bla....Logic(0),OX,Y-8
- '
- ' I've left it this way because, because, errr, well its a laugh.
- ' Ok the reason for this is so you can use a step speed of 4 pixels.
- ' Read the last comments.
- '
- Inc _NEXT_BLOCK_Y
- '
- On _NEXT_BLOCK_Y Goto P1,P2,P3,P4,P5,P6,P7,P8
- '-----------------------------------
- P1:
- Cls 0,0,256 To 160,264
- Text 0,_TEXT_BASE,Mid$(A$(LINE),1,20)
- Pop Proc
- P2:
- Cls 0,160,256 To 320,264
- Text 160,_TEXT_BASE,Mid$(A$(LINE),21,20)
- P3:
- Cls 0,320,256 To 480,264
- Text 320,_TEXT_BASE,Mid$(A$(LINE),41,20)
- Pop Proc
- P4:
- Cls 0,480,256 To 640,264
- Text 480,_TEXT_BASE,Mid$(A$(LINE),61,20)
- '-----------------------------------
- P5:
- Cls 0,0,264 To 160,272
- Text 0,_TEXT_BASE2,Mid$(A$(LINE+1),1,20)
- Pop Proc
- P6:
- Cls 0,160,264 To 320,272
- Text 160,_TEXT_BASE2,Mid$(A$(LINE+1),21,20)
- P7:
- Cls 0,320,264 To 480,272
- Text 320,_TEXT_BASE2,Mid$(A$(LINE+1),41,20)
- Pop Proc
- P8:
- Cls 0,480,264 To 640,272
- Text 480,_TEXT_BASE2,Mid$(A$(LINE+1),61,20)
- '-----------------------------------
- _NEXT_BLOCK_Y=0 : MORE_TEXT=False
- '
- ' To use a faster stepping speed, merge the above two blocks together.
- ' i.e delete P5: & move its contents into P1:
- ' Do the same with P6: & P2: and so on... (& optimised Cls)
- '
- End Proc