Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:37 25 Nov 2024 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 : out of general memory

Author Message
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 06:20am 10 Feb 2012
Copy link to clipboard 
Print this post

Hi all,

I'm trying to convert a Tandy Colour Computer programme for use with the Maximite, but I'm running into memory problems.
The line that barfs is:


130 DIM VM$(110,1),A$(80),R1$(17),R3$(34),R4$(23),R5$(24),R6$(13)


The programme is called VARMAP.BAS. Those of you from Coco backgrounds may remember it.
It prints all the variables used in your programme and shows the line numbers where they are found.

Now, a Colour computer has just ~24K memory free when no programme is loaded, so I can't understand why the maximite can't handle this when it's got ~37K with the programme loaded.

Anyone got any clues?

Regards,
Bob Devries
Dalby, QLD, Australia
 
djuqa

Guru

Joined: 23/11/2011
Location: Australia
Posts: 447
Posted: 06:34am 10 Feb 2012
Copy link to clipboard 
Print this post

maybe those dim statements needing re-thinking?
they will use 80k of memory if each string element is reserved 256bytes

Maybe Use a data file to store the accumulated values
Edited by djuqa 2012-02-11
VK4MU MicroController Units

 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 07:46am 10 Feb 2012
Copy link to clipboard 
Print this post

But.....

The programme works in a Tandy computer with less than 32K free RAM!

Why not on the Maximite?

Regards,

Bob Devries
Dalby, QLD, Australia
 
djuqa

Guru

Joined: 23/11/2011
Location: Australia
Posts: 447
Posted: 07:58am 10 Feb 2012
Copy link to clipboard 
Print this post

Different size string Variable at a guess.
With the speed available on MM parsing thru the BASIC File and printing the accumulated data at the end of program maybe option
VK4MU MicroController Units

 
MM_Wombat
Senior Member

Joined: 12/12/2011
Location: Australia
Posts: 139
Posted: 08:02am 11 Feb 2012
Copy link to clipboard 
Print this post

I had the same problem when I wrote Maxifont. Geoff G wrote

  Quote  
Each element in a number array uses 4 bytes. So, dim plot(4,100,30) would use up about 47KB which is more than the space available for arrays (which from memory is about 37KB). Moving to option base 1 would reduce your memory consumption a bit but still not enough to fit in.

A floating point number can be used to hold quite a large integer which you could pull apart into individual bits. For example you should be able to store 16 bits in each floating point number but manipulating the bits in BASIC would be tedious (you would use AND and OR which do bitwise manipulation).

I would suggest using strings. If you declared an array of strings like: dim str$(64) then each string could be one row (or line). Each element in a string array uses 256 bytes so by doing that you would use only 16KB of general memory. If you used the convention of X as a pixel and space as no pixel writing out the font would be as simple as looping through the array doing PRINT #1, str$(loopcntr)


Hope this helps

mm_wombat
Keep plugging away, it is fun learning
But can be expensive (if you keep blowing things up).

Maximite, ColourMaximite, MM+
 
Olimex
Senior Member

Joined: 02/10/2011
Location: Bulgaria
Posts: 226
Posted: 10:25am 11 Feb 2012
Copy link to clipboard 
Print this post

  BobDevries said   But.....

The programme works in a Tandy computer with less than 32K free RAM!

Why not on the Maximite?

Regards,


probably the Tandy computer BASIC use dynamic string sizes.
it's always trade off between speed and memory.
if you use fixed size 256 bytes per string you waste memory but increase the speed, if you use dynamic string sizes you have to move lot of memory blocks each time you access strings so this will decrease the memory usage but lower the speed
 
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 08:55pm 12 Feb 2012
Copy link to clipboard 
Print this post

The Maximite deals with 32-bit numbers only in arrays so I'd probably say that was the case. As the Tandy was 8 or 16-bits (can't remember which) it probably used that size for each cell in the array, hence why it works on the Tandy and not on the Maximite.
Capacitance is futile - roll on 2012!
 
Print this page


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

© JAQ Software 2024