scrolling the console screen 
Author Message
 scrolling the console screen

I have the following code (which relies on a function that determines the
screen width and one that reads a single line from the screen at a specified
line nuber) for scrolling the console window.

It don't work.

Any suggetions?  I can't figure it out.  It seems to scroll like 10 lines
where it out to scroll 1.

The idea is the following:

for each n do the following:
    for each line (1-25) do the following:
        1. blank out the current line.
        2. print the next line to the current line.
        3. move to the next line and do the same.

Is there a better way to scroll the screen?  Is there a better way to handle
screen location, etc?

Thanks for your help.

Sub scrollScreen(n)

    'scrolls the console screen up n lines.

    'save current position:
    curPosX = CSRLIN   'save the row
    curPosY = POS(0)    'save the column

    sw = screenWidth

    For i = 1 To n
        i2=1
        for i2=1 to 25
  Locate i2, 1
  Print String$(sw, 32) 'blank out the current line
  Locate i2, 1

  If i2 = 25 Then
      Exit For
  Else
      Print screenLine$(i2 + 1) 'print the next line to the current one
  End If
 next i2
    Next i

    Locate curPosX, curPosY

End Sub



Fri, 29 Mar 2002 03:00:00 GMT  
 scrolling the console screen

I did these off the top of my head but you'll get the idea.

C'ya,

SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

  Trow% = Trow% - 1
  Brow% = Brow% - 1

  REG 1, &h0600 + Lines%
  REG 2, (Attr% * 256)
  REG 3, (Trow% * 256) + Lcol% - 1
  REG 4, (Brow% * 256) + Rcol% - 1
  CALL INTERRUPT &h10

END SUB

SUB ScrollScreen(n)

  'scrolls the console screen up n lines.
  'save current position:
  curPosX = CSRLIN      'save the row
  curPosY = POS(0)      'save the column
  sw      = screenWidth
  LastRow = 25

  DEF SEG    = &hB800

  FOR i = 1 To n
    FromOffset = sw * 2
    ToOffset   = 0
    FOR Row = 2 to LastRow
      FOR Col = 1 TO sw
        POKE ToOffset, PEEK(FromOffset)
        FromOffset = FromOffset + 1
        ToOffset   = ToOffset + 1
      NEXT
    NEXT
    LOCATE Row-1, 1 : PRINT SPACE$(sw);
    LastRow = LastRow -1
  NEXT  

  DEF SEG

  LOCATE curPosX, curPosY

END SUB

   ____    _    ____      ____  _____
  |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

  |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
  ___________________________________   www.basicguru.com
      Vertical Software Solutions



Sat, 30 Mar 2002 03:00:00 GMT  
 scrolling the console screen
I'm quite ignorant about interupts.

Beyond that, what are the parameters are in this first example?

Thanks very much for the code.

SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

  Trow% = Trow% - 1
  Brow% = Brow% - 1

  REG 1, &h0600 + Lines%
  REG 2, (Attr% * 256)
  REG 3, (Trow% * 256) + Lcol% - 1
  REG 4, (Brow% * 256) + Rcol% - 1
  CALL INTERRUPT &h10

END SUB


Quote:

> I did these off the top of my head but you'll get the idea.

> C'ya,

> SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

>   Trow% = Trow% - 1
>   Brow% = Brow% - 1

>   REG 1, &h0600 + Lines%
>   REG 2, (Attr% * 256)
>   REG 3, (Trow% * 256) + Lcol% - 1
>   REG 4, (Brow% * 256) + Rcol% - 1
>   CALL INTERRUPT &h10

> END SUB

> SUB ScrollScreen(n)

>   'scrolls the console screen up n lines.
>   'save current position:
>   curPosX = CSRLIN      'save the row
>   curPosY = POS(0)      'save the column
>   sw      = screenWidth
>   LastRow = 25

>   DEF SEG    = &hB800

