background image

Summary of Contents for TRS-80 III

Page 1: ...S SO Model ID Disk System Owners Manual Mini Disk Operation TRSDOS Disk Operating System Disk BASIC Programming Language Cysr M MANUFACTURED IN THE USA BY RADIO SHACK M A DIVISION OF TANDY CORPORATIO...

Page 2: ...the following measures Reorient the receiving antenna Relocate the computer with respect to the receiver Move the computer away from the receiver Plug the computer into a different outlet so that comp...

Page 3: ...Model III Owner s Manual Radio hack 9A DIVISION OF TANDY CORPORATION FORT WORTH TEXAS 76102...

Page 4: ...erein Model III TRSDOS Operating System 1980 Tandy Corporation Fort Worth Texas 76102 U S A All Rights Reserved Model III BASIC Software 1980 Tandy Cor poration and Microsoft All Rights Reserved The s...

Page 5: ...nue to grow in power and convenience When Radio Shack issues improvements and enhancements to the system programs you can install them simply by obtaining a new release of the trsdos diskette Model II...

Page 6: ...p you might belong to The Sample Sessions are especially geared for novices while the Technical Information chapters are for the more experienced users Keep in mind however that it isn t necessary to...

Page 7: ...shooting and Maintenance 13 Notation and Abbreviations 14 Specifications 15 TRSDOS Description of trsdos 17 Roles basic ram Use Memory Map Using trsdos 20 Commands 20 Entering Syntax Forms File Specif...

Page 8: ...cements to Model III Disk basic 93 Abbreviations Commands Disk Related Features 116 Q File Manipulation Q File Access Methods of File Access 145 Q Sequential Q Random Disk basic Error Codes Messages 1...

Page 9: ...t drive The 26 1 161 drive may only be used in a four drive system in which it must be Drive 2 1 Locate the flat ribbon cable that was included with the 26 1 164 drive Notice that it has a single plug...

Page 10: ...TRS 80 MODEL III DISK SYSTEM Computer Plug Drive 3 Plug Figure 1 External Disk Cable with Plugs Labeled Figure 2 Connection of the External Disk Cable to the Model III...

Page 11: ...OPERATION ii mm MINI DISK REAR VIEW Attach the plug so the cable exits toward the rear of the Computer EDGE CARD PLUGS GUIDE PIN GUIDE SLOT Figure 3 Connection of external disk drives...

Page 12: ...hese drives may contain data diskettes Data diskettes are described briefly in this chapter Drive Select led When a drive is being accessed its led lights up Drive Door To insert or remove a diskette...

Page 13: ...te Window The disk drive accesses the diskette surface through this window Don t touch the diskette surface CD Label To write on this label use only a felt tipped pen Any other writing implement might...

Page 14: ...e such a number on the permanent label You might also put your name on the diskette and record the date when the diskette was first put into use Remember use only a felt tip pen for marking This fc pe...

Page 15: ...rsdos will prompt you to enter the date in the form mm dd yy For example 07 04 80 for July 4 1980 Type in the correct date and press ENTER trsdos will not continue until you type in the date correctly...

Page 16: ...k diskette The trsdos diskette will be referred to as the source while the blank one will be called the destination during backup 2 Start trsdos as explained in the previous section TRSDOS READY shoul...

Page 17: ...ave no system programs All of the storage capacity of such diskettes is available for your programs and data The format utility program takes a diskette and initializes or formats it If the diskette w...

Page 18: ...om the diskette to be converted You can do this with the prot command described in the Model I TRSDOSlDisk basic Owner s Manual 2 Start Model III trsdos 3 Place the Model I diskette in Drive I 2 or 3...

Page 19: ...load and start basic First it will ask two questions Press ENTER in response to each of them HOW MANY FILES CENTER MEMORY SIZE ENTER A heading will be displayed followed by READY You may now begin us...

Page 20: ...IC trsdos sets the cassette baud rate to High If you would like to change this use the following trsdos command PATCH BASIC CMD ADD 5202 FIND 02 CHG FF CENTER Consequently you will be prompted with CA...

