Locate() and Screen() in FirstBasic? 
Author Message
 Locate() and Screen() in FirstBasic?

I've noticed if I have a combination like below:

Input A$
shell("DIR")
Input B$

It behaves differently in QBasic than in FirstBasic.

QBasic relocates to the first line after the DIR commands last line of
output to do its inputting for B$.
FirstBasic, on the other hand, relocates to the line following the original
input for A$ to input for B$.

How would one accurately make FirstBasic relocate the same way?

Looking for the first blank line probably wouldn't be very accurate.
Perhaps starting at the bottom of the screen and working up to the first
non-blank line and then using the next one down might.

Is there any way to actually know where a command like DIR's output actually
ended and relocate to the next line?

Thanks very much for any suggestions.



Mon, 25 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?

Quote:

> I've noticed if I have a combination like below:

> Input A$
> shell("DIR")
> Input B$

> It behaves differently in QBasic than in FirstBasic.

> QBasic relocates to the first line after the DIR commands last line of
> output to do its inputting for B$.
> FirstBasic, on the other hand, relocates to the line following the original
> input for A$ to input for B$.

> How would one accurately make FirstBasic relocate the same way?

I'd do something like this:

Shell "DIR > " + mydir$ + "dir.tmp"
Open "I", 1, mydir$ + "dir.tmp"
While Not Eof(1)
  Line Input#1, a$
  Print a$
Wend
Close 1
Shell "DEL " + mydir$ + "dir.tmp"

That way you could interpret the directory information as well.

mydir$ should point to an existing directory on the harddisk so it'll
work on a CD too.

--
Peter Manders.
Please remove the 'u' to reply.



Mon, 25 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
To locate the cursor, use LOCATE verb.

If you want to *find* where the cursor is, use the CSRLIN and POS(0)
functions.


Quote:

>Is there any way to actually know where a command like DIR's output
actually
>ended and relocate to the next line?

>Thanks very much for any suggestions.



Tue, 26 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?


FirstBASIC keeps track of where the cursor was BEFORE the SHELL then places it
back to that position when SELL terminates. The guy is going to have to search
to find the next empty line starting at line 25 and working up.

C'ya,

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

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

Quote:
>To locate the cursor, use LOCATE verb.

>If you want to *find* where the cursor is, use the CSRLIN and POS(0)
>functions.



>>Is there any way to actually know where a command like DIR's output
>actually
>>ended and relocate to the next line?

>>Thanks very much for any suggestions.



Tue, 26 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Thanks, everyone.

I'll have to toy with these.



Tue, 26 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Ok, reading from 25 up works fine for all cases except where the last line
has text in it.

What to do there?

How does one determine if the screen is 40 or 80 characters wide?
Can one read 80 without an error on a 40-line screen?  Or would that wrap to
the next line?

Is there some way one can make the console roll up a line?  Locate to the
end of the last line and start printing?

The Input Statement normally handles this pretty well by itself.  How does
it do it?

If I knew how wide the screen was, I could read the screen into a string
array and just rewrite it, dropping the top one and moving all lines up.  Is
there a faster way?

I would think there would be some built-in trigger to make  the screen do
this.  Perhaps not.

Thanks for any suggestions.



Wed, 27 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Can Width() only be used to set the screen width?
Or can it be used to determine it?


Wed, 27 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Hey, Ed, here's a "high tech" suggestion:

Why don't you TRY it?

Word of Honor: If you avoid POKE, CALL ABSOLUTE and CALL INTERRUPT, it is
damn near impossible to damage your computer with any BASIC language verb.
Even with these "power verbs" you the chance of doing damage *accidentally*
is probably less than the chance of being hit by a bus.

You may "hang" your computer or your program may abort, but if you are not
prepared to suffer a few of these minor setbacks programming is probably not
a good career choice.

--
Michael Mattias
Tal Systems
Racine WI USA
The views and opinions expressed herein are my own.
As I am self-employed, they also express the views of my employer.


Quote:
>Can Width() only be used to set the screen width?
>Or can it be used to determine it?



Wed, 27 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?

I certainly will.  Information is much more useful, however, than years of
trial-and-error.

If there are any good books or on-line manuals on powerbasic, please suggest
one.

I've found an old TurboBasic book, but it suffers from what most BASIC texts
do:  it's written as an introduction to programming in general and doesn't
delve into the particularities necessary for a comprehensive understanding
of the syntax and usage of the particular language itself.

Perhaps the BASIC grammar that PowerBasic sells would be a good choice
(though it sounds like and introduction as well).

I just hoped to find some specific information here.

One can be an expert in one or more flavours of a certain langauge and be
quite stumped at the subtle differences when moving to a new flavour of the
same.  One has to know the details.

So far, programming has been a great career choice.


Quote:
> Hey, Ed, here's a "high tech" suggestion:

> Why don't you TRY it?

