DOS Tips and Tricks – Page Index
LDOS Tips
TRSDOS Tips
Miscellaneous Tips
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:
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:
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
LDOS 6.x for the Model 4 System Files and Purposes – LDOS Manual
Increasing The Number of Drives in LDOS – Frank Durda IV
To turn floppies 2 and 3 on immediately, but only for the current session:
To make this permanent, SYSGEN these settings or make these commands part of the boot jcl.
Passwords (ALL DOS’S)
TRSDOS Passwords (Model I)
TRSDOS Passwords (HD4)
LDOS Passwords – Tim Mann/Frank Durda IV
Disabling Password Checking
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.
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:
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:
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:
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.
SVC #23 (012EH in the table) is undefined. It points to 1AF4H (displays SYSTEM ERROR 2BH)
SVC #36-39 (0148H-014FH in the table) are undefined. These locations contain 1AF4H (a call that returns SYSTEM ERROR 2BH, SVC PARAMETER ERROR)
SVC #84 RETURNS SYS ERROR 2B – LOCATION IN TABLE IS 01A8H
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?
SVC #89 IS ANOTHER MYSTERY THAT JUMPS TO ADDRESS 1875 HEX.
SVC #92 RETURNS SYS ERROR 2B – LOCATION IN TABLE IS 01B8H
SVC #95 RETURNS SYS ERROR 2B – LOCATION IN TABLE IS 01BEH
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:
To Disable:
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
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:
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.
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.
<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.
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.
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.