ROM starting in page 0 or 3?

Page 1/2
| 2

By aoineko

Champion (485)

aoineko's picture

15-12-2021, 19:17

Hello,

I have always heard that a ROM can only boot in page 1 or 2 since the BIOS does not look for the 'AB' header at the start of the other pages.
That said, I never dug into the BIOS to check. ^^

Looking at the usable ROM types in OpenMSX, I found 4 that seem incompatible with the first statement:
- Plain rom start at 0x0000
- Plain rom start at 0xC000
- Plain 16kB page 0
- Plain 16kB page 3

For the last 2, it may be ROMs that do not boot and are used by other programs, but what about the first two?
Does OpenMSX list them in a purely theoretical basis?

Login or register to post comments

By geijoenr

Champion (314)

geijoenr's picture

15-12-2021, 19:42

Case 1 makes sense because you may have data in page 0 and still an AB magic in page 1, which will be found.

Case 2, 3 and 4 don't make sense to me. Well, the computer will boot to BASIC either way, but unless you install some hooks no functionality from the ROM is exposed (right?).

By zeilemaker54

Champion (342)

zeilemaker54's picture

15-12-2021, 20:52

aoineko wrote:

Hello,

I have always heard that a ROM can only boot in page 1 or 2 since the BIOS does not look for the 'AB' header at the start of the other pages.
That said, I never dug into the BIOS to check. ^^

Looking at the usable ROM types in OpenMSX, I found 4 that seem incompatible with the first statement:
- Plain rom start at 0x0000
- Plain rom start at 0xC000
- Plain 16kB page 0
- Plain 16kB page 3

For the last 2, it may be ROMs that do not boot and are used by other programs, but what about the first two?
Does OpenMSX list them in a purely theoretical basis?

Plain rom start at 0x0000 -> which size of the ROM ? If it is 16 KB and does no mirroring, it will not start on the real thing. OpenMSX has some strange mirroring default which could mean that 0x0000 is mirrored at 0x4000 or 0x8000. in that case if 0x0000 contains AB and 0x0002 has a valid INIT entry, it could start
Plain rom start at 0xC000 -> which size of the ROM ? If it is 16 KB and does no mirroring, it will not start on the real thing. OpenMSX has some strange mirroring default which could mean that 0xC000 is mirrored at 0x4000 or 0x8000. in that case if 0xC000 contains AB and 0xC002 has a valid INIT entry, it could start
- Plain 16kB page 0, same as above
- Plain 16kB page 3, same as above

By Manuel

Ascended (18871)

Manuel's picture

15-12-2021, 21:25

These options are just there so that you are able to put your ROM anywhere in the Z80 address space you like.

By gdx

Enlighted (5594)

gdx's picture

16-12-2021, 02:22

Roms headers can be at 4000h or/and 8000h only but Roms can still start at page 0 or 3 if the address at INIT (4002h or 8002h) specifies an address less than 4000h or more than BFFFh. This is possible when the ROM is over 16kB. If the ROM size is 8/16kB, this is also possible using mirrors.

There are very complete explanations in the wiki.

https://www.msx.org/wiki/The_Memory
https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM

On MSX2 an MSX2+, it is possible to launch a ROM at the address 0002h if the "BC" code is at 0000h (as the Sub-ROM). By cons, if the ROM is in a slot lower than that of the Sub-ROM, it will start before the display of the MSX logo. This is not feasible on MSX1 nor Turbo R.

By Jipe

Paragon (1552)

Jipe's picture

16-12-2021, 13:42

i checked two roms 8k that i know
Sparkie: 41.42.CF.00
Juno First: 41.42.0D.03
code AB and adress 0002h

By aoineko

Champion (485)

aoineko's picture

04-01-2022, 18:05

The Develop a program in cartridge ROM page on the wiki says:

Quote:

When the system finds a header, it selects the ROM slot only on the memory page corresponding to the address specified in INIT then, runs the program in ROM at the same address. (In short, it makes an inter-slot call.)

In case header and INIT are not at the same page, is the page where the ROM header is located also switched by the BIOS?
It is necessarily switched when reading the 'AB', but when the code at the INIT address is executed, is the ROM still selected in the header page?
The wiki seems to say "no", but I prefer double-check.

Also, is the method of retrieving the cartridge slot-id in the C register 100% safe with all BIOS?
It is very useful, but this feature seems to be rarely used.
So I wonder if there are any known compatibility issues.

By Grauw

Ascended (10604)

Grauw's picture

04-01-2022, 18:22

aoineko wrote:

Also, is the method of retrieving the cartridge slot-id in the C register 100% safe with all BIOS?

I only first ever heard of it recently on this wiki and forum, and I’ve never seen this documented anywhere else, so use at your own risk. Even if it works with all standard BIOSes, it may be incompatible with C-BIOS or ROM loaders since it is an undocumented feature, and as far as I know not relied upon by a lot of software either (which would make it de facto standard).

