S65-Display/Display3000

Stack underflow?

  • 1
  • 2
  • 3
  • 5
  • 6
  • 7
  • Page 1 of 7
wilbo
Benutzer
Avatar
Gender:
Age: 68
Posts: 35
Registered: 11 / 2023
Subject:

S65-Display/Display3000

 · 
Posted: 13.04.2024 - 15:27  ·  #1
Hallo,
im folgendem Program bekomme ich einen Stack underflow error im Simulator den ich mir nicht erklären kann.
Ich hoffe das liegt an mir.
Der Error kommt in drt Procedure Letter

Code
Program Test;
{$WG}                      {global Warnings on}

Device = mega128, VCC = 3.3;
{ $BOOTRST $0F000}         {Reset Jump to $0F000}

Define_fuses
//  Override_Fuses;
  NoteBook   = A;
  Supply     = 5.0, 100;
  LockBits0  = [];
  FuseBits0  = [];
  FuseBits1  = [SPIEN, JTAGEN, OCDEN];
  FuseBits2  = [];
  FuseBits3  = [];
  FuseBits4  = [];
  FuseBits5  = [];
  FuseBits6  = [];
  FuseBits7  = [];

Import SysTick;

From System Import;


Define
  ProcClock      = 16000000;       {Hertz}
  SysTick        = 10;             {msec}
  StackSize      = $0064, iData;
  FrameSize      = $0064, iData;

Implementation

{$IDATA}

{--------------------------------------------------------------}
{ Type Declarations }

Type

  TCharArr       = Array[0..7] Of Byte;
{--------------------------------------------------------------}
{ Const Declarations }
Const
  Charset : TCharArr = ($00, $0A, $1F, $0A, $0A, $1F, $0A, $00);      //#

{--------------------------------------------------------------}
{ Const Declarations }

{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
Var
  GX, GY : Byte;

{--------------------------------------------------------------}
{ functions }

Procedure Letter(X : Byte; Y : Byte; VG : Word; HG : Word);
Var
  Z   : Byte;
Begin
  Z := 0;
  For GY := 0 To 6 Do
    For GX := 0 To 7 Do
      If Bit(Charset[GY], GX) Then
        //Lcd_Plot(X + Z, Y + GY, VG);
      Else
        //Lcd_Plot(X + Z, Y + GY, HG);
      Endif;
    Endfor;
    Z := Z + 1;
  Endfor;
  //LCD_Window(0, 0, Window_Width - 1, Window_Height - 1);
End;

Begin
  Letter(10, 10, 0, 0);
End.
Test;


[Edit] Titel geändert und verschoben
You must be logged in or your permissions are to low to see this Attachment(s).
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1415
Registered: 03 / 2005
Subject:

Re: Stack underflow?

 · 
Posted: 13.04.2024 - 20:13  ·  #2
Can you please provide your asm file as well?

Thank you.
wilbo
Benutzer
Avatar
Gender:
Age: 68
Posts: 35
Registered: 11 / 2023
Subject:

Re: Stack underflow?

 · 
Posted: 13.04.2024 - 20:28  ·  #3
Hallo Merlin,
vielen dank für dein schnelle Reaktion
anbei das asm .file
You must be logged in or your permissions are to low to see this Attachment(s).
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1415
Registered: 03 / 2005
Subject:

Re: Stack underflow?

 · 
Posted: 14.04.2024 - 16:10  ·  #4
Hi Wilbo.

There is indeed a stack underflow. It is not as a result of your code. There is not an obvious cause.

Please zip up your entire directory (including project file etc.) and I will debug it here. You can send zip via pm if you prefer.

Regards.
wilbo
Benutzer
Avatar
Gender:
Age: 68
Posts: 35
Registered: 11 / 2023
Subject:

Re: Stack underflow?

 · 
Posted: 14.04.2024 - 18:36  ·  #5
Hi Merlin,

anbei das Test Projekt. Ich hoffe es macht dir nicht soviel Mühe. Ich kann auch gerne das gesamte Projekt senden wo mir der Fehler aufgefallen ist zukommen lassen.
Gruß Wilbo

Hi Merlin,

Enclosed is the test project. I hope it doesn't cause you too much trouble. I can also send you the entire project where I noticed the error.
Greetings Wilbo
You must be logged in or your permissions are to low to see this Attachment(s).
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1415
Registered: 03 / 2005
Subject:

Re: Stack underflow?

 · 
Posted: 14.04.2024 - 19:11  ·  #6
Thank you Wilbo. This should be sufficient.

Vielen Dank, Wilbo. Das sollte ausreichen.
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1415
Registered: 03 / 2005
Subject:

Re: Stack underflow?

 · 
Posted: 15.04.2024 - 10:33  ·  #7
Hi Wilbo.

Please find attached a fix for your problem which is specifically an issue with 'bit'.

@ALL

This is a very long standing issue in a complex part of the compiler dealing with several situations. I have tried to make sure that the fix does not interfere with other situations but I would encourage everyone who uses the 'Bit' function to download and test that this fix does not cause any issues in their projects. Please remember that this is now a community project.

I was about to release a new version but will now wait for feed-back.

------------------------------------------------------------------------------------------------------

Hallo Wilbo.

Anbei finden Sie eine Lösung für Ihr Problem, das speziell ein Problem mit 'bit' ist.

@ALL

Es handelt sich um ein seit langem bestehendes Problem in einem komplexen Teil des Compilers, der mit verschiedenen Situationen zu tun hat. Ich habe versucht, dafür zu sorgen, dass der Fix keine anderen Situationen beeinträchtigt, aber ich möchte jeden, der die 'Bit'-Funktion verwendet, dazu ermutigen, diesen Fix herunterzuladen und zu testen, dass er keine Probleme in seinen Projekten verursacht. Bitte denken Sie daran, dass dies jetzt ein Gemeinschaftsprojekt ist.

Ich war kurz davor, eine neue Version zu veröffentlichen, werde aber jetzt auf Rückmeldungen warten.

Übersetzt mit DeepL.com (kostenlose Version)

See later for attachment.
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1415
Registered: 03 / 2005
Subject:

Re: Stack underflow?

 · 
Posted: 15.04.2024 - 10:57  ·  #8
BTW Wilbo, I would strongly recommend that you use local variables for 'for' loops, particularly if you are using the optimiser as they are much faster and consume less code (if optimised).
  • 1
  • 2
  • 3
  • 5
  • 6
  • 7
  • Page 1 of 7
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   136   150 · Page-Gen-Time: 0.032823s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI