Author Topic: WINDOW.PAS - Turbo Pascal 3 Disk  (Read 5031 times)

0 Members and 1 Guest are viewing this topic.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1159
  • Likes Given: 1931
WINDOW.PAS - Turbo Pascal 3 Disk
« on: 15:14, 28 August 10 »
One of the few treats on the Turbo Pascal 3 Disk is a program demonstrating the use of Windows. Quite nice to actually see it there given other CP/M versions of TP3 don't include it, mainly because it's a machine specific instruction - only other versions which provides this is the PCDOS version of TP3.
 
Unfortunately the WINDOW.PAS program which comes on the Turbo Pascal 3 Disk Image on NVG is bugged which stops it from being compiled. Fortunately it's easily fixed.
 
Code: [Select]
{$C-}
{$U-}
program TestWindow;
const
   Windows    = 3;
   Wtab       : array[1..Windows,1..5] of Integer
                = (( 5,  2,  35, 11,  1), { X0,Y0,X1,Y1,LineNo }
                   (45,  2,  75, 11,  1),
                   ( 5, 15,  75, 23,  1)
                  );
type
   String255  = String[255];
var
   i          : Integer;
   Ch         : Char;

   procedure window(x1,x2,y1,y2:byte);
   begin
     write(#26,chr(x1-1),chr(y1-1),chr(x2-1),chr(y2-1));
   end;
   procedure Frame(UpperLeftX, UpperLeftY, LowerRightX, LowerRightY: Integer);
   var
      i: Integer;
   begin
      GotoXY(UpperLeftX, UpperLeftY);
      Write(#150);
      for i:=UpperLeftX+1 to LowerRightX-1 do Write(#154);
      Write(#156);
      for i:=UpperLeftY+1 to LowerRightY-1 do
      begin
         GotoXY(UpperLeftX , i);  Write(#149);
         GotoXY(LowerRightX, i);  Write(#149);
      end;
      GotoXY(UpperLeftX, LowerRightY);
      Write(#147);
      for i:=UpperLeftX+1 to LowerRightX-1 do Write(#154);
      Write(#153);
   end  { Frame };

   function RanStr(Len: Integer): String255;
   var
      S: String255;
      i: Integer;
   begin
      S[0]:=Chr(Len);
      for Len:=1 to Len do
      begin
         i:=Random(223);
         i:=i + 32;
         S[Len]:=Chr(i);
      end;
      RanStr:=S;
   end  { RanStr };

   procedure SelectWindow(Win: Integer);
   begin
      Window(Wtab[Win,1], Wtab[Win,2], Wtab[Win,3], Wtab[Win,4])
   end  { SelectWindow };

   procedure Window1;
   begin
      LowVideo;
      SelectWindow(1);
      GotoXY(1,24);
      Write('Line ', Wtab[1,5]:5, ' ' ,#207,' ', RanStr(16));
      Wtab[1,5]:=Succ(Wtab[1,5]);
      NormVideo;
   end  { Window1 };
   procedure Window2;
   begin
      LowVideo;
      SelectWindow(2);
      GotoXY(1,24);
      Write('Line ', Wtab[2,5]:5, ' ' ,#207,' ', RanStr(16));
      Wtab[2,5]:=Succ(Wtab[2,5]);
      NormVideo;
   end  { Window2 };

   procedure Window3;
   begin
      LowVideo;
      SelectWindow(3);
      GotoXY(1,1);
      Write(#13#11);
      GotoXY(1,1);
      Write('Line ', Wtab[3,5]:5, ' ' ,#207,' ',  RanStr(56));
      Wtab[3,5]:=Succ(Wtab[3,5]);
      NormVideo;
   end  { Window3 };
begin
   clrscr;
   GotoXY(15,25);
   Write('TURBO PASCAL Window Demo  -  Press any key to stop');
   for i:=1 to Windows do
      Frame(Wtab[i,1]-1, Wtab[i,2]-1, Wtab[i,3]+1, Wtab[i,4]+1);
   repeat
      Window1;
      Window2;
      Window3;
   until KeyPressed;
   Read(KBD, Ch);
   window(1,1,80,25);
   clrscr;
end.

Quite straightfoward actually, the program sets up 3 Windows and makes all this stuff flow through it!  ;D  The Procedure Window uses Control Character #26 which is the Text Window equivalent to the BASIC Window command and the additional paramaters reflect the dimensions of the Window.
 
Here's the output of that program!
 
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #1 on: 23:42, 03 September 10 »
Ok, it's nice to see that the CPC can use Windows! And there may be few applications, where windows make sense (f. e. a window with file-names). But (IMHO) in most cases a screen with 80 * 25 charactes really need no windows. I mean, where is the gain in using a Window? The only thing that a window does for you is to SHRINK the usable space on screen.
Personally I can't understand the hype about windows. They just cut down you freedom. Look at windows on CPC, except the soundtrakker/Starkos there is not one application running with / in a window, that wouldn't be better in fullscreen. But ok, for some people it's more important that it looks nice, instead of being usable. "the sizzle sells the steak". The eye eats, too ;-)
Anyway, it's a pleasure to see that it is possible in TP3 on CPC, at least to kick to butt of some commodore guys ;-)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

norecess

  • Guest
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #2 on: 23:48, 03 September 10 »
Seconded.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1159
  • Likes Given: 1931
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #3 on: 01:48, 04 September 10 »
Ooh - take that Windows!  ;D
 
I know I have a bit of a thing for Windows (probably because the Windows Demo program in the CPC464 manual was so cool!). I'm guilty of having them for my Menu programs where, in that I would change the paper colour and clear screen that as an effective means to make it look like a Filled in Box.
Another program I wrote (in BASIC of course) where I thought Windows were very effective was a Memory Dumper, it would simply divide the screen - I could have a bar at the top of the screen with the address, hexadecimal byte & decimal byte in one window, and below that boxes for the address, hexadecimal byte & decimal byte. Around that I had all text graphics (border edge graphics) - of course the main idea was to scroll the addresses and bytes down without interfering with the rest of screen. I think the only setback there was speed cause scrolling things down in Windows Text Boxes does this - though it doesn't present the problem of realigning something like the Status Bar.
 
It might have other uses perhaps in a Game one could setup a Status Bar to keep things like Score & Lives in and then elsewhere maybe a Graphics Window with a Scrolly game in it.
 
Windows is simply there as a cosmetic feature though, in Mode 2 (80x25) it probably doesn't have many applications, which leaves Mode 1 & Mode 0 to add more colour to it and in some ways can be an alternate way to eliminating the issues of scrolling.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #4 on: 05:26, 04 September 10 »
Well, right. As long as "windows" are not thrown chaotic over each other there are some applications which may like them :-)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

norecess

  • Guest
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #5 on: 06:05, 04 September 10 »
Actually, the only "windows-based" system that convinced me was Discology user interface.. was usable, but not too much intrusive !


At some point, Ocp Art Studio is also interesting for that.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #6 on: 06:09, 04 September 10 »
I totally agree! Are you coming home now? Must be really late in France (think 28:08 errr...4:08). Here in NOLA it's "only" 22:08. I will great the French Quarter from you, which I will visite now... :-)
 
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1159
  • Likes Given: 1931
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #7 on: 06:25, 04 September 10 »
Yeah, No, well that's fine  :-[  Each to their own I say!!  :)
 
I just thought it would be something useful to have in Turbo Pascal, given I've seen some interesting BASIC games which make use of the Windows. It can be used as a glorifying tool, or simply a means or organising. Okay I'm perhaps not the best person to be writing about this, given I was over the moon when I understood how Window works, and yes I suppose it can be misused just like anything else.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1017
  • Likes Given: 926
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #8 on: 15:13, 04 September 10 »
Well, right. As long as "windows" are not thrown chaotic over each other there are some applications which may like them :-)

Well, for example SymbOS is well organized with it's windows and works fine.
Really, it's very user friendly because it's Win-style.
It's easy to bring windows to front because each window has it's task symbol in a task bar.
And the screen rendering is really fast enough.
So thumbs up for windows on CPC!
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

norecess

  • Guest
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #9 on: 01:01, 05 September 10 »
Quote
I totally agree! Are you coming home now? Must be really late in France (think 28:08 errr...4:08). Here in NOLA it's "only" 22:08. I will great the French Quarter from you, which I will visite now... :-)


Sure, enjoy visiting France ! But you won't find me there - I'm living in Montreal (Canada) actually ! And got my 2 CPCs there... :P

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1159
  • Likes Given: 1931
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #10 on: 03:24, 05 September 10 »
Okay more fuel for the Fire - it's on my Website!  ;D
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #11 on: 03:26, 05 September 10 »

Sure, enjoy visiting France ! But you won't find me there - I'm living in Montreal (Canada) actually ! And got my 2 CPCs there... :P

Have a good evening neighbour!  ;D
 
 
Well, for example SymbOS is well organized with it's windows and works fine.
Really, it's very user friendly because it's Win-style.
It's easy to bring windows to front because each window has it's task symbol in a task bar.
And the screen rendering is really fast enough.
So thumbs up for windows on CPC!

You must be right!  :o  We can see it here:
http://en.wikipedia.org/wiki/File:Symbos-cpc.png
« Last Edit: 03:28, 05 September 10 by TFM/FS »
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1159
  • Likes Given: 1931
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #12 on: 11:21, 06 September 10 »
TFM/FS wrote:

You must be right!  :o  We can see it here:
http://en.wikipedia.org/wiki/File:Symbos-cpc.png

The Windows used in my examples are Text Based so in this instance the Text Window is &BB66 which uses registers H for the Left Side of the Window, D for the Right, L for the Top & E for the Bottom.
 
To do Graphical Based Windows again requires two Firmware Routines with GRA WIN WIDTH and GRA WIN HEIGHT. GRA WIN WIDTH (&BBCF) sets the left and right hand edges, both of the Edges is defined using DE and HL (it doesn't matter which edge is which). Likewise to use GRA WIN HEIGHT (&BBD2) top and bottom is defined with DE and HL (it doesn't matter which is which).
 
But having said all that Symbos probably has it's own special routine for defining Windows given it's an OS in it's own right - it probably scraps the Firmware for something more meaningful for it.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1985
  • Likes Given: 4650
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #13 on: 20:59, 08 September 10 »
The Windows used in my examples are Text Based so in this instance the Text Window is &BB66 which uses registers H for the Left Side of the Window, D for the Right, L for the Top & E for the Bottom.
 
To do Graphical Based Windows again requires two Firmware Routines with GRA WIN WIDTH and GRA WIN HEIGHT. GRA WIN WIDTH (&BBCF) sets the left and right hand edges, both of the Edges is defined using DE and HL (it doesn't matter which edge is which). Likewise to use GRA WIN HEIGHT (&BBD2) top and bottom is defined with DE and HL (it doesn't matter which is which).

Yes, and as long as you don't shuffle windows over each other you still have some order and you can work with it. Chaos always begins when windows become "thrown" on each other.
 
Actually I like the very first pic in this thread, because there is still order on the screen. But on the other hand windows (used in an unordered way) always have the potential to bring chaos. ;)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1159
  • Likes Given: 1931
Re: WINDOW.PAS - Turbo Pascal 3 Disk
« Reply #14 on: 11:52, 09 September 10 »
Oh yeah I hear what you're saying, I think I only had Windows over one another if I was doing a Box and wanted like a small Bordering effect in another colour behind it just to make it look a bit multidimensional. Otherwise it gets a bit confusing.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3