How to properly detect MSX-DOS version?

Page 1/2
| 2

By Eugeny_Brychkov

Paragon (1088)

Eugeny_Brychkov's picture

19-09-2018, 09:30

I need to know DOS1 or DOS2 mode. I am sure there's something in machine config RAM area, or BDOS system call. But what is the most reliable way - and sequence of tests?

BDOS's "RETURN VERSION NUMBER (0CH)" seems gives the wrong information.

Login or register to post comments

By gdx

Prophet (2979)

gdx's picture

19-09-2018, 10:11

By Eugeny_Brychkov

Paragon (1088)

Eugeny_Brychkov's picture

19-09-2018, 14:21

Thank you!

By NYYRIKKI

Enlighted (5366)

NYYRIKKI's picture

19-09-2018, 17:41

Eugeny_Brychkov wrote:

BDOS's "RETURN VERSION NUMBER (0CH)" seems gives the wrong information.

"This function simply returns the CP/M version number which is being emulated. This is always version 2.2 in current systems."

"GET MSX-DOS VERSION NUMBER (6FH)

Parameters: C = 6FH (_DOSVER)
Results: A = Error (always zero)
BC = MSX-DOS kernel version
DE = MSXDOS2.SYS version number
This function allows a program to determine which version of MSX-DOS it is running under. Two version numbers are returned, one in BC for the MSX-DOS kernel in ROM and the other is DE for the MSXDOS2.SYS system file. Both of these version numbers are BCD values with the major version number in the high byte and the two digit version number in the low byte. For example if there were a version 2.34 of the system, it would be represented as 0234h.

For compatibility with MSX-DOS 1.0, the following procedure should always be followed in using this function. Firstly if there is any error (A<>0) then it is not MSX-DOS at all. Next look at register B. If this is less than 2 then the system is earlier than 2.00 and registers C and DE are undefined. If register B is 2 or greater then registers BC and DE can be used as described above. In general the version number which should be checked (after this procedure) is the MSXDOS2.SYS version in register DE."

By gdx

Prophet (2979)

gdx's picture

17-12-2018, 11:04

As I understand it, A is different from zero after calling a function not supported by MSX-DOS1, is it right?

By gdx

Prophet (2979)

gdx's picture

17-12-2018, 15:24

Forget my question!
A = 0 if the environment is DOS, and we can kown if is DOS1 with that routine:

	ld	d,1		; Because D register does not change on DOS1
	ld	c,06fh
	call	BDOS		; Get MSX-DOS version
	ld	a,d
	cp	1
	jp	nz,DOS1
	cp	2
	jp	nz,DOS2

By NYYRIKKI

Enlighted (5366)

NYYRIKKI's picture

17-12-2018, 16:08

Please note that you can't trust D to return 2 if MSXDOS2.SYS is not loaded... but your checks are a bit weird looking anyway. How about:

	ld	c,06fh
	call	BDOS		; Get MSX-DOS version
	and	a
	ret	nz		; No MSX-DOS
	ld	a,b
	cp	2
	jp	c,DOS1
	jp	DOS2

By hit9918

Prophet (2866)

hit9918's picture

17-12-2018, 18:48

something is fishy. which system is it who ever returns "error", and why should I bother to support this system?

By Grauw

Ascended (8395)

Grauw's picture

17-12-2018, 19:27

Perhaps CP/M?

By konamiman

Paragon (1041)

konamiman's picture

17-12-2018, 21:17

hit9918 wrote:

something is fishy. which system is it who ever returns "error", and why should I bother to support this system?

Why is it fishy? The specification is just saying that a valid implementation of MSX-DOS will always return A=0 when invoking that function, that's all; the circumstances in which A!=0 would be returned are outside the specification and it's up to you to check if that happens or to not check it, it depends on how robust you want your software to be.

It's like the HTTP specification, for example. The specification says that the first line of the response to a HTTP request will be something like 200 Ok on success or 400 Bad parameter on error. Which system would return something different like OH NOES FOOBAR instead? No idea, but not a proper HTTP server, for sure. Should you check for malformed responses? That's up to you, but I'd say it's advisable to do so. Smile

Page 1/2
| 2