; ; SYSLIB Module Name: SBBLIN ; Author: Richard Conn ; SYSLIB Version Number: 2.0 ; Module Version Number: 1.0 ; Module Entry Points: ; BBLINE ; Module External References: ; CAPS ; ; ; BBLINE -- Buffered BDOS Input Line Editor ; BBLINE provides a very convenient interface to the BDOS for input ; line editor functions. It contains its own internal buffer for storage ; of the input line (200 bytes allocated), and it returns a pointer to ; the first byte of the line upon return. The line stored in this buffer ; is terminated by a binary zero (0). ; To use BBLINE, the user need only call it, with a capitalization flag ; stored in the A Register. If A = 0, BBLINE does not capitalize the input ; line characters; if A <> 0, BBLINE capitalizes the input line characters ; before returning to the caller. ; No error codes are returned by BBLINE. On return, HL points to the ; first byte of the input line and A contains a count of the number of ; characters in that line. ; ; ; EQUATES ; BDOS EQU 5 B$RDLINE EQU 10 ; READ LINE FUNCTION ; ; EXTERNAL DECLARATIONS ; EXT CAPS ; ; MAIN ROUTINE FOR BBLINE ; BBLINE:: JMP START ; SKIP OVER BUFFER INLINE: DB 200 ; ALLOW 200 BYTES IN BUFFER CCNT: DB 0 ; CHARACTER COUNT LINE: DS 200 ; BUFFER SPACE DB 0 ; TERMINATING ZERO CAPFLG: DS 1 ; CAPITALIZATION FLAG (0=NO CAP) START: PUSH D ; SAVE DE, BC PUSH B STA CAPFLG ; SAVE CAPITALIZATION FLAG LXI D,INLINE ; PT TO BUFFER MVI C,B$RDLINE ; READ LINE FUNCTION IN BDOS CALL BDOS ; DO READ LINE FUNCTION LXI H,CCNT ; PT TO CHAR COUNT MOV A,M ; GET IT INX H ; PT TO FIRST CHAR ADD L ; ADD CHAR COUNT MOV L,A MOV A,H ACI 0 MOV H,A ; HL PTS TO AFTER LAST CHAR MVI M,0 ; STORE ENDING ZERO LDA CAPFLG ; CAPITALIZE? ORA A ; 0=NO JZ DONE LXI H,LINE ; MOVE THRU LINE CAPLP: MOV A,M ; GET CHAR ORA A ; END OF LINE? JZ DONE CALL CAPS ; CAPITALIZE CHAR MOV M,A ; PUT IT BACK INX H ; PT TO NEXT JMP CAPLP DONE: POP B ; RESTORE REGS POP D LXI H,LINE ; PT TO FIRST CHAR IN LINE LDA CCNT ; GET CHAR COUNT RET END