Board index » delphi » TRIVIA -- PASCAL 3 RELATED QUESTION -- TRIVIA (TEXTMODE RELATED

TRIVIA -- PASCAL 3 RELATED QUESTION -- TRIVIA (TEXTMODE RELATED

?here some thing for those of you into historical programming or started
when pascal first came out...

is there a way to change the textmode in pascal three so that the screen
is 80x50 instead of 80x25...i know this can be done in TP7 by using...

    textmode (CO80 + FONT8X8);

that's easy but we use TP3 (don't ask me why, we just do!!!!) in class
and i need to do some serious output for a program and just need more
room...so far i have not been able to get this to work, i could just
write my program in "7" but that would be too easy ;-)  any way if you
know of a way to accomplish this i would greatly appreciate it...

please respond via e-mail as opposed to posting your response...

thanks a million

NUNZIO

 

Re:TRIVIA -- PASCAL 3 RELATED QUESTION -- TRIVIA (TEXTMODE RELATED


Quote
Moritz Richter (nun...@EriNet.com) wrote:

: ?here some thing for those of you into historical programming or started
: when pascal first came out...
:
: is there a way to change the textmode in pascal three so that the screen
: is 80x50 instead of 80x25...i know this can be done in TP7 by using...
:
:     textmode (CO80 + FONT8X8);
:
: that's easy but we use TP3 (don't ask me why, we just do!!!!) in class
: and i need to do some serious output for a program and just need more
: room...so far i have not been able to get this to work, i could just
: write my program in "7" but that would be too easy ;-)  any way if you
: know of a way to accomplish this i would greatly appreciate it...

I did thid eons ago using ideas from Ferraro's EGA/VGA book -- I
shall note that many applications became royally confused in the
new modes.  

: please respond via e-mail as opposed to posting your response...

If you can post you should be read it from here....

Re:TRIVIA -- PASCAL 3 RELATED QUESTION -- TRIVIA (TEXTMODE RELATED


----=_333ae67213185751301cb1e99.MFSBCHJLHS
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Quote
Moritz Richter <nun...@EriNet.com> wrote:
>is there a way to change the textmode in pascal three so that the screen
>is 80x50 instead of 80x25...i know this can be done in TP7 by using...

>    textmode (CO80 + FONT8X8);

Trivia implies you have information for us! <g>
OTOH, there is nothing trivial about your request <g>

Anyway I thought your question was quite interesting, so armed w/
the idea that all things are possible, I surged ahead.

The following is specifically coded for Turbo 3.01a PC-DOS Version.
It may have to be reworked, or fine tuned, for MS-DOS or Turbo-87
versions.

Because Turbo 3.0 has so many hard coded parameters, it was
necessary to stoop to using a little self-modifying code. If you are
compiling to memory, you need to call PatchCrt(FALSE) before the
program ends. If not, exit and reload the compiler.

The program should be self-documenting.  If its not clear enough, or
you have any problems or questions don't hesitate to ask.

Quote
>please respond via e-mail as opposed to posting your response...

I'm going to give you the benefit of the doubt here.  This would be
grounds for many to ignore your request for help simply based on the
selfish attitude this presents.  Replies should be posted to the
group so that others may benefit from the information. Replies may
be posted to the group w/ a complementary copy by email, but it
isn't proper to ask for an email only reply.

    ...red
cc

----=_333ae67213185751301cb1e99.MFSBCHJLHS
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

{ TEST Support functions }

TYPE AnyString = String[255];

FUNCTION Stringof(c: Char; Count: Integer): AnyString;
VAR s: AnyString;
BEGIN
    s[0] := #0;
    If (Count >= 1) and (Count <= 255) Then Begin
       FillChar(s[1], Count, C);
       s[0] := Char(Count)
    End;
    StringOf := s
END;

{ ----------------------------------------------------------- }
TYPE TRegisters = record
       Case Integer of
           0: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Integer);
           1: (AL, AH, BL, BH, CL, CH, DL, DH: Byte);
     End;

{ Useful parameters.  Treat as read only! }
VAR CrtRows: Byte absolute $0040:$0084;  { number of rows less 1 }
    CrtCols: Byte absolute $0040:$004A;  { number of columns     }

