TSCLIB A Library for C Programmes under TSX-plus V3 18th February 1989 TSCLIB is a library of functions designed to allow the user access to TSX-plus functions using the DECUS C compiler. It also contains routines giving access to RT-11 functions at a more primitive level than is allowed in the standard C library. Whilst this does not allow portability from RT/TSX, it does allow systems programming with a reasonable degree of efficiency. It also allows C programmes to be written which are designed not to use any of the normal C operating system at all, should space be a problem. TSCLIB is written in Macro-11 for TSX-plus and RT-11 on the PDP-11 family of computers, by Chester Wilson, 71 Galatea St, Charleville 4470, Australia. All brickbats should be hefted at him. There are four sections to TSCLIB: 1) TSX EMTs 2) Handy TSX Routines 3) RT-11 EMTs 4) Ancillary routines and CVLLIB portion. For the more complicated routines this manual will have to be used in conjunction with the TSX &/or RT-11 Reference Manuals, as the author had no intention of typing them all into this document. Note that routines which decode device or file names call routines from CVLLIB, another library of useful routines available from DECUS. ______ TSCLIB - A Library for C Programmes under TSX-plus Page 2 T A B L E O F C O N T E N T S Chapter 1: Errors Returned by TSCLIB Chapter 2: TSX EMTs 2.1 TSCVER - Provides current version & edit numbers of TSCLIB 2.2 TSX - Determine whether running under TSX-plus 2.3 SPLFRE - Return Number of Free Spool Blocks 2.4 SPHOLD - Set Spooler Hold 2.5 SPNOHO - Set Spooler NoHold 2.6 TSXLN - Return Terminal Line 2.7 TSXSLN - Return Suboprocess Line 2.8 ACTODT - Set/Reset ODT Activation Mode 2.9 TTOBLK - Send a Block of Characters to the Terminal 2.10 TTIBLK - Get a Block of Characters 2.11 CKTTIE - Check for Terminal Input Errors 2.12 NUMTTC - Return Number of Waiting Terminal Characters 2.13 SETTTO - Set Terminal Time-Out 2.14 HIEFF - Set/Reset High Efficiency Terminal Mode 2.15 CKACT - Check for Activation Character Pending 2.16 SEND - Send (Asciz) Buffer to Another Line 2.17 YELL - Send (Asciz) Buffer to Another Line despite Gag 2.18 DCLBRK - Set Up Completion Routine for BREAK Key 2.19 TTICPL - Set Up Completion Routine for TT Input 2.20 MOUNT - Mount a Device 2.21 DISMNT - Dismount a Device 2.22 DISALL - Dismount All Mounted Devices 2.23 LDMOU - Mount a Logical Disc Unit 2.24 LDDIS - Dismount a Logical Disc Unit 2.25 LDDISA - Dismount all Logical Disc Units 2.26 LDSTAT - Return Logical Disc Status 2.27 TTYPE - Return Terminal Type 2.28 JSTAT - Check Job Status 2.29 FILINF - Return File Information 2.30 SFTIM - Set File Time 2.31 GETNAM/SETNAM - Get/Set User Name 2.32 GTPNAM/STPNAM - Get/Set Programme Name 2.33 SJBPRI - Set Priority 2.34 SETPRV - Get/Set Privileges 2.35 SELOPT - Set Terminal Characteristics 2.36 NONINT - Set/Reset Interactive Mode 2.37 STTSPD - Set Line Parameters 2.38 GETCL - Get a CL Line 2.39 ALCDEV - Allocate/Deallocate a Device 2.40 MONJOB - Job Monitoring 2.41 GETCXT - Get Job's File Context 2.42 Windows - Create, Select, Delete, Suspend, Resume & Print 2.43 Shared File Access 2.44 TSX Message Channels 2.45 Performance Monitoring 2.46 Detached Jobs 2.47 SWTSUB - Subprocess Switching EMTs 2.48 RTTIM1 - Real-Time EMTs for TSX TSCLIB - A Library for C Programmes under TSX-plus Page 3 2.49 RTTIM2 - Heavier Real-Time TSX EMTs 2.50 RTTIM3 - Heaviest Real-Time TSX EMTs 2.51 Shared Run-Time System Support 2.52 KILL - Kill a Job 2.53 KMON Illusion Routines Chapter 3: Handy TSX Routines 3.1 BPT - Assist in debugging 3.2 TTIN - Get terminal input from TT or Command File 3.3 TSXCMD - TRUE if under TSX & run from Command File 3.4 EXITM - Exit Sending Commands to KMON Chapter 4: RT-11 EMTs 4.1 $ABTIO - Abort I/O on a channel 4.2 $CHAIN - Chain to another programme 4.3 $CLOSE - Close a channel. 4.4 $CMKT - Cancel a Mark Time Request 4.5 $CRAW - Create a Virtual Address Window 4.6 $CRRG - Create a Dynamic Region 4.7 $CSTAT - Returns Channel Information 4.8 $DATE - Returns System Date in RT-11 format 4.9 $DELETE - Deletes a File 4.10 $DEVICE - Set up locations on exit from programme 4.11 $DSTATUS - Return Device Status Information 4.12 $ELAW - Eliminate a Virtual Address Window 4.13 $ELRG - Eliminate a Region 4.14 $ENTER - Enter a File 4.15 $FETCH - Fetch a Handler 4.16 $FPROT - Handle File Protection 4.17 $GMCX - Return Mapping Status of Extended Memory Window 4.18 $GTIM - Return System Time 4.19 $GTJB - Return Job Information 4.20 $GTLIN - Use the GTLIN request 4.21 $GVAL - Return Monitor Value 4.22 $HERR - Don't Trap Monitor Errors 4.23 $LOCK - Lock the USR 4.24 $LOOKUP - Lookup a file 4.25 $MAP - Map a Previously Defined Address Window 4.26 $MRKT - Schedule a Completion Routine after Elapsed Time 4.27 $PEEK - Returns Low Memory Address 4.28 $POKE - Deposit Value into Low Memory 4.29 $PRINT - Print a line to the terminal 4.30 $PROTECT - Protect a Vector 4.31 $PURGE - Purge a Channel 4.32 $RCTRLO - Clear Control-O 4.33 $READ - Read Without Waiting 4.34 $READC - Read, Scheduling Completion Routine 4.35 $READW - Read and Wait 4.36 $RELEAS - Release a Handler 4.37 $RENAME - Rename a File 4.38 $REOPEN - Reopen a Saved Channel 4.39 $SAVESTATUS - Save Channel Status TSCLIB - A Library for C Programmes under TSX-plus Page 4 4.40 $SCCA - Handle Control-C Under RT/TSX 4.41 $SDTTM - Set date and time 4.42 $SERR - Trap "Serious" Errors 4.43 $SFDAT - Modify File Creation Date 4.44 $SFPA - Set Floating-Point Exception Trap 4.45 $SPFUN - Allow SPFUNs From "C" 4.46 $SPND - SPND & RSUM for C programmes 4.47 $TLOCK - Lock USR, returning if not available 4.48 $TRPSET - Intercept traps to 4 and 10 4.49 $TTINR - Return character from terminal 4.50 $TTYIN - Get 1 character from the TT 4.51 $TTYOU - Send a character to the TT 4.52 $TWAIT - Wait for a Timed Interval 4.53 $UNLOCK - Unlock the USR 4.54 $UNMAP - Unmap a Virtual Address Window 4.55 $UNPROTECT - Unprotect a Vector 4.56 $WAIT - Wait for Channel I/O to Finish 4.57 $WRITC - Write, Scheduling a Completion Routine 4.58 $WRITE - Write, with no waiting 4.59 $WRITW - Write and Wait Chapter 5: Ancillary Routines 5.1 UNUCHN - Return an Unused Channel 5.2 EMTRET - Return 0 (FALSE) if CS, 1 (TRUE) if CC 5.3 EMTEMT - Perform EMT & Return Error Value if Necessary 5.4 EMTAREA - Area for EMTs 5.5 CMPSET - Set up Completion Routine 5.6 CSV$ & CRET$ - Subroutine Linkages for Programmes with Macro Main Routine & C Subroutines 5.7 RFTLB - Read Filename for TSCLIB 5.8 $RAD50 - Get a Radix-50 Value TSCLIB - A Library for C Programmes under TSX-plus Page 5 U P D A T E H I S T O R Y V1 8-Aug-87 Initial Version V1a 13-Jan-88 Inclusion of KILL & KMON Illusion Routines V2 24-Aug-88 Addition of EMTs from 6.01 to 6.31; this involves changes to STTSPD making it incompatible with previous versions, and addition of TSXSLN, NUMTTC, YELL, DISALL, LDMOU, LDDIS, LDDISA, LDSTAT, GTPNAM, STPNAM, SWTSUB, and EXITM. Note that there is now an assembly in the KILL file allowing for an assembly option for before or after TSX-plus verion 6.31. V3 17-Feb-89 Add "X" prefixed routines to allow access to Radix-50 device filenames if required _ (eg $XLOOK vs $LOOKUP). CHAPTER 1 Errors Returned by TSCLIB When an EMT is executed, errors are returned to a macro programme by the setting of the Carry bit. As this cannot easily be translated into C programmes, the following values may be returned by TSCLIB functions unless specifically stated: 0 no errors detected positive value is <1+monitor error value> negative value is that returned by monitor (this set of values provided when $SERR called). The meanings for positive returns vary with each EMT used, and will need to be checked against the TSX and RT manuals. CHAPTER 2 TSX-Specific Portion of TSCLIB 2.1 TSCVER - Versions of TSCLIB TSCVER and TSCEDT are globals which are defined in this module. By loading TSCVER with the LINK/INCLUDE switch, you may examine the load map and see which version of TSCLIB you are using. At the time of this manual, they are both 2. ---------------------NOTE THIS ROUTINE!----------------------- 2.2 TSX - Determine whether running under TSX-plus int tsx(); This function returns TRUE (1) if running under TSX-plus, FALSE (0) otherwise. It contains a global TSX$$ which is set to zero if not running under TSX, one if running under TSX. The technique used is merely testing the bit in the SYSGEN offset in RMON. Thus this will not work for TSX version 5. This routine should be called at the beginning of any programme using this library, as some of the routines assume TSX$$ to have been set up before they are called. --------------------------------------------------------------- TSCLIB - A Library for C Programmes under TSX-plus Page 2-2 TSX-Specific Portion of TSCLIB 2.3 SPLFRE() - Return Number of Free Spool Blocks unsigned int splfre(); This function returns the number of blocks available in the spooler file. [EMT 375, 107, 0] 2.4 SPHOLD - Set Spooler Hold sphold(chan); Sets already-opened spooler channel to HOLD mode. This should be called after the channel has been opened but before any output has been performed. (HOLD mode causes the spooler to wait until all output has been sent before sending any of it to the spooled device.) [EMT 375, 151, 1] 2.5 SPNOHO - Set Spooler NoHold spnoho(chan); Sets already-opened spooler channel to NOHOLD mode. This should be called after the channel has been opened but before any output has been performed. (NOHOLD mode causes the spooler to start sending output to the spooled device as soon as output becomes available, whether the output has been completed or not.) [EMT 375, 151, 0] 2.6 TSXLN - Return Terminal Line int tsxln(); Returns the line number for the job. This corresponds to the line indicated for that job on a SHOW TT command. [EMT 375, 110, 0] TSCLIB - A Library for C Programmes under TSX-plus Page 2-3 TSX-Specific Portion of TSCLIB 2.7 TSXSLN - Return SubProcess Line int tsxsln(subjob); int subpro; Returns the line number for the subprocess specified. This subprocess number is the same as the number typed after control-W to access that subprocess. [EMT 375, 110, 0] 2.8 ACTODT - Set/Reset ODT Activation Mode actodt(n); Set/Reset ODT Activation Mode if n is 1/0 respectively. Other values are not checked for! [EMT 375, 111, 0] 2.9 TTOBLK - Send a Block of Characters to the Terminal ttoblk(buf,count) char *buf; int count; This is a TSX oddity for sending a counted block of characters to the terminal in a more efficient manner than usual. [EMT 375, 114, 0] 2.10 TTIBLK - Get a Block of Characters ttiblk(buf,size) char *buf; int size; Another TSX oddity for getting characters from the terminal (size is number of bytes available). [EMT 375, 115, 0] 2.11 CKTTIE - Check for Terminal Input Errors int ckttie(); Returns FALSE (0) if errors, TRUE (1) if no errors. TSCLIB - A Library for C Programmes under TSX-plus Page 2-4 TSX-Specific Portion of TSCLIB [EMT 375, 116, 0] 2.12 NUMTTC - Return Number of Terminal Characters Pending int numttc(); Returns number of input characters pending in type-ahead for this job. [EMT 375, 116, 1] 2.13 SETTTO - Set Terminal Time-Out settto(time,char) int time; char char; This warp-minded thing shoves char into the terminal input stream if the user did not provide input in the time specified. Too bad if he actually types the char: that kills him dead. (Try ^A to login ...). To be fair, this would have been the easiest way given the RT-11 problems with terminal input, and it does work. The time is in half-second units. [EMT 375, 117, 0] 2.14 HIEFF - Set/Reset High Efficiency Terminal Mode hieff(n) int n; Switches terminal high efficiency mode on/off if n is 1/0 respectively. Note that the SELOPT EMT/Routine can turn it on but not off. It ain't only RT wot suffered Topsy-type growth, am it? [EMT 375, 120, 0/1] 2.15 CKACT - Check for Activation Character Pending int ckact(); Returns 1 (TRUE) if an activation character is pending, 0 (FALSE) otherwise. [EMT 375, 123, 0] TSCLIB - A Library for C Programmes under TSX-plus Page 2-5 TSX-Specific Portion of TSCLIB 2.16 SEND - Send (Asciz) Buffer to Another Line int send(line,buffer) int line; char *buffer; Sends the ASCIZ string in buffer to the terminal line. Error Conditions: 1 Job does not have SEND privilege. 2 Line has SET TT GAG set and is executing a programme [EMT 375, 127, 0] 2.17 YELL - Send (Asciz) Buffer to Another Line Despite GAG int yell(subfunc,line,buffer) int line; char *buffer; Sends the ASCIZ string in buffer to the terminal line. Returns values a la EMTEMT Subfunction values: bit 0: 0 selects no-GAG-override [ie reverts to SEND] 1 selects GAG-override bit 1: 0 waits for free message buffer 1 if no free message buffers, returns with error code <2+1>=3 Error Conditions: 1 Job does not have SEND privilege. 2 Line has SET TT GAG set and is executing a programme [EMT 375, 127, 0] - same as SEND 2.18 DCLBRK - Set Up Completion Routine for BREAK Key dclbrk(char,routine) char char, routine(); Sets up a routine to be executed if the BREAK key is typed. [EMT 375, 133, 0] TSCLIB - A Library for C Programmes under TSX-plus Page 2-6 TSX-Specific Portion of TSCLIB 2.19 TTICPL - Set Up Completion Routine for TT Input tticpl(routine) int routine(char) char char; Sets up a routine to be called when the next character is typed at the terminal. However, can't keep a good thing to itself: bloody returns that character to the completion routine. (Didn't they learn from RT-11's mistakes?) Another nasty is that it cannot track command files. If you use this with command files, it will grab type-ahead before characters in the command file. [See TTIN for trying to get round all this.] [EMT 275, 133, 1] 2.20 MOUNT - Mount a Device Ascii: int mount(dev) char dev[]; eg mount("du6") or mount("du6:"); Radix-50: int xmount(dev) int dev; eg mount($rad50("du6")); The character string is only looked at up to the first three characters or the first non-radix-50 character, whichever comes first. [EMT 375, 134, 0] 2.21 DISMNT - Dismount a Device Ascii: int dismnt(dev) char *dev; eg dismount("du6") or dismount("du6:") Radix-50: int xdismn($rad50("du6")) The character string is only looked at up to the first three characters or the first non-rad50 character, whichever comes first. [EMT 375, 135, 0] TSCLIB - A Library for C Programmes under TSX-plus Page 2-7 TSX-Specific Portion of TSCLIB 2.22 DISALL - Dismount All Mounted File Structures disall(); dismounts all mounted file structures - no error returns. [EMT 375, 135, 2] 2.23 LDMOU - Mount Logical Discs Ascii: i=ldmou(unit,readflg,"file") int unit, readflg; Radix-50: i=xldmou(unit,readflg,file); int unit, file[4], readflg; unit LD unit - value from 0 through 7 readflg 0 allow reads and writes 1 disallow writes "file" ASCIZ string with name of file file Radix-50 name of file Error Conditions 1 Channel is already open (should not happen?) 2 Invalid logical disc number 3 Logical disc upport not generated into system 4 Logical disc already associated with a file 5 Invalid file specification 6 Invalid logical unit number nesting 7 Unable to open specified file [EMT 375, 163, 0] 2.24 LDDIS - Dismount a Logical Disc i=lddis(unit) Dismounts that LD unit (from 0 through 7). Error Conditions: 1 Specified LD unit is not associated with a file 2 Invalid LD unit number TSCLIB - A Library for C Programmes under TSX-plus Page 2-8 TSX-Specific Portion of TSCLIB 3 LD support not sysgened into system 4 Some channel is opened to a file on the logical disc [EMT 375, 135, 3] 2.25 LDDISA - Dismount All Logical Discs i=lddisa() Error Conditions: 3 LD support not sysgened into system 4 Some channel is opened to a file on a logical disc [EMT 375, 135, 5] 2.26 LDSTAT - Return Status of Logical Disc Unit Ascii: i=ldstat(unit,&readflg,file); char file[]; Radix-50: i=xldsta(unit,&readflg,file); int file[4] unit LD unit to determine status of (0 through 7) readflg returns 0 if read/write, 1 if read only. file returns ASCIZ string of filename associated with LD or 4 words in Radix-50 Error Conditions: 1 LD is not currently accessible. [EMT 375, 135, 4] 2.27 TTYPE - Return Terminal Type int ttype(); Returns terminal type for current line. 0 unknown 1 VT52 2 VT100 TSCLIB - A Library for C Programmes under TSX-plus Page 2-9 TSX-Specific Portion of TSCLIB 3 Hazeltine 4 ADM3A 5 LA36 6 LA120 7 Diablo & Qume 8 9 VT200 [EMT 375, 137, 0] 2.28 JSTAT - Check Job Status jstat(line,func,buffer) int line; char func; int *buffer; 0 func: check status of line. Bits set indicate status: 1 subprocess 2 detached 100 locked in memory 200 has SYSPRV 1 func: execution state: 1 non-interactive high priority run state 2 normal priority run state 3 fixed low priority run state 4 terminal input wait 5 terminal output wait 6 timed wait 7 suspended (.SPND) 8. shared file wait 9. message wait 10. USR wait 11. I/O wait 12. spool wait 13. interactive high priority run state 14. fixed high priority run state 15. memory expansion wait 2 func: return amount of memory in 256-word blocks (incl PLAS regions) 3 func: return connect time (minutes) 4 func: returns 256-word block number of start of memory area allocated to that job 5 func: return 2-word programme name 6 func: returns project & programmer numbers 7 func: returns clock-ticks of CPU time used (high order word first) TSCLIB - A Library for C Programmes under TSX-plus Page 2-10 TSX-Specific Portion of TSCLIB 8 func: returns job execution priority. 9 func: returns job name (12 bytes). [EMT 375 144, 0] 2.29 FILINF - Return File Information Ascii: int filinf(file,block) int block[]; char file[]; Radix-50: int xfilin(file,block) int block[], file[4]; eg filinf("dk:x.tmp",block); Gets information about the file into 7-word block. Error Conditions: 1 Cannot get a free channel to use 2 Unable to locate specified file 3 Device is not file structures [EMT 375, 145, 0] 2.30 SFTIM - Set File Time Ascii: int sftim(file,time) char file[]; int time; Radix-50: int xsftim(file,time) int file[4], time; eg sftim("dk:fred.dat",1000); Sets the time for the file in 3-second units (since previous midnight). Error Conditions: 1 Cannot get a free channel 2 Cannot find file 3 Device is not file structured TSCLIB - A Library for C Programmes under TSX-plus Page 2-11 TSX-Specific Portion of TSCLIB [EMT 375, 145, 0] 2.31 GETNAM/SETNAM - Get/Set User Name getnam(string) char *string; setnam(string) char *string; Gets/Sets user name into/from string. The name is twelve characters long, padded to the right with spaces. An error return means the user does not have SETNAME privilege. [EMT 375, 147, 0/1] 2.32 GTPNAM/STPNAM - Get/Set Programme Name gtpnam(string) char *string; stpnam(string) char *string; Gets/Sets programme name into/from string. The name is six characters long, with a terminating null (make sure string is at least seven characters long!). An error return means the user does not have SETNAME privilege. [EMT 375, 147, 3/4] 2.33 SJBPRI - Set Priority sjbpri(value) int value; Sets the job priority to value from 0-127 [EMT 375, 150, 0] 2.34 SETPRV - Get/Set Privileges setprv(func,type,buffer) char func, type; int *buffer; Returns/clears/sets privilege bits for func 0, 1, 2 respectively, in current/set/authorized privs for for type 0, 1, 2 respectively. [The values are not checked for validity.] Privileges are: TSCLIB - A Library for C Programmes under TSX-plus Page 2-12 TSX-Specific Portion of TSCLIB 1, 1 SYSPRV System manager functions (eg authorize accounts) 1, 2 NFSWRITE ibid, writes 1, 4 NFSREAD Perform non file structured reads 1, 10 SETPRV Set privileges beyond those authorized 1, 20 SETNAME Change job name or password 1, 40 SEND Sent a message to another terminal 1, 100 REALTIME Real time system services (eg interrupt connect) 1, 200 PSWAPM Change process swap mode (ie lock in memory) 1, 400 OPER Operator functions (eg set time, spool control) 1, 1000 BYPASS Bypass device/file access restrictions 1, 2000 MEMMAP Access system memory (eg I/O page) 1, 4000 SPFUN Allow SPFUNs 1,10000 DETACH Start of kill detached jobs 1,20000 DEBUG Use system debugging facilities 1,40000 ALLOCATE Allocate a device 2, 1 UP1 User-defined privs 1 2, 2 UP2 ibid, 2 2, 4 UP3 ibid, 3 2, 10 UP4 ibid, 4 2, 200 GETCXT Get file context from another job 2, 400 SYSGBL Use named global regions & display windows 2, 1000 RLOCK Shared file record locking & access control 2, 2000 MESSAGE Send and receive messages 2, 4000 SUBPROCESS Use virtual lines 2,10000 SAME Affect another job with same project and programmer number 2,20000 GROUP Affect other jobs with same project number 2,40000 WORLD Affect any job 2,100000 TERMINAL Terminal and CL line control Error Conditions: 1 Attempt to enable privileges for which the job is not authorized. Only those privileges for which the job is authorized are set. [EMT 375, 150, 1] 2.35 SELOPT - Set Terminal Characteristics selopt(func,arg) int func, *arg; If arg is unnecessary, it need not be specified [whatever is on the stack will be used, but this should not matter]. TSCLIB - A Library for C Programmes under TSX-plus Page 2-13 TSX-Specific Portion of TSCLIB FUNCTION MEANING A * Set rubout filler character B Enable VT52 & VT100 escape-letter activation C Disable, ibid D * Define new activation character E Turn on character echoing F Turn off, ibid H Disable subprocesses I Enable lower case J Disable ibid K Enable deferred character echo L Disable ibid M Set transparency mode for output N Suspend command file input O Restart command file input P * Reset activation character Q * Set activation on field width R Turn on high efficiency TTY mode S Turn on single character activation mode T Turn off, ibid U Enable no-wait TT input test V * Set field width limit W Turn tape mode on X Turn tape mode off Y Disable echo of after Z Enable, ibid * = requires additional argument. [EMT 375, 152, 0] 2.36 NONINT - Set/Reset Interactive Mode nonint(n) int n; Sets job to interactive/noninteractive mode for values of n 1/0 respectively. The value of n is not checked. [EMT 375, 153, 0] 2.37 STTSPD - Set Line Parameters sttspd(subfunc,line,params) int subfunc, line, params; Sets terminal or CL line parameters - NEARLY all but dips out on number of stop bits. Thanks folks! The subfunc argument was added in V2 of TSCLIB, making this function incompatible with previous versions of this library. TSCLIB - A Library for C Programmes under TSX-plus Page 2-14 TSX-Specific Portion of TSCLIB Values for subfunc are: 0 set speed 1 reset line XOFF status 2 raise line DTR 3 lower line DTR For subfunction 0 (set speed), the PARAMS argument is used. The low-order 8 bits are used as follows: Bit Value Meaning 7 0 Even parity 1 Odd parity 6 0 No parity 1 Enable parity 5 0 8 data bits 1 7 data bits 4 Unused (still hope!) 3,2,1,0 Speed: 1 75 11 2000 2 110 12 2400 3 134.5 13 3600 4 150 14 4800 5 300 15 7200 6 600 16 9600 7 1200 17 19200 10 1800 Error Conditions: 1 Job does not have TERMINAL privilege 2 Invalid line number specified [EMT 375, 154, 0] 2.38 GETCL - Get a CL Line getcl(clunit,line) int clunit,line; Attempts to connect CL'clunit to the desired line. [CL lines are numbered from 0 through to the highest one generated in a system. The C1x lines will usually therefore start at number 8, up to number 15 for C17.] Error Conditions: 2 Job does not have TERMINAL privilege 3 Invalid CL specified 4 Invalid line specified 5 Line already assigned to a CL 6 Line in use as time-sharing line 7 CL currently busy TSCLIB - A Library for C Programmes under TSX-plus Page 2-15 TSX-Specific Portion of TSCLIB [EMT 375, 155, 0] 2.39 ALCDEV - Allocate/Deallocate a Device Ascii Device Names: alcdev(dev) char *dev; eg alcdev("cl5:") Tries to allocate a device dealoc(dev); Deallocates that device tstalc(dev); Tests for allocation of a device. Radix-50 Device Names: xalcde($rad50(dev)); xdealo($rad50(dev)); xtstal($rad50(dev)); Error Conditions: 2 Device allocated to another job 3 Invalid device 4 Device allocation table full (MAXALC) 5 Device in use 6 Job does not have ALLOCATE privilege [EMT 375, 156, 0/1/2] 2.40 MONJOB - Job Monitoring monjob(job,&routine) int job, routine(); Establishes a job monitoring request [If job is zero, monitor all jobs, including those not logged in at that time.] nomonj(job) Cancels a job monitoring request stamon(job) Broadcasts a monitor status report. Error Conditions: 1 No jobs are monitoring this line 2 Invalid job number specified 3 No free job monitoring control blocks (MAXMON) [EMT 375, 157, 0/1/2] TSCLIB - A Library for C Programmes under TSX-plus Page 2-16 TSX-Specific Portion of TSCLIB 2.41 GETCXT - Get Job's File Context getcxt(job) int job; Attempts to get the file context of the other job. Error Conditions: 1 Job not privileged to use this EMT 2 Job number invalid or not logged on [EMT 375, 160, 0] 2.42 Window Routines - Create, Select, Delete, Suspend, Resume & Print Note that these are TSX Process Windows, not RT-11 Virtual Address Windows. makwin(id,pflag,width,scroll) int id, pflag, width, scroll; Creates a window selwin(id) int id; Selects a window delwin(id) int id; Deletes a window spnwin(); Suspends window processing rsmwin(); Resumes window processing prtwin(id); Prints a window Error Conditions: 1 Window management not included at SYSGEN, or invalid EMT block 2 Maximum # windows already in use (MAXWIN) 3 Unable to create global memory region (may need SYSGBL privilege, or increase NGR, or may have insufficient memory space) 4 Unable to locate window with specified ID 5 WINPRT not running [EMT 375, 161, 0/1/2/3/4/5] TSCLIB - A Library for C Programmes under TSX-plus Page 2-17 TSX-Specific Portion of TSCLIB 2.43 Shared File Access shrfil(chan,access) int chan, access; Allows a file which has already been fopen'ed to be shared savshr(chan) int chan; Allows shared file details to be held across a savestatus lockw(chan,block) int chan, block; Waits for a locked block tlock(chan,block) Tries to lock a block unlock(chan,block) Tries to unlock a block unlall(chan) Unlocks all blocks locked by this user ckwshr(chan) Checks for writes to a shared file Error Conditions: 1 Job does not have RLOCK privilege, or shared file support not included at SYSGEN. 2 Channel has not been opened to a file. 3 Too many channels opened to shared files, or request to lock too many blocks in file, or some other job has written to file since last check (CKWSHR). 4 Too many shared files open, or requested block is locked by another user. 5 File protection / access conflict. [EMT 375, 125/122/102/103/113/101/121, 0] 2.44 TSX Message Channels sndmsg("chname",buf,size) char *buf; int size; Sends a message getmsg("chname",buf,size,&nbytes) char *buf; int size, nbytes; Checks for pending message, returning size in nbytes watmsg("chname",buf,size,&nbytes) char *buf; int size, nbytes; Waits for a message, ibid cmpmsg("chname",buf,size,routine) char *buf; int size, routine(arg_r0,arg_r1); Schedules a completion routine when a message is received, giving the length of the message in arg_r0 and the number of the sending job in TSCLIB - A Library for C Programmes under TSX-plus Page 2-18 TSX-Specific Portion of TSCLIB arg_r1. The channel name should be six ascii characters (space filled if necessary). Error Conditions: 1 Job does not have MESSAGE privilege, or system does not include message channel support. 2 All message channels are busy. 3 Max # of messages already in message queues. 4 No message was queued on the named channel. 5 Message too long: truncated to max length. 6 Max # message requests pending. [EMT 375, 104/105/106/106, 0/0/0/1] 2.45 Performance Monitoring initpa(base,top,celsiz,flags) Initializes parameters for performance analysis strtpa() Starts performance data collection stoppa() Stops, ibid haltpa(parbuf,hisbuf,bufsiz) Stops analysis and returns data Error Conditions: 1 Performance analysis being done by some other user. 2 Performance analysis not included at SYSGEN. [EMT 375, 136, 0/1/2/3] 2.46 Detached Jobs strtdj("filename") Starts the detached job, using the file as the job's command file. RETURNS 0 IF CAN'T, else JOB NUMBER of detached job. abrtdj(jobno) Aborts detached job. statdj(jobno) Checks status of detached job. [EMT 375, 132, 0/2/1] TSCLIB - A Library for C Programmes under TSX-plus Page 2-19 TSX-Specific Portion of TSCLIB 2.47 SWTSUB - Switch between subprocesses i=swtsub(subfunc,subpro,retpro,iniflg,"commandfile") Switches control between subprocesses: subfunc 0 use existing subprocess or create new one prn 1 create new subprocess 2 use existing subprocess subpro Number of subprocess (as per digit typed after ^W) If -1, locates first unused subprocess number and uses it retpro Process to return to when subprocess initiated by this EMT logs off. If -1, return to process which executed this EMT iniflg 0 Terminal control switches to subprocess 1 Terminal control remains with current process "file" ASCIZ name of command file to be executed by the specified subprocess. (If zero, no command file executed). Error Conditions: 2 You are not suthorized to use subprocesses 3 Specified subprocess number is too large 4 All of your subprocesses are already active 5 Insufficient memory space available for process 6 Specified subprocess has already been initiated 7 Specified subprocess has not been initiated [EMT 375, 162, 0] 2.48 RTTIM1 - Real-Time EMTs for TSX mapiop() Map i/o page into this job's PAR 7. mapmon() Map PAR 7 to simulated RMON. peekio(addr) Peek at address in i/o page. pokeio(addr,val) Poke into address in i/o page. bisio(addr,val) Bit set, ibid bicio(addr,val) Bit clear, ibid mapphy(par,addr,size,access,cache) int par, addr, size, access, cache; Map physical memory region An error return indicates either inadequate privileges to perform these EMTs. TSCLIB - A Library for C Programmes under TSX-plus Page 2-20 TSX-Specific Portion of TSCLIB [EMT 375, 140, 5/6/12/3/4/17] 2.49 RTTIM2 - Heavier Real-Time TSX EMTs steals() Requests exclusive use of system rturns() Relinquishes, ibid loklow() Lock job in low memory lokjob() Lock job where it is unlokj() Unlock job phyadd(virt,&phys) unsigned int virt, phys; Convert virtual address to physical setpri(n) int n; Sets processor priority to n (See SJBPRI for job priority) [EMT 375, 140, 14/15/7/13/10/0/16] 2.50 RTTIM3 - Heaviest Real-Time TSX EMTs attsvc(vector,routine) int vector, routine(); Connect interrupt service routine attvec(vector,routine,prio) int vector, routine(), prio; Connect interrupt completion routine relvec(vector) int vector; Release interrupt vector schcmp(routine,prio,r1value) int routine(), prio, r1value; Schedule a completion routine Error Conditions: 1 Real-time not included or job not privileged. 2 Maximum # vectors already in use. 3 Another job connected to that vector. 4 Job not locked in memory. [EMT 275, 140, 20/11/12/21] TSCLIB - A Library for C Programmes under TSX-plus Page 2-21 TSX-Specific Portion of TSCLIB 2.51 Shared Run-Time System Support userts(name) char *name; (name in asciz) Associate run-time system with job maprts(par,offset,size); Map associated run-time system on to job faston(par,offset,size,region); Define fast-access run-time system mapping region trap(region); Connect region to job fastof(); Disconnect all run-rime system definitions [EMT 375, 143, 0/1/2/3] 2.52 KILL - Kill a Job This EMT has changed form. If you are using TSX before version 6.3, you will need to change the definition of "V6.31" to zero, as until then it was a more complicated EMT to use. kill(line) int line; Kill the job on the associated line. old: [EMT 375, 126, 5 - Requires special KMON flag] new: [EMT 375, 132, 2] 2.53 KMON Illusion Routines For a job to execute various TSX internal EMTs (such as the KILL EMT), it is necessary that the job execute a special which gives it the same internal privileges as TSKMON. These privileges may be switched on and off respectively by the routines kmnon(); and kmnoff(); CHAPTER 3 Handy Routines for TSX C Programmes This section contains routines which are not merely extensions of TSX EMTs but give additional convenience or functionality. 3.1 BPT - Assist in debugging bpt() Merely puts a breakpoint trap so as to escape to the debugger, at a convenient point in the programme. [The programme does not have to be run with the RUN/DEBUG command for this to work, as long as the user has the DEBUG privilege and the debugger was TSGENed into the system.] 3.2 TTIN - Get terminal input from TT or Command File TSX-Plus suffers from a weird problem (up to 6.01 anyway) where type-ahead for a programme using single-character I/O will be held in abeyance until another character is typed after the programme has been running. This routine gets around this problem. Before using TTIN the programme should have called TSX() to determine whether or not the it is running under TSX. [This sets the global tsx$$ non-zero if running under TSX.] The support routine TT1SET sets the terminal up for single-character input ready for calls to TTIN. This sets the JSW bits and uses the SELOPT terminal selection options "S" and "U". While it is not necessary that the user utilize this routine, it is provided for convenience. [Warning - I am told this will not work on TSX prior to version TSCLIB - A Library for C Programmes under TSX-plus Page 3-2 Handy Routines for TSX C Programmes 6.] 3.3 TSXCMD - Command File Determination tsxcmd() Returns TRUE if the programme is both running under TSX-plus and is being run from a command file. This is useful in deciding which type of terminal I/O to use under TSX-plus. 3.4 EXITM - Message Exits for RT-11 There are four routines in this set: extset() - set up ready for lines of code to be put into exit area; extmes("text") - puts another line of code into area; extmsx("text") - puts a partial line (no zero at end) into area; extgo() - finally exits! CHAPTER 4 RT-11 Extension Routines This chapter contains routines which are extensions of the RT-11 EMTs in a manner useful to C programmers. There may be some conflict with the C operating system, especially in terms of I/O channels. These have not been fully explored as yet. [Fixed in the next release ... !!] 4.1 $ABTIO - Abort I/O on a channel $abtio(chan) int chan Aborts I/O currently queued on a channel. NOTE: it can only remove queued elements from handlers - it cannot abort I/O currently being performed in monitors earlier than RT-11 version 5 (I am not sure: maybe even 5.4). 4.2 $CHAIN - Chain to another programme Ascii: $chain("Filename"); Radix-50: $xchai(filename); - with a Radix-50 filename Chains to that file. TSX-plus appears to destroy locations 400-500 on a chain. 500-510 are used for the chain data, and 512+ can be used by the system for passing unchanged GTLIN lines. TSCLIB - A Library for C Programmes under TSX-plus Page 4-2 RT-11 Extension Routines 4.3 $CLOSE - Close a channel. $close(chan) Merely performs a close on that channel. 4.4 $CMKT - Cancel a Mark Time Request $cmkt(id,&time,mrtn) int id; long time; int mrtn Cancels mark time request with ident id, returning the amount of time left in time. Uses macro completion routine in mrtn (gotten when $MRKT request posted) to free up completion routine again. Note the "&" on the time. 4.5 $CRAW - Create a Virtual Address Window $craw(block) int *block; Creates a window using the window definition block pointed to by block. 4.6 $CRRG - Create a Dynamic Region $crrg(block) int *block; Allocates a dynamic region in physical memory for use by the requesting job, using the region definition block pointed to by block. 4.7 $CSTAT - Returns Channel Information $cstat(channel,block) int channel, *block; Returns channel information about channel into block. TSCLIB - A Library for C Programmes under TSX-plus Page 4-3 RT-11 Extension Routines 4.8 $DATE - Returns System Date in RT-11 format $date() Returns date in RT-11 format. 4.9 $DELETE - Deletes a File Ascii: $delete("Filename"); Radix-50: $xdele(filename); Deletes that file. 4.10 $DEVICE - Set up locations on exit from programme $device(list) int *list; Gives monitor a list of addresses and values to be plugged into those values when the job terminates. If list=0, discard any previous DEVICE list. 4.11 $DSTATUS - Return Device Status Information Ascii: $dstatus("dev:",block) int block[]; Radix-50: $xdstat(dev,block); int dev, block[]; Returns information concerning the device into the block, documented in the RT-11 manuals. TSCLIB - A Library for C Programmes under TSX-plus Page 4-4 RT-11 Extension Routines 4.12 $ELAW - Eliminate a Virtual Address Window $elaw(block) Eliminates window whose details are in the definition block. 4.13 $ELRG - Eliminate a Region $elrg(block) int *block; Eliminates a region whose details are provided in the region definition block. 4.14 $ENTER - Enter a File Ascii: $enter(chan,"filename",size) int chan,size; char filename[]; Radix-50: $xente(chan,filename,size) int chan,filename[4],size; Enters the desired file. If size=0, use half the largest area available as per usual RT-11 or TSX techniques. This routine does not load a handler, nor check a device for validity. 4.15 $FETCH - Fetch a Handler Ascii: $fetch("dev",&addr); Radix-50: $xfetch(dev,&addr); Fetches the handler for that device if that handler is not already loaded, putting the address (if memory was required for the fetch) into addr. TSCLIB - A Library for C Programmes under TSX-plus Page 4-5 RT-11 Extension Routines 4.16 $FPROT - Handle File Protection Ascii: $fprot("Filename",n) int n; Radix-50: $xfpro(filename,n); If n=0, unprotect file; if n=1 protect file. 4.17 $GMCX - Return Mapping Status of Extended Memory Window $gmcx(block) int *block; Returns in relevant location in window definition block the status of that particular window. 4.18 $GTIM - Return System Time $gtim(&time) long time; Returns RT-11 format system time into time. 4.19 $GTJB - Return Job Information $gtjb(block) int *block; Returns into block details of the job whose number is provided in the first word of the block. 4.20 $GTLIN - Use the GTLIN request $gtlin(&line,&prompt); Returns the terminal's line in &line. TSCLIB - A Library for C Programmes under TSX-plus Page 4-6 RT-11 Extension Routines 4.21 $GVAL - Return Monitor Value int $gval(n) int n; Returns monitor offset n. 4.22 $HERR - Don't Trap Monitor Errors $herr() This routine is the converse of $serr(), allowing the operating system to handle errors regarded as too serious to let unprepared programmes deal with. 4.23 $LOCK - Lock the USR $lock() Locks the USR 4.24 $LOOKUP - Lookup a file Ascii: $lookup(chan,"filename",&size) int chan, size; Radix-50: $lookup(chan,filename,&size) int chan, filename[4], size; Looks up the file, using the channel provided, and returning the size in blocks in size. This routine does not fetch any handlers, nor check for the validity of any device. 4.25 $MAP - Map a Previously Defined Address Window $map(block) int *block; Maps the window using the information in the window definition block. TSCLIB - A Library for C Programmes under TSX-plus Page 4-7 RT-11 Extension Routines 4.26 $MRKT - Schedule a Completion Routine after Elapsed Time $mrkt(&time,crtn,id,&mrtn) long time; int crtn(), id, mrtn; Note the "&" before the time! Schedules routine crtn(arg_r0,arg_r1) to be run after time ticks have elapsed, using id for identification of this particular request. Returns address of macro "pre"completion routine in mrtn, for use with cmkt. 4.27 $PEEK - Returns Low Memory Address $peek(addr) Returns the value from the address specified in the low 64Kb of memory. 4.28 $POKE - Deposit Value into Low Memory $poke(addr,value) int *addr, value; Puts value into addr in low 64Kb of memory. 4.29 $PRINT - Print a line to the terminal $print("Line"); Prints the line to the terminal. (Remember that to suppress the at the end of a line, end the string with a <200> byte as per $print("This is a prompt: \200"); 4.30 $PROTECT - Protect a Vector $protect(vector) int vector; Protects the locations vector and vector+2. TSCLIB - A Library for C Programmes under TSX-plus Page 4-8 RT-11 Extension Routines 4.31 $PURGE - Purge a Channel $purge(chan) int chan; Purges that channel. 4.32 $RCTRLO - Clear Control-O $rctrlo() Enables output to the terminal if this has been disabled by the user typing control-O. 4.33 $READ - Read Without Waiting $read(chan,buf,wcnt,blk,&nread) int chan, *buf, wcnt, blk, nread; Reads from the specified channel. Note the argument &nread, which gets the actual number of words read. 4.34 $READC - Read, Scheduling Completion Routine $readc(chan,buf,wcnt,crtn,blk,&nread) int chan,*buf,wcnt,crtn(),blk,nread; Reads from chan, scheduling completion routine crtn(arg_r0,arg_r1), where arg_r0 and arg_r1 receive the values which would have been sent in r0 and r1 respectively to the completion routine. Note the argument &nread, which receives the actual number of words which will be read. 4.35 $READW - Read and Wait $readw(chan,buf,wcnt,blk,&nread) int chan, *buf, wcnt, blk, nread; Reads from chan, waiting until read is completed. Note the argument &nread, which receives the actual number of words which were read. TSCLIB - A Library for C Programmes under TSX-plus Page 4-9 RT-11 Extension Routines 4.36 $RELEAS - Release a Handler Ascii: $releas("dev",addr); Radix-50: $xrelea(dev,addr); Releases a device handler previously loaded by $fetch. The addr arg must be the address returned by $fetch. 4.37 $RENAME - Rename a File Ascii: $rename("filename","newfilename"); Radix-50 $xrena(filename,newfilename); Renames the file specified in the first argument to the name specified in the second argument. (Any device field specified in the second argument is ignored.) 4.38 $REOPEN - Reopen a Saved Channel $reopen(chan,block) int chan, *block; Reopens a channel using previously saved channel information ($savestatus). 4.39 $SAVESTATUS - Save Channel Status $savestatus(chan,block) int chan, *block; Saves channel information into block. May be restored by using $REOPEN. TSCLIB - A Library for C Programmes under TSX-plus Page 4-10 RT-11 Extension Routines 4.40 $SCCA - Handle Control-C Under RT/TSX $scca(loc) int *loc; Allows control-C intercept, using loc as flag word. [There are problems with the SCCA routine provided in the C library unless you are running under RSTS!]. If loc=0, disables control-C trapping. 4.41 $SDTTM - Set date and time $sdttm(date,time) int date; long time; Sets system date and time. 4.42 $SERR - Trap "Serious" Errors $serr(); Allows "Serious" Errors to be returned to programme. These usually provide a negative value for the EMT error return (see the RT manuals for details). 4.43 $SFDAT - Modify File Creation Date Ascii: $sfdat("filename",date) int date; Radix-50: $xsfda(filename,date) int date, filename[4]; Sets the date on the specified to the date specified in RT-11 format in the second argument. 4.44 $SFPA - Set Floating-Point Exception Trap $sfpa(routine) int routine(); After $sfpa is called, when a floating-point exception trap occurs, the routine specified in the argument will be called. TSCLIB - A Library for C Programmes under TSX-plus Page 4-11 RT-11 Extension Routines 4.45 $SPFUN - Allow SPFUNs From "C" $spfun(chan,func,buf,wcnt,blk,crtn) int chan, func, *buf, int wcnt, blk, crtn(arg_r0,arg_r1); As per RT spfuns, using the channel used by the file specified as FILE *file; spfun(file->iolun, etc). If crtn is zero, the programme will wait for the spfun completion. If 1, there will be no waiting (and no completion routine either). The arguments to crtn will be the contents of registers r0 and r1 when the completion routine is called. Note that only ten completion routines may be simultaneously outstanding in TSCLIB as provided. If you require more, alter the value of CMPNUM in the module CMPSET. SPFUN with func=0 degenerates into READ/W/C if wcnt is positive, and WRITE/W/C if wcnt is negative. I do not know if TSX checks for these cases. 4.46 $SPND - SPND & RSUM for C programmes $spnd() $rsum() These two routines suspend or resume programme execution, and are usually used in programmes which set up completion routines then suspend execution, waiting for a $rsum call in a completion routine to wake the main programme up again. 4.47 $TLOCK - Lock USR, returning if not available $tlock(); Tlock attempts to lock the USR, but returns (with an error return) if the USR is not available. 4.48 $TRPSET - Intercept traps to 4 and 10 $trpset(routine) int routine(); Allows the routine to be called should any traps to location 4 of location 10 occur. This routine must be re-called after each trap if it is desired to keep trapping. TSCLIB - A Library for C Programmes under TSX-plus Page 4-12 RT-11 Extension Routines 4.49 $TTINR - Return character from terminal $ttinr(); This routine reads from the terminal, returning <-1> if no characters are available (and the necessary conditions have been set up for no-wait terminal input). 4.50 $TTYIN - Get 1 character from the TT $ttyin(); Returns a character from the terminal, waiting for input if none is available. 4.51 $TTYOU - Send a character to the TT $ttyou(char); Sends the character to the terminal, waiting until it has been placed in the terminal output buffer. 4.52 $TWAIT - Wait for a Timed Interval $twait(&time) long time; Waits for the time specified, in clock ticks. Note that the ADDRESS of time is required! 4.53 $UNLOCK - Unlock the USR $unlock() Unlocks the USR TSCLIB - A Library for C Programmes under TSX-plus Page 4-13 RT-11 Extension Routines 4.54 $UNMAP - Unmap a Virtual Address Window $unmap(block) Unmaps the window whose details are in the window control block. 4.55 $UNPROTECT - Unprotect a Vector $unprotect(vector) int vector; Unprotects the specified vector. 4.56 $WAIT - Wait for Channel I/O to Finish $wait(chan); Waits for I/O, returning error status of that channel. 4.57 $WRITC - Write, Scheduling a Completion Routine $writc(chan,buf,wcnt,crtn,blk,&nwrit) int chan,*buf,wcnt,crtn(),blk,nwrit; Writes to the channel, scheduling crtn(arg_r0,arg_r1) to be run upon completion of the writing. The arguments arg_r0 and arg_r1 get the values provided to the completion routine in r0 and r1 respectively. Note the argument &nwrit, which gets the actual number of words which will be written. 4.58 $WRITE - Write, with no waiting $write(chan,buf,wcnt,blk,&nwrit) int chan, *buf, wcnt, blk, nwrit; Writes to the channel, not waiting for I/O to complete. Note the argument &nwrit, which gets the number of words which will actually be written. TSCLIB - A Library for C Programmes under TSX-plus Page 4-14 RT-11 Extension Routines 4.59 $WRITW - Write and Wait $writw(chan,buf,wcnt,blk,&nwrit) int chan, *buf, wcnt, blk, nwrit; Writes to the channel, waiting for completion of the I/O. Note the argument &nwrit, which gets the actual number of words written. CHAPTER 5 Ancillary Routines These routines are called by routines earlier in the library. Apart from UNUCHN and $RAD50, none of them is designed to be called directly from C programmes. 5.1 UNUCHN - Return an Unused Channel (called by other TSCLIB routines) Returns in R1 and R0 the value of an unused channel number. If none available, returns zero, which, being a used channel, will cause the subsequent EMT to prang. 5.2 EMTRET - Return 0 (FALSE) if CS, 1 (TRUE) if CC EMTRET is the end-point of numerous routines. It performs an EMT 375, and returns 1 if an error occurred, 0 if no error occurred. EMTRET performs the EMT 375; EMTRES simply sets the value. 5.3 EMTEMT - Perform EMT & Return Error Value if Necessary These routines are the end-points of numerous routines. Enter at EMTEMT if EMT 375 is required; at EMTVAL if not. If no error is returned, the function returns 0. If an error is returned, it is dealt with as follows: If error byte positive or zero, return <1+error value> If error byte negative, return that negative value. TSCLIB - A Library for C Programmes under TSX-plus Page 5-2 Ancillary Routines 5.4 EMTAREA - Area for EMTs EMTAREA merely provides a (seven word) common block for the "area" argument for EMTs. There is a potential problem here in that EMTs executed in completion routines should use a different area from those in the mainstream code, as it is possible for completion routines to interrupt the main code right in the middle of setting up an EMT argument area! If you have trouble, let the author know; it is done this way to save space, but may require a little care in some applications. 5.5 CMPSET - Set up Completion Routine CMPSET allows for CMPNUM number of simultaneous completion routines. These routines must be in the form of routine(arg_r0, arg_r1) int r0,r1; {} with the two arguments being the contents of registers R0 and R1 respectively when the completion routine is called from the monitor. Should there be no room for the required number of completion routines, this routine will need to be rebuilt with a larger value for CMPNUM. It is initially provided with room for ten simultaneous completion routines. EMTWHOOPS allows a deliberate error return from routines which have set up a routine using CMPSET and find that it prangs, thereby not requiring the completion routine. 5.6 CSV$ & CRET$ - Subroutine Linkages for Programmes with Macro Main & C Subroutines CSV$ and CRET$ are called by all C programmes. They set up and restore the stack and the R5 context pointer for each C routine. When C programmes are linked, the calls to these routines cause the C operating system to be linked. When C routines are merely used as subroutines to a Macro main programme, and none of the C operating system is required, it is necessary to use a LINK/INCLUDE command to include CSV$ (or CRET$) so as to avoid getting the whole C operating system linked as well. These routines are included here in source form: csv$:: mov r5,r0 mov sp,r5 TSCLIB - A Library for C Programmes under TSX-plus Page 5-3 Ancillary Routines mov r4,-(sp) mov r3,-(sp) mov r2,-(sp) call (r0) cret$:: mov r5,r2 mov -(r2),r4 mov -(r2),r3 mov -(r2),r2 mov r5,sp mov (sp)+,r5 return 5.7 RFTLB - Read Filename for TSCLIB Called by routines which require a filename decoded from an ascii string, this routine forces DK: if no device is specified, unless no filename was specified either in which case it is left null. (This protects the user from scribbling all over DK: inadvertently - he can do it deliberately if he must!) This routine calls the CVLLIB routine RF to do the actual filename decoding. 5.8 $RAD50 - Convert String to Radix-50 i=$rad50("xyz"); Converts the first three characters of the string to Radix-50 format. Spaces and full stops are converted rather than acting as delimiters. CHAPTER 6 Index $ABTIO - Abort I/O on a channel . . . . . . . . . . . . . . 4-1 $CHAIN - Chain to another programme . . . . . . . . . . . . 4-1 $CLOSE - Close a channel. . . . . . . . . . . . . . . . . . 4-2 $CMKT - Cancel a Mark Time Request . . . . . . . . . . . . . 4-2 $CRAW - Create a Virtual Address Window . . . . . . . . . . 4-2 $CRRG - Create a Dynamic Region . . . . . . . . . . . . . . 4-2 $CSTAT - Returns Channel Information . . . . . . . . . . . . 4-2 $DATE - Returns System Date in RT-11 format . . . . . . . . 4-3 $DELETE - Delete a File . . . . . . . . . . . . . . . . . . 4-3 $DEVICE - Set up locations on exit from programme . . . . . 4-3 $DSTATUS - Return Device Status Information . . . . . . . . 4-3 $ELAW - Eliminate a Virtual Address Window . . . . . . . . . 4-4 $ELRG - Eliminate a Region . . . . . . . . . . . . . . . . . 4-4 $ENTER - Enter a File . . . . . . . . . . . . . . . . . . . 4-4 $FETCH - Fetch a Handler . . . . . . . . . . . . . . . . . . 4-4 $FPROT - Handle File Protection . . . . . . . . . . . . . . 4-5 $GMCX - Return Mapping Status of Extended Memory Window . . 4-5 $GTIM - Return System Time . . . . . . . . . . . . . . . . . 4-5 $GTJB - Return Job Information . . . . . . . . . . . . . . . 4-5 $GTLIN - Use the GTLIN request . . . . . . . . . . . . . . . 4-5 $GVAL - Return Monitor Value . . . . . . . . . . . . . . . . 4-6 $HERR - Don't Trap Monitor Errors . . . . . . . . . . . . . 4-6 $LOCK - Lock the USR . . . . . . . . . . . . . . . . . . . . 4-6 $LOOKUP - Lookup a file . . . . . . . . . . . . . . . . . . 4-6 $MAP - Map a Previously Defined Address Window . . . . . . . 4-6 $MRKT - Schedule a Completion Routine after Elapsed Time . . 4-7 $PEEK - Returns Low Memory Address . . . . . . . . . . . . . 4-7 $POKE - Deposit Value into Low Memory . . . . . . . . . . . 4-7 $PRINT - Print a line to the terminal . . . . . . . . . . . 4-7 $PROTECT - Protect a Vector . . . . . . . . . . . . . . . . 4-7 $PURGE - Purge a Channel . . . . . . . . . . . . . . . . . . 4-8 $RAD50 - Convert String to Radix-50 . . . . . . . . . . . . 5-3 $RCTRLO - Clear Control-O . . . . . . . . . . . . . . . . . 4-8 $READ - Read Without Waiting . . . . . . . . . . . . . . . . 4-8 $READC - Read, Scheduling Completion Routine . . . . . . . . 4-8 $READW - Read and Wait . . . . . . . . . . . . . . . . . . . 4-8 $RELEAS - Release a Handler . . . . . . . . . . . . . . . . 4-9 $RENAME - Rename a File . . . . . . . . . . . . . . . . . . 4-9 $REOPEN - Reopen a Saved Channel . . . . . . . . . . . . . . 4-9 $RSUM - Resume Execution . . . . . . . . . . . . . . . . . . 4-11 $SAVESTATUS - Save Channel Status . . . . . . . . . . . . . 4-9 $SCCA - Handle Control-C Under RT/TSX . . . . . . . . . . . 4-10 TSCLIB - A Library for C Programmes under TSX-plus Page 6-2 Index $SDTTM - Set Date and Time . . . . . . . . . . . . . . . . . 4-10 $SERR - Trap "Serious" Errors . . . . . . . . . . . . . . . 4-10 $SFDAT - Modify File Creation Date . . . . . . . . . . . . . 4-10 $SFPA - Set Floating-Point Exception Trap . . . . . . . . . 4-10 $SPFUN - Allow SPFUNs From "C" . . . . . . . . . . . . . . . 4-11 $SPND - Suspend Execution . . . . . . . . . . . . . . . . . 4-11 $TLOCK - Lock USR, returning if not available . . . . . . . 4-11 $TRPSET - Intercept traps to 4 and 10 . . . . . . . . . . . 4-11 $TTINR - Return character from terminal . . . . . . . . . . 4-12 $TTYIN - Return character from terminal . . . . . . . . . . 4-12 $TTYOU - Send a Character to the Terminal . . . . . . . . . 4-12 $TWAIT - Wait for a Timed Interval . . . . . . . . . . . . . 4-12 $UNLOCK - Unlock the USR . . . . . . . . . . . . . . . . . . 4-12 $UNMAP - Unmap a Virtual Address Window . . . . . . . . . . 4-13 $UNPROTECT - Unprotect a Vector . . . . . . . . . . . . . . 4-13 $WAIT - Wait for Channel I/O to Finish . . . . . . . . . . . 4-13 $WRITC - Write, Scheduling a Completion Routine . . . . . . 4-13 $WRITE - Write, with no waiting . . . . . . . . . . . . . . 4-13 $WRITW - Write and Wait . . . . . . . . . . . . . . . . . . 4-14 $XCHAI - Chain to another programme . . . . . . . . . . . . 4-1 $XDELE - Delete a File . . . . . . . . . . . . . . . . . . . 4-3 $XDSTAT - Return Device Status Information . . . . . . . . . 4-3 $XENTE - Enter a File . . . . . . . . . . . . . . . . . . . 4-4 $XFETC - Fetch a Handler . . . . . . . . . . . . . . . . . . 4-4 $XFPRO - Handle File Protection . . . . . . . . . . . . . . 4-5 $XLOOK - Lookup a file . . . . . . . . . . . . . . . . . . . 4-6 $XRELE - Release a Handler . . . . . . . . . . . . . . . . . 4-9 $XRENA - Rename a File . . . . . . . . . . . . . . . . . . . 4-9 $XSFDA - Modify File Creation Date . . . . . . . . . . . . . 4-10 10 Address Traps - $TRPSET . . . . . . . . . . . . . . . . . 4-11 4 Address Traps - $TRPSET . . . . . . . . . . . . . . . . . 4-11 Abort a Detached Job - ABRTDJ . . . . . . . . . . . . . . . 2-18 Abort I/O on a Channel - $ABTIO . . . . . . . . . . . . . . 4-1 ABRTDJ - Aborts a Detached Job . . . . . . . . . . . . . . . 2-18 Activation Characters Pending - CKACT . . . . . . . . . . . 2-4 Activation Mode - ODT - ACTODT . . . . . . . . . . . . . . . 2-3 ACTODT - Set/Reset ODT Activation Mode . . . . . . . . . . . 2-3 ALCDEV - Allocate a Device . . . . . . . . . . . . . . . . . 2-15 Allocate a Device - ALCDEV, XALCDE . . . . . . . . . . . . . 2-15 Area for EMTs . . . . . . . . . . . . . . . . . . . . . . . 5-2 Associate Run-Time System with Job - USERTS . . . . . . . . 2-21 ATTSVC - Connect Interrupt Service Routine . . . . . . . . . 2-20 ATTVEC - Connect Interrupt Completion Routine . . . . . . . 2-20 BICIO - Bit clear into I/O Page . . . . . . . . . . . . . . 2-19 BISIO - Bit set into I/O Page . . . . . . . . . . . . . . . 2-19 BPT - Assist in Debugging . . . . . . . . . . . . . . . . . 3-1 BREAK Key Completion Routine - DCLBRK . . . . . . . . . . . 2-5 Cancel a Mark Time Request - $CMKT . . . . . . . . . . . . . 4-2 Carry Bit . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Chain to another programme - $CHAIN, $XCHAI . . . . . . . . 4-1 Channel - Get an Unused One - UNUCHN . . . . . . . . . . . . 5-1 TSCLIB - A Library for C Programmes under TSX-plus Page 6-3 Index Channel I/O - Wait for Finish - $WAIT . . . . . . . . . . . 4-13 Channel Information - $CSTAT . . . . . . . . . . . . . . . . 4-2 Channel Reopening - $REOPEN . . . . . . . . . . . . . . . . 4-9 Channel Status Saving - $SAVESTATUS . . . . . . . . . . . . 4-9 Character from Terminal - $TTINR . . . . . . . . . . . . . . 4-12 Character from Terminal - $TTYIN . . . . . . . . . . . . . . 4-12 Character to Terminal - $TTYOU . . . . . . . . . . . . . . . 4-12 Characteristics of Terminal - SELOPT . . . . . . . . . . . . 2-12 Characters from the Terminal in a block - TTIBLK . . . . . . 2-3 Characters Pending from Terminal - NUMTTC . . . . . . . . . 2-4 Characters to the terminal in a block - TTOBLK . . . . . . . 2-3 Check for Activation Character Pending - CKACT . . . . . . . 2-4 Check for Pending Message - GETMSG . . . . . . . . . . . . . 2-17 Check for Shared File Writes - CKWSHR . . . . . . . . . . . 2-17 Check for Terminal Input Errors - CKTTIE . . . . . . . . . . 2-3 Check Job Status - JSTAT . . . . . . . . . . . . . . . . . . 2-9 CKACT - Check for Activation Character Pending . . . . . . . 2-4 CKTTIE - Check for Terminal Input Errors . . . . . . . . . . 2-3 CKWSHR - Check for Shared File Writes . . . . . . . . . . . 2-17 CL Line - Get one - GETCL . . . . . . . . . . . . . . . . . 2-14 Clear Control-O - $RCTRLO . . . . . . . . . . . . . . . . . 4-8 Close a channel - $CLOSE . . . . . . . . . . . . . . . . . . 4-2 CMPMSG - Completion Routine on Message . . . . . . . . . . . 2-17 CMPSET - Set up Completion Routine . . . . . . . . . . . . . 5-2 Command File Operation - TSXCMD . . . . . . . . . . . . . . 3-2 Command File Tracking - TTIN . . . . . . . . . . . . . . . . 3-1 Commands to KMON - EXITM . . . . . . . . . . . . . . . . . . 3-2 Completion Routine after Timed Wait - $MRKT . . . . . . . . 4-7 Completion Routine for BREAK Key - DCLBRK . . . . . . . . . 2-5 Completion Routine for TT Input - TTICPL . . . . . . . . . . 2-6 Completion Routine on Message - CMPMSG . . . . . . . . . . . 2-17 Completion Routine Read - $READC . . . . . . . . . . . . . . 4-8 Completion Routine Setting - CMPSET . . . . . . . . . . . . 5-2 Completion Routine Write - $WRITC . . . . . . . . . . . . . 4-13 Control-C Trapping - $SCCA . . . . . . . . . . . . . . . . . 4-10 Control-O Clearing - $RCTRLO . . . . . . . . . . . . . . . . 4-8 Convert Virtual Address to Physical - PHYADD . . . . . . . . 2-20 Create a Dynamic Region - $CRRG . . . . . . . . . . . . . . 4-2 Create a Virtual Address Window - $CRAW . . . . . . . . . . 4-2 Create Window - MAKWIN . . . . . . . . . . . . . . . . . . . 2-16 Creating a File - $ENTER, $XENTE . . . . . . . . . . . . . . 4-4 Creation Date of File - $SFDAT, $XSFDA . . . . . . . . . . . 4-10 CRET - C Subroutine Linkages . . . . . . . . . . . . . . . . 5-2 Date and Time Setting - $SDTTM . . . . . . . . . . . . . . . 4-10 Date from System - $DATE . . . . . . . . . . . . . . . . . . 4-3 Date of File Creation - $SFDAT, $XSFDA . . . . . . . . . . . 4-10 DCLBRK - Set Up Completion Routine for BREAK Key . . . . . . 2-5 Deallocate a Device - DEALOC, XDEALO . . . . . . . . . . . . 2-15 DEALOC - Deallocate a Device . . . . . . . . . . . . . . . . 2-15 Debugging Assistance - BPT . . . . . . . . . . . . . . . . . 3-1 Delete a File - $DELETE, $XDELE . . . . . . . . . . . . . . 4-3 Delete Window - DELWIN . . . . . . . . . . . . . . . . . . . 2-16 Deposit Value into Low Memory - $POKE . . . . . . . . . . . 4-7 Detached Jobs . . . . . . . . . . . . . . . . . . . . . . . 2-18 Determine whether running under TSX-plus . . . . . . . . . . 2-1 TSCLIB - A Library for C Programmes under TSX-plus Page 6-4 Index Device Allocation - ALCDEV et alii . . . . . . . . . . . . . 2-15 Device Dismounting - DISMNT, XDISMN . . . . . . . . . . . . 2-6 Device Handler Fetching - $FETCH, $XFETC . . . . . . . . . . 4-4 Device Handler Releasing - $RELEAS, $XRELE . . . . . . . . . 4-9 Device Mounting - MOUNT, XMOUNT . . . . . . . . . . . . . . 2-6 Device Status Information - $DSTATUS, $XDSTAT . . . . . . . 4-3 DISALL - Dismount All Mounted File Structures . . . . . . . 2-7 DISMNT - Dismount a Device . . . . . . . . . . . . . . . . . 2-6 Dismount a Logical Disc - LDDIS . . . . . . . . . . . . . . 2-7 Dismount All Logical Discs - LDDISA . . . . . . . . . . . . 2-8 Dismount All Mounted File Structures - DISALL . . . . . . . 2-7 Dynamic Region Creation - $CRRG . . . . . . . . . . . . . . 4-2 Eliminate a Region - $ELRG . . . . . . . . . . . . . . . . . 4-4 Eliminate a Virtual Address Window - $ELAW . . . . . . . . . 4-4 EMTAREA - Area for EMTs . . . . . . . . . . . . . . . . . . 5-2 EMTEMT - Perform EMT & Return Error Value if Necessary . . . 5-1 EMTRES - Return 0 (FALSE) if CS, 1 (TRUE) if CC . . . . . . 5-1 EMTRET - Return 0 (FALSE) if CS, 1 (TRUE) if CC . . . . . . 5-1 EMTVAL - Return Error Value if Necessary from EMT . . . . . 5-1 Enter a File - $ENTER, $XENTE . . . . . . . . . . . . . . . 4-4 Errors Returned by TSCLIB . . . . . . . . . . . . . . . . . 1-1 Exception Trap for Floating-Point - $SFPA . . . . . . . . . 4-10 Exception Trapping - 4 & 10 - $TRPSET . . . . . . . . . . . 4-11 Exclusive Use of the System - STEALS/RTURNS . . . . . . . . 2-20 EXITM - Message Exits for RT-11 . . . . . . . . . . . . . . 3-2 Extended Memory Window Mapping Status - $GMCX . . . . . . . 4-5 FASTOF - Fast Run-Time System Mapping Off . . . . . . . . . 2-21 FASTON - Fast Run-Time System Mapping On . . . . . . . . . . 2-21 Fetch a Device Handler - $FETCH, $XFETC . . . . . . . . . . 4-4 File Context - GETCXT . . . . . . . . . . . . . . . . . . . 2-16 File Creation Date Modification - $SFDAT, $XSFDA . . . . . . 4-10 File Deletion - $DELETE, $XDELE . . . . . . . . . . . . . . 4-3 File Lookup - $LOOKUP, $XLOOK . . . . . . . . . . . . . . . 4-6 File Protection - $FPROT, $XFPRO . . . . . . . . . . . . . . 4-5 File Renaming - $RENAME, $XRENA . . . . . . . . . . . . . . 4-9 File Time Setting - SFTIM, XSFTIM . . . . . . . . . . . . . 2-10 FILINF - Return File Information . . . . . . . . . . . . . . 2-10 Floating-Point Exception Trap - $SFPA . . . . . . . . . . . 4-10 Get a Block of Characters from the Terminal - TTIBLK . . . . 2-3 Get a CL Line - GETCL . . . . . . . . . . . . . . . . . . . 2-14 Get a Message - GETMSG . . . . . . . . . . . . . . . . . . . 2-17 Get an Unused Channel - UNUCHN . . . . . . . . . . . . . . . 5-1 Get Job's File Context . . . . . . . . . . . . . . . . . . . 2-16 Get Line from Terminal - $GTLIN . . . . . . . . . . . . . . 4-5 Get Privileges - SETPRV . . . . . . . . . . . . . . . . . . 2-11 Get Status of Detached Job - STATDJ . . . . . . . . . . . . 2-18 GETCL - Get a CL Line . . . . . . . . . . . . . . . . . . . 2-14 GETCXT - Get Job's File Context . . . . . . . . . . . . . . 2-16 GETMSG - Check for Pending Message . . . . . . . . . . . . . 2-17 GETNAM - Get User Name . . . . . . . . . . . . . . . . . . . 2-11 GTPNAM - Get Programme Name . . . . . . . . . . . . . . . . 2-11 HALTPA - Stop Performance Monitoring & Return Data . . . . . 2-18 TSCLIB - A Library for C Programmes under TSX-plus Page 6-5 Index Handle File Protection - $FPROT, $XFPRO . . . . . . . . . . 4-5 Handler Releasing - $RELEAS, $XRELE . . . . . . . . . . . . 4-9 HIEFF - Set/Reset High Efficiency Terminal Mode . . . . . . 2-4 High Efficiency Terminal Mode - HIEFF . . . . . . . . . . . 2-4 Hold Mode for Spooler - SPHOLD . . . . . . . . . . . . . . . 2-2 I/O Page into this Job's PAR 7 - MAPIOP . . . . . . . . . . 2-19 Information about Files - FILINF, XFILIN . . . . . . . . . . 2-10 Initialize for Performance Monitoring - INITPA . . . . . . . 2-18 INITPA - Initialize for Performance Monitoring . . . . . . . 2-18 Input Errors from Terminal - CKTTIE . . . . . . . . . . . . 2-3 Input from Terminal - $TTINR . . . . . . . . . . . . . . . . 4-12 Input from Terminal - $TTYIN . . . . . . . . . . . . . . . . 4-12 Input from Terminal in a block - TTIBLK . . . . . . . . . . 2-3 Interactive Mode Set/Reset - NONINT . . . . . . . . . . . . 2-13 Job Information - $GTJB . . . . . . . . . . . . . . . . . . 4-5 Job Monitoring - MONJOB . . . . . . . . . . . . . . . . . . 2-15 Job Priority - SJBPRI . . . . . . . . . . . . . . . . . . . 2-11 Job Status - JSTAT . . . . . . . . . . . . . . . . . . . . . 2-9 Job's File Context - GETCXT . . . . . . . . . . . . . . . . 2-16 JSTAT - Check Job Status . . . . . . . . . . . . . . . . . . 2-9 Kill a Job - KILL . . . . . . . . . . . . . . . . . . . . . 2-21 Kind of Terminal - TTYPE . . . . . . . . . . . . . . . . . . 2-8 LDDIS - Dismount a Logical Disc . . . . . . . . . . . . . . 2-7 LDDISA - Dismount All Logical Discs . . . . . . . . . . . . 2-8 LDMOU - Mount Logical Discs . . . . . . . . . . . . . . . . 2-7 LDSTAT - Return Status of Logical Disc Unit . . . . . . . . 2-8 Line (Subprocess) Number - TSXLN . . . . . . . . . . . . . . 2-3 Line Number - TSXLN . . . . . . . . . . . . . . . . . . . . 2-2 Line Parameters - STTSPD . . . . . . . . . . . . . . . . . . 2-13 Lock a Block - TLOCK . . . . . . . . . . . . . . . . . . . . 2-17 Lock the USR - $TLOCK . . . . . . . . . . . . . . . . . . . 4-11 Locked Block Wait - LOCKW . . . . . . . . . . . . . . . . . 2-17 Locking the USR - $LOCK . . . . . . . . . . . . . . . . . . 4-6 LOCKW - Wait on a Locked Block . . . . . . . . . . . . . . . 2-17 Logical Disc Dismount - LDDIS . . . . . . . . . . . . . . . 2-7 Logical Disc Mounting - LDMOU, XLDMOU . . . . . . . . . . . 2-7 Logical Disc Unit Status - LDSTAT, XLDSTA . . . . . . . . . 2-8 Logical Discs - Dismount All - LDDISA . . . . . . . . . . . 2-8 LOKJOB - Lock Job where it is . . . . . . . . . . . . . . . 2-20 LOKLOW - Lock Job in Low Memory . . . . . . . . . . . . . . 2-20 Lookup a file - $LOOKUP, $XLOOK . . . . . . . . . . . . . . 4-6 Low Memory Peeking - $PEEK . . . . . . . . . . . . . . . . . 4-7 Low Memory Poke - $POKE . . . . . . . . . . . . . . . . . . 4-7 MAKWIN - Create a Window . . . . . . . . . . . . . . . . . . 2-16 Map a Previously Defined Address Window - $MAP . . . . . . . 4-6 MAPIOP - Map I/O Page into this Job's PAR 7 . . . . . . . . 2-19 MAPMON - Map PAR 7 to Simulated RMON . . . . . . . . . . . . 2-19 MAPPHY - Map Physical Memory Region . . . . . . . . . . . . 2-19 Mapping Status of Extended Memory Window - $GMCX . . . . . . 4-5 MAPRTS - Map Associated Run-Time System on to Job . . . . . 2-21 Mark File to be Shared - SHRFIL . . . . . . . . . . . . . . 2-17 TSCLIB - A Library for C Programmes under TSX-plus Page 6-6 Index Mark Time Completion Routine - $MRKT . . . . . . . . . . . . 4-7 Mark Time Request - Cancel - $CMKT . . . . . . . . . . . . . 4-2 Message Channels . . . . . . . . . . . . . . . . . . . . . . 2-17 Message Exits for RT-11 - EXITM . . . . . . . . . . . . . . 3-2 Modify File Creation Date - $SFDAT, $XSFDA . . . . . . . . . 4-10 Monitor Errors - $HERR . . . . . . . . . . . . . . . . . . . 4-6 Monitor Values - $GVAL . . . . . . . . . . . . . . . . . . . 4-6 Monitor-Returned Errors . . . . . . . . . . . . . . . . . . 1-1 MONJOB - Job Monitoring . . . . . . . . . . . . . . . . . . 2-15 MOUNT - Mount a Device . . . . . . . . . . . . . . . . . . . 2-6 Mount Logical Discs - LDMOU, XLDMOU . . . . . . . . . . . . 2-7 Mounted File Structures Dismount - DISALL . . . . . . . . . 2-7 Name of Programme Get/Set - GTPNAM/STPNAM . . . . . . . . . 2-11 Name of User Get/Set - GETNAM/SETNAM . . . . . . . . . . . . 2-11 NoHold Mode for Spooler - SPNOHO . . . . . . . . . . . . . . 2-2 NONINT - Set/Reset Interactive Mode . . . . . . . . . . . . 2-13 Number of Free Spool Blocks - SPLFRE . . . . . . . . . . . . 2-2 NUMTTC - Return Number of TT Characters . . . . . . . . . . 2-4 ODT Activation Mode - ACTODT . . . . . . . . . . . . . . . . 2-3 Operating system determination - TSX() . . . . . . . . . . . 2-1 Output to Terminal - Character - $TTYOU . . . . . . . . . . 4-12 Output to terminal in a block - TTOBLK . . . . . . . . . . . 2-3 PAR 7 to I/O Page or Simulated RMON - MAPMON/MAPIOP . . . . 2-19 Peek into Low Memory - $PEEK . . . . . . . . . . . . . . . . 4-7 PEEKIO - Peek at I/O Page . . . . . . . . . . . . . . . . . 2-19 Pending Characters from Terminal - NUMTTC . . . . . . . . . 2-4 Performance Monitoring . . . . . . . . . . . . . . . . . . . 2-18 PHYADD - Convert Virtual Address to Physical . . . . . . . . 2-20 Physical Memory Mapping - MAPPHY . . . . . . . . . . . . . . 2-19 Poke Value into Low Memory - $POKE . . . . . . . . . . . . . 4-7 POKEIO - Poke into I/O Page . . . . . . . . . . . . . . . . 2-19 Print a line to the terminal - $PRINT . . . . . . . . . . . 4-7 Print Window - PRTWIN . . . . . . . . . . . . . . . . . . . 2-16 Priority of Job - SJBPRI . . . . . . . . . . . . . . . . . . 2-11 Privileges Get/Set - SETPRV . . . . . . . . . . . . . . . . 2-11 Processor Priority - SETPRI . . . . . . . . . . . . . . . . 2-20 Programme Name Get/Set - GTPNAM/STPNAM . . . . . . . . . . . 2-11 Protect a Vector - $PROTECT . . . . . . . . . . . . . . . . 4-7 Protection on Files - $FPROT, $XFPRO . . . . . . . . . . . . 4-5 PRTWIN - Print Window . . . . . . . . . . . . . . . . . . . 2-16 Purge a Channel - $PURGE . . . . . . . . . . . . . . . . . . 4-8 Radix-50 Conversion - $RAD50 . . . . . . . . . . . . . . . . 5-3 Read and Wait - $READW . . . . . . . . . . . . . . . . . . . 4-8 Read Filename for TSCLIB - RFTLB . . . . . . . . . . . . . . 5-3 Read Without Waiting - $READ . . . . . . . . . . . . . . . . 4-8 Read, Scheduling Completion Routine - $READC . . . . . . . . 4-8 Real Time Routines - Third Set . . . . . . . . . . . . . . . 2-20 Real-Time Routines - First Set . . . . . . . . . . . . . . . 2-19 Real-Time Routines - Second Set . . . . . . . . . . . . . . 2-20 Region Elimination - $ELRG . . . . . . . . . . . . . . . . . 4-4 Region, Dynamic - Creation - $CRRG . . . . . . . . . . . . . 4-2 Release a Handler - $RELEAS, $XRELE . . . . . . . . . . . . 4-9 TSCLIB - A Library for C Programmes under TSX-plus Page 6-7 Index RELVEC - Release Interrupt Vector . . . . . . . . . . . . . 2-20 Rename a File - $RENAME, $XRENA . . . . . . . . . . . . . . 4-9 Reopen a Saved Channel - $REOPEN . . . . . . . . . . . . . . 4-9 Reset Interactive Mode - NONINT . . . . . . . . . . . . . . 2-13 Reset ODT Activation Mode - ACTODT . . . . . . . . . . . . . 2-3 Resume Execution - $RSUM . . . . . . . . . . . . . . . . . . 4-11 Resume Window Processing - RSMWIN . . . . . . . . . . . . . 2-16 Return Character from Terminal - $TTINR . . . . . . . . . . 4-12 Return Character from Terminal - $TTYIN . . . . . . . . . . 4-12 Return Device Status Information - $DSTATUS, $XDSTAT . . . . 4-3 Return File Information - FILINF, XFILIN . . . . . . . . . . 2-10 Return Mapping Status of Extended Memory Window - $GMCX . . 4-5 Return Number of Free Spool Blocks - SPLFRE . . . . . . . . 2-2 Return Status of Logical Disc Unit - LDSTAT, XLDSTA . . . . 2-8 Return System Time - $GTIM . . . . . . . . . . . . . . . . . 4-5 Returning Errors by TSCLIB . . . . . . . . . . . . . . . . . 1-1 RFTLB - Read Filename for TSCLIB . . . . . . . . . . . . . . 5-3 RMON Mapping to PAR 7 - MAPMON . . . . . . . . . . . . . . . 2-19 RSMWIN - Resume Window Processing . . . . . . . . . . . . . 2-16 RTURNS - Relinquish Exclusive Use of the System . . . . . . 2-20 Run-Time System Support . . . . . . . . . . . . . . . . . . 2-21 Save Channel Status - $SAVESTATUS . . . . . . . . . . . . . 4-9 Saved Channel Reopening - $REOPEN . . . . . . . . . . . . . 4-9 Savestatus & Shared Files - SAVSHR . . . . . . . . . . . . . 2-17 SAVSHR - Allow Shared File Details across Savestatus . . . . 2-17 SCHCMP - Schedule a Completion Routine . . . . . . . . . . . 2-20 Select Window - SELWIN . . . . . . . . . . . . . . . . . . . 2-16 SELOPT - Set Terminal Characteristics . . . . . . . . . . . 2-12 SEND - Send Buffer to Another Line . . . . . . . . . . . . . 2-5 Send a Block of Characters to the Terminal - TTOBLK . . . . 2-3 Send a Character to the Terminal - $TTYOU . . . . . . . . . 4-12 Send a Message - SNDMSG . . . . . . . . . . . . . . . . . . 2-17 Send Buffer to Another Line Despite GAG - YELL . . . . . . . 2-5 Serious Error Trapping - $SERR . . . . . . . . . . . . . . . 4-10 Set Date and Time - $SDTTM . . . . . . . . . . . . . . . . . 4-10 Set File Time - SFTIM, XSFTIM . . . . . . . . . . . . . . . 2-10 Set Floating-Point Exception Trap - $SFPA . . . . . . . . . 4-10 Set Interactive Mode - NONINT . . . . . . . . . . . . . . . 2-13 Set Job Priority - SJBPRI . . . . . . . . . . . . . . . . . 2-11 Set Line Parameters - STTSPD . . . . . . . . . . . . . . . . 2-13 Set ODT Activation Mode - ACTODT . . . . . . . . . . . . . . 2-3 Set Privileges - SETPRV . . . . . . . . . . . . . . . . . . 2-11 Set Spooler Hold - SPHOLD . . . . . . . . . . . . . . . . . 2-2 Set Spooler NoHold - SPNOHO . . . . . . . . . . . . . . . . 2-2 Set Terminal Characteristics - SELOPT . . . . . . . . . . . 2-12 Set Terminal Time-Out - SETTTO . . . . . . . . . . . . . . . 2-4 Set up Completion Routine - CMPSET . . . . . . . . . . . . . 5-2 Set Up Completion Routine for BREAK Key - DCLBRK . . . . . . 2-5 Set Up Completion Routine for TT Input - TTICPL . . . . . . 2-6 Set up locations on exit from programme - $DEVICE . . . . . 4-3 SETNAM - Set User Name . . . . . . . . . . . . . . . . . . . 2-11 SETPRI - Set Processor Priority . . . . . . . . . . . . . . 2-20 SETPRV - Get/Set Privileges . . . . . . . . . . . . . . . . 2-11 SETTTO - Set Terminal Time-Out . . . . . . . . . . . . . . . 2-4 SFTIN - Set File Time . . . . . . . . . . . . . . . . . . . 2-10 TSCLIB - A Library for C Programmes under TSX-plus Page 6-8 Index Shared File Access Routines . . . . . . . . . . . . . . . . 2-17 Shared Run-Time System Support . . . . . . . . . . . . . . . 2-21 SHRFIL - Mark File to be Shared . . . . . . . . . . . . . . 2-17 SJBPRI - Set Job Priority . . . . . . . . . . . . . . . . . 2-11 SNDMSG - Send a Message . . . . . . . . . . . . . . . . . . 2-17 Speed of Lines - STTSPD . . . . . . . . . . . . . . . . . . 2-13 SPFUN Calling - $SPFUN . . . . . . . . . . . . . . . . . . . 4-11 SPHOLD - Set Spooler Hold . . . . . . . . . . . . . . . . . 2-2 SPLFRE - Return Number of Free Spool Blocks . . . . . . . . 2-2 SPNOHO - Set Spooler NoHold . . . . . . . . . . . . . . . . 2-2 Spool Blocks - Return Number Free - SPLFRE . . . . . . . . . 2-2 Start a Detached Job - STRTDJ . . . . . . . . . . . . . . . 2-18 Start Performance Monitoring Data Collection . . . . . . . . 2-18 STATDJ - Get Status of Detached Job . . . . . . . . . . . . 2-18 Status of Job - JSTAT . . . . . . . . . . . . . . . . . . . 2-9 STEALS - Requests Exclusive Use of the System . . . . . . . 2-20 Stop Performance Monitoring & Return Data - HALTPA . . . . . 2-18 Stop Performance Monitoring Data Collection - STOPPA . . . . 2-18 STOPPA - Stop Performance Monitoring Data Collection . . . . 2-18 STPNAM - Set Programme Name . . . . . . . . . . . . . . . . 2-11 STRTDJ - Start a Detached Job . . . . . . . . . . . . . . . 2-18 STRTPA - Start Performance Monitoring Data Collection . . . 2-18 STTSPD - Set Line Parameters . . . . . . . . . . . . . . . . 2-13 Subprocess Line Number - TSXLN . . . . . . . . . . . . . . . 2-3 Subprocess Switching - SWTSUB . . . . . . . . . . . . . . . 2-19 Subroutine Linkages - CSV$, CRET$ . . . . . . . . . . . . . 5-2 Suspend Execution - $SPND . . . . . . . . . . . . . . . . . 4-11 Suspend Window Processing - SUSWIN . . . . . . . . . . . . . 2-16 Switch between subprocesses - SWTSUB . . . . . . . . . . . . 2-19 SWTSUB - Switch between subprocesses . . . . . . . . . . . . 2-19 System Date - $DATE . . . . . . . . . . . . . . . . . . . . 4-3 System Time - $GTIM . . . . . . . . . . . . . . . . . . . . 4-5 Terminal Characteristics - SELOPT . . . . . . . . . . . . . 2-12 Terminal Characters Pending - NUMTTC . . . . . . . . . . . . 2-4 Terminal High Efficiency Mode - HIEFF . . . . . . . . . . . 2-4 Terminal Input - $TTINR . . . . . . . . . . . . . . . . . . 4-12 Terminal Input - $TTYIN . . . . . . . . . . . . . . . . . . 4-12 Terminal Input - TTIN . . . . . . . . . . . . . . . . . . . 3-1 Terminal Input Errors - CKTTIE . . . . . . . . . . . . . . . 2-3 Terminal Input in a block - TTIBLK . . . . . . . . . . . . . 2-3 Terminal Line Number - TSXLN . . . . . . . . . . . . . . . . 2-2 Terminal Output - Character - $TTYOU . . . . . . . . . . . . 4-12 Terminal output in a block - TTOBLK . . . . . . . . . . . . 2-3 Terminal Parameters - STTSPD . . . . . . . . . . . . . . . . 2-13 Terminal Time-Out - SETTTO . . . . . . . . . . . . . . . . . 2-4 Terminal Type - TTYPE . . . . . . . . . . . . . . . . . . . 2-8 Test for Device Allocation - TSTALC, XTSTAL . . . . . . . . 2-15 Time and Date Setting - $SDTTM . . . . . . . . . . . . . . . 4-10 Time from System - $GTIM . . . . . . . . . . . . . . . . . . 4-5 Time on Files - SFTIM, XSFTIM . . . . . . . . . . . . . . . 2-10 Time-Out for Terminal - SETTTO . . . . . . . . . . . . . . . 2-4 Timed Interval Wait - $TWAIT . . . . . . . . . . . . . . . . 4-12 Timed Wait Completion Routine - $MRKT . . . . . . . . . . . 4-7 TLOCK - Try to Lock a Block . . . . . . . . . . . . . . . . 2-17 Trap "Serious" Errors - $SERR . . . . . . . . . . . . . . . 4-10 TSCLIB - A Library for C Programmes under TSX-plus Page 6-9 Index TRAP - Fast Run-Time System Switching . . . . . . . . . . . 2-21 Trap Floating-Point Exceptions - $SFPA . . . . . . . . . . . 4-10 Trapping Control-C - $SCCA . . . . . . . . . . . . . . . . . 4-10 Trapping Location 4 & 10 Traps - $TRPSET . . . . . . . . . . 4-11 Try to Lock a Block - TLOCK . . . . . . . . . . . . . . . . 2-17 TSCEDT - Edit Version Number of TSCLIB . . . . . . . . . . . 2-1 TSCVER - Release Version Number of TSCLIB . . . . . . . . . 2-1 TSTALC - Test for Device Allocation . . . . . . . . . . . . 2-15 TSX - Determine whether running under TSX-plus . . . . . . . 2-1 TSXCMD - Running Under Command Files . . . . . . . . . . . . 3-2 TSXLN - Terminal Line Number . . . . . . . . . . . . . . . . 2-2 TSXSLN - Subprocess Line Number . . . . . . . . . . . . . . 2-3 TTIBLK - Get a Block of Characters from the Terminal . . . . 2-3 TTICPL - Set Up Completion Routine for TT Input . . . . . . 2-6 TTIN - Get Terminal Input from TT or Command File . . . . . 3-1 TTOBLK - Send a Block of Characters to the Terminal . . . . 2-3 TTYPE - Return Terminal Type . . . . . . . . . . . . . . . . 2-8 Type of Terminal - TTYPE . . . . . . . . . . . . . . . . . . 2-8 UNLALL - Unlock all Blocks . . . . . . . . . . . . . . . . . 2-17 UNLOCK - Unlock a Block . . . . . . . . . . . . . . . . . . 2-17 Unlock the USR - $UNLOCK . . . . . . . . . . . . . . . . . . 4-12 UNLOKJ - Unlock Job . . . . . . . . . . . . . . . . . . . . 2-20 Unmap a Virtual Address Window - $UNMAP . . . . . . . . . . 4-13 Unprotect a Vector - $UNPROTECT . . . . . . . . . . . . . . 4-13 UNUCHN - Return an Unused Channel (called by other TSCLIB routines) 5-1 User Name Get/Set - GETNAM/SETNAM . . . . . . . . . . . . . 2-11 USERTS - Associate Run-Time System with Job . . . . . . . . 2-21 USR Locking - $LOCK . . . . . . . . . . . . . . . . . . . . 4-6 USR Locking - $TLOCK . . . . . . . . . . . . . . . . . . . . 4-11 USR Unlocking - $UNLOCK . . . . . . . . . . . . . . . . . . 4-12 Values Returned from EMTs - EMTEMT, EMTVAL . . . . . . . . . 5-1 Values Returned from EMTs - EMTRET, EMTRES . . . . . . . . . 5-1 Vector Protection - $PROTECT . . . . . . . . . . . . . . . . 4-7 Vector Unprotecting - $UNPROTECT . . . . . . . . . . . . . . 4-13 Version Numbers for TSCLIB - TSCVER, TSCEDT . . . . . . . . 2-1 Virtual Address to Physical - PHYADD . . . . . . . . . . . . 2-20 Virtual Address Window Creating - $CRAW . . . . . . . . . . 4-2 Virtual Address Window Unmapping - $UNMAP . . . . . . . . . 4-13 Wait for a Message - WATMSG . . . . . . . . . . . . . . . . 2-17 Wait for a Timed Interval - $TWAIT . . . . . . . . . . . . . 4-12 Wait for Channel I/O to Finish - $WAIT . . . . . . . . . . . 4-13 Wait on a Locked Block - LOCKW . . . . . . . . . . . . . . . 2-17 WATMSG - Wait for a Message . . . . . . . . . . . . . . . . 2-17 Window - Extended Memory - Mapping Status - $GMCX . . . . . 4-5 Window - Virtual Address - Creating - $CRAW . . . . . . . . 4-2 Window - Virtual Address - Elimination - $ELAW . . . . . . . 4-4 Window - Virtual Address - Map - $MAP . . . . . . . . . . . 4-6 Window - Virtual Address - Unmapping - $UNMAP . . . . . . . 4-13 Write and Wait for Completion - $WRITW . . . . . . . . . . . 4-14 Write without Waiting - $WRITE . . . . . . . . . . . . . . . 4-13 Write, Scheduling a Completion Routine - $WRITC . . . . . . 4-13 XALCDE - Allocate a Device . . . . . . . . . . . . . . . . . 2-15 TSCLIB - A Library for C Programmes under TSX-plus Page 6-10 Index XDEALO - Deallocate a Device . . . . . . . . . . . . . . . . 2-15 XDISMN - Dismount a Device . . . . . . . . . . . . . . . . . 2-6 XFILIN - Return File Information . . . . . . . . . . . . . . 2-10 XLDMOU - Mount Logical Discs . . . . . . . . . . . . . . . . 2-7 XLDSTA - Return Status of Logical Disc Unit . . . . . . . . 2-8 XMOUNT - Mount a Device . . . . . . . . . . . . . . . . . . 2-6 XSFTIM - Set File TIme . . . . . . . . . . . . . . . . . . . 2-10 XTSTAL - Test for Device Allocation . . . . . . . . . . . . 2-15 YELL - Send Buffer to Another Line Despite GAG . . . . . . . 2-5 ^C Trapping - $SCCA . . . . . . . . . . . . . . . . . . . . 4-10 ^O Clearing - $RCTRLO . . . . . . . . . . . . . . . . . . . 4-8