Jump to content
IGNORED

Mad Pascal


Recommended Posts

 

On 5/20/2023 at 2:53 AM, danwinslow said:

Ah. Ok, thanks. The guy asking about it seemed to have some expectation of it working that way, so I kind of thought it was supposed to. Maybe it's kind of a language hole, and only works in variants that MadPascal is not implementing.

Yes, I assumed that local variables are initialized every time you call a function, but it seems local variables in (Mad) Pascal act more like static local variables in C language.  

 

I like Mad Pascal. It makes me more productive.

  • Like 5
Link to comment
Share on other sites

  • 2 months later...

Hi Tebe,

thank you very much for the compiler update! Woke me up to restart some A8 coding after summer break :)

 

Recompiling my project with 1.6.8 gave me an error with "mod", which did not happen under 1.6.6.

It looks like a 'mod 16' (or 2,4,8,..) produces a 'jsr #$00' .

 

 

line 1288: textline[13]:=chr(33+w1 mod 16); 

--> 

RTLIB: $22AB..$29D3
        jsr #$00
BRIT.a65 (12562) ERROR: Illegal addressing mode (CPU 6502)

 

The corresponding code in .a65 @ line 12562:

; optimize OK (BRIT.PAS), line = 1288

    lda GLOBALS.W1
    and #$0F
    jsr #$00
    lda #$21
    add @BYTE.MOD.RESULT
    sta adr.TEXTLINE+$0D

 

for context: 

 [..]
    'u' : begin           // Use sextant
        textline:='Use-sextant'~;
        write_text;

        if night < 50 then begin
            xms_textline(103); // Only     
            xms_textline(105); // at night!     
        end else begin
            xms_textline(101); // Position: Y"y' X"x'
            w1:=byte(my*16)+ay_m;
            w2:=byte(mx*16)+ax_m;
            textline[11]:=chr(33+w1 div 16);
            textline[13]:=chr(33+w1 mod 16); //rogi@2023.08.17: new compiler error??
            textline[16]:=chr(33+w2 div 16);
            //textline[18]:=chr(33+w2 mod 16); rogi@2023.08.17: new compiler error??
        end;
     end;
 [..]

 

Edited by Atlan_Roland
Link to comment
Share on other sites

What a release! Thank you for the new version, making it the most powerful Atari 8-bit cross-platform development tool besides MADS. Other tools are also great, of course, but this is true masterpiece.

 

  • Like 1
Link to comment
Share on other sites

MP newest version, new features

https://github.com/tebe6502/Mad-Pascal/tree/master

- improved memory allocation for arrays [0..0], 'ABSOLUTE $0000' is enforced initially, 1 byte of memory is saved
- added possibility to declare arrays without specifying their size, e.g.:

 tab: array of byte = [1,3,4,3,1];
 tb: array of char = 'abcdefghij';

- new compiler directive {$bin2csv filename} allows you to initialize arrays e.g.:

 tb: array of byte = [ {$bin2csv filename} ];

 

https://github.com/tebe6502/Mad-Pascal/tree/master/samples/a8/bin2csv

  • Like 3
Link to comment
Share on other sites

Hi Tebe,
 

in MP 1.6.8+, the usage of a pstring variable as parameter to unzx0() does not work anymore.

(compiles, but the unzx0ed datastream seems to get written unpredictably into memory, at least not in the specified target adress).

 

The same workes fine with MP1.6.6 though.

 

Has there been any change in usage of pstring that i'm missing?

 

Attached the .a65 outputs of MP 1.6.6 and MP 1.6.8 of given code below. If you should need more data tell me.


Thank you for all your efforts with mp! 👍

 

program test_mp_1_6_8;
uses crt,zx0;

const
	IMPORT   = $5000;	  

var
	i		: byte;
	fname		: pstring;
begin

fname:='D:RESOURCE.ZX0';
unzx0(fname, pointer(IMPORT));  		// was fine MP 1.6.6, but not anymore in MP 1.6.8 ?
//unzx0('D:RESOURCE.ZX0', pointer(IMPORT));	// to verify, works fine if the filestring is given directly.
 
gotoxy(1,1);
for i:=0 to 39 do
	write(chr(peek(IMPORT+i)));

repeat until false;

end.

 

 

testcode_mp_1.6.6.a65 testcode_mp_1.6.9.a65

Link to comment
Share on other sites

On 8/21/2023 at 11:37 PM, tebe said:
- improved memory allocation for arrays [0..0], 'ABSOLUTE $0000' is enforced initially, 1 byte of memory is saved
- added possibility to declare arrays without specifying their size, e.g.:

 tab: array of byte = [1,3,4,3,1];
 tb: array of char = 'abcdefghij';

- new compiler directive {$bin2csv filename} allows you to initialize arrays e.g.:

 tb: array of byte = [ {$bin2csv filename} ];

 

https://github.com/tebe6502/Mad-Pascal/tree/master/samples/a8/bin2csv

I'm a bit confused about the name "$bin2csv". I'd expect CSV means "Comma Separated Values", so read a "1,2,3" text file. But this looks like a "bin2bytearray," e.g. INS in MADS. ?!

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...