.title kbin ; Written: June 19, 1979 by Stoney Ballard - ML3-2/E41 ; Mangled: Oct. 19, 1979 by Martin Minow - ML3-2/E41 ; Renamed kbin 31-Aug-91 ; ; This module is a C function for reading TT: ; in TECO mode with no echo. ; The C declaration is: ; ; extern kbin(); /* Return next character */ ; ; kbin returns -1 on failure; ; ; ** Macro definitions ** $iodef ; ** Static tables ** .psect data,noexe,gbl inpdev: ;descriptor for TT: .long 2$-1$ ;length .long 1$ ;address 1$: .ascii /TT/ ;name 2$: termset: ;termination char set .long 1$ ;pointer to termset 1$: .long ^D16 ;16 bytes of 1 bits .long 2$ 2$: .rept ^D16 .byte ^D255 .endr ; ** Static variables ** ichan: .blkl 1 ;channel number for TT: opened: .word 0 ;set to non-zero when opened ibuff: .blkb 1 ;one byte input buffer ibufflen = 1 ;length of buffer iostab: ;i/o status block ioss: .blkw 1 ;returned status iosof: .blkw 1 ;terminator offset ioster: .blkw 1 ;terminator iostsiz:.blkw 1 ;terminator size ; ** Main ** .psect $code,rd,nowrt,exe,pic,shr,byte kbin:: .word 0 ;entry mask bbss #1,opened,get ;Branch if already opened $assign_s - devnam=inpdev,- ;assign a channel for TT: chan=ichan blbs r0,get ;Br if ok $exit_s r0 ;no, bomb with error msg get: $qiow_s efn=#1,- ;make the read call chan=ichan,- func=#io$_readlblk!io$m_noecho!io$m_nofiltr,- iosb=iostab,- ;i/o status block p1=ibuff,- ;input buffer p2=#ibufflen,- ;input buffer length p4=termset ;termination char set blbs iostab,done ;Br if ok movl #-1,r0 ;no, return -1 ret ;Exit the routine done: movzbl ioster,r0 ;Get char in r0 ret .end