CODE_SEG	SEGMENT
.MODEL SMALL
ASSUME CS:CODE_SEG
;
;************************************
;*    CHAOCIPHER II                 *
;*                                  *
;*    A CRYPTOGRAPHIC ALGORITHM     *
;************************************
;
;
;DATA SECTION
;
COUNT DW	0
COUNT2	DW	0
FSR	 DB     7 DUP(02H)
TEMP	DB	3 DUP(?)
KEY	DB	?
FSR3 DB 9	DUP(0FH)
TFSR63 DB 9 DUP(?); TEMP SPACE USED BY FSR63 GENERATOR
BSAVE DB	0
FSR2	DB	5 DUP(45H)
PSIZE DW	?
PLOC	 DW	?
PDO	 DW	?
STORE	DB	?;USED BY ROUTINE BYTEKEY
PTEMP DB	?
PADR1 DW	?
ASAVE	DW	?
AS2	DW	?
TSAVE DW	?
TAB1 DB	256 DUP(?)
TAB2 DB	256 DUP(?)
TAB1INV DB 256 DUP(?)
TAB2INV DB 256 DUP(?)
TIME	DB 	0DH,0AH,'  :  :  :  $';USED BY GETTIME ROUTINE
TEN	DB	10
MODE	DB	0; 0 FOR ENCIPHER
CHAR	DB	0; CHARACTER OF CIPHER/DECIPHER
D1	DB	0; FIRST DISPLACEMENT
D2	DB	0
D3	DB	0
FEEDBACK	DB	0
TEMPBYTE	DB	0; USED FOR FEEDBACK STORE
;DATA FOR FILE READ ROUTINE
TITLE1 DB 0DH,0AH,'CCCCCC                          III   III$'
TITLE2 DB 0DH,0AH,'C       H   H  HHHHH  OOOOO      I     I$'
TITLE3 DB 0DH,0AH,'C       HHHHH  H___H  O   O      I     I$'
TITLE4 DB 0DH,0AH,'C       H   H  H   H  OOOOO      I     I$'
TITLE5 DB 0DH,0AH,'CCCCCC                          III   III$'
HEADER	DB	0DH,0AH,'   CHAOCIPHER II.....All rights reserved$',0DH,0AH
M1		DB   0DH,0AH,'ENTER NAME OF FILE: $'
M2		DB	0DH,0AH,0DH,0AH,'UNABLE TO OPEN FILE $',0DH,0AH
M3		DB	0DH,0AH,'ENCIPHERING... $'
M4		DB	0DH,0AH,'DECIPHERING... $'
M5		DB	0DH,0AH,'ERROR READING FILE, CLOSING FILE...$'
M6	        DB   0DH,0AH,'ENTER YOUR KEY (CTRL-E FOR ECHO): $'
M7		DB	0DH,0AH,'NO KEY ENTERED, TRY AGAIN (CTRL C TO ABORT) $'
M8		DB	0DH,0AH,'KEY TOO SHORT (MUST BE AT LEAST 10 CHARS): $'
M9		DB	0DH,0AH,'KEYCHECK = $'
M10		DB	0DH,0AH,'PROCEED WITH DECIPHERMENT [Y/N]? $'
M11		DB	0DH,0AH,'DATE & TIME OF ENCRYPTION: $'
M12		DB	0DH,0AH,'AUTHENTICATOR DOES NOT VERIFY!!!!!!!$'
M13		DB	0DH,0AH,'DATE, TIME, & CHECKSUM VERIFIED $'
M14		DB	0DH,0AH,'THIS IS A WEAK KEY, PLEASE CHANGE KEYS $'
EMESS		DB	0DH,0AH,'ERROR AT INSTRUCTION POINTER = $'
TOOLONG		DB	0DH,0AH,'KEY IS TOO LONG, TRY AGAIN... $'
FILENAME	DB	50 DUP(0)
HANDLE	DW	0
LEN		DB	4 DUP(0); 32 BIT FILE LENGTH
NUMBLKS	DW	0; NUMBER OF BLOCKS TO BE ENCRYPTED
LASTBLK	DW	0; SIZE OF LAST BLOCK TO BE ENCRYPTED
NUMDONE	DW	0 ;NUMBER OF BLOCKS ENCRYPTED SO FAR
LENDATA	DW	0 ;LENGTH OF DATA CURRENTLY BEING CIPHERED
TXTPTR	DW	0 ;POINTER INTO TEXT BEING CIPHERED
LENSAVE	DW	0 ;USED BY ENCRYPTION ROUTINE
KEYIN	DB	52 DUP(20H); USER ENTERED KEY
CHKSUM	DW	0; CALCULATED CHECKSUM OF USER ENTERED KEY
ASCII	DB	'    $';OUTPUT OF CONV16 ROUTINE
HEX	DB	'0123456789ABCDEF'
YEAR	DW	0
MONTH	DB	0
DAY	DB	0
WEEKDAY	DB	0
HOURS	DB	0
MINUTES	DB	0
AUTH	DW	0;TIME DATE KEY STAMP- MUST COME AFTER MINUTES
CAUTH	DW	0
DIGITS	DB	'0123456789'
DAYS	DB	' MON  TUE  WED  THR  FRI  SAT  SUN '
MONTHS	DB	' JAN  FEB  MAR  APR  MAY  JUN  JLY  AUG  SEP  OCT  NOV  DEC '
TIMEDATE DB     '                 :    HRS $'
;
;CODE SECTION
;
INIT		PROC	NEAR
;
;AFTER LOADING SHIFT REGISTER DATA, COMPLETE INITIALIZATION
		XOR	AX,AX
		MOV	COUNT2,AX
		MOV	COUNT,AX
;
;GENERATE TAB1
	MOV	CX,256
	MOV	AH,0
	MOV	BX,OFFSET TAB1
LL1:	MOV	[BX],AH
	INC	BX
	INC	AH
	LOOP	LL1
	MOV	AX,256
	MOV	PSIZE,AX
	MOV	AX,OFFSET TAB1
	MOV	PLOC,AX
	MOV	AX,500
	MOV	PDO,AX
	CALL	PERM
;GENERATE TAB2
	MOV	CX,256
	MOV	AH,0
	MOV	BX,OFFSET TAB2
LL2:	MOV	[BX],AH
	INC	BX
	INC	AH
	LOOP	LL2
	MOV	AX,256
	MOV	PSIZE,AX
	MOV	AX,OFFSET TAB2
	MOV	PLOC,AX
	MOV	AX,500
	MOV	PDO,AX
	CALL	PERM
