Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Micromite MMBasic Ver 5.04.10 Beta Post ReplyPost New Topic
<< Prev Page of 4
Author
Message << Prev Topic | Next Topic >>
disco4now
Senior Member
Senior Member


Joined: 18 December 2014
Location: Australia
Online Status: Offline
Posts: 281
Posted: 11 October 2018 at 8:20pm | IP Logged Quote disco4now

out of memory errors when a string was passed to a SUB or FUNCTION
An error fixed in 5.04.08 now appears in 5.04.09 and 5.04.10 Beta9
with MX170 chip.


Change log for Micromite MMBasic Ver 5.04.08  

Bug Fixes:                                            

      * Corrected a bug which caused EXIT DO to skip the first line after the LOOP command.  

      * Corrected a bug which caused EXIT FOR to fail if the whole FOR loop was on a single line  
        (with colons as command separators).  

    * Fixed a bug which could cause out of memory errors when a string was passed to a SUB or  FUNCTION.  


The code below loops forever on 5.04.08
Running on 5.04.09 or 5.04.10 beta9 it fails with Error: Not enough memory
on the third iteration of the loop


Quote:
Option Explicit
DIM STRING cleartext
DIM integer gain1(4)=(257,247,225,180,22)
DIM integer x

do
x=x+
1
DisplayValue
300,134,"CH1 "+str$(gain1(0))+" "+str$(gain1(1))+" "+str$(gain1(2))+" "+str$(gain1(3))+" "+str$(gain1(4))
print x
loop

SUB DisplayValue x As integer, y As integer, s As STRING
'TEXT x,y,cleartext,CM,fStandard,,RGB(blue),RGB(blue)
'TEXT x,y,s,CM,fStandard,,RGB(white),cBGnd
cleartext=string$(len(s)," ")
END SUB



The error showed up when I upgraded a larger program, but this code is enough to
reproduce it. An LCD is not required, just an MX170 chip with MMMbasic.

Can someone confirm they get the same thing.

Regards
Gerry





Back to Top View disco4now's Profile Search for other posts by disco4now
 
Vito
Newbie
Newbie


Joined: 11 October 2016
Location: Australia
Online Status: Offline
Posts: 12
Posted: 11 October 2018 at 8:45pm | IP Logged Quote Vito

Yes on version 5.4.1

Something is not freeing RAM after executing SUB.

Place a memory statement after x=x+1 in DO loop, will print whats happening to RAM.

Option Explicit
DIM STRING  cleartext
DIM integer gain1(4)=(257,247,225,180,22)
DIM integer x

do
 x=x+1
 Memory
 DisplayValue 300,134,"CH1 "+str$(gain1(0))+" "+str$(gain1(1))+" "+str$(gain1(2))+" "+str$(gain1(3))+" "+str$(gain1(4))
 print x
loop

SUB DisplayValue x As integer, y As integer, s As STRING
  'TEXT x,y,cleartext,CM,fStandard,,RGB(blue),RGB(blue)
  'TEXT x,y,s,CM,fStandard,,RGB(white),cBGnd
  cleartext=string$(len(s)," ")
END SUB
Back to Top View Vito's Profile Search for other posts by Vito
 
disco4now
Senior Member
Senior Member


Joined: 18 December 2014
Location: Australia
Online Status: Offline
Posts: 281
Posted: 14 October 2018 at 4:44pm | IP Logged Quote disco4now

Hi Geoff,

Here is another code snippet that runs OK under 5.04.08 but fails under 5.04.09 and 5.04.10 beta 9.

It is using the longstring Cfunctions.Not sure if it is connected to out of memory error above or something different.

Quote:
' This code run OK on MMbasic 5.04.08 however
'it fails on MMBasic 5.04.09 and 5.04.10 Beta9
CONST longStringMaxLen=4096
option autorun on

dim float htmlBuffer(longStringMaxLen/4)
dim AS INTEGER i

readHTMLTemplate

?
"DONE",mm.ver
end

sub readHTMLTemplate
LOCAL string A(16)
for i= 1 to 16
A(i)=
string$(254,"X")
next i

SClear htmlBuffer()

for i = 1 to 16
? i,
" - ";
pause 1000
SAddStr htmlBuffer(), A(i)
? SLen(htmlBuffer())
next i
end sub

CSub SAddStr float, string
00000000
10800011 00000000 10A0000F 00000000 90A30000 8C820000 00623021 1060000A
AC860000
24420004 00822021 24A50001 00831821 90A20000 A0820000 24840001
1483FFFC 24A50001 03E00008 00000000
end CSub

CSub SClear float
00000000 54800001 AC800000 03E00008 00000000
end CSub

CFunction SLen (float) INTEGER
00000000
10800005 00003821 8C860000 00C01021 03E00008 00E01821 00003021 00C01021
03E00008 00E01821
end CFunction





It gives the following error

> RUN
 1      -  254
 2      -  508
 3      -  762
 4      -

CPU exception #6 (bus error on ifetch) at address 0x58585858
Processor restarted


It originally came to light here

Regards
Gerry




Edited by disco4now on 14 October 2018 at 4:45pm
Back to Top View disco4now's Profile Search for other posts by disco4now
 


If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
<< Prev Page of 4
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1875 seconds.
Privacy Policy     Process times : 0.02, 0, 0, 0.17