background image

Summary of Contents for TRS-80

Page 1: ...TER Contents 1 General Information 2 Mini Disk Operation 3 TRSDOS Overview 4 TRSDOS Commands 5 Extended Utilities 6 TRSDOS Technical Information 7 DISK BASIC 8 Appendices Index CUSTOM MANUFACTURED IN...

Page 2: ......

Page 3: ...S DISK BASIC Reference Manual For the Radio Shack TRS 80 Disk Operating System TRSDOS Version 2 1 DISK BASIC Version 1 1 Radio haek Ma DIVISION OF TANDY corporation One Tandy Center Fort Worth Texas 7...

Page 4: ...s Neither is any liability assumed for damages resulting from the use of the information con tained herein Copyright 1979 Radio Shack A Division of Tandy Corporation Fort Worth Texas 76102 U S A All T...

Page 5: ...lug right in to this manual along with DISK BASIC But don t think you have to read the manual in strict sequence If you re an old hand at LEVEL II BASIC and you want to start out with DISK BASIC go ah...

Page 6: ......

Page 7: ...General Information Radio Jhaek TRS BO MICRO COMPUTER SYSTEM v J Contents of This Section Introduction Notation Conventions Versions and Releases 2 3 6 Section 1 Page 1...

Page 8: ...ride comfortably along in BASIC but eventually you re going to want to have a say in where the train goes what its schedule is and what goes in all those freight cars That s when you need to understan...

Page 9: ...TRSDOS onto a blank diskette You ll find abbreviated instructions for making a duplicate BACKUP of your TRSDOS diskette at the end of the Mini Disk Operation chapter Notation Conventions In descripti...

Page 10: ...d an expression goes on the right Brackets enclose optional material Example CLOSE filenum filenum the file number is optional after CLOSE The brackets are not actually typed in The triple period symb...

Page 11: ...xpression including constants variables functions Numerical variable name String expression including constants in quotes variables functions and operators String variable name Constant either string...

Page 12: ...by the integers 1 2 3 A new release on the other hand is simply an update of the previous release of a given version This later release generally includes wider implementations and enhancements of co...

Page 13: ...on 5 Care of Diskettes 8 Specifications 10 Schematics 11 Making a TRSDOS BACKUP 16 Note Abbreviated instructions for making a BACKUP duplicate of your TRSDOS software diskette are included at the end...

Page 14: ...process and the motor speed See Figures 1 and 2 There are two types of drives distinguished by their Radio Shack Catalog Numbers 26 1 160 and 26 1 161 Your disk system must include one and only one 2...

Page 15: ...ed so the cable exits from the bottom Before connecting the Drive s to the cable note the following rules 1 26 1 160 must always be the terminal or final drive on the cable that is of all your drives...

Page 16: ...drive must be 26 1 160 then connect it to the first connector plug so as not to leave any empty connectors between the Drive and the Expansion Interface Leave the last three connectors empty If you h...

Page 17: ...k The disk drive does not rotate continuously while it is on It only rotates when a Motor On signal is sent from the Computer If more than one Mini Disks are connected the Motor On signal will turn th...

Page 18: ...e 6 Track sector organization on a formatted diskette Each diskette is permanently sealed inside its jacket to prevent bending creasing scratching or contamination of the diskette surface When the dis...

Page 19: ...Be sure the Mini Disk drive is stopped when you insert or remove a diskette 2 Open the front of the Mini Disk drive Gently insert the diskette into the vertical slot with the write protect notch up a...

Page 20: ...ert formatted diskettes into the other drives now however these may be inserted any time the drives are stopped Another approach would be to plug all devices into an adequate power strip and turn them...

Page 21: ...ccurrences of disk I O errors during disk accesses may indicate a worn diskette or some problem with the Mini Disk drive or other hardware Try to isolate the problem by swapping drives and diskettes a...

Page 22: ...iskette storage temperature 35 2560 10 256 12 5K bytes second 750 mS 1 second Radio Shack Flexible Diskettes Catalog Number 26 305 or 26 0405 pkg of 3 2 5 x 106 passes track 110 hrs 5 years estimated...

Page 23: ...14 1 LM3I1U 4 I 74 LSI4 2E 14 1 __ ufcsszfc 3A IO lAOl 4C 4 D 14 1 _ I486 4c 4 2 14 1 14S 20 14 1 96 02 4B l 8 14SS 2P 14 1 2QT2222 zt H414 2 ID IDl fi 14 1 _ 2QT290S c _ T 4ISS 2 D b 8 _ l o O IE a...

Page 24: ...Read Write Logic 5V 5V Motor ou PULL up i TCS4 00 vOR ite DATA DfcWe SfcL OT 3 PULL UP I XSAOO W MTR OU 4 wpiT peo T 15400 DRWE b L ECT DUWEr SErL CT 1 2 13 _ _ TRUCK ERO M O v TR CX BO W u c v...

Page 25: ...S OTHERWISE SPECIFIED 2 CAPACIT0R VALUES IN MICROFARADS AND WORKING VOLTAGE 3 INDICATES CLOCKWISE ROTATION 2V RETURN NC 1 14 CURRENT LIMIT 2 13 CURRENT SENSE 3 12 INV INPUT 4 1 1 NON INV INPUTj 5 10 V...

