@DATABASE "NDos"
@$VER: NDos.guide 1.00 (6 Aug 1997)
@(C) THOR Software
@SMARTWRAP
@AUTHOR Thomas Richter
@NODE MAIN "NDos II Guide"
@{CODE}@{BG Fill}@{FG Shadow}
@{"                          NDos II © THOR Software                           " link About}



@{"Legal Stuff   : The Licence                                                 " link Licence}


@{"Overview      : What it does                                                " link Overview}


@{"Installation  : Simple!                                                     " link Install}


@{"Usage         : Installing boot menus                                       " link Usage}


@{"Compatibility : NDos, Viruscheckers and DiskCopy                            " link Compatibility}


@{"Internals     : How does it work, how to check it?                          " link Internals}


@{"History       : Long!                                                       " link History}



@{BODY}@{BG Background}@{FG Text}
        © THOR-Software

        Thomas Richter

        Rühmkorffstraße 10A



        12209 Berlin


        Germany



EMail:  thor@einstein.math.tu-berlin.de

WWW:    http://www.math.tu-berlin.de/~thor/thor/index.html


NDos is FREEWARE and copyrighted © 1989-1997 by
Thomas Richter. No commercial use without perimission of the
author. Read the @{"licence" link Licence}!

@ENDNODE
@NODE About "About NDos"

This program is dedicated to S. Baucke. Read the
@{"History" link History} to find out why!

@ENDNODE
@NODE Licence "The THOR-Software Licence"
                        The THOR-Software Licence


This License applies to the computer programs known as "NDos II".
The "Program", below, refers to such program.


The programs and files in this distribution are freely distributable
under the restrictions stated below, but are also Copyright (c)
Thomas Richter.


Distribution of the Program by a commercial organization without written
permission from the author to any third party is prohibited if any payment
is made in connection with such distribution, whether directly
(as in payment for a copy of the Program) or indirectly (as in payment
for some service related to the Program, or payment for some product
or service that includes a copy of the Program "without charge";
these are only examples, and not an exhaustive enumeration of prohibited
activities). However, the following methods of distribution involving
payment shall not in and of themselves be a violation of this restriction:


(i) Posting the Program on a public access information storage and
retrieval service for which a fee is received for retrieving information
(such as an on-line service), provided that the fee is not
content-dependent (i.e., the fee would be the same for retrieving the same
volume of information consisting of random data).



(ii) Distributing the Program on a CD-ROM, provided that the files
containing the Program are reproduced entirely and verbatim on such
CD-ROM, and provided further that all information on such CD-ROM be
redistributable for non-commercial purposes without charge.



Everything in this distribution must be kept together, in original
and unmodified form.




Limitations.

THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO
WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
SERVICING, REPAIR OR CORRECTION.



IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE ALL FILES CONTAINED IN
THIS ARCHIVE.

@ENDNODE
@NODE Overview "Overview: What about it"
The "NDos" is a boot block menu; once installed to a disk, you get a tiny
menu each time you're booting from that disk, to select one out of a set of
startup - sequences.


NDos is designed to replace the standard boot block of "floppies" and can't
be used for HD. It is, therefore, optimized in length: It takes 0
(literally: ZERO) blocks of disk space, no additional room on the disk is
needed to store that menu. The only thing you need to provide is a set of
startup-sequences you may create with the "NDos Converter".


This makes the "NDos" the ideal solution for a "Game Dos". Install multiple
games on one floppy and use the "NDos" as boot menu, without wasting any
room on the floppy itself.


The "NDos" boot menu redirects the standard "Startup-Sequence" to one out of
a set of user-created and user selectable startup-sequences. This bootblock,
and the individual startup sequences are created by the "NDos Converter"
program in this archive.

@ENDNODE
@NODE Install "Installation of NDos"
The Installation of the "NDos Converter" is remarkably simply:


- Copy the NDos converter whereever you want to keep it.


- Copy this guide whereever you want.


That's in principle all, unless you want to configure a bit more:



You may select your prefered editor that NDos uses to edit the
startup-sequences. It's stored in the environment variable "ENV:Editor".
This is, btw., the same variable that is used by other programs for the
editor selection, like "More". Each standard ASCII editor will work here,
but you should prefer an editor that operates synchronuously, i.e. doesn't
launch itself in the background. Hence, the popular editor "Ced" is not the
best choice here, even though it works "sort-of".


The following line, entered in shell, selects this editor:


@{I}
SetENV Editor "<enter the full path to the editor>"
@{UI}


and use the following command to save it permanently to disk:


@{I}
copy ENV:Editor to ENVARC:
@{UI}


