tebe6502 / Mad-Pascal

Mad Pascal Compiler for 6502 (Atari XE/XL, C64, C4Plus, Neo6502)
122 stars 19 forks source link

Adding brackets to object function yields unhandled exception? #122

Closed aydindemircioglu closed 10 months ago

aydindemircioglu commented 11 months ago

I tested objects, and obtained an unhandled exception like this:

Mad Pascal Compiler version 1.7.0 [2023/11/10] for 6502
Compiling test.pas
An unhandled exception occurred at $000000010102A8F8:
                                                     EAccessViolation: Access violation
                                                                                         $000000010102A8F8
                                                                                                            $00000001010090F0
                                                                                                                               $0000000101009574
                                                                                                                                                  $000000010101FA08
                                                                                                                                                                     $0000000101020034
                                                                                                                                                                                        $0000000101024308

                                                                                                                                                                                                         0 lines of source assembled in 2 pa
ss

i compiled this source code:

program Test;

{$librarypath '../../../../retro/madPascal/blibs/'}
{$librarypath '../../../../retro/madPascal/base/'}
{$librarypath '../../../../retro/madPascal/lib/'}

uses crt, joystick, atari, b_system, b_utils, b_crt, sysutils, rmt, graph, image;

type
    Location = object
      Name: string[16];
      constructor Init(In_Name: string[16]);
      procedure Show;
    end;

    constructor Location.Init(In_Name: string[16]);
    begin
      Name := In_Name;
    end;

    procedure Location.Show;
    begin
      CRT_Clear;
      CRT_WriteCentered(2, Name);
      WriteLn('This message is from the vehicle.');
    end;

var NicePlace : Location;

begin
  move(pointer($e000),pointer($8000),1024);
  SystemOff;
  SetCharset($80);

  CRT_Init;
  NicePlace.Init('hi there');
  NicePlace.Show();
end.

using mp test.pas -o test.a65 -ipath:../../Mad-Pascal-master/lib -code:0c00

The error is gone, when I remove the brackets around the Show function:

  NicePlace.Show;

Looks like a bug to me?

tebe6502 commented 11 months ago

fixed