Jump to content
IGNORED

Mad Pascal


Recommended Posts

On 3/29/2021 at 12:51 AM, tebe said:

new MP, https://github.com/tebe6502/Mad-Pascal

 

- unit ZX0

- block ASM without { } is supported

 

 

FYI: i guess there's an 'end;' too much in lib\zx0.pas 

 

zx0.pas: 

[..]

to_exit        ldx #0
@sp        equ *-1
end;

//end;       commented this out, compiles & works great then.

end.
 

 

Link to comment
Share on other sites

  • 4 weeks later...

Mad Pascal 1.6.5

  • rewritten handling of CASE OF
  • rewritten code optimization for arrays not exceeding 256 bytes
  • optimization for conditions '>', '<='
  • added memory allocation for STRING-type arrays (so far only the pointer was put away, it worked like 'array of ^string')
  • new platform added, Commodore C4 Plus
  • unit GRAPHICS: procedure Font(charset: pointer);
  • unit STRINGUTILS
  • unit MISC, RMT, CMC, MPT: DetectAntic
  • unit SYSTEM revised to include ATARI, C64, C4Plus platforms
  • unit ZX0
  • unit HCM2
  • added support of $resource (RCDATA, RCASM) for C64, C4Plus platforms, resources are sorted by ascending addresses
  • extended RCDATA resource with possibility to specify ofset for read file
  • added support for Pascal compliant syntax for ASM block, no { } brackets required
  • added new directive {$codealign proc = value}, {$codealign loop = value} allowing to align generated code

https://github.com/tebe6502/Mad-Pascal/releases

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

Waw, great! So many new features...

 

I also noticed some examples do not work anymore. I checked the code for cube_clip3.pas (fast object rotation), which uses FrameBuffer procedure, which does not exist in graph.inc anymore.

I found there are new routines (SetDisplayBuffer, NewDisplayBuffer, SwitchDisplayBuffer), which, I suppose, do the job properly, but I didn't grasp the functionality properly yet.

 

Link to comment
Share on other sites

  • 2 weeks later...

I think I try @ilmenit way but instead C I plan to use... guess what... yep Pascal :D

 

https://www.freepascal-meets-sdl.net/sdl-tutorials/

https://lazyfoo.net/tutorials/SDL/

 

https://github.com/PascalGameDevelopment/SDL2-for-Pascal

 

but before that I must study this: https://castle-engine.io/modern_pascal_introduction.html

 

Edited by zbyti
github repo
  • Thanks 1
Link to comment
Share on other sites

Very nice implementation for Free Pascal and Delphi. Most non-Pascal developers think Pascal language is obsolete, but it is far from the truth. It is modular, elegant language, with clear syntax.

And best of all, it is fast and optimized when right options are used. Free Pascal and Delphi can be used for low-level programming as C language.

 

It is really useful to read the tutorial listed as last link. Great material for new and experienced developers.

 

The reflexion of usefulness of Pascal language is seen also on Atari 8-bit platform. It is the best high-level language for the platform, fast and optimized, which can also be used as low-level language.

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Variables using Type declaration

 

I found a strange behaviour when using type variable (array of type). Let's explain...

 

I increment a type variable element by some value:

 

monster[0].x := monster[0].x + 2;

 

This code runs ok.

 

But using a procedure, which consists of incrementing such variable, doesn't work correctly.

The example works when commenting (remarking) the call to MoveMonster at the end of listing example.

 

This is modified example from Mad Pascal repository:

uses crt;

type
	monsters = packed record
   	  x: byte ;
	  a: cardinal;
	  y: byte;
	end;

var
	monster: array [0..3] of ^monsters;
	i: byte;

procedure MoveMonster(p : byte);
begin
  monster[p].x := monster[p].x + 2;
end;

begin
  for i:=0 to High(monster) do begin
    GetMem(monster[i], sizeof(monsters));

    monster[i].x := i;
    monster[i].a := $ffffffff;
    monster[i].y := i * 2;
  end;

  for i:=0 to High(monster) do
    writeln(monster[i].x,',', monster[i].y);

  // Let's move first monster
  writeln('');
  writeln('Let''s move first monster');
//  monster[0].x := 2;
  monster[0].x := monster[0].x + 2;
  writeln(monster[0].x,',', monster[0].y);

  MoveMonster(0);
  writeln(monster[0].x,',', monster[0].y);

  repeat until keypressed;
end.

 

Any thoughts? Thank you.

 

Regards.

 

Link to comment
Share on other sites

Yes, it's known bug. Use:

uses crt;

type
  monsters = packed record
      x: byte ;
    a: cardinal;
    y: byte;
  end;

var
  monster: array [0..3] of ^monsters;
  i: byte;
  m : ^monsters;

procedure MoveMonster(p : byte);
begin
  m := monster[p];
  Inc(m.x, 2);
end;

begin
  for i:=0 to High(monster) do begin
    GetMem(monster[i], sizeof(monsters));

    monster[i].x := i;
    monster[i].a := $ffffffff;
    monster[i].y := i * 2;
  end;

  for i:=0 to High(monster) do
    writeln(monster[i].x,',', monster[i].y);

  // Let's move first monster
  writeln('');
  writeln('Let''s move first monster');
  m := monster[0];
  //monster[0].x := 2;
  Inc(m.x, 2);
  writeln(monster[0].x,',', monster[0].y);

  MoveMonster(1);
  writeln(monster[1].x,',', monster[1].y);

  repeat until keypressed;
end.

 

Edited by zbyti
  • Thanks 1
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...
 Share

  • Recently Browsing   0 members

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