MSX boot

Page 1/4
| 2 | 3 | 4

By pp

Rookie (27)

pp's picture

22-11-2005, 06:56

Hi,

What I dont understand is how the booting of an MSX works.

If you have no disc or cartdridge installed, it just boots from basic rom.
But what if you put in a cartridge, does this go before a disc, or is the disc first ? Which mechanism controls this ?

Even so, the MSX title screen. Where does it come from ? The bios/basic rom ?

Does anyone know this ?

Regards,

PP

Login or register to post comments

By [D-Tail]

Ascended (8232)

[D-Tail]'s picture

22-11-2005, 07:22

Cartridge comes first. The logo is controlled by the BIOS ROM. It will initialise your MSX during that sequence. After checking for cartridges and none are found, the disk will be accessed for availability of MSXDOS (and start it when it was found) or AUTOEXEC.BAS (and start it when it was found). All other cases will cause your MSX to boot in BASIC. All this is controlled by the BIOS ROM.

By pp

Rookie (27)

pp's picture

22-11-2005, 07:30

Thanks,

Do you also know whether a cartridge, for example a Konami one, uses the bios routines as well ? Or will the cartridge swap out the bios page ?

Regards,

pp

By msd

Paragon (1372)

msd's picture

22-11-2005, 08:33

A cartridge can use the bios and will probably do that on some point in the code.

By HansO

Paladin (672)

HansO's picture

22-11-2005, 08:53

Hi,

What I dont understand is how the booting of an MSX works.

If you have no disc or cartdridge installed, it just boots from basic rom.
But what if you put in a cartridge, does this go before a disc, or is the disc first ? Which mechanism controls this ?

Even so, the MSX title screen. Where does it come from ? The bios/basic rom ?

Does anyone know this ?

Regards,

PP

How MSX starts up can be read from the MSX BIOS listing, see my website for the MSX 1 startup code. MSX 2 is not much different (long live standards!), just a bit more work like memory mapper inititializing.

After setting up the various MSX ICs like the VDP and the PPI and filling in BIOS workspace like the BIOS hooks and displaying the MSX logo, the slots are examined for presence of cartridges with ROMs. If a ROM is found and, depending on the signature in the first bytes of the ROM and init code present (e.g. basic extensions), the cartridge can take over and do whatever the programmer wants. E.g. a game can not give back control to the MSX BIOS, a floppy disk cartridge will give control back to the MSX BIOS ROM to let it start Basic.
The disk cartridge is just a standard catrdige, taking care of booting either from floppy etc. and filling in the various MSX Disk Basic hooks.

By zeilemaker54

Master (245)

zeilemaker54's picture

22-11-2005, 09:39

Actually the MSX boot is a bit more complicated with a disksystem (assuming DiskBasic 1.0 here):

- A MSX cartridge (eg ROM) can patch the H.STKE to take control of the disksystem. In this case, as soon as the initialization of the disksystem is ready, control is passed to the basic interpreter (so no basic roms, bootsectors to take control), and at a certain point H.STKE is called, and control is back to the cartridge. This is used by ROM games, which use the disksystem.
-If H.STKE was not patched, the disksystem search for a MSX cartridge (eg ROM) with a BASIC program. If this is found, this BASIC program is executed (with Diskbasic initialized).
- disksystem next tries to read sector 0 of drive 0 ( A: ) at &HC000. If this fails Diskbasic is started.
- The bootsector just read, is check for a MSDOS2.x header (e.g. &HE9 or &HEB at offset 0). If this is not found, Diskbasic is started.
- control is passed to &HC01E (the MSX bootloader) with the carry flag RESET. This can be used by a diskgame. Note that a own bootloader must be present in sector 0, because the default bootloader returns control to the disksystem at this point.
- a check for 64 KB of RAM (at all pages) is preformed. If not found, Diskbasic is started.
- disksystem next tries to read sector 0 of drive 0 ( A: ) at &HC000. If this fails Diskbasic is started.
- The bootsector just read, is check for a MSDOS2.x header (e.g. &HE9 or &HEB at offset 0). If this is not found, Diskbasic is started.
- perperation for MSX-DOS are performed (slot switching and interrupt routine) and control is passed to &HC01E (the MSX bootloader) with the carry flag SET. Normal MSX bootloader loads MSXDOS.SYS at 0100 and starts this. With own bootloader you could do something else......

DOS2 kernel boot are different, if anyone is interested, I can post this as well...

By msd

Paragon (1372)

msd's picture

22-11-2005, 10:03

yeah list the dos2 kernel boot as well

By HansO

Paladin (672)

HansO's picture