Page 26: ...If not have the blank diskette handy BACKUP will tell you when to insert it into drive 0 Do not place a write protect tape on the blank diskette After you power on the CPU the display will read TRSDO...

Page 27: ...he message BACKUP REJECTED DUE TO C then erase the diskette with a bulk eraser Radio Shack Catalog Number 44 210 and repeat the BACKUP procedure If it still won t work you may need to try using anothe...

Page 28: ......

Page 29: ...TRSDOS An Overview Contents of This Section Introduction 2 Entering a Command 5 File Specification 6 Section 3 Page 1...

Page 30: ...program that allows a complex computer system including various Input Output I O devices storage devices and programs to interact efficiently and with apparent simplicity The operating system makes s...

Page 31: ...o store internal bookkeeping information as well as data and programs you create TRSDOS uses completely dynamic disk space allocation so you can open and manipulate files freely without worrying where...

Page 32: ...ine another one may be loaded in the same area or overlayed The use of overlays means that execution of system routines will not affect your memory area addresses above 5 IFF hex The library command f...

Page 33: ...operator command consists of a command followed by one or more file specifications followed by special parameters command Wespec param tfTO tyfilespec param where filespec is a valid TRSDOS file spec...

Page 34: ...ed by a period symbol d is an optional drive specification with d equal to 0 1 2 or 3 depending on which drive you wish to specify The drive specification if used must be preceded by a colon Do not em...

Page 35: ...The particular extension you use can be purely arbitrary and personalized Used this way extensions give you an extra three characters to work with in creating a suitable file name Examples PAYROLL AUG...

Page 36: ...es in use starting with drive 0 the first drive with the correct name extension wiil be used However if the command requires a file creation TRSDOS will skip over to the first non write protected disk...

Page 37: ...reate a new file SAMPLE WATERBOY TRSDOS will give you a FILE ACCESS DENIED message since in effect you re trying to access an existing file with the wrong password The correct password is a string of...

Page 38: ......

Page 39: ...D S Contents of This Section System Commands BASIC2 2 DEBUG 3 TRACE 10 Library Commands AUTO 11 ATTRIB 12 CLOCK 14 COPY 15 DATE 15 DEVICE 16 DIR 16 DUMP 18 KILL 19 11 FREE 19 LIB 19 LIST 20 LOAD 20 P...

Page 40: ...BAS1C2 This command has no arguments or parameters It simply transfers control to LEVEL II BASIC Once it has been executed TRSDOS is no longer resident in RAM Your TRS 80 will then function as a LEVE...

Page 41: ...above 5 IFF are unaffected Type debug Ezma to enable the debugging facility Normal TRSDOS command interpretation continues but the debug program is now set to load and execute under any of the followi...

Page 42: ...BC 8R 3E y 09 BR C2 68 89 7D 93 C2 68 09 C9 21 wl 41 CD D3 DE 61 4 s 1R 4D 45 4D 4F 52 59 28 53 49 5fl 45 00 52 41 44 HL 09 54 y 01 01 5B IB 8R 1R 88 18 09 19 28 28 0B i O Bl 28 RF FF FF SZ1H1PNC BC 4...

Page 43: ...that position whenever this bit is set Here s a complete table of codes for all the flag bits if not set bit status if s 7 Sign S 6 Zero z 5 unused 1 4 Half carry H 3 unused 1 2 Parity overflow P 1 N...

Page 44: ...PC register Target program cannot be a system or execute only file SPACE Sets memory display starting address to aaaa In full screen mode sets starting address so aaaa is contained in display Place aa...

Page 45: ...r format also cancels any command you are in the process of entering except R command none Increments memory display by one page in register display mode page 64 bytes page 256 bytes in full screen mo...

Page 46: ...the screen To modify the contents of 7F00 type the new two digit contents and press SPACE The display will then be updated and DEBUG will increment the modification address by one To leave an address...

Page 47: ...itialize TRSDOS type G6000 QZEQaI More on the U command update display In the Update mode only foreground tasks are executed So to see anything happening you need to look at registers or memory locati...

Page 48: ...lt The TRACE command enables a foreground task which displays the contents of the user s program instruction counter PC register in the upper right of the Video Display The 4 digit hexadecimal value w...

Page 49: ...ia i causes TRSDOS to write dos command as an automatic key in on the drive diskette replacing any previous automatic key ins From that point on every time you power up using that TRSDOS diskette dos...

Page 50: ...s This command lets you alter the protection status of a file by changing passwords and or the degree of access granted by a password See TRSDOS Overview File Specifications section Specifying the 1 p...

Page 51: ...access password on the other hand grants a limited privilege as specified by a PROT parameter in the ATTRIB command The protection levels form a hierarchy and each level implies access to all lower l...

Page 52: ...ification For example RTTRIB PAYROLL MRNRGER RCC sets the access password to blanks and leaves the update password unchanged Note To access a file from DISK BASIC requires a privilege of READ or highe...