> Word of Honor: If you avoid POKE, CALL ABSOLUTE and CALL INTERRUPT, it is
> damn near impossible to damage your computer with any BASIC language verb.
> Even with these "power verbs" you the chance of doing damage
*accidentally*
> is probably less than the chance of being hit by a bus.

> You may "hang" your computer or your program may abort, but if you are not
> prepared to suffer a few of these minor setbacks programming is probably
not
> a good career choice.

> --
> Michael Mattias
> Tal Systems
> Racine WI USA
> The views and opinions expressed herein are my own.
> As I am self-employed, they also express the views of my employer.



> >Can Width() only be used to set the screen width?
> >Or can it be used to determine it?



Thu, 28 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Well, the fruit of my limited experimentation are the following:

You can't read the screen past 81 characters (my screen is 80 wide).

I don't know if that means FirstBasic has a built-in threshold of 80
(probably) and/or it can't read past the actual width of the screen.

So, I guess the question remains:  is there not a way to determine the width
of the screen (in QuickBasic you can set it but not determine it).



Thu, 28 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
If the manual you have is the Turbo BASIC manual supplied by Borland (I have
one), it's not bad. THe manuals from PB/DOS 2.1 and 3.x are much better.

 ".. the particularities necessary for a comprehensive understanding of the
syntax and usage of the particular language itself."

Syntax is one thing; usage another. Syntax is explained reasonably well by
most language products' manuals. Usage is, IMO, best learned by studying
others' source code and experimentation. There are hundreds of internet
sites with BASIC-language source code free for the download. Usually this
code is procedure-by-procedure rather than a complete application; putting
the pieces together is why programmers get the big bucks.

--
Michael Mattias
Tal Systems
Racine WI USA
The views and opinions expressed herein are my own.
As I am self-employed, they also express the views of my employer.

Quote:

>I've found an old TurboBasic book, but it suffers from what most BASIC
texts
>do:  it's written as an introduction to programming in general and doesn't
>delve into the particularities necessary for a comprehensive understanding
>of the syntax and usage of the particular language itself.



Thu, 28 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
If you are ready for BIOS calls using CALL INTERRUPT, you can use BIOS
interrupt &h10, service x'0F', which returns current video mode, number of
columns, and current display page.

In later versions of PB/DOS, they made available the internal variables
pbvScrnRows and pbvScrnCols. You might want to try getting the values of
these variables in FirstBASIC, as PB has always had a bunch of undocumented
features and these may have actually worked in PB/DOS 2.1 (FirstBASIC).

--
Michael Mattias
Tal Systems
Racine WI USA
The views and opinions expressed herein are my own.
As I am self-employed, they also express the views of my employer.


Quote:
>Well, the fruit of my limited experimentation are the following:

>You can't read the screen past 81 characters (my screen is 80 wide).

>I don't know if that means FirstBasic has a built-in threshold of 80
>(probably) and/or it can't read past the actual width of the screen.

>So, I guess the question remains:  is there not a way to determine the
width
>of the screen (in QuickBasic you can set it but not determine it).



Thu, 28 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Looks like this will do it, which brings me to the question, "Does
FirstBasic expose error numbers?":

Function screenWidth
    On Error GoTo tooWide

    'determines if the console screen is 80 or 40

    screenWidth = screen(1, 80)
    screenWidth = 80

    Exit Function
tooWide:
    Resume trapped
trapped:
    screenWidth = 40
End Function



Thu, 28 Mar 2002 03:00:00 GMT  
 Locate() and Screen() in FirstBasic?
Thanks.

Apparently pbvScrnRows and pbvScrnCols are not available to first basic ( or
fbvScrnRows and fbvScrnCols, tbvScrnRows and tbvScrnCols, or ScrnRows and
ScrnCols ).


Quote:
> If you are ready for BIOS calls using CALL INTERRUPT, you can use BIOS
> interrupt &h10, service x'0F', which returns current video mode, number of
> columns, and current display page.

> In later versions of PB/DOS, they made available the internal variables
> pbvScrnRows and pbvScrnCols. You might want to try getting the values of
> these variables in FirstBASIC, as PB has always had a bunch of
undocumented
> features and these may have actually worked in PB/DOS 2.1 (FirstBASIC).



Thu, 28 Mar 2002 03:00:00 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. BSAVE in FirstBasic Screen 13

2. odd screen writes with COPY TO and LOCATE

3. Registering FirstBasic

4. FirstBasic will it be discontinued?

5. file i/o in firstBasic?

6. shell() in FirstBasic?

7. Fast shareware compiler - FirstBASIC

8. FirstBasic Help file

9. ?Folling bios (dos) for screen saver (screen related)??

10. Finding Screen Size to centre top-level window on Screen

11. Will you load near the Sub Seven, if Mikie hatefully locates the screen?

12. Locating Rick Gage

 

 
Powered by phpBB® Forum Software