Difference between revisions of "Pascal"

From Ninerpedia
Jump to navigation Jump to search
m (add category)
 
(7 intermediate revisions by 2 users not shown)
Line 25: Line 25:
  {$L PRINTER: }  
  {$L PRINTER: }  
  program fastback;  
  program fastback;  
 
  buffer:array[1..5120] of integer;  
  buffer:array[1..5120] of integer;  
  inunit,outunit:integer;  
  inunit,outunit:integer;  
  blkbase,blklimit:integer;  
  blkbase,blklimit:integer;  
  ch:string[9];  
  ch:string[9];  
  procedure getfrom;  
  procedure getfrom;  
  begin  
  begin  
Line 48: Line 49:
  blklimit:=(blkbase div 10) - 1;  
  blklimit:=(blkbase div 10) - 1;  
  end;  
  end;  
  procedure getto;  
  procedure getto;  
  begin  
  begin  
Line 58: Line 60:
  end
  end
  end;  
  end;  
  beqin  
  beqin  
  writeln('FASTBACK [V1,0]');  
  writeln('FASTBACK [V1,0]');  
  qetfrom;  
  qetfrom;  
  getto;  
  getto;  
  writeln('insert disks-- to start');  
  writeln('insert disks--<cr> to start');  
  readln(ch);  
  readln(ch);  
  for blkbase:=0 to blklimit do  
  for blkbase:=0 to blklimit do  
