Vertical full page fine text scroller

Page 3/3
1 | 2 |

By Metalion

Paladin (1006)

Metalion's picture

17-10-2008, 23:24

Without the blank line, I should have dealt differently the case of "O" over "t" by the case of "n" over "t", using, thus, different tiles for any possible couple between the two lines.
Well that was exactly my idea ... Tongue
To use a fixed tileset of 224 characters dynamically defined at each pixel movement by using the base charset.

By ARTRAG

Enlighted (6243)

ARTRAG's picture

18-10-2008, 00:27

Well, if you have 26 letters, there are 325 couples that can happens in the text (i.e. N!/K!/(N-K)! ).
Considering also that "O" over "t" is different by "t" over "O" and 325 is the number of couples taken without considering which is on top, I think that the actual number of situations you should face (with 26 letters) is 325*2-26 = 624 (the latter -26 considers as one the cases like "O" over "O").

how do you want to use the 224 tiles you said ?

By Metalion

Paladin (1006)

Metalion's picture

18-10-2008, 08:41

Imagine that 7 lines on screen 1 are occupied by the first 224 characters of the char table, always in the same position.

line 1 : 00 01 02 ... 1F
line 2 : 20 21 22 ... 3F
...
line 7 : C0 C1 C2 ... DF

The base charset is defined in E0 - FF. Then for each pixel movement, you check each letter of the text, the one preceding it and the one following it, so that you can dynamically draw the tileset on screen by using the base charset.

In fact, we are using the 224 characters as a tileset, just like in screen 2. It means you have to move a maximum of 224x8=1792 bytes per pixel movement of the text. That's why I realized it was just like making a vertical pixel scrolling in screen 2.

By Manuel

Ascended (15750)

Manuel's picture

18-10-2008, 11:04

wait this is for the msx1.

i'm looking for basic things using vdp(24) command.
msx1 is not my target.

I made it in Pascal once, it's really simple. Something like this (pasting the very old program with old URL's and old mail addresses):

PROGRAM VerticalTextScroll; {VTXTSCRL.PAS, By Manuel Bilderbeek, May 1998}

{$I VDPCMD.INC}
{$I GRPPRINT.INC}
{$I WRTVDP.INC}
{$I SCREEN.INC}
{$I PAINTBOX.INC}
{$I COPY_XY.INC}
{$I SETPAGE.INC}
{$I MSXBIOS.LIB}

VAR YLine, TxtLineNumb, LineNumb:Byte;

CONST GetMaxX: Integer = 512;             {Define the maximum X value here...}
      GetMaxY: Byte = 212;                          {...and the Y value here!}
      ScreenMode: Byte = 7;                          {And here the screenmode}
      TxtWidth: Byte = 64;             {=GetMaxX DIV 8, should always be this}
      NumberOfTxtLines:Byte = 27;       {Please, fill in the number of lines!}
      CenteringOn:Boolean = True;                    {Switch for centering...}

{Here follow the stringconstants with the scroll-text. Make sure that the}
{length of the lines does not exceed 'TxtWidth'!!}

     { 0        1         2         3         4         5         6     }
     { 1234567890123456789012345678901234567890123456789012345678901234 }

CONST Line: ARRAY [1..27] of String[64] =   {Fill in NumberOfTxtLines and...}
{ 1} ('Welcome to "Vertical Text Scroll"!',                   {...TxtWidth!!}
{ 2}  '----------------------------------',
{ 3}  'This smooth (?) vertical text scrolling program which even cen-',
{ 4}  'ters the text (!) is written in Turbo Pascal 3.00A, with the',
{ 5}  'use of the INClude files of Kari Lammassaari. This program it-',
{ 6}  'self is written by Manuel Bilderbeek, in May 1998, after',
{ 7}  'having it written in Basic first... Thanks to Eric Boon for',
{ 8}  'the good suggestion of splitting the textlines in 8 pieces!',
{ 9}  'As you can see, this version still has a major bug: there is',
{10}  'a huge gap in the text, caused by that stupid clipping effect',
{11}  'when printing the text on the screen. Therefore I asked Kari',
{12}  'to improve GRPPRINT.INC in such a way that this is avoided',
{13}  '(probably by using direct code instead of that BIOS routine',
{14}  'Well, that was all folks! I hope you like this example of the',
{15}  'huge possibilities of programming in Turbo Pascal on MSX.',
{16}  'By the way: this program is freeware, and may only be changed',
{17}  'with my permission (unless it''s not spread).',
{18}  'More programs are on my WWW-pages:',
{19}  '-------------------------------------',
{20}  'http://studs.sci.kun.nl:8888/manuelbi',
{21}  '-------------------------------------',
{22}  'For info and/or questions, you can mail me: ',
{23}  'By another way: you can end this program by holding the space-',
{24}  'bar for a while... (KeyPressed seems to be a bit slow in this)',
{25}  'Now, this text will be repeated..........................',
{26}  '...............................................................',
{27}  '');

PROCEDURE Cls;
BEGIN
     MsxBios($00C3);                                                {Real CLS}
     MsxBios($0069)                                            {Clear sprites}
END;

PROCEDURE Pause(Duration:Byte);             {Pauses "Duration" x 1/50 seconds}
VAR Timer: Integer Absolute $FC9E;                       {Timer is in 'Jiffy'}
BEGIN
     Timer:=0;
     Repeat Until Timer=Duration
END;

PROCEDURE ScrollLine;
BEGIN
     If YLine<255 Then YLine:=Succ(YLine) Else YLine:=0;
     WrtVdp(23,YLine);                 {Write the value in the scrollregister}
END;


PROCEDURE ScrollText;
VAR TxtLineNumb,TxtLen,BlockLen,RestLen,XPos,XOffset,YTxt,Number:Byte;
    XGrPos:Integer;
BEGIN
    For TxtLineNumb:=1 to NumberOfTxtLines Do          {Process all textlines}
    BEGIN
         PaintBox(0,YLine-16,1,GetMaxX,8,0,0);     {Clear the area for a line}
         TxtLen:=Length(Line[TxtLineNumb]);
         BlockLen:=TxtLen DIV 7;                 {Devide textline in 8 blocks}
         RestLen:=TxtLen MOD 7;
         IF CenteringOn THEN XOffset:=(TxtWidth-TxtLen) SHR 1 ELSE XOffset:=0;
                                                {Calculate centering X offset}
         YTxt:=YLine-16;                     {Store the Y-co. of the textline}
         For LineNumb:=0 To 7 Do     {Process 8 graphical lines (so 8 blocks)}
         BEGIN
              XPos:=LineNumb*BlockLen;
              XGrPos:=(XOffset*XPos)*8;
              IF LineNumb=7 THEN Number:=RestLen ELSE Number:=BlockLen;
              SetPage(1,0);
              GraphicPrint(Copy(Line[TxtLineNumb],XPos+1,Number),XGrPos,0,15,0);
              SetPage(0,0);
              Copy_XY(XGrPos,0,1,XGrPos,YTxt,0,Number*8,8,0);
              Pause(3);                            {Wait a while -> smoothing}
              ScrollLine                     {YES: Scroll a (graphical) line!}
         END;
    END;
END;

BEGIN
     Screen(ScreenMode);
     Color(15,0,0);
     Cls;
     PaintBox(0,0,0,GetMaxX,256,0,0);          {Make the screen really empty}
     YLine:=0;                                     {Startvalue of the Y line}
     While NOT KeyPressed DO ScrollText;      {Scroll until a key is pressed}
     Screen(0);                                {Restore the screen to mode 0}
     Color(15,4,4)
END.
Page 3/3
1 | 2 |