;COMPUTE INVERSE OF TAB1
	MOV	CX,256
	MOV	SI,OFFSET TAB1
	MOV	DI,OFFSET TAB1INV
	XOR	AH,AH
LL3:	XOR	BX,BX
	MOV	BL,[SI]
	ADD 	BX,DI
	MOV	[BX],AH
	INC	AH
	INC	SI
	LOOP	LL3
;COMPUTE INVERSE OF TAB2
	MOV	CX,256
	MOV	SI,OFFSET TAB2
	MOV	DI,OFFSET TAB2INV
	XOR	AH,AH
LL4:	XOR	BX,BX
	MOV	BL,[SI]
	ADD	BX,DI
	MOV	[BX],AH
	INC	AH
	INC	SI
	LOOP	LL4
	RET
;
INIT ENDP
;
;CIPHER ROUTINE: ACT ON CHAR WITH CURRENT DATA AND UPDATE
CIPHER	PROC	NEAR
	CMP	MODE,0
	JNZ	DECRYPT
ENCRYPT:
	MOV	AL,CHAR
	MOV	TEMPBYTE,AL; SAVE FOR FEEDBACK
	ADD	AL,D1
	MOV	BX,OFFSET TAB1
	XLAT
	ADD	AL,D2
	MOV	BX,OFFSET TAB2
	XLAT
	ADD	AL,D3
	MOV	CHAR,AL
	JMP	UPDATE
DECRYPT:
	MOV	AL,CHAR
	MOV	AH,D3
	NEG	AH
	ADD	AL,AH
	MOV	BX,OFFSET TAB2INV
	XLAT
	MOV	AH,D2
	NEG	AH
	ADD	AL,AH
	MOV	BX,OFFSET TAB1INV
	XLAT
	MOV	AH,D1
	NEG	AH
	ADD	AL,AH
	MOV	CHAR,AL
	MOV	TEMPBYTE,AL;SAVE FEEDBACK BYTE
UPDATE:
	CALL	BYTEKEY
	ADD	D1,AH
	CALL	BYTEKEY
	ADD	D2,AH
	CALL	BYTEKEY
	ADD	D3,AH
	MOV	AH,TEMPBYTE
	ADD	D2,AH;FEEDBACK
	RET
CIPHER	ENDP
;
FSR63	PROC	NEAR
;S(i+63)=S(i+1)+S(i)
;TO INITIALIZE:PLACE 63 BITS RIGHT JUSTIFIED
;IN FSR3+1 TO FSR3+8.  ZERO COUNT2
;NEXT BYTE RETURNED IN AH
SS1:	MOV	AX,COUNT2
	CMP	AX,0
	JNZ	NZ
;COMPUTE 2 LEFT END BLOCK BITS AND OUTPUT FSR3+1
	MOV	AH,FSR3+8
	AND	AH,1
	MOV	AL,FSR3+8
	AND	AL,2
	SHR	AL,1
	XOR	AH,AL
	JZ	SS2
;SET BIT
	MOV	AH,FSR3+1
	OR	AH,80H
	MOV	FSR3+1,AH
	JMP	SS3
;RESET BIT
SS2:	MOV	AH,FSR3+1
	AND	AH,7FH
	MOV	FSR3+1,AH
;NEXT BIT
SS3:	MOV	AH,FSR3+8
	AND	AH,2
	MOV	AL,FSR3+8
	AND	AL,4
	SHR	AL,1
	XOR	AH,AL
	CMP	AH,0
	JZ	SS4
;SET BIT
	MOV	AH,FSR3
	OR	AH,1
	MOV	FSR3,AH
	JMP	SS5
;RESET BIT
SS4:	MOV	AH,FSR3
	AND	AH,0FEH
	MOV	FSR3,AH
;SET COUNT2 AND OUTPUT BYTE
SS5:	MOV	AX,1
	MOV	COUNT2,AX
	MOV	AH,FSR3+1
	RET
;COUNT2 <> 0
NZ:	CMP	AX,8
	JZ	SS6
;OUTPUT NEXT BYTE
	INC	AX
	MOV	COUNT2,AX
	MOV	SI,OFFSET FSR3
	ADD	SI,AX
	MOV	AH,[SI]
	RET
;GENERATE NEXT 63 BIT BLOCK AND GO TO SS1
SS6:	MOV	AX,0
	MOV	COUNT2,AX
;
;COPY FSR3 BLOCK INTO TFSR63
	MOV	SI,OFFSET FSR3
	MOV	DI,OFFSET TFSR63
	MOV	CX,9
CIRC2: MOV	AH,[SI]
	MOV	[DI],AH
	INC	SI
	INC	DI
LOOP	CIRC2
;SHIFT FSR3 BLOCK LEFT
	MOV	SI,OFFSET FSR3
	SHL	BYTE PTR [SI],1
	INC	SI
	MOV	CX,8
CIRC1: SHL	BYTE PTR [SI],1
	JNC	SS10
	DEC	SI
	OR	BYTE PTR [SI],1
	INC	SI
SS10: INC	SI
LOOP	CIRC1
;XOR	THE TWO BLOCKS AND STORE IN FSR3 BLOCK
	MOV	SI,OFFSET TFSR63
	MOV	DI,OFFSET FSR3
	MOV	CX,9
CIRC3: MOV	AH,[SI]
	XOR	AH,[DI]
	MOV	[DI],AH
	INC	SI
	INC	DI
LOOP CIRC3
;RIGHT SHIFT FSR3 TWICE
	MOV	BX,2
SS9: MOV	SI,OFFSET FSR3+8
	SHR	BYTE PTR [SI],1
	MOV	CX,8
	DEC	SI
SS20: SHR	BYTE PTR [SI],1
	JNC	SS11
	INC	SI
	OR	BYTE PTR [SI],80H
	DEC	SI
SS11: DEC	SI
LOOP	SS20
	DEC	BX
	JNZ	SS9
	JMP	SS1
FSR63	ENDP
;
FSR55	PROC	NEAR
;S(i+55)=S(i+24)+S(i)
;TO INITIALIZE: PLACE ZERO IN COUNT & INITIAL 55 BITS
;LEFT JUSTIFIED IN FSR.  NEXT BYTE RETURNED IN REG AH
;
GL:	MOV	AX,COUNT
	CMP	AX,0
	JE	NB
	CMP	AX,7
	JNZ	G1
	MOV	AX,0
	MOV	COUNT,AX
	JMP	NBLK
G1:	INC	AX
	MOV	COUNT,AX
	MOV	SI,OFFSET FSR
	MOV	CX,COUNT
	SUB	CX,1
L1:	INC	SI
LOOP	L1
	MOV	AH,[SI]
	RET
;COMPUTE NEXT BIT
NB:	MOV	AH,FSR
	MOV	AL,FSR+3
	XOR	AH,AL
	MOV	AL,FSR+6
	AND	AL,0FEH
	AND	AH,80H
	JZ	N1
	XOR	AL,1
N1:	MOV	BYTE PTR FSR+6,AL
	MOV	AH,FSR
	MOV	AL,1
	MOV	BYTE PTR COUNT,AL
	RET
;GENERATE NEXT BLOCK
NBLK: MOV	SI,OFFSET FSR
	SAL	BYTE PTR [SI],1
	INC	SI
	MOV	CX,6
LP2:	SAL	BYTE PTR [SI],1
	JNC	CONT2
	DEC	SI
	XOR	BYTE PTR [SI],1
	INC	SI
CONT2: INC	SI
LOOP	LP2
	MOV	AH,FSR
	MOV	AL,FSR+3
	XOR	AH,AL
	AND	AH,80H
	JZ	CONT3
	MOV	AH,FSR+6
	XOR	AH,1
	MOV	BYTE PTR FSR+6,AH
CONT3: MOV	AH,FSR
	MOV	AL,FSR+3
	XOR	AH,AL
	MOV	BYTE PTR FSR,AH
	MOV	AH,FSR+1
	MOV	AL,FSR+4
	XOR	AH,AL
	MOV	BYTE PTR FSR+1,AH
	MOV	AH,FSR+2
	MOV	AL,FSR+5
	XOR	AH,AL
	MOV	BYTE PTR FSR+2,AH
	MOV	AH,FSR+3
	MOV	AL,FSR+6
	XOR	AH,AL
	MOV	BYTE PTR FSR+3,AH
	MOV	SI,OFFSET FSR
	MOV	DI,OFFSET TEMP
	MOV	CX,3
LP4:	MOV	AH,[SI]
	MOV	BYTE PTR [DI],AH
	INC	SI
	INC	DI
LOOP	LP4
	MOV	SI,OFFSET TEMP
	SAL	BYTE PTR [SI],1
	INC	SI
	SAL	BYTE PTR [SI],1
	JNC	LP5
	DEC	SI
	XOR	BYTE PTR [SI],1
	INC	SI
LP5: INC	SI
	SAL	BYTE PTR [SI],1
	JNC	LP6
	DEC	SI
	XOR	BYTE PTR [SI],1
LP6:	MOV	AH,TEMP
	MOV	AL,FSR+4
	XOR	AH,AL
	MOV	BYTE PTR FSR+4,AH
	MOV	AH,TEMP+1
	MOV	AL,FSR+5
	XOR	AH,AL
	MOV	BYTE PTR FSR+5,AH
	MOV	AH,TEMP+2
	MOV	AL,FSR+6
	XOR	AH,AL
	MOV	BYTE PTR FSR+6,AH
	JMP	GL
FSR55	ENDP
;
FSR35	PROC	NEAR
;S(I+25)=S(I)+S(I+3)
;TO INITIALIZE PLACE INITIAL 25 BITS LEFT
;JUSTIFIED IN FSR2.  UPON CALL NEXT BIT LEFT
;IN REG AH.  THIS SR USED ONLY DURING KEY 
;GENERATION
;
	MOV	AH,FSR2
	AND	AH,90H
	CMP	AH,0
	JE	ZERO
	CMP	AH,90H
	JE	ZERO
;XOR NOT ZERO
	MOV	AH,1
	MOV	BSAVE,AH
	JMP	MX1
ZERO: MOV	AH,0
	MOV	BSAVE,AH
MX1:	MOV	AH,BYTE PTR FSR2+3
	AND	AH,80H
	MOV	AL,BSAVE
	CMP	AL,0
	JZ	MX2
	XOR 	AH,40H
MX2:	MOV	BYTE PTR FSR2+3,AH
;SHIFT BLOCK
	MOV	SI,OFFSET FSR2
	SAL	BYTE PTR [SI],1
	MOV	CX,3
	INC	SI
ML3:	SAL	BYTE PTR [SI],1
	JNC	MX4
	DEC	SI
	XOR	BYTE PTR [SI],1
	INC	SI
MX4:	INC	SI
LOOP	ML3
	MOV	AH,BSAVE
	RET
FSR35	ENDP
;
BYTEKEY	PROC	NEAR
;COMBINE FSR55 AND FSR63. PUT OUTPUT IN AH.
	CALL	FSR55
	MOV	STORE,AH
	CALL	FSR63
	MOV	AL,STORE
	XOR	AH,AL
	RET
BYTEKEY ENDP
;
STREAM	PROC	NEAR
;INTERRUPTED BYTE STEAM REGISTER USED FOR
;KEY GENERATION.  INITIALIZE BOTH FSR55
;AND FSR35 BEFORE CALLING.  NEXT BYTE 
;RETURNED IN AH.
;
F1:	CALL	BYTEKEY
	MOV	BYTE PTR KEY,AH
	CALL	FSR35
	CMP	AH,0
	JE	F1
	MOV	AH,KEY
	RET
STREAM	ENDP
;
PERM	PROC	NEAR
;PERMUTATION GENERATOR.  STREAM MUST BE 
;INITIALIZED BEFORE CALLING THIS ROUTINE.
;ENTRY DATA:
;    PSIZE (W) : SIZE OF PERM BLOCK (MUST
;                BE POWER OF 2 & <=256.)
;    PLOC (W)  : ADDR OF PERM BLOCK
;    PDO  (W)  : # OF INTERCHANGES TO MAKE
;EXIT DATA:
;    PERMUTED BLOCK IN PLOC LOCATION
;
	MOV	AX,PSIZE
	SUB	AX,1
	MOV	PSIZE,AX; BIT MASK
;LOAD & SAVE FIRST BYTE
G2:	CALL	STREAM
	MOV	AL,BYTE PTR PSIZE; LOWER BYTE BIT MASK
	AND	AL,AH
	XOR	AH,AH
	MOV	SI,PLOC
	ADD	SI,AX
	MOV	AH,[SI]
	MOV	PTEMP,AH
