Konamiman / Nextor

A disk operating system for MSX computers, forked from MSX-DOS 2.31
Other
183 stars 33 forks source link

Information about DOS1 or DOS2 mode is required at the DRV_INIT stage #41

Closed Eugeny1 closed 4 years ago

Eugeny1 commented 4 years ago

Because hardware configuration may depend on the the mode system started in - e.g. different storage subsystem configuration settings read from EEPROM. From the source code I see that Nextor just assigns B directly, and it is not possible to properly know what kernel code has called the DRV_INIT (DOS1 or DOS2), not flag is available in the RAM. As a workaround it is possible to perform hardware initialization in DRV_CONFIG, but then I need confirmation and guarantee that this routine will always be called in any DOS1 or DOS2 configurations only once.

Konamiman commented 4 years ago

Hi, unfortunately the DRV_INIT routine is executed very early in the system boot process so it's not possible to know which DOS mode will be active at that point.

As a workaround I can suggest you to indeed use DRV_CONFIG and use a flag in system area (initialized from the second execution of DRV_INIT) to check if that routine has been already called.

Eugeny1 commented 4 years ago

"As a workaround I can suggest you to indeed use DRV_CONFIG and use a flag in system area (initialized from the second execution of DRV_INIT) to check if that routine has been already called." Can you please explain how to do it? DEV_INIT does not return flag indicating DOS1 or DOS2 target mode, and it is always called twice, right?

Right now I see that DRV_CONFIG is called once if DOS2 mode is target, and twice if DOS1 mode is target (first time for DOS2 initialization, and second time for DOS1 initialization) causing driver displaying messages about initialization two times. And driver does not now beforehand how many times DRV_CONFIG will be called.

Konamiman commented 4 years ago

This is how you do it:

  1. You need to keep a variable (in page 3 work area for the driver, unless your hardware has its own RAM) with a flag indicating if DRV_CONFIG has been already invoked or not.
  2. If you need to allocate page 3 work area for that, do it in the first execution of DRV_INIT.
  3. In the second execution of DRV_INIT you reset the flag.
  4. In DRV_CONFIG you check the flag. If it's set, you don't display any messages. If not, you display the messages, and then set the flag.

I know it's not an ideal solution but it should work for the time being.