Page 21: ...ls are properly connected Error Messages Look up the message in the trsdos or basic Error Message Section The cure should be listed Frequent disk i o errors 1 Diskette is partially erased Backup the d...

Page 22: ...LIST filename indicates that you can supply any valid file specification after list Ellipsis indicates that the preceding items can be repeated For example ATTRIB filename option indicates that sever...

Page 23: ...s External Drives 5 A mini diskettes Radio Shack Catalog Number 26 305 26 405 package of three or 26 406 package of 10 Single sided Double density 40 Tracks 18 Sectors Track 256 Bytes Sector 55 to 80...

Page 24: ...m works These are known as library 1 commands In its role as program manager trsdos will load and run system or user programs During this time the system or user program is in control of the Computer...

Page 25: ...s divided into several independent modules The resident module is in memory at all times It consists of input output drivers tables the command interpreter and other essential routines Additional modu...

Page 26: ...SIC OTHER PROGRAMS ROM TRSDOS DEBUG w DO Figure 8 trsdos Memory Map 4000H 5200H 5500H DOS OVERLAYS 7000H FORMAT 8000H END 180H TRSDOS System Utility Language packages Z 80 Programs FORMAT Disk BASIC U...

Page 27: ...hecks to see if what you ve typed is the name of a trsdos command If it is trsdos executes it immediately 2 If what you typed is not a trsdos command then trsdos will check to see if it s the name of...

Page 28: ...mmand you re having trouble with trsdos will give you the syntax format as well as a brief definition of the command Commands Syntax Forms No file commands tviW a iiiwiL t 7 wmimMUm purpose of the inp...

Page 29: ...d it A file specification has the general form filen me extpB sword d filename consists of a letter or numbers fextis an optional name extensipn 4 ext is a sequence of up to three letters or numbers s...

Page 30: ...or ascii text for machine language command file for data One advantage of using extensions is that you can tell by just looking at the directory what kind of information a file contains Another advant...

Page 31: ...u specify You can change them later with the attrib command A password consists of a period followed by one to eight letters or numbers If you do not assign a password to a file trsdos uses a default...

Page 32: ...os ready level For example the basic interpreter is a program file Data files include all files that are not in the correct format to allow loading and executing from trsdos ready For example a progra...

Page 33: ...ams saved with the a option append copies the contents of the source file onto the end of the destination file The source file is unaffected while the destination file is extended to include the sourc...

Page 34: ...rs C P Dodson M W Kick am on T Y Lewis G E Miller L Peterson B Rodriguez F payroll b will be unaffected To see the APPENDed file type LIST PAYROLL A ASCII Note Do not load a program under basic after...

Page 35: ...alue either the password you specified or a blank password Examples ATTRIB DATAFILE I ACO JULY14 UPD M0USE PR0T READ Makes the file invisible sets the access password to julyh and the update password...

Page 36: ...rt basic 2 Type RUN TEST This is the only way to access the program If the operator attempts to load it instead basic will erase the program from memory before returning with ready After the run test...

Page 37: ...time AUTO BASIC Tells trsdos to load and execute basic each time the System is started up AUTO FORMS WIDTH S0 Tells trsdos to reset the printer width parameter each time the System is started up AUTO...

Page 38: ...build creates the file and immediately prompts you to begin inserting lines Each time you complete a line press ENTER While typing in a line you can use the usual cursor control keys for erasures and...

Page 39: ...rom 0000 to ffff If this option is omitted the memory protect address is reset to end of user ram If all options are omitted all available ram is cleared memory protect is reset to end of memory the D...

Page 40: ...egardless of what program is executing Clock display is off at trsdos start up Note Except during cassette and disk i o the real time clock is always running regardless of whether the clock display is...

Page 41: ...o the new file defined by destination file This allows you to copy a file from one disk to another using a single drive if necessary In the latter case you must include drive specifications in both fi...

Page 42: ...nformation on file segmentation To rename a file on the same disk use rename not copy CREATE Create a Pre allocated File te If omitted tm is as iini f refc rdstlosired it omitted no records are al o0p...

Page 43: ...4 bytes long CREATE PAYROLL BAG Creates a file named payroll bas but allocates no space to it Sample Use Suppose you are going to store personnel information on no more than 250 employees and each dat...

Page 44: ...the date or display the date You initially set the date when trsdos is started up After that trsdos updates the date automatically using its built in calendar You can enter any two digit year after 19...

Page 45: ...In most cases you do not have to press INTER after the command has been typed in Either a prompt will immediately be displayed or debug will execute the operation without further instruction In some...

Page 46: ...updated M Modify RAM Press ffi to change to the disk utility display format see the f command trsdos will respond with the prompt M ADDRESS You should type in the four digit hexadecimal address of the...

Page 47: ...e control is returned to debug debug will not however step through a call or jump into a rom address C Call Single Step If you wish to complete an entire call return sequence press The call is then ex...

Page 48: ...address and a breakpoint address The command is terminated when you press ENTER Type in the addresses in one of three formats i 8BE s as aaaa bbbb 1HTER ial address specifying the jump destination If...

Page 49: ...display mode CD Next page O Previous page To change the file contents press This puts you in a modify memory mode like the one previously described Use the arrow keys to position the cursor a blinking...

Page 50: ...Figure 10 Full Screen Format 43...

Page 51: ...command gives you information about a disk and the files it contains To pause the listing press CD To continue press CENTER To terminate the listing press BREAK Examples DIR Displays the directory of...

Page 52: ...d Total access 1 Kill file and everything listed below 2 Rename file and everything listed below 3 This designation is not used 4 Write and everything listed below 5 Read and everything listed below 6...

Page 53: ...The System executes the commands just as if they had been typed in from the Keyboard Command lines in a build file may include library commands or file specifications for user programs When do reache...

Page 54: ...ted trsdos uses on This command duplicates all video output to the Printer and vice versa It takes effect immediately Notes 1 Video and printer output may be different because of intrinsic differences...

Page 55: ...is omitted no relocation will take place Note Addresses must be hexadecimal form without the x notation You must add the prefix 0 to any hex number which begins with a letter This command copies a mac...

Page 56: ...characters per output line If a line reaches this length trsdos will insert a cartage Tetwrn to imm a new line If this option is omitted the current maximum width will be used To disable the maximum...

Page 57: ...Printer It omitted trsdos sends the map to the Video Display only This command gives you a map of granule allocation on a diskette A granule 1280 bytes is the unit of space allocation It also shows th...

Page 58: ...irect Directory Information X Allocated Granule Flawed Granule Contains a Flawed Sector Unusable A typical free map display is shown in Figure 12 Disk Name All six granules in track 2 are allocated Fi...

Page 59: ...tes one file or a group of files depending on which form is used Form A deletes the specified file If no drive specification is given trsdos deletes the file from the first diskette that contains it F...

Page 60: ...d If omitted the listing is continuous AiHitelteRSDOs to list the file in asch format If omitted hexadecimal format is used This routine lists the contents of a file The listing shows both the hexadec...

Page 61: ...file is loaded trsdos returns to the trsdos ready mode You cannot use this command to load a basic program or any file created by basic See the basic Reference Manual for instructions on loading basic...

Page 62: ...ill continue searching on the next higher numbered drive Example After you enter the command MASTER DRIVE i Drive 1 becomes the master drive PATCH Change the Contents of a Disk File k p Ui aK fmn bb c...

Page 63: ...ve to wait for a later release of the operating system Sample Use Suppose you want to change seven bytes in a machine language program file First determine where the seven byte sequence resides in ram...

Page 64: ...ue See build and do for sample uses PROT Use or Change a Diskette s Master Password PROT tf PW LOCK d is an optional drive specification If omitted Drive is used mtells trsoos you want to change the m...