;SAVE FIRST ADDRESS
	MOV	PADR1,SI
;GET 2ND BYTE
	CALL	STREAM
	MOV	AL,BYTE PTR PSIZE
	AND	AL,AH
	XOR	AH,AH
	MOV	SI,PLOC
	ADD	SI,AX
	MOV	DI,SI
	MOV	AH,[SI]
;SAVE 2ND BYTE
	MOV	SI,PADR1
	MOV	BYTE PTR [SI],AH
;SAVE 1ST BYTE
	MOV	AH,PTEMP
	MOV	[DI],AH
;TEST FOR FINISH
	MOV	AX,PDO
	DEC	AX
	MOV	PDO,AX
	CMP	AX,0
	JNE	G2
	RET
PERM	ENDP
;
;
GETTIME	PROC	NEAR
;THIS ROUTINE READS THE SYSTEM CLOCK AND PRINTS
;THE VALUE ON THE SCREEN.  USED FOR TIMING TESTS.
	MOV	AH,2CH
	INT	21H
	MOV	DI,OFFSET TIME+2
	MOV	AH,0
	MOV	AL,CH
	DIV	TEN
	ADD	AL,48
	MOV	[DI],AL
	INC	DI
	ADD	AH,48
	MOV	[DI],AH
	INC	DI
	INC	DI
	MOV	AH,0
	MOV	AL,CL
	DIV	TEN
	ADD	AL,48
	MOV	[DI],AL
	INC	DI
	ADD	AH,48
	MOV	[DI],AH
	INC	DI
	INC	DI
	MOV	AH,0
	MOV	AL,DH
	DIV	TEN
	ADD	AL,48
	MOV	[DI],AL
	INC	DI
	ADD	AH,48
	MOV	[DI],AH
	INC	DI
	INC	DI
	MOV	AH,0
	MOV	AL,DL
	DIV	TEN
	ADD	AL,48
	MOV	[DI],AL
	INC	DI
	ADD	AH,48
	MOV	[DI],AH
	INC	DI
	MOV	AH,'$'
	MOV	[DI],AH
	MOV	AH,9
	MOV	DX,OFFSET TIME
	INT	21H
	RET
GETTIME	ENDP
;
BINTODECI	PROC	NEAR
;CONVERT DATA IN AL INTO TWO DECIMAL ASCII DIGITS AND STORE IN AX 
		XOR	AH,AH
		DIV	TEN; REMAINDER TO AH, QUOTIENT TO AL
		ADD	AL,48; CONVERT TO ASCII DIGITS
		ADD	AH,48
		MOV	BL,AH
		MOV	AH,AL
		MOV	AL,BL
		RET
BINTODECI	ENDP						
;	
CONV16    PROC NEAR
;THIS ROUTINE CONVERTS THE CONTENTS OF AX INTO A $ TERMINATED
;ASCII STRING AT ASCII
;UPPER BYTE
          MOV  SI,OFFSET HEX
          MOV  DI,OFFSET ASCII+3
          XOR  BH,BH
          MOV  BL,AH
          AND  BL,0FH
          ADD  BX,SI
          MOV  CH,[BX]
          MOV  [DI],CH
          MOV	DI,OFFSET ASCII+2
          XOR  BH,BH
          MOV  BL,AH
          SHR  BL,1
          SHR  BL,1
          SHR  BL,1
          SHR  BL,1
          ADD  BX,SI
          MOV  CH,[BX]
          MOV  [DI],CH
          MOV	DI,OFFSET ASCII+1
;LOWER BYTE
          XOR  BH,BH
          MOV  BL,AL
          AND  BL,0FH
          ADD  BX,SI
          MOV  CH,[BX]
          MOV  [DI],CH
          MOV	DI,OFFSET ASCII
          XOR  BH,BH
          MOV  BL,AL
          SHR  BL,1
          SHR  BL,1
          SHR  BL,1
          SHR  BL,1
          ADD  BX,SI
          MOV  CH,[BX]
          MOV  [DI],CH
          RET
CONV16    ENDP
;
ERROR	PROC	NEAR
;INT 21H CALL FAILURE.  PRINT IP ADDRESS. 
	MOV	AH,9
	MOV	DX,OFFSET EMESS
	INT	21H
	POP	AX
	PUSH	AX
	CALL	CONV16
	MOV	AH,9
	MOV	DX,OFFSET ASCII
	INT	21H
	RET
ERROR	ENDP
;
;THE FOLLOWING ROUTINE READS FILES IN 32K CHUNKS AND CALLS
;A CIPHER ROUTINE.  THE CIPHERTEXT IS WRITTEN BACK INTO 
;THE SAME FILE.
;
READFILE	PROC	FAR
;FILE READ ROUTINE
;
;GET HEADER
GETNME:
;SET UP SEGMENT REGISTERS
		PUSH	DS
		XOR	AX,AX
		PUSH	AX
		MOV	AX,CS
		MOV	DS,AX
		ASSUME	DS:CODE_SEG
;PRINT TITLE
		MOV	AH,9
		MOV	DX,OFFSET TITLE1
		INT	21H
		MOV	AH,9
		MOV	DX,OFFSET TITLE2
		INT 	21H
		MOV	AH,9
		MOV	DX,OFFSET TITLE3
		INT	21H
		MOV	AH,9
		MOV	DX,OFFSET TITLE4
		INT	21H
		MOV	AH,9
		MOV	DX,OFFSET TITLE5
		INT	21H
		MOV	AH,9
		MOV	DX,OFFSET HEADER
		INT	21H
;CHECK TO SEE IF FILENAME ENTERED ON COMMAND LINE
		MOV	SI,80H
		MOV	AH,ES:[SI]
		CMP	AH,0
		JZ   WHIZ
		INC	SI
;FIND FIRST NONBLANK CHAR.
Q1:		MOV	AH,ES:[SI]
		CMP	AH,20H
		JNZ	ISITCR
		INC	SI
		JMP	Q1	
;CR?		
ISITCR:	CMP	AH,0DH
		JNZ	Q2
;CR CAME BEFORE ANY NON-BLANK CHAR.
		JMP	WHIZ
;LOAD THE FILENAME AND REPLACE 0D BY 0
Q2:		MOV	DI,OFFSET FILENAME+2
Q3:		MOV	[DI],AH
		INC	SI
		INC	DI
		MOV	AH,ES:[SI]
		CMP	AH,0DH
		JNZ	Q3
