;	O	O O O	O O O	O   O
;	O   O	O   O	O   O	O  O
; CBBS	O O O	O   O	O O O	O O	.ASM
;	OO OO	O   O	O O	O  O
;	O   O	O O O	O   O	O   O
;
;
;MODIFICATIONS LOG THRU 3.2 TO "HISTORY"
;====> HISTORICAL COMMENTS SINCE 3.3 TO "HISTORY.033"
;
;------------------ WORK AREA ----------------
;
;SET THE FOLLOWING EQUATES FOR THE VARIOUS DISKS:
;
;     VALUE   DISK
;
;	0     LOGGED IN DISK
;	1     DISK A
;	2     DISK B
;	3     DISK C
;	4     DISK D
;
;(NOTE CBBS "RUNS" ON 1 DISK, COMFORTABLY ON 2)
;
;IF YOU HAVE A 1 DISK SYSTEM, SET ALL EQUATES=0
;
;THESE EQUATES ARE PROVIDED FOR CONVENIENCE.  IF
;YOU WISH, YOU MAY STORE 0, 1, OR 2 IN FRONT
;IF ANY SPECIFIC FILENAME, SUCH AS:
;WELCOME	DB	2,'WELCOME     '
;		--------
01;NEXT, SUMMARIES, MESSAGES WRITTEN TO:
;
DISKMSG	EQU	1
;		--------
;FIRSTIME, WELCOME, BULLETIN, HELP, ENTRHELP,
;SCANHELP, ENTINTRO, AND PASSWORD READ FROM:
;
03	IF	NOT TEST
DISKRO	EQU	1	;FILES WHICH ARE READ/ONLY
03	ENDIF
;
03	IF	TEST
03 DISKRO EQU	0
03	ENDIF
;		--------
;LOG, KILLED, NOTES WRITTEN TO:
;
03	IF	NOT TEST
DISKLK	EQU	1	;<================ NOTE "a:"
03	ENDIF		;	YOU MAY WANT "B:"
;
03	IF	TEST
03 DISKLK EQU	0
03	ENDIF
;		--------
;
;SUMMARY REQUEST OUTPUT AREA
;	(OVERLAID W/DATA FROM SUMMARY FILE)
;
SUMLN	DB	' MSG# LINES'
SUMDT	DB	'MM/DD/YY '
SUMFR	DB	'--------FROM-------- '
SUMTO	DB	'---------TO--------- '
	DB	CR,LF	;NEW LINE
04;MOD: (WAS 'SUBJECT:'
SUBJHD	DB	'   Subj:'
SUBJ	DB	'THIS IS THE MESSAGE SUBJECT   '
04;MOD: 1 CR/LF, NOT 2
	DB	CR,LF,0
;
;ARROW WRITTEN AT START OF COMMENTS
;	IN THE LOG FILE
;
ARROW	DB	'-->',CR	;07/11/81 NOT USED.
;
;NAME OF QUESTION FILE FOR FIRST TIME USER
;
TIME1	DB	DISKRO,'FIRSTIME   '
;
;NAME OF THE NEWS FILE FOR "WHAT'S NEW" ON CBBS
;
NEWSFL	DB	DISKRO,'NEWS       '
;
;NAME OF WELCOME FILE: IT'S THE FIRST FILE PRINTED
;
WELCOM	DB	DISKRO,'WELCOME    '
;
;NAME OF BULLETIN FILE (NEED NOT EXIST).
;ALSO, LINE OF DATA PUT OUT AS BULLETIN HEADER
;
BULLIN	DB	'--->BULLETIN',CR
BULFL	DB	DISKRO,'BULLETIN   '
;
;FILE USED TO LOG NAME TO WHEN SOMEONE SIGNS ON.
;	COMMENTS ARE ALSO WRITTEN TO THIS FILE
;
LOGFL	DB	DISKLK,'LOG        '
;
;HISTORY FILE OF KILLED MSGS
;
MSGLGFL	DB	DISKLK,'KILLED     '
;
;NOTES FILE FOR MESSAGES BETWEEN OPERATORS
;
NOTEFL	DB	DISKLK,'NOTES      '
;
;KEYWORD HELP FILE
;
HELPFL	DB	DISKRO,'HELP       '
;..AND ITS INDEX
HELPIDX	DB	DISKRO,'HELP    IDX'
;
;"NAIVE USER" HELP FILE
;
HELP2FL	DB	DISKRO,'HELP2      '
;
;HELP FILE FOR ENTER FUNCTION
;
ENHLFL	DB	DISKRO,'ENTRHELP   '
;
;HELP FILE FOR SCANNING SUMMARIES
;
SCHLFL	DB	DISKRO,'SCANHELP   '
;
;INTRO TO ENTER FUNCTIONS FILE
;
ENINFL	DB	DISKRO,'ENTINTRO   '
;
;SUMMARY FILE NAME
;
SUMFL	DB	DISKMSG,'SUMMARY    '
;
;FILE CONTAINING FUNCTION SUMMARY
;
FUNCFL	DB	DISKRO,'FUNCTION   '
;
;FILE CONTAINING NEXT MSG # TO USE.  ALSO
;CONTAINS THE CALLER NUMBER.  FORMAT:
;NNNNN(CR/LF)CCCCC(CR/LF)(CTL-Z)
;
NEXTFL	DB	DISKMSG,'NEXT       '
;
;FILE CONTAINING SYSTEM OPERATOR PASSWORD
;
PASSFL	DB	DISKRO,'PASSWORD   '
;11/11/78 FOLLOWING ADDED FOR LOGGING PASSWORD
;VIOLATION TO DISK
	DB	CR
;
MSGFN	DB	DISKMSG,'MESSAGE ' ;FILENAME (TYPE FOLLOWS:)
;
MSGFT	DB	'XNN'	;FOR EXAMPLE X02 (NEW WAY)
;MSGFT	DB	'NNX'	;FOR EXAMPLE 02X (OLD WAY)
;
;FCB FOR WORK FILE USED IN KILLING MSG & SUMM
;
WKFCB	DB	DISKMSG	;SAME DISK AS MSG
	DB	'WORKFILE   '
WKEXT	DB	0	;EXTENT
	DS	19
WKRNO	DB	0	;SECTOR #
;
WKBFA	DW	$-$	;WORK BUFFER ADDR
WKCOUNT	DW	0	;BYTE COUNT
;
;POINTER TO MSG #'S STORED WHEN FLAGGING
;A MESSAGE DURING RETRIEVE.  0000 MEANS NONE
;
FLAGPTR	DW	0
;
;file transfer flag for cp/m exit
ftrflg	db	0	;=1 if F function used
;
;BELL FLAG, LOW BIT ON MEANS ECHO PROMPTING BELL
;
BELLF	DB	1
;
;MESSAGE TO TYPE WHEN BAD FUNCTION ENTERED
;
WHAT	DB	'I DON''T UNDERSTAND ''',0
;
EOFLG	DB	0	;END OF FILE (1AH=EOF)
;
;FULL/HALF DUPLEX FLAG, 0=HALF
;
ECHOFLG	DB	1	;=0 MEANS NO ECHO
;
;NUMBER OF UNSUCCESSFUL KILL ATTEMPTS
;
NKILATT	DB	0	;CAN'T KILL IF 3 BAD
01;START OF MODS
;
;# OF MSG ENTRIES/CALL
;
ELEFT	DB	ECOUNT	;2 LEFT
;
;# OF COMMENT LINES PER CALL
;
CLEFT	DB	CCOUNT	;10 LEFT
01;END OF MODS
;
CARFLG	DB	0	;SET >0 IF CARRIER LOST
;
;EXPERT USER FLAG: >0 MEANS STOP PROMPT MSGS @ ':'
;
EXPERT	DB	0	;NOT EXPERT
;
BYMSG	DB	CR,LF
	DB	'Character counts:'
NCHRE	DB	'        typed by you, '
NCHRT	DB	'        typed by system.',CR,LF
;	  /--------------------------\
;	/   NOTE: CHANGE THE NAMES IN  \
;	\     THE FOLLOWING MESSAGE:   /
;	  \--------------------------/
;
;	DB	'From Ward and Randy:'
	db	'From Jack:'
;
	DB	CR,LF
	DB	'Thanks for calling, ',0
;
NOFMSG	DB	'THERE IS NO FILE: ',0
;
TABCOL	DB	1	;CURR. COL FOR TAB EXPAND
;
COL	DB	1	;CURRENT TTY OUTPUT COLUMN
;
SPEED	DB	'X',CR	;LOG 1ST DIGIT OF BAUD RATE
;
MSGNO	DB	'XXXXX'	;MESSAGE NUMBER..
	DB	CR	;..C/R
;
HILINE	DB	'00',CR ;HIGHEST LINE # ON ENTER
;
PASSWD	DB	'NONE',CR
;
NONE	DB	'NONE',CR ;DUMMY PASSWORD
;
PRINTSW	DB	0	;1 IF LOCAL PRINT
;
INHELP	DB	0	;>0 IF IN "HELP" AND
;			 GETVAR IS TO IGNORE "X"
;
;FOLLOWING FLAG SET =0 WHEN
;SYSTEM OPERATOR PASSWORD ENTERED
;
PASSFLG	DB	1	;0 = PASSWORD ENTERED
;
;FOLLOWING IS A MASK USED IN AN 'ANA' INSTRUCTION.
;THE MASK IS EITHER 0FFH (I.E. RESULTS IN NO CHANGE)
;OR IS A 5FH, WHICH TRANSLATES lower case TO UPPER
;
;THE DEFAULT IS UPPER CASE BECAUSE OF THE
;#&$#@* HEATH H9 WHICH GARBAGES LOWER CASE.
;(EXCUSE THE EDITORIAL COMMENTARY)
;
CASE	DB	5FH	;DEFAULT TO UPPER CASE
;
CASEFLG	DB	0	;SET TO 1 IF WE HAVE ASKED
;			;IF LOWER CASE CAN BE HANDLED
;
TWITSW	DB	0	;1 ==> USER IS A TWIT,
;			;CAN'T KILL OR ENTER
;
;WHEN THE PHONE CONNECTION IS LOST AT AN UNEXPECTED
;TIME, THE FOLLOWING SWITCH IS INTERROGATED TO SEE
;IF A DISK UPDATE IS IN PROGRESS (>0) OR NOT (=0).
;IF NOT, WE CAN GO AWAY.  IF SO, WE HAVE TO CONTINUE
;UNTIL THE UPDATE IS DONE.
;
DKUPSW	DB	0
;
;SWITCH TO SHOW IF CTL-K (FUNCTION ABORT) IS
;ENABLED (=0) OR NOT (>0)
;
CTLKSW	DB	4	;CTL-K ENABLED, TO 1ST TIME Q.
;
;SWITCH TO SHOW IF CTL-C DISABLED (>0)
;
CTLCSW	DB	0	;ENABLED
;
;MESSAGE TO TYPE WHEN CTL-K ATTEMPTED BUT
;NOT PERMITTED
;
NOCTLK	DB	CR,LF
	DB	'++Can''t USE CTL-K now',CR,LF,0
;
;MESSAGES FOR WHICH CASE WE ARE IN
;
LCASEM	DB	'lower/'
;
UCASEM	DB	'upper case mode',CR,LF,0
;
;DEFINE FLAG WHICH WILL PREVENT SYSTEM HANGING UP
;IF THE COMMENT FUNCTION GETS AN ERROR.  SET TO 'B'
;(BUSY) UPON ENTRY TO COMMENT, AND 'N' (NOT BUSY) UPON
;EXIT.  IF THE ROUTINE IS ENTERED AND FOUND BUSY, IT
;IS BYPASSED
;
COMFLG	DB	'N'
;
COMFRM	DB	'FROM: ',CR ;NOTES FILE HDR
;
;
	IF	TTY	;HAVE LOG TTY?
TTYSTP	DW	LOGBUF	;PTR: STORE CHAR FROM KB
TTYLDP	DW	LOGBUF	;PTR: LOAD CHAR TO TTY
	ENDIF
;
;NUMBER OF NULLS TO SEND TO USER
;
NULLS	DB	0
;
;USER-SELECTABLE BACKSPACE CHAR VIA "V" COMMAND
;
BSCHAR	DB	8	;DEFAULT TO ^H
;
;DECIMAL NUMBER STORED HERE (WRITTEN
;TO LOG FILE AS ELAPSED TIME)
;
WRETMSG	DB	'E.T. '
DECNUM	DB	'000',CR
;
;"NONEFLG" IS >0 IF NO DUPLICATE CHARS
;	>= ' ' AND < '9' ARE TO BE TYPED.
;
NONEFLG	DB	0	;DEFAULT OFF
PREVCHR	DB	0	;PREVIOUS CHAR TYPED
;			 TO CHECK FOR DUPLICATES
;
;HOLDFLG IS >0 IF OPERATOR HAS REQUESTED "HOLD"
;SO PHONE WON'T HANG UP
;
HOLDFLG	DB	0
;
;FLAG SET NON-ZERO IF OPERATOR "CONT" COMMAND USED -
;	CONTINUES PREVIOUSLY ENTERED MESSAGE
;
MCONT	DB	0
;
THIRTY	DB	'00030'	;USED IN BINARY SUMMARY SEARCH
;
;
PERFLG	DB	0
;
;PATCH AREA FOR DEBUGGING
;
;	ORG	($+15) AND 0FFF0H ;TO 16 BOUNDARY
;PATCH	DB	' <<PATCH AREA>> '
;	DB	' <<PATCH AREA>> '
;	DB	' <<PATCH AREA>> '
;	DB	' <<PATCH AREA>> '
;
;
QFNAME	DB	''', '	;FNAME MUST BE NEXT DS
;
;-------- DB'S ABOVE THIS LINE, DS'S BELOW ---------
;
FNAME	DS	20	;QFNAME MUST PRECEED THIS
LNAME	DS	20	;CALLER LAST NAME
;
;btrys	ds	1
;sswflg	ds	1
;dsrflg	ds	1
;nulls	ds	1
;temp	ds	1
;dkupsw	ds	1
;relogf	ds	1
;carlc	ds	1
;autofg	ds	1
;expert	ds	1
;bellf	ds	1
;echoflg	ds	1
;bsflg	ds	1
pasflg	ds	1
;case	ds	1
;caseflg	ds	1
;typusrf	ds	1
;
DATE	DS	12	;MM/DD/YY (CR)
MSGTO	DS	30	;WHO IS MESSAGE TO
ANSWER	DS	65	;ANSWER GOES HERE
INBUF	DS	132	;INPUT BUFFER
SAVUSR	DS	1	;SAVE USER # FOR PASSWORD FILE
SAVMSG	DS	5	;SAVE MSG # DURING "GET"
MISSMSG	DS	6	;MSG # MISSED IN SUMMARY
GVREPT	DS	2	;ADDR TO REPEAT TOO LONG INPUT
GVTRUNC	DS	2	;ADDR OF LINE FOR TRUNC PRINT
BUFPTR	DS	2	;FILE READ CHAR POINTER
NUM	DS	2	;POINTER TO #(CBBS).  Any comments, errors, omissions, 
scanptr	ds	2	;pointer past ',' in q/s scan
sclog	ds	2	;pointer for scan logicals
strptr	ds	2	;address of string to match	
;etc should be referred to the Chicago CBBS, online at (312) 
;545-8086, or to Ward CO MATCH
SCDELIM	DS	1	;SCAN LOGICAL DELIMITER
SCANTYP	DS	1	;D/F/T/S/=
LENGTH	DS	1	;LENGTH OF INPUT VARIABLE
SUMTYP	DS	1	;SUMMARY: S=REG, Q=QUICK
COMPTYP	DS	1	;IS THIS A "NOT EQUAL" COMPARE?
STRFLG	DS	1	;',' MEANS STRING SEARCH
FLAGREQ	DS	1	;1=FLAG RTRV REQUESTED
INFLG	DS	1	;CASE TRANSLATE ON INPUT (0=YES)
BYEFLG	DS	1	;COMMENTS TO WRITE?
T1FLAG	DS	1	;'Y'/'N', FIRST TIME?
RTOGO	DS	1	;# LEFT TO RETRIEVE (+)
SUMCNT	DS	1	;COUNT 50 TO PRINT HEADER
TRIES	DS	1	;SPEED SELECT TRY COUNT
FIRSTCH	DS	1	;FIRST CHAR IN ON A LINE
NPURG	DS	1	;# MSGS PURGED FR. SUMMARY
CALLERN	DS	6	;CALLER # SO IT CAN BE LOGGED
;
	IF	CLOCK
LGINTIM	DS	9	;LOG IN HH:MM:SS,0
	ENDIF
;
LOSECT	DS	1	;FIELDS USED..
MIDSECT	DS	1	;..BY BINARY..
HISECT	DS	1	;..SEARCH FOR..
SRCHLVL	DS	1	;..SUMMARY
;
perbuf	ds	5	;storage for personal msg password
;
	DS	100	;STACK SPACE
STACK	EQU	$	;FOR 'LXI SP,STACK'
	ORG	($+255) AND 0FF00H ;TO PAGE BOUNDARY
;
;KEEP THE NEXT 3 TOGETHER - LOGBUF MUST BE PAGE ALIGNED,
;WKBUF SECTOR ALIGNED, AND MSGBUF AT LEAST ALIGNED
;ON 64 BYTE BOUNDARY.
;
	IF	TTY	;HAVE LOG TTY?
LOGBUF	DS	256	;1 PAGE LOG BUFFER FOR TTY
	ENDIF
;
WKBUF	DS	256	;128
MSGBF	DS	1+16*64	;MESSAGE INPUT AREA (ALIGNED)
;
;MSGBF IS ALSO USED FOR A DISK BUFFER FOR
;WRITING TEMP FILE DURING KILL OF SUMMARY/MSG.
;
;IT IS ALSO USED TO STORE FLAGGED SUMMARY MESSAGE #'S
;
	ORG	MSGBF+KBUFPG*256 ;SIZE
;
KILLBUF	EQU	$	;KILLED MSG READ HERE
;
;------------------ EQUATES ----------------
;
;FOLLOWING EQUATES ADDED FOR IDS MODEM,
;OUTPUTTING VARIOUS BITS.  WE ALSO USE IT
;WITH THE PMMI
;
;CTLPORT	EQU	3	;OUT TO THIS PORT
;CTLRDET	EQU	80H	;OUTPUT RING DETECT 1 SEC
;CTLMOTR	EQU	40H	;MOTOR ON OUTPUT
;
;DEFINE A BIT WHICH CAN BE OUTPUT TO SWITCH
;	BETWEEN MODEMS ONLINE
;	(SORRY, NEVER IMPLEMENTED)
;CTLMODM	EQU	20H	;0=HAYES, 1=IDS
;
;CP/M BDOS CALL FUNCTION CODES, REVISED 07/06/81
;
RDCON	EQU	1
WRCON	EQU	2
RDRDR	EQU	3
PUNPUN	EQU	4
LISTOUT	EQU	5
DIRCON	EQU	6
GETIOBY	EQU	7
PUTIOBY	EQU	8
PRINT	EQU	9
RDCONBF	EQU	10	;A
CONSTAT	EQU	11	;B
GETVERS	EQU	12	;C
RESETDK	EQU	13	;D
LGINDK	EQU	14	;E 0=A
OPEN	EQU	15	;F
CLOSE	EQU	16	;10
SRCHF	EQU	17	;11
SRCHN	EQU	18	;12
ERASE	EQU	19	;13
READ	EQU	20	;14
WRITE	EQU	21	;15
MAKE	EQU	22	;16
REN	EQU	23	;17
GETLGIN	EQU	24	;18
INQDISK	EQU	25	;19 0=A
SETDMA	EQU	26	;1A
INQALC	EQU	27	;1B
WRPROT	EQU	28	;1C
GETROV	EQU	29	;1D
SETATTR	EQU	30	;1E
GETPARM	EQU	31	;1F
SGUSER	EQU	32	;20
RDRAND	EQU	33	;21
WRRAND	EQU	34	;22
COMPSZ	EQU	35	;23
SETRAND	EQU	36	;24
BDOS	EQU	5
FCB	EQU	5CH 
FCB2	EQU	6CH
FCBEXT	EQU	FCB+12
FCBNSEC	EQU	FCB+15
FCBRNO	EQU	FCB+32
