;-----------------------------------------------------------------------; ; ** CLINE ** ; ; ; ; Subroutine to extract the initiating command from a ; ; a RUNning BASIC program, returns "RUN XXXXXX ????????? ; ; trimming off the trailing CRLF. The ???????? is of ; ; greatest interest 'cause that way a program can be told ; ; what to do without other input... ; ; ; ; usage: XCALL CLINE, INPUT$ ; ; ; ; Copyright [c] Noel Alaska Systems Technology, 1983. ; ;-----------------------------------------------------------------------; VMAJOR = 1. ; version equates VMINOR = 0. VSUB = 0. VEDIT = 2. ; CHANGE EACH EDIT <----------- VWHO = 0. SEARCH SYS ; AMOS librarys SEARCH SYSSYM SEARCH TRM OBJNAM 0,0,[SBR] BEGIN: PHDR -1,-1,PH$REE!PH$REU JOBIDX A0 ; get JCB addr MOV JOBTRM(A0),A0 ; get trm addr MOV T.ILB(A0),A1 ; trm input buffer addr MOV T.ILS(A0),D1 ; trm input buffer size MOV 4(A3),A2 ; get arg addr (assume present) MOV 10(A3),D2 ; get arg size (assume string) DEC D2 ; leave room for terminator CMP D1,D2 ; make sure input line will fit BLO 1$ ; if so use it all MOV D2,D1 ; if not, truncate it 1$: PUSH A2 ; save arg pointer 2$: MOVB (A1)+,(A2)+ ; move line SOB D1,2$ CLRB @A2 ; mark the end POP A2 ; restore line pointer 3$: CMMB #15,@A2 ; is this CR? BEQ 4$ ; yep - done CMMB #12,@A2 ; is this LF? BEQ 4$ ; yep - done TSTB @A2 ; is this NULL? BEQ 4$ ; yep - done INC A2 ; nope - incr pointer BR 3$ ; and loop 4$: CLRB @A2 ; mark true end RTN ; goback... EVEN END