22-11-2005, 10:04

Actually the MSX boot is a bit more complicated with a disksystem (assuming DiskBasic 1.0 here):

DOS2 kernel boot are different, if anyone is interested, I can post this as well...

Please do!

By mohai

Paladin (833)

mohai's picture

22-11-2005, 11:29

Hi,

What I dont understand is how the booting of an MSX works.

If you have no disc or cartdridge installed, it just boots from basic rom.
But what if you put in a cartridge, does this go before a disc, or is the disc first ? Which mechanism controls this ?

Even so, the MSX title screen. Where does it come from ? The bios/basic rom ?

Does anyone know this ?

Regards,

PP

Indeed, it is simple. First, Z80 executes conde starting from #0000 in the lowest slot (0). Then code in the ROM-BIOS initializes PPI, VDP, SOUND, etc. Perform a routine to find and activate (at least) 16k RAM. Shows start-up screen and search for connected rom-cartdriges, starting from lowest slot/subslot...

Cartdriges in lower slots, will be initialized first.
If no rom-cartdriges did not take over the control, then MSX-BASIC rom is started

regards,
IvI

By zeilemaker54

Master (245)

zeilemaker54's picture

22-11-2005, 13:28

Here is the MSX boot procedure with a disksystem kernel 2.x.

Note that kernel 2.31 (used in the Turbo-R) has some modifications, which extends the bootprocedure (because kernel 1.00 is in the same slot and page). Kernel 2.31 specifics are marked [2.31].

- [2.31] The key "1" is checked. If pressed, kernel 1.00 is started. look for bootprocedure for kernel 1.00 in my previous post.
- A MSX cartridge (eg ROM) can patch the H.STKE to take control of the disksystem. In this case, as soon as the initialization of the disksystem is ready, control is passed to the basic interpreter (so no basic roms, bootsectors to take control), and at a certain point H.STKE is called, and control is back to the cartridge. This is used by ROM games, which use the disksystem. [2.31] after the H.STKE check, the DEFUSR0 entry is checked. If this default, kernel 1.00 is started. Otherwise, the normal action is performed (so kernel 2.31 stays active and control is passed to ROM). This means that the (game) ROM must explicit change the DEFUSR0 entry for the kernel 2.31 to stay active!
-If H.STKE was not patched, the disksystem search for a MSX cartridge (eg ROM) with a BASIC program. If this is found, this BASIC program is executed (with Diskbasic initialized). [2.31] the DEFUSR0 entry is checked. If this default, kernel 1.00 is started. Otherwise, the normal action is performed (so kernel 2.31 stays active and the basic program in ROM is started). This means that the ROM must explicit change the DEFUSR0 entry for the kernel 2.31 to stay active!
- [2.31] if (&HF2FD)<>0, then MSXDOS2 is started from the driveid specified in (&HF2FD).
- disksystem next tries to read sector 0 of any drive (phantom drives are skipped) with a valid MSDOS2.x header (e.g. &HE9 or &HEB at offset 0) at &HC000. If this fails Diskbasic is started.
- [2.31] if the bootsector has no valid volumeid, kernel 1.00 is started.
- control is passed to &HC01E (the MSX bootloader) with the carry flag RESET. This can be used by a diskgame. Note that a own bootloader must be present in sector 0, because the default bootloader returns control to the disksystem at this point.
- If (BOTTOM)<>&H8000, Diskbasic is started.
- perperation for MSX-DOS are performed (slot switching and interrupt routine)
- the system tries to load MSXDOS2.SYS (from the default drive, the one with a valid bootsector) at &H0100
- If this is succesfull, MSXDOS2 is started
- disksystem next tries to read sector 0 any drive (phantom drives are skipped) with a valid MSDOS2.x header (e.g. &HE9 or &HEB at offset 0) at &HC000. If this fails Diskbasic is started.
- [2.31] if if the bootsector has no valid volumeid, Diskbasic is started.
- control is passed to &HC01E (the MSX bootloader) with the carry flag SET. Normal MSX bootloader loads MSXDOS.SYS at 0100 and starts this.

By zeilemaker54

Master (245)

zeilemaker54's picture

22-11-2005, 13:40

I have spent quite a bit of time in disassembling the various MSX roms. I am looking for a method to publish the assembly source somewhere on the internet. So everone can look at the code, and may be create a custom version of the dos kernel. But I am not sure if publishing is legal (because of the copyrights).
At the moment I am busy modifing the kernel 2.31 to support FAT16 (so no need to patch the kernel with FAT16.COM), but other modification are possible with my source at hand.
Like to hear your reactions...

Page 1/4
| 2 | 3 | 4