;DONE
		MOV	AH,0
		MOV	[DI],AH
		JMP	CATTRI
;GET FILENAME
WHIZ:		MOV	AH,9
		MOV	DX,OFFSET M1
		INT	21H
		MOV	AH,10
		MOV	AL,40; MAXIMUM FILE NAME LENGTH
		MOV	FILENAME,AL
		MOV	DX,OFFSET FILENAME
		INT	21H
;REPLACE CR WITH 0 BYTE
		MOV	AH,0
		MOV	AL,FILENAME+1
		MOV	BX,OFFSET FILENAME
		ADD	BX,AX
		INC	BX
		INC	BX
		MOV	BYTE PTR [BX],0
;*************PATCH TO RESET ATTRIB OF FILE TO 00H
;IN CASE OF READ ONLY FILES (PROBLEM WITH MS-WORD)
CATTRI:	MOV	AH,43H
		MOV	AL,0
		MOV	DX,OFFSET FILENAME+2
		INT	21H
		JNC	JOUEPAS
;ERROR
		MOV	AH,9
		MOV	DX,OFFSET M2
		INT	21H
		JMP	WHIZ
JOUEPAS:	CMP	CL,26H
		JZ	GETKEY
;RESET ATTRIBUTE
		MOV	CL,0
		MOV	AH,43H
		MOV	AL,1
		MOV	DX,OFFSET FILENAME+2
		INT	21H
;*************
;GET KEY
GETKEY:
;^^^^^^^BEFORE GETTING KEY GET AND PRINT TIME AND DATE DATA
;
;CHECK FOR DECIPHER
		MOV	AH,43H
		MOV	AL,00; GET ATTRIBUTE
		MOV	DX,OFFSET FILENAME+2
		INT	21H
		JNC	RAZZZ
		JMP	NOFIND
;CHECK ATTRIBUTE FOR DECIPHER
RAZZZ:		CMP	CL,26H
		JZ	DEECIPH
		MOV	AH,0
		MOV	MODE,AH
		JMP	RAZZ4
DEECIPH:	MOV	AH,1
		MOV	MODE,AH
RAZZ4:		CMP	CL,26H
		JZ	RAZZZ2
		JMP	RSTU
;DECIPHER MODE- OPEN FILE
;OPEN FILE
RAZZZ2:	MOV	DX,OFFSET FILENAME
		INC	DX
		INC	DX
		MOV	AL,2;READ/WRITE ACCESS
		MOV	AH,61
		INT	21H
;ERROR?
		JNC	PROCHY
		MOV	AH,9
		MOV	DX,OFFSET M2
		INT	21H
		JMP	GETNME
PROCHY:		MOV	HANDLE,AX
;POSITION PTR 9 BYTES IN FROM EOF 		
		MOV	AH,42H
		MOV	AL,02; SIGNED OFFSET FROM EOF
		MOV	BX,HANDLE
		MOV	CX,0FFFFH
		MOV	DX,0FFF7H; CX:DX = -9
		INT	21H
;READ TIME DATE AND HASHING DATA
		MOV	AH,3FH
		MOV	BX,HANDLE
		MOV	CX,9
		MOV	DX,OFFSET YEAR
		INT	21H
;REPOSITION PTR 9 BYTES IN FROM EOF
		MOV	AH,42H
		MOV	AL,02
		MOV	BX,HANDLE
		MOV	CX,0FFFFH
		MOV	DX,0FFF7H
		INT	21H
;truncate file to remove time date data
		mov	AH,40H
   		MOV	BX,HANDLE
		XOR	CX,CX
		MOV	DX,OFFSET YEAR
		INT	21H
;CLOSE FILE
		MOV	BX,HANDLE
		MOV	AH,3EH
		INT	21H
;PRINT DATA:
;PRINT MESSAGE
		MOV	AH,9
		MOV	DX,OFFSET M11
		INT	21H
;SETUP DATE TIME PRINT LINE IN DATETIME
;(1) WEEKDAY
		MOV	AL,WEEKDAY
		DEC	AL
		MOV	BL,5
		MUL	BL
		MOV	DI,OFFSET TIMEDATE
		MOV	SI,OFFSET DAYS
		ADD	SI,AX
		MOV	CX,5
RASCAL:		MOV	AL,[SI]
		MOV	[DI],AL
		INC	SI
		INC	DI
		LOOP	RASCAL
;(2) DAY
		MOV	AL,DAY
		CALL	BINTODECI
		MOV	TIMEDATE+5,AH
		MOV	TIMEDATE+6,AL
;(3) MONTH
		MOV	AL,MONTH
		DEC	AL
		MOV	BL,5
		MUL	BL
		MOV	DI,OFFSET TIMEDATE+7
		MOV	SI,OFFSET MONTHS
		ADD	SI,AX
		MOV	CX,5
RASCAL2:	MOV	AL,[SI]
		MOV	[DI],AL
		INC	SI
		INC	DI
		LOOP	RASCAL2
;(4) YEAR (LAST TWO DIGITS)
		MOV	AX,YEAR
		SUB	AX,1900
		CALL	BINTODECI
		MOV	TIMEDATE+12,AH
		MOV	TIMEDATE+13,AL
;(5) HOUR
		MOV	AL,HOURS
		CALL	BINTODECI
		MOV	TIMEDATE+15,AH
		MOV	TIMEDATE+16,AL
;(6) MINUTES
		MOV	AL,MINUTES
		CALL	BINTODECI
		MOV	TIMEDATE+18,AH
		MOV	TIMEDATE+19,AL
;PRINT IT
		MOV	AH,9
		MOV	DX,OFFSET TIMEDATE
		INT	21H
		JMP 	RSTU
NOFIND:		MOV	AH,9
		MOV	DX,OFFSET M2
		INT	21H
		JMP	WHIZ
;^^^^^^^END OF DATE TIME PRINTING
RSTU:		MOV	AH,9
		MOV	DX,OFFSET M6
		INT	21H
;ECHO ON IF FIRST CHAR. = CTRL-E
		MOV	AH,7
		INT	21H
		CMP	AL,05
		JZ	ECHO_ON
;DO NOT USE ECHO
		MOV	KEYIN+2,AL
		MOV	AL,50
		MOV	BYTE PTR KEYIN,AL
		MOV	AL,1
		MOV	KEYIN+1,AL
		MOV	DI,OFFSET KEYIN+3
		PUSH	DI