Page 65: ...files no Invisible m All Invisible and User files No System all All files on disk User System Invisible If file typen omitted trsdos defaults to User files This command allows quick deletion of files...

Page 66: ...er parts of this command are as explained previously However be sure to do the purge using Drive 1 2 or 3 since the diskette will become non system during the purge RELO Change Where Program Loads int...

Page 67: ...annot be used to change a file s password protection Use attrib to do that rename also checks to see that the intended new name does not duplicate a filename currently on the same diskette If it does...

Page 68: ...s resets i o Drivers to their original i o routes The source and destination devices must both be output or both be input This command allows you to route i o devices automatically For example trsdos...

Page 69: ...fore executing it you should connect the communications device to the Model III See the Model III Operation Manual for a description of rs 232 c signals used See Using the RS 232 C Interface in the Mo...

Page 70: ...FOR KEYBOARD INPUT 150 C INKEY 1G0 IF C THEN 110 NO KEY SO GO CHECK SERIAL 185 PRINT C SELF ECHO 170 POKE CO ASC C PUT CHARACTER INTO OUTPUT BUFFER 130 X USR2 0 CALL RSTX 200 GOTO 110 GO CHECK SERIAL...

Page 71: ...drive see master TAPE S D D T Starts a disk to tape transfer trsdos will prompt you for the desired cassette baud rate then for the diskette file specification Then it will tell you to press NTER whe...

Page 72: ...o run past 23 59 59 it will re cycle to zero the date will be incremented and the clock will continue to run TRSDOS WP Write Protect Via Software d specifies the disk drive to be protected if omitted...

Page 73: ...TRS 80 MODEL Ml DISK SYSTEM Examples WP DRIME i trsdos will write protect the disk in Drive 1 WP trsdos will eliminate write protection on all drives 66...

Page 74: ...prompt you at each step after you type BACKUP If you omitted the source destination drive numbers trsdos will begin with the prompts SOURCE DRIVE NUMBER Type in the number of the drive that contains t...

Page 75: ...this reason Model I Disk basic programs may require slight changes before they will run properly in the Model III Disk System Model I machine language programs may require major or minor changes befo...

Page 76: ...in the source directory Sample Use Get the Model I diskette ready If you have a Model I Disk System with trsdos 2 3 try to remove all passwords from all your files This will prevent any problems with...

Page 77: ...ormat takes a blank new or magnetically erased diskette records track sector boundaries on it then initializes it with and creates a directory When format detects a non blank diskette it will display...

Page 78: ...start the do file Once the herzso change is done it will remain in effect for that diskette To perform the change type DO HERZ50 Once the change has been made you will need to reset the system to put...

Page 79: ...e your program diskette lpc will automatically load into memory and you can use the program as usual lpc locates into the highest available memory There is no need to set MEMORY SIZE to protect lpc It...

Page 80: ...2 to version 1 3 etc System files which already exist on the destination diskette are replaced by those from the source diskette Files which do not exist on the destination diskette are added User fi...

Page 81: ...ntiguous bytes Granule The minimum allocatable unit of storage for any file Extent One contiguous allocation of granules System Routines for Assembly Language I O This information is provided for cust...

Page 82: ...be used to position to end of file so that new records may be added to the end of the file To position to the end of file use a call to posn with a record number of ern l posn is described later Phys...

Page 83: ...sdos will not move a logical record for the user if lrl 0 in this particular case it will only read write the physical record to from the buffer Once control is shifted to your program you will have a...

Page 84: ...ay to open the dcb of a file which already exists in the directory The dcb must contain the filespec of the file to be opened before entry to open Entry Conditions HL BUFFER DE DCB B LRL CALL OPEN Exi...

Page 85: ...c if lrl is not zero Unused if lrl o de dcb call write Exit Conditions Z OK a trsdos error code VERF 17468 X 443C The only difference between verf and write is that verf writes one physical record to...

