good work, gdx
The principe is simple but easy to make a mistake.
I just replaced ld a,e
by ld a,b
.
I hope it is correct now.
gdx, I'm confused ...
The code you posted just select RAM in P0, or does it search for it also ?
I must say I'm amazed at the length and complexity of the code needed to simply switch RAM in a page.
You would have thought that this simple task was easier to do in a standardized system such as the MSX.
But then again, I never really understood how slot management was working ...
If you do not overwrite the RAM space allocated to the BIOS, the sub-slot information is directly accessible to the SLTTBL addresses. So there is no need to change the slot on page 3 to read this information.
Yes, this is a trick I don't use yet in MSXgl. It's part of the optimizations I will add because even if I want the library to be BIOS independent, when starting a program, it doesn't make much sense not to use the information already present in RAM.
The RAM search routine is on the Wiki page I linked above. To make a program in ROM that accesses the RAM on all the pages, it is necessary to know the slots of the RAM to be able to access them.
The routine works bit by bit so the program becomes long. It's the essence of machine language. It's fast but the programs are long. In addition, it is amplified by the method used on MSX to select the slots. As I always say, the slots were the advantage and at the same time the defect of the MSXs.
If you do not overwrite the RAM space allocated to the BIOS, the sub-slot information is directly accessible to the SLTTBL addresses. So there is no need to change the slot on page 3 to read this information.
Yes, this is a trick I don't use yet in MSXgl.
Yes, it is sometimes advantageous to use that and ASCII recommends it but you still have to change slots on page 3 to access the secondary slots.
I did some experiment recently to have ram in page0 on my Turrican project, so I have the code ready. I won't use it (because I want Turrican to be compatible with all MSXes and 16KB machines don't have ram in page0) but it works, so if you want I can send it