>   FOR i = 1 To n
>     FromOffset = sw * 2
>     ToOffset   = 0
>     FOR Row = 2 to LastRow
>       FOR Col = 1 TO sw
>         POKE ToOffset, PEEK(FromOffset)
>         FromOffset = FromOffset + 1
>         ToOffset   = ToOffset + 1
>       NEXT
>     NEXT
>     LOCATE Row-1, 1 : PRINT SPACE$(sw);
>     LastRow = LastRow -1
>   NEXT

>   DEF SEG

>   LOCATE curPosX, curPosY

> END SUB

>    ____    _    ____      ____  _____
>   |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

>   |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
>   ___________________________________   www.basicguru.com
>       Vertical Software Solutions



Sun, 31 Mar 2002 03:00:00 GMT  
 scrolling the console screen
Thanks.


Quote:

> I did these off the top of my head but you'll get the idea.

> C'ya,

> SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

>   Trow% = Trow% - 1
>   Brow% = Brow% - 1

>   REG 1, &h0600 + Lines%
>   REG 2, (Attr% * 256)
>   REG 3, (Trow% * 256) + Lcol% - 1
>   REG 4, (Brow% * 256) + Rcol% - 1
>   CALL INTERRUPT &h10

> END SUB

> SUB ScrollScreen(n)

>   'scrolls the console screen up n lines.
>   'save current position:
>   curPosX = CSRLIN      'save the row
>   curPosY = POS(0)      'save the column
>   sw      = screenWidth
>   LastRow = 25

>   DEF SEG    = &hB800

>   FOR i = 1 To n
>     FromOffset = sw * 2
>     ToOffset   = 0
>     FOR Row = 2 to LastRow
>       FOR Col = 1 TO sw
>         POKE ToOffset, PEEK(FromOffset)
>         FromOffset = FromOffset + 1
>         ToOffset   = ToOffset + 1
>       NEXT
>     NEXT
>     LOCATE Row-1, 1 : PRINT SPACE$(sw);
>     LastRow = LastRow -1
>   NEXT

>   DEF SEG

>   LOCATE curPosX, curPosY

> END SUB

>    ____    _    ____      ____  _____
>   |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

>   |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
>   ___________________________________   www.basicguru.com
>       Vertical Software Solutions



Sun, 31 Mar 2002 03:00:00 GMT  
 scrolling the console screen

Do you see why mine didn't work?  I just don't get it.


Quote:

> I did these off the top of my head but you'll get the idea.

> C'ya,

> SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

>   Trow% = Trow% - 1
>   Brow% = Brow% - 1

>   REG 1, &h0600 + Lines%
>   REG 2, (Attr% * 256)
>   REG 3, (Trow% * 256) + Lcol% - 1
>   REG 4, (Brow% * 256) + Rcol% - 1
>   CALL INTERRUPT &h10

> END SUB

> SUB ScrollScreen(n)

>   'scrolls the console screen up n lines.
>   'save current position:
>   curPosX = CSRLIN      'save the row
>   curPosY = POS(0)      'save the column
>   sw      = screenWidth
>   LastRow = 25

>   DEF SEG    = &hB800

>   FOR i = 1 To n
>     FromOffset = sw * 2
>     ToOffset   = 0
>     FOR Row = 2 to LastRow
>       FOR Col = 1 TO sw
>         POKE ToOffset, PEEK(FromOffset)
>         FromOffset = FromOffset + 1
>         ToOffset   = ToOffset + 1
>       NEXT
>     NEXT
>     LOCATE Row-1, 1 : PRINT SPACE$(sw);
>     LastRow = LastRow -1
>   NEXT

>   DEF SEG

>   LOCATE curPosX, curPosY

> END SUB

>    ____    _    ____      ____  _____
>   |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

>   |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
>   ___________________________________   www.basicguru.com
>       Vertical Software Solutions



Sun, 31 Mar 2002 03:00:00 GMT  
 scrolling the console screen

In my experiment, the 2nd procedure (I don't know how to use the params in
the first one.) works out almost exactly like mine.

When you have an input prompt at the bottom line, and the input string is
shelled, the input prompt line with the input command string get erased.  In
other words, if you enter "echo x" and it gets shelled, and another prompt
is written to the screen, you get the following:

