.title wottty return the terminal type, rsx standard .ident /000002/ ; ;+ ; ; Index Terminal Type ; Index Wottty ; Index SF.GMC ; Index TC.TTP ; Index ForTran ; Index example ; Index I/D address space ; ; Usage ; ; int typ; /* receives terminal type sign extended to ; 16 bits */ ; int wottty(); /* tell C compiler it exists */ ; int mumble; /* receives terminal type, sign extended to ; 16 bits */ ; ; call (wottty,1,&type); /* single argument, fortran callable */ ; OR ; mumble = call(wottty,1,&junk); /* destroys junk, not recommended */ ; ; ; Description ; ; Wotty returns to its (address of byte) argument the terminal type ; as revealed to it by RSX, SF.GMC, TC.TPP. ; ; The kinky calling sequence is because it is ForTran compatible, ; for historical reasons. This kludge is not important enough for ; library tapes, Dean feels. It is an example of I/D coding. ; ForTran users beware: it actually gives ther terminal type ; of LUN 1, which is always the stderr terminal for DECUS C users. ; ; As a concession to ForTran programmers, it also works as Integer*2 ; Function Wottty(junk) returning a byte to junk and sign-extending ; the byte value to 16 bits for the function value. ; ; If it can't find out the terminal type of LUN 1, it crashes the ; task. ; Internal ; ; Uses LUN 1, EFN 1, psects c$data, c$code and c$mwcn. ; Avoids many DEC macros - to improve maintainability. ; DEC macros are still built for 11/20s. Sigh. ; Bugs ; Horrible name. ; Doesn't check number of arguments. ; Doesn't error check the QIO$W. ; Assumes LUN 1 is console terminal. ; RSX only so far. Good luck converting. ;- ; ; Edit history ; 000001 11-Jun-85 DLE Rewrite from scratch to match a binary we have been ; using. Now with I/D space capabilities. ; 000002 11-Jun-85 DLE Assume the argument is address of a WORD because some ; applications programs depend on this. ; Check if qiow worked. ; .mcall .blk.,.blkw.,qiow$,dir$ LUN = 1 EFN = 1 ; ; ForTran argument blocks are pointed to by R5. ; The first word is a byte of argument count, then an udefined byte. ; The next word is our first argument, which is the address of a byte ; that receives the terminal type. ; ; ; The .blk* macros are from the standard RSX macro-11 library. ; .blk. .blkw. 1,numarg .blkw. 1,ansadr .psect c$code,i wottty:: dir$ #myqiow bcc 10$ ; ;02 iot ; ;02 10$: movb answer,r0 ; (r0) = function value for ForTran mov r0,@ansadr(r5) ; but we also put it in a nominated ;02 ; place for BASIC, C and other perversions. ; It is a whole (sign extended) word to ; keep the masses compatible. return ; .psect c$mwcn,d ; .psect c$mwcn ; see comment below about c$data ! myqiow: qiow$ sf.gmc,LUN,EFN,,,, ; ; For completely stupid reasons, not unconnected with 25-bit addressing, ; we have to be stupid here. I will fix it one day. ; ; .psect c$data,d .psect c$data arg2qi: .byte TC.TTP ; terminal type please answer: .blkb 1 ; answer appears here .end