ROND:		MOV	AH,7
		INT	21H
		POP	DI
;KEY TOO LONG?
		MOV	AH,KEYIN+1
		INC	AH
		MOV	KEYIN+1,AH
		CMP	AH,51
		JNZ	EOL
		MOV	AH,9
		MOV	DX,OFFSET TOOLONG
		INT	21H
		JMP	GETKEY
;CR?				
EOL:		CMP	AL,0DH
		JZ	PROCESSIT
;TERMINATE ENTRY AND RETRY?
		CMP	AL,03
		JNZ	PLUS
;TERMINATE KEY ENTRY
		JMP	GETKEY
PLUS:		MOV	[DI],AL
		INC	DI
		PUSH	DI
		JMP	ROND
PROCESSIT:
;FIRST SAVE CR
		MOV	[DI],AL
;NOW PROCESS KEY
		MOV	AH,KEYIN+1
		DEC	AH
		MOV	KEYIN+1,AH
		CMP	AH,10
		JL	NOT10
;KEY TOO SHORT
		JMP	PIT2
ECHO_ON:
		MOV	AH,10
		MOV	AL,50
		MOV	KEYIN,AL
		MOV	DX,OFFSET KEYIN
		INT	21H
;FIND START AND END OF KEY
PIT2:		MOV	SI,OFFSET KEYIN+2
		XOR	AL,AL
;LOOK FOR FIRST NON-BLANK CHAR. BEFORE CR
CIVILWAR:	MOV	AH,[SI]
		CMP	AH,20H
		JNZ	CW2
;ANOTHER BLANK
		INC	SI
		JMP	CIVILWAR
CW2:		CMP	AH,0DH
		JZ	KEYERROR
;FOUND FIRST NON=BLANK CHAR.
		MOV	DI,SI
		INC	DI
		INC	AL
CW3:		MOV	AH,[DI]
		CMP	AH,0DH
		JZ	GOTIT
		INC	DI
		INC	AL
		JMP	CW3
;NO KEY ENTERED
KEYERROR:	MOV	AH,9
		MOV	DX,OFFSET M7
		INT	21H
		JMP  GETKEY
GOTIT:		MOV	CX,DI
		MOV	AX,SI
		SUB	CX,AX
		CMP	CX,10
		JGE	CW4
;KEY LESS THAN 10 CHARACTERS
NOT10:		MOV	AH,9
		MOV	DX,OFFSET M8	
		INT	21H
		JMP	GETKEY
;HASH KEY
CW4:		MOV	AL,50
		MOV	BX,30
CW5:		MOV	DI,SI
		MOV	CX,BX
CW6:		MOV	AH,[DI]
		ROL	AH,1
		INC	DI
		XOR	BYTE PTR [DI],AH


		LOOP	CW6
		MOV	AH,[DI]
		XOR	BYTE PTR [SI],AH


;TEST FOR NEXT ROUND
		DEC	AL
		JNZ	CW5	
;CALCULATE KEY CHECKSUM
		MOV	BH,3
VOTRE:	MOV	SI,OFFSET KEYIN+2
		MOV	CX,10
CSUM:	MOV	AX,[SI]
		ROL	AX,1
		XOR	CHKSUM,AX
		INC	SI
		INC	SI
		LOOP	CSUM
		ROL	CHKSUM,1
		ROL	CHKSUM,1
		ROL	CHKSUM,1
		DEC	BH
		JNZ	VOTRE
;OPEN FILE
		MOV	DX,OFFSET FILENAME
		INC	DX
		INC	DX
		MOV	AL,2;READ/WRITE ACCESS
		MOV	AH,61
		INT	21H
;ERROR?
		JNC	PROCH
		MOV	AH,9
		MOV	DX,OFFSET M2
		INT	21H
		JMP	GETNME
;GET FILE LENGTH 
PROCH:	MOV	HANDLE,AX
		MOV	BX,HANDLE
		MOV	CX,0
		MOV	DX,0
		MOV	AL,2
		MOV	AH,66
		INT	21H
		MOV	WORD PTR LEN,DX
		MOV	WORD PTR LEN+2,AX
;CALCULATE NUMBER OF 32K BLOCKS TO BE READ
		MOV	CX,8000H; 32 K
		DIV	CX
;AX HAS QUOTIENT, DX HAS REMAINDER
		CMP	DX,0
		JZ	BALIHI
		INC	AX
BALIHI:	MOV	NUMBLKS,AX; NUMBER OF BLOCKS TO BE ENCRYPTED
		MOV	WORD PTR LASTBLK,DX; SIZE OF LAST BLOCK
;
;*******************************
;CHECK FOR WEAK KEY
		XOR	AH,AH
;CHECK FSR
		MOV	SI,OFFSET KEYIN+2
		MOV	CX,7
COTTON:		OR	AH,[SI]
		INC	SI
		LOOP	COTTON
		CMP	AH,0
		JZ	WEAKKEY
;CHECK FSR3
		XOR	AH,AH
		MOV	SI,OFFSET KEYIN+9
		MOV	CX,9
COTTON2:	OR	AH,[SI]
		INC	SI
		LOOP	COTTON2
		CMP	AH,0
		JZ	WEAKKEY
;CHECK FSR2
		XOR	AH,AH
		MOV	SI,OFFSET KEYIN+18
		MOV	CX,5
COTTON3:	OR	AH,[SI]
		INC	SI
		LOOP	COTTON3
		JZ	WEAKKEY
		JMP	MORESTUFF
WEAKKEY:	MOV	AH,9
		MOV	DX,OFFSET M14
		INT	21H
		RET
;
;LOAD THE THREE SHIFT REGISTERS
MORESTUFF:	MOV	SI,OFFSET KEYIN+2
		MOV	DI,OFFSET FSR
		MOV	CX,7
GEE:		MOV	AH,[SI]
		MOV	[DI],AH
		INC	SI
		INC	DI
		LOOP	GEE
		MOV	DI,OFFSET FSR3
		MOV	CX,9
GEE2:		MOV	AH,[SI]
		MOV	[DI],AH
		INC	SI
		INC	DI
		LOOP	GEE2
		MOV	DI,OFFSET FSR2


		MOV	CX,5
GEE3:		MOV	AH,[SI]
		MOV	[DI],AH
		INC	SI
		INC	DI
		LOOP	GEE3
