Page Menu

NEWDOS/80

DOSPlus

LDOS

TRSDOS

Misc


How to use LDOS for Host Work – Michael Cooper

One of the features of LDOS that make it a superior operating system is the device independence. This allows you total flexibility in the way you can set up the system I/O. In the case of CLUB-80 I needed to include a communications link to the operating system, but still protect the integrity of the applications programs and files.

The Standard Devices in LDOS are:

*KI = Keyboard
*DO = Video Display
*PR = Printer
*SI = System Input (Unassigned)
*SO = System Output (Unassigned)
*JL = Job-log (Unassigned)

LDOS comes supplied with a Serial Device Driver for use with the RS-232 Port.The Model 3 version of the driver(RS232T/DVR) is very sophisticated, with an input buffer of 128 bytes and interrupt handling of incoming characters. To set the driver for use with a MODEM you must specify the Baud Rate and Byte configuration.

SET *CL TO RS232T (B=300,W=8,S=1,P=N,DTR,RTS)

This will create a new device called *CL- Comm Line that uses RS232T as its driver program. The parameters passed in the parentheses set Baud Rate = 300, Word length = 8 Bits, Stop Bit = 1, No Parity Bit, sets DTR and RTS to logical “TRUE”. Now by connecting a MODEM to the RS-232 Serial port you have a pathway for data to and from the Telephone.

The remaining task is to connect the *CL device into LDOS. This can be achieved in several ways,but in this case we want to use the system in remote mode, so we connect *CL to the *KI (Keyboard) device for input, and to *DO (Display) device for output. In LDOS this is done by:

LINK *CL *KI ENTER
LINK *CL *DO ENTER

This permits any request for keyboard input via *KI Keyboard to be serviced either by the keyboard of the HOST machine or via MODEM through *CL. Any character output to *DO (Display) will also be sent to *CL and thus to the MODEM, this provides the ECHO.

As an added bonus, the LDOS Type-ahead Keyboard Driver allow double buffering of all input via *CL. Data from the MODEM is fetched by the interrupt handler as soon as it arrives, and buffered until the next scan of th typeahead routine. The data is then buffered for use by the *KI driver when needed.

To complete this operation, the whole of high memory and the DCB’s are saved in the CONFIG file for loading at Boot. All is now prepared so the computer can be used remotely via the phone. All the programs it will run can be written in BASIC and do whatever you want.

The CLUB-80 software is written in LBASIC and the programs run in “EXEC” mode(Level 7) to afford maximum protection from tampering. As an added protection a FILTER program is used on the *KI (Keyboard) device to check that the system hasn’t somehow dropped into DOS READY or BASIC READY. If the FILTER finds this condition true, the system is rebooted to disconnect the current caller before they can play around.


LDOS 5.1.x for the Model III System Files and Purposes – LDOS Manual

SYS0/SYS
Mandatory    
Resident part of the operating system. Must be present on any bootable disk
SYS1/SYS
Mandatory
LDOS command interpreter, routines for processing the @FEXT system vector, routines for processing the @FSPEC system vector, routines for processing the @PARAM system vector. Must be available on all SYSTEM disks.
SYS2/SYS
Mandatory
Opening or initializing disk files and logical devices. Contains routines for checking the availability of a disk pack (services the @CKDRV system vector), and routines for hashing file specifications and passwords Must be available on all SYSTEM disks.
SYS3/SYS
Mandatory
All system routines needed to close files and logical devices. Contains the routines needed to service the @FNAME system vector. Must be available on all SYSTEM disks.
SYS4/SYS
Optional
System error dictionary. If removed from a SYSTEM disk, all errors will say “SYS ERROR”. Note: Very Small; May Not Be Worth Deleting
SYS5/SYS
Optional
LDOS DEBUG command. May be deleted if you don’t need to use DEBUG. If you purge SYS5/SYS you may as well purge SYS9/SYS too.
SYS6/SYS
Optional
Contains all routines necessary to service the LIBrary “A” commands (primary library functions). May be removed but would leave very limited use of LDOS.
SYS7/SYS
Optional
Contains all routines necessary to service the LIBrary “B” commands. May be deleted if you don’t need those specific commands.
SYS8/SYS
Mandatory
Needed to dynamically allocate file space used when writing files.
SYS9/SYS
Optional
Contains the routines necessary to service the EXTended debugging commands available after a DEBUG (EXT) is performed. May be purged if you will not need the extended debugging commands. If you purge SYS5/SYS you may as well purge SYS9/SYS too.
SYS10/SYS
Mandatory
Contains the procedures necessary to service “KILL” and contains the routines to service the @DODIR system vector. It should remain on your working SYSTEM diskettes.
SYS11/SYS
Optional
Contains all procedures to perform JCL If you purge SYS6/SYS you may as well purge SYS11/SYS too.
LBASIC/CMD
Mandatory if Keeping BASIC
LBASIC/OV1
Optional
Needed for Renumbering or Cross-Referencing (not sure which)
LBASIC/OV2
Optional
Needed for Renumbering or Cross-Referencing (not sure which)
LBASIC/OV3
Mandatory if Keeping BASIC

TRSDOS v1.3 for the Model III System Files and Purposes – Snappware Manual

SYS0/SYS
Mandatory
Boot and resident part of the operating system. Must be present on any bootable disk
SYS1/SYS
Mandatory
TRSDOS command interpreter. Must be available on all SYSTEM disks.
SYS2/SYS
Mandatory
$OPEN and $INIT calls. Must be available on all SYSTEM disks.
SYS3/SYS
Mandatory
$CLOSE and $KILL calls. Must be available on all SYSTEM disks.
SYS4/SYS
Mandatory
System error dictionary. Note: Very Small; May Not Be Worth Deleting
SYS5/SYS
Optional
DEBUG command. May be deleted if you don’t need to use DEBUG.
SYS6/SYS
Optional
APPEND, ATTRIB, AUTO, BUILD, CLEAR, CLOCK, CREATE, DATE, DIR, DO, DUMP, ERROR, FREE, LIB, LOAD, PAUSE, PROT, RENAME, and TIME.
SYS7/SYS
Optional
BACKUP and FORMAT.
SYS8/SYS
Optional
HELP.
SYS9/SYS
Optional
COPY, DUAL, FORMS, KILL, MASTER, PATCH, RELO, ROUTE, SETCOM, and WP.
SYS10/SYS
Optional
$DSPDIR and BASIC Error Messages.
SYS11/SYS
Optional
LIST, PURGE, and TAPE.
SYS12/SYS
Optional
BASIC Commands: NAME and CMD “C”
SYS13/SYS
Optional
BASIC Commands: CMD “J”, CMD “O”, and CMD “X”
SYS14/SYS
Optional
$FILPTR and $RAMDIR calls.

Increasing The Number of Drives in LDOS – Frank Durda IV

To turn floppies 2 and 3 on immediately, but only for the current session:

system (drive=2,enable)
system (drive=3,enable)

To make this permanent, SYSGEN these settings or make these commands part of the boot jcl.


Passwords (ALL DOS’S)

TRSDOS Passwords (Model I)

Back-Door password on TRSDOS 2.3
NV36 and/or AF19
Master Password
P3UF
Other TRSDOS 2.3 passwords
F3GUM, RVCOOK, UBETT, WKIA

TRSDOS Passwords (HD4)

Files
Password
TRSHD*/DCT     
.P3UF

LDOS Passwords – Tim Mann/Frank Durda IV

Files
LDOS 5.1
LDOS 5.3.1
TRSDOS 6
LS-DOS 6.3.1
—–
——–
———-
——–
————
basic/*
(unused)
basic
basic
basic
*/ov?
basic
lbasic/*
basic
(unused)
(unused)
(unused)
config/sys
ccc
ccc
ccc
ccc
*/sys
wolves
system
lsidos
system6
*/flt
gsltd
filter
filter
filter
*/dvr
gsltd
driver
driver
driver
*/dct
rrw3
driver
utility
driver or utility
*/cmd
rrw3
utility
utility
utility
*/hlp
(unused)
help
(unused)
help
back door
rs0lt0ff
rs0lt0ff
(none)
(set bit 7 of nflag$)
back door?
LDOSOKVS
LDOSOKVS
LDOSOKVS

Disabling Password Checking

LDOS v6.3.1 (Model 4)
MEMORY (A=”N”,B=128)

C Code To Compute TRS-80 Passwords – Tim Mann

/* trspwhash
 * Usage:  trspwhash password	  // Hash a password
 *         trspwhash -u 0xhash    // Unhash a password to letters
 *         trspwhash -n 0xhash    // Unhash a password to letters and digits
 */
#include <stdio.h>

unsigned int
pwhash(unsigned char pw[8])
{
    unsigned char *p = &pw[7];
    unsigned int count = 8;
    unsigned int hl, t1, t2;

    hl = 0xffff;
    do {
	t1 = hl & 0x07;
	t2 = hl & 0xff;
	hl = (t1 << 13) ^ (t1 << 9) ^ (t1 << 2) ^
	     (t2 << 8) ^ (t2 << 4)  ^ (t2 > 3) ^
             (hl >8) ^ (*p-- << 8);
    } while (--count);
    return hl;
}

void
usage()
{
    fprintf(stderr, "usage: trspwhash [-u | -n] arg\n");
    exit(1);
}

int
main(int argc, char **argv)
{
    unsigned int goal;
    unsigned char pw[17];
    int i;
    if (argc == 2) {
	strncpy(pw, argv[1], 8);
	pw[8] = '\0';
	strncat(pw, "        ");
	for (i = 0; i <8; i++) {
	    if (islower(pw[i])) pw[i] = toupper(pw[i]);
	}
	printf("%04x\n", pwhash(pw));
    } else if (argc == 3 && strcmp(argv[1], "-u") == 0) {
	goal = strtoul(argv[2], (void*)0, 0);
	strcpy(pw, "        ");
	for (;;) {
	    if (pwhash(pw) == goal) printf("%s\n", pw);
	    i = 0;
	    for (;;) {
		switch (pw[i]) {
		  case ' ':
		    pw[i] = 'A';
		    break;
		  case 'Z':
		    pw[i] = 'A';
		    i++;
		    if (i == 8) exit(0);
		    continue;
		  default:
		    pw[i]++;
		    break;
		}
		break;
	    }
	}
    } else if (argc == 3 && strcmp(argv[1], "-n") == 0) {
	goal = strtoul(argv[2], (void*)0, 0);
	strcpy(pw, "        ");
	for (;;) {
	    if (pwhash(pw) == goal) printf("%s\n", pw);
	    i = 0;
	    for (;;) {
		switch (pw[i]) {
		  case ' ':
		    pw[i] = 'A';
		    break;
		  case 'Z':
		    pw[i] = '0';
		    break;
		  case '9':
		    pw[i] = 'A';
		    i++;
		    if (i == 8) exit(0);
		    continue;
		  default:
		    pw[i]++;
		    break;
		}
		break;
	    }
	}
    } else {
	usage();
    }
    return 0;
}

Removing TRSDOS v1.3 Password – By Tom Price