Page 86: ...that the file may be opened Entry Conditions HL Filename DE DCB CALL SYNTAX Exit Conditions z Good file specification nz Bad file specification DIVIDE 17489 X 4451 The divide routine takes a 16 bit di...

Page 87: ...ry or the entire directory or the diskette s free space The information is written into a user specified ram buffer Only non system files will be included in the ram directory Entry Conditions hl ram...

Page 88: ...sage is ASCII coded FILPTR 17037 X 428D This routine provides information on any user file that is currently open It enables you to obtain the drive number and the logical file number for any file and...

Page 89: ...yy timloc Three bytes ss mm hh ERRDSP 17417 X 4409 This routine displays a trsdos error message determined by the contents of the accumulator A This register contains an error code 0 no error after c...

Page 90: ...er parameters that were included in the last command line For example given a program named editor cmd we want the operator to select an input file name when the program is loaded and executed from tr...

Page 91: ...ber 17 Directory Read Error 18 Directory Write Error 19 Invalid File Name 20 GAT Read Error 21 GAT Write Error 22 HIT Read Error 23 HIT Write Error 24 File Not Found 25 File Access Denied Due to Passw...

Page 92: ...you are first asked HON MANY FILES This lets you specify the maximum number of files that will be open or in use at once See open Type in an appropriate number and press ENTER or simply press ENTER an...

Page 93: ...then be protected from use by basic Example MEMORY SIZE 32000 CENTER causes basic to protect addresses above 32000 If you have 16K of ram this means that you ll have 32767 32000 767 bytes protected fo...

Page 94: ...a string array only Check printer status Start real time clock display Normal return to trsdos jump to exit routine Turn off real time clock display Cross reference of reserved words string variables...

Page 95: ...Hex Decimal 1 H1 1 2 H2 2 77777 H7FFF 32767 100000 H8000 32768 1 00001 H8001 32767 1 00002 H8002 32766 177776 HFFFE 2 177777 HFFFF 1 Hex and octal constants cannot be typed in as responses to an input...

Page 96: ...rogram Linexx EXX Edit Program Line xx DXX Delete Program Linexx AXXX XXXX Automatic Line Numbering Beginning at Linexxx Incrementing byxxxx CMD A Return to TRSDOS m This command allows you to return...

Page 97: ...key will remain disabled even after the program has ended To enable the BREAK key use the cmd B Y ON command Returning to trsdos via the cmd S or cmd I commands will also enable the BREAK key Example...

Page 98: ...OR GOTO 800 8G0 READ COMPANY 870 PRINT RIGHT C0MPANY 2 G0T0 880 880 END If you then wanted to delete the spaces type in CMD C and the program would read 850 RESTORE ONERRORGOTO800 8S0 READCOMPANY 870...

Page 99: ...MD n D i the directory for Drive 1 will be displayed CMD E Display Previous TRSDOS error CMD E This command displays the last trsdos error message If no errors have occurred prior to the command the m...

Page 100: ...rol will return to trsdos trsdos commands all overlay basic your z 80 program may not if it loads above basic Example CMD I t M PROGRAM returns you to trsdos and executes the program file program CMD...

Page 101: ...IGHT D1 3 90 J2 0AL RIGHT D2 3 100 SI Yl 365 Jl 110 S2 Y2 365 J2 120 PRINT THE INTERVAL BETWEEN DATES IS 5 130 PRINT ABS S1 S2 DAYS 140 PRINT IGNORING LEAP YEARS 150 INPUT ENTER TO CONTINUE A 1S0 GOTO...

Page 102: ...ng the number of Jfeih to be s ort9d arrayfstert specifies an array element The array contains the data to be sorted and start is the subscript of the first element to be sorted The array must be one...

Page 103: ...ch as PRINTER UNAVAILABLE and go on to some other operation To accomplish this you need to check the printer status cmd p can be used to check the printer s status at any time It returns the contents...

Page 104: ...is always running except during cassette or disk i o regardless of whether the display is on or off Example To turn on the clock display type CMD R To turn the display off type CMD T n CMD S Return to...

