Jump to content
IGNORED

Mad Pascal


Recommended Posts

I am glad you figured it out :) The fact is that Pascal is as strong as C for several years, from Turbo Pascal, Delphi and now Lazarus and Free Pascal on PC platform.

Actually, in the late 80s and 90s I did a lot of Turbo Pascal and Delphi 1. But after that I moved on, because all programming languages I learned at university like Common LISP and Oberon. Yes, Oberon.

Edited by JoSch
Link to comment
Share on other sites

Hi.

 

Here's another small patch needed to compile blit.pas VBXE example on Linux. And static binaries (32-bit) for Linux.

Mp + VBXE is... like a dream come true :)

 

W.

 

That's true :) It is also very close to Action! programming in some ways. But that does not mean I will ignore Action!, and Effectus will continue to be developed, but in small waves.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I really like Mad Pascal, but I have two suggestions and one issue:

1.) I really like that MP uses fixed point arithmetics for type Real, but only 8 bits for the fractional part? It's a little sparse for my taste.

It tinkered a little with source code of the compiler and I could change the fractional bit count, but in the runtime there were lots of places where there should be changes that are hardcoded at moment.

Would it be possible to change the runtime so, that changes are reflected, so that we can change the fraction bit count by, say, a parameter?

 

2.) I remember using Turbo Pascal 3 with overlays. Would it be feasible to implement a similar feature?

 

3.) I wanted to implement a vector and matrix library for an application, I'm thinking about. You find it here: http://github.com/josch1710/8ray.

Now, when I run the program in altirra, the program outputs the values of the vector correctly, if I access them directly.

But in the string conversion routine, it only gets the first two values correctly. What's going on here?

Link to comment
Share on other sites

1.) I really like that MP uses fixed point arithmetics for type Real, but only 8 bits for the fractional part? It's a little sparse for my taste.

 

In contrary to your opinion I find it absolutely gorgeous a feature in MP. Should I ever, what is highly unlikely, need more accuracy, I'd revert to system provided routines. A small lib would cover this beautifully.

 

Edit after seeing your lib - I do understand now why you want more accuracy, indeed matrix operations will make the error grow fast. Still would stick to low bit count for speed.

Edited by pirx
Link to comment
Share on other sites

 

In contrary to your opinion I find it absolutely gorgeous a feature in MP. Should I ever, what is highly unlikely, need more accuracy, I'd revert to system provided routines. A small lib would cover this beautifully.

 

Edit after seeing your lib - I do understand now why you want more accuracy, indeed matrix operations will make the error grow fast. Still would stick to low bit count for speed.

No, I think, you got me wrong. As I already said, I really like the feature.

I don't want to change the overall size of real (4 bytes). What I want to change is the fractional part, which is at the moment 8 bits, meaning the smallest fraction would be 1/256, which is about 0.004. Perhaps some other user needs a better resolution, and that's not possible at the moment.

Which brings me to my sample code. This is far from a finished solution ;-) I'm far from a API freeze. I was just experimenting with Mad Pascal, when I ran into the problem, which hopefully is fixed.

So, it's rather early to think about dismissing my feature request, just because my code doesn't use reals at the moment ;-)

Edited by JoSch
  • Like 1
Link to comment
Share on other sites

Ok, I don't know where the bug is, but when I run my test code under Altirra with AltirraOS, then writeln of the result of the vector string conversion function, will be shown as if each space is two EOLs.

post-38519-0-09468500-1465242025_thumb.png

 

With a XL ROM, everything is as supposed on one line.

Edited by JoSch
Link to comment
Share on other sites

Ok, I don't where the bug is, but when I run my test code under Altirra with AltirraOS, then writeln of the result of the vector string conversion function, will be shown as if each space is two EOLs.

attachicon.gifBildschirmfoto 2016-06-06 um 21.39.09.png

 

With a XL ROM, everything is as supposed on one line.

Best to mention this to phaeron in the latest Altirra thread.

Link to comment
Share on other sites

@tebe: I think, I found the next bug. When I try to call v_add both vector parameters are the same value, i.e. they have both the values of the second parameter.

 

result as array -> not implemented yet (string is special case)

assign arrays -> not implemented yet (string is special case)

 

solution at this time (VAR)

 

 

  procedure v_init2(x, y, z: smallint; var r: tvector);
  begin
    r[0] := x;
    r[1] := y;
    r[2] := z;
    r[3] := 1;
  end;
 
begin
  v_init2 (3, 2, 1, x);
  v_init2 (6, 3, 2, y);
  
  writeln(v_tostring(x));
  writeln(v_tostring(y));
end.
Edited by tebe
  • Like 1
Link to comment
Share on other sites

 

 

result as array -> not implemented yet (string is special case)

assign arrays -> not implemented yet (string is special case)

 

solution at this time (VAR)

 

Ok, thanks for the workaround.

Can I use pointers as parameters? This should be working, I guess.

Edited by JoSch
Link to comment
Share on other sites

 

 

result as array -> not implemented yet (string is special case)

assign arrays -> not implemented yet (string is special case)

 

solution at this time (VAR)

  procedure v_init2(x, y, z: smallint; var r: tvector);
  begin
    r[0] := x;
    r[1] := y;
    r[2] := z;
    r[3] := 1;
  end;
 
begin
  v_init2 (3, 2, 1, x);
  v_init2 (6, 3, 2, y);
  
  writeln(v_tostring(x));
  writeln(v_tostring(y));
end.

Well, I didn't look closely at the workaround, but v_init actually works.

What doesn't work, is v_add. It uses two tvector parameters and the second one seems to overwrite the first one.

Edited by JoSch
Link to comment
Share on other sites

Ok, I don't know where the bug is, but when I run my test code under Altirra with AltirraOS, then writeln of the result of the vector string conversion function, will be shown as if each space is two EOLs.

attachicon.gifBildschirmfoto 2016-06-06 um 21.39.09.png

 

With a XL ROM, everything is as supposed on one line.

That seems to be a bug in MP. Look at that post, please: http://atariage.com/forums/topic/246939-altirra-270-released/page-24?do=findComment&comment=3527154

Edited by JoSch
Link to comment
Share on other sites

There is some wrong with the implicit char to string conversion:

function tostring(: integer): string;
var space, temp: string;
begin
  space := ' ';
  Str(i, temp);
  Result := concat(Result, space); { this works, space is a string }
  Result := concat(Result, temp);
  Result := concat(Result, ' '); { this doesn't work, expects string, gets char, doesn't convert }
end;

The single character is assigned to a string variable and gets implicitly converted.

But a single character is not converted when used a parameter.

I think, this should be corrected.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...