Question about memory management in MSX1

Page 1/2
| 2

By Juan Luis

Expert (100)

Juan Luis's picture

07-12-2019, 09:31

I have read documentation about memory management in MSX and I could see that MSX2 has the ports 0xFC, 0xFD and 0xFE for selecting segments in Page 0, 1 and 2. It's also possible to select segments by extended BIOS routines.

The question is: how can I change the segment selected for a slot/subslot in MSX1 if MSX1 doesn't have above ports and it doesn't have extended BIOS? I guess that MSX1 supports memory expansion and this memory has to be managed in any way.

Login or register to post comments

By gdx

Prophet (3311)

gdx's picture

07-12-2019, 10:13

Extended BIOS routines are installed from some MSX2+ (not all). They can also installed by an external software even on MSX1/2.
https://www.msx.org/wiki/Extended_Bios

Memory Mapper is not present on all MSX2, and only a few new Memory mappers are fully supported on MSX1.

Extended BIOS routines for the Memory Mapper are installed by Nextor or with MU.COM under MSX-DOS1.
https://www.msx.org/downloads/mu-v105-with-manual-translated

By Juan Luis

Expert (100)

Juan Luis's picture

07-12-2019, 10:28

gdx wrote:

Extended BIOS routines are installed from some MSX2+ (not all). They can also installed by an external software even on MSX1/2.
https://www.msx.org/wiki/Extended_Bios

Memory Mapper is not present on all MSX2, and only a few new Memory mappers are fully supported on MSX1.

Extended BIOS routines for the Memory Mapper are installed by Nextor or with MU.COM under MSX-DOS1.
https://www.msx.org/downloads/mu-v105-with-manual-translated

- Can I use extended BIOS if my software is execute from a ROM-cartridge? I have traced the execution of one of my developed ROM cartridge and extended BIOS wasn't present. There was a ret instruction where it should be the routine.
- If the answer is yes, how can I use it?

By gdx

Prophet (3311)

gdx's picture

07-12-2019, 10:44

Juan Luis wrote:

- Can I use extended BIOS if my software is execute from a ROM-cartridge?

I think only if you make a ROM that support disks and only on some MSX2+ and Turbo R.
https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM

By Manuel

Ascended (16116)

Manuel's picture

07-12-2019, 17:17

Does your software require that the MSX has an MSX Memory Mapper? How much RAM does it need?

By Juan Luis

Expert (100)

Juan Luis's picture

07-12-2019, 21:57

Manuel wrote:

Does your software require that the MSX has an MSX Memory Mapper? How much RAM does it need?

I would like to develop games for MSX1 + GFX9000/Video9000 + Moonsound. ASCI16 ROM mapper provides up to 4MB ROM memory. My intention is to develop Real Time Strategy, at least a proof of concept. This kind of games use Pathfinding algorithms that require big quantities of memory for calculating route path. To do this, I need RAM. Z80 is not a powerful CPU so I would need to store as much precalculated information as possible to reduce CPU work. The precalculated information is variable because it would depend on the map.

I know how to assign segments in MSX2 or later by using BIOS and I/O RAM Mapper ports, but I would like the possibility of executing the game on MSX1. I/O Mapper ports don't exist on MSX1, but I have read on msx.org wiki (just a few hours ago) that RAM expansions use to provide I/O RAM Mapper ports, I have done some tests in OpenMSX with Philips 8020 + slotexpander + 4MB RAM cartridge and I was successful, I was able to use I/O RAM Mapper ports for finding the expanded memory.

Thank for the help to everybody.

My unique remaining doubt is how to use Extended BIOS in MSX2 and MSX1 (if the last thing is possible) executing the game from a cartridge. When you start the code from a cartridge Extended BIOS is not still available.

I have a doubt more about OpenMSX, but I'm going to open a new thread for that question.

By zPasi

Champion (494)

zPasi's picture

07-12-2019, 22:50

You can just use the ports 0xFC, 0xFD, 0xFE and 0xFF. You don't need any BIOS for that.

You'll need code to test if a memory mapper is present, and how big it is. There may be more than one mapper, so you'd better test which one is the biggest.

By Manuel

Ascended (16116)

Manuel's picture

07-12-2019, 23:20

The ports are not MSX1 or MSX2 specific. They are just part of the MSX Memory Mapper. If your system has an MSX Memory mapper according to the standard, these ports are used.
The only BIOS thing is that the BIOS of most MSX1 machines, that do not have an MSX Memory Mapper, won't initialize the MSX Memory Mapper. And by default, most of these all have the same bank selected. So the slot with the memory mapper will have 4x the same 16kB of RAM. If the RAM of the MSX1 is in a lower slot, this is not an issue (AFAIK!), as that RAM will be used as main RAM. But if that memory mapper is selected as main RAM by the BIOS, there's an issue. Anyway, you can indeed check this in openMSX, this situation should behave like (most) real hardware.

By Juan Luis

Expert (100)

Juan Luis's picture

07-12-2019, 23:42

zPasi wrote:

You can just use the ports 0xFC, 0xFD, 0xFE and 0xFF. You don't need any BIOS for that.

You'll need code to test if a memory mapper is present, and how big it is. There may be more than one mapper, so you'd better test which one is the biggest.

It's true. I have tested the IO RAM mapper ports that you mention and this works fine even in MSX1 because RAM expansion provides theese ports.

I would like to use BIOS because it's easier to manage memory with BIOS routines but I see that this is not possible if my code is executed from cartridge, so I'll use IO ports directly. It's not so complex either.

Thanks.

By Juan Luis

Expert (100)

Juan Luis's picture

07-12-2019, 23:44

Thanks for the help. I think I have enough information with all the provided comments.

Thanks to everybody.

By gdx

Prophet (3311)

gdx's picture

08-12-2019, 09:49

You can use an DSK image formatted MSX-DOS1 and use MU.COM, then convert it to ROM using DSK2ROM.
Otherwise you can use an MegaSRAM SCC and one of images below (even the one with MSX-DOS2) to make your ROM.
http://msx.org/downloads/esedos4m
But i think the result will probably be better if you can manage the memory mapper directly from the ROM. (Boot will be faster and less greedy in memory.)

Page 1/2
| 2