x
x
x
x
enter a string to shell? echo x
------------------------------------------------------

(where the line is the bottom of the screen, i.e. the prompt is on line 25.)

whereas for a true scroll of everything on the screen, the outcome would be
the following:

x
enter a string to shell? echo x
x
enter a string to shell? echo x
x
enter a string to shell? echo x
x
enter a string to shell? echo x
------------------------------------------------------

(where the line is the bottom of the screen, i.e. the prompt is on line 25.)

Hmmm.  Must be the input function conflicting by using it's own tracking of
the screen position (which is the problem in the first place.)

Thanks again for the code.  Shall I use your signature below as
acknowledgment in the comments in the procedure (in case someone else ever
sees it - not likely.)?


Quote:

> I did these off the top of my head but you'll get the idea.

> C'ya,

> SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

>   Trow% = Trow% - 1
>   Brow% = Brow% - 1

>   REG 1, &h0600 + Lines%
>   REG 2, (Attr% * 256)
>   REG 3, (Trow% * 256) + Lcol% - 1
>   REG 4, (Brow% * 256) + Rcol% - 1
>   CALL INTERRUPT &h10

> END SUB

> SUB ScrollScreen(n)

>   'scrolls the console screen up n lines.
>   'save current position:
>   curPosX = CSRLIN      'save the row
>   curPosY = POS(0)      'save the column
>   sw      = screenWidth
>   LastRow = 25

>   DEF SEG    = &hB800

>   FOR i = 1 To n
>     FromOffset = sw * 2
>     ToOffset   = 0
>     FOR Row = 2 to LastRow
>       FOR Col = 1 TO sw
>         POKE ToOffset, PEEK(FromOffset)
>         FromOffset = FromOffset + 1
>         ToOffset   = ToOffset + 1
>       NEXT
>     NEXT
>     LOCATE Row-1, 1 : PRINT SPACE$(sw);
>     LastRow = LastRow -1
>   NEXT

>   DEF SEG

>   LOCATE curPosX, curPosY

> END SUB

>    ____    _    ____      ____  _____
>   |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

>   |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
>   ___________________________________   www.basicguru.com
>       Vertical Software Solutions



Sun, 31 Mar 2002 03:00:00 GMT  
 scrolling the console screen

Quote:
>I'm quite ignorant about interupts.

Not difficult just a different way of using a 'sub' routine or 'function'.

Quote:
>Beyond that, what are the parameters are in this first example?

  Trow%  = top row
  Lcol%  = left column
  Brow%  = bottom row
  Rcol%  = right column
  Lines% = number of lines you want to move
  Attr%  = (Background% * 16) + Foreground%
         or do I have that backwards!?!

  The interrupt actually uses rows & columns with a base of zero so 1 has to
be subtracted from them in the sub routine.

Quote:
>Thanks very much for the code.

You're welcome.

SUB MoveScreenUP (Trow%, Lcol%, Brow%, Rcol%, Lines%, Attr% )

  Trow% = Trow% - 1
  Brow% = Brow% - 1

  REG 1, &h0600 + Lines%
  REG 2, (Attr% * 256)
  REG 3, (Trow% * 256) + Lcol% - 1
  REG 4, (Brow% * 256) + Rcol% - 1
  CALL INTERRUPT &h10

END SUB

C'ya,

   ____    _    ____      ____  _____
  |  _ \  / \  / ___) __ | ___)(_   _) Don Schullian

  |____//_/ \_\(____/\__/|_|     |_|    www.DASoftVSS.com
  ___________________________________   www.basicguru.com
      Vertical Software Solutions



Mon, 01 Apr 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. 8.5a2 console scroll bug?

2. Screen output to console

3. newbe: clear the console screen

4. poking data into console screen

5. Q: Clear screen in Win32 console?

6. gnat console screen-package

7. gnat console screen-package

8. Fujitsu v3 & console screen/keyboard I/O

9. Screen handling/console

10. Windows XP and CVF console mode screen

11. Clearing the Console Screen - HOW??

12. How do you clear a console screen?

 

 
Powered by phpBB® Forum Software