Page 105: ...splay function However the clock continues to run Example To stop the clock display update type CMD 11 To start the display type CMD R CMD X Cross reference of Program Lines CMO Vte gef target is eith...

Page 106: ...ere print was part of a quoted string lines 10 and 40 CMD X PRINT will find all occurrences of print as a string literal line 20 CMD X will list line 30 but CMD X will list line 40 CMD X A will list l...

Page 107: ...name determines the type of value the function will return For example if function name is single precision then that function will return a single precision value regardless of the precision of the...

Page 108: ...The value for x is passed when the function is called PRINT FNL 3 This line prints a string of 30 hyphens Here s an example showing def fn used for a complex computation in double precision DEF FNX A...

Page 109: ...o the USR3 call When your program calls USR3 control will branch to your subroutine beginning at x 7D00 DEFUSR BASE IS assigns start address base 16 to the usro routine Note When decimal addresses are...

Page 110: ...oln INSTR A INC returns a value of 2 INSTR A 12 returns a zero INSTR A t LINCOLNABRAHAM returns a zero For a slightly different use of instr look at INSTR 3 1232123 12 which returns 5 Sample Program T...

Page 111: ...ng input is to press ENTER line input is a convenient way to input string data without having to worry about accidental entry of delimiters commas quotation marks colons etc The CENTER key serves as t...

Page 112: ...wd oldstring position length replacement string o tf5fr 7 ff is the variabie name of the string you want to change pessiei character to be changed length is a numeric expression specifying the number...

Page 113: ...CHR U5 8Z0 PRINT S IS EASIER TO READ ISN T IT This program uses instr to search for the slash When it finds it if it finds it it uses MiD to substitute a Chr 45 for it NAME Renumber the Current Progra...

Page 114: ...ne These functions usro through USR9 transfer control to machine language routines previously defined with DEFUSRn statements When a urs call is encountered in a statement control goes to the address...

Page 115: ...ay to pass two or more arguments back and forth 2 Pass one argument to the routine as the argument in the usRn call then use special rom calls to access this argument and return a value to basic This...

Page 116: ...NE LANGUAGE FUNCTION 115 DEPRESS THE KEY WHILE NUMBERS ARE PRINTING TO STOP 120 130 POKE MACHINE PROGRAM INTO MEMORY 140 150 DEFUSR1 H7D00 1S0 FOR X 32000 TO 32013 7D00 HEX EQUAL 32000 DECIMAL 170 REA...

Page 117: ...er the heading File Access we will discuss the following statements and functions Statements OPEN CLOSE INPUT LINE INPUT PRINT HELD GET PUT LSET RSET Functions CVD CVI CVS EOF LOC Open a file for acce...

Page 118: ...Return number of last record in file Convert double precision number to string so it can be put on disk Convert integer to string so it can be put on disk Convert single precision number to string so...

Page 119: ...the first drive which contains it Do not kill an open file or you may destroy the contents of the diskette First close the open file LOAD Load BASIC Program File from Disk where jp defines a filespec...

Page 120: ...gram and loads progi bas from Drive 2 returns to basic command mode MERGE Merge Disk Program with Resident Program MERGE i if1W gelfication for an Ascii format basic disk file eg a program merge is si...

Page 121: ...ENTER then type in this program 100 CLS 110 PRINT LET S CALL THE SUBROUTINE 120 PRINT DIALING NOW 130 FOR 1 1 TO 1000 NEXT 140 GOSUB 1000 150 PRINT BACK FROM SUBROUTINE 1S0 END Now type MERGE file usi...

Page 122: ...e your basic programs on disk You can save the program in compressed or ascii format Using compressed format takes up less disk space and is faster during both saves and loads Using the ascii option m...

Page 123: ...compressed format with the file name filei extension bas password johnqdoe the file is placed on Drive 3 SAUE MATHPAK TXT n A saves the resident program in ascii form using the name mathpak txt on th...

Page 124: ...zation 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 numb...

Page 125: ...create a file write data into it update it and read it For details on file access see Methods of Access later in this section If file includes a drive specification basic will use only the specified d...

Page 126: ...rs 1 2 and 8 These buffers can now be assigned to other files with open statements CLOSE FIRSTX COUNTX Terminates the file assignment to the buffer specified by the sum first COUNT Do not remove a dis...

Page 127: ...at of the data is Here is a description of how input interprets the various characters it encounters when reading data When inputting data into a variable basic ignores leading blanks when the first n...

Page 128: ...at the 2 and ends with the 7 String Input When reading data into a string variable input ignores all leading blanks the first non blank character is taken as the beginning of the data item If this fi...

Page 129: ...provide several examples When basic encounters a terminating character it scans ahead to see how many more terminating characters it can include with the first terminator This ensures that basic will...

Page 130: ...tAtBtC Ex Image on disk 123 45 ENTERS 8 2E4 70B8 ENTER 3 HT H 4 fENTER 5 ENTER AlZeof 1 2 3 4 CENTER i 3 t eof Values assigned A 123 45 B 82000 C 7000 A 34 B 5 C A 1 B C 2 A 1 B 3 C eof error eof end...

Page 131: ...J ENTER UNIT OF MEMORY B null eof error In Example 3 the first data item is an unquoted string therefore the double quotes are not terminators and become part of a In Example 4 the ENTER is preceded...

Page 132: ...ooks like 10 CLEAR 500 ENTER 20 OPEN fl PR0G ENTER then the statement LIIMEINPUT 1 A could be used repetitively to read each program line one line at a time PRINT Sequential Write to Disk File ii ii l...

Page 133: ...PRINT 1 A B places the data on disk as 2300 1 303 ENTER The comma between a and b in the print list causes 10 extra spaces in the disk file Generally you wouldn t want to use up disk space this way so...

Page 134: ...the value doe and b will get john q because of the comma after doe in the disk image To write this data so that it can be input correctly you must use the chr function to insert explicit double quotes...

Page 135: ...rst field nmexp2 specifies the length of the second field uar2 defines a variable name for the second field Subsequent nmexp as var pairs define other fields in the buffer Note The sum of all the fiel...

Page 136: ...ctions below FIELD 3 IS AS NM 25 AS AD 10 AS CY 2 AS ST H AS ZP The first 16 bytes of buffer 3 are assigned the buffer name nm the next 25 ad the next 10 cy the next 2 st and the next 7 zp The remaini...

Page 137: ...ffer or retrieve it from the buffer The buffer now looks like this 16 112 16 112 CL d HIST D CL 2 HIST 2 DUMMY GET Read a Record from Disk Random Access get mexpti imxp2i into 15 nmexp2 specifies whic...

Page 138: ...are using variable length records not fixed length an attempt to get past the end of file will produce an error If you are using fixed length records the same attempt will return a null record and no...

Page 139: ...nt record is the record whose number is one higher 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...

Page 140: ...rence between lset and rset For example RSET NM JIM CRICKET JR RSET AD 2000 EAST PECAN ST places data in the fields as follows JIM CRICKET JR 2000 EAST PECAN ST NM AD If a string item is too large to...

Page 141: ...of mkd mki and mks respectively For example suppose the name grosspays references an eight byte field in a random access file buffer and after GETting a record grosspays contains a mkds representation...

Page 142: ...er in the file is read the eof test in line 30 passes so the program branches out of the disk access loop preventing an input past end error from occurring Also note that the variable i contains the n...

Page 143: ...It is useful for both sequential and random access For example during random access to a pre existing file you often need a way to know when you ve read the last valid record lof provides a way lof i...

Page 144: ...umber to a string Actually 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 Th...

Page 145: ...converted single precision values yrs and hr converted integers Suppose we want to write the following data record slow learner played 38 years lifetime batting average 123 career homeruns 11 at bats...

