TRS-80 Tips and Tricks – DOS Tips and Tricks

How to Make a Custom LDOS Boot Disk – Patrick

To make a custom LDOS boot disk with, let’s say, a different number of tracks, follow this procedure:

  • FORMAT (ENTER)
  • BACKUP SYS0/SYS:0 :1 (SYS)
  • BACKUP :0 :1 (SYS,NEW)
  • BACKUP :0 :1 (INV,NEW)
  • SYSTEM (SYSGEN,DRIVE=1)
  • Making a Double Sided Boot Diskette

    LDOS requires that SYS0/SYS be on SIDE 0 of a diskette, and does not have enough code loaded to understand how to process SIDE 1. SYS0/SYS, however, is way too large to fit on SIDE 0 if a disk is formatted double sided — some of it will spill over onto SIDE 1. With this, you need to use a program written by KNUT ROLL-LUND to force SYS0/SYS to be on SIDE 0 only.

    The steps are:

  • FORMAT :1
  • BACKUP SYS0/SYS:0 :1 (I,S)
  • TWOSIDER :1
  • BACKUP :0 :1 (I,S)
  • 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
    	LINK *CL *DO

    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 the 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

    File
    Status
    Purpose
    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

    LDOS 6.x for the Model 4 System Files and Purposes – LDOS Manual

    File
    Status
    Purpose
    SYS0/SYS
    Mandatory
    Contains the SYSRES functions, and loaded by BOOT/SYS. This SYS file contains the file read/write, position and allocation routines, [2] SVC handling, overlay loading, and command file loading, [3] Interrupt processing, [4] System initialization, [5] sound, pause, and other low memory routines, and [6] the logo.
    SYS1/SYS
    Mandatory
    This SYS file is the primary command interpreter. It also includes @CMNDI, @CMNDR, @FSPEC, @FEXT, @PARAM, @EXIT, and @ABORT
    SYS2/SYS
    Mandatory
    Creates, opens, and renames files, as well as hashing filenames and passwords, checking a drive for a mounted diskette, and locating a DCB. It also includes @INIT, @OPEN, @RENAME, @GTDCB, and @CKDRV
    SYS3/SYS
    Mandatory
    Closes a file or device, and restores an original filespec or drivespec to the Control Block. Will also de-allocate space if a CLOSE results in a smaller file than it was on OPEN. It also includes @CLOSE and @FNAME
    SYS4/SYS
    Mandatory
    System error routines. Includes @ERROR
    SYS5/SYS
    Optional
    System debugger, called either by BREAK or @DEBUG
    SYS6/SYS
    Optional
    Contains all routines necessary to service the LIBrary “A” commands: APPEND, CAT, CLS, COPY, DEVICE, DIR, DO, FILTER, LIB, LINK, LIST, LOAD, MEMORY, REMOVE, RENAME, RESET , ROUTE, RUN, SET, TOF
    SYS7/SYS
    Optional
    Contains all routines necessary to service the LIBrary “B” commands: ATTRIB, AUTO, BUILD, CREATE, DATE, DEBUG, DUMP, FREE, PURGE, TIME, VERIFY
    SYS8/SYS
    Optional
    Contains all routines necessary to service the LIBrary “C” commands: FORMS, SETCOM, SETKI, SPOOL, SYSGEN, SYSTEM
    SYS9/SYS
    Optional
    Extended system debugger (himem)
    SYS10/SYS
    Mandatory
    KILL a file or device. Contains @REMOV
    SYS11/SYS
    Optional
    Executes a JCL file
    SYS12/SYS
    Mandatory
    Two mini-directory and free space SVC’s as well as locates or checks for a memory module header. Contains the code for @DODIR, @RAMDIE, and @GTMOD
    SYS13/SYS
    Optional
    Any CMD file which bears the name SYS13/SYS.LSIDOS can be run from the command line simply by the use entering a *

    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
    Backup Password
    Always try PASSWORD first.

    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.

  • 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.
  • 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.
  • 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 appropriate 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.

    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

  • Boot under LDOS6.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!
  • Boot NEWDOS80 V2. (Note, if you are a 4P owner, and are having problems booting NEWDOS, see the info file on this topic)
  • 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.
  • Use the normal NEWDOS Copy command to copy the file from your NEWDOS80 disk to the LDOS disk.
  • Reboot the system using LDOS6.2.
  • 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:

  • Boot in 6.2
  • Format as noted above. Then, copy files as desired to the newly formatted disk while still in LDOS.
  • Boot NEWDOS.
  • Set PDRIVE as noted above.
  • 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.

  • 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 fileto (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 -this 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 -use 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).
  • Having chosen the required configuration alternatives, install them into LDOS by issuing the necessary commands.
  • 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.
  • 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.
  • 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.
  • 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

    Using a Single Disk in a Double Sided Drive as Two Single Sided Disks

    MultiDOS has the ability, for those with double sided disk drives, to format each side of the disk as a separate side, each side being accessible without ejecting or flipping the disk!

    To do this, MultiDOS will use the drive number alone (i.e., 1) for Side 0 of that drive and the drive number with an apostrophe (i.e., 1′) for Side 1

    If you are fortunate enough to have a double sided drive, you can do this in one easy step:

    Type CONFIG :1 (SIDES=2) and press ENTER.

    You can verify that it took by typing in CONFIG and pressing ENTER. If you did it right, the line for Drive 1 will now say “2 side(s)”.

    If you want to format the second side, simply run FORMAT but type 1′ instead of 1. Same for every DOS command which takes a drivespec.