Page 53: ...using the same name extension COPY OLDFILE BRS PDQ TO DERDFILE duplicates OLDFILE under the name DEADFILE Note that OLDFILE is protected by a password while DEADFILE is not DEADFILE will be created on...

Page 54: ...les displayed This command reads and displays the file directory of a specified or assumed drive If no parameters are specified only non Invisible user files will be displayed Disk space allocation is...

Page 55: ...only Typically FILE DIRECTORY DRIVE TRSDOS 11 18 78 EDTASM CMD LRL 256 E0F 27 SIZE 6 GRANS RSM CMD LRL 256 E0F 18 SIZE 4 GRANS VHMTBUG CMD LRL 256 E0F SIZE 2 GRANS SEQCHECK TXT LRL 256 EOF 2 SIZE 1 G...

Page 56: ...t If filespec does not include an extension TRSDOS will automatically assign the extension CIM core image to the file Once you have dumped a machine language program onto disk there are two ways to ex...

Page 57: ...as no arguments or parameters It displays the amount of free space remaining on all drives in use in terms of files available and unused granules Each diskette can contain up to 48 user files data dis...

Page 58: ...ccept such a pause after listing a complete physical record that s why you need to hold down the SHIFT keys until TRSDOS notices your pause command Example LIST PR0Q1 TXT LOAD load machine language fi...

Page 59: ...changes the protection status of all non System files on the specified drive To use it you need to know the diskette s Master Password which is assigned during FORMAT or BACKUP The diskette you refer...

Page 60: ...me2 are TRSDOS file names extl ext2 are extensions d is a drivespec d 0 l 2 3 psw is a password This command changes a file s name from the first name extension to the second name extension Note that...

Page 61: ...eal time clock TIMEtyhh mm ss where hh is a 2 digit hours specification mm is a 2 digit minutes specification ss is a 2 digit seconds specification This command sets the clock On power up the clock is...

Page 62: ...ant to be sure that no data is lost or altered during a disk write For example before you COPY a file you may want to enable VERIFY However when VERIFY is on disk accesses are only about 50 percent as...

Page 63: ...Extended Utilities Radio hack TRSBO MICRO COMPUTER SYSTEM T R S D S Contents of This Section TRSDOS Utilities 2 BACKUP 2 FORMAT 4 Auxiliary Utilities 6 TAPEDISK 6 DISKDUMP BAS 8 Section 5 Page 1...

Page 64: ...te You can use any two drives for the backup or you can perform the backup using drive 0 by swapping source and destination diskettes when BACKUP tells you to If the destination diskette is unformatte...

Page 65: ...es for the BACKUP you won t have to do any swapping IMPORTAINT NOTICE The BACKUP utility is provided solely for your personal use in maintaining safe copies of your TRSDOS and data diskettes BACKUP au...

Page 66: ...agnetically erased diskette records track sector boundaries on it then initializes it with directory and bootstrap files During the formatting process TRSDOS will let you specify any tracks you d like...

Page 67: ...write to locked out tracks Here is a typical FORMAT sequence using Drive 1 DISK FORMATTER UTILITY WHICH DRIVE IS TO BE USED i ElZEHO DISKETTE NAME HfiNUfiL 14UI4J CREATION DATE MM DD W 18 6S F8 Q2QH1...

Page 68: ...ack SYSTEM tapes designed for use with LEVEL II TRS 80 s will not work under DISK BASIC because of differences in RAM usage under DISK BASIC and LEVEL II To load and execute TAPEDISK type TRPEDisK nan...

Page 69: ...nt for execution of the file All addresses are in 4 digit hexadecimal form When you re ready to dump the program from RAM onto disk type in the F command For example if the program loaded into RAM add...

Page 70: ...SN This program prompts you to enter the filename and then to enter the sector you want to examine You can simply press nana without a number and the sector by sector examination will be sequential st...

Page 71: ...4F 128 4E 28 4E 45 58 54 26 4C 49 4E 45 2E 28 28 22 43 144 48 52 24 28 39 31 29 22 3D 42 59 54 45 28 44 45 168 4C 49 4D 49 54 45 52 29 22 8D 33 38 28 46 4F 52 176 49 25 3D 31 28 54 4F 28 4C 45 4E 28 4...

Page 72: ......

Page 73: ...T R S D S Contents of This Section Memory Organization 2 Disk Organization 2 File Structure 3 System Routines for Assembly I O 5 Data Device Control Blocks 6 Physical and Logical Records 7 Fundamenta...

Page 74: ...dent system routines System buffers and overlays comprise the last portion of the 4K RAM requirement Since all major system commands are actually loaded as needed from disk in the form of utilities th...

Page 75: ...the physical file location This structure eliminates time consuming disk packing operations File Structure A TRSDOS file is composed of one or more segments of storage space Each segment consists of...

Page 76: ...user defined logical record Such a logical record is the smallest unit of information which can be addressed during disk input output a physical record is the unit which is actually read from or writ...

Page 77: ...binary form If 0 127 decimal then A 7FH Register A is used to return the TRSDOS error code for I O calls A complete list of error codes and their meanings appears at the end of this chapter Z OK Zero...

Page 78: ...drive number residence Reserved EOF offset of last delimiter in last physical record LRL logical record length NRN next record no open sets X 0000 lsb msb ERN ending record no last in file lsb msb Re...

Page 79: ...Logical Record Length the length is fixed until the file is closed To change a file s LRL you must CLOSE it and re OPEN it with the new LRL Each opening of the file sets a single fixed record length T...

Page 80: ...ts value before return In order to properly apply this data you should read through all of these descriptions and clear up all of the points that are not obvious to you by using other reference materi...

Page 81: ...le in order to add new records onto the end use the record number ERN 1 see page 2 entry DE DCB must have been opened previously BC Logical record number to position for CALL 4442H exit Z OK A TRSDOS...

Page 82: ...ll be written After each logical record is transferred the NRN value in the DCB will be incremented by one IF LRL 0 WRITE transfers one physical record from the RAM BUFFER into the disk file using the...

Page 83: ...s CLOSE entry DE DCB CALL 442CH exit Z OK A TRSDOS error code Supplementary Information Other routines and addresses which may be of interest are defined here Pay particular attention to the error rou...

Page 84: ...Seek error during read 03 XK Lost data during read 04 MD Parity error during read 05 FMD Data record not found during read 06 P Attempted to read system data record 07 P Attempted to read system data...

Page 85: ...specified 33 UP No device space available for new device 34 MPUS Load file format error Not a program 35 XCS Memory fault 36 PUXC Attempted to load ROM memory 37 P Illegal access attempted to protecte...

Page 86: ......

Page 87: ...EM L A G U A G E S Contents of This Section Introduction 2 Enhancements to LEVEL II 5 Disk Features 26 File Manipulation 28 File Access 33 Sequential Access Techniques 60 Random Access Techniques 65 D...

Page 88: ...w type basic HUES TRSDOS will load BASIC into RAM and BASIC will begin the initialization dialog This is a series of questions and answers which tell BASIC how to organize memory according to your nee...

Page 89: ...then be able to have 15 files open at once however this will reduce your available memory by 15 290 4350 bytes HOW MANY FILES tells BASIC to use a default of 3 for the number of files to be in use at...

Page 90: ...mum amount of RAM available for use by BASIC Refer to the Memory Map for decimal addresses of the various TRS 80 memory configurations 16K 32K 48K After you answer the MEMORY SIZE question RADIO SHOCK...

Page 91: ...Get time and date from real time clock USRft Call external routine n 0 1 2 9 Cassette Operations Before any BASIC cassette input or output operation you must disable interrupts with the CMD T command...

Page 92: ...ex form H and 0 let you introduce such constants into your program H and O are used as prefixes for the numerals that immediately follow them Hdddd where dddd Oddddd where ddddd is a 1 to 4 digit sequ...

Page 93: ...gnificant byte of X and POKEs the result into location A CMD D execute DEBUG program CMD D Executing this statement causes the TRSDOS debugging program to load and execute See TRSDOS Commands DEBUG Yo...

Page 94: ...CLS PRINT TAEK15X DEBUG EXAMPLE PRINT 148 PRINT ENTERING DEBUG 158 FOR 1 1 TO 506 NEXT I DELAY A WHILE 168 170 ENTER DEBUGGING PACKAGE ISO 198 CMD D 200 210 RETURN HERE WHEN G ENTER TVPED IN DEBUG 220...

Page 95: ...88 F2 51 06 10 CD 65 51 3R 5D 48 FE 41 28 13 CD F2 IK 49 15 _ 81 E3 83 80 88 08 4B 49 87 58 84 31 3E 88 44 4F IV FF FF FF F3 RF C3 74 06 C3 00 48 C3 88 48 El E3 C3 9F SP BD 6C J BR 69 IE ID 08 00 84 0...

Page 96: ...pe before using CMD S as your resident BASIC program will be lost CMD T stop clock disable interrupts CMD T You must execute this command immediately before any BASIC tape input output operation Such...

Page 97: ...variable used to name the function determines what type of value the function will return For example if the function name has the single precision attribute then that function will return a single p...

Page 98: ...en A and B Returns first 8 characters of string argument Returns double precision value of the square of the difference 100 PROGRAM STRING 110 EXAMPLE OF fi STRING DEFFN FUNCTION 120 13 0 FUNCTION TO...

Page 99: ...MINIMUM VALUE MX IS CURRENT MAXIMUM VALUE READ MN MX MN GET NEXT VALUE AND FIND NEW M IN MAX READ V IF V 99999 THEN 320 V 99999 MEANS ALL DONE MN FNMIN MN V GET NEW MINIMUM MX FNMAX MX V GET NEW MAXIM...

Page 100: ...b routine beginning at hex 7D00 Here are three ways to get a machine language program into RAM so that it can be accessed via a USRn call 1 Use the TRS 80 Editor Assembler Radio Shack Catalog Number 2...

Page 101: ...through a string to see if it contains another string If it does INSTR returns the starting position of the substring in the target string otherwise zero is returned Note that the entire substring mu...