Page 146: ...starting at the end of file You also assign a file buffer for basic to use during file accesses This number can be from 1 to 15 but must not exceed the number of concurrent files you requested when yo...

Page 147: ...data item begins and ends To read a file sequentially you must know ahead of time the format of the data For example Does the file consist of lines of text terminated with carriage returns Does it con...

Page 148: ...already exists line 10 will cause all its data to be lost Here s why Whenever a file is opened for sequential output the end of file eof is set to the beginning of the file In effect trsdos forgets t...

Page 149: ...ly acquired data Line 40 reads a value into the string array unit and a number into the single precision array factr Note that this input list parallels the print list that created the data file see t...

Page 150: ...STR PROG TXT 0 THEN 110 require TXT extension 40 0PEN I H t 1 t PROG 50 H 60 IF EOF l THEN 30 70 n n l LINE INPUT I t TEMP 80 GOTO G0 30 PRINT PROG IS 11 LINES LONG 100 CLOSE GOTO 20 110 PRINT FILESPE...

Page 151: ...and functions to structure your data Once you have set up the structure direct input output becomes quite simple The last advantage listed above is also the hard part of direct access It takes a littl...

Page 152: ...and gives buffer 1 direct access to the file Line 110 defines two fields onto buffer 1 wd consists of the first 16 bytes of the buffer meanings consists of the last 240 bytes wd and meanings are now...

Page 153: ...be on the right Now that the data is in the buffer we can write it to disk with a simple put statement 140 PUT 1 1 150 CLOSE This writes the first record into the file glossary bas To read and print t...

Page 154: ...ntents of the record use CVD CVI CVS before displaying numeric data 5 LSET and RSET new values into the fields use MKD MKI MKS with numeric data before setting it into the buffer 6 PUT the updated rec...

Page 155: ...n pointer to next alpha entry NX 1 2 3 4 LEFT JUSTIFY BYTE RIGHT JUSTIFY HEXADECIMAL 3 4 1 When we read record 2 byte it tells us that record 4 hexadecimal is next which then tells us record 1 left ju...

Page 156: ...d file number 54 File not found 55 Bad file mode 58 Disk i o error 62 Disk full 63 Input past end 64 Bad record number 65 Bad file name 67 Direct statement in file 68 Too many files 69 Disk write prot...

Page 157: ...3 105 Commands Auto 29 30 Entering 20 Forms of 21 Subject Page Library 26 66 Syntax 20 Utility 67 89 CONVERT 8 10 25 68 COPY 34 50 CREATE 35 CSAVE 63 CVD CVi CVS 139 40 Data Diskette See Diskette DATE...

Page 158: ...53 LOAD 12 54 118 Load 11 LOC 141 2 LOF 142 LPC 71 Maintenance 13 MASTER 55 64 Memory Display 38 Map 19 User 38 59 Subject Page Memory Size 11 MEMTEST 72 MERGE 119 MID 93 111 MKD MKI MKS 143 4 NAME 9...

Page 159: ...93 113 VERF 31 Videooutput 47 105 WP 65 WRITE 80 1 Write protect notch 5 XFERSYS 73 7 80 37 39 40 41 48 55 56 63 Hand 0 93 4 Subject Page Figures and Tables A Diskette 5 Connection of the External Di...

Page 160: ...system and applications software modified or not in whole or in part provided CUSTOMER has purchased one copy of the software for each one resold The provisions of this Software License paragraphs A B...

Page 161: ...es the right to refuse to service the equipment or to void any remaining warranty on the equipment 2 If any Radio Shack computer equipment has been modified so that it is not within manufacturer s spe...

Page 162: ...ram are satisfactory RADIO SHACK SOFTWARE LICENSE A Radio Shack grants to CUSTOMER a non exclusive paid up license to use on CUSTOMER S computer the Radio Shack computer software received Title to the...

Page 163: ...adio Shack s election and sole expense Radio Shack shall have no obligation to replace or repair expendable items Any statements made by Radio Shack and its employees including but not limited to stat...

Reviews: