Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:44 12 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : code OK in MMDOS 5.04.08; 5.04.09 fails

Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3467
Posted: 01:27pm 20 Oct 2018
Copy link to clipboard 
Print this post

The code below, sent to me by Paul_L, runs on his PC with 5.04.08. On mine, with 5.04.09, it fails with an out of memory error.
[code]
DOS MMBasic Ver 5.04.09
Copyright 2011-2018 Geoff Graham

Program: 4K ( 0%) used 508K free (162 lines)
Variables: 8K (24%) used 23K free (124 variables)
General RAM: 4K ( 0%) used 508K free
[55] dds(Mid$(Date$,4,2)+"/"+Mid$(Date$,1,2)+"/"+Mid$(Date$,7,4)):ddc
Error: Not enough memory
>
[/code]

I inserted the line, "PRINT "" : memory" before the "NEXT it" line to try to see what was happening, and it ran to completion.

[code]
' DataDumpTest.bas

Option EXPLICIT
Option DEFAULT INTEGER
Option BASE 1

Dim i, j, k, L, x, y, in$, PIC, iSimRecNo, st$, it
Dim Hstg, TkTarget, FS, FSo
Dim Xok, XFAIL '@@@@

Dim MANBLR, MODE$="O", KEYSEEK$="UAW1"
Dim UtilStat, GenStat ' for DOS test only
Dim WeM, WeD, SeM, SeD
Dim WeM2, WeD2, SeM2, SeD2
Dim WINTER, oDate$, DOY, FrWgen, FrWgen2, KEYPOINTER
Dim oatStrt, tkStrt, ratio! 'slope settings
Dim oatStrt2, tkStrt2, ratio2!
Dim FGxSensors = 0, FGxUI = 0, FGxDate = 0, FGxFileSetsData = 0

' LB x181010 If MM.Device$ <> "DOS" Then PIC=1 'PL???? PIC is used in many places

' calculated values
Dim SupHt, SubCl, FrGain, TkGain, YdGain, TkBTU, YdBTU


ArrayElementPointers: '=========================================================
Const PydF=1,PtkF=2,PcpF=3,PcpR=4,PydQ=5,PtkQ=6,Pha=7,Pgr=8,Poa=9 'S(n) Z(n)
Const PydR=10,PtkR=11,PtkC=12,PxvF=13,PxvR=14,Putil=15,Pgen=16 'T!(n,?) P(n)
Const Ptmp=1,Perr=2 'T!(?,n)
Const Pwlo=1,Pwhi=2,Pslo=3,Pshi=4 'S(?,n) Z(?,n)
Const Prtc=1, Ploop=2, Pfrho=3,Ppre=4,PflSns=5, Pstab=6
Const Ppost=7, PdataSS=8, PdataDU=9 'D(n,?)
Const Pset=1,Psmn=2,Psmx=3,Pmnlo=4,Pmxhi=5,Pstat=6, PEnd=7 'D(?,n)
Const Pfc=1,Pfrr=2,Pydp=3,Pjp=4,Pahp=5,Pgas=6,Pnav=7 'O(n,?),OPS(n)
Const Ppin=1,Pnow=2,Pneed=3,Pprob=4,Pposs=5,PtOn=6 'O(?,n)
Const PtOff=7,PttOn=8,PttOff=9 'O(?,n)

DimArrays: '====================================================================
' settings temp in pins delays status out pins trips
Const kSx=9,kSy=4, kTx=16,kTy=2, kPx=17, kDx=9,kDy=7, kOx=7,kOy=9, kZx=6,kZy=4
Dim S(kSx,kSy), T!(kTx,kTy), P(kPx), D(kDx,kDy), O(kOx,kOy), Z(kZx,kZy)

Open "GEOdump.csv" For output As #2
Restore DDdata
For x=1 To 14
Read st$:Print #2,st$;
Next x
Print #2,""
memory

for it=1 to 30 ' 30
'dds(Mid$(Date$,7,4)+Mid$(Date$,4,2)+Mid$(Date$,1,2)):ddc
'dds(Mid$(Date$,4,2)+Mid$(Date$,1,2)+Mid$(Date$,7,4)):ddc
'dds(Date$):ddc
dds(Mid$(Date$,4,2)+"/"+Mid$(Date$,1,2)+"/"+Mid$(Date$,7,4)):ddc
dds(Time$):ddc:dd(NOW()):dds(MODE$):ddc:dd(MANBLR,1)
dds(KEYSEEK$):ddc:dd(KEYPOINTER,2)
For i=1 To 7
DD(O(i,Pposs),1)
Next i
dd(SupHt,5)
dd(SubCl,5)
dd(FrGain,5)
dd(TkGain,5)
dd(YdGain,5)
dd(TkBTU,5)
dd(YdBTU,5)
For x=1 To kTx '16 ydF to gen
dd(T!(x,Ptmp),3,1)
Next x '16 nnn.n
For x=1 To 7 'RtcStat to PostEnd
For y=6 To 7
dd(D(x,y),7)
Next y
Next x '7 of 9
dd(FS,2)
for x=1 to kZx '6 TRydF to TRtkQ
for y=1 to kZy '4
dd(Z(x,y),1)
Next y '4
next x '6
For x=1 To kOx '7 FRCnnpp to NAVnnpp
For y=2 To 5
dd(O(x,y),1)
Next y
For y=6 To 9
dd(O(x,y),6)
Next y
Next x
Print #2
' print "" : memory
next it
Close #2
print "" : memory
End

