; TITLE "SBBLINE - Syslib 4.0" NAME ('BBLINE') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SBBLINE.Z80 Ver 1.1 by Richard Conn ; Date : 17 Sep 89 ; Version : 1.2 ; Module : SBBLINE ; Abstract: This module contains the routine BBLINE which provides ; a Buffered BDOS Input Line Editor feature. It contains its ; own internal buffer for storage of the input line (200 byte ; allocated), and it returns a pointer to the first byte of ; line upon return. The line stored in this buffer is ter- ; minated with a binary zero (0). Provisions exist for the ; routine to perform automatic capitalization of the input ; line. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC BBLINE ; From SYSLIB Get.. EXT CAPSTR ; Definitions BDOS EQU 5 ; CP/M, Zrdos, P2Dos Entry Point B$RDLIN EQU 10 ; Read Line Function .Z80 CSEG ;=============================================================== ; NAME - BBLINE ; Entry: A = 0 for NO Capitalization, A <> 0 for Caps ; Exit : HL - Points to first byte of input line ; A - Number of characters ; Uses : AF,HL ; Special Requirements: None ;=============================================================== BBLINE: PUSH DE ; Save DE, BC PUSH BC PUSH AF ; Save capitalization flag LD HL,200 ; Set up initial buffer values LD (INLINE),HL ; ..sets INLINE=200, CCNT=0 XOR A ; Set terminating Zero LD (INLINE+202),A LD DE,INLINE ; Pt to buffer LD C,B$RDLIN ; Read line function in Bdos CALL BDOS ; Do read line function LD HL,CCNT ; Pt to char count LD C,(HL) ; Get it INC HL ; Pt to first char LD B,0 ; Add char count ADD HL,BC LD (HL),0 ; Store ending zero LD HL,LINE ; Set Starting Addr of line POP AF ; Restore Flag OR A ; Capitalize the Line? CALL NZ,CAPSTR ; ..call subroutine if so POP BC ; Now restore regs for exit POP DE LD A,(CCNT) ; Get char count RET ; Data Storage/Buffers DSEG ; Put in Data Segment INLINE: DEFS 1 ; Max length of buffer CCNT: DEFS 1 ; Character count LINE: DEFS 201 ; Buffer space + terminating Zero END