.TITLE GCLGCL (promptaddr%,promptlength%,errarrayadr%,bufadr%,bufsiz%,sizgot%) .ENABL LC .MCALL .BLK.,.BLKW.,GCML$D,FDOF$L FDOF$L GCML$D .BLK. ; standard FTN arg block .BLKW. 1,AN ; number of arguments .BLKW. 1,PA ; prompt string address .BLKW. 1,PL ; prompt string length .BLKW. 1,EA ; array to hold error flags ; ERR$[1]=DSW error ; [2]=FCS ; [3]=GCL ; all zero means OK .BLKW. 1,BA ; address of buffer to store command line .BLKW. 1,BZ ; size of buffer to hold command line .BLKW. 1,GZ ; size (bytes) of command line returned ; -1: buffer overflow ; 0: probable error: check EA .ENABL LSB ; GCLGCL:: ; here to grab next command line MOV @EA(R5),R1 ; (R1) = [array] CLR (R1)+ ; CLRB (R1)+ ; ; (R1) = ERR$[4] ; assume no errors (yet) MOV #GCLWRK,R0 ; BISB #GE.LC,G.MODE(R0); tell GCL to leave lower case alone MOV @PL(R5),G.PSDS(R0); MOV @PA(R5),G.PSDS+2(R0); CALL .GCML1 ; BCC X ; quit if OK MOVB G.ERR(R0),-(R1) ; GCL error MOVB F.ERR(R0),-(R1) ; FCS error MOVB F.ERR+1(R0),-(R1);DSW error CLR R2 ; zero bytes to copy BR ERR ; fake null copy X: ; here with GCL call sucessful ; now deliver buffer of data MOV G.CMLD(R0),R2 ; (R2) = source size CMP R2,@BZ(R5) ; source size : destination size BLE 1$ ; branch if OK MOV #-1,@GZ(R5) ; else note buffer too small BR XIT ; 1$: ; here if buffer will fit ; (R2) = source size MOV @BA(R5),R4 ; (R4) = [next destn byte] MOV G.CMLD+2(R0),R3 ; (R3) = [next source byte] ERR: MOV R2,@GZ(R5) ; say how big returned buffer is BEQ 3$ ; don't copy 0 bytes 2$: ; (R2) = # bytes left to copy ; (R3) = [next source byte] ; (R4) = [next destn byte] MOVB (R3)+,(R4)+ ; SOB R2,2$ ; 3$: ; here with GZ, buffer done XIT: ; RETURN ; R0,R1,R2,R3,R4 clobbered .DSABL LSB ; .END