;LOAD THREE DISPLACEMENTS


		MOV	DI,OFFSET D1
		MOV	AH,[SI]
		MOV	[DI],AH
		INC	SI
		INC	DI
		MOV	AH,[SI]


		MOV	[DI],AH
		INC	SI
		INC	DI
		MOV	AH,[SI]
		MOV	[DI],AH
;LOAD INITIAL FEEDBACK BYTE


		INC	SI
		MOV	AH,[SI]
		MOV	FEEDBACK,AH
;
;*******************************
;
;DETERMINE MODE, DECIPHER IF  ATTRIBUTE BYTE
; IS 26H, ELSE ENCIPHER, MODE=0 FOR ENCIPHER
		MOV	AH,43H
		MOV	AL,0
		MOV	BX,CS


		MOV	DS,BX
		MOV	DX,OFFSET FILENAME+2
		INT	21H
;SET MODE
		CMP	CL,26H
		JZ	MODED
;ENCIPHER-CHANGE ATTRIBUTE FOR SAVE
		MOV	AL,0	
		JMP	SETIT
;DECIPHER- CHANGE ATTRIBUTE FOR SAVE
MODED:	
		MOV	AL,1
		MOV	MODE,AL
;CODE OMITTED, CANNOT SET ATTRIB WHILE FILE OPEN
SETIT:	
;PRINT MODE MESSAGE
		MOV	AL,0
		CMP	MODE,AL
		JZ	ZZZC
;DECIPHERING
		MOV	DX,OFFSET M4
		JMP	ZZZ1
;ENCIPHERING
ZZZC:		MOV	DX,OFFSET M3
;PRINT IT
ZZZ1:		MOV	AH,9
		INT	21H
;
;PRINT KEY CHECKSUM
		MOV	AX,CHKSUM
		CALL	CONV16
		MOV	AH,9
		MOV	DX,OFFSET M9
		INT	21H
		MOV	AH,9
		MOV	DX,OFFSET ASCII
		INT	21H
;PAUSE IF DECIPHERMENT
		MOV	AH,0
		CMP	MODE,AH
		JNZ	SUZY
		JMP	READIT
;^^^^^^^^^^^IF DECIPHERMENT, VERIFY AUTHENTICATOR
;HASH IT WITH CHECKSUM AND PLACE IN WORD AUTH
SUZY:	MOV	AX,CHKSUM
		MOV	CAUTH,AX
		MOV	CX,15
CAUTH4:
		MOV	AX,CAUTH
		ROR	AX,1
		ROR	AX,1
		ROR	AX,1
		MOV	BX,YEAR
		ADD	AX,BX
		JNC	CAUTH1
		XOR	AL,1
CAUTH1:		MOV	BH,AH
		MOV	AH,AL
		MOV	AL,BH
		ROL	AH,1
		ROL	AL,1
		MOV	BX,WORD PTR MONTH
		ADD	AX,BX
		JNC	CAUTH2
		XOR	AL,1
CAUTH2:		MOV	BH,AH
		MOV	AH,AL
		MOV	AH,BH
		ROL	AH,1
		ROL	AL,1
		MOV	BX,WORD PTR HOURS
		ADD	AX,BX
		JNC	CAUTH3
		XOR	AL,1
CAUTH3:		MOV	BH,AH
		MOV	AH,AL
		MOV	AH,BH
		ROL	AH,1
		ROL	AL,1
		LOOP	CAUTH4
		MOV	CAUTH,AX
;COMPARE CAUTH AND AUTH
		MOV	AX,AUTH
		MOV	BX,CAUTH
		XOR	AX,BX
		JZ	ITSOK
;NO VERIFY
		MOV	AH,9
		MOV	DX,OFFSET M12
		INT	21H
		JMP	SAWING
ITSOK:		MOV	AH,9
		MOV	DX,OFFSET M13
		INT	21H	
SAWING:		MOV	AH,9
		MOV	DX,OFFSET M10
		INT	21H
;READ ONE CHARACTER RESPONSE
		MOV	AH,1
		INT	21H
		OR	AL,20H
		CMP	AL,'y'
		JZ	READIT
		JMP	APPENDIT
;^^^^^^^^^^^^END OF AUTHENTICATOR CHECK
;READING OF FILE BEGINS HERE
;
;SET NUMBER OF BLOCKS ENCIPHERED TO ZERO
READIT:		MOV	AX,0
		MOV	NUMDONE,AX
;SET FILE POINTER
FINITE:		MOV	AX,NUMDONE
		MOV	DX,0
		MOV	CX,0
PROCH6:		CMP	AX,0
		JZ	PROCH4
		ADD	DX,8000H
		JNC	CORRECT
		INC	CX


CORRECT:	DEC	AX
		JMP	PROCH6
PROCH4:   
		MOV	AH,42H
		MOV	AL,0		
		MOV	BX,HANDLE
		INT	21H
		JNC	PROCH3
;ERROR	
		MOV	AH,9
		MOV	DX,OFFSET M5 
		INT	21H
		MOV	AH,3EH
		MOV	BX,HANDLE
		INT	21H
		MOV	AH,0
		INT	21H
;READ FILE
PROCH3:	MOV	AH,3FH
		MOV	BX,HANDLE
		MOV	DX,CS
		MOV	DS,DX
		MOV	DX,OFFSET TEXT
;IS THIS LAST BLOCK?
		MOV	CX,NUMBLKS
		CMP	CX,1
		JNZ	NOTLAST
;LAST BLOCK, LOAD LENGTH
		MOV	CX,LASTBLK
		JMP	PROCH2
;NOT LAST, LOAD 32K FOR LENGTH
NOTLAST:	MOV	CX,8000H
;SAVE THE LENGTH OF DATA TO BE CIPHERED 
PROCH2:	MOV	LENDATA,CX
;READ THE FILE
		INT	21H
;CLOSE FILE
		MOV	BX,HANDLE


		MOV	AH,3EH
		INT	21H
SKIPIT:
;
;****************************************
;CIPHER THE DATA HERE.  DATA BEGINS AT 'TEXT' WITH LENGTH AT LENDATA
;TRANSFER 'LENDATA' TO 'LENSAVE' AND USE LENSAVE AS COUNTER
;
;GENERATE THE KEY
		CALL	INIT
;LOAD LENSAVE 
		MOV	AX,LENDATA


		MOV	LENSAVE,AX
;INITIALIZE TEXT POINTER
		MOV	TXTPTR,OFFSET TEXT
;CHECK FOR FINISH
		CALL	GETTIME
