
uDOS 1.0

uDOS (ultra small DOS) is a very small DOS, which fits in the 3 boot sectors of a disk, but can read and write existing files anyway. It has many restrictions, but is useful for games with multiple files. Such games load their data from files and write only few data like the game state or a highscore list. Exactly this uDOS can do - and nothing more.

Features:
- uDOS fits in the 3 boot sectors, LOMEM is $938, thus 5-6 KB more free RAM
- Can read and overwrite files via D:-Handler like any other DOS
- Supports DOS 2.x and MyDOS files, Single/Medium/Double Density
- Starts COM/XEX file "D:AUTORUN" (instead of AUTORUN.SYS) when booting
- Open 4: Read file (normally)
- Open 8: Overwrite existing (!) file, all file sectors should be written to
  (otherwise the overwritten file may get too long)
- Open 12: Update existing file, like DOS 2.x, but no read allowed
- Can ignore disk write errors (for use with write protected disks)
- Supports XIO 40 to load an OBJ/COM/XEX file (AUX1 must be 0)
- No other OPEN/XIO/STATUS commnds (like Append, Delete, Rename, ...)

Restrictions:
- No DUP or Command Line
- Not reset-proof, RESET key reboots
- Works only with XL/XE compatible OS (not 400/800 OS)
- Works only with D1:, max. 1 file open at a time
- Cannot create or extend files (no additional sectors)
- No wildcards (? and *) in filenames
- No disk swaps Single/Medium to Double or vice versa
- Locations used - don't modify: $2D5/6, $301, $304/5, D entry in HATABS=$31a
- Don't modify between Open and Close: $43-$47, $30A/B
- No error 167 (File Locked) and 3 (Last Byte of File)
- Open finds unclosed written files also

Usage:
Start UDOSINIT.COM to write uDOS to a disk. You can choose, if uDOS ignores disk write errors. Alternatively use UDOS.BIN (or UDOSWRT.BIN to ignore write errors) with "dir2atr.exe -B" to create an ATR with uDOS. The COM/XEX file, uDOS shall start when booting, must be namend AUTORUN. uDOS works also with BASIC and Turbo-BASIC.

Other tools:
- BASOFF.OBJ    COM segment with INIT address to turn off BASIC
- RUNCOM.COM    Turn off BASIC and start AUTORUN.COM
- RUNBAS.COM    Turn on BASIC and start the BASIC program AUTORUN.BAS
- RUNUDOS.COM   Starts uDOS directly (without writing it into the boot sectors)
- TURBASIC.COM  Turbo-BASIC 1.51 (modified Turbo-BASIC 1.5):
  doesn't need a DOS to start, ESC key when starting skips AUTORUN.BAS,
  DOS command retains Turbo-BASIC active, RUN from DUP reenters Turbo-BASIC

Open/XIO details:

Open Update (AUX1=12): Overwrites a file without changing the file length, like DOS 2.x. But reading with AUX1=12 isn't supported.

Open Write (AUX1=8): Overwrites a file and updates the file length, but the sector count remains unchanged. If you write more bytes than fit in the file's sectors, you get Error 136 (End of File). The new file length will only be correct, if all sectors of the file are overwritten, otherwise it may get too high. (Reason: The DOS2 sector links remain unchanged.)

Note: Since writing is rather slow, it should be only used for short files (like highscore tables or game states).

XIO 40 doesn't open the COM/XEX file, thus reading the file via an INIT address (as Turbo-BASIC does at startup) doesn't work. Use TURBASIC.COM to start Turbo-BASIC with uDOS (or any other DOS).