DDdata:
Data "Date ,Time ,Timer ,M,B,SEEK,KP,F,R,Y,J,A,G,N,"
Data "supHt,subCl,FGain,TGain,YGain,TkBTU,YdBTU,"
Data " ydF, tkF, cpF, cpR, ydQ, tkQ, hall, grnd,"
Data " oat, ydR, tkR, tkC, xvF, xvR, util, gen,"
Data "RtcStat, RtcEnd,LoopStt,LoopEnd,FrHoStt,FrHoEnd,PreStat,"
Data " PreEnd,FlowStt,FlowEnd,StabStt,StabEnd,PostStt,PostEnd,"
Data "FS,TRydF,,,,TRtkF,,,,TRcpF,,,,TRcpR,,,,TRydQ,,,,TRtkQ,,,,"
Data "FRCnnpp,,,, on, off, t on, t off,"
Data "YDPnnpp,,,, on, off, t on, t off,"
Data "FRRnnpp,,,, on, off, t on, t off,"
Data " JPnnpp,,,, on, off, t on, t off,"
Data "AHPnnpp,,,, on, off, t on, t off,"
Data "GASnnpp,,,, on, off, t on, t off,"
Data "NAVnnpp,,,, on, off, t on, t off,"

Sub dd(v,m,n,c$)
If m=0 Then m=3
If n=0 Then n=0
If c$="" Then c$="0"
Print #2, Str$(v,m,n,c$)+",";
End Sub 'dd(n)

Sub dds(ss$)
Print #2, ss$;
End Sub 'dds(ss$)

Sub ddx
Print #2, "/";
End Sub 'ddx

Sub ddc
Print #2, ",";
End Sub 'ddc

Function NOW() '^seconds since 1/1/2018 using date$ dd-mm-yyyy & time$ hh:mm:ss
Local n.yr,n.mo,n.da,n.hr,n.mn,n.s,y,n.doy,n.t.da,n.t.hr,n.t.mn,n.t.s
n.yr=Val(Mid$(Date$,7,4)):n.mo=Val(Mid$(Date$,4,2)):n.da=Val(Mid$(Date$,1,2))
n.hr=Val(Mid$(Time$,1,2)):n.mn=Val(Mid$(Time$,4,2)):n.s=Val(Mid$(Time$,7,2))
For y=2018 To n.yr-1
n.doy=DoYi(y,12,31):n.t.da=n.t.da+n.doy
Next y
n.doy=DoYi(n.yr,n.mo,n.da)
n.t.da=n.t.da+n.doy
n.t.hr=(n.t.da*24)+n.hr
n.t.mn=(n.t.hr*60)+n.mn
NOW=(n.t.mn*60)+n.s
End Function 'NOW()

Function DoYi(DoYiy%,DoYim%,DoYid%)
DoYi= DoYid% + Int((DoYim%-1)*30.57+0.5)
If DoYim%>2 Then
DoYi=DoYi-1
If (DoYiy% Mod 4)>0 Then DoYi = DoYi-1 'not leap year
If (DoYiy% Mod 100)=0 Then DoYi = DoYi-1 'not leap century
If (DoYiy% Mod 400)=0 Then DoYi = DoYi+1 'leap 4th century
EndIf
End Function 'DoYi(DoYy%,DoYm%,DoYd%)

Function DoYset(DoYd$)
Local DoYsd,DoYsm,DoYsy
DoYsd=Val(Mid$(DoYd$,1,2))
DoYsm=Val(Mid$(DoYd$,4,2))
DoYsy=Val(Mid$(DoYd$,7,4))
DoYset=DoYi(DoYsy,DoYsm,DoYsd)
End Function 'DoYset(DoYsd$)
[/code]


PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 07:30pm 20 Oct 2018
Copy link to clipboard 
Print this post

Yep Lance, it runs to completion here with or without the extra print command.

Things that make you go hmmmmmm ....

Paul in NY


DOS MMBasic Ver 5.04.08
Copyright 2011-2017 Geoff Graham

> load "datadumptest.bas"
> RUN

Program: 4K ( 0%) used 508K free (161 lines)
Variables: 8K (24%) used 23K free (124 variables)
General RAM: 4K ( 0%) used 508K free
>
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 05:17am 26 Oct 2018
Copy link to clipboard 
Print this post

I have tracked this one down and reported the solution in this thread: https://www.thebackshed.com/forum/forum_posts.asp?TID=10720&PN=1&get=last#126794
Geoff Graham - http://geoffg.net
 
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 07:49am 26 Oct 2018
Copy link to clipboard 
Print this post

Brilliant work Geoff!

Paul in NY
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025