.TITLE GETLIN .IDENT /V1.0A/ .ENABLE LC ; ; New routine required for CCL V7.0A. ; ; Performs read from file open on LUN 1, or a pseudo read from a ; data table included in .PSECT $TABLE which has been "opened" on ; LUN 0. All arguments are handled via FDB, global symbol defined by ; CCL. ; ; Paul Sorenson -- 3/81 ; Department of Physiology ; Michigan State University ; E. Lansing, MI 48824 ; .MCALL GET$ .PSECT $CODE1,RW,I,CON,LCL GETLIN:: ; Entry point MOV R0,-(SP) ; Save registers MOV R1,-(SP) ; TSTB FDB+F.LUN ; Check LUN # in FDB BNE 10$ ; Branch if non-0, got a real file to work on ; ; Simulate a read from file but fetch data from internal table defined ; in .PSECT $TABLE. Starting point in file must already be defined ; by simulating an OPEN (done by caller) -- PRS ; MOV FDB+F.NRBD,R0 ; Fetch previous record length MOV FDB+F.NRBD+2,R1 ; and previous record pointer INC R0 ; Increment previous line length then-- BIC #1,R0 ; mask off low bit to get even word boundary ADD R0,R1 ; Set pointer to next line MOV (R1),FDB+F.NRBD ; Define new line length BEQ ERROR ; Branch if 0, signal for end-of-file ADD #2,R1 ; Adjust pointer to first byte of line MOV R1,FDB+F.NRBD+2 ; Save current record pointer MOV R1,FDB+F.URBD+2 ; Do a "move" by simply ; redefining user buffer address BR END ; ; Do real read from file on LUN 1 ; ; For the file open on LUN 1, offset locations F.URBD (user buffer ; length) and F.URBD+2 (user buffer address) must be defined prior ; to calling GETLIN (performed in CCL by call to OPEN). ; ; 10$: GET$ #FDB ; Read a line from the file BCC END ; Exit if OK ERROR: SEC ; Else, signal error by setting carry bit END: MOV (SP)+,R1 ; Restore registers MOV (SP)+,R0 ; RETURN .END