MSX and memory

Página 1/2
| 2

Por freedom711

Rookie (27)

Imagen del freedom711

05-07-2021, 22:04

hello to everyone...

I am new to the msx world...

I use OpenMsx and emulate a Sony HB-f900

I read that it has 128k ram and 128 vram

Why does it tell me that there are only 23431 bytes free?
How does msx manage memory?

Thanks for the answer...

Login sesión o register para postear comentarios

Por rolandve

Master (254)

Imagen del rolandve

05-07-2021, 22:19

It depends on your definition of powerful. All MSX 2+ machines have the same muscle (Z80). 512KB memory can be added through a Carnivore2 or a Multi Functional SCC+ card.

Por freedom711

Rookie (27)

Imagen del freedom711

05-07-2021, 22:23

sorry I changed the question....

Por Grauw

Ascended (10001)

Imagen del Grauw

06-07-2021, 00:15

The Z80 has 64K of addressable space as a basis, like most 8-bit processors. The standard MSX memory lay-out is that the first 16K is used for the BIOS, the second 16K is used for the MSX-BASIC interpreter, and the last 32K is RAM, of which the top 3K is used for various system variables, and if a disk drive is attached, 6K more for the various data and code for disk operation. The rest of the RAM is available to the program, which is that 23431 bytes free you see in MSX-BASIC.

To get beyond that 64K you need to employ a mechanism called banking. You partition that 64K into blocks (let’s say four blocks of 16K each), and then swap those out as needed. Since the onset the MSX has the slots banking mechanism which allowed for extendibility but also has limitations. Then games started to employ megaROM mappers, and finally memory mappers for RAM expansions greater than 64K were introduced. The 128K RAM is provided using a memory mapper.

The problem with banking mechanisms is that at the core the Z80 is still a processor with only 64K of addressable memory. The banking gets around it, but also introduces complexity. The BIOS, the MSX-BASIC interpreter and the system memory must always stay accessible, so this means in the 64K space you only have a 16K block of BASIC program memory that can be changed.

But during the execution, different parts of the BASIC program need to be accessed, which means you constantly need to swap out what is visible in that 16K region of memory. When reading program data sequentially, you need to introduce checks to switch banks if you exceed the 16K region that is available. When reading data randomly, you need to constantly switch banks. And if you need things located in different banks of memory at the same time, things get even more complicated.

So as you can imagine, even though a single bank switch is quick, the overhead of switching those banks all the time can add up quickly if you’re not careful. The MSX-BASIC interpreter was written before the memory mapping mechanism was created, so this would mean a major rewrite of it to support the memory mapped memory, and it would likely run more slowly. This is why the MSX-BASIC interpreter does not support it at all outside of being able to use it as a RAM disk.

The full amount of memory is mostly usable for finely tuned assembly programs which have more flexibility to use the extra memory in an efficient way and avoid bank switches when they can. Though even then it can be quite cumbersome to work with, I’m certainly jealous of those 16-bit processors like the 68000 sometimes, which can address much more than 64K without the need for banking.

Lastly, about the video RAM, this is a whole other story as it holds graphics data and not program data. The amount shown in MSX-BASIC only concerns the memory available for program data.

These concepts also apply to most other 8-bit systems, and even sometimes in 16-bit systems.

Por Manuel

Ascended (18067)

Imagen del Manuel

06-07-2021, 00:04

So, the 23431 bytes are free for BASIC programs. Luckily, MSX-BASIC stores the program in tokenized from in memory, which means it is relatively compact.

You could have asked this question in 1985 as well, and in fact, many people did. Most of the magazines that cover the first 128kB RAM MSX2 machines in Europe cover exactly this question Smile

In fact, I'd suggest to ask the moderators to remove 'Open Msx' from the topic, as it's totally unrelated.

Por freedom711

Rookie (27)

Imagen del freedom711

06-07-2021, 10:04

Hi

I agree openmsx should be deleted....

Por freedom711

Rookie (27)

Imagen del freedom711

06-07-2021, 10:03

Hi

Thank you very much for the explanation....

Por Meits

Scribe (6430)

Imagen del Meits

06-07-2021, 11:51

How would you like the topic to be titled?

Por freedom711

Rookie (27)

Imagen del freedom711

08-07-2021, 12:25

Sorry for the wait ....
Decide you... I am not expert Msx Computer.

Smile

Por Micha

Resident (34)

Imagen del Micha

08-07-2021, 13:58

Does someone know why most MSX1's came with 64k RAM ? Almost no program, game or basic uses the first 32k of RAM, so to me it would sound totally logical to produce a machine with 32k of ROM, 32k of RAM and 16K of VRAM. Remember, memory was expensive in the early 80's.
Was it just marketing (better or same specs as the c64) ? Or were there other reasons ?

Por NYYRIKKI

Enlighted (5836)

Imagen del NYYRIKKI

08-07-2021, 14:43

Micha wrote:

Does someone know why most MSX1's came with 64k RAM ? Almost no program, game or basic uses the first 32k of RAM, so to me it would sound totally logical to produce a machine with 32k of ROM, 32k of RAM and 16K of VRAM. Remember, memory was expensive in the early 80's.
Was it just marketing (better or same specs as the c64) ? Or were there other reasons ?

Well... For BASIC and cartridge games this is true... More than 32k of RAM is very rarely used. For commercial grade cassette games how ever 48k was often needed if not full 64k. Naturally also MSX-DOS or CP/M also needs 64k, but disk drives were relatively rare especially on early days. I think how ever that many people were anyway interested about possibility to upgrade the computer with disk drive once the prices go down. I think plenty of the reason is indeed that people did not know very much about computers, but they surely did know that "80k RAM is much better than 48k or 64k", so people were sold what people wanted... You can just as well argue today that people rarely really need 64GB memory sticks for their every day use as most of the time they put something like 8GB OS image to it, but yet those are the ones that are flying off the shelves.

Página 1/2
| 2