Page 102: ...ta without having to worrv about accidental entry of delimiters because only the la ftid key serves as a delimiter If you want anyone to be able to input information to a program without special instr...

Page 103: ...var nl n2 exp where var names the string to be changed nl specifies the starting position for the replacement n2 specifies how many characters are to be replaced if n2 is omitted LEN xp or LEN var nl...

Page 104: ...ement position and a replacement string Then it performs the MID replacement and prints the new string Type in a position equal to zero to stop the program 160 PROGRAM EDIT 110 EXAMPLE OF INSTR FUNCTI...

Page 105: ...e currently stored in the Real Time Clock memory area The string is always 17 characters long and has the following format MM DD YY HH MM SS month day year hr min sec The hour appears in 24 hour form...

Page 106: ...ED 220 236 A INKEY IF A THEN END ELSE 180 USRn call to user s external subroutine JSR n nmexp where n specifies one of ten available USR calls 7 2 0 1 2 9 If n is omitted zero is assumed nmexp is in t...

Page 107: ...d back from the routine if your routine makes the JUMP described below otherwise A will be assigned the value of X line 100 Passing arguments to and from USR routines There are several ways to pass ar...

Page 108: ...TO 1LEFT SHIFT i8140 RN ARGUMENT SENT FROM BRSIC AND RETURN 00150 THE RESULT BACK TO BR SIC 80160 7D00 00170 00180 J ORG 7D88H 00190 EQUATES RND ENTRV POINTS 00200 i 8A7F 00210 GETARG EQU 8R7FH GET AR...

Page 109: ...AL READ A POKE X A NEXT X GET VALUE FROM USER CLS PRINT TAEK15 USR5 LEFT SHIFT FUNCTION PRINT INPUT ENTER INTEGER VALUE V IF V 0 THEN END PRINT LEFT SHIFTED VALUE TAEK32 USR5 V GOTO 270 DATA IS DEM1CA...

Page 110: ...8278 88288 88298 88388 2fiP OUT SCREEN USR FUNCTION ORG EQURTES VIDEO EQU WHITE EQU COUNT EQU 7D88H 3C88H 8BFH 3FFH START OF VIDEO RAM fil_L WHITE GRAPHICS BVTE NUMBER OF BVTES TO MOVE PROGRAM CHAIN M...

Page 111: ...NEXT X 192 194 CLEAR SCREEN PRINT NUMBERS 1 THRU 100 196 200 CLS 205 PRINT TAB 15 M WHITE OUT USER ROUTINE PRINT 210 FOR X 1 TO 100 220 PRINT X 225 A INKEY IF A THEN END 230 NEXT X 240 250 JUMP TO WHI...

Page 112: ...ent syntax DISK BASIC provides a powerful set of commands statements and functions relating to disk I O under TRSDOS These fall into two categories 1 File manipulation dealing with files as units rath...

Page 113: ...field add blanks on the right to fill field RSET Place value in specified buffer field add blanks on the left to fill field Functions CVD CVI CVS EOF LOF MKD MKI MKS Restore double precision number t...

Page 114: ...tells BASIC to RUN the program after it is loaded This command loads a BASIC program file into RAM if the R option is used BASIC will proceed to RUN the program automatically otherwise BASIC will ret...

Page 115: ...e exp defines a filespec for an ASCII format BASIC disk file e g a program saved with the A option MERGE is similar to LOAD except that the resident program is not wiped out before the new program exp...

Page 116: ...URN And suppose the following program is stored on disk in ASCII format 1000 REM BEGINNING OF SUBROUTINE 1010 PRINT EXECUTING SUBROUTINE 1020 REM MORE PROGRAM LINES HERE 1100 RETURN Assuming the subro...

Page 117: ...PRINT PR0G1 EXECUTING 20 RUN PRGG2 BfiS And save this program on disk with the name PROG2 BAS 10 PRINT PRGG2 EXECUTING 20 RUH PRGGl 6fiS Now type mmmmmmm RUN PR0G1 BRS QZEQ3 and you ll see a simple ex...

Page 118: ...er programs as data will typically require that the data programs be stored in ASCII Useful conventions for placing extensions on BASIC programs For compressed format programs use the extension BAS Fo...

Page 119: ...on dialog you type in a number in response to HOW MANY FILES The number you type in tells BASIC how many buffers to create to handle your disk accesses reads and writes Each buffer is given a number f...

Page 120: ...the file and exp2 names the file to be accessed If exp2 does not exist then TRSDOS may or may not create it depending on the access mode Note nmexp buffer number cannot exceed the number you entered f...

Page 121: ...drive While a file is open it is referenced by the buffer number which was assigned to it Examples GET buffer number PUT buffer number PRINT buffer number INPUT buffer number All these statements will...

Page 122: ...ssignments to buffers 1 2 and 8 These buffers can now be assigned to other files with OPEN statements CLOSE FIRSTJS COUNTX Terminates the file assignment to the buffer specified by the sum FIRST COUNT...

Page 123: ...statement put it there or whether it required 10 different PRINT statements What matters to INPUT are the positions of the terminating characters and the EOF marker To INPUT data successfully from di...

