System work area wasted in Basic usable for others

By DarkSchneider

Paladin (965)

DarkSchneider's picture

23-07-2017, 09:07

I am looking for all that space in valuable system work area in page 3 wated in Basic that could be usable for others.
Here the reference:
http://www.konamiman.com/msx/msx2th/th-ap.txt

Search by (copy and paste):
* Work used by BASIC internally

Quickly we get 2 large areas, F41FH and F55EH (this one is used by MSX-Audio BIOS, that gave me the idea to find all the usable space).

I currently have made a temporary list with candidates, behold (address, space):
F39A, 20.
F41F, 318.
F55E, 258.
F66A, 8.
F6CA, 26.
F6E8, 100.
F750, 100.
F7C5, math pack. Do not use if you use the math pack.
F87F, 160. Basic F keys text.
F931, Basic circle, paint, Play. Can use all the space in a row.

Not tested but it would be nice to try if Basic space is initialized at BIOS start, and then some areas could not be used (only data space but not related with execution could be used), or at Basic start itself, and then the whole area assigned to basic could be used, from F414H, with care of the math pack area if using it.
A quick test could be modify the F keys text (F87F) area from DOS and then return to Basic. If it shows correctly, then probably is initialized at Basic start. Another one good candidate, and that should be tested in any case I think, are the ON xxx GOSUB ones, because if they are modified and kept when returning to Basic, a system freeze is much possible.

Login or register to post comments

By DarkSchneider

Paladin (965)

DarkSchneider's picture

23-07-2017, 11:46

Indeed, if we ignore the F55DH one (with initial value "," that could be easily restored) we have a good contiguous segment. Interesting using the F4F4H initial value we have 364 bytes to put our interrupt IM2 routine there (if not using MSX-Audio). Or F9B4H for MSX-Music BIOS work area. It says "The FM BIOS uses 160 bytes as the work area, and 32 bytes as the stack area" so not sure if those 32 bytes must be added to work area, if not then use FA54H for 160 bytes at the end of the PLAY area, that is the end assigned to Basic.
And many more useful uses.

By ricbit

Champion (438)

ricbit's picture

23-07-2017, 20:47

I needed some page-3 space when writing Aleste 2 ROM, so what I did was just write a tcl script for openmsx which logged all addresses that were used:

https://github.com/ricbit/aleste2/blob/master/find_unused_ra...

After finishing the game with this setup, I was absolutely sure of what hasn't been touched by the game or the bios.