PROCEDURE PatchCrt(font8x8: Boolean);
{ ------------------------------------------------- }
{ Restores original values, then if font8x8 is true }
{ sets 43/50 line EGA/VGA screen                    }
{ ------------------------------------------------- }
CONST Video = $10;
VAR   Regs: tRegisters;
      CrtInfo        : Byte absolute $0040:$0087;
      CrtMode        : Byte absolute  DSeg:$0006;
      GotoxyRowLimit : Byte absolute  CSeg:$016B;  { 19h: literal operand }
      WindowRowLimit : Byte absolute  CSeg:$038F;  { 19h: literal operand }
      ForceCrtReset  : Byte absolute  CSeg:$0335;  { 74h: jz opcode       }
BEGIN
    CrtInfo := CrtInfo and $FE;        { translate cursor mode 0..3 }
    WindowRowLimit := 25;              { reset window row limit     }
    GotoxyRowLimit := 25;              { reset gotoxy row limit     }

    ForceCrtReset := $B4;              { change jz to mov AH, ...   }
    TextMode(CrtMode);                 { to force crt reset         }
    ForceCrtReset := $74;              { Restore original jz opcode }

    If font8x8 Then With Regs Do Begin

       AX := $1112;                    { set 8x8 font }
       BL := 0;
       Intr(Video, Regs);

       AX := $1130;                    { get font info }
       BH := 0;
       DL := 0;
       Intr(Video, Regs);

       If DL > 42 Then Begin
          CrtInfo := CrtInfo or 1;     { inhibit cursor translation }
          WindowRowLimit := Succ(DL);  { patch window row limit     }
          GotoxyRowLimit := Succ(DL);  { patch gotoxy row limit     }

(*--
          AX := $100;                  { set cursor size }
          CX := $600;
          Intr(Video, Regs);
(*--*)
          AH := $12;                   { alternate select           }
          BL := $20;                   { switch to alt print screen }
          Intr(Video, Regs)
       End;
    End;
END;

{ ----------------------------------------------------------- }
VAR i: Integer;
    c: Char;
BEGIN
    PatchCrt(TRUE);

    { write series of stair stepped lines }
    For i := 1 to Succ(CrtRows) Do Begin
        Gotoxy(i, i); Write(StringOf('-', 80-i));
    End;

    { set small windows and test clrscr }
    Window(20,10,30,15);
    ClrScr;

    Window(40,26,50,32);
    ClrScr;

(*--*)
    { Set larger window and test line wrap and scrolling }
    Window(60,20,75,30);
    ClrScr;
    For i := 1 to 30 Do
      Writeln(i:2, StringOf(#254,26));

    Window(1,1,80,Succ(CrtRows));  { restore full screen }
    Gotoxy(40, 38);                { and test ClrEol     }
    Write('>>-ClrEol->'); ClrEol;
(*---*)
    Window(1,1,80,Succ(CrtRows));  { restore full screen }
    Gotoxy(1,CrtRows);             { next to last line }
    Writeln('crt should be in 43/50 line mode');
    Write('Press <enter> to continue'); Readln;
    PatchCrt(FALSE);
END.

----=_333ae67213185751301cb1e99.MFSBCHJLHS--

Re:TRIVIA -- PASCAL 3 RELATED QUESTION -- TRIVIA (TEXTMODE RELATED


Quote
> is there a way to change the textmode in pascal three so that the screen
> is 80x50 instead of 80x25

Sure.  You can do it with the following inline code:

inline( $b8 / $12 / $11   { mov ax,1112h }
      / $30 / $db         { xor bl,bl    }
      / $cd / $10         { int 10h      }  
      )

Alternatively, use

var r:Registers;
begin
  r.ax:=$1112;
  r.bl:=0;
  intr($10,r)
end;

With tp3, you have to define the Registers type yourself.  Just copy
the one from v7.
It's something like
type Registers=record
  case integer of
  0:  ax,bx,cx,dx,...:word;
  1:  al, ah, bl, bh, ... : byte;
end;

IHTH

Paul

Other Threads