Switching RAM in page 0 on MSX2

Pagina 1/3
| 2 | 3

Door Metalion

Paragon (1628)

afbeelding van Metalion

17-06-2022, 20:57

Hi everyone,

You can be sure that I searched ... But I was unable to find a definitive snippet of code to do it !
I want to switch RAM in page 0 on an MSX2 (from a megarom with an ASCII mapper).
I will write my own ISR on 38h, so don't worry about that bit.

Can someone help me on this ?

Thanks.

Aangemeld of registreer om reacties te plaatsen

Van aoineko

Paragon (1137)

afbeelding van aoineko

17-06-2022, 21:30

I just added this feature to MSXgl recently.
You can look at this file: https://github.com/aoineko-fr/MSXgl/blob/main/engine/src/crt...
Everything happens in INSTALL_RAM_ISR macro with setting page 0 to the same slot as page 3 (the slot with the most RAM found by the BIOS), then copying the ISR to 0038h.

(I am now improving the ISR, hence my question on the other thread ^^)

Van gdx

Enlighted (6431)

afbeelding van gdx

18-06-2022, 01:55

There is a routine in the wiki for a long time.
System with disk:
https://www.msx.org/wiki/How_to_detect_the_RAM
without disk:
https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM#...

Once you have the slot number, it becomes easy to select it.

Van sdsnatcher73

Enlighted (4295)

afbeelding van sdsnatcher73

18-06-2022, 07:05

aoineko wrote:

I just added this feature to MSXgl recently.
You can look at this file: https://github.com/aoineko-fr/MSXgl/blob/main/engine/src/crt...
Everything happens in INSTALL_RAM_ISR macro with setting page 0 to the same slot as page 3 (the slot with the most RAM found by the BIOS), then copying the ISR to 0038h.

(I am now improving the ISR, hence my question on the other thread ^^)

You say it will use the page 3 in the same slot as page 0. But there are quite some MSX’s that:

  1. Have 64kB of RAM but it is split over different (sub)slots.
  2. Have less then 64kB RAM but can have a external RAM cartridge. In many cases these machines have the RAM in slot 0. Effectively these become the same as first category because AFAIK the BIOS won’t select the slot with biggest memory (unlike what you said).

There is a page in the wiki that shows how RAM will be selected on machines in category 2 (but I can’t find it now). I think for compatibility sake it would be better to search for RAM available for use in page 3.

Van Metalion

Paragon (1628)

afbeelding van Metalion

18-06-2022, 09:12

Thank you everyone for your input and links.

I just thought that, alternatively, I might also switch page 0 to a page of the megarom.
That might be easier, since I know already which slot it's in, right ?
Is it possible ?

Van aoineko

Paragon (1137)

afbeelding van aoineko

18-06-2022, 13:05

The most common ROM mappers (ASCII8/16, Konami, SCC) can only act on page 1 and 2.
I don't know one that can interact with page 0.
Unless you want to take advantage of the mirroring and have your ISR at 8038h?

sdsnatcher73 wrote:

Have less then 64kB RAM but can have a external RAM cartridge. In many cases these machines have the RAM in slot 0. Effectively these become the same as first category because AFAIK the BIOS won’t select the slot with biggest memory (unlike what you said).

According to this page (https://www.msx.org/wiki/The_Memory) and other readings, it seems to me that the BIOS boot code already takes care of checking all slots and sub-slots to find the memory block that starts on page 3 and goes the furthest towards page 0.
If a 16K machine has a 64K RAM cartridge inserted at boot time, then it is the cartridge slot that should be selected on page 3, no?
The only case that would not work with my code is if there was a RAM cartridge present on page 0, but not on page 3. This would seem quite strange to me. By the way, I don't know of any RAM extension less than 64K.
Are there really machines with RAM present on page 0 that would not be also present on page 3 in the same slot?

EDIT: Oh... shit -_-, Toshiba HX-52
Ok, let's say it's MSX2 only then. ^^

Van ToriHino

Paladin (925)

afbeelding van ToriHino

18-06-2022, 13:05

The MSX2 Sony F500 first generation also has it's RAM split over two slots.

Van aoineko

Paragon (1137)

afbeelding van aoineko

18-06-2022, 13:07

Argh. :-/
Ok, so let's go to add RAM search in slot 0.

Van MsxKun

Paragon (1134)

afbeelding van MsxKun

18-06-2022, 13:52

So never assume things on MSX Big smile
If a stuff is not documented as ALWAYS mandatory to be/to work in exact way, it can be anything. That's why we have so much fun coding. Running Naked in a Field of Flowers

Van gdx

Enlighted (6431)

afbeelding van gdx

19-06-2022, 01:09

Aoineko wrote:

The most common ROM mappers (ASCII8/16, Konami, SCC) can only act on page 1 and 2.
I don't know one that can interact with page 0.
Unless you want to take advantage of the mirroring and have your ISR at 8038h?

Konami8 and Konami SCC interact with page 0 with mirrors. It's not very annoying to put ISR at 0038h.

Aoineko wrote:

If a 16K machine has a 64K RAM cartridge inserted at boot time, then it is the cartridge slot that should be selected on page 3, no?

No, according the wiki page, this is the RAM in the lower slot that will be selected and it is independently done for each page.

Aoineko wrote:

Ok, so let's go to add RAM search in slot 0.

Also rethink your other slot routines, we have already talked about it before. You have not foreseen all possible cases.

Van Metalion

Paragon (1628)

afbeelding van Metalion

19-06-2022, 18:08

It seems no one have seen my second question, so here it is again:

I just thought that, alternatively, I might also switch page 0 to a page of the megarom.
That might be easier, since I know already which slot it's in, right ?
Is it possible ?

Pagina 1/3
| 2 | 3