Page 124: ...Input Suppose the data image on disk is 1 234 33 27 EN EN denotes a carriage return character ASCII code decimal 13 Then the statement INPUTS fi B C or the sequence of statements INPUTS fi INPUTS B IN...

Page 125: ...S Then the statement INPUT 1 ft B C would assign values as follows A PECOS B pTEXAS GOOD MELONS C null string If a comma is inserted in the data image before the first double quote C will get the valu...

Page 126: ...a character encountered double quote EN EN LF Unquoted string terminator sets end of file encountered 255th data character encountered EN LF Here s a flow chart describing how INPUT assigns data to a...

Page 127: ...This is evaluated by a routine just like the BASIC VAL function which returns a zero since the first character of A12 is non numeric In Example 3 when INPUT goes looking for the second data item it im...

Page 128: ...n contain enough data for A B and more LINE INPUT read a line of text from disk LINE INPUT nmexp var where nmexp specifies a sequential output file buffer nmexp l 2 15 var is the variable name to cont...

Page 129: ...i colon is preferable exp is the expression to be evaluated and written to disk This statement writes data sequentially to the specified file When you first open a file for sequential output a pointer...

Page 130: ...ces in the disk file Generally you wouldn t want to use up disk space this way so you should use semi colons instead of commas PRINT 1 A B writes the data as 2300 1 303 EN PRINT with numeric data is q...

Page 131: ...the data For example suppose A DOE JOHN Q B 100 01 001 If you use PRINTttL flfo V iB the disk image will be DOE JOHN Q 100 0 1 001 EN When you try to input this with a statement like INPUT 2 fl B A wi...

Page 132: ...lue are written to disk For example suppose A LUDWIG B VAN C BEETHOVEN Then the statement PRINTttL USING Y i Mi B C would write the data in nickname form L V BEET EN In this case we didn t want to add...

Page 133: ...age to BASIC or from BASIC to disk However you need a way to access this buffer from BASIC so that you can either read the data it contains or place new data in it The FIELD statement provides the mea...

Page 134: ...er field therefore you won t be able to access that field using the previous field name For example fi B nullifies the effect of the FIELD statement above line 100 During random input the GET statemen...

Page 135: ...t is a statement like OPEN R nmexpl filespec is required before the statement GET nmexpl nmexp2 When BASIC encounters the GET statement it looks at the buffer s control block and obtains the informati...

Page 136: ...will occur To prevent this from occurring you can use the LOF function to determine the number of the highest numbered record PUT write a record to disk random access PUT nmexpl nmexp2 where nmexpl s...

Page 137: ...er than the last record accessed The first time you access a file via a particular buffer the current record is set equal to 1 If the record number you PUT is higher than the end of file record number...

Page 138: ...30 Effect 1045 1050 1055 1060 LSET PUT 1 25 LSET PUT 1 Open SAMPLE BAS for random address under buffer 1 Prepare buffer Place data in buffer Copy buffer contents into current record 1 Place data in bu...

Page 139: ...information into the buffer fields so it can be written to disk name JIM CRICKET JR address 2000 EAST PECAN ST This is accomplished with the two statements LSET NM M JIM CRICKET JR LSET flD 2000 EAST...

Page 140: ...EN exp 2 an ILLEGAL FUNCTION CALL error occurs if LEN exp 2 only the first two characters are used CVS exp where exp defines a four character string exp is typically the name of a buffer field contain...

Page 141: ...c value 13 123 38 to the double precision variable A EOF end of file detector EOF nmexp where nmexp specifies a file buffer nmexp 2 15 This function checks to see whether all characters up to the end...

Page 142: ...ifies a random access buffer nmexp l 2 15 This function tells you the number of the last i e highest numbered record in a file It is useful for both sequential and random access For example during ran...

Page 143: ...the byte values which make up the number are not changed only one byte the internal data type specifier is changed so that numeric data can be placed in a string variable See LEVEL II Reference Manua...

Page 144: ...ended to hold a character string AVG AB and ERNINGS converted single precision values YR and HR converted integers Suppose we want to write the following data record SLOW LEARNER played 38 years lifet...

Page 145: ...equential Output An Example Suppose we want to store a table of English to metric conversion constants English unit Metric equivalent 1 inch 2 54001 centimeters 1 mile 1 60935 kilometers 1 acre 4046 8...

Page 146: ...data to be lost Here s why Whenever a file is opened for sequential output the EOF marker is set to the beginning of the file In effect TRSDOS forgets that anything has ever been written beyond this...

Page 147: ...60 INPUT V 170 PRINT THE METRIC EQUIVALENT IS n V FACTR CH0ICE O 180 INPUT PRESS ENTER TO CONTINUE X 190 PRINT 704 CHR 31 CLEAR TO END OF FRAME 200 GOTO 140 Line 20 opens the file for sequential input...

Page 148: ...se the file 4 Add your new entries to the data array or correct existing entries 5 Re open the file for sequential output 6 Output the updated data array to the file 7 Close the file If the file is to...