ROULETTE:
		CMP	WORD PTR LENSAVE,0
		JZ	JURY
;CIPHER NEXT  BYTE
		MOV	SI,TXTPTR
		MOV	AL,[SI]
		MOV	CHAR,AL
		CALL	CIPHER
		MOV	AH,CHAR
		MOV	SI,TXTPTR


		MOV	[SI],AH
		INC	TXTPTR
		MOV	AX,LENSAVE
		DEC	AX
		MOV	LENSAVE,AX
		JMP	ROULETTE
;****************************************
;
;STORE THE FILE
;
;OPEN FILE
JURY:	CALL	GETTIME
	MOV	DX,OFFSET FILENAME
		INC	DX
		INC	DX
		MOV	AL,2
		MOV	AH,61
		INT	21H
		MOV	HANDLE,AX
;POSITION FILE POINTER
		MOV	AX,NUMDONE
		MOV	DX,0
		MOV	CX,0
PROCH10:	CMP	AX,0
		JZ	PROCH11
		ADD	DX,8000H
		JNC	CORRECT2
		INC	CX
CORRECT2:	DEC	AX
		JMP	PROCH10
PROCH11:	
		MOV	AH,42H
		MOV	AL,0
		MOV	BX,HANDLE
		INT	21H
;SAVE FILE
		MOV	BX,CS
		MOV	DS,BX
		MOV	AH,40H
		MOV	BX,HANDLE
		MOV	CX,LENDATA
		MOV	DX,OFFSET TEXT
		INT	21H
;CLOSE FILE
		MOV	AH,3EH
		MOV	BX,HANDLE
		INT	21H
;ADJUST PARAMETERS FOR NEXT ROUND
		MOV	AX,NUMDONE
		INC	AX
		MOV	NUMDONE,AX
		MOV	AX,NUMBLKS
		DEC	AX
		MOV	NUMBLKS,AX
		CMP	AX,0
		JZ	ENDIT
;REOPEN FILE FOR NEXT ROUND
		MOV	DX,OFFSET FILENAME
		INC	DX
		INC	DX
		MOV	AL,2
		MOV	AH,61
		INT	21H
		MOV	HANDLE,AX
		JMP	FINITE
;REWRITE FILE ATTRIBUTE
ENDIT:	MOV	AH,43H
		MOV	AL,0
		MOV	BX,CS
		MOV	DS,BX
		MOV	DX,OFFSET FILENAME+2	
		INT	21H
		CMP	CL,26H; CIPHERED FILE IF ATTRIBUTE IS 6
		JNZ	PROCH13
;CIPHERED FILE, REVERSE ATTRIBUTE
		MOV	CL,20H
		JMP	PROCH14
;PLAINTEXT FILE, CHANGE TO CIPHERED
PROCH13:	MOV	CL,26H
PROCH14:	MOV	AH,43H
		MOV	AL,1
		MOV	BX,CS
		MOV	DS,BX
		MOV	DX,OFFSET FILENAME+2
		INT	21H
;^^^^^^^^APPEND TIME AND DATE TO END OF FILE IF ENCRYPT
;
;TEST FOR ENCRYPT
		MOV	AH,MODE
		CMP	AH,0
		JZ	ORION
		JMP	ERASE
;GET DATE
ORION:	MOV	AH,2AH
		INT	21H
		MOV	YEAR,CX
		MOV	MONTH,DH
		MOV	DAY,DL
		MOV	WEEKDAY,AL
;GET TIME
		MOV	AH,2CH
		INT	21H
		MOV	HOURS,CH
		MOV	MINUTES,CL
;HASH IT WITH CHECKSUM AND PLACE IN WORD AUTH
		MOV	AX,CHKSUM
		MOV	AUTH,AX
		MOV	CX,15
AUTH4:
		MOV	AX,AUTH
		ROR	AX,1
		ROR	AX,1
		ROR	AX,1
		MOV	BX,YEAR
		ADD	AX,BX
		JNC	AUTH1
		XOR	AL,1
AUTH1:		MOV	BH,AH
		MOV	AH,AL
		MOV	AL,BH
		ROL	AH,1
		ROL	AL,1
		MOV	BX,WORD PTR MONTH
		ADD	AX,BX
		JNC	AUTH2
		XOR	AL,1
AUTH2:		MOV	BH,AH
		MOV	AH,AL
		MOV	AH,BH
		ROL	AH,1
		ROL	AL,1
		MOV	BX,WORD PTR HOURS
		ADD	AX,BX
		JNC	AUTH3
		XOR	AL,1
AUTH3:		MOV	BH,AH
		MOV	AH,AL
		MOV	AH,BH
		ROL	AH,1
		ROL	AL,1
		LOOP	AUTH4
		MOV	AUTH,AX
;ADD YEAR TO YEAR+8 TO END OF FILE
;OPEN FILE
APPENDIT:	MOV	AH,3DH
		MOV	DX,OFFSET FILENAME+2
		MOV	AL,2
		INT	21H
		MOV	HANDLE,AX
;SET FILE POINTER TO EOF
		MOV	AH,42H
		MOV	AL,02H; EOF
		MOV	BX,HANDLE
		XOR	CX,CX
		XOR	DX,DX
		INT	21H
;APPEND DATA
		MOV	AH,40H
		MOV	BX,HANDLE
		MOV	CX,9
		MOV	DX,OFFSET YEAR
		INT	21H
;CLOSE FILE
		MOV	AH,3EH
		MOV	BX,HANDLE
		INT	21H
;
;^^^^^^^^END OF APPEND
;
;ERASE DATA FROM MEMORY
ERASE:		MOV	CX,OFFSET HEX
		MOV	AX,OFFSET COUNT
		SUB	CX,AX
		MOV	BX,OFFSET COUNT
FINAL1:	MOV	[BX],AH
		INC	BX
		LOOP	FINAL1
;ERASE LAST DATA BLOCK FROM MEMORY
		MOV	CX,OFFSET ENDDATA
		MOV	AX,OFFSET TEXT
		SUB	CX,AX
		MOV	BX,OFFSET TEXT
FINAL2:	MOV	[BX],AH
		INC	BX
		LOOP	FINAL2
;END IT ALL
		RET
READFILE	ENDP
;
.STACK	100H
DATA	PROC	NEAR
TEXT:	DB	8000H DUP(0)
ENDDATA:
DATA		ENDP
CODE_SEG	ENDS
;
;
	END	READFILE
