home *** CD-ROM | disk | FTP | other *** search
- ; PROGRAM: COMMENT
- ; AUTHOR: Richard Conn
- ; VERSION: 1.0
- ; DATE: 18 APR 83
- ; PREVIOUS VERSIONS: None
-
- vers equ 10
-
- ;
- ; COMMENT echoes lines, with simple character editing, to the user's
- ; console. This program is designed to facilitate communication between
- ; two users who see the same console via redirectable I/O. They can chat
- ; freely to each other by using this program.
- ;
-
- llen equ 65 ;number of chars allowed before auto newline
-
- fcb equ 5ch ;FCB
-
- ctrlc equ 'C'-'@' ;Abort Character
- cr equ 0dh ;New Line
- lf equ 0ah ;Line Feed
- bs equ 8 ;Back Space
- del equ 7fh ;Delete Char
- ctrlu equ 'U'-'@' ;^U
- ctrlx equ 'X'-'@' ;^X
-
- ext cin, cout, crlf, print
-
-
- ;
- ; This program is Copyright (c) 1983 by Richard Conn
- ; All Rights Reserved
- ;
- ; ZCPR2 and its utilities, including this one, are released
- ; to the public domain. Anyone who wishes to USE them may do so with
- ; no strings attached. The author assumes no responsibility or
- ; liability for the use of ZCPR2 and its utilities.
- ;
- ; The author, Richard Conn, has sole rights to this program.
- ; ZCPR2 and its utilities may not be sold without the express,
- ; written permission of the author.
- ;
-
- ;
- ; Branch to Start of Program
- ;
- jmp start
-
- ;
- ;******************************************************************
- ;
- ; SINSFORM -- ZCPR2 Utility Standard General Purpose Initialization Format
- ;
- ; This data block precisely defines the data format for
- ; initial features of a ZCPR2 system which are required for proper
- ; initialization of the ZCPR2-Specific Routines in SYSLIB.
- ;
-
- ;
- ; EXTERNAL PATH DATA
- ;
- EPAVAIL:
- DB 0FFH ; IS EXTERNAL PATH AVAILABLE? (0=NO, 0FFH=YES)
- EPADR:
- DW 40H ; ADDRESS OF EXTERNAL PATH IF AVAILABLE
-
- ;
- ; INTERNAL PATH DATA
- ;
- INTPATH:
- DB 0,0 ; DISK, USER FOR FIRST PATH ELEMENT
- ; DISK = 1 FOR A, '$' FOR CURRENT
- ; USER = NUMBER, '$' FOR CURRENT
- DB 0,0
- DB 0,0
- DB 0,0
- DB 0,0
- DB 0,0
- DB 0,0
- DB 0,0 ; DISK, USER FOR 8TH PATH ELEMENT
- DB 0 ; END OF PATH
-
- ;
- ; MULTIPLE COMMAND LINE BUFFER DATA
- ;
- MCAVAIL:
- DB 0FFH ; IS MULTIPLE COMMAND LINE BUFFER AVAILABLE?
- MCADR:
- DW 0FF00H ; ADDRESS OF MULTIPLE COMMAND LINE BUFFER IF AVAILABLE
-
- ;
- ; DISK/USER LIMITS
- ;
- MDISK:
- DB 4 ; MAXIMUM NUMBER OF DISKS
- MUSER:
- DB 31 ; MAXIMUM USER NUMBER
-
- ;
- ; FLAGS TO PERMIT LOG IN FOR DIFFERENT USER AREA OR DISK
- ;
- DOK:
- DB 0FFH ; ALLOW DISK CHANGE? (0=NO, 0FFH=YES)
- UOK:
- DB 0FFH ; ALLOW USER CHANGE? (0=NO, 0FFH=YES)
-
- ;
- ; PRIVILEGED USER DATA
- ;
- PUSER:
- DB 10 ; BEGINNING OF PRIVILEGED USER AREAS
- PPASS:
- DB 'chdir',0 ; PASSWORD FOR MOVING INTO PRIV USER AREAS
- DS 41-($-PPASS) ; 40 CHARS MAX IN BUFFER + 1 for ending NULL
-
- ;
- ; CURRENT USER/DISK INDICATOR
- ;
- CINDIC:
- DB '$' ; USUAL VALUE (FOR PATH EXPRESSIONS)
-
- ;
- ; DMA ADDRESS FOR DISK TRANSFERS
- ;
- DMADR:
- DW 80H ; TBUFF AREA
-
- ;
- ; NAMED DIRECTORY INFORMATION
- ;
- NDRADR:
- DW 00000H ; ADDRESS OF MEMORY-RESIDENT NAMED DIRECTORY
- NDNAMES:
- DB 64 ; MAX NUMBER OF DIRECTORY NAMES
- DNFILE:
- DB 'NAMES ' ; NAME OF DISK NAME FILE
- DB 'DIR' ; TYPE OF DISK NAME FILE
-
- ;
- ; REQUIREMENTS FLAGS
- ;
- EPREQD:
- DB 000H ; EXTERNAL PATH?
- MCREQD:
- DB 000H ; MULTIPLE COMMAND LINE?
- MXREQD:
- DB 000H ; MAX USER/DISK?
- UDREQD:
- DB 000H ; ALLOW USER/DISK CHANGE?
- PUREQD:
- DB 000H ; PRIVILEGED USER?
- CDREQD:
- DB 000H ; CURRENT INDIC AND DMA?
- NDREQD:
- DB 000H ; NAMED DIRECTORIES?
- Z2CLASS:
- DB 0 ; CLASS 0
- DB 'ZCPR2'
- DS 10 ; RESERVED
-
- ;
- ; END OF SINSFORM -- STANDARD DEFAULT PARAMETER DATA
- ;
- ;******************************************************************
- ;
-
- ;
- ; Start of Program
- ;
- start:
-
- call print
- db 'COMMENT, Version '
- db (vers/10)+'0','.',(vers mod 10)+'0',0
- lda fcb+1 ;check for help request
- cpi '/' ;help?
- jnz cmt
- ;
- ; Help for COMMENT
- ;
- call print
- db cr,lf,'COMMENT simply echoes the user''s input to his'
- db cr,lf,'screen until he types a ^C. Simple line editing'
- db cr,lf,'via the ^H, DEL, ^U, and ^X functions is available.'
- db cr,lf
- db cr,lf,'COMMENT is intended to be used when two users are'
- db cr,lf,'seeing the same screen (via redirectable I/O) and'
- db cr,lf,'wish to converse freely. Assuming that both consoles'
- db cr,lf,'are tied together on input and output, COMMENT allows'
- db cr,lf,'the two people to type freely to each other without'
- db cr,lf,'fear of disturbing the system.'
- db cr,lf
- db cr,lf,'COMMENT is invoked by simply typing "COMMENT".'
- db 0
- ret
- ;
- ; Beginning of Comment Routine
- ;
- cmt:
- call print
- db cr,lf,'Strike ^C to Abort'
- db cr,lf,0
- call comment ;print first prompt and set char count
- ;
- ; Main Character Input Loop
- ;
- loop:
- call cin ;input char
- ani 7fh ;mask MSB
- cpi ctrlc
- rz
- cpi cr ;new line?
- jz newline
- cpi bs ;back up?
- jz back
- cpi del ;back up?
- jz back
- cpi ctrlu ;erase line?
- jz eraln
- cpi ctrlx ;erase line?
- jz eraln
- call cout
- cpi ' ' ;printable char?
- jc loop
- inr c ;increment char count
- mvi a,llen ;check for nearing end of line
- cmp c
- cz comment
- jmp loop
- ;
- ; Routine to begin a new line
- ;
- newline:
- call comment ;new line, print prompt, set char count to zero
- jmp loop
- ;
- ; Back up one character
- ;
- back:
- mov a,c ;check for no chars
- ora a
- jz loop
- call back1 ;backup routine
- jmp loop ;continue
- ;
- ; General Routine for backing up
- ;
- back1:
- dcr c ;count down
- mvi a,bs ;backspace
- call cout
- mvi a,' ' ;space
- call cout
- mvi a,bs ;backspace
- jmp cout
- ;
- ; Erase Current Line
- ;
- eraln:
- mov a,c ;done?
- ora a
- jz loop
- call back1 ;backup
- jmp eraln
- ;
- ; Print User Prompt
- ;
- comment:
- call crlf
- call print
- db 'Comment> ',0
- mvi c,0 ;set char count
- ret
-
- end