Page 149: ...1 THEN 90 70 I5J IJJ 1 LINE INPUT 1 TEMP 80 GOT060 90 PR I NT THE PROGRAM IS I LINES LONG 100 CLOSE GOTO20 110 PRINT FILESPEC MUST INCLUDE THE EXTENSION VTXT 120 GOTO20 For BASIC programs stored in A...

Page 150: ...nts don t write data directly to the disk instead the data is placed in the 256 byte output buffer When this buffer is filled the contents are automatically written to disk Closing the file will also...

Page 151: ...up the structure random input output becomes quite simple The last advantage listed above is also the hard part of random access It takes a little extra thought For the purposes of random access you...

Page 152: ...umbers Strings 2 4 8 Up to 255 Therefore you ll want to place several values into the buffer before PUTting its contents into the disk file to avoid wasting disk space This is accomplished by 1 dividi...

Page 153: ...DED ON THE RIGHT IF THE DATA IS TOO LONG THE EXTRA CHARACTERS ON THE RIGHT ARE IGNORED LSET IS A LEFT JUSTIFY FUNCTION Line 1 20 left justifies the value in quotes into the first field in buffer 1 Lin...

Page 154: ...cess for file maintenance But before looking at the program study this general procedure for creating and maintaining files via random access Step Number See GLOSSACC BAS Line Number 1 OPEN the file 1...

Page 155: ...TRV OR RECORD EN FOR SPECIFIC ENTRV OR O EN TO QUIT M RX 260 IF 0 R5i THEN 140 270 CLOSE 280 END Notice we ve added a field NX to the record line 120 NX will contain the number of the record which com...

Page 156: ...PEC IHRL HJHJd TYPE NEW DEF N EN OR EN IF OK MM TYPE NEW SEQUENCE NUMBER OR EN IF OK UMAil TYPE EN TO READ NEXT ALPHA ENTRY OR RECORD EN FOR SPEC IFIC ENTRY OR 8 EN TO QUIT BZHID WORD LEFT JUSTIFY DEF...

Page 157: ...he buffer it is a good idea to define several identical sub records on the buffer That way you don t waste disk space by PUTting records which contain only a few bytes of useful information For exampl...

Page 158: ...i NEXT The first time through the loop STARTHERES will have a length of zero Therefore NM 0 will start at the first byte AD 0 at the 19th byte etc LP 0 will end at the 63rd byte The second time throug...

Page 159: ...in the last record We then number them sequentially starting with 1 The following formulas use this number we ll call it a key number to determine exactly where the sub record is in the file If the su...

Page 160: ...I NPUTLP t SEKS tP 270 PUT 1 PR5J PRINT INPUT PRESS EN TO GO ON M X GOTO 120 1 00 PR I NT READING SUBRECORD SR i IN PHYSICAL RECORD PR3J 310 PRINT PRINT NflME TRB 20 NM 320 PRINT H ADDRESS TAB 20 AD...

Page 161: ...HASE S yN A I C H2HHS 2222 SECOND STREET ffiOHl OLD PORT BZEIl i2 si riMUi PRESS EN TO GO ON HMM TVPE 1 EN TO WRITE 2 EN TO READ 0 EN TO QUIT 2 TVPE KEV NUMBER EN OR 6 EN 1 Qffllil READING SUBRECORD 1...

Page 162: ...names to the same area of the buffer For example if the first two digits of a six digit stock number specify a category you might use the following field structure FIELD 1 6 AS STOCKS FIELD 1 2 ASCTGS...

Page 163: ...disk check name extension to see they were specified correctly Attempt to perform disk file input or output which conflicts with the mode in which the file was opened An error occurred during data tr...

Page 164: ...MERGE a disk file which is not a BASIC program Attempt to place more than 48 files on a single diskette Attempt to write to disk with write protect notch covered Attempt to access existing file with i...

Page 165: ...Appendices Contents of This Section Glossary 2 Memory Map 3 TRSDOS Character Tables 14 Base Conversions 1 Section 8 Page 1...

Page 166: ...or more subscripts In BASIC any variable name can be used to name an array and arrays can have one or more dimensions AR signifies a one dimensional array named AR AR signifies a two dimensional arra...

Page 167: ...for and 1 bit Binary digit the smallest unit of memory in the Computer capable of representing the values and 1 bootstrap program A fundamental or primitive program which takes the Computer from an OF...

Page 168: ...the extension CUD Such a file should consist of an executable Z 80 program since TRSDOS will load and attempt to execute it when you type filename HUUi Command files can be placed on any disk in effec...

Page 169: ...al part of the computer system used for data I O e g keyboard display line printer cassette disk drive voice synthesizer directory A listing of the files which are contained on a disk disk drive or Mi...

Page 170: ...me as the starting address Entry point is also referred to as the transfer address expression A meaningful sequence of one or more variables constants operators and functions field A user defined subd...

Page 171: ...ically erased diskette into tracks and sectors via the TRSDOS FORMAT utility BACKUP also implicitly formats a blank diskette Formatted diskettes contain 35 tracks each of which contains 10 sectors gra...

