Jump to content

Photo

CLSN Pascal


40 replies to this topic

#26 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 13,818 posts
  • Location:United Kingdom

Posted Fri Mar 13, 2015 12:32 PM

Good. You could run the application from inside a batch file and clear the screen on exit.

I just sat for half an hour with DIS6502 trying to figure out what's different about the way AUTORUN.SYS loads the main program and I got nowhere so far. The only obvious thing is that the autorun loader ensures against the host DOS having an issue with PORTB being changed during the load. There are no segments loading to the region where the crash occurs, so I wonder if I'm actually looking at SDX crashing while running in its extended bank.

Edited by flashjazzcat, Fri Mar 13, 2015 12:34 PM.


#27 MrFish OFFLINE  

MrFish

    River Patroller

  • 4,922 posts
  • Location:1010-1010

Posted Fri Mar 13, 2015 8:35 PM

Made a cover, added the version 1.1 readme, and bookmarked the manual. Should make it a little easier to digest.

 

CLSN Pascal Cover.png

 

 



#28 Alfred OFFLINE  

Alfred

    Moonsweeper

  • 320 posts
  • Location:Elmwood, Ontario

Posted Fri Mar 13, 2015 11:29 PM

It doesn't work under any of the disk-based SpartaDos versions.



#29 MrFish OFFLINE  

MrFish

    River Patroller

  • 4,922 posts
  • Location:1010-1010

Posted Sat Mar 14, 2015 1:51 PM

Some corrections. Several bookmarked subsections were not listed correctly. I also ordered the PDF page numbers to match the actual document page numbers.

 

Attached File  CLSN Pascal - Reference Manual.pdf   6.07MB   121 downloads

 



#30 Alfred OFFLINE  

Alfred

    Moonsweeper

  • 320 posts
  • Location:Elmwood, Ontario

Posted Sat Mar 14, 2015 7:19 PM

Looking at the object code that CLSN produces, it's really quite appalling. Almost makes PL65 look good. It doesn't seem as though it does anything inline. Every operation seems to involve multiple (4+) subroutine calls, three of which are to do with pushing and popping things off the stack which is located in a bank. It might be faster than Basic, but it can't be by much if it is.

 

I can't believe how bad these compiled languages are. Action! sure runs rings around them for code performance.



#31 JamesD OFFLINE  

JamesD

    Quadrunner

  • 8,228 posts
  • Location:Flyover State

Posted Sat Mar 14, 2015 8:13 PM

Looking at the object code that CLSN produces, it's really quite appalling. Almost makes PL65 look good. It doesn't seem as though it does anything inline. Every operation seems to involve multiple (4+) subroutine calls, three of which are to do with pushing and popping things off the stack which is located in a bank. It might be faster than Basic, but it can't be by much if it is.

 

I can't believe how bad these compiled languages are. Action! sure runs rings around them for code performance.

It sounds a little like a BASIC compiler I looked at.



#32 TXG/MNX OFFLINE  

TXG/MNX

    River Patroller

  • 3,633 posts

Posted Sat May 30, 2015 1:13 AM

Anyone knows some of the programmers of this software maybe we can try to find the sourcecode.

#33 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Wed Apr 18, 2018 12:37 AM

Hi Alfred,

 

CLSN Pascal works with Disk Based Sparta!

But requires extended memory.

 

Here is working atr image 

 

I just renamed AUTORUN.SYS to CLSN.COM. :)

Try -CLSN for loading bat file.

 

zen

Attached Files



#34 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Thu Apr 19, 2018 2:21 PM

Hi there, friends

Does anyone knows what is COPY.PAS example mentioned in manual?



#35 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Wed May 23, 2018 2:07 AM

Here is working Pascal program

program list;

type
  link = ^node;
  node = record
           data: integer;
           next: link;
         end;

var
  head: link;
  key : integer;
  l   : integer;

procedure addnew(var a: link; d: integer);
var
  c: link;
begin
  if a = nil then begin
    new(a);
    a^.data := d;
    a^.next := nil;
  end

  else begin
    c := a;
    while c^.next <> nil do c := c^.next;
      new(c^.next);
      c^.next^.data := d;
      c^.next^.next := nil;
    end
end;

function showlast(a: link):integer;
var
  c: link;
begin
  c := a;
  if c <> nil then begin
  while c^.next <> nil do c := c^.next;
  showlast := c^.data;
  end
  else
  showlast := 0;
end;

procedure deletelast(var a: link);
var
  c: link;
begin
  if a <> nil then
  begin
  if a^.next <> nil then begin
    c := a;
    while (c^.next^.next <> nil) do c := c^.next;
    dispose(c^.next);
    c^.next := nil;
    end
  else
    begin
    dispose(a);
    a := nil;
    end;
  end;
end;

procedure show_list(a: link);
var
  c: link;
begin
  if a = nil then
  writeln('Stack is empty')
else
  begin
  c := a;
  while c <> nil do
    begin
    write(c^.data:2);
    c := c^.next;
    end;
  writeln;
  end;
end;

begin
  head := nil;

  repeat
    clrscr;
    writeln;
    show_list(head);

    writeln;
    writeln('Select operation');
    writeln('1 - Addition');
    writeln('2 - Deletion');
    writeln('3 - Typing');
    writeln('4 - Exit');

    readln(key);

  case key of
  1: begin
    writeln('Enter number');
    readln(l);
    addnew(head,l);
  end;

  2: deletelast(head);

  3: begin
    writeln;
    show_list(head);
    writeln;
    writeln('Press Return');
    readln;
  end;

  end;
  until key = 4;
end.


#36 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Thu Jul 12, 2018 1:12 PM

Hello Friends.
 
CLSN is a convenient Pascal version working with Heap like BASIC XE out of a Box!
And it's heap is ALL 130XE extended memory 16*3 = 48k. (Do you like it?)
 
Being a strictly type-care language Pascal itself can NOT be too simple.
BUT. It's really simple!
 
I leave PL65 for CLSN!!!
 
Certainly!!!
 
Because of...
CLSN is THE ONLY high level language feeling HIGH-leveled itself.
Please look at Action!
- It's realy Atari-Lang but It's not compartible with any other machine.
- I'm an Atari FAN but I want to transfer my ideas to a world!
IDEAS I mean! And what is the IDEA above Action! itself?
 
Moreover, rtlibs placing separately on disk, killed dosen langs:
- all C dialects
- Action!
...
 
All the attempts to make serious high level lang beyond BASIC failed on Atari, but CLSN.
Let's try CLSN!
 
The main Idea to work with ATARI heap is to supply compiler with acceptable data.
 
AND WHAT IS IT?
- the consensus of types
- the consensus of data
 
Let's try to make bytes area on heap. Can do you like?
 
Don't forget to remember that Pascal is strictly... etc.
 
- At first for the case of heap we need some pointer type, because of it's THE ONLY way to point to never declared entity. (* It's the only exception in Pascal's too striked typization *)
- At second we need to declare THE entity itself!
- At third we need to make variable(static) to touch to every point of our beloved entity on heap!
 
Here is the code to make Dinamic Array on heap.
 
program dyn;
type
  arrP = ^arrT;
  arrT = array[1..1] of byte;
(* On this stage there are no any array on Heap! *)
(* But array is clearly declared as one-dimensioned! And it's size is 1 byte. *)
(* Size means NOTHING for declaration! It's for compiler itself! We can redimension it while runtime!!! *)
var
  a: arrP; (* Here we have created a static variable 'a' to access dynamic data. It's possible because of early accurate Pascal typyzation! *)
  i,num: integer;
begin
  writeln('Enter number of array elements');
  readln(num);


(* Dynamic programming *)
  getmem(a, sizeof(byte)*num); (* We've got a needed part of memory. Now it's marked as used in Pascal. *)
  for i := 1 to num do begin
    writeln('Enter ', i , '-th array element');
    readln(a^[i]);
  end;
  (* Then all array-oriented cycles can use 'num' as a max-border *)
  freemem(a,num*sizeof(byte)); (* freeing used earlier memory *)
end.
 
P.S.
If you are interested in Linked Lists in Pascal I can give you freely used codes...
Just whistle!
 
zen


#37 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Thu Jul 26, 2018 8:25 AM

Deque implementation with Doubly Linked List.

Contains full set of Deque functions.

program deque;
type
(* Container type *)
  infoT = Char;


(* Types for DLL *)
  linkT = ^nodeT;


  nodeT = Record
               data: infoT;
               next, prev: linkT;
             End;


(* Type for deque *)
  deqT = Record
           front,rear: linkT;
         End;


(* Useful functions *)
Function isEmpty(Var deq: deqT): Boolean;
Begin
  isEmpty := (deq.front = nil);
End;


Procedure printDeq(Var deq: deqT);
  Var p: linkT;
Begin
  WriteLn( 'Printing Deque ...' );
  writeln;
  If isEmpty(deq) Then
    Begin
      WriteLn('<empty>'); Exit;
    End;
  p := deq.front;
  While p <> nil Do
    Begin
      Write( p^.data, ' ' );
      p := p^.next;
    End;
  WriteLn;
End;


Procedure pushFront(Var deq: deqT; Ch: infoT);
  Var neo: linkT;
Begin
  new(neo);
  neo^.next := deq.front;
  neo^.prev := nil;
  neo^.data := Ch;
  If deq.front <> nil Then
    deq.front^.prev := neo
  Else
    deq.rear := neo;
  deq.front := neo;
End;


Procedure pushRear(Var deq: deqT; Ch: infoT);
  Var neo: linkT;
Begin
  new(neo);
  neo^.next := nil;
  neo^.prev := deq.rear;
  neo^.data := Ch;
  If deq.rear <> nil Then
    deq.rear^.next := neo
  Else
    deq.front := neo;
  deq.rear := neo;
End;


Function popFront(Var deq: deqT): infoT;
  Var toDelete: linkT;
Begin
  popFront := #0;
  If isEmpty(deq) Then Exit;
  toDelete := deq.front;
  deq.front := toDelete^.next;
  If deq.front <> nil Then
    deq.front^.prev := nil
  Else
    deq.rear := nil;
  popFront := toDelete^.data;
  Dispose(toDelete);
End;


Function popRear(Var deq: deqT): infoT;
  Var toDelete: linkT;
Begin
  popRear := #0;
  If isEmpty(deq) Then Exit;
  toDelete := deq.rear;
  deq.rear := toDelete^.prev;
  If deq.rear <> nil Then
    deq.rear^.next := nil
  Else
    deq.front := nil;
  popRear := toDelete^.data;
  Dispose(toDelete);
End;


Procedure initDeq(Var deq: deqT);
Begin
  deq.front := nil;
  deq.rear := nil;
End;


Procedure killDeq(Var deq: deqT);
  var D: infoT;
Begin
  While not isEmpty(deq) Do D := popFront(deq);
End;


Var mD: deqT;
Begin
  initDeq(mD);
  pushFront(mD, 'A');
  pushFront(mD, 'B');
  pushRear(mD, 'F');
  pushRear(mD, 'G');
  writeln;
  writeln('Forward traversing');
  printDeq(mD);
  writeln;
  writeln('Backward traversing');
  writeln('Printing Deque ...');
  writeln;
  While not isEmpty(mD) Do
    WriteLn( popRear(mD) );
  killDeq(mD);
End.

And the Result:

 

Also you know that These functions can be used as standard functions of Stack, Oueue etc...

Attached Thumbnails

  • DEQ.png

Edited by 576XE, Thu Jul 26, 2018 8:49 AM.


#38 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Fri Jul 27, 2018 10:28 AM

The Joystick's implementations in CLSN is the same as in PL65.

 

It's just an array of system Equates.

But there are never sayed that logic calculations are the same as in Basic, PL65  etc.

 

This string make me comfort:

  isEmpty := (deq.front=nil);

 

We CAN calculate bulean value and then equate it to variable!

Thus:

(* Globals *)type
  stk = record
            dx,dy: byte; (* to be returned to main program *)
          end;
var
  s: byte;


procedure rdStick();
  var i: integer;
begin
  for i := 0 to 1 do begin
    s := stick[i];
    stk.dx := (s=5 or s=6 or s=7) - (s=9 or s=10 or s=11);
    stk.dy := (s=5 or s=9 or s=13) - (s=6 or s=10 or s=14);
  end;
end;
Sorry it needs to be checked, but is so clear and simple that I don't even want to make a control program.
zen
 


#39 tebe OFFLINE  

tebe

    Dragonstomper

  • 759 posts
  • Location:Poland

Posted Sat Jul 28, 2018 1:49 PM

 

The Joystick's implementations in CLSN is the same as in PL65.

 

It's just an array of system Equates.

But there are never sayed that logic calculations are the same as in Basic, PL65  etc.

 

This string make me comfort:

  isEmpty := (deq.front=nil);

 

We CAN calculate bulean value and then equate it to variable!

Thus:

(* Globals *)type
  stk = record
            dx,dy: byte; (* to be returned to main program *)
          end;
var
  s: byte;


procedure rdStick();
  var i: integer;
begin
  for i := 0 to 1 do begin
    s := stick[i];
    stk.dx := (s=5 or s=6 or s=7) - (s=9 or s=10 or s=11);
    stk.dy := (s=5 or s=9 or s=13) - (s=6 or s=10 or s=14);
  end;
end;
Sorry it needs to be checked, but is so clear and simple that I don't even want to make a control program.
zen
 

 

 

strange Pascal dialect

 

STK in this example is TYPE, not VARIABLE

stk.dx := .....

Error: Variable identifier expected

stk.dx := (s=5 or s=6 or s=7) - (s=9 or s=10 or s=11);

Error: Incompatible types: got "Boolean" expected "LongInt"

Error: Operator is not overloaded: "Boolean" - "Boolean"

 

Pascal needs parenthesis

 

correct version of example (FreePascal, MadPascal)

type
  Tstk = record
            dx,dy: byte;
          end;
 
var stk: Tstk;
      s: byte;
 
begin
    s := stick0;
    stk.dx := ord((s=5) or (s=6) or (s=7)) - ord((s=9) or (s=10) or (s=11));
    stk.dy := ord((s=5) or (s=9) or (s=13)) - ord((s=6) or (s=10) or (s=14));
end.

Edited by tebe, Sat Jul 28, 2018 1:52 PM.


#40 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Sun Jul 29, 2018 2:20 AM

Hi there, tebe-

You are absolutely right !!!

must be:

(* Globals *)
type
  stkT = record
            dx,dy: byte; (* to be returned to main program *)
          end;
var
  s: byte; stk: stkT; 


procedure rdStick();
  var i: integer;
begin
  for i := 0 to 1 do begin
    s := stick[i];
    stk.dx := (s=5 or s=6 or s=7) - (s=9 or s=10 or s=11);
    stk.dy := (s=5 or s=9 or s=13) - (s=6 or s=10 or s=14);
  end;
end;


#41 576XE OFFLINE  

576XE

    Dragonstomper

  • 763 posts
  • Location:Moscow, Russia

Posted Mon Oct 8, 2018 3:45 AM

Hello, FRIENDS!

 

For about 2 months I can NOT arrange Line Screen Access to SCREEN just to eliminate multiplication in cycles (which is the native Pascal way of thinking.)

 

Here is a short program which has to be working but ...

program ptr;

var
  (* It;s INITIALIZATION of _Scr! Now _Scr contains SAVMSC data. *)
  _Scr: word absolute $58;
  _Len: byte; _Adr: word;
  (* We say that _Val contains the ADDRESS of byte which placed in absolute _Adr location *)
  _Val: ^byte absolute _Adr;

procedure invLin(a: word; l: byte);
begin
  (* Move Args to Globals *)
  _Adr := a; _Len := l;
  inline(
         $a0/$00/  (*         LDY #$00   *)
                   (* ------------------ *)
         $B9/_Adr/ (* LOOP    LDA _Adr,Y *)
         $49/$80/  (*         EOR #$80   *)
         $99/_Adr/ (*         STA _Adr,Y *)
                   (* ------------------ *)
         $C8/      (*         INY        *)
         $CC/_Len/ (*         CPY _Len   *)
         $D0/$F2   (*         BNE LOOP   *)
        );
end;

var
  a: word; l: byte; c: char;
begin
  (* Just to be visible in CLSN IDE ;) *)
  writeln;
  (* Move Args to Globals *)
  a := _Scr; l := 10;
  write('?>'); c := readkey; writeln;
  (* This part is lost in time... *)
  invLin(a,l);
  writeln;
  write('?>'); c := readkey; writeln;
end.

CLSN is VERY impressive.

Please help me make CLSN better

zen

 






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users