The NDos converter expects also three standard tools in the "C:" directory,
namely:


"Copy", "Delete" and "Install".


The NDos code expects the CBM tools, but replacements work as long as they
accept the same command line arguments and work in the same way.


@ENDNODE
@NODE Usage "Using the NDos converter"
Step one is of course to copy all required data to the disk you want to
install the NDos at. The NDos converter can't help you in this task cause
there is no general way to do it.


The next step is to create the startup-sequences for each application you
copied in the first step to the disk. You may do this by hand - see
@{"below" link Internals} where the different startup-sequences are
kept - but the NDos converter can you help here:



- Start the "NDos Converter".


- Insert the disk you prepared before in any drive.


- Select "Clear Menu -> Really?" from the leftmost "NDos" menu.


- Enter the headline of the disk in the gadget on top of the screen. This
headline is shown on top of the program list later on.


- The next and all subsequent gadgets keep the items of the bootmenu, one
for each application on that disk. Enter a string here you want to appear in
the bootmenu, and press RETURN.


The "NDos Converter" launches now your editor. Please enter here the
startup-sequence to run this application - this script file gets executed as
replacement for the startup-sequence each time you select the associated
menu item in the boot menu.


Leave the editor and save the file to get back to the converter.


Continue with this step until all necessary startup sequences are created.



@{B}Additional edit features:@{UB}

You may also edit these script files later on:

Click into the gadget whose startup sequence you want to change and select
the "Edit this startup" from the rightmost "Edit" menu.


It's also possible to add more entries to or remove entries from the
bootmenu list. The "Insert Entry" function of the same menu inserts one item
on top of the currently selected, and the "Delete Entry" removes the current
entry from the list.


Another menu point "Rename Startup-Sequence" reads the original
"S:Startup-Sequence" file from your disk and uses this sequence as one of
the individual startup scripts of the currently selected application. That
makes usually only sense for one application on that disk. And no sense at
all if the file isn't present anyways.




- If you're done creating and compiling the startup-sequences of all 
applications you'd like to launch by the NDos menu, select the proper "Save
To" sub item of the middlest "Menu-I/O" menu to write the startup scripts
and the boot menu itself to the disk.


You're now ready to go and might try to boot from that disk.



@{B}More functions provided by the NDos Converter:@{UB}

It's of course also possible to load a previously installed NDos from a
disk. That's done (guess how!) with the "Load from" menu item and its
subitems.


The "Delete NDos at" item removes the NDos boot code from a disk and
restores a usual "booting" boot block. Quite the same is done with
"Install NoBoot" except that a "non-booting" bootblock is written to that
disk.


The second to last "Check Bootblock" is used to test which type of
bootblock is actually installed on the disk.


The last menu item "Restore NDos from" is needed to repair a partially
destroyed NDos information. It's quite common that disk copy programs like
the CBM "DiskCopy" copy only a part of the NDos information so you can't
re-read the bootblocks later on. Use this menu item instead of "Load From"
to repair a damaged bootblock. However, @{B}BE WARNED@{UB}, don't try to
"restore" anything else than NDos bootblocks, or the converter might crash.


So, @{B}use this function with extreme care!@{UB}


More on that is @{"here" link Compatibility}.


The last additional feature is that you might remove the
"S:Startup-sequence" file from a disk completely, without using it for
anything else. That's done by the "Delete Startup-Sequence" menu item and
its subitems in the "NDos menu".

@ENDNODE
@NODE Compatibility "NDos Compatibily problems."
Since NDos replaces the stanard bootblocks of floppies by a custom
bootblock, this might cause certain virus checkers to scream (or, at least
they should scream!).


The NDos identification isn't stored in the bootblock itself, but in the
"label buffer" of the two boot blocks of the floppy. This label buffer is
not correctly copied by all copy-programs, like the CBM "DiskCopy". This
won't harm the boot menu itself in any way, it never reads this label
buffer directly. But this additional set of 16 bytes is used by the "NDos
Converter" to identify the boot blocks as valid "NDos Bootcode", and also to
locate the menu data of the "NDos bootblock" because its precise location
inside the blocks might differ from version to version. The
@{"menu item" link Usage} "Restore NDos from" is provided to force reading
this information anyways, without requiring the proper information in the
label buffer. This is, however, not 100% safe and will work @{B}ONLY@{UB} if
the version of the bootblock and the converter match.


More about the information in the label buffer is @{"here" link Internals}.

@ENDNODE
@NODE Internals "NDos Internals"
Each application on disk gets a unique startup-sequence assigned to it that
is launched instead of the "usual" S:Startup-Sequence file. The topmost menu
item runs the "S/A" script, the next runs "S/B" and so on. The NDos
converter simply creates and copies these files to the "S" drawer of the
disk and writes the boot code.


The bootcode, on the other hand, installs now a patch that redirects the
opening of the "S:Startup-sequence" file to the proper startup code, so to
one of the files "S/A" to "S/K". The patch is removed automatically once the
startup-sequence is running, so you don't have to fear any
incompatibilities. (This patch, and hence NDOS, works with all versions of
the OS, including the BCPL dos of the 1.2 and 1.3 releases.)


You may, of course, also edit these files manually, without using the
converter.


The "NDos Converter" stores additional information about the menu in the
label buffer of the floppy. This might cause some compatibility problems,
see @{"here" link Compatibility}, but is harmless since the data is not
needed by the bootcode itself.


You'll find the 16 bytes label buffer filled with the following information:


Bytes 0-3:      The first long word contains the offset of the menu
information relative to the first byte of the first boot block. It's read by
the "NDos converter" to load a previously saved menu but is ignored by the
boot code.


Bytes 4-15:     They contain the string "NDos2© THOR",0

The digit "2" refers to the version number and might increase in the future.

This information is also ignored by the boot code but used by the converter
for identification. Virus checkers could implement a check for valid NDos
bootblocks in the same way.

@ENDNODE
@NODE History "Historical nodes"
About the name:

Unlike what you might have guessed, "NDos" is not a spoof of the text that
the workbench shows for illegal disks. The name "NDos" is completely
unrelated to "Not A Dos Disk" disks. But let's have a look at the history
which starts way before the amiga was created:


Version 1 of the NDos was actually a "Game Dos" for the Atari-XL computer
series. It was written by a guy called "S. Bauke", that's all what I know
except that I was using it for years with great success. It became a sort of
standard tool for this 8 bit computer.


The next version included a couple of minor fixes I made to the Atari
version of the "NDos converter", for example for faster loading. This is the
currently "active" version which I'm still using for the Atari. We're
talking about the year 1985 or the like, just to give you an idea how old
this thingly is!


Later on, I bought the Amiga computer (had quite a lot of trouble with it,
but that's a different story) and wanted to write something similar. The
booting mechanism of the Amiga is, however, almost completely unlike that of
the Atari. The "DOS" is build in, and you don't have a choice of selecting
what's happening during startup up except you put it in the
startup-sequence. However, my disks got really full those days since I had
no HD, and no room for a boot menu on that disk either; so the idea was born
to put this menu in the boot block that contains usually only a minimal stub
routine to launch the dos library. The first approach was done in C, and
that was actually my first contact with C whatsoever. As you might expect,
it was unsuccessful. C code is much too long to fit in these tight blocks,
no way. The second attempt was in assembly language which was better in
principle, but I tried here to replace the "Open()" vector of the DOS
routine, which is again never used by the BCPL dos itself. After a lot of
research with a debugger I found that the "mystical" DOS GlobVec is used
instead, and I tried to patch this one. Again without success, because the
globvec is reconstructed each time a process gets launched. The first really
working version of NDos attacked this point with another patch that
re-installs the globvec patch each time a task gets run. That's this
version:


NDos, Version 1.3:      Sometimes around 1989.


It worked stable, but the converter was ugly and so was the boot menu. The
patching mechanism was "more than adventureous". But I made first some tiny
improvements in the converter, only to make it visually more attractive:


NDos, Version 1.41:     In the same year.


Still the tricky patching, some tiny bugfixes in the menu.


However, I wasn't happy with the boot menu at all, the way how this patch
worked. This was only good, because this globVec is no longer used in the
newer 2.x releases of the OS. But there was no sign of 2.0 those days, the
1.3 workbench was brand new and a big improvement. ViNCEd started in those
days too, in case you wonder.



NDos, Version 2.05:     (we're now in 1992) The finished version 2.xx,
after some bugfixes and porting it to the DevPac assembler. The menu is now
visually attractive and the best I could fit into the bootblocks including
the text for the menu itself. The patching mechanism changed dramatically,
everything was completely rewritten, the boot code and the converter. That's
the version I used to have on my HD for years, until now.


NDos, Version 2.10:     That's the version in this archive. I dared, after
years, to touch one of my first projects again and to make a major code
cleanup. The boot code is now compatible to the newer MC'40 to MC'60
processors and the assembler source of the converter was really somehow
cleaned up as well. I don't know if you really need this converter anymore,
and if you can make any use of it, but here you have it. It's yours, it's
free! It's at least better than to store it on my HD alone....


@ENDNODE