For those of you who have used the basic version of SUPERZAP from NEWDOS 2.1 to peek at the directory of the MODEL-III TRSDOS, you may have noticed that the password encode for a null (blank) password is EF5C rather than the old familiar 9642 from the MODEL-I. This is caused by Radio Shack using a slightly different algorithm to encode the passwords (they changed two bytes in the code), but the system works in much the same way. This article will explain three ways to get around the password system if you have a need to do so. The first two will require the above mentioned SUPERZAP, which is all we have until someone comes up with a version tailored to the MODEL-III’s double density disk structure. the third method doesn’t require any utility program at all and can be used by anyone.

  1. ZAPPING THE DIRECTORY – Use SUPERZAP to select track 1B, sector 4. This will bring you to the first sector of the directory. Then, use the “;” key to page through the directory until you find the programs you want. The first four bytes of the second line of each directory entry are the update and access password encodes respectively and, on an unprotected file, they will be EF5C EF5C. To remove the passwords on a protected file, just zap EF5C into the entry in place of whatever you find there. just like the MODEL-I. Don’t waste any time looking for the SYS Files. They aren’t listed by name in the directory and don’t have passwords anyway.
  2. DISABLING PASSWORD CHECKING – You can dispense with passwords altogether if you want to. Use SUPERZAP to bring up track 1A, sector 2. Then use the MOD function of SUPERZAP to change relative byte DE from 28 to 18. Press ENTER and type Y to write the modified sector back to the diskette. From now on, all passwords will be ignored when accessing files if this diskette is used in drive #0.
  3. THE MASTER PASSWORD – If you don’t have SUPERZAP or don’t want to make any modifications to TRSDOS, you can access any file regardless of protection by using a master password to over-ride all other passwords. One such password is “NYXB”. This acts as a master key to unlock any file and can be used if you have a diskette with a master password other than “PASSWORD”.


System functions that can be accomplished in BASIC

Functions to Read, Test, and Change bits:

DEF FNReadBit   (Address,Bit) = INT(PEEK(Address)/2^Bit)-2 * INT(PEEK(Address)/2^(Bit+1))
DEF FNResetBit  (Address,Bit) = PEEK(Address) - FNReadBit(Address,Bit) * 2^Bit
DEF FNSetBit    (Address,Bit) = PEEK(Address) + (1-FNReadBit(Address,Bit)) * 2^Bit
DEF FNToggleBit (Address,Bit) = FNResetBit(Address,Bit) + FNSetBit(Address,Bit) - peek(Address)

109 -- Bit 1==>  Type-Ahead
           Set = Enabled
         Reset = Disabled

116 -- Bit 5==>  Caps
           Set = Upper Only
         Reset = Upper/Lower

121 -- Bit 7==> Spooler
           Set = Despooling
         Reset = Paused

124 -- Bit 4==>  Break Key
           Set = Disabled
         Reset = Enabled

127 -- Bit 4==>  Clock Display
           Set = Display On
         Reset = Display Off

127 -- Bit 6==>  Cursor Control
           Set = Non-Blinking
         Reset = Blinking

For example to turn the clock display on from BASIC use the statement:
POKE 127,FNSetBit(127,4).

Print string of number without a leading space:
Call with A set to the number.

DEF FNST$(A)=RIGHT$(STR$(A),LEN(STR$(A))-1)

Function to display the current DOS version:

DEF FNVersion$="TRSDOS Version " + LEFT$(HEX$(PEEK(133)),1)+
   "." + RIGHT$(HEX$(PEEK(133)),1) + "."+HEX$(PEEK(59))

Function to display the current date in ‘Day, Mon ##, 19##’ format:

