Bug in character output of MSX-DOS?

By Prodatron

Paragon (1836)

Prodatron's picture

13-05-2014, 11:09

I had a strange problem in the last days when working with the MSX-DOS STRING OUTPUT (09H) function:
According to this reference...
http://map.grauw.nl/resources/dos2_environment.php#c4
...we have the screen control code:

Esc Y < n > < m > = Position cursor at row < n > column < m >. Top left of screen is n=m=20h (ASCII space)

When I want to place the cursor in line 5, which means, that n=24h, the output runs riot. This caused me hours of quite a headache until I figured out, that 24h = "$", which is the terminator code for the textoutput. So what the f... is this?
Is this a known problem? Do all programs, which use this control code, have to bypass this problem by placing the cursor in the neighbour line/column and move it one step back/forward then?

Login or register to post comments

By Grauw

Ascended (10699)

Grauw's picture

13-05-2014, 12:01

I don’t use the _STROUT (09H) BDOS call, it’s convenient to have a string print method ready to go, but because of this weird terminator character I have my own little function which prints zero-terminated strings (ASCIIZ) by calling _CONOUT (02H) repeatedly.

Probably the $ terminator character originates back to the CP/M days, some guy made a bad decision and in order to stay CP/M compatible they were not able to change it in MSX-DOS.

By WORP3

Paladin (864)

WORP3's picture

13-05-2014, 12:51

Yep me too, i'm only using the conout, string handling from that point on is easy Wink

By Prodatron

Paragon (1836)

Prodatron's picture

13-05-2014, 14:13

Yes, the $ comes from CP/M:

Gary Kildall wrote:

"Ask Bill Gates why the string in MS-DOS function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that."

(http://en.wikiquote.org/wiki/Gary_Kildall#Sourced)
I really wonder, if this "bug" occures in CP/M as well. The phrase "Only I know that" would be very funny then :))
Anyway, thanks a lot for your hints! Now I will try it with this char by char methode, too.

By Grauw

Ascended (10699)

Grauw's picture

13-05-2014, 14:41

He seems a very bitter man… I think I like Tim Paterson better Smile.

It looks like Kildall brought things onto himself by not being able to deliver CP-M/86 on time, and now he’s blaming the world and Bill Gates in particular.

By Prodatron

Paragon (1836)

Prodatron's picture

13-05-2014, 14:42

I agree! (but most CP/M fanboys don't)
CP/M was quite crappy, but maybe it was ok for the 70ies (no disc format standard, no screen terminal standard, quite primitive file system etc.). MS(X)-DOS improved a lot...

By konamiman

Paragon (1190)

konamiman's picture

13-05-2014, 16:19

You know what? Solving this bug was the very first step in the development of Nextor.

Hannibal

By Prodatron

Paragon (1836)

Prodatron's picture

13-05-2014, 16:44

konamiman wrote:

Solving this bug was the very first step in the development of Nextor.

Hannibal

Running Naked in a Field of Flowers

By Grauw

Ascended (10699)

Grauw's picture

13-05-2014, 18:30

I also once made a proof of concept which replaced the BDOS console output calls with ones that wrote directly to the VDP. It was so much faster!

By Prodatron

Paragon (1836)

Prodatron's picture

13-05-2014, 21:30

@Grauw, btw, thanks a lot for providing these MSX resource pages, great stuff!

By Grauw

Ascended (10699)

Grauw's picture

13-05-2014, 22:11

Thanks, it’s nice to see that so many people use it for reference nowadays Smile.