MTX BASIC Variables

Everything about programming, including VDP and Sound programming.
Post Reply
Bill B
Posts: 593
Joined: 26 Jan 2014 16:31

MTX BASIC Variables

Post by Bill B »

I have been trying to understand exactly where and how MTX BASIC stores the values of its variables in memory. As far as I know this has not been fully documented (Dave will undoubtedly correct me if I am wrong).

The attached document records what I have concluded so far. Paul Daniels has obviously done a lot of work on this, and much of what I describe has been deduced from reverse engineering his MTX2BAS program (downloaded from Andy's site). However I have extended this a bit with a description of the MTX 24 bit virtual addressing, and a few potentially useful ROM entry points.

Any corrections, comments or suggestions welcome. My thanks to Paul for MTX2BAS and appologies for any errors in my understanding of how it works.

Bill.
Attachments
MTX_Variables.pdf
(36.96 KiB) Downloaded 475 times
User avatar
Dave
Posts: 1280
Joined: 11 Aug 2012 18:16
Contact:

Re: MTX BASIC Variables

Post by Dave »

Bill B wrote:As far as I know this has not been fully documented (Dave will undoubtedly correct me if I am wrong).
Bill.
No correction required :-)

I have not seen that documented either - very interesting reading, as you suggest, Paul would seem to be the ideal person to comment,

regards
Dave
User avatar
thewiz
Posts: 137
Joined: 12 Aug 2012 16:08

Re: MTX BASIC Variables

Post by thewiz »

Hi Bill,

Only just seen this. Had a quick look at the doc and the 24bit addressing stuff I've not seen described before so thanks for that.

I'll have a good read of this and come back to to but a couple of points:

Arrays are stored straight after BASIC.

Strings are defined as 64 byte arrays I think.

Non-Arrays are stored at $C000 onwards.

When using mtx2bas, there is an option that prints out variable debugging information. Did you try that?

Strings are defined as 64 byte arrays I think.

Regards
THIS is what Memotech is doing now.
Bill B
Posts: 593
Joined: 26 Jan 2014 16:31

Re: MTX BASIC Variables

Post by Bill B »

The variable name table and variable values table are both in high memory above 0xC000 and so are restricted to less than 16KB in total (the system variables etc. are also in high memory). This could be a limitation in some cases.

The "virtual memory" contains in order:

BASIC Listing
NODDY pages
Array data

On a MTX which has the maximum amount of RAM available when in ROM mode, this could occupy 496KB, plus a bit more if the last page overflows into high memory. Plenty of room for a large program or big arrays. Unfortunately the 512KB in my SDX is only available in CP/M mode and is not accessible in ROM mode.

Strings default to 64 characters if not dimensioned, but even non-array strings can be dimensioned to different sizes.

Yes, I used the debug information in MTX2BAS to help my understanding of how the memory is organised. There is still a lot more information that could be gained from this source as to how BASIC programs are stored in memory (particularly ASSEM blocks), and how NODDY pages are stored.
Bill B
Posts: 593
Joined: 26 Jan 2014 16:31

Re: MTX BASIC Variables

Post by Bill B »

Dave,

Feel free to post this on your site if you wish, It is probably more findable there long term.

Either post my PDF or turn it into a web page. Drop me an email if you want the editable version (Libre Office or I can save it as Word).

Bill.
User avatar
Dave
Posts: 1280
Joined: 11 Aug 2012 18:16
Contact:

Re: MTX BASIC Variables

Post by Dave »

Hi Bill,

OK, thanks, will do,

Regards
Dave
User avatar
Dave
Posts: 1280
Joined: 11 Aug 2012 18:16
Contact:

Re: MTX BASIC Variables

Post by Dave »

The file is now available as a web page, here

http://www.primrosebank.net/computers/m ... c_vars.htm

regards
Dave
Post Reply