DEF FNDay$=MID$("SunMonTueWedThuFriSat",(((PEEK(55)AND 14)/2)-1)*3+1,3)+
	  ", "+MID$("JanFebMarAprMayJunJulAugSepOctNovDec",(PEEK(53)-1)*3+1,3)+
	  " "+RIGHT$(" "+FNST$(PEEK(52))+", 19"+FNST$(PEEK(51))

Print appropiate article in front of a word:
Call with A$ = to the word that you want the article in front of.

DEF FNARTICLE$(A$)="A"+LEFT$("n",INSTR("AEIOUaeiou",LEFT$(A$,1)))+" "+A$

Display a menu number in reverse video:
Call with A = to menu number to display.

DEF FNNUM$(A)="{"+CHR$(16)+FNST$(A)+CHR$(17)"} "

Condense the TIME or DATE strings to 4 bytes:
Call with A$ = to TIME$ or DATE$.

DEF FNTIMEDATE$(A$)=MKS$(VAL(LEFT$(A$,2)+MID$(A$,4,2)+RIGHT$(A$,2)))

Expand time or date string as condense above:
Call with A$ = Condensed string — B$ = seperator, ‘/’ or ‘:’.

 DEF FNEXPAND$(A$,B$)=STRING$(6-LEN(FNST$(CVS(A$))),48) +
	 LEFT$(FNST$(CVS(A$)),(LEN(FNST$(CVS(A$)))-4))+B$ +
	 LEFT$(RIGHT$(FNST$(CVS(A$)),4),2)+B$ +
	 RIGHT$(FNST$(CVS(A$)),2)

Pad string on right or left to a specific length:
Call with A$ = String — A = maximum length to output

DEF FNRSPC$(A$,A)=LEFT$(A$+SPACE$(A),A)
DEF FNLSPC$(A$,A)=RIGHT$(SPACE$(A)+A$,A)

Creating /CMD Files from LDOS LIB Commands

These remarks are an attempt to explain how you may create CMD files, the only purpose for which is to have more disk space available for data files or whatever.

Using cmdfile you merely call for SYS6 or SYS7, depending where the routine you wish is located, and then give the overlay number when requested. these numbers may be found by reading a download of sys1 with the extended debugger. to make it easier i am listing them below:

APPEND
31
ATTRIB
51
AUTO
11
BOOT
A9
BUILD
33
CLOCK
17
COPY
32
CREATE
13
DATE
15
DEBUG
14
DEVICE
61
DIR
21
DO
91
DUMP
71
FILTER
66
FREE
22
KILL
18
LIB
19
LINK
62
LIST
41
LOAD
81
MEMORY
1E
PROT
52
PURGE
72
RENAME
53
RESET
63
ROUTE
64
RUN
82
SET
65
SPOOL
A2
SYSTEM
A1
TIME
16
TRACE
1A
VERIFY
1B
XFER
73

I’ll leave it to you to figure out to which sys file each of these belongs, reminding you that it is obligatorily SYS6 or SYS7. Let’s assume you wish to create a CMD file of the copy command. Merely enter the number 32 when you are requested. it is not necessary to change addresses or transfer addresses, since you will be using the command file exactly as you would have used the library routine. Save the file with a different name since if you call ‘copy’ the parsing routine will load the routine from SYS6 and not your COPY/CMD file. In any case, you would only wish to create these cmd files to replace SYS6 and SYS7, reducing the overhead on your disk. This is especially useful for users with only disk drive. Since these routines, when changed into cmd files, will occupy a full gran of 5 sectors (6 on double density), it is clear that if you create too many such files, you will have defeated the purpose of eliminating the SYS6 and SYS7 files! as for names of the corresponding files, i should opt for names similar enough to the library commands to avoid confusion with yourself, ccopy for copy, ddir for dir, etc.

Finally, for those who wish to better understand the principle employed with the library, i will explain how a routine is parsed and then loaded and run from its sys file. When you enter a command, it is parsed by SYS1, and a table with the names of all the LIB routines, each followed by the index no. shown above. Following that number is an 80 or a c0, which tells the system to look for the in SYS6 or SYS7. within the SYS6 or SYS7 file a search is made for the index number. this number is followed by the starting address of the routine once loaded and the relative sector number and relative byte where the routine is located within the sys file. The routine is loaded and executed.

I hope these remarks will assist any interested users in better understanding both my idea of creating command files to save space, and of the library routines themselves.


Guided Tour Through The Model III TRSDOS Directory

This article will describe and explain the important features of the Model-III TRSDOS directory. You’ll see that it is quite similar in most respects to the Model-I directory except for the way in which the DOS SYSTEM files are handled.

As in the Model-I, the directory is located on Track #17 (11H), and occupies the entire track. Because of the Model-III’s double density format, this amounts to 18, 256 byte sectors. The first sector (#0) contains the Granule Allocation Table (GAT), the diskette Master Password encode, the diskette name and any AUTO command which may be active. Sector #1 contains the Hash Index Table (HIT) and the information by which TRSDOS is able to locate the SYSTEM files. The remaining sixteen sectors of the directory track contain the directory entries for the diskettes user files, five entries per sector.

Let’s take a look at Track #17 in detail:

  1. Sector #0 (the GAT sector) – The first 40 bytes (00H to 27H) make up the GAT and represent Tracks 0 to 39 on the diskette. Each byte is a “bit map” of the allocated granules in the corresponding track. Bits 0 through 5 represent the 6 granules of the track and bits 6 and 7 are not used (always 0). Thus, a fully allocated track would appear as a ‘3F’ in the GAT. In binary this would be 00111111. If a byte is ’25’, a binary 00100101, it means that the first, third and sixth granules are allocated.

    Bytes CEH and CFH of Sector #0 are the encoded Master Password for the diskette. This is normally D38F for “PASSWORD”. Bytes D0H – DFH are the diskette’s name in ASCII and the creation date in MM/DD/YY format. Bytes E0H – FFH are used to store any AUTO command which may have been set up for the diskette. If byte E0H is a ‘0D’ (carriage return), no AUTO command is in effect.
  2. Sector #1 (the HIT sector) – The first 80 bytes (00H to 4FH) make up the Hash Index Table (HIT). Each non-zero byte is the hash code for an active file in the directory, and its position in the HIT indicates in which sector and where in the sector the directory entry is located. For example, on a standard Radio Shack TRSDOS diskette, the first two bytes are ‘F0’ and ‘F4’, which are the hash codes for BASIC/CMD and CONVERT/CMD. A glance at Sector #2 will confirm that these files are the first two entries in that sector. The Model-III uses the same algorithm as the Model-I for computing hash codes.

    Bytes E0H – FDH are used to store the size and location of the TRSDOS SYSTEM files. There are 15 pairs of bytes and each pair represent one of the SYS files. The first byte of the pair contains the granule offset and the size of the file in granules. The second byte of the pair is the number of the track in HEX where the file starts. To see how this works, let’s take a look at bytes E4H-E5H which are ‘4210’. The ’42’ is 01000010 in binary notation. Because the byte has two pieces of information embedded in it, we’ll write it as 010 00010. The ‘00010’ is the granule count for the file, which is TWO. The ‘010’ is the granule offset from the start of the track which is also TWO. Remember that a granule is three sectors in the Model-III. The second byte of the pair is ’10’ which means that the file starts on Track #16 (10H). Putting it all together, we see that the file starts on Track #16 (10H), beginning on Sector #6 (offset of TWO granules) and occupies TWO granules or six sectors. This particular file, by the way, is very similar to SYS2/SYS on the Model-I. The fifteen pairs of bytes in this area represent the TRSDOS resident module and fourteen overlay modules making up the entire DOS. The sixteenth pair is presently ‘FFFF’ and is not in use, no doubt being reserved for a future overlay, like a spooler (just a guess). Since the user never calls the DOS modules directly, they need not have names and the information in these byte pairs is all that TRSDOS needs in order to locate them when program execution calls for them.
  3. Sectors #2 through #17 (Named directory entries) – There is room for five, three line (48 byte) directory entries on each of these sixteen sectors. This gives a total capacity of 80 named files. The sixteenth line on each sector is not used, so Radio Shack placed a ‘(c) 1980 Tandy’ on it as a filler. Let’s look at the first entry in Sector #2 to see how it is constructed. This is the entry for BASIC/CMD and it looks like this:
    5E08 5000 0042 4153 4943 2020 2043 4D44
    0000 EF5C 1200 0E06 FFFF FFFF FFFF FFFF
    FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

    The first byte, ‘5E’, contains the file type, its visibility and protection level. In binary this is 01011110 and we’ll write it as 0 1 0 1 1 110 to make it easier to break it down. Bits 0-2 are the protection level. In this case, it is 6 (EXECute only). Bit 3 is the visibility bit. A ‘1’ means that the file is invisible, as in this case. If bit 4 is a ‘1’, the file is an active file and has a corresponding HIT entry. Bit 5 is usually ‘0’, but if it should be a ‘1’, it means that the file has a backup limitation. Radio Shack has said in a newsletter that certain programs like Scripsit and VisiCalc will be limited to two backup copies. Whether this can circumvented by setting bit 5 to ‘0’, I have no idea. Might be worth trying. If bit 6 is a ‘1’, the file is a SYSTEM file. If it is a ‘0’, it is a USER file. If the Model-III TRSDOS has been set up using the same methods as the Model-I, bit 7 will be ‘0’ for a Primary directory entry and will be a ‘1’ for an EXTENDED directory entry. I don’t know if this is true for the Model-III. If not, a file will be limited to 12 extents. In any case, bit 7 is ‘0’ for all my files.

    The second and third bytes are simply the file creation month and year in HEX, in this case ’08 50′, meaning 08/80. The fourth byte shows the location of the EOF byte in the file’s final sector. The fifth byte is the Logical Record Length of the file (00 means 256 bytes). The sixth through the sixteenth bytes are the file name in ASCII, in this example, BASIC CMD.

    Bytes 17-18 and 19-20 are the UPDATE and ACCESS password encodes, respectively. For this file, we see ‘0000 EF5C’. ‘EF5C’ is the code for NO password, so BASIC/CMD has an UPDATE password assigned but no access password.

    Bytes 21-22 indicate the total number of sectors in the file in LSB-MSB format. So BASIC/CMD has 18 (12H) sectors.

    The next 26 byte are arranged in pairs and are used for the file EXTENTS. ‘FFFF’ indicates no further extents. The first byte is the number in HEX where the extent begins. In our example, this is ‘0E’ meaning Track #14. The second byte of the pair contains the file’s granule count and offset, encoded in exactly the same way as for the TRSDOS system modules. For BASIC/CMD, this byte is ’06’ which is 000 00110 in binary notation. Thus BASIC/CMD occupies 6 granules and starts at the beginning of the track (no offset).

Formatting A Double-Sided Diskette Under TRSDOS 6.x / LDOS 5.1.x and 6.x – Jeffrey Brenton

TRSDOS 6.x is an advanced version of the LDOS operating system designed for use on all-RAM computers using the Z80 processor. TRSDOS 6.x supports a variety of disk types, although only a few are documented in the official Tandy documentation. Drive types supported include:

  • 5″ mini-floppy in single- and double-density, single- and double-sided, with cylinder counts of up to 96.
  • 8″ floppy in single- and double-density, single- and double-sided and 77 cylinders.
  • Hard (or “rigid”) drives of various sizes, cylinder and head counts.

All that is required to take advantage of these disk types is the hardware itself and the proper “driver” to control it. Full support for all 5″ drive types is included with the basic TRSDOS system, but only 40-track, single sided operation is documented.

To use a double-sided drive under TRSDOS, all that is necessary (apart from the drive itself) is to format the diskette for two sides. In non-Tandy versions of LDOS 6.x, the FORMAT utility will prompt the user for the number of sides to format, however Tandy asked that this prompt be bypassed due to the fact that they do not sell a double-sided drive for the model 4. You can still format for two sides, though. All that is necessary is to specify “SIDES=2” in the parameter section of your command line.

Thus: FORMAT :1 (cyl=80,sides=2) will format drive 1 for 80 tracks and 2 sides. FORMAT will ask for disk name and master password.

If you wish to then use this double-sided diskette as your “boot” diskette, you *must* be sure that SYS0/SYS begins with the first sector of a cylinder. The only way to guarantee this is to back it up to the blank diskette *first*. To do this, use the command: BACKUP SYS0/SYS:0 :1 (S)

Follow that with: BACKUP SYS/SYS:0 :1 (NEW)



Defeating TRSDOS v6.x Backup Protection

To defeat backup protection on TRSDOS 6.x disks:

10 OPEN "R",1,"BOOT/SYS.LSIDOS:0"
20 GET 1, 3: POKE VARPTR (#1) + 198,0
30 PUT 1,3: CLOSE: END

Reading a Model 4 TRSDOS 6.0 or a Model III LDOS disk on NEWDOS/80

To read a Model 4 TRSDOS 6.0 or a Model III LDOS disk directly on NEWDOS/80 V.2, use this PDRIVE setting:

TI=A, TD=E, TC=40, SPT=18, TSR=3, GPL=6, DSL=12, DGA=2

Running SYSTEM Commands from Model 4 BASIC – Colin Dunn

You can execute DOS commands from BASIC by using the RUN library command of TRSDOS.

Example: SYSTEM"RUN COMM *CL" will run the COMM/CMD program.

Note: SYSTEM"COMM *CL" will result in an error message – you MUST use the RUN command.


Renaming DOS Commands – Colin Dunn

If you hate the commands that the Shack set up for TRSDOS 6.x, you can change them!!! Using your file editor, read in SYS1/SYS.LSIDOS. The DOS commands are contained within the file. You can change the bytes of the commands to get a new command. If the command falls short of 6 characters, fill the rest of the space with 20H (32 decimal). Example: Change DIR to D, REMOVE to K.


Using TRSDOS or LDOS to Write Protect

To use LDOS or TRSDOS 6.x to write-protect disks in drive 1:

From LDOS READY type: SYSTEM (DRIVE=1, WP=Y) (or WP=N to unprotect).

From TRSDOS READY type: WP (DRIVE=1) (or WP to unprotect).


Addresses of TRSDOS 6.2 Routines – Colin Dunn

Ah, the glory of rebelling against the untrue statements in the TRSDOS 6.2 manual. The manual says that you should not call any DOS routines without using the SVC’s (LD A,x and RST 28H). Why not escape this waste of source and use a CALL xxxxH instruction? It is also faster because DOS won’t need to look up the SVC’s in the table. The Shack would scream if us programmers were making TRSDOS 6.2 run faster than a snail…but is it worth the pain of the scream to save the ENDLESS pain of RST 28H instructions? Also, now that we have the addresses to all the SVC’s, let’s get the disassemblers into action and disassemble this DOS 6.2 thing and disseminate the good new undocumented addresses. One catch is that this is not guaranteed to work on DOSes other than 6.20. DO NOT USE TRSDOS 6.21 has it has a bug that erases parts of files on the disk! It just totally ignores the granule allocation table! Well, I think I’ve said enough of this crap, so let’s get to business. The rules for calling the DOS routines are the same as for the SVC’s, except instead of LD A,x and RST 28H you CALL xxxxH. The registers must be the same on entry. The exit conditions remain the same. It is still advisable to PUSH AF when calling DOS routines because the routines may internally use AF. For an explanation of the routines (DOS names have been used in this file), see your copy of the Model 4 TRSDOS manual.

@IPL
1BF2H
@KEY
0628H
@DSP
0642H
@GET
0638H
@PUT
0645H
@CTL
0623H
@PRT
063DH
@WHERE
1979H
@KBD
0635H
@KEYIN
0585H
@DSPLY
052DH
@LOGER
0503H
@LOGOT
0500H
@MSG
0530H
@PRINT
0528H
@VDCTL
0B99H
@PAUSE
0382H
@PARAM
1987H
@DATE
07A8H
@TIME
078DH
@CHNIO
0689H
@ABORT
1B08H
@EXIT
1B0BH

SVC #23 (012EH in the table) is undefined. It points to 1AF4H (displays SYSTEM ERROR 2BH)

@CMNDI
197EH
@CMNDR
197BH
@ERROR
1B0FH
@DEBUG
19A0H
@CKTSK
1CF5H
@ADTSK
1CDAH
@RMTSK
1CD7H
@RPTSK
1CEBH
@KLTSK
1CD0H
@CKDRV
1993H
@DODIR
19AFH
@RAMDIR
19ACH

SVC #36-39 (0148H-014FH in the table) are undefined. These locations contain 1AF4H (a call that returns SYSTEM ERROR 2BH, SVC PARAMETER ERROR)

@DCSTAT
19B5H
@SLCT
19BCH
@DCINIT
19C0H
@DCRES
19C4H
@RSTOR
19C8H
@STEPI
19CCH
@SEEK
19D0H
@RSLCT
19D4H
@RDHDR
19D8H
@RDSEC
19F4H
@VRSEC
19DCH
@RDTRK
19E0H
@HDFMT
19E4H
@WRSEC
19E8H
@WRSSC
19ECH
@WRTRK
19F0H
@RENAM
1996H
@REMOV
19A6H
@INIT
198DH
@OPEN
198AH
@CLOSE
1999H
@BKSP
1486H
@CKEOF
158FH
@LOC
14B3H
@LOF
14DEH
@PEOF
14A2H
@POSN
1434H
@READ
1513H
@REW
149BH
@RREAD
1473H
@RWRIT
13ADH
@SEEKSC
1421H
@SKIP
1430H
@VER
1560H
@WEOF
14ECH
@WRITE
1531H
@LOAD
1B38H
@RUN
1B1DH
@FSPEC
1981H
@FEXT
1984H
@FNAME
199CH
@GTDCT
1A1EH
@GTDCB
1990H
@GTMOD
19B2H

SVC #84 RETURNS SYS ERROR 2B – LOCATION IN TABLE IS 01A8H

@RDSSC
18D8H

SVC #86 IS A MYSTERY SVC NOT LISTED IN THE MANUAL. IT CALLS A ROUTINE AT 1874 HEX THAT I CAN’T FIGURE OUT. ANYONE KNOW WHAT THIS ONE’S FOR?

@DIRRD
18BBH
@DIRWR
1803H

SVC #89 IS ANOTHER MYSTERY THAT JUMPS TO ADDRESS 1875 HEX.

@MUL8
190AH
@DIV16
06C9H

SVC #92 RETURNS SYS ERROR 2B – LOCATION IN TABLE IS 01B8H

@DIV8
1927H
@DIV16
06E3H

SVC #95 RETURNS SYS ERROR 2B – LOCATION IN TABLE IS 01BEH

@DECHEX
03E1H
@HEXDEC
06F6H
@HEX8
07C2H
@HEX16
07BDH
@HIGH$
1948H
@FLAGS
196AH
@BANK
0877H
@BREAK
196FH
@SOUND
0392H
@CLS
0545H
@CKBRKC
0553H

SVC’S #107-#127 are free for you to use. SVC #107 is found in location 01D6H. Each one after that is found two bytes later. You can use the following formula to calculate exact locations (under DOS 6.20):

LOC=0100H+SVC*2

Where SVC is the number of the SVC you wish to program. You CAN program OVER the DOS SVC’s, but should you use this practice, use the @IPL SVC (#000, address 1BF2H) to exit your program. If you don’t wish to reboot, store the original SVC table in a buffer as follows:

LD HL,0100H
LD DE,BUFFER
LD BC,0100H
LDIR

The SVC table is 256 bytes long and is ALWAYS found on a page boundary (even multiples of 100 hex). Should the SVC table get moved, you can get its starting address by using this code…

LD A,101
RST 28H
LD A,(IY+26)
LD H,A
LD L,0
; NOW HL HAS THE ADDRESS - MSB IS IN H, LSB ALWAYS ZERO.

NOTE: If the SVC table got moved, the addresses provided above would be wrong.


Enabling and Disabling the DATE and TIME Prompts on TRSDOS v1.3

To Enable:

PATCH *0:0 (ADD=4EA9,FIND=C3,CHG=CA)

To Disable:

PATCH *0:0 (ADD=4EA9,FIND=CA,CHG=C3)

Trading Files Between LDOS6.2 and NEWDOS/80 v2.0 – Chris Anderson

One of the things I quickly discovered as I began working with my new Model 4P was that there was going to be a need to move data back and forth between my old NEWDOS disks and LDOS6 disks. The following procedure is very straightforward, and will work without hassle for those important data files.

Note: The following procedure requires at least two drives!

NEWDOS80 V2 to LDOS v6.2

  1. Boot under LDOS6.2.
  2. Format a disk SSSD, 35 tracks. You MUST use single side, single density and 35 tracks, regardless of the type of drive you are actually using!
  3. Boot NEWDOS80 V2. (Note, if you are a 4P owner, and are having problems booting NEWDOS, see the info file on this topic)
  4. Set the PDRIVE for the drive where the LDOS disk resides to TI=A,TD=A,TC=35,SPT=10,GPL=2,DDSL=17,DDGA=2.
  5. Use the normal NEWDOS Copy command to copy the file from your NEWDOS80 disk to the LDOS disk.
  6. Reboot the system using LDOS6.2.
  7. Use the RESET command or TSK/CMD if you have several copied files) to CLOSE each of the copied files. NEWDOS is not familiar with the open/closed status, and will leave each file open when copying it over to LDOS.

That’s all there is to the job in that direction. Going the other way is just as easy.

LDOS v6.2 to NEWDOS80 V2

Perform the steps above in the following order:

  1. Boot in 6.2
  2. Format as noted above. Then, copy files as desired to the newly formatted disk while still in LDOS.
  3. Boot NEWDOS.
  4. Set PDRIVE as noted above.
  5. Use normal NEWDOS copy command to move files from the LDOS disk to the NEWDOS disk.

Provided you have a Model 4 (and not a 4P) you may also find that it is fairly fast to use Multidos for this sort of thing.


Configuring LDOS like NEWDOS/80 – Rowan Evans

At last we have some questions to answer on LDOS!! The first one comes from a Newdos 80 user, who wants to know “How to configure LDOS, and what all the /DVR and /FLT files do”, and the second from a TRSDOS 6.x user who wants to access the system status flags from within a BASIC program.

Configuring LDOS:

The first thing that should be done to configure LDOS for the system you use is to list the options that your system needs- e.g. Double Density, Printer Driver, etc. The easiest way to do this is to list your current Newdos configuration, or if you don’t use Newdos, your hardware and its requirements.

  1. Using an existing Newdos system configuration list.
    I have listed the Newdos configuration options below and their LDOS counterparts. Items marked + cannot be SYSGENed under LDOS. Items marked * can be done if a driver or filter is written.
    SYSTEM
    LDOS
    +AA
    Password enable – LDOS passwords are always enabled, with the option of a “Global” password to allow access to ANY file (password is “RS0LT0FF”).
    AB
    Run only – this is possible under LDOS by forcing a non-breakable AUTO with the SYSTEM option BREAK=N.
    AC
    Debounce routine On/Off – LDOS does its debounce through the KI/DVR, so by disabling it, debounce is disabled.
    AD
    “JKL” screen print On/Off – This is also a function of the KI/DVR.
    AE
    “123” invokes debug -press BREAK instead once debug is activated.
    AF
    “DFG” invokes miniDOS -install LDOS’ MINIDOS/FLT then by pressing CLEAR and then another key, several minidos functions are available –
    <CLEAR> & “C” – Clock on/off.
    <CLEAR> & “D” – Enter Debug.
    <CLEAR> & “F” – Free space on all active drives.
    <CLEAR> & “K” – Kill a file.
    <CLEAR> & “P” – Send a character to the printer.
    <CLEAR> & “Q” – Directory of selected disk drive.
    <CLEAR> & “R” – Repeat last DOS command.
    <CLEAR> & “T” – Send form feed to printer.
    AG
    Break key status – use LDOS’ command SYSTEM (BREAK=ON/OFF).
    AH
    Not defined in Newdos 80 version 2.
    AI
    Lower case modification installed in computer – LDOS senses this automatically at power up/reset.
    AJ
    Keyboard intercept routine active (debounce on/off, repeat on/off and ‘JKL’,’123′ and ‘DFG’ are activated solely by interrupts) -the LDOS *KI driver is used to activate these functions, either SET *KI KI/DVR or RESET *KI.
    AK
    Not defined in Newdos 80 version 2.
    AL
    Number of drives on the system -use LDOS’ command SYSTEM (DRIVE=n,ENABLE/DISABLE) to set the correct number and address of the drives in the system.
    *AM
    number of retries for disk I/O -only possible to alter if you write a driver routine for a specific drive there are several example disk drivers published in various magazines.
    +AN
    default drive for the directory command -LDOS doesn’t allow this, instead typing just DIR will give the directories for ALL currently mounted (and enabled) disk drives in the system.
    +AO
    first drive to write a default filedto (ie where the user has not specified the drive number in the command) -LDOS allows this via the SYSTEM (DRIVE=n,WP) command to software write protect any drive that you don’t want to write a file to.
    AP
    DOS high memory value to be inserted at bootup -use the LDOS command MEMORY (HIGH=X'nnnn') then do a SYSTEM (SYSGEN).
    AQ
    CLEAR key enable/disable -no equivalent function in LDOS apart from the *KI driver.
    +AR
    password enable/disable for full disk backup -LDOS does not allow the enabling and disabling of passwords like Newdos however the LDOS BACKUP can be subverted to allow the full disk backup of a disk with an unknown password.
    *AS
    BASIC converts quoted strings to upper case – no equivalent function in LDOS.
    +AT
    do files will only accept string input requests from the /JCL file, single key inputs will be requested from the keyboard – LDOS /JCL files do not allow this, however the LDOS JCL does allow for //KEYIN and //INPUT to get keyboard input during execution of a do file.
    *AU
    repeat key function on/off – no equivalent function in LDOS.
    *AV
    wait for specified number of milliseconds before repeating the last key held down – no equivalent function in LDOS.
    AW
    write with verify disk I/O retries – no equivalent function in LDOS.
    *AX
    number specified is that of the highest printable ASCII character to be sent to the printer -dhis can be done through an LDOS filter.
    AY
    ask operator for time and date on/off – LDOS allows the time and date questions to be bypassed (under version 5.1.x) by using the commands SYSTEM (DATE=ON/OFF) and SYSTEM (TIME=ON/OFF).
    AZ
    force the operator to re-input time and date after reset on/off – no equivalent function in LDOS.
    BA
    reset disables VDU display on/off – this can be done by doing a ROUTE *DO NIL and then a SYSTEM (SYSGEN).
    *BB
    50/60 Hz clock notification – see TIME50 in the LDOS Quarterly Vol 2 Number 5 page 22 to fix the Mod III real time clock. NOTE -this notification does NOTHING under Newdos 80 – refer to the manual!!!
    BC
    operator pause/cancel chaining on/off – no equivalent function in LDOS.
    +BD
    operator override of AUTO command on/off -done in LDOS when the AUTO command is set up by issuing the command – AUTO *command.
    *BE
    enable/disable dos ‘R’ repeat command – can be done by patch to MINIDOS/FLT if desired.
    BF
    lower case driver activate – not needed.
    BG
    set keyboard to lower case -done by pressing SHIFT + 0 and then doing SYSTEM (SYSGEN).
    BH
    enable/disable cursor blinking -dse the command SYSTEM (BLINK=ON/OFF) or SYSTEM (BLINK=LARGE/SMALL).
    BI
    set the cursor to specified character – use the command SYSTEM (BLINK=[ASCII value]).
    BJ
    system speed up control – use the LDOS command SYSTEM (FAST/SLOW) which not only changes the timing loops like Newdos,but also will change the CPU speed if the speed mod is addressed through port 254 and is switched on using 1 and off using 0.
    BK
    enable/disable command WRDIRP and the W and C functions of DIRCHECK – no equivalent function in LDOS as the disk format from Mod I to III to 4 are IDENTICAL in double density
    BM
    enable/disable separate verify pass during format – no equivalent function in LDOS.
    +BN
    write single density disk data address mark for either Model I TRSDOS or Model III Newdos 80 – use the LDOS utility REPAIR (ALIEN).
  2. Having chosen the required configuration alternatives, install them into LDOS by issuing the necessary commands.
  3. When you are certain that all your chosen functions are operational, type SYSTEM (SYSGEN) to get LDOS to create a configuration file and write it to drive 0. Please note that EVERYTHING in high memory (including SYSRESed /SYS files) will be included in this file, so ensure that you have sufficient room on the floppy to save the file.
  4. Once the configuration file is written, power down and then back up again to get a cold start of the system. I have found that some configurations will appear OK if a warm start test is done, but not if a cold start test is done – particularly if the disk is a SOLED double density boot disk.
  5. A typical configuration for a system with 3 drives is –
    PDUBL – for double density.
    SET *KI KI (TYPE,JKL) – type-ahead, JKL, etc.
    SYSTEM (BLINK=143) – blinking block cursor.
    SYSTEM (DRIVE=3,DISABLE) – drives 0, 1 & 2 only.
    SYSTEM (DRIVE=2,STEP=1) – drive 2 is 12 m/s step.
    SYSTEM (TYPE) – activate type-ahead.
    FILTER *KI MINIDOS – activate MiniDOS.
    FILTER *PR PR (ADDLF) – add linefeeds to printer.
    ZSHELL – Misosys command processor.
  6. Type SYSTEM (SYSGEN)

Setting MEMORY SIZE inside DOS BASIC

If you are in Model I DOS BASIC and forgot to set Memory Size. Do the following, and it will re-set the memory size. While it will say LEVEL II BASIC it will still be DOS BASIC.

SYSTEM
*? /177

2 Comments

  1. I’m trying to make a copy of my TRSDOS v6 disk, and the basic code listed here to defeat the backup protection doesn’t seem to be working. I load BASIC, enter the code and run it, then I get a “File access denied in line 20” error. I double checked the code and it’s correct. The disk is not write protected.

    Any idea on this?

    EDIT FROM IRA – Turns out that the user was trying to use a TRSDOS patch on LDOS. The above patch does not work on LDOS.

    Reply
  2. Hi, Ira –
    I’ve been moving some of the files you’ve given me on MOD3 NEWDOS80 disks to the LDOS system on Peter Bartlett’s M3SE. The sequence posted above for moving files from NEWDOS80 to LDOS states that you need 2 disks. Since the latch on my Drive 1 on my MOD3 died shortly before installing my M3SE, I had to modify the procedure to work with ONE drive. It does… when you use the COPY $filespec in NEWDOS80. Here’s the modified sequence:

    1) Boot under LDOS6.2.
    2) Format a disk SSSD, 35 tracks. You MUST use single side, single density and 35 tracks, regardless of the type of drive you are actually using!
    3) Boot NEWDOS80 V2.
    4) Set an inactive PDRIVE slot for the following settings (I use 5):
    PDRIVE 0 5 TI=A TD=A TC=35 SPT=10 TSR=3 GPL=2 DDSL=17 DDGA=2
    5) Your active (drive 0) pdrive should be: TI=A TD=E TC=40 SPT=18 TSR=3 GPL=2 DDSL=17 DDGA=2
    6) Use the NEWDOS Copy $ command to copy the file from your NEWDOS80 disk to the LDOS disk using COPY $filespec/ext:0 filespec/ext:0 SPDN=0 DPDN=5. Make sure you have and keep the SOURCE, DESTINATION, and SYSTEM disks organized during this process.
    7) Reboot the system using LDOS6.2.
    8) You can copy the files from the SSSD LDOS floppy to your LDOS system at this point.

    Reply

Leave a Comment.