Board index » delphi » Detecting 43/50 line mode

Detecting 43/50 line mode

Hello,  I was wondering if there was any way to detect if my program
is being run in 25 line mode or 43/50 line mode.  I've looked through
the Turbo Pascal help, and was only able to find GetTextMode or
something, but it needs the graph unit.  I'm writing a text based
program, and I don't want the extra overhead, and I'm not even sure if
it does what I want.

ttyl,
Brian Zhou

 

Re:Detecting 43/50 line mode


Quote
Irrational wrote:
> Hello,  I was wondering if there was any way to detect if my program
> is being run in 25 line mode or 43/50 line mode.  I've looked through
> the Turbo Pascal help, and was only able to find GetTextMode or
> something, but it needs the graph unit.  I'm writing a text based
> program, and I don't want the extra overhead, and I'm not even sure if
> it does what I want.

function screenlines : byte;

begin
  screenlines := succ(mem[Seg0040:$0084]);
end;

Returns the number of lines on the text screen.  For pre-TP7 versions, replace
Seg0040 with $0040.

Quote
> ttyl,
> Brian Zhou

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:Detecting 43/50 line mode


In article <352DBD11.29D87F5F@_ix.netcom.com>,
Scott Earnest  <setech@_ix.netcom.com> wrote:

Quote
>Irrational wrote:

>> Hello,  I was wondering if there was any way to detect if my program
>> is being run in 25 line mode or 43/50 line mode.  I've looked through
>> the Turbo Pascal help, and was only able to find GetTextMode or
>> something, but it needs the graph unit.  I'm writing a text based
>> program, and I don't want the extra overhead, and I'm not even sure if
>> it does what I want.

>function screenlines : byte;

>begin
>  screenlines := succ(mem[Seg0040:$0084]);
>end;

>Returns the number of lines on the text screen.  For pre-TP7 versions, replace
>Seg0040 with $0040.

Note that for some old computers this might be zero. It might be good
to check that if one has EGA first.

Also if you put

{$ifdef msdos}
const Seg0040=$40;
{$endif}

then you do not have to mention anything specific about older versions.
I have also noticed that for some reason the constant $40 seems to work
also in protected mode.

Osmo

Re:Detecting 43/50 line mode


JRS:  In article <352e4508.7474...@90.0.0.1> of Thu, 9 Apr 1998 22:00:43
in comp.lang.pascal.borland, Irrational <irrational@most-

Quote
wanted.com.remove.me> wrote:
>Hello,  I was wondering if there was any way to detect if my program
>is being run in 25 line mode or 43/50 line mode.  I've looked through
>the Turbo Pascal help, and was only able to find GetTextMode or
>something, but it needs the graph unit.  I'm writing a text based
>program, and I don't want the extra overhead, and I'm not even sure if
>it does what I want.

See around the save screen bit in
        http://www.merlyn.demon.co.uk/programs/shower.pas
where it reads from the mem?[seg0040:$xx] region.  This will do what you
want, and more.

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web <URL: http://www.merlyn.demon.co.uk/> - TP/BP/&c. FAQqish topics & links.
  Timo's TurboPascal <A HREF="ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip">FAQ</A>.
  <A HREF="http://www.merlyn.demon.co.uk/clpb-faq.txt">Mini-FAQ</A> of c.l.p.b.

Re:Detecting 43/50 line mode


Quote
Irrational wrote:

> Hello,  I was wondering if there was any way to detect if my program
> is being run in 25 line mode or 43/50 line mode.  I've looked through
> the Turbo Pascal help, and was only able to find GetTextMode or
> something, but it needs the graph unit.  I'm writing a text based
> program, and I don't want the extra overhead, and I'm not even sure if
> it does what I want.

> ttyl,
> Brian Zhou

A simple (but un-pretty) way of doing this is to
writeln to the screen and use wherey to get the verticle position
repeat this until you get two results that are the same (this will
avoid the ega problem).

Look I know this isnt the best method but hey, it works.

Kenn.

Re:Detecting 43/50 line mode


Quote
Osmo Ronkanen wrote in message <6gkk45$...@kruuna.Helsinki.FI>...
>In article <352DBD11.29D87F5F@_ix.netcom.com>,
>Scott Earnest  <setech@_ix.netcom.com> wrote:
>>function screenlines : byte;

>>begin
>>  screenlines := succ(mem[Seg0040:$0084]);
>>end;

>>Returns the number of lines on the text screen.  For pre-TP7
versions, replace
>>Seg0040 with $0040.

>Note that for some old computers this might be zero. It might be good
>to check that if one has EGA first.
>...

What is the best way to do that?

In the CRT unit, Pascal calls int 10h with ax=1130h, bh=0 and dl=0.
From Ralf Brown's Interrupt List, I see that this should return the
highest screen row number in dl, or sometimes the number of rows - not
0 anyway. So calling this and checking for dl=0 is presumably the best
way to check if one has EGA, or at least a reliable way - are there
better ways? Is it more reliable than calling int 10h with ax=1A00h
and checking for al=1Ah on return?

FP

Re:Detecting 43/50 line mode


On Fri, 10 Apr 1998 02:32:49 -0400, Scott Earnest

Quote
<setech@_ix.netcom.com> wrote:

>function screenlines : byte;

>begin
>  screenlines := succ(mem[Seg0040:$0084]);
>end;

thank you so VERY much.!
ttyl,

Other Threads