Because I don’t have the complete answer to those questions, I personally wouldn’t rely on it. And I’m not a fan of having it added to the wiki as a casual recommendation, without providing the necessary context, as if it’s a well known and standard method.

By zeilemaker54

Champion (342)

zeilemaker54's picture

04-01-2022, 21:54

Jipe wrote:

i checked two roms 8k that i know
Sparkie: 41.42.CF.00
Juno First: 41.42.0D.03
code AB and adress 0002h

These are strange ROMs, which work because they are using ROM mirroring (and are not using the normal CS1,CS2 or CS12 ROM cartridge signals). That means that the ROM is actually running in page 0 and therefor bypassing the MSX BIOS completely. This means also that the ROMs are using direct I/O ports (not only for the VDP), which is not allowed according to the MSX programming best practices.

By zeilemaker54

Champion (342)

zeilemaker54's picture

04-01-2022, 22:00

Grauw wrote:
aoineko wrote:

Also, is the method of retrieving the cartridge slot-id in the C register 100% safe with all BIOS?

I only first ever heard of it recently on this wiki and forum, and I’ve never seen this documented anywhere else, so use at your own risk. Even if it works with all standard BIOSes, it may be incompatible with C-BIOS or ROM loaders since it is an undocumented feature, and as far as I know not relied upon by a lot of software either (which would make it de facto standard).

Because I don’t have the complete answer to those questions, I personally wouldn’t rely on it. And I’m not a fan of having it added to the wiki as a casual recommendation, without providing the necessary context, as if it’s a well known and standard method.

I agree with Grauw on this matter. Do not use the C register method. I already did a previous post on the same matter:
I would advice against using the Z80 register values, as those are not guaranteed by the standard. If I implement a custom BIOS which does implement for example a custom slot search (is fully acceptable in the true expandable way MSX is designed), the ROM search routine will be different and so will probably the register use. As the use of the ROM search routine registers is not documented, this will cause compatibility problems.
True MSX software follow the code best practice to avoid compatibility problems and run on any (future) MSX.

By Manuel

Ascended (18871)

Manuel's picture

05-01-2022, 00:13

Jipe wrote:

i checked two roms 8k that i know
Sparkie: 41.42.CF.00
Juno First: 41.42.0D.03
code AB and adress 0002h

There are many more, for instance from GoodMSX1:

Balance (1984) (Hal) (J) [a1].rom
Balance (1984) (Hal) (J).rom
Battle Ship Clapton 2 (1983) (T&E Soft) (J).rom
Boggy\84 (1984) (Nippon Columbia) (J).rom
Bomber Man (1983) (Hudson) (J).rom
Butamaru Pants (1983) (Hal) (J).rom
Cannon Ball (1983) (Hudson) (J).rom
Captain Chef (1984) (Nippon Columbia) (J).rom
Car Race (1983) (Ample) (J).rom
Color Ball (1983) (Hudson) (J).rom
Computer Billiards (1983) (Sony) (J).rom
Con-dori (1983) (Raison) (J).rom
Dragon Attack (1983) (Hal) (J).rom
Flash Sprash (1984) (Toshiba Emi) (J).rom
Frogger (1983) (Konami) (J).rom
Fruit Search (1983) (Hal) (J).rom
Galaxian (1984) (Namcot) (J) [a1].rom
Galaxian (1984) (Namcot) (J).rom
Harapeko Pakkun (1984) (Ascii) (J).rom
Heavy Boxing (1983) (Hal) (J).rom
Hitsuji Yai - Preety Sheep (1984) (Hudson) (J).rom
Jump Coaster (1984) (Nippon Columbia) (J).rom
Mr. Chin (1984) (Hal) (J).rom
Mr. Do (1984) (Nippon Columbia) (J).rom
Oyoide Tango (1984) (Hal) (J).rom
Peetan (1984) (Nippon Columbia) (J).rom
Picture Puzzle (1983) (Hal) (J).rom
Pyramid Warp (1983) (T&E Soft) (J).rom
Real Tennis (1983) (Takara) (J).rom
Scramble Eggs (1983) (Ample) (J).rom
Space Maze Attack (1983) (Hal) (J).rom
Space Trouble (1984) (Hal) (J).rom
Step Up (1983) (Hal) (J) [a1].rom
Step Up (1983) (Hal) (J).rom
Super Billiards (1984) (Hal) (J).rom
Super Cobra (1983) (Konami) (J).rom
Super Monitor 1.1 (1985) (Emiiru) (J).rom
Super Monitor 1.2 (1985) (Emiiru) (J).rom
Super Snake (1983) (Hal) (J).rom
Tank Battalion (1984) (Namcot) (J).rom
Video Hustler (1984) (Konami) (J).rom
Warp Warp (1984) (Namcot) (J).rom

Page 1/2
| 2