Line 69: Line 72:
  beqin  
  beqin  
  write( ' Insert MASTER disk--press  
  write( ' Insert MASTER disk--press  
  when ready');  
<cr> when ready');  
  readln(ch)  
  readln(ch)  
  end;
  end;
Line 76: Line 79:
  begin  
  begin  
  write('Insert COPY disk--Press  
  write('Insert COPY disk--Press  
  when ready');  
<cr> when ready');  
  readln(ch)  
  readln(ch)  
  end;
  end;
  unitwrite(outunit,buffer,5120,blkbase*10)  
  unitwrite(outunit,buffer,5120,blkbase*10)  
  end;  
  end;  
  write1('Copy Complete.')  
  writeln('Copy Complete.')  
  end.
  end.


== Turbo Pasc'99 ==
== Turbo Pasc'99 ==
[[File:TPV3_Manual_Cover.jpg|right]]
Turbo Pasc '99 originated in Germany and initial release to the English world was a German version. It was supplied on disk and did NOT require the P-code card.


Turbo Pasc '99 originated in Germany and initial release to the English world was a German version.
The specific origin is not known but the name Wiposoft is associated. In the English speaking world Texaments was the leading supplier.


The specific origin is murky and anyone with knowledge is asked to edit this article please.
This language is not to be confused with that other Turbo Pascal from Borland. This is closer to ISO Pascal.


This language is not to be confused with that other Turbo Pascal from Borland. This is closer to ISO Pascal.
Started by running the Editor Assembler #EA5 program image DSK1.TP99A


ISO Pasca1 items NOT supported are:  
===Comparison with ISO Pascal===
ISO Pascal items NOT supported are:  


file, in, packed, record, set, type, with, char, ord, pred, round, sqr, succ, trunc,odd, reset, rewrite, dispose, new, pack, unpack.  
file, in, packed, record, set, type, with, char, ord, pred, round, sqr, succ, trunc,odd, reset, rewrite, dispose, new, pack, unpack.  
Line 106: Line 111:


REAL must be specified as 4, 6 or 8 bytes- if you select 8 you have normal Ex Bas, precision.
REAL must be specified as 4, 6 or 8 bytes- if you select 8 you have normal Ex Bas, precision.
===Samples Turbo Pasc '99 code===
====Integer Math loop====
PROGRAM intmath;
    VAR t,
    i,x,y : INTEGER;
      BEGIN
      writeln(".........");
      t  :=  0;
        FOR  t  :=  1 TO 100 DO
        BEGIN
        x  :=  0;
        y  :=  9;
        writeln("start");
            FOR i  := 1 TO  1000 DO
            BEGIN
            x  :=  x  +  (y * y - y)  DIV  y;
            END;
        END;
      writeln("---",x);
      END.
====Writing to disk====
PROGRAM store;
VAR  i  :  INTEGER;
      f  :  STREAM[80];
BEGIN
    writeln("START");
    open(f,"DSK2.TEXT",output);
        FOR i  :=  1  TO  1000
        putln(f,"1234567890qwertyuiop");
        close(f);
        writeln("*****");
END.


[[Category:Programming language]]
[[Category:Programming language]]

Latest revision as of 10:56, 26 February 2024

UCSD Pascal System

P-Code welcome screen, booted with Editor/Filer disk

File doesn't exist

PASCAL NOTE: Guy Stefan-Romano, 99ers Users Group. Sept 1984:

'FILE DOESN'T EXIST" after adding a UNIT to SYSTEM.LIBRARY:

In most USCD Pascals. the system is not provided with a SYSTEM.LIBRARY. TI placed parts of Pascal that would normally reside on disk/ram into chips on the card, to allow our tiny machine to run Pascal. TI also provided a SYSTEM.LIBRARY to allow use of sound, graphics. speech etc.

Because installation of a new UNIT into a SYSTEM.LIBRARY requires that a file be open while data is manipulated, the existing SYSTEM.LIBRARY data is quite vulnerable. TI added protection.

You need to call a temporary File -say USER.LIB. transfer all UNITS in SYSTEM.LIBRARY to USER.LIB, then add your new UNITS to USER.LIB and IF all goes well, rename the USER.LIB file SYSTEM.LIBRARY


What is P-Code?

P-Code can be thought of as a universal assembly type language. P-Code was developed to be transportable to different platforms for execution. The TI-99/4A supports P-Code with the use of the P-Code card. Some other platforms that support P-Code are: Z80, Motorola 6800/68000, Intel 8086/8088 and many others.

A sample of USCD Pascal coding

This program will backup any disk using sector I/O; both 1 and multiple drives and single/double sided. Written in UCSD Pascal for the TI 99/4A.

{$L PRINTER: } 
program fastback; 

buffer:array[1..5120] of integer; 
inunit,outunit:integer; 
blkbase,blklimit:integer; 
ch:string[9]; 

procedure getfrom; 
begin 
inunit:=0; 
while (inunit,.4) and (inunit,.<>5) 
and (inunit<>9) do 
begin 
write('Enter Source Drive # (4,5,9) '?');
readln(inunit) 
end; 
blkbase:=0; 
while (blkbase<>180) and 
(blkbase <> 360) do 
begin 
write('# blocks to copy (180/360) ?') 
readln(blkbase) 
end; 
blklimit:=(blkbase div 10) - 1; 
end; 

procedure getto; 
begin 
outunit:=0; 
while (outunit<>4) and 
(outunit<>5) and (outunit<>9) do 
begin 
write('Enter Copy Drive # (4,5,9) ?'); 
readln(outunit) 
end
end; 

beqin 
writeln('FASTBACK [V1,0]'); 
qetfrom; 
getto; 
writeln('insert disks--<cr> to start'); 
readln(ch); 
for blkbase:=0 to blklimit do 
begin 
if inunit=outunit then 
beqin 
write( ' Insert MASTER disk--press 
<cr> when ready'); 
readln(ch) 
end;
unitread(inunit,buffer,5120,blkbase*10); 
if inunit=outunit then 
begin 
write('Insert COPY disk--Press 
<cr> when ready'); 
readln(ch) 
end;
unitwrite(outunit,buffer,5120,blkbase*10) 
end; 
writeln('Copy Complete.') 
end.

Turbo Pasc'99

TPV3 Manual Cover.jpg

Turbo Pasc '99 originated in Germany and initial release to the English world was a German version. It was supplied on disk and did NOT require the P-code card.

The specific origin is not known but the name Wiposoft is associated. In the English speaking world Texaments was the leading supplier.

This language is not to be confused with that other Turbo Pascal from Borland. This is closer to ISO Pascal.

Started by running the Editor Assembler #EA5 program image DSK1.TP99A

Comparison with ISO Pascal

ISO Pascal items NOT supported are:

file, in, packed, record, set, type, with, char, ord, pred, round, sqr, succ, trunc,odd, reset, rewrite, dispose, new, pack, unpack.

Items included but not in ISO PASCAL (some replacing items above):

Block, Module, Relative, Stream, String, Open, Seek, Append, Close, Asc, Cursor, Key, Screen, minint, pi, graphics, text, putln, cls, cir, cis, cri, crs, csi, csr, len, int, rnd, seg, tan, randomize.

Variations on ISO Pascal are:

Strings are within double quotes "string" instead of 'string'

REAL must be specified as 4, 6 or 8 bytes- if you select 8 you have normal Ex Bas, precision.

Samples Turbo Pasc '99 code

Integer Math loop

PROGRAM intmath; 
   VAR t, 
   i,x,y : INTEGER; 
     BEGIN 
     writeln("........."); 
     t  :=  0;
       FOR  t   :=  1 TO 100 DO 
       BEGIN 
       x  :=  0;
       y  :=  9;
       writeln("start"); 
           FOR i  := 1 TO  1000 DO 
           BEGIN 
           x  :=  x  +  (y * y - y)  DIV  y; 
           END; 
       END;
     writeln("---",x);
     END. 

Writing to disk

PROGRAM store; 
VAR   i   :  INTEGER; 
      f   :  STREAM[80];
BEGIN 
   writeln("START"); 
   open(f,"DSK2.TEXT",output); 
       FOR i  :=  1  TO  1000 
       putln(f,"1234567890qwertyuiop"); 
       close(f); 
       writeln("*****");
END.