Page 172: ...d TRSDOS commands which are overlayed as needed into RAM between 5200 and 6FFF to see which library commands are available use the TRSDOS LIB command LIB EN logical expression An expression which is e...

Page 173: ...as overlays parameter Optional information supplied with a command to specify how the command is to operate TRSDOS parameters are placed inside parentheses password An optional field in a filespec con...

Page 174: ...s of what the current background task is At power on the real time clock is set to 00 00 00 When interrupts are disabled the clock is stopped reset To press the reset button on the rear left of the TR...

Page 175: ...file A TRSDOS disk file with the extension SYS Such files are read protected To avoid confusion don t use the extension SYS on your own disk files syntax The grammatical requirements for a command or...

Page 176: ...r routine which serves a limited specific purpose There are two extended TRSDOS utilities FORMAT and BACKUP and two non TRSDOS utilities DISKDUMP BAS and TAPEDISK write protect To physically protect a...

Page 177: ...X 3000 I O X 4000 X 4200 X 5200 16K RAM X 7000 t X 8000 16 K RAM X COOO 16 K RAM X FFFF I O DRIVERS AND BOOTSTRAP LEVEL II BASIC DISK BASIC MEMORY MAPPED I O BASIC VECTORS TRSDOS DISK BASIC TRSDOS UT...

Page 178: ...or a given character For example the character Q is represented by the pattern 1010001 decimal 81 MOST SIGNIFICANT BITS b b5 0000 LEAST 0001 SIGNIF 0010 BITS 0011 t b 0100 0101 0110 0111 1000 1001 101...

Page 179: ...08 BKSP 40 28 72 48 H 9 09 HT 41 29 73 49 I 10 0A LF 42 2A 74 4A J 11 0B VT 43 2B 75 4B K 12 OC FF 44 2C 76 4C L 13 0D CR 45 2D _ 77 4D M 14 0E CURON 46 2E 78 4E N 15 OF CUROFF 47 2F 79 4F 16 10 DLE 4...

Page 180: ...32 95 20 5F Keyboard display characters 96 127 60 7F Non printing characters code 32 is printed 128 191 80 BF Graphics characters 192 255 CO FF Space compression codes The following control character...

Page 181: ...0 LPRINT GRRPHICS CODE I 45 LPRINT CHR 138 50 R1 P0 1 NT 0 R2 P0 1 NT i 60 R3 P0 1 NT 0 1 R4 P0 I NT 1 1 70 A5 PQ I NT 0 2 R6 P0 I NT 1 2 80 LPR I NTTRB 8 CHR Hi 40 48 i CHR R2 40 48 90 LPR I NTTRB 8...

Page 182: ...881 11 821 68 88111100 3C 074 18 88818818 12 022 61 00111101 3D 875 13 88818811 13 023 62 80111110 3E 876 28 80018188 14 824 63 80111111 3F 077 21 80010101 15 025 64 CM GtGiGi k 48 100 VXVKflOKJKfKf 2...

Page 183: ...29 10000001 81 201 130 10000010 82 202 131 10000011 83 203 132 10000100 84 204 133 10000101 85 285 134 10000110 fc fo 206 135 10000111 8 207 136 10001000 88 210 137 10001001 89 211 138 10001010 8fl 21...

Page 184: ...000110 C6 306 234 11101010 EA Ji JC 199 11000111 C7 307 235 11101011 EB 353 266 11001000 C8 310 236 23 11101100 11101101 EC ED 354 201 11001001 C9 311 238 11101110 EE 356 202 11001010 CA 312 239 11101...

Page 185: ...Index for TRSDOS DISK BASIC Reference Manual 1 Radio hack TRS BO MICRO COMPUTER SYSTEM I D E X Wi v jSS TM For TRSDOS Version 2 1 DISK BASIC Version 1 1 lIliWWIKI...

Page 186: ...OS 6 3 6 7 bootstrap program 8 3 break 8 3 buffer 6 5 6 6 7 2 7 33 ff 8 3 byte 84 cassette I O under DISK BASIC 7 5 7 10 Subject Page CLOCK TRSDOS command 4 14 clock real time see real time clock CLOS...

Page 187: ...4 10 8 7 FORMAT TRSDOS utility 54 ff format 54 ff 8 7 FREE TRSDOS command 4 19 Subject Page GET BASIC statement 7 49 granule 4 16 4 19 54 6 3 6 12 8 7 hexadecimal 8 7 constants BASIC 7 6 increment 8...

Page 188: ...al 6 4 6 7 8 9 logical 6 7 8 8 release 1 6 RENAME TRSDOS command 4 22 reset 8 10 resident program 3 4 8 10 ROM see read only memory Subject Page RSET BASIC statement 7 53 RUN program BASIC command 7 3...

Page 189: ......

Page 190: ......

Page 191: ...uipment or programs sold by Radio Shack including but not limited to any Interruption of service loss of business or anticipatory profits or consequential damages resulting from the use or operation o...

Page 192: ...fact including but not limited to statements regarding capacity suitability for use or performance of the equipment shall be or be deemed to be a warranty or representation by Radio Shack for any pur...

Reviews: