HLP (CP/M Plus Help file) format

The CP/M Plus Help file is pretty much a text file with an index prepended. It is generated from a text file containing markup (usually called HELP.DAT).

The start of each topic in HELP.DAT is designated by a title line. This is of the form:

	///1Commands

The triple slash means that this line is a topic title. It can be anywhere in the line; usually it is at the beginning.

After the triple slash is a single digit. This gives the level of the topic in the hierarchy. Level 1 is a main topic; level 2 is a subtopic of the main topic that precedes it. For example:

        ///1DEVICE

	...text...

        ///2Options

	...text...

        ///2Examples

	...text...

means that DEVICE is a main topic, with subtopics Options and Examples.

The text for a topic immediately follows its title. By convention, this is 70 characters per line, left and right justified. There is no end-of-topic marker; the viewer stops when it finds the next topic title (or EOF). Lines are always terminated with CR,LF.

HELP.HLP is an indexed version of this file. The index at the beginning has 16 bytes per topic:

        DS      12      ;Topic name, upper-cased, padded with 
                        ;spaces
        DW      recno   ;Record number containing the start of the 
                        ;topic.
                        ;As always in CP/M, records are 128 bytes
                        ;long.
        DB      offset  ;Offset within the record of the start of 
                        ;the topic (to be exact, the carriage return
			;at the end of the "///" line)
        DB      level   ;Level of this topic.

The last entry of the index has a topic name of "$" (still space padded) with the other three fields holding zeroes. There may be up to seven further "$" entries, to pad the index out to a multiple of 128 bytes.

After the index, the text follows. This is identical to the un-indexed version in HELP.DAT; title lines remain present, though the help viewer does not display them.