From 2d04cacc5322951f187bb17e017c12920ac8ebe2 Mon Sep 17 00:00:00 2001 From: Mark Zbikowski Date: Thu, 25 Apr 2024 21:24:10 +0100 Subject: MZ is back! --- v4.0/src/CMD/EDLIN/EDLCMD1.ASM | 664 ++++++++++++++ v4.0/src/CMD/EDLIN/EDLCMD2.ASM | 1203 +++++++++++++++++++++++++ v4.0/src/CMD/EDLIN/EDLEQU.ASM | 156 ++++ v4.0/src/CMD/EDLIN/EDLIN.ASM | 1843 +++++++++++++++++++++++++++++++++++++++ v4.0/src/CMD/EDLIN/EDLIN.LNK | 7 + v4.0/src/CMD/EDLIN/EDLIN.SKL | 75 ++ v4.0/src/CMD/EDLIN/EDLMES.ASM | 665 ++++++++++++++ v4.0/src/CMD/EDLIN/EDLPARSE.ASM | 281 ++++++ v4.0/src/CMD/EDLIN/EDLSTDSW.INC | 32 + v4.0/src/CMD/EDLIN/MAKEFILE | 56 ++ 10 files changed, 4982 insertions(+) create mode 100644 v4.0/src/CMD/EDLIN/EDLCMD1.ASM create mode 100644 v4.0/src/CMD/EDLIN/EDLCMD2.ASM create mode 100644 v4.0/src/CMD/EDLIN/EDLEQU.ASM create mode 100644 v4.0/src/CMD/EDLIN/EDLIN.ASM create mode 100644 v4.0/src/CMD/EDLIN/EDLIN.LNK create mode 100644 v4.0/src/CMD/EDLIN/EDLIN.SKL create mode 100644 v4.0/src/CMD/EDLIN/EDLMES.ASM create mode 100644 v4.0/src/CMD/EDLIN/EDLPARSE.ASM create mode 100644 v4.0/src/CMD/EDLIN/EDLSTDSW.INC create mode 100644 v4.0/src/CMD/EDLIN/MAKEFILE (limited to 'v4.0/src/CMD/EDLIN') diff --git a/v4.0/src/CMD/EDLIN/EDLCMD1.ASM b/v4.0/src/CMD/EDLIN/EDLCMD1.ASM new file mode 100644 index 0000000..ea304f4 --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLCMD1.ASM @@ -0,0 +1,664 @@ + PAGE 60,132; + TITLE EDLCMD1.ASM + +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: EDLCMD1.SAL +; +; DESCRIPTIVE NAME: EDLIN ROUTINES +; +; FUNCTION: THIS MODULE PROVIDES ROUTINES NEEDED FOR EDLIN'S EXECUTION. +; +; ENTRY POINT: ANY CALLED ROUTINE +; +; EXIT NORMAL: NA +; +; EXIT ERROR : NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: EDLCMD2 - ROUTINES MAY BE CALLED FROM EDLCMD2 +; EDLMES - ROUTINES MAY BE CALLED FROM EDLMES +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE +; +; REVISION HISTORY: +; +; AN000 VERSION DOS 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT SYSPARSE +; - IMPLEMENT MESSAGE RETRIEVER +; - IMPLEMENT DBCS ENABLING +; - ENHANCED VIDEO SUPPORT +; - EXTENDED OPENS +; - SCROLLING ERROR +; +; COPYRIGHT: "MS DOS EDLIN UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; +;======================= END OF SPECIFICATIONS =========================== + +include edlequ.asm + +SUBTTL Contants and Data areas +PAGE + + +CODE SEGMENT PUBLIC +CODE ENDS + +CONST SEGMENT PUBLIC WORD +CONST ENDS + +cstack segment stack +cstack ends + +DATA SEGMENT PUBLIC WORD +DATA ENDS + +DG GROUP CODE,CONST,cstack,DATA + +CONST SEGMENT PUBLIC WORD + EXTRN DSKFUL_ptr:word,READ_ERR_PTR:word + EXTRN NOSUCH_ptr:word,TOOLNG_ptr:word,EOF_ptr:word + extrn txt1:byte,txt2:byte +CONST ENDS + +cstack segment stack +cstack ends + +DATA SEGMENT PUBLIC WORD + extrn ParamCt:WORD + extrn current:word,pointer:word,start:word,endtxt:word + extrn wrt_handle:word,editbuf:byte,path_name:byte,fname_len:word + extrn arg_buf:byte,arg_buf_ptr:word + extrn olddat:byte,oldlen:word,newlen:word,param1:word,param2:word + extrn srchflg:byte,srchmod:byte,comline:word,lstfnd:word,numpos:word + extrn lstnum:word,srchcnt:word,amnt_req:word,delflg:byte,lastlin:word + extrn three4th:word,one4th:word,last:word,rd_handle:word,ending:byte + extrn haveof:byte + extrn Disp_Len:Byte + +DATA ENDS + +CODE SEGMENT PUBLIC +ASSUME CS:DG,DS:DG,SS:CStack,ES:DG + + extrn findlin:near,shownum:near,loadbuf:near + extrn delbak:near,unquote:near,lf:near + extrn dispone:near,display:near,query:near + extrn quit:near,scanln:near,scaneof:near + extrn fndfirst:near,fndnext:near,replace:near,memerr:near + extrn std_printf:near,chkrange:near,comerr:near + + public xerror,bad_read,append,nocom,pager,list + public delete,replac_from_curr,search_from_curr,ewrite,wrt + +NOMOREJ:JMP NOMORE + +APPEND: + CMP ParamCt,1 + JZ AppendOK + JMP ComErr +AppendOK: + TEST BYTE PTR [HAVEOF],-1 + JNZ NOMOREJ + MOV DX,[ENDTXT] + CMP [PARAM1],0 ;See if parameter is missing + JNZ PARMAPP + CMP DX,[THREE4TH] ;See if already 3/4ths full + jb parmapp + return ;If so, then done already +PARMAPP: + MOV DI,DX + MOV CX,[LAST] + SUB CX,DX ;Amount of memory available + jnz sj53 + jmp memerr +sj53: + MOV DX,[ENDTXT] + MOV BX,[RD_HANDLE] + mov [amnt_req],cx ;Save number of chars requested + MOV AH,READ + INT 21H ;Fill memory with file data + CMP CX,AX ;Did we read less than we asked for? + JZ SJ55 +; Make sure this is an end-of-file by trying to read more + PUSH AX ;Save old byte count + ADD DX,AX ;Point to next open space in buffer + MOV CX,1 ;Just one character past EOF + MOV AH,READ + INT 21H + CMP AX,0 ;Is it EOF? + POP AX + JNZ SJ54 ;No -- we have one more character + MOV BYTE PTR [HAVEOF],1 ;Yes - set old style system call flag + JMP SHORT SJ55 +SJ54: + INC AX ;Include one more char in byte count +sj55: + MOV CX,AX ;Want byte count in CX + PUSH CX ;Save actual byte count + CALL SCANEOF + JNZ NOTEND + MOV BYTE PTR [HAVEOF],1 ;Set flag if 1AH found in file +NOTEND: + XOR DX,DX + MOV BX,[PARAM1] + OR BX,BX + JNZ COUNTLN + MOV AX,DI + ADD AX,CX ;First byte after loaded text + CMP AX,[THREE4TH] ;See if we made 3/4 full + JBE COUNTLN + MOV DI,[THREE4TH] + MOV CX,AX + SUB CX,DI ;Length remaining over 3/4 + MOV BX,1 ;Look for one more line +COUNTLN: + CALL SCANLN ;Look for BX lines + CMP [DI-1],AL ;Check for full line + JZ FULLN + CMP HavEof,1 + JNZ DoBackScan +; +; We have an incomplete line in the buffer at end of file. Fix it up to be +; pretty. +; + MOV BYTE PTR [DI],13 ; CR + MOV BYTE PTR [DI+1],10 ; LF + ADD DI,2 ; length is 2 greater + POP CX + ADD CX,2 + PUSH CX + JMP SHORT FULLN + +DoBackScan: + DEC DI + MOV CX,[LAST] + STD + REPNE SCASB ;Scan backwards for last line + CLD + INC DI + INC DI + DEC DX +FULLN: + POP CX ;Actual amount read + MOV WORD PTR [DI],1AH ;Place EOF after last line + SUB CX,DI + XCHG DI,[ENDTXT] + ADD DI,CX ;Amount of file read but not used +; Must seek for old partial line + OR DI,DI + JZ FULLN1 + PUSH DX + PUSH BX + MOV BX,[RD_HANDLE] + MOV DX,DI + NEG DX + MOV CX,-1 + MOV AL,1 + MOV AH,LSEEK + INT 21H + POP BX + POP DX + JC BAD_READ +FULLN1: + CMP BX,DX + JNZ EOFCHK + MOV BYTE PTR [HAVEOF],0 + return +NOMORE: + MOV DX,OFFSET DG:EOF_ptr + call std_printf +ret3: return + +BAD_READ: + MOV DX,OFFSET DG:READ_ERR_ptr + MOV DI,offset dg:path_name + ADD DI,[FNAME_LEN] + MOV AL,0 + STOSB + JMP XERROR + +EOFCHK: + TEST BYTE PTR [HAVEOF],-1 + JNZ NOMORE + TEST BYTE PTR [ENDING],-1 + retnz ;Suppress memory error during End + JMP MEMERR + +EWRITE: + CMP ParamCt,1 + JBE EWriteOK + JMP ComErr +EWriteOK: + MOV BX,[PARAM1] + OR BX,BX + JNZ WRT + MOV CX,[ONE4TH] + MOV DI,[ENDTXT] + SUB DI,CX ;Write everything in front of here + JBE RET3 + CMP DI,OFFSET DG:START ;See if there's anything to write + JBE RET3 + XOR DX,DX + MOV BX,1 ;Look for one more line + CALL SCANLN + JMP SHORT WRTADD +WRT: + INC BX + CALL FINDLIN +WRTADD: + CMP BYTE PTR [DELFLG],0 + JNZ WRTADD1 + PUSH DI + CALL DELBAK ;Want to delete the .BAK file + ;as soon as the first write occurs + POP DI +WRTADD1: + MOV CX,DI + MOV DX,OFFSET DG:START + SUB CX,DX ;Amount to write + retz + MOV BX,[WRT_HANDLE] + MOV AH,WRITE + INT 21H + JC WRTERR + CMP AX,CX ; MZ correct full disk detection + JNZ WRTERR ; MZ correct full disk detection + MOV SI,DI + MOV DI,OFFSET DG:START + MOV [POINTER],DI + MOV CX,[ENDTXT] + SUB CX,SI + INC CX ;Amount of text remaining + CLD + REP MOVSB + DEC DI ;Point to EOF + MOV [ENDTXT],DI + MOV [CURRENT],1 + return + +WRTERR: + MOV BX,[WRT_HANDLE] + MOV AH,CLOSE + INT 21H + MOV DX,OFFSET DG:DSKFUL_ptr +xERROR: + push cs + pop ds + call std_printf + mov al,0ffh + mov ah,exit + int 21h + +NOTFNDJ:JMP NOTFND + +replac_from_curr: + CMP ParamCt,2 + JBE Replace1 + JMP ComErr +Replace1: + mov byte ptr [srchmod],1 ;search from curr+1 line + jmp short sj6 + +REPLAC: + mov byte ptr [srchmod],0 ;search from beg of buffer +sj6: + MOV BYTE PTR [SRCHFLG],0 + CALL FNDFIRST + JNZ NOTFNDJ +REPLP: + MOV SI,[NUMPOS] + CALL LOADBUF ;Count length of line + SUB DX,[OLDLEN] + MOV CX,[NEWLEN] + ADD DX,CX ;Length of new line + CMP DX,254 + jbe len_ok + Jmp TOOLONG +len_ok: + MOV BX,[LSTNUM] + PUSH DX + CALL SHOWNUM + POP DX + MOV CX,[LSTFND] + MOV SI,[NUMPOS] + SUB CX,SI ;Get no. of char on line before change + DEC CX + mov di,offset dg:arg_buf ;Initialize the output string buffer + CALL OUTCNT ;Output first part of line + PUSH SI + MOV SI,1+ OFFSET DG:TXT2 + MOV CX,[NEWLEN] + CALL OUTCNT ;Output change + POP SI + ADD SI,[OLDLEN] ;Skip over old stuff in line + MOV CX,DX ;DX=no. of char left in line + ADD CX,2 ;Include CR/LF + CALL OUTCNT ;Output last part of line + xor al,al + stosb + mov dx,offset dg:arg_buf_ptr + call std_printf + CALL QUERY ;Check if change OK + JNZ REPNXT + CALL PUTCURS + MOV DI,[LSTFND] + DEC DI + MOV SI,1+ OFFSET DG:TXT2 + MOV DX,[OLDLEN] + MOV CX,[NEWLEN] + DEC CX + ADD [LSTFND],CX ;Bump pointer beyond new text + INC CX + DEC DX + SUB [SRCHCNT],DX ;Old text will not be searched + JAE SOMELEFT + MOV [SRCHCNT],0 +SOMELEFT: + INC DX + CALL REPLACE +REPNXT: + CALL FNDNEXT + retnz + JMP REPLP + +OUTCNT: + JCXZ RET8 +OUTLP: + LODSB + stosb + DEC DX + LOOP OUTLP +RET8: return + +TOOLONG: + MOV DX,OFFSET DG:TOOLNG_ptr + JMP SHORT PERR + +search_from_curr: + CMP ParamCt,2 + JBE Search1 + JMP ComErr +Search1: + mov byte ptr [srchmod],1 ;search from curr+1 line + jmp short sj7 + +SEARCH: + mov byte ptr [srchmod],0 ;search from beg of buffer +sj7: + MOV BYTE PTR [SRCHFLG],1 + CALL FNDFIRST + JNZ NOTFND +SRCH: + MOV BX,[LSTNUM] + MOV SI,[NUMPOS] + CALL DISPONE + MOV DI,[LSTFND] + MOV CX,[SRCHCNT] + MOV AL,10 + CLD + REPNE SCASB + JNZ NOTFND + MOV [LSTFND],DI + MOV [NUMPOS],DI + MOV [SRCHCNT],CX + INC [LSTNUM] + CALL QUERY + JZ PUTCURS1 + CALL FNDNEXT + JZ SRCH +NOTFND: + MOV DX,OFFSET DG:NOSUCH_ptr +PERR: + call std_printf + return + +; +; Replace enters here with LSTNUM pointing to the correct line. +; +PUTCURS: + MOV BX,[LSTNUM] + jmp short putcursor +; +; Search enters here with LSTNUM pointing AFTER the correct line +; +putcurs1: + MOV BX,[LSTNUM] + DEC BX ;Current <= Last matched line + +putcursor: + CALL FINDLIN + MOV [CURRENT],DX + MOV [POINTER],DI + return + +; +; n,mD deletes a range of lines. Allowable values for n are: +; 1 ... LAST. Allowable values for m are: +; 1 ... LAST. +; nD deletes a single line +; D deletes the current line +; +DELETE: + CMP ParamCt,2 ; at most two parameters specified. + JA ComErrJ + MOV BX,Param1 + OR BX,BX ; default first arg? + JNZ DelParm2 + MOV BX,Current ; use current as default + MOV Param1,BX +DelParm2: + MOV BX,Param2 ; did we default second arg? + OR BX,BX + JNZ DelCheck ; no, use it. + MOV BX,Param1 ; use param1 as default + MOV Param2,BX +DelCheck: + MOV BX,Param1 + CALL ChkRange ; returns by itself if bad range +; +; BX is first line of range to be deleted. Param2 is last line in range to +; be deleted. Get pointer to beginning of block. Save location +; + CALL FINDLIN ; Grab line + retnz ; If not found => return + PUSH BX + PUSH DI +; +; Get pointer past end of block (Param2+1). +; + MOV BX,Param2 + INC BX + CALL FINDLIN +; +; Set up pointers. Compute number of chars to move. +; + MOV SI,DI ; move from second line+1 + POP DI ; restore destination (first line) + POP Current ; Current line is first param + MOV Pointer,DI ; internal current line + MOV CX,EndTxt ; compute count + SUB CX,SI + JB ComErrJ ; should never occur: ChkRange + INC CX ; remember ^Z at end + CLD + REP MOVSB ; move data + DEC DI + MOV EndTxt,DI ; reset end pointer + return + +COMERRJ: + JMP COMERR + +PAGER: + CMP ParamCt,2 + JA ComErrJ + xor bx,bx ;get last line in the buffer + call findlin + mov [lastlin],dx + + mov bx,[param1] + or bx,bx ;was it specified? + jnz frstok ;yes, use it + mov bx,[current] + cmp bx,1 ;if current line =1 start from there + je frstok + inc bx ;start from current+1 line +frstok: + cmp bx,[lastlin] ;check that we are in the buffer + jbe frstok1 + return ;if not just quit +frstok1: + mov dx,[param2] + or dx,dx ;was param2 specified? + jnz scndok ;yes,.... + mov dx,bx ;no, take the end line to be the + ; start line + length of active display + +;========================================================================= +; This modification is to provide support for screens larger than +; 24 lines. +; +; Date : 6/10/87 +;========================================================================= + + push ax ;an000;save affected registers + + mov ah,00h ;an000;zero out high byte + mov al,dg:disp_len ;an000;set ax to active display length + sub ax,2 ;an000;adjust for length of screen & current + ; line + add dx,ax ;an000;this gives us the last line to be + ; printed + pop ax ;an000;restore affected registers + +;========================================================================= + +scndok: + inc dx + cmp dx,[lastlin] ;check that we are in the buffer + jbe infile + mov dx,[lastlin] ;we are not, take the last line as end +infile: + cmp dx,bx ;is param1 < param2 ? + retz + ja sj33 + jmp comerr ;yes, no backwards listing, print error +sj33: + push dx ;save the end line + push bx ;save start line + mov bx,dx ;set the current line + dec bx + call findlin + mov [pointer],di + mov [current],dx + pop bx ;restore start line + call findlin ;get pointer to start line + mov si,di ;save pointer + pop di ;get end line + sub di,bx ;number of lines + jmp short display_lines + + +LIST: + CMP ParamCt,2 + JBE ListOK + JMP ComERR +ListOK: + MOV BX,[PARAM1] + OR BX,BX + JNZ CHKP2 + MOV BX,[CURRENT] + SUB BX,11 + JA CHKP2 + MOV BX,1 +CHKP2: + CALL FINDLIN + retnz + MOV SI,DI + MOV DI,[PARAM2] + INC DI + SUB DI,BX + JA DISPLAY_lines + +;========================================================================= +; This modification is to provide support for screens larger than +; 24 lines. +; +; Date : 6/10/87 +;========================================================================= + + push ax ;an000;save affected registers + + mov ah,00h ;an000;zero out high byte + mov al,dg:disp_len ;an000;set ax to active display length dec ax ;an000;allow room at bottom for + ; messages + mov di,ax ;an000;number of lines to print an + ; entire screen less 1. + pop ax ;an000;restore affected registers + +;========================================================================= + +display_lines: + call DISPLAY + return + +Break + +; +; NOCOM is called when there is a single line being edited. This occurs when +; the command letter is CR or is ;. +; +NOCOM: + CMP ParamCt,2 + JB NoComOK + JMP ComErr +NoComOK: + DEC [COMLINE] + MOV BX,[PARAM1] + OR BX,BX + JNZ HAVLIN + MOV BX,[CURRENT] + INC BX ;Default is current line plus one + CALL CHKRANGE +HAVLIN: + CALL FINDLIN + MOV SI,DI + MOV [CURRENT],DX + MOV [POINTER],SI + jz sj12 +ret12: return +sj12: + CMP SI,[ENDTXT] + retz + CALL LOADBUF + MOV [OLDLEN],DX + MOV SI,[POINTER] + CALL DISPONE + CALL SHOWNUM + MOV AH,STD_CON_STRING_INPUT ;Get input buffer + MOV DX,OFFSET DG:EDITBUF + INT 21H + CALL lf + MOV CL,[EDITBUF+1] + MOV CH,0 + JCXZ RET12 + MOV DX,[OLDLEN] + MOV SI,2 + OFFSET DG:EDITBUF +;----------------------------------------------------------------------- + call unquote ;scan for quote chars if any +;----------------------------------------------------------------------- + mov cl,[EditBuf+1] ;an000; dms;get new line length + mov ch,0 ;an000; dms;clear high byte + MOV DI,[POINTER] + JMP Replace ; MZ 11/30 + +CODE ENDS + END + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLCMD2.ASM b/v4.0/src/CMD/EDLIN/EDLCMD2.ASM new file mode 100644 index 0000000..decc228 --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLCMD2.ASM @@ -0,0 +1,1203 @@ + PAGE 60,132 +TITLE Edlcmd2 - PART2 procedures called from EDLIN + + +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: EDLCMD2.SAL +; +; DESCRIPTIVE NAME: EDLIN ROUTINES +; +; FUNCTION: THIS MODULE PROVIDES ROUTINES NEEDED FOR EDLIN'S EXECUTION. +; +; ENTRY POINT: ANY CALLED ROUTINE +; +; EXIT NORMAL: NA +; +; EXIT ERROR : NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: EDLCMD1 - ROUTINES MAY BE CALLED FROM EDLCMD1 +; EDLMES - ROUTINES MAY BE CALLED FROM EDLMES +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE +; +; +; REVISION HISTORY: +; +; AN000 VERSION DOS 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT SYSPARSE +; - IMPLEMENT MESSAGE RETRIEVER +; - IMPLEMENT DBCS ENABLING +; - ENHANCED VIDEO SUPPORT +; - EXTENDED OPENS +; - SCROLLING ERROR +; +; COPYRIGHT: "MS DOS EDLIN UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; +;======================= END OF SPECIFICATIONS =========================== + +include edlequ.asm + +CODE SEGMENT PUBLIC +CODE ENDS + +CONST SEGMENT PUBLIC WORD +CONST ENDS + +cstack segment stack +cstack ends + +DATA SEGMENT PUBLIC WORD +DATA ENDS + + +DG GROUP CODE,CONST,cstack,DATA + +CONST SEGMENT PUBLIC WORD + extrn crlf_ptr:byte,lf_ptr:byte,qmes_ptr:byte,ask_ptr:byte + extrn bak:byte,$$$file:byte,delflg:byte,loadmod:byte,txt1:byte + extrn txt2:byte,memful_ptr:word,YES_BYTE:BYTE + + extrn Del_Bak_Ptr:byte ;an000;dms; + extrn cont_ptr:byte ;an000;dms:6/10/87 + +CONST ENDS + +DATA SEGMENT PUBLIC WORD + extrn ParamCt:WORD + extrn current:word,pointer:word,start:word,endtxt:word + extrn wrt_handle:word,editbuf:byte,ext_ptr:word,qflg:byte + extrn temp_path:byte,line_num:word,line_flag:byte + extrn line_num_buf_ptr:byte,arg_buf:byte,arg_buf_ptr:word + extrn olddat:byte,oldlen:word,newlen:word,param1:word,param2:word + extrn srchflg:byte,srchmod:byte,comline:word,lstfnd:word,numpos:word + extrn lstnum:word,last:word,srchcnt:word,amnt_req:word + + extrn lc_adj:byte ;an000;dms:6/10/87 + extrn continue:byte ;an000;dms:6/10/87 + extrn pg_count:byte ;an000;dms:6/10/87 + extrn Disp_Len:byte ;an000;dms; + extrn Disp_Width:byte ;an000;dms; + extrn lc_flag:byte ;an000;dms:6/10/87 + + if kanji + extrn lbtbl:dword + endif + +DATA ENDS + +CODE SEGMENT PUBLIC + +ASSUME CS:DG,DS:DG,SS:CStack,ES:DG + + public findlin,shownum,loadbuf,crlf,lf,abortcom,unquote + public kill_bl,make_caps,display,dispone,make_cntrl + public query,quit,scanln,delbak,scaneof,memerr + public fndfirst,fndnext,replace + if kanji + public testkanj + endif + extrn std_printf:near,command:near,chkrange:near,ComErr:NEAR + extrn Xerror:near + + +FINDLIN: + +; Inputs +; BX = Line number to be located in buffer (0 means last line+1) +; Outputs: +; DX = Actual line found +; DI = Pointer to start of line DX +; Zero set if BX = DX (if specified line found) +; AL,CX destroyed. No other registers affected. + + MOV DX,[CURRENT] + MOV DI,[POINTER] + CMP BX,DX ; fast find. Current = requested + retz + JA FINDIT ; start scanning at current? + OR BX,BX ; special case of EOF? + JZ FINDIT ; yes + MOV DX,1 ; set up for scan at beginning + MOV DI,OFFSET DG:START + CMP BX,DX ; at beginning? + retz +FINDIT: + MOV CX,[ENDTXT] ; count of bytes in buffer + SUB CX,DI ; for scan +SCANLN: + MOV AL,10 ; LF is what we look for. + OR AL,AL ; Clear zero flag for JCXZ +FINLIN: + JCXZ RET4 ; at end? Yes, no skip. + REPNE SCASB ; find EOL + INC DX ; increment count + CMP BX,DX ; find correct line? + JNZ FINLIN ; no, try again. +RET4: return + +; Inputs: +; BX = Line number to be displayed +; Function: +; Displays line number on terminal in 8-character +; format, suppressing leading zeros. +; AX, CX, DX destroyed. No other registers affected. + +SHOWNUM: + mov dx,offset dg:line_num_buf_ptr + mov line_num,bx + MOV line_flag,"*" + CMP BX,[CURRENT] + JZ STARLIN + MOV line_flag," " +STARLIN: + call std_printf +ret5: return + + +DISPONE: + MOV DI,1 + +DISPLAY: + +; Inputs: +; BX = Line number +; SI = Pointer to text buffer +; DI = No. of lines +; Function: +; Ouputs specified no. of line to terminal, each +; with leading line number. +; Outputs: +; BX = Last line output. +; All registers destroyed. + + MOV CX,[ENDTXT] + SUB CX,SI + retz ; no lines to display +;========================================================================= +; Initialize screen size and line counts for use by display. +; +; Date : 6/10/87 +;========================================================================= + + push ax ;an000;save affected regs + + mov al,dg:disp_len ;an000;length of video display + mov pg_count,al ;an000;init. screen size ctr. + + pop ax ;an000;restore affected regs + +;========================================================================= + + mov dx,di ;number of lines to print +; +; CX is the number of bytes in the buffer +; dx is the number of lines to be output +; +DISPLN: + SaveReg + CALL SHOWNUM + RestoreReg + mov di,offset dg:arg_buf +; +; Copy chars until CR/LF or end of line hit +; +OUTLN: + LODSB + CMP DI,254+offset dg:arg_buf ; are we at end of buffer? + JAE StoreDone ; Yes, do NOT store + CMP AL," " + JAE SEND + CMP AL,10 + JZ SEND + CMP AL,13 + JZ SEND + CMP AL,9 + JZ SEND + MOV AH,"^" + OR AL,40h + XCHG AL,AH + STOSW + JMP StoreDone +SEND: + stosb +StoreDone: + CMP AL,10 ; perform copy until LF is seen + LOOPNZ OUTLN +; +; Make sure buffer ends with CRLF +; + cmp byte ptr [di-1],10 + jz Terminate +; +; No LF seen. See if CR +; + cmp byte ptr [di-1],CR + jz StoreLF + mov al,CR + stosb +StoreLF: + mov al,10 + stosb +Terminate: + mov byte ptr [di],0 + + call EDLIN_DISP_COUNT ;an000;determine lines printed + ; DMS:6/10/87 + push dx + mov dx,offset dg:arg_buf_ptr + call std_printf + pop dx + JCXZ ret7 + INC BX + + call EDLIN_PG_COUNT ;an000;adjust screen line count + ; DMS:6/10/87 + cmp lc_flag,false ;an000;continue DISPLAY? + ; DMS:6/10/87 + JNZ DISPLN + DEC BX +ret7: return + +FNDFIRST: + MOV DI,1+OFFSET DG:TXT1 + mov byte ptr[olddat],1 ;replace with old value if none new + CALL GETTEXT + OR AL,AL ;Reset zero flag in case CX is zero + JCXZ RET7 + cmp al,1ah ;terminated with a ^Z ? + jne sj8 + mov byte ptr[olddat],0 ;do not replace with old value +sj8: + MOV [OLDLEN],CX + XOR CX,CX + CMP AL,0DH + JZ SETBUF + CMP BYTE PTR [SRCHFLG],0 + JZ NXTBUF +SETBUF: + DEC SI +NXTBUF: + MOV [COMLINE],SI + MOV DI,1+OFFSET DG:TXT2 + CALL GETTEXT + CMP BYTE PTR [SRCHFLG],0 + JNZ NOTREPL + CMP AL,0DH + JNZ HAVCHR + DEC SI +HAVCHR: + MOV [COMLINE],SI +NOTREPL: + MOV [NEWLEN],CX + MOV BX,[PARAM1] + OR BX,BX + JNZ CALLER + cmp byte ptr[srchmod],0 + jne sj9 + mov bx,1 ;start from line number 1 + jmp short sj9a +sj9: + MOV BX,[CURRENT] + INC BX ;Default search and replace to current+1 +sj9a: + CALL CHKRANGE +CALLER: + CALL FINDLIN + MOV [LSTFND],DI + MOV [NUMPOS],DI + MOV [LSTNUM],DX + MOV BX,[PARAM2] + CMP BX,1 + SBB BX,-1 ;Decrement everything except zero + CALL FINDLIN + MOV CX,DI + SUB CX,[LSTFND] + OR AL,-1 + JCXZ aret + CMP CX,[OLDLEN] + jae sj10 +aret: return +sj10: + MOV [SRCHCNT],CX + +FNDNEXT: + +; Inputs: +; [TXT1+1] has string to search for +; [OLDLEN] has length of the string +; [LSTFND] has starting position of search in text buffer +; [LSTNUM] has line number which has [LSTFND] +; [SRCHCNT] has length to be searched +; [NUMPOS] has beginning of line which has [LSTFND] +; Outputs: +; Zero flag set if match found +; [LSTFND],[LSTNUM],[SRCHCNT] updated for continuing the search +; [NUMPOS] has beginning of line in which match was made + + MOV AL,[TXT1+1] + MOV CX,[SRCHCNT] + MOV DI,[LSTFND] +SCAN: + OR DI,DI ;Clear zero flag in case CX=0 + REPNE SCASB ;look for first byte of string + + retnz ;return if you don't find +if kanji + call kanji_check ;see if the found byte is on a character boundary + jnz scan +endif + MOV DX,CX + MOV BX,DI ;Save search position + MOV CX,[OLDLEN] + DEC CX + MOV SI,2 + OFFSET DG:TXT1 + CMP AL,AL ;Set zero flag in case CX=0 + REPE CMPSB + MOV CX,DX + MOV DI,BX + JNZ SCAN + MOV [SRCHCNT],CX + MOV CX,DI + MOV [LSTFND],DI + MOV DI,[NUMPOS] + SUB CX,DI + MOV AL,10 + MOV DX,[LSTNUM] +;Determine line number of match +GETLIN: + INC DX + MOV BX,DI + REPNE SCASB + JZ GETLIN + DEC DX + MOV [LSTNUM],DX + MOV [NUMPOS],BX + XOR AL,AL + return + +if kanji + +;Kanji_check idea is to scan backwards to the first +; character which can't be a kanji or part of one +; (.lt. 40h) then scan forward to see if the +; current byte is on character boundary +; +;Output ZR <==> we're on a character boundary +; NZ <==> we're not on character boundary i.e. No Match +kanji_check: + push ax ;save search character + push di + dec di ;point to the character we found + mov si,di ;start searching bakwards from there + std +srch_loop: + lodsb + cmp al,40H + jae srch_loop + inc si ;point to first non-kanji + cld ;forward search +kan_loop: + cmp si,di ;are we at current byte? + jae passed_char ;if we are, or are passed it, exit + call next_char ;otherwise advance si to next char + jmp short kan_loop ;and loop +passed_char: + pop di + pop ax + ret + +;Next_char si points to a character boundary +; advance si to point to the beginning of the next char +; +; +next_char: + push ax + lodsb + call testkanj + jz not_kanj + inc si +not_kanj: + pop ax + ret + +;--------------------------------------------------------------------; +; TESTKANJ ~ FIND OUT IS THE BYTE IS A KANJI PREFIX ; +; ; +; entry: AL byte to test ; +; ; +; exit: NZ if lead byte ortherwise ZR ; +; ; +; modifies: AX ; +; ; +;--------------------------------------------------------------------; + +testkanj: + push ax + xchg ah,al ;put byte in ah + push ds + push si + lds si,cs:[lbtbl] ;get pointer to lead byte table +ktlop: + lodsb ;direction flag should be OK + or al,al ;are we at the end of table? + jz notlead ;brif so + cmp al,ah ;is START RANGE > CHARACTER? + ja notlead ;brif so, not a lead character (carry clear) + lodsb ;get second range byte + cmp ah,al ;is CHARACTER > END RANGE + ja ktlop ;brif so, not a lead character (check next range) + or al,al ;make NZ +notl_exit: + pop si + pop ds + pop ax + ret +notlead: + cmp al,al + jmp notl_exit + +endif + +GETTEXT: + +; Inputs: +; SI points into command line buffer +; DI points to result buffer +; Function: +; Moves [SI] to [DI] until ctrl-Z (1AH) or +; RETURN (0DH) is found. Termination char not moved. +; Outputs: +; AL = Termination character +; CX = No of characters moved. +; SI points one past termination character +; DI points to next free location + + XOR CX,CX + +GETIT: + LODSB +;----------------------------------------------------------------------- + cmp al,quote_char ;a quote character? + jne sj101 ;no, skip.... + lodsb ;yes, get quoted character + call make_cntrl + jmp short sj102 +;----------------------------------------------------------------------- +sj101: + CMP AL,1AH + JZ DEFCHK +sj102: + CMP AL,0DH + JZ DEFCHK + STOSB + INC CX + JMP SHORT GETIT + +DEFCHK: + OR CX,CX + JZ OLDTXT + PUSH DI + SUB DI,CX + MOV BYTE PTR [DI-1],cl + POP DI + return + +OLDTXT: + cmp byte ptr[olddat],1 ;replace with old text? + je sj11 ;yes... + mov byte ptr[di-1],cl ;zero text buffer char count + return + +sj11: + MOV CL,BYTE PTR [DI-1] + ADD DI,CX + return + +REPLACE: + +; Inputs: +; CX = Length of new text +; DX = Length of original text +; SI = Pointer to new text +; DI = Pointer to old text in buffer +; Function: +; New text replaces old text in buffer and buffer +; size is adjusted. CX or DX may be zero. +; CX, SI, DI all destroyed. No other registers affected. + + CMP CX,DX + JZ COPYIN + PUSH SI + PUSH DI + PUSH CX + MOV SI,DI + ADD SI,DX + ADD DI,CX + MOV AX,[ENDTXT] + SUB AX,DX + ADD AX,CX + CMP AX,[LAST] + JAE MEMERR + XCHG AX,[ENDTXT] + MOV CX,AX + SUB CX,SI + CMP SI,DI + JA DOMOV + ADD SI,CX + ADD DI,CX + STD +DOMOV: + INC CX + + REP MOVSB + CLD + POP CX + POP DI + POP SI +COPYIN: + REP MOVSB + return + +MEMERR: + MOV DX,OFFSET DG:MEMFUL_ptr + call std_printf + JMP COMMAND + + +LOADBUF: + MOV DI,2 + OFFSET DG:EDITBUF + MOV CX,255 + MOV DX,-1 +LOADLP: + LODSB + STOSB + INC DX + CMP AL,13 + LOOPNZ LOADLP + MOV [EDITBUF+1],DL + retz +TRUNCLP: + LODSB + INC DX + CMP AL,13 + JNZ TRUNCLP + DEC DI + STOSB + return + +SCANEOF: + cmp [loadmod],0 + je sj52 + +;----- Load till physical end of file + + cmp cx,word ptr[amnt_req] + jb sj51 + xor al,al + inc al ;reset zero flag + return +sj51: + jcxz sj51b + push di ;get rid of any ^Z at the end of the file + add di,cx + dec di ;points to last char + cmp byte ptr [di],1ah + pop di + jne sj51b + dec cx +sj51b: + xor al,al ;set zero flag + call check_end ;check that we have a CRLF pair at the end + return + +;----- Load till first ^Z is found + +sj52: + PUSH DI + PUSH CX + MOV AL,1AH + or cx,cx + jz not_found ;skip with zero flag set + REPNE SCASB ;Scan for end of file mark + jnz not_found + LAHF ;Save flags momentarily + inc cx ;include the ^Z + SAHF ;Restore flags +not_found: + mov di,cx ;not found at the end + POP CX + LAHF ;Save flags momentarily + SUB CX,DI ;Reduce byte count if EOF found + SAHF ;Restore flags + POP DI + call check_end ;check that we have a CRLF pair at the end + + return + + +;----------------------------------------------------------------------- +; If the end of file was found, then check that the last character +; in the file is a LF. If not put a CRLF pair in. + +check_end: + jnz not_end ;end was not reached + pushf ;save return flag + push di ;save pointer to buffer + add di,cx ;points to one past end on text + dec di ;points to last character + cmp di,offset dg:start + je check_no + cmp byte ptr[di],0ah ;is a LF the last character? + je check_done ;yes, exit +check_no: + mov byte ptr[di+1],0dh ;no, put a CR + inc cx ;one more char in text + mov byte ptr[di+2],0ah ;put a LF + inc cx ;another character at the end +check_done: + pop di + popf +not_end: + return + +CRLF: + push dx + mov dx,offset dg:crlf_ptr + call std_printf + pop dx + return +LF: + MOV dx,offset dg:lf_ptr + call std_printf + return + +ABORTCOM: + MOV AX,CS + MOV DS,AX + MOV ES,AX + MOV AX,cstack + MOV SS,AX + MOV SP,STACK + STI + CALL CRLF + JMP COMMAND + +DELBAK: + ;Delete old backup file (.BAK) + + MOV BYTE PTR [DELFLG],1 + MOV DI,[EXT_PTR] + MOV SI,OFFSET DG:BAK + MOVSW + MOVSW + MOVSB + MOV AH,UNLINK + MOV DX,OFFSET DG:TEMP_PATH + INT 21H +; $if c ;error ? ;an000; dms; + JNC $$IF1 + cmp ax,Access_Denied ;file read only? ;an000; dms; +; $if e ;yes ;an000; dms; + JNE $$IF2 + mov bx,[Wrt_Handle] ;close .$$$ file ;an000; dms; + mov ah,Close ;close function ;an000; dms; + int 21h ;close it ;an000; dms; + + mov di,[Ext_Ptr] ;point to extension ;an000; dms; + mov si,offset dg:$$$File ;point to .$$$ extension;an000; dms; + movsw ;get .$$$ extension ;an000; dms; + movsw ; ;an000; dms; + movsb ; ;an000; dms; + mov dx,offset dg:Temp_Path ;point to .$$$ file ;an000; dms; + mov ah,Unlink ;delete it ;an000; dms; + int 21h ; ;an000; dms; + + mov di,[Ext_Ptr] ;point to extension ;an000; dms; + mov si,offset dg:BAK ;point to .BAK extension;an000; dms; + movsw ;get .BAK extension ;an000; dms; + movsw ; ;an000; dms; + movsb ; ;an000; dms; + mov dx,offset dg:Del_Bak_Ptr;point to error message ;an000; dms; + jmp Xerror ;display message & exit ;an000; dms; +; $endif +$$IF2: +; $endif +$$IF1: + + MOV DI,[EXT_PTR] + MOV SI,OFFSET DG:$$$FILE + MOVSW + MOVSW + MOVSB + return + + +;-----------------------------------------------------------------------; +; Will scan buffer given pointed to by SI and get rid of quote +;characters, compressing the line and adjusting the length at the +;begining of the line. +; Preserves al registers except flags and AX . + +unquote: + push cx + push di + push si + mov di,si + mov cl,[si-1] ;length of buffer + xor ch,ch + mov al,quote_char + cld +unq_loop: + jcxz unq_done ;no more chars in the buffer, exit + repnz scasb ;search for quote character + jnz unq_done ;none found, exit + push cx ;save chars left in buffer + push di ;save pointer to quoted character + push ax ;save quote character + mov al,byte ptr[di] ;get quoted character + call make_cntrl + mov byte ptr[di],al + pop ax ;restore quote character + mov si,di + dec di ;points to the quote character + inc cx ;include the carriage return also + rep movsb ;compact line + pop di ;now points to after quoted character + pop cx + jcxz sj13 ;if quote char was last of line do not adjust + dec cx ;one less char left in the buffer +sj13: pop si + dec byte ptr[si-1] ;one less character in total buffer count also + push si + jmp short unq_loop + +unq_done: + pop si + pop di + pop cx + return + + +;-----------------------------------------------------------------------; +; Convert the character in AL to the corresponding control +; character. AL has to be between @ and _ to be converted. That is, +; it has to be a capital letter. All other letters are left unchanged. + +make_cntrl: + push ax + and ax,11100000b + cmp ax,01000000b + pop ax + jne sj14 + and ax,00011111b +sj14: + return + + +;---- Kill spaces in buffer --------------------------------------------; +;========================================================================= +; kill_bl : Parses over spaces in a buffer. +; +; Date : 6/10/86 +;========================================================================= +kill_bl: + + push bx ;an000;save affected reg. +kill_bl_cont: + + lodsb ;get rid of blanks + cmp al,9 + je kill_bl_cont ;an000;it is a tab + + cmp al,10 + je kill_bl_cont ;an000;if LF + + cmp al,' ' + je kill_bl_cont ;an000;we have a space + + if kanji ;an000;is this a kanji assembly + call testkanj ;an000;do we have a dbcs lead byte +; $if nz ;an000;yes, we have a lead byte + JZ $$IF5 + cmp al,dbcs_lead_byte;an000;is it 81h +; $if z ;an000;it is 81h + JNZ $$IF6 + mov bl,ds:[si] ;an000;set up for compare + cmp bl,asian_blk;an000;is it 40h +; $if z ;an000;we have an asian blank + JNZ $$IF7 + lodsb ;an000;skip byte containing 81h + jmp kill_bl_cont +; $endif ;an000; +$$IF7: +; $endif ;an000;fall through no delim +$$IF6: + ; found +; $endif ;an000;end test for dbcs lead byte +$$IF5: + endif ;an000;end conditional assembly + + pop bx ;an000;restore affected reg. + return + +;----- Capitalize the character in AL ----------------------------------; +; ; +; Input: ; +; ; +; AL contains a character to capitalize ; +; ; +; Output: ; +; ; +; AL contains a capitalized character ; +; ; +;-----------------------------------------------------------------------; + +MAKE_CAPS: + CMP AL,"a" + JB CAPS1 + CMP AL,"z" +if KANJI + JA CAPS1 ; M003 MSKK TAR 476, kana chars +else + JG CAPS1 +endif + AND AL,0DFH +CAPS1: + return + +QUIT: + CMP ParamCt,1 + JZ Quit1 +CERR: JMP ComErr +Quit1: CMP Param1,0 + JNZ CERR + MOV DX,OFFSET DG:QMES_ptr + call std_printf + +IF KANJI + CALL TESTKANJ + JZ ASCII + MOV AX, (STD_CON_INPUT_FLUSH SHL 8) + 0 + INT 21H ; Eat the trailing byte. + JMP CRLF +ASCII: +ENDIF +;========================================================================= +; We are invoking the VAL_YN proc here. This will replace the +; method of Y/N validation used prior to DOS 4.00. +; +; Date : 6/10/87 +;========================================================================= + + call val_yn ;an000;pass Y/N byte in AL to macro + cmp ax,yes ;an000;did we return a Y + jz NoCRLF ;an000; dms; close the file + cmp ax,no ;an000; dms; return N? +; $if ne ;an000; dms; neither N or Y - reprompt + JE $$IF11 + push dx ;an000; dms; must be N + mov dx,offset dg:crlf_ptr ;an000; dms; spit out CRLF + call std_printf ;an000; dms; and return + pop dx ;an000; dms; to caller + jmp Quit1 ;an000; dms; reprompt +; $endif ;an000; dms; +$$IF11: + push dx ;an000; dms; must be N + mov dx,offset dg:crlf_ptr ;an000; dms; spit out CRLF + call std_printf ;an000; dms; and return + pop dx ;an000; dms; to caller + return ;an000; dms; + +;========================================================================= +; End of Y/N validation check for qmes_ptr +;========================================================================= + +NOCRLF: + MOV BX,[WRT_HANDLE] + MOV AH,CLOSE + INT 21H + MOV DX,OFFSET DG:TEMP_PATH + MOV AH,UNLINK + INT 21H + mov ah,exit + xor al,al + INT 21H + +QUERY: + TEST BYTE PTR [QFLG],-1 + retz + MOV DX,OFFSET DG:ASK_ptr + call std_printf + PUSH AX + CALL CRLF + POP AX +IF KANJI + CALL TESTKANJ + JZ ASCII1 + PUSH AX + MOV AX,(STD_CON_INPUT_FLUSH SHL 8) + 0 + INT 21H ;Eat the trailing byte + XOR AX,AX + INC AX ; non zero flag + POP AX + return +ASCII1: +ENDIF + CMP AL,13 ;Carriage return means yes + retz +;========================================================================= +; We are invoking the VAL_YN proc here. This will replace the +; method of Y/N validation used prior to DOS 4.00. +; This invocation of val_yn will return ZR if Y is found, otherwise +; it will return NZ. +; +; Date : 6/10/87 +;========================================================================= + + call val_yn ;an000;pass Y/N byte in AL to macro + cmp ax,yes ;an000;did we return a Y + je Query_Exit ;an000; dms; exit Y/N validation + cmp ax,no ;an000; dms; N response? + jne Query ;an000; dms; no - reprompt user + cmp ax,yes ;an000; dms; must have N response - force + ; NZ flag +Query_Exit: + + +;========================================================================= +; End of Y/N validation check for ask_ptr +;========================================================================= + + return + +;========================================================================= +; EDLIN_DISP_COUNT: This routine will determine the number of lines +; actually displayed to the screen. Lines displayed to +; the screen for one EDLIN line printed will be calculated +; by the following formula: +; +; LINES_PRINTED = (LINE_LEN + 10) / SCREEN_WIDTH +; +; LINES_PRINTED - Actual number of lines printed on screen +; for one EDLIN line. If LINES_PRINTED has +; a remainder, it will be rounded up. +; +; LINE_LEN - The length, in bytes, of the EDLIN line +; printed. +; +; SCREEN_WIDTH - The width in bytes of the current display. +; +; Inputs : DI - offset into buffer containing line printed +; DISP_WIDTH - width of current video output +; +; Outputs: LC_ADJ - factor to adjust line counter by +; +; Date : 6/10/87 +;========================================================================= + +EDLIN_DISP_COUNT proc near ;an000;lines printed + + push dx ;an000;save affected regs + push di ;an000; + push ax ;an000; + push bx ;an000; + push cx ;an000; + + mov bx,offset dg:arg_buf ;an000;arg_buf holds line + ; printed + mov ax,di ;an000;where print line ends + sub ax,bx ;an000;diff = line's length + add ax,10 ;an000;adjust for leading blks + mov cl,dg:disp_width ;an000;set up for division + div cl ;an000;divide AX by the + ; width of the console + cmp ah,0 ;an000;see if a remainder +; $if nz ;an000;if a remainder + JZ $$IF13 + add al,1 ;an000;increment AL 1 + ; to round upward +; $endif ;an000; +$$IF13: + + mov lc_adj,al ;an000;number of lines printed + ; on console + pop cx ;an000;restore affected regs + pop bx ;an000; + pop ax ;an000; + pop di ;an000; + pop dx ;an000; + + ret ;an000;return to caller + +EDLIN_DISP_COUNT endp ;an000;end proc + +;========================================================================= +; EDLIN_PG_COUNT : This routine determines whether or not we will continue +; displaying text lines based on the count of lines that +; can be output to the current video screen. +; +; Inputs : LC_ADJ - adjustment factor for number of lines printed +; PG_COUNT - number of lines remaining on current video +; display +; DX - holds the total number of lines to print +; CONTINUE - signals if the user wants to continue +; printing lines. +; +; Outputs: LC_FLAG - used to signal completion of print +; +; Date : 6/10/87 +;========================================================================= + +EDLIN_PG_COUNT proc near ;an000;track remaining lines + + push ax ;an000;save affected regs + + mov lc_flag,true ;an000;init. flag to signal + ; continue printing + + mov al,pg_count ;an000;set up for page adj. + cmp al,lc_adj ;an000;see if we are at end +; $if be ;an000 + JNBE $$IF15 + mov pg_count,0 ;an000;set pg_count to 0 +; $else + JMP SHORT $$EN15 +$$IF15: + sub al,lc_adj ;an000;adjust number of lines + mov pg_count,al ;an000;save remaining line ct. +; $endif ;an000; +$$EN15: + + dec dx ;an000;decrease total number + ; of lines to print by 1 +; $if nz ;an000;more lines to print + JZ $$IF18 + cmp pg_count,0 ;an000;have we printed screen +; $if be ;an000;we have printed screen + JNBE $$IF19 + call EDLIN_PG_PROMPT ;an000;prompt the user to + ; "Continue(Y/N)?" + cmp continue,true ;an000;did user say continue +; $if z ;an000;continue + JNZ $$IF20 + mov al,dg:disp_len ;an000;begin init of screen +; dec al ;an000; length + mov pg_count,al ;an000; +; $else ;an000;do not continue + JMP SHORT $$EN20 +$$IF20: + mov lc_flag,false ;an000;signal no more to print +; $endif ;an000; +$$EN20: +; $endif ;an000; +$$IF19: +; $else ;an000;total lines printed + JMP SHORT $$EN18 +$$IF18: + mov lc_flag,false ;an000;signal no more to print +; $endif ;an000; +$$EN18: + + pop ax ;an000;restore affected regs + + ret ;an000;return to caller + +EDLIN_PG_COUNT endp ;an000;end procedure + +;========================================================================= +; EDLIN_PG_PROMPT : This routine prompts the user as to whether or not to +; continue printing lines to the video display, if lines +; are still present for printing. +; +; Inputs : none +; +; Outputs: CONTINUE - flag that signals other routines whether or +; not to continue printing. +; +; Date : 6/10/87 +;========================================================================= + +EDLIN_PG_PROMPT proc near ;an000;ask user to continue? + + push dx ;an000;save affected regs. + push ax ;an000; + +EPP_Reprompt: + + mov dx,offset dg:cont_ptr ;an000;point to Continue msg. + call std_printf ;an000;invoke message ret. + + push ax ;an000;save affected regs. + call crlf ;an000;send crlf + pop ax ;an000;restore affected regs. + + call val_yn ;an000;Y/N validation + + cmp ax,yes ;an000;did we have a Y + jz EPP_True_Exit ;an000;we had a Y + cmp ax,no ;an000;did we have a N + jz EPP_False_Exit ;an000;yes + jmp EPP_Reprompt ;an000;neither Y or N - reprompt + +EPP_True_Exit: + + mov Continue,True ;an000;flag Y found + jmp EPP_Exit ;an000;exit routine + +EPP_False_Exit: + + mov Continue,False ;an000;flag N found + +EPP_Exit: + + pop ax ;an000;restore affected regs. + pop dx ;an000; + + ret ;an000;return to caller + +EDLIN_PG_PROMPT endp ;an000;end procedure + +;========================================================================= +; val_yn: This proc validates a Y/N response entered by the user. The +; routine uses the new functionality of "GET EXTENDED COUNTRY +; INFORMATION" being implemented in DOS 4.00. +; +; Inputs : AL - character to be validated for Y/N response +; +; Outputs: AX - 00h = "N"o +; - 01h = "Y"es +;========================================================================= + +val_yn proc near ;an000;validate Y/N response + + push dx ;an000;save affected registers + push cx ;an000; + push bx ;an000; + + mov dl,al ;an000;character to be checked for Y/N + mov ah,GetExtCntry ;an000;get extended country information + mov al,yn_chk ;an000;perform Y/N checking + mov cx,max_len ;an000;max. len. of Y/N char. + int 21h ;an000;invoke function + + pop bx ;an000;restore affected registers + pop cx ;an000; + pop dx ;an000; + + ret ;an000;return to caller + +val_yn endp ;an000;end proc + + + +code ends + end + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLEQU.ASM b/v4.0/src/CMD/EDLIN/EDLEQU.ASM new file mode 100644 index 0000000..d60796d --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLEQU.ASM @@ -0,0 +1,156 @@ + page 60,132 ; + + .xlist + include DOSSYM.INC + include EDLSTDSW.INC + .list + +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: EDLEQU.SAL +; +; DESCRIPTIVE NAME: EQUATES FOR EDLIN +; +; FUNCTION: PROVIDES EQUATES FOR EDLIN. IT ALSO PROVIDES THE MACRO +; VAL_YN. +; +; ENTRY POINT: NA +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: +; +; ROUTINE: VAL_YN - VALIDATES Y/N RESPONSES FROM THE KEYBOARD +; +; EXTERNAL REFERENCES: +; +; ROUTINE: NA +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT SYSPARSE +; - IMPLEMENT MESSAGE RETRIEVER +; - IMPLEMENT DBCS ENABLING +; - ENHANCED VIDEO SUPPORT +; - EXTENDED OPENS +; - SCROLLING ERROR +; +; COPYRIGHT: "MS DOS EDLIN UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; +;======================= END OF SPECIFICATIONS =========================== + + + + + + +COMAND_LINE_LENGTH EQU 128 +QUOTE_CHAR EQU 16H ;Quote character = ^V +CR EQU 13 +STKSIZ EQU 200h +STACK equ stksiz + +asian_blk equ 40h ;an000;asian blank 2nd. byte +dbcs_lead_byte equ 81h ;an000;asian blank lead byte +nul equ 00h ;an000;nul character +Access_Denied equ 0005h ;an000;extended error code for access denied + +;======== Y/N validation equates ========================================= + +yn_chk equ 23h ;an000;check for Y/N response +max_len equ 01h ;an000;max. len. for Y/N char. +yes equ 01h ;an000;boolean yes value +no equ 00h ;an000;boolean no value + +;======== text display values for initialization ========================= + +video_get equ 0fh ;an000;int 10 get video attributes +video_set equ 00h ;an000;int 10 set video attributes +video_text equ 03h ;an000;80 X 25 color monitor + +;======== code page values for functions ================================= + +get_set_cp equ 66h ;an000;get or set code page +get_cp equ 01h ;an000;get active code page +set_cp equ 02h ;an000;set active code page + +;======== screen length & width defaults ================================= + +std_out equ 01h ;an000;console output +display_attr equ 03h ;an000;display for IOCTL +Get_Display equ 7fh ;an000;Get display for IOCTL +Def_Disp_Len equ 25 ;an000;default display length +Def_Disp_Width equ 80 ;an000;default display width + +;======== extended open equates ========================================== + +rw equ 0082h ;an000;read/write + ; compatibility + ; noinherit + ; int 24h handler + ; no commit + +ext_read equ 0080h ;an000;read + ; compatibility + ; noinherit + ; int 24h handler + ; no commit + +rw_flag equ 0101h ;an000;fail if file not exist + ; open if file exists + ; don't validate code page + +creat_flag equ 0110h ;an000;create if file does not exist + ; fail if file exists + ; don't validate code page + +open_flag equ 0101h ;an000;fail if file not exist + ; open if file exists + ; don't validate code page + +creat_open_flag equ 0112h ;an000;create if file does not exist + ; open/replace if file exists + ; don't validate code page + +attr equ 00h ;an000;attributes set to 0 + +;======== parse value equates ============================================ + +nrm_parse_exit equ 0ffffh ;an000;normal exit from sysparse +too_many equ 01h ;an000;too many parms entered +op_missing equ 02h ;an000;required operand missing +sw_missing equ 03h ;an000;not a valid switch + + +;======== Strucs ========================================================= + +Display_Buffer_Struc Struc ;an000;dms; + + Display_Info_Level db ? ;an000;dms; + Display_Reserved db ? ;an000;dms; + Display_Buffer_Size dw ? ;an000;dms; + Display_Flags dw ? ;an000;dms; + Display_Mode db ? ;an000;dms; + ; TEXT=01 + ; APA =02 + Display_Mode_Reserved db ? ;an000;dms; + Display_Colors dw ? ;an000;dms;# of colors + Display_Width_Pixels dw ? ;an000;dms;# of pixels in width + Display_Length_Pixels dw ? ;an000;dms;# of pixels in len. + Display_Width_Char dw ? ;an000;dms;# of chars in width + Display_Length_Char dw ? ;an000;dms;# of chars in length + +Display_Buffer_Struc ends ;an000;dms; + + + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLIN.ASM b/v4.0/src/CMD/EDLIN/EDLIN.ASM new file mode 100644 index 0000000..5368db0 --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLIN.ASM @@ -0,0 +1,1843 @@ + PAGE 60,132; + TITLE EDLIN + +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: EDLIN.SAL +; +; DESCRIPTIVE NAME: LINE TEXT EDITOR +; +; FUNCTION: EDLIN IS A SIMPLE, LINE ORIENTED TEXT EDITOR. IT PROVIDES +; USERS OF DOS THE ABILITY TO CREATE AND EDIT TEXT FILES. +; +; ENTRY POINT: EDLIN +; +; INPUT: DOS COMMAND LINE +; EDLIN COMMANDS +; TEXT +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: +; +; EXTERNAL REFERENCES: +; +; ROUTINE: EDLCMD1 - CONTAINS ROUTINES CALLED BY EDLIN +; EDLCMD1 - CONTAINS ROUTINES CALLED BY EDLIN +; EDLMES - CONTAINS ROUTINES CALLED BY EDLIN +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: +; +; - IMPLEMENT SYSPARSE +; - IMPLEMENT MESSAGE RETRIEVER +; - IMPLEMENT DBCS ENABLING +; - ENHANCED VIDEO SUPPORT +; - EXTENDED OPENS +; - SCROLLING ERROR +; +; COPYRIGHT: "MS DOS EDLIN UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft" +; +; +; MICROSOFT REVISION HISTORY: +; ; +; V1.02 ; +; ; +; V2.00 9/13/82 M.A.U ; +; ; +; 2/23/82 Rev. 13 N. P ; +; Changed to 2.0 system calls. ; +; Added an error message for READ-ONLY files ; +; ; +; 11/7/83 Rev. 14 N. P ; +; Changed to .EXE format and added Printf ; +; ; +; V2.50 11/15/83 Rev. 1 M.A. U ; +; Official dos 2.50 version. Some random bug ; +; fixes and message changes. ; +; ; +; 11/30/83 Rev. 2 MZ ; +; Close input file before rename. ; +; Jmp to replace after line edit ; +; ; +; 02/01/84 Rev. 3 M.A. U ; +; Now it is called 3.00 dos. Repaired problem ; +; with using printf and having %'s as data. ; +; ; +; 02/15/84 MZ make out of space a fatal error with output; +; ; +; 03/28/84 MZ fixes bogus (totally) code in MOVE/COPY ; +; ; +; 04/02/84 MZ fixes DELETE and changes MOVE/COPY/EDIT ; +; ; +; V3.20 08/29/86 Rev. 1 S.M. G ; +; ; +; 08/29/86 M001 MSKK TAR 593, TAB MOVEMENT ; +; ; +; 08/29/86 M002 MSKK TAR 157, BLKMOVE 1,1,1m, 1,3,1m ; +; ; +; 08/29/86 M003 MSKK TAR 476, EDLCMD2,MAKECAPS,kana char; +; ; +; 08/29/86 M004 MSKK TAR 191, Append load size ; +; ; +; 08/29/86 M005 IBMJ TAR Transfer Load command ; +; +; +;======================= END OF SPECIFICATIONS =========================== ; + +include edlequ.asm + +SUBTTL Contants and Data areas +PAGE + extrn parser_command:near ;an000;SYSPARSE + +CODE SEGMENT PUBLIC +CODE ENDS + +CONST SEGMENT PUBLIC WORD +CONST ENDS + +cstack segment stack +cstack ends + +DATA SEGMENT PUBLIC WORD +DATA ENDS + +DG GROUP CODE,CONST,cstack,DATA + +CONST SEGMENT PUBLIC WORD + + public bak,$$$file,delflg,loadmod,txt1,txt2 + + EXTRN BADDRV_ptr:word,NDNAME_ptr:word,bad_vers_err:byte,opt_err_ptr:word + EXTRN NOBAK_ptr:word,BADCOM_ptr:word,NEWFIL_ptr:word,DEST_ptr:word,MRGERR_ptr:word + EXTRN NODIR_ptr:word,FILENM_ptr:word,ro_err_ptr:word,bcreat_ptr:word + EXTRN TOO_MANY_ptr:word,lf_ptr:word,prompt_ptr:word + EXTRN MemFul_Ptr:word + +BAK DB ".BAK",0 + +$$$FILE DB ".$$$",0 + +fourth db 0 ;fourth parameter flag + +loadmod db 0 ;Load mode flag, 0 = ^Z marks the + ; end of a file, 1 = viceversa. +optchar db "-" + +TXT1 DB 0,80H DUP (?) +TXT2 DB 0,80H DUP (?) +DELFLG DB 0 +fNew DB 0 ; old file +HAVEOF DB 0 + +CONST ENDS + +cstack segment stack + db stksiz dup (?) +cstack ends + +DATA SEGMENT PUBLIC WORD + + extrn arg_buf_ptr:word ;an000; + extrn line_num_buf_ptr:word ;an000; + + public path_name,ext_ptr,start,line_num,line_flag + public arg_buf,wrt_handle,temp_path + public current,pointer,qflg,editbuf,amnt_req,fname_len,delflg,lastlin + public olddat,oldlen,newlen,srchflg,srchmod + public comline,lstfnd,numpos,lstnum,last,srchcnt + public rd_handle,haveof,ending,three4th,one4th + + public lc_adj ;an000;page length adj. factor + public lc_flag ;an000;display cont. flag + public pg_count ;an000;lines left on screen + public Disp_Len ;an000;display length + public Disp_Width ;an000;display width + public continue ;an000;boolean T/F + public temp_path ;an000;pointer to filespec buf + +Video_Buffer label word ;an000;buffer for video attr + db 0 ;an000;dms; + db 0 ;an000;dms; + dw 14 ;an000;dms; + dw 0 ;an000;dms; + db ? ;an000;dms; + db 0 ;an000;dms; + dw ? ;an000;dms;# of colors + dw ? ;an000;dms;# of pixels in width + dw ? ;an000;dms;# of pixels in len. + dw ? ;an000;dms;# of chars in width + dw ? ;an000;dms;# of chars in length + + +video_org db ? ;an000;original video mode on + ; entry to EDLIN. +lc_adj db ? ;an000;page length adj. factor +lc_flag db ? ;an000;display cont. flag +pg_count db ? ;an000;lines left on screen +Disp_Len db ? ;an000;display length +Disp_Width db ? ;an000;display width +continue db ? ;an000;boolean T/F + + +;-----------------------------------------------------------------------; +; This is a table that is sequentially filled via GetNum. Any additions to it +; must be placed in the correct position. Currently Param4 is known to be a +; count and thus is treated specially. + + public param1,param2,Param3,param4,ParamCt +PARAM1 DW ? +PARAM2 DW ? +PARAM3 DW ? +PARAM4 DW ? +ParamCt DW ? ; count of passed parameters + if kanji ; Used in TESTKANJ: +LBTbl dd ? ; long pointer to lead byte table + endif ; in the dos (from syscall 63H) + +;-----------------------------------------------------------------------; + +PUBLIC PTR_1, PTR_2, PTR_3, OLDLEN, NEWLEN, LSTFND, LSTNUM, NUMPOS, SRCHCNT +PUBLIC CURRENT, POINTER, ONE4TH, THREE4TH, LAST, ENDTXT, COPYSIZ +PUBLIC COMLINE, LASTLIN, COMBUF, EDITBUF, EOL, QFLG, ENDING, SRCHFLG +PUBLIC PATH_NAME, FNAME_LEN, RD_HANDLE, TEMP_PATH, WRT_HANDLE, EXT_PTR +PUBLIC MRG_PATH_NAME, MRG_HANDLE, amnt_req, olddat, srchmod, MOVFLG, org_ds +if kanji +public lbtbl +endif + +; +; These comprise the known state of the internal buffer. All editing +; functions must preserve these values. +; +CURRENT DW ? ; the 1-based index of the current line +POINTER DW ? ; pointer to the current line +ENDTXT DW ? ; pointer to end of buffer. (at ^Z) +LAST DW ? ; offset of last byte of memory +; +; The label Start is the beginning of the in-core buffer. +; + +; +; Internal temporary pointers +; +PTR_1 DW ? +PTR_2 DW ? +PTR_3 DW ? + +QFLG DB ? ; TRUE => query for replacement +OLDLEN DW ? +NEWLEN DW ? +LSTFND DW ? +LSTNUM DW ? +NUMPOS DW ? +SRCHCNT DW ? +ONE4TH DW ? +THREE4TH DW ? +COPYSIZ DW ? ; total length to copy +COPYLEN DW ? ; single copy length +COMLINE DW ? +LASTLIN DW ? +COMBUF DB 82H DUP (?) +EDITBUF DB 258 DUP (?) +EOL DB ? +ENDING DB ? +SRCHFLG DB ? +PATH_NAME DB 128 DUP(0) +FNAME_LEN DW ? +RD_HANDLE DW ? +TEMP_PATH DB 128 DUP(?) +WRT_HANDLE DW ? +EXT_PTR DW ? +MRG_PATH_NAME DB 128 DUP(?) +MRG_HANDLE DW ? +amnt_req dw ? ; amount of bytes requested to read +olddat db ? ; Used in replace and search, replace + ; by old data flag (1=yes) +srchmod db ? ; Search mode: 1=from current+1 to + ; end of buffer, 0=from beg. of + ; buffer to the end (old way). +MOVFLG DB ? +org_ds dw ? ;Orginal ds points to header block + +arg_buf db 258 dup (?) + +EA_Flag db False ;an000; dms;set to false + +EA_Buffer_Size dw ? ;an000; dms;EA buffer's size + +EA_Parm_List label word ;an000; dms;EA parms + dd dg:Start ;an000; dms;ptr to EA's + dw 0001h ;an000; dms;additional parms + db 06h ;an000; dms; + dw 0002h ;an000; dms;iomode + + +line_num dw ? + +line_flag db ?,0 + EVEN ;align on word boundaries +; +; Byte before start of data buffer must be < 40H !!!!!! +; + dw 0 ;we scan backwards looking for + ;a character which can't be part + ;of a two-byte seqence. This + ;double byte sequence will cause the back + ;scan to stop here. +START LABEL WORD + +DATA ENDS + + +CODE SEGMENT PUBLIC + +ASSUME CS:DG,DS:NOTHING,ES:NOTHING,SS:CStack + + + + extrn pre_load_message:near ;an000;message loader + extrn disp_fatal:near ;an000;fatal message + extrn printf:near ;an000;new PRINTF routine + + extrn findlin:near,shownum:near,loadbuf:near,crlf:near,lf:near + extrn abortcom:near,delbak:near,unquote:near,kill_bl:near + extrn make_caps:near,dispone:near,display:near,query:near + extrn quit:near,make_cntrl:near,scanln:near,scaneof:near + extrn fndfirst:near,fndnext:near,replace:near,memerr:near + extrn xerror:near,bad_read:near,append:near + extrn nocom:near,pager:near,list:near,search_from_curr:near + extrn replac_from_curr:near,ewrite:near,wrt:near,delete:near + + + extrn filespec:byte ;an000;parser's filespec + extrn parse_switch_b:byte ;an000;result of switch scan + + public std_printf,command,chkrange,comerr + ; exit from EDLIN + + IF KANJI + extrn testkanj:near + ENDIF + +EDLIN: + JMP SHORT SIMPED + +std_printf proc near ;ac000;convert to proc + + push dx + call printf + pop dx ;an000;balance the push + ret + +std_printf endp ;ac000;end proc + +NONAME: + MOV DX,OFFSET DG:NDNAME_ptr + JMP XERROR + +SIMPED: + mov org_ds,DS + push ax ;ac000;save for drive compare + + push cs ;an000;exchange cs/es + pop es ;an000; + + push cs ;an000;exchange cs/ds + pop ds ;an000; + assume ds:dg,es:dg ;an000;establish addressibility + + MOV dg:ENDING,0 + mov sp,stack + call EDLIN_DISP_GET ;an000;get current video + ; mode & set it to + ; text + +;========================================================================= +; invoke PRE_LOAD_MESSAGE here. If the messages were not loaded we will +; exit with an appropriate error message. +; +; Date : 6/14/87 +;========================================================================= + + call PRE_LOAD_MESSAGE ;an000;invoke SYSLOADMSG +; $if c ;an000;if the load was unsuccessful + JNC $$IF1 + mov ah,exit ;an000;exit EDLIN. PRE_LOAD_MESSAGE + ; has said why we are exiting + mov al,00h ;an000 + int 21h ;an000;exit +; $endif ;an000; +$$IF1: + + + +VERS_OK: +;----- Check for valid drive specifier --------------------------------; + + pop ax + OR AL,AL + JZ get_switch_char + MOV DX,OFFSET DG:BADDRV_ptr + JMP xerror +get_switch_char: + MOV AX,(CHAR_OPER SHL 8) ;GET SWITCH CHARACTER + INT 21H + CMP DL,"/" + JNZ CMD_LINE ;IF NOT / , THEN NOT PC + MOV OPTCHAR,"/" ;IN PC, OPTION CHAR = / + + IF KANJI + push ds ; SAVE! all regs destroyed on this + push es + push si ; call !! + mov ax,(ECS_call shl 8) or 00h ; get kanji lead tbl + int 21h +assume ds:nothing +assume es:nothing + mov word ptr [LBTbl],si + mov word ptr [LBTbl+2],ds + pop si + pop es + pop ds +assume ds:dg +assume es:dg + ENDIF + + +CMD_LINE: + push cs + pop es + ASSUME ES:DG + +;----- Process any options ------------------------------------------; + +;========================================================================= +; The system parser, called through PARSER_COMMAND, parses external +; command lines. In the case of EDLIN we are looking for two parameters +; on the command line. +; +; Parameter 1 - Filespec (REQUIRED) +; Parameter 2 - \B switch (OPTIONAL) +; +; PARSER_COMMAND - exit_normal : ffffh +; exit_error : not = ffffh +;========================================================================= + + + call PARSER_COMMAND ;an000;invoke sysparse + ; DMS:6/11/87 + cmp ax,nrm_parse_exit ;an000;was it a good parse +; $if z ;an000;it was a good parse + JNZ $$IF3 + call EDLIN_COMMAND ;an000;interface results + ; into EDLIN +; $else ;an000; + JMP SHORT $$EN3 +$$IF3: + cmp ax,too_many ;an000;too many operands +; $if z ;an000;we have too many + JNZ $$IF5 + jmp badopt ;an000;say why and exit +; $endif +$$IF5: + + cmp ax,op_missing ;an000;required parm missing +; $if z ;an000;missing parm + JNZ $$IF7 + jmp noname ;an000;say why and exit +; $endif ;an000; +$$IF7: + + cmp ax,sw_missing ;an000;is it an invalid switch +; $if z ;an000;invalid switch + JNZ $$IF9 + jmp badopt ;an000;say why and exit +; $endif ;an000; +$$IF9: + +; $endif ;an000; +$$EN3: + +;========================================================================= +;======================= begin .BAK check ================================ +; Check for .BAK extension on the filename + + push ds ;an000;save reg. + push cs ;an000;set up addressibility + pop ds ;an000; + assume ds:dg ;an000; + + push ax ;an000;save reg. + mov ax,offset dg:path_name ;an000;point to path_name + add ax,[fname_len] ;an000;calculate end of path_name + mov si,ax ;an000;point to end of path_name + pop ax ;an000;restore reg. + + MOV CX,4 ;compare 4 bytes + SUB SI,4 ;Point 4th to last char + MOV DI,OFFSET DG:BAK ;Point to string ".BAK" + REPE CMPSB ;Compare the two strings + pop ds + ASSUME DS:NOTHING + JNZ NOTBAK + JMP HAVBAK + +;======================= end .BAK check ================================== + +;======================= begin NOTBAK ==================================== +; we have a file without a .BAK extension, try to open it + +NOTBAK: + push ds + push cs + pop ds + ASSUME DS:DG + +;========================================================================= +; implement EXTENDED OPEN +;========================================================================= + + push es ;an000;save reg. + mov bx,RW ;an000;open for read/write + mov cx,ATTR ;an000;file attributes + mov dx,RW_FLAG ;an000;action to take on open + mov di,0ffffh ;an000;nul parm list + + call EXT_OPEN1 ;an000;open for R/W;DMS:6/10/87 + pop es ;an000;restore reg. + +;========================================================================= + pop ds + ASSUME DS:NOTHING + JC CHK_OPEN_ERR ;an open error occurred + MOV RD_HANDLE,AX ;Save the handle + + call Calc_Memory_Avail ;an000; dms;enough memory? + + mov bx,RD_Handle ;an000; dms;set up for call + call Query_Extend_Attrib ;an000; dms;memory required? + + cmp dx,cx ;an000; dms;enough memory for EA's? +; $if b ;an000; dms;no + JNB $$IF12 + call EA_Fail_Exit ;an000; dms;say why and exit +; $endif ;an000; dms; +$$IF12: + + mov bx,RD_Handle ;an000; dms;set up for call + mov EA_Flag,True ;an000; dms; + call Get_Extended_Attrib ;an000; dms;get attribs + + Jmp HavFil ;work with the opened file + +;======================= end NOTBAK ====================================== + +Badopt: + MOV DX,OFFSET DG:OPT_ERR_ptr;Bad option specified + JMP XERROR + +;========================================================================= +; +; The open of the file failed. We need to figure out why and report the +; correct message. The circumstances we can handle are: +; +; open returns pathnotfound => bad drive or file name +; open returns toomanyopenfiles => too many open files +; open returns access denied => +; chmod indicates read-only => cannot edit read only file +; else => file creation error +; open returns filenotfound => +; creat ok => close, delete, new file +; creat fails => file creation error +; else => file cre +; + +CHK_OPEN_ERR: + cmp ax,error_path_not_found + jz BadDriveError + cmp ax,error_too_many_open_files + jz TooManyError + cmp ax,error_access_denied + jnz CheckFNF + push ds + push cs + pop ds + assume ds:dg + mov ax,(chmod shl 8) + MOV DX,OFFSET DG:PATH_NAME + int 21h + jc FileCreationError + test cx,attr_read_only + jz FileCreationError + jmp ReadOnlyError + +CheckFNF: + cmp ax,error_file_not_found + jnz FileCreationError +; +; Try to create the file to see if it is OK. +; + push ds + push cs + pop ds + assume ds:dg +;========================================================================= +; implement EXTENDED OPEN +;========================================================================= + + mov bx,RW ;an000;open for read/write + mov cx,ATTR ;an000;file attributes + mov dx,CREAT_FLAG ;an000;action to take on open + mov di,0ffffh ;an000;null parm list + call EXT_OPEN1 ;an000;create file;DMS:6/10/87 + +;========================================================================= + + pop ds + assume ds:nothing + jc CreateCheck + mov bx,ax + mov ah,close + int 21h + push ds + push cs + pop ds + assume ds:dg + mov ah,unlink + MOV DX,OFFSET DG:PATH_NAME + int 21h + pop ds + assume ds:nothing + jc FileCreationError ; This should NEVER be taken!!! + MOV HAVEOF,0FFH ; Flag from a system 1.xx call + MOV fNew,-1 + JMP HAVFIL + +CreateCheck: + cmp ax,error_access_denied + jnz BadDriveError +DiskFull: + MOV DX,OFFSET DG:nodir_ptr + jmp xerror + +FileCreationError: + mov dx,offset dg:BCreat_PTR + jmp xerror + +ReadOnlyError: + MOV DX,OFFSET DG:RO_ERR_ptr + jmp xerror + +BadDriveError: + MOV DX,OFFSET DG:BADDRV_PTR + jmp xerror + +TooManyError: + MOV DX,OFFSET DG:TOO_MANY_ptr + jmp xerror + + +CREAT_ERR: + CMP DELFLG,0 + JNZ DiskFull + push cs + pop ds + CALL DELBAK + JMP MAKFIL + +HAVBAK: + MOV DX,OFFSET DG:NOBAK_ptr + JMP XERROR + +HAVFIL: + push cs + pop ds + ASSUME DS:DG + CMP fNew,0 + JZ MakeBak + MOV DX,OFFSET DG:NEWFIL_ptr ; Print new file message + call std_printf +MakeBak: + MOV SI,OFFSET DG:PATH_NAME + MOV CX,[FNAME_LEN] + PUSH CX + MOV DI,OFFSET DG:TEMP_PATH + REP MOVSB + DEC DI + MOV DX,DI + POP CX + MOV AL,"." + STD + REPNE SCASB + JZ FOUND_EXT + MOV DI,DX ;Point to last char in filename +FOUND_EXT: + CLD + INC DI + MOV [EXT_PTR],DI + MOV SI,OFFSET DG:$$$FILE + MOV CX,5 + REP MOVSB + +;Create .$$$ file to make sure directory has room +MAKFIL: + +;========================================================================= +; implement EXTENDED OPEN +;========================================================================= + + mov bx,RW ;an000;open for read/write + mov cx,ATTR ;an000;file attributes + mov dx,Creat_Open_Flag ;an000;action to take on open + cmp EA_Flag,True ;an000;EA_Buffer used? +; $if e ;an000;yes + JNE $$IF14 + mov di,offset dg:EA_Parm_List ;an000; point to buffer +; $else ;an000; + JMP SHORT $$EN14 +$$IF14: + mov di,0ffffh ;an000;nul parm list +; $endif ;an000; +$$EN14: + call EXT_OPEN2 ;an000;create file;DMS:6/10/87 + +;========================================================================= + + JC CREAT_ERR + MOV [WRT_HANDLE],AX +; +; We determine the size of the available memory. Use the word in the PDB at +; [2] to determine the number of paragraphs. Then truncate this to 64K at +; most. +; + push ds ;save ds for size calc + mov ds,[org_ds] + MOV CX,DS:[2] + MOV DI,CS + SUB CX,DI + CMP CX,1000h + JBE GotSize + MOV CX,0FFFh +GotSize: + SHL CX,1 + SHL CX,1 + SHL CX,1 + SHL CX,1 + pop ds ;restore ds after size calc + DEC CX + MOV [LAST],CX + MOV DI,OFFSET DG:START + TEST fNew,-1 + JNZ SAVEND + SUB CX,OFFSET DG:START ;Available memory + SHR CX,1 ;1/2 of available memory + MOV AX,CX + SHR CX,1 ;1/4 of available memory + MOV [ONE4TH],CX ;Save amount of 1/4 full + ADD CX,AX ;3/4 of available memory + MOV DX,CX + ADD DX,OFFSET DG:START + MOV [THREE4TH],DX ;Save pointer to 3/4 full + MOV DX,OFFSET DG:START +SAVEND: + CLD + MOV BYTE PTR [DI],1AH + MOV [ENDTXT],DI + MOV BYTE PTR [COMBUF],128 + MOV BYTE PTR [EDITBUF],255 + MOV BYTE PTR [EOL],10 + MOV [POINTER],OFFSET DG:START + MOV [CURRENT],1 + MOV ParamCt,1 + MOV [PARAM1],0 ;M004 Leave room in memory, was -1 + TEST fNew,-1 + JNZ COMMAND +; +; The above setting of PARAM1 to -1 causes this call to APPEND to try to read +; in as many lines that will fit, BUT.... What we are doing is simulating +; the user issuing an APPEND command, and if the user asks for more lines +; than we get then an "Insufficient memory" error occurs. In this case we +; DO NOT want this error, we just want as many lines as possible read in. +; The twiddle of ENDING suppresses the memory error +; + MOV BYTE PTR [ENDING],1 ;Suppress memory errors + CALL APPEND + MOV ENDING,0 ; restore correct initial value + +Break
+ +; +; Main read/parse/execute loop. We reset the stack all the time as there +; are routines that JMP back here. Don't blame me; Tim Paterson write this. +; +COMMAND: + push cs ;an000;set up addressibility + pop ds ;an000; + push cs ;an000; + pop es ;an000; + assume ds:dg,es:dg ;an000; + + MOV SP, STACK + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H + MOV DX,OFFSET DG:ABORTCOM + INT 21H + mov dx,offset dg:prompt_ptr + call std_printf + MOV DX,OFFSET DG:COMBUF + MOV AH,STD_CON_STRING_INPUT + INT 21H + MOV [COMLINE],OFFSET DG:COMBUF + 2 + mov dx,offset dg:lf_ptr + call std_printf +PARSE: + MOV [PARAM2],0 + MOV [PARAM3],0 + MOV [PARAM4],0 + mov [fourth],0 ;reset the fourth parameter flag + MOV QFLG,0 + MOV SI,[COMLINE] + MOV BP,OFFSET DG:PARAM1 + XOR DI,DI +CHKLP: + CALL GETNUM +; +; AL has first char after arg +; + MOV ds:[BP+DI],DX + ADD DI,2 + + MOV ParamCt,DI ; set up count of parameters + SHR ParamCt,1 ; convert to index (1-based) + + CALL SKIP1 ; skip to next parameter + CMP AL,"," ; is there a comma? + JZ CHKLP ; if so, then get another arg + DEC SI ; point at char next + CALL Kill_BL ; skip all blanks + CMP AL,"?" ; is there a ? + JNZ DISPATCH ; no, got command letter + MOV QFLG,-1 ; signal query + CALL Kill_BL +DISPATCH: + CMP AL,5FH + JBE UPCASE + cmp al,"z" + ja upcase + AND AL,5FH +UPCASE: + MOV DI,OFFSET DG:COMTAB + MOV CX,NUMCOM + REPNE SCASB + JNZ COMERR + SUB DI,1+OFFSET DG:COMTAB ; convert to index + MOV BX,DI + MOV AX,[PARAM2] + OR AX,AX + JZ PARMOK + CMP AX,[PARAM1] + JB COMERR ; Param. 2 must be >= param 1 +PARMOK: + MOV [COMLINE],SI + SHL BX,1 + CALL [BX+TABLE] +COMOVER: + MOV SI,[COMLINE] + CALL Kill_BL + CMP AL,0DH + JZ COMMANDJ + CMP AL,1AH + JZ DELIM + CMP AL,";" + JNZ NODELIM +DELIM: + INC SI +NODELIM: + DEC SI + MOV [COMLINE],SI + JMP PARSE + +COMMANDJ: + JMP COMMAND + +SKIP1: + DEC SI + CALL Kill_BL +ret1: return + +Break + +; +; People call here. we need to reset the stack. +; Inputs: BX has param1 +; Outputs: Returns if BX <= Param2 +; + +CHKRANGE: + CMP [PARAM2],0 + retz + CMP BX,[PARAM2] + JBE RET1 + POP DX ; clean up return address +COMERR: + MOV DX,OFFSET DG:BADCOM_ptr +COMERR1: + call std_printf + JMP COMMAND + +; +; GetNum parses off 1 argument from the command line. Argument forms are: +; nnn a number < 65536 +; +nnn current line + number +; -nnn current line - number +; . current line +; # lastline + 1 +; +; + +GETNUM: + CALL Kill_BL + cmp di,6 ;Is this the fourth parameter? + jne sk1 + mov [fourth],1 ;yes, set the flag +sk1: + CMP AL,"." + JZ CURLIN + CMP AL,"#" + JZ MAXLIN + CMP AL,"+" + JZ FORLIN + CMP AL,"-" + JZ BACKLIN + MOV DX,0 + MOV CL,0 ;Flag no parameter seen yet +NUMLP: + CMP AL,"0" + JB NUMCHK + CMP AL,"9" + JA NUMCHK + CMP DX,6553 ;Max line/10 + JAE COMERR ;Ten times this is too big + MOV CL,1 ;Parameter digit has been found + SUB AL,"0" + MOV BX,DX + SHL DX,1 + SHL DX,1 + ADD DX,BX + SHL DX,1 + CBW + ADD DX,AX + LODSB + JMP SHORT NUMLP +NUMCHK: + CMP CL,0 + retz + OR DX,DX + JZ COMERR ;Don't allow zero as a parameter + return + +CURLIN: + cmp [fourth],1 ;the fourth parameter? + je comerra ;yes, an error + MOV DX,[CURRENT] + LODSB + return +MAXLIN: + cmp [fourth],1 ;the fourth parameter? + je comerra ;yes, an error + MOV DX,1 + MOV AL,0Ah + PUSH DI + MOV DI,OFFSET DG:START + MOV CX,EndTxt + SUB CX,DI +MLoop: + JCXZ MDone + REPNZ SCASB + JNZ MDone + INC DX + JMP MLoop +MDone: + POP DI + LODSB + return +FORLIN: + cmp [fourth],1 ;the fourth parameter? + je comerra ;yes, an error + CALL GETNUM + ADD DX,[CURRENT] + return +BACKLIN: + cmp [fourth],1 ;the fourth parameter? + je comerra ;yes, an error + CALL GETNUM + MOV BX,[CURRENT] + SUB BX,DX + JA OkLin ; if negative or zero + MOV BX,1 ; use first line +OkLin: + MOV DX,BX + return + +comerra: + jmp comerr + +Break + +;-----------------------------------------------------------------------; +; Careful changing the order of the next two tables. They are linked and +; changes should be be to both. + +COMTAB DB 13,";ACDEILMPQRSTW" +NUMCOM EQU $-COMTAB + +TABLE DW NOCOM ; Blank line + DW NOCOM ; ; + DW APPEND ; A(ppend) + DW COPY ; C(opy) + DW DELETE ; D(elete) + DW ENDED ; E(xit) + DW INSERT ; I(nsert) + DW LIST ; L(ist) + DW MOVE ; M(ove) + DW PAGER ; P(age) + DW QUIT ; Q(uit) + dw replac_from_curr ; R(eplace) + dw search_from_curr ; S(earch) + DW MERGE ; T(merge) + DW EWRITE ; W(rite) + +ERRORJ: + JMP COMERR +ERROR1J: + JMP COMERR1 + +Break + +PUBLIC MOVE +MOVE: + CMP ParamCt,3 + JNZ ERRORJ + MOV BYTE PTR [MOVFLG],1 + JMP SHORT BLKMOVE + +PUBLIC COPY +COPY: + CMP ParamCt,3 + JB ERRORJ + MOV BYTE PTR [MOVFLG],0 +; +; We are to move/copy a number of lines from one range to another. +; +; Memory looks like this: +; +; START: line 1 +; ... +; pointer-> line n Current has n in it +; ... +; line m +; endtxt-> ^Z +; +; The algoritm is: +; +; Bounds check on args. +; set ptr1 and ptr2 to range before move +; set copysiz to number to move +; open up copysize * count for destination +; if destination is before ptr1 then +; add copysize * count to both ptrs +; while count > 0 do +; move from ptr1 to destination for copysize bytes +; count -- +; if moving then +; move from ptr2 through end to ptr1 +; set endtxt to last byte moved. +; set current, pointer to original destination +; + +BLKMOVE: +; +; Make sure that all correct arguments are specified. +; + MOV BX,[PARAM3] ; get destination of move/copy + OR BX,BX ; must be specified (non-0) + MOV DX,OFFSET DG:DEST_ptr + JZ ERROR1J ; is 0 => error +; +; get arg 1 (defaulting if necessary) and range check it. +; + MOV BX,[PARAM1] ; get first argument + OR BX,BX ; do we default it? + JNZ NXTARG ; no, assume it is OK. + MOV BX,[CURRENT] ; Defaults to the current line + CALL CHKRANGE ; Make sure it is good. + MOV [PARAM1],BX ; set it +NXTARG: + CALL FINDLIN ; find first argument line + JNZ ErrorJ ; line not found + MOV [PTR_1],DI +; +; get arg 2 (defaulting if necessary) and range check it. +; + MOV BX,[PARAM2] ; Get the second parameter + OR BX,BX ; do we default it too? + JNZ HAVARGS ; Nope. + MOV BX,[CURRENT] ; Defaults to the current line + MOV [PARAM2],BX ; Stash it away +HAVARGS: + CALL FindLin + JNZ ErrorJ ; line not found + MOV BX,Param2 + INC BX ;Get pointer to line Param2+1 + CALL FINDLIN + MOV [PTR_2],DI ;Save it +; +; We now have true line number arguments and pointers to the relevant places. +; ptr_1 points to beginning of region and ptr_2 points to first byte beyond +; that region. +; +; Check args for correct ordering of first two arguments +; + mov dx,[param1] + cmp dx,[param2] + jbe havargs1 ; first must be <= second + jmp comerr +havargs1: +; +; make sure that the third argument is not contained in the first range +; + MOV DX,[PARAM3] + CMP DX,[PARAM1] ; third must be <= first or + JBE NOERROR + CMP DX,[PARAM2] + JA NoError ; third must be > last + JMP ComErr +NOERROR: +; +; Determine number to move +; + MOV CX,Ptr_2 + SUB CX,Ptr_1 ; Calculate number of bytes to copy + MOV CopySiz,CX + MOV CopyLen,CX ; Save for individual move. + MOV AX,[PARAM4] ; Was count defaulted? + OR AX,AX + JZ SizeOk ; yes, CX has correct value + MUL [COPYSIZ] ; convert to true size + MOV CX,AX ; move to count register + OR DX,DX ; overflow? + JZ SizeOK ; no + JMP MEMERR ; yes, bomb. +SizeOK: + MOV [COPYSIZ],CX +; +; Check to see that we have room to grow by copysiz +; + MOV AX,[ENDTXT] ; get pointer to last byte + MOV DI,[LAST] ; get offset of last location in memory + SUB DI,AX ; remainder of space + CMP DI,CX ; is there at least copysiz room? + JAE HAV_ROOM ; yes + JMP MEMERR +HAV_ROOM: +; +; Find destination of move/copy +; + MOV BX,[PARAM3] + CALL FINDLIN + MOV [PTR_3],DI +; +; open up copysiz bytes of space at destination +; +; move (p3, p3+copysiz, endtxt-p3); +; + MOV SI,EndTxt ; get source pointer to end + MOV CX,SI + SUB CX,DI ; number of bytes from here to end + INC CX ; remember ^Z at end + MOV DI,SI ; destination starts at end + ADD DI,[COPYSIZ] ; plus size we are opening + MOV [ENDTXT],DI ; new end point + STD ; go backwards + REP MOVSB ; and store everything + CLD ; go forward +; +; relocate ptr_1 and ptr_2 if we moved them +; + MOV BX,Ptr_3 + CMP BX,Ptr_1 ; was dest before source? + JA NoReloc ; no, above. no relocation + MOV BX,CopySiz + ADD Ptr_1,BX + ADD Ptr_2,BX ; relocate pointers +NoReloc: +; +; Now we copy for count times copylen bytes from ptr_1 to ptr_3 +; +; move (ptr_1, ptr_3, copylen); +; + MOV BX,Param4 ; count (0 and 1 are both 1) + MOV DI,Ptr_3 ; destination +CopyText: + MOV CX,CopyLen ; number to move + MOV SI,Ptr_1 ; start point + REP MOVSB ; move the bytes + SUB BX,1 ; exhaust count? + JG CopyText ; no, go for more +; +; If we are moving +; + CMP BYTE PTR MovFlg,0 + JZ CopyDone +; +; Delete the source text between ptr_1 and ptr_2 +; +; move (ptr_2, ptr_1, endtxt-ptr_2); +; + MOV DI,Ptr_1 ; destination + MOV SI,Ptr_2 ; source + MOV CX,EndTxt ; pointer to end + SUB CX,SI ; number of bytes to move + CLD ; forwards + REP MOVSB + MOV BYTE PTR ES:[DI],1Ah ; remember ^Z terminate + MOV EndTxt,DI ; new end of file +; +; May need to relocate current line (parameter 3). +; + MOV BX,Param3 ; get new current line + CMP BX,Param1 ; do we need to relocate + JBE CopyDone ; no, current line is before removed M002 + ADD BX,Param1 ; add in first + SUB BX,Param2 ; current += first-last - 1; + DEC BX + MOV Param3,BX +CopyDone: +; +; we are done. Make current line the destination +; + MOV BX,Param3 ; set parameter 3 to be current + CALL FINDLIN + MOV [POINTER],DI + MOV [CURRENT],BX + return + +Break + +; +; MoveFile moves the text in the buffer to create a hole +; +; Inputs: DX is spot in buffer for destination +; DI is spot in buffer for source +MOVEFILE: + MOV CX,[ENDTXT] ;Get End-of-text marker + MOV SI,CX + SUB CX,DI ;Calculate number of bytes to copy + INC CX ; remember ^Z + MOV DI,DX + STD + REP MOVSB ;Copy CX bytes + XCHG SI,DI + CLD + INC DI + MOV BP,SI +SETPTS: + MOV [POINTER],DI ;Current line is first free loc + MOV [CURRENT],BX ; in the file + MOV [ENDTXT],BP ;End-of-text is last free loc before + return + +NAMERR: + cmp ax,error_file_not_found + jne otherMergeErr + MOV DX,OFFSET DG:FILENM_ptr + JMP COMERR1 + +otherMergeErr: + MOV DX,OFFSET DG:BADDRV_ptr + JMP COMERR1 + +PUBLIC MERGE +MERGE: + CMP ParamCt,1 + JZ MergeOK + JMP Comerr +MergeOK: + CALL KILL_BL + DEC SI + MOV DI,OFFSET DG:MRG_PATH_NAME + XOR CX,CX + CLD +MRG1: + LODSB + CMP AL," " + JE MRG2 + CMP AL,9 + JE MRG2 + CMP AL,CR + JE MRG2 + CMP AL,";" + JE MRG2 + STOSB + JMP SHORT MRG1 +MRG2: + MOV BYTE PTR[DI],0 + DEC SI + MOV [COMLINE],SI + +;========================================================================= +; implement EXTENDED OPEN +;========================================================================= + + push es ;an000;save reg. + mov bx,ext_read ;an000;open for read + mov cx,ATTR ;an000;file attributes + mov dx,OPEN_FLAG ;an000;action to take on open + mov di,0ffffh ;an000;null parm list + call EXT_OPEN3 ;an000;create file;DMS:6/10/87 + pop es ;an000;restore reg. + +;========================================================================= + + JC NAMERR + + MOV [MRG_HANDLE],AX + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H + MOV DX,OFFSET DG:ABORTMERGE + INT 21H + MOV BX,[PARAM1] + OR BX,BX + JNZ MRG + MOV BX,[CURRENT] + CALL CHKRANGE +MRG: + CALL FINDLIN + MOV BX,DX + MOV DX,[LAST] + CALL MOVEFILE + MOV DX,[POINTER] + MOV CX,[ENDTXT] + SUB CX,[POINTER] + PUSH CX + MOV BX,[MRG_HANDLE] + MOV AH,READ + INT 21H + POP DX + MOV CX,AX + CMP DX,CX + JA FILEMRG ; M005 + MOV DX,OFFSET DG:MRGERR_ptr + call std_printf + MOV CX,[POINTER] + JMP SHORT RESTORE +FILEMRG: + ADD CX,[POINTER] + MOV SI,CX + dec si + LODSB + CMP AL,1AH + JNZ RESTORE + dec cx +RESTORE: + MOV DI,CX + MOV SI,[ENDTXT] + INC SI + MOV CX,[LAST] + SUB CX,SI + inc cx ; remember ^Z + REP MOVSB + dec di ; unremember ^Z + MOV [ENDTXT],DI + MOV BX,[MRG_HANDLE] + MOV AH,CLOSE + INT 21H + return + +PUBLIC INSERT +INSERT: + CMP ParamCt,1 + JBE OKIns + JMP ComErr +OKIns: + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H ;Set vector 23H + MOV DX,OFFSET DG:ABORTINS + INT 21H + MOV BX,[PARAM1] + OR BX,BX + JNZ INS + MOV BX,[CURRENT] + CALL CHKRANGE +INS: + CALL FINDLIN + MOV BX,DX + MOV DX,[LAST] + CALL MOVEFILE +INLP: + CALL SETPTS ;Update the pointers into file + CALL SHOWNUM + MOV DX,OFFSET DG:EDITBUF + MOV AH,STD_CON_STRING_INPUT + INT 21H + CALL LF + MOV SI,2 + OFFSET DG:EDITBUF + CMP BYTE PTR [SI],1AH + JZ ENDINS +;----------------------------------------------------------------------- + call unquote ;scan for quote chars if any +;----------------------------------------------------------------------- + MOV CL,[SI-1] + MOV CH,0 + MOV DX,DI + INC CX + ADD DX,CX + JC MEMERRJ1 + JZ MEMERRJ1 + CMP DX,BP + JB MEMOK +MEMERRJ1: + CALL END_INS + JMP MEMERR +MEMOK: + REP MOVSB + MOV AL,10 + STOSB + INC BX + JMP SHORT INLP + +ABORTMERGE: + MOV DX,OFFSET DG:START + MOV AH,SET_DMA + INT 21H + +ABORTINS: + MOV AX,CS ;Restore segment registers + MOV DS,AX + MOV ES,AX + MOV AX,CSTACK + MOV SS,AX + MOV SP,STACK + STI + CALL CRLF + CALL ENDINS + JMP COMOVER + +ENDINS: + CALL END_INS + return + +END_INS: + MOV BP,[ENDTXT] + MOV DI,[POINTER] + MOV SI,BP + INC SI + MOV CX,[LAST] + SUB CX,BP + REP MOVSB + DEC DI + MOV [ENDTXT],DI + MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H + MOV DX,OFFSET DG:ABORTCOM + INT 21H + return + + +FILLBUF: + MOV [PARAM1],-1 ;Read in max. no of lines + MOV ParamCt,1 + CALL APPEND + MOV Param1,0 +PUBLIC ENDED +ENDED: + +;Write text out to .$$$ file + + CMP ParamCt,1 + JZ ENDED1 +CERR: JMP ComErr +Ended1: + CMP Param1,0 + JNZ Cerr + MOV BYTE PTR [ENDING],1 ;Suppress memory errors + MOV BX,-1 ;Write max. no of lines + CALL WRT + TEST BYTE PTR [HAVEOF],-1 + JZ FILLBUF + MOV DX,[ENDTXT] + MOV CX,1 + MOV BX,[WRT_HANDLE] + MOV AH,WRITE + INT 21H ;Write end-of-file byte + +;Close input file ; MZ 11/30 + ; MZ 11/30 + MOV BX,[RD_HANDLE] ; MZ 11/30 + MOV AH,CLOSE ; MZ 11/30 + INT 21H ; MZ 11/30 + +;Close .$$$ file + + MOV BX,[WRT_HANDLE] + MOV AH,CLOSE + INT 21H + +;Rename original file .BAK + + MOV DI,[EXT_PTR] + MOV SI,OFFSET DG:BAK + MOVSW + MOVSW + MOVSB + MOV DX,OFFSET DG:PATH_NAME + MOV DI,OFFSET DG:TEMP_PATH + MOV AH,RENAME + INT 21H + MOV DI,[EXT_PTR] + MOV SI,OFFSET DG:$$$FILE + MOVSW + MOVSW + MOVSB + +;Rename .$$$ file to original name + + MOV DX,OFFSET DG:TEMP_PATH + MOV DI,OFFSET DG:PATH_NAME + MOV AH,RENAME + INT 21H + ; mode + mov ah,exit + xor al,al + int 21h + +;========================================================================= +; EDLIN_DISP_GET: This routine will give us the attributes of the +; current display, which are to be used to restore the screen +; back to its original state on exit from EDLIN. We also +; set the screen to a text mode here with an 80 X 25 color +; format. +; +; Inputs : VIDEO_GET - 0fH (get current video mode) +; VIDEO_SET - 00h (set video mode) +; VIDEO_TEXT- 03h (80 X 25 color mode) +; +; Outputs : VIDEO_ORG - Original video attributes on entry to EDLIN +; +;========================================================================= + +EDLIN_DISP_GET proc near ;an000;video attributes + + push ax ;an000;save affected regs. + push bx ;an000; + push cx ;an000; + push dx ;an000; + push si ;an000; + push ds ;an000; + + push cs ;an000;exchange cs/ds + pop ds ;an000; + + mov ax,440Ch ;an000;generic ioctl + mov bx,Std_Out ;an000;Console + mov cx,(Display_Attr shl 8) or Get_Display ;an000;get display + mov dx,offset dg:Video_Buffer ;an000;buffer for video attr. + int 21h ;an000; +; $if nc ;an000;function returned a + JC $$IF17 + ; buffer + mov si,dx ;an000;get pointer + mov ax,word ptr dg:[si].Display_Length_Char ;an000;get video len. + dec ax ;an000;allow room for message + mov dg:Disp_Len,al ;an000;put it into var. + mov ax,word ptr dg:[si].Display_Width_Char ;an000;get video width + mov dg:Disp_Width,al ;an000;put it into var. +; $else ;an000;function failed use + JMP SHORT $$EN17 +$$IF17: + ; default values + mov al,Def_Disp_Len ;an000;get default length + dec al ;an000;leave room for messages + mov dg:Disp_Len,al ;an000;use default length + mov dg:Disp_Width,Def_Disp_Width;an000;use default width +; $endif ;an000; +$$EN17: + + pop ds ;an000;restore affected regs. + pop si ;an000; + pop dx ;an000; + pop cx ;an000; + pop bx ;an000; + pop ax ;an000; + + ret ;an000;return to caller + +EDLIN_DISP_GET endp ;an000;end proc. + + +;========================================================================= +; EXT_OPEN1 : This routine opens a file for read/write access. If the file +; if not present for opening the open will fail and return with a +; carry set. +; +; Inputs : BX - Open mode +; CX - File attributes +; DX - Open action +; +; Outputs: CY - If error +; +; Date : 6/10/87 +;========================================================================= + +EXT_OPEN1 proc near ;an000;open for R/W + + assume ds:dg + push ds ;an000;save regs + push si ;an000; + + mov ah,ExtOpen ;an000;extended open + mov al,0 ;an000;reserved by system + mov si,offset dg:path_name ;an000;point to PATH_NAME + + int 21h ;an000;invoke function + pop si ;an000;restore regs + pop ds ;an000; + + ret ;an000;return to caller + +EXT_OPEN1 endp ;an000;end proc. + +;========================================================================= +; EXT_OPEN2 : This routine will attempt to create a file for read/write +; access. If the files exists the create will fail and return +; with the carry set. +; +; Inputs : BX - Open mode +; CX - File attributes +; DX - Open action +; +; Outputs: CY - If error +; +; Date : 6/10/87 +;========================================================================= + +EXT_OPEN2 proc near ;an000;create a file + + assume ds:dg + push ds ;an000;save regs + push si ;an000; + + mov ah,ExtOpen ;an000;extended open + mov al,0 ;an000;reserved by system + mov si,offset dg:temp_path ;an000;point to TEMP_PATH + + int 21h ;an000;invoke function + + pop si ;an000;restore regs + pop ds ;an000; + + ret ;an000;return to caller + +EXT_OPEN2 endp ;an000;end proc. + +;========================================================================= +; EXT_OPEN3 : This routine will attempt to create a file for read +; access. If the files exists the create will fail and return +; with the carry set. +; +; Inputs : BX - Open mode +; CX - File attributes +; DX - Open action +; +; Outputs: CY - If error +; +; Date : 6/10/87 +;========================================================================= + +EXT_OPEN3 proc near ;an000;create a file + + assume ds:dg + push ds ;an000;save regs + push si ;an000; + + mov ah,ExtOpen ;an000;extended open + mov al,0 ;an000;reserved by system + mov si,offset dg:mrg_path_name ;an000;point to mrg_path_name + + int 21h ;an000;invoke function + + pop si ;an000;restore regs + pop ds ;an000; + + ret ;an000;return to caller + +EXT_OPEN3 endp ;an000;end proc. + + +;========================================================================= +; EDLIN_COMMAND : This routine provides an interface between the new +; parser and the existing logic of EDLIN. We will be +; interfacing the parser with three existing variables. +; +; Inputs : FILESPEC - Filespec entered by the user and passed by +; the parser. +; +; PARSE_SWITCH_B - Contains the result of the parse for the +; /B switch. This is passed by the parser. +; +; Outputs: PATH_NAME - Filespec +; LOADMOD - Flag for /B switch +; FNAME_LEN - Length of filespec +; +; Date : 6/11/87 +;========================================================================= + +EDLIN_COMMAND proc near ;an000;interface parser + + push ax ;an000;save regs. + push cx ;an000; + push di ;an000 + push si ;an000; + + mov si,offset dg:filespec ;an000;get its offset + mov di,offset dg:path_name ;an000;get its offset + + mov cx,00h ;an000;cx will count filespec + ; length + cmp parse_switch_b,true ;an000;do we have /B switch +; $if z ;an000;we have the switch + JNZ $$IF20 + mov [LOADMOD],01h ;an000;signal switch found +; $endif ;an000 +$$IF20: + +; $do ;an000;while we have filespec +$$DO22: + lodsb ;an000;move byte to al + cmp al,nul ;an000;see if we are at + ; the end of the + ; filespec +; $leave e ;an000;exit while loop + JE $$EN22 + stosb ;an000;move byte to path_name + inc cx ;an000;increment the length + ; of the filespec +; $enddo ;an000;end do while + JMP SHORT $$DO22 +$$EN22: + + mov [FNAME_LEN],cx ;an000;save filespec's length + + pop si ;an000; restore regs + pop di ;an000; + pop cx ;an000; + pop ax ;an000; + + ret ;an000;return to caller + +EDLIN_COMMAND endp ;an000;end proc + +;========================================================================= +; Get_Extended_Attrib : This routine gets the extended attributes of +; the file that was opened. +; +;========================================================================= + +Get_Extended_Attrib proc near ;an000; dms; + + mov ax,5702h ;an000; dms;get extended attrib + mov si,0ffffh ;an000; dms;all attribs + mov cx,dg:EA_Buffer_Size ;an000; dms;buffer size + mov di,offset dg:Start ;an000; dms;point to buffer + int 21h ;an000; dms; + ret ;an000; dms; + +Get_Extended_Attrib endp ;an000; dms; + + +;========================================================================= +; Query_Extend_Attrib : This routine gets the extended attributes of +; the file that was opened. +; +; Inputs : Start - Buffer for extended attributes +; +; Outputs : CX - size in paras +; +;========================================================================= + +Query_Extend_Attrib proc near ;an000; dms; + + mov ax,5702h ;an000; dms;get extended attrib + mov si,0ffffh ;an000; dms;all attribs + mov cx,0000h ;an000; dms;get buffer size + mov di,offset dg:Start ;an000; dms;point to buffer + int 21h ;an000; dms; + mov dg:EA_Buffer_Size,cx ;an000; dms;save buffer size + ret ;an000; dms; + +Query_Extend_Attrib endp ;an000; dms; + + +;========================================================================= +; Calc_Memory_Avail : This routine will calculate the memory +; available for use by EDLIN. +; +; Inputs : ORG_DS - DS of PSP +; +; Outputs : DX - paras available +;========================================================================= + +Calc_Memory_Avail proc near ;an000; dms; + + push ds ;save ds for size calc + push cx ;an000; dms; + push di ;an000; dms; + + mov ds,cs:[org_ds] + MOV CX,DS:[2] + MOV DI,CS + SUB CX,DI + mov dx,cx ;an000; dms;put paras in DX + + pop di ;an000; dms; + pop cx ;an000; dms; + pop ds ;an000; dms; + + ret ;an000; dms; + +Calc_Memory_Avail endp ;an000; dms; + +;========================================================================= +; EA_Fail_Exit : This routine tells the user that there was +; Insufficient memory and exits EDLIN. +; +; Inputs : MemFul_Ptr - "Insufficient memory" +; +; Outputs : message +;========================================================================= + +EA_Fail_Exit proc near ;an000; dms; + + mov dx,offset dg:MemFul_Ptr ;an000; dms;"Insufficient + + push cs ;an000; dms;xchange ds/cs + pop ds ;an000; dms; + ; memory" + call Std_Printf ;an000; dms;print message + mov ah,exit ;an000; dms;exit + xor al,al ;an000; dms;clear al + int 21h ;an000; dms; + ret ;an000; dms; + +EA_Fail_Exit endp ;an000; dms; + +CODE ENDS + END EDLIN + + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLIN.LNK b/v4.0/src/CMD/EDLIN/EDLIN.LNK new file mode 100644 index 0000000..8b90da5 --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLIN.LNK @@ -0,0 +1,7 @@ +EDLIN+ +EDLCMD1+ +EDLCMD2+ +EDLMES+ +EDLPARSE +EDLIN.EXE; + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLIN.SKL b/v4.0/src/CMD/EDLIN/EDLIN.SKL new file mode 100644 index 0000000..ff5109e --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLIN.SKL @@ -0,0 +1,75 @@ +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: EDLMES.FIL +; +; DESCRIPTIVE NAME: EDLIN MESSAGES +; +; FUNCTION: PROVIDES A SET OF MESSAGES FOR EDLIN. +; +; ENTRY POINT: NA +; +; INPUT: NA +; +; EXIT NORMAL: NA +; +; EXIT ERROR: NA +; +; INTERNAL REFERENCES: NA +; +; EXTERNAL REFERENCES: NA +; +; +; NOTES: THIS MODULE IS TO BE PREPPED BY FASTBLD.EXE. +; +; REVISION HISTORY: +; +; VERSION 4.00 - CREATED FOR DOS 4.00 +; +;======================= END OF SPECIFICATIONS =========================== + +;========================================================================= +; edlin utility message file +;========================================================================= + +:util EDLIN ;utility name +:class 1 + +:class A ;system messages +:use 1 COMMON1 ;"Incorrect DOS version",CR,LF +:use 2 COMMON2 ;"Insufficient memory",CR,LF +:use 3 COMMON3 ;"Error loading messages",CR,LF + +:class B ;utility messages +:def 6 "*" ;prompt_ptr +:def 7 "Invalid drive or file name",CR,LF ;baddrv_ptr +:def 8 "File name must be specified",CR,LF ;ndname_ptr +:def 10 "File is READ-ONLY",CR,LF ;ro_err_ptr +:def 11 "File Creation Error",CR,LF ;bcreat_ptr +:def 12 "Too many files open",CR,LF ;too_many_ptr +:def 13 "Read error in:",CR,LF,"%1",CR,LF ;read_err_ptr +:def 14 "Cannot edit .BAK file--rename file",CR,LF ;nobak_ptr +:def 15 "No room in directory for file",CR,LF ;nodir_ptr +:def 16 "Disk full. Edits lost.",CR,LF ;dskful_ptr +:def 18 "Entry error",CR,LF ;badcom_ptr +:def 19 "New file",CR,LF ;newfil_ptr +:def 20 "Not found",CR,LF ;nosuch_ptr + +:class C ;utility messages +:def 21 "O.K.? " ;ask_ptr +:def 22 "Line too long",CR,LF ;toolng_ptr +:def 23 "End of input file",CR,LF ;eof_ptr +:def 24 "Abort edit (Y/N)? " ;qmes_ptr +:def 25 "Must specify destination line number",CR,LF ;dest_ptr +:def 26 "Not enough room to merge the entire file",CR,LF ;mrgerr_ptr +:def 27 CR,LF ;crlf_ptr +:def 28 LF ;lf_ptr +:def 29 "Continue (Y/N)?" ;cont_ptr +:def 30 "Unable to print message",CR,LF ;fatal_error +:def 31 "%1" ;arg_buf_ptr +:def 32 "%1:%2" ;line_num_buf_ptr +:def 33 "Cannot merge - Code page mismatch",CR,LF ;cp_err_ptr + +:end + +;========================================================================= +;========================================================================= diff --git a/v4.0/src/CMD/EDLIN/EDLMES.ASM b/v4.0/src/CMD/EDLIN/EDLMES.ASM new file mode 100644 index 0000000..889a044 --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLMES.ASM @@ -0,0 +1,665 @@ + PAGE 60,132; + title EDLIN Messages +;======================= START OF SPECIFICATIONS ========================= +; +; MODULE NAME: EDLMES.SAL +; +; DESCRIPTIVE NAME: MESSAGE RETRIEVER INTERFACE MODULE +; +; FUNCTION: THIS MODULE PROVIDES AN INTERFACE FOR THE MODULES THAT ARE +; NEEDED TO INVOKE THE MESSAGE RETRIEVER. +; +; ENTRY POINT: PRINTF +; +; INPUT: OFFSET CARRIED IN DX TO APPLICABLE MESSAGE TABLE +; +; EXIT NORMAL: NO CARRY +; +; EXIT ERROR : CARRY +; +; INTERNAL REFERENCES: +; +; ROUTINE: PRINTF - PROVIDES THE ORIGINAL INTERFACE FOR THE ORIGINAL +; PRINTF USED PRIOR TO VERSION 4.00. PRINTS MESSAGES. +; +; DISP_MESSAGE - BUILDS THE REGISTERS NECESSARY FOR INVOCATION +; OF THE MESSAGE RETRIEVER, BASED ON THE TABLE +; POINTED TO BY DX. +; +; DISP_FATAL - INVOKED IF AN ERROR OCCURS (CARRY) IN THE +; MESSAGE RETRIEVER. IT DISPLAYS THE APPROPRIATE +; MESSAGE. +; +; EXTERNAL REFERENCES: +; +; ROUTINE: SYSLOADMSG - LOAD MESSAGES FOR THE MESSAGE RETRIEVER +; SYSDISPMSG - DISPLAYS THE REQUESTED MESSAGE +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS +; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE +; +; REVISION HISTORY: +; +; AN000 VERSION DOS 4.00 - IMPLEMENTATION OF MESSAGE RETRIEVER +; +; COPYRIGHT: "MS DOS EDLIN UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" +; "LICENSED MATERIAL - PROPERTY OF Microsoft " +; +; MICROSOFT REVISION HISTORY +; +; MODIFIED BY: AARON R +; M.A. U +; N. P +;======================= END OF SPECIFICATIONS =========================== + +.xlist + +include sysmsg.inc ;an000;message retriever + +msg_utilname ;an000;EDLIN messages +.list +;-----------------------------------------------------------------------; +; ; +; Done for Vers 2.00 (rev 9) by Aaron R ; +; Update for rev. 11 by M.A. U ; +; Printf for 2.5 by Nancy P ; +; ; +;-----------------------------------------------------------------------; + +;========================================================================= +; revised edlmes.asm +;========================================================================= + +fatal_error equ 30 ;an000;fatal message handler +unlim_width equ 00h ;an000;unlimited output width +pad_blank equ 20h ;an000;blank pad +pre_load equ 00h ;an000;normal pre-load + + + +message_table struc ;an000;struc for message table + + entry1 dw 0 ;an000;message number + entry2 db 0 ;an000;message type + entry3 dw 0 ;an000;display handle + entry4 dw 0 ;an000;pointer to sublist + entry5 dw 0 ;an000;substitution count + entry6 db 0 ;an000;use keyb input? + entry7 dw 0 ;an000;keyb buffer to use + +message_table ends ;an000;end struc + +;========================================================================= +; macro disp_message: this macro takes a pointer to a message table +; and displays the applicable message based on +; the table's contents. +; this is to provide an interface into the module +; of the message retriever, SYSDISPMSG. +; +; Date : 6/11/87 +;========================================================================= + +disp_message macro tbl ;an000;display message macro + + push bx ;an000; + push cx ;an000; + push dx ;an000; + push di ;an000; + push si ;an000; + + push tbl ;an000;exchange tbl with si + pop si ;an000;exchanged + + mov ax,[si].entry1 ;an000;move message number + mov bx,[si].entry3 ;an000;display handle + mov cx,[si].entry5 ;an000;number of subs + mov dl,[si].entry6 ;an000;function type + mov di,[si].entry7 ;an000;input buffer if appl. + mov dh,[si].entry2 ;an000;message type + mov si,[si].entry4 ;an000;sublist + + call sysdispmsg ;an000;display the message + + pop si ;an000;restore affected regs + pop di ;an000; + pop dx ;an000; + pop cx ;an000; + pop bx ;an000; + +endm ;an000;end macro disp_message + +;========================================================================= +; macro disp_message: end macro +;========================================================================= + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE +CONST ENDS + +cstack segment stack +cstack ends + +DATA SEGMENT PUBLIC BYTE + + extrn path_name:byte + +DATA ENDS + +DG GROUP CODE,CONST,cstack,DATA + +code segment public byte ;an000;code segment + assume cs:dg,ds:dg,es:dg,ss:CStack ;an000; + + public printf ;an000;share printf + public disp_fatal ;an000;fatal error display + public pre_load_message ;an000;message loader + +.xlist +msg_services ;an000; +.list + +;======================= sysmsg.inc invocation =========================== +; +; include sysmsg.inc - message retriever services +; +; +; options selected: +; NEARmsg +; DISPLAYmsg +; LOADmsg +; CHARmsg +; NUMmsg +; CLSAmsg +; CLSBmsg +; CLSCmsg +; +;========================================================================= + +.xlist + + msg_services ;an000;no version check + msg_services ;an000;display messages + msg_services ;an000;message types + msg_services ;an000;message types + msg_services ;an000; + +.list + +;========================================================================= +; printf: printf is a replacement of the printf procedure used in DOS +; releases prior to 4.00. printf invokes the macro disp_message +; to display a message through the new message handler. the +; interface into printf will continue to be a pointer to a message +; passed in DX. the pointer is pointing to more than a message +; now. it is pointing to a table for that message containing +; all relevant information for printing the message. the macro +; disp_message operates on these tables. +; +; Date : 6/11/87 +;========================================================================= + +printf proc near ;an000;printf procedure + + disp_message dx ;an000;display a message +; $if c ;an000;if an error occurred + JNC $$IF1 + call disp_fatal ;an000;display the fatal error +; $endif ;an000; +$$IF1: + + ret ;an000;return to caller + +printf endp ;an000;end printf proc + + +;========================================================================= +; disp_fatal: this routine displays a fatal error message in the event +; an error occurred in disp_message. +; +; Date : 6/11/87 +;========================================================================= + +disp_fatal proc near ;an000;fatal error message + + mov ax,fatal_error ;an000;fatal_error number + mov bx,stdout ;an000;print to console + mov cx,0 ;an000;no parameters + mov dl,no_input ;an000;no keyboard input + mov dh,UTILITY_MSG_CLASS ;an000;utility messages + + call sysdispmsg ;an000;display fatal error + + ret ;an000;return to caller + +disp_fatal endp ;an000;end disp_fatal proc + +;========================================================================= +; PRE_LOAD_MESSAGE : This routine provides access to the messages required +; by EDLIN. This routine will report if the load was +; successful. An unsuccessful load will cause EDLIN +; to terminate with an appropriate error message. +; +; Date : 6/11/87 +;========================================================================= + +PRE_LOAD_MESSAGE proc near ;an000;pre-load messages + + + call SYSLOADMSG ;an000;invoke loader + +; $if c ;an000;if an error + JNC $$IF3 + pushf ;an000;save flags + call SYSDISPMSG ;an000;let him say why + popf ;an000;restore flags +; $endif ;an000; +$$IF3: + + ret ;an000;return to caller + +PRE_LOAD_MESSAGE endp ;an000;end proc + +include msgdcl.inc + +code ends ;an000;end code segment + + + + +CONST SEGMENT PUBLIC BYTE + + extrn arg_buf:byte ;an000; + extrn line_num:byte ;an000; + extrn line_flag:byte ;an000; + extrn Temp_Path:byte ;an000; + + public baddrv_ptr,bad_vers_err,opt_err_ptr,nobak_ptr + public too_many_ptr,dskful_ptr,memful_ptr,badcom_ptr + public nodir_ptr,filenm_ptr,newfil_ptr,read_err_ptr + public nosuch_ptr,toolng_ptr,eof_ptr,dest_ptr + public mrgerr_ptr,ro_err_ptr,bcreat_ptr,ndname_ptr + public ask_ptr,qmes_ptr,crlf_ptr,lf_ptr,yes_byte + public prompt_ptr + public line_num_buf_ptr ;an000;DMS:6/15/87 + public arg_buf_ptr ;an000;DMS:6/15/87 + public cont_ptr ;an000;DMS:6/18/87 + public cp_err_ptr ;an000;DMS:6/22/87 + public Del_Bak_Ptr ;an000;dms; + + yes_byte db "y" + +;============== REPLACEABLE PARAMETER SUBLIST STRUCTURE ================== +; +; byte 1 - substitution list size, always 11 +; byte 2 - reserved for use by message handler +; byte 3 - pointer to parameter to be used as a substitution +; byte 7 - which parameter is this to replace, %1, %2, etc. +; byte 8 - determines how the parameter is to be output +; byte 9 - determines the maximum width of the parameter string +; byte 10 - determines the minimum width of the parameter string +; byte 11 - define what is to be used as a pad character +; +;========================================================================= + +;========================================================================= +; replaceable parameter sublists +;========================================================================= + +ed_read_sub label dword ;an000;a read error occurred + + db 11 ;an000;sublist size + db 00 ;an000;reserved + dd dg:path_name ;an000;pointer to parameter + db 01 ;an000;parm 1 + db Char_Field_ASCIIZ ;an000;left align/asciiz/char. + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width of 0 + db pad_blank ;an000;pad with blanks + +arg_sub label dword ;an000;line output buffer + + db 11 ;an000;sublist size + db 00 ;an000;reserved + dd dg:arg_buf ;an000;pointer to parameter + db 01 ;an000;parm 1 + db Char_Field_ASCIIZ ;an000;left align/asciiz/char. + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width of 0 + db pad_blank ;an000;pad with blank + +num_sub label dword ;an000;line number + + db 11 ;an000;sublist size + db 00 ;an000;reserved + dd dg:line_num ;an000;pointer to parameter + db 01 ;an000;parm 1 + db Right_Align+Unsgn_Bin_Word ;an000;right align/decimal + db 08 ;an000;maximum width + db 08 ;an000;minimum width of 0 + db pad_blank ;an000;pad with blank + + db 11 ;an000;optional flag + db 00 ;an000;reserved + dd dg:line_flag ;an000;pointer to parameter + db 02 ;an000;parm 2 + db Char_Field_Char ;an000;character + db 01 ;an000;minimum width of 1 + db 01 ;an000;maximum width of 1 + db pad_blank ;an000;pad with blank + +BAK_Sub label dword ;an000;line output buffer + + db 11 ;an000;sublist size + db 00 ;an000;reserved + dd dg:Temp_Path ;an000;pointer to parameter + db 00 ;an000;parm 0 + db Char_Field_ASCIIZ ;an000;left align/asciiz/char. + db unlim_width ;an000;unlimited width + db 00 ;an000;minimum width of 0 + db pad_blank ;an000;pad with blank + + +;========================================================================= +; end replaceable parameter sublists +;========================================================================= + +;======================= TABLE STRUCTURE ================================= +; +; bute 1-2 : message number of message to be displayed +; byte 3 : message type to be used, i.e.;class 1, utility, etc. +; byte 4-5 : display handle, i.e.; console, printer, etc. +; byte 6-7 : pointer to substitution list, if any. +; byte 8-9 : number of replaceable parameters, if any. +; byte 10 : type of input from keyboard, if any. +; byte 11-12: pointer to buffer for keyboard input, if any. +; +;========================================================================= + + +bad_vers_err label word ;an000;"Incorrect DOS version" + dw 0001 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +prompt_ptr label word ;an000;"*",0 + dw 0006 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +baddrv_ptr label word ;an000;"Invalid drive or file name" + ;an000;,0d,0a,0 + dw 0007 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +ndname_ptr label word ;an000;"File name must be + ;an000;specified",0d,0a,0 + dw 0008 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +opt_err_ptr label word ;an000;"Invalid parameter",0d,0a,0 + dw 0010 ;an000;message number + db Parse_Err_Class ;an000;utility message + dw StdErr ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +ro_err_ptr label word ;an000;"File is READ-ONLY",0d,0a,0 + dw 0010 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +bcreat_ptr label word ;an000;"File Creation Error",0d,0a,0 + dw 0011 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +too_many_ptr label word ;an000;"Too many files open",0d,0a,0 + dw 0012 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +read_err_ptr label word ;an000;"Read error in:", + ;an000;0d,0a,"%1",0d,0a,0 + dw 0013 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:ed_read_sub ;an000;point to sublist + dw 0001 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + + +nobak_ptr label word ;an000;"Cannot edit .BAK file + ;an000;--rename file",0d,0a,0 + dw 0014 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +nodir_ptr label word ;an000;"No room in directory + ;an000;for file",0d,0d,0 + dw 0015 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +dskful_ptr label word ;an000;"Disk full. Edits lost.",0d,0a,0 + dw 0016 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +memful_ptr label word ;an000;"Insufficient memory",0d,0a,0 + dw 0008 ;an000;message number + db Ext_Err_Class ;an000;extended error + dw stderr ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +filenm_ptr label word ;an000;"File not found",0d,0a + dw 0002 ;an000;message number + db Ext_Err_Class ;an000;utility message + dw stderr ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +badcom_ptr label word ;an000;"Entry error",0d,0a,0 + dw 0018 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +newfil_ptr label word ;an000;"New file",0d,0a,0 + dw 0019 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +nosuch_ptr label word ;an000;"Not found",0d,0a,0 + dw 0020 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +ask_ptr label word ;an000;"O.K.? ",0 + dw 0021 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db DOS_KEYB_INP ;an000;keyboard input - AX + dw 00 ;an000;no keyboard buffer + +toolng_ptr label word ;an000;"Line too long",0d,0a,0 + dw 0022 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +eof_ptr label word ;an000;"End of input file",0d,0a,0 + dw 0023 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +qmes_ptr label word ;an000;"Abort edit (Y/N)? ",0 + dw 0024 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db DOS_KEYB_INP ;an000;keyboard input - AX + dw 00 ;an000;no keyboard buffer + +dest_ptr label word ;an000;"Must specify destination + ;an000;line number",0d,0a,0 + dw 0025 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +mrgerr_ptr label word ;an000;"Not enough room to + ;an000;merge the entire file",0d,0a,0 + dw 0026 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +crlf_ptr label word ;an000;0d,0a,0 + dw 0027 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +lf_ptr label word ;an000;0a,0 + dw 0028 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +cont_ptr label word ;an000;"Continue (Y/N)?" + dw 0029 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no sub + db DOS_KEYB_INP ;an000;keyboard input + dw 00 ;an000;no keyboard buffer + +arg_buf_ptr label word ;an000;argument buffer for + ; line output + dw 0031 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:arg_sub ;an000;argument sublist + dw 01 ;an000;1 sub + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +line_num_buf_ptr label word ;an000;holds line numbers + dw 0032 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw dg:num_sub ;an000;argument sublist + dw 02 ;an000;2 subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +cp_err_ptr label word ;an000;"Cannot merge - Code page + ; mismatch",0d,0a + dw 0033 ;an000;message number + db UTILITY_MSG_CLASS ;an000;utility message + dw stdout ;an000;display handle + dw 00 ;an000;no sublist + dw 00 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +del_bak_ptr label word ;an000;"Access Denied - xxxxxxxx.BAK" + dw 0005 ;an000;message number + db Ext_Err_Class ;an000;utility message + dw stderr ;an000;display handle + dw dg:BAK_Sub ;an000;no sublist + dw 01 ;an000;no subs + db no_input ;an000;no keyboard input + dw 00 ;an000;no keyboard buffer + +CONST ENDS + END + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLPARSE.ASM b/v4.0/src/CMD/EDLIN/EDLPARSE.ASM new file mode 100644 index 0000000..32f6f4c --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLPARSE.ASM @@ -0,0 +1,281 @@ + + page 60,132; + title EDLPARSE for EDLIN + + +;******************* START OF SPECIFICATIONS ***************************** +; +; MODULE NAME: EDLPARSE.SAL +; +; DESCRIPTIVE NAME: PARSES THE EXTERNAL COMMAND LINE FOR EDLIN +; +; FUNCTION: THIS ROUTINE PROVIDES PARSING CAPABILITIES FOR THE +; EXTERNAL COMMAND LINE OF EDLIN. IT PARSES FOR THE PRESENCE +; OF A REQUIRED FILESPEC AND AN OPTIONAL SWITCH (/B). +; +; ENTRY POINT: PARSER_COMMAND +; +; INPUT: DOS COMMAND LINE +; +; EXIT NORMAL: AX = 0FFH - VALID SWITCH AND FILESPEC SPECIFIED +; +; EXIT ERROR: AX NOT= 0FFH - INVALID SWITCH OR NO FILESPEC SPECIFIED +; +; INTERNAL REFERENCES +; +; ROUTINE: PARSER_COMMAND - THIS ROUTINE PARSES FOR THE PRESENCE +; OF THE /B SWITCH AND A FILESPEC. THE +; FILEPSEC IS REQUIRED, WHILE THE SWITCH +; IS OPTIONAL. +; +; EXTERNAL REFERENCES: +; +; ROUTINE: PARSE.ASM - THIS IS THE PARSER CODE. +; +; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. +; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE +; +; REVISION HISTORY: +; +; AN000 VERSION 4.00 - IMPLEMENTS THE SYSTEM PARSER (SYSPARSE) +; +; COPYRIGHT: "THE IBM PERSONAL COMPUTER EDLIN UTILITY" +; "VERSION 4.00 (C) COPYRIGHT 1988" +; "LICENSED MATERIAL - PROPERTY OF Microsoft" +; +; +;******************** END OF SPECIFICATIONS ****************************** + + +;======================= equates for edlparse ============================ + +parse_ok equ 0 ;an000;good parse return +parse_command equ 081h ;an000;offset of command line +nul equ 0 ;an000;nul +fs_flag equ 05h ;an000;filespec found +sw_flag equ 03h ;an000;switch found +true equ 0ffffh ;an000;true +false equ 00h ;an000;false +too_many equ 01h ;an000;too many parms + +;======================= end equates ===================================== + + +CODE SEGMENT PUBLIC BYTE +CODE ENDS + +CONST SEGMENT PUBLIC BYTE +CONST ENDS + +cstack segment stack +cstack ends + +DATA SEGMENT PUBLIC BYTE + + extrn path_name:byte + extrn org_ds:word ;an000; dms; + + public parse_switch_b ;an000;parse switch result + public filespec ;an000;actual filespec + +;======================= input parameters control blocks ================= +; these control blocks are used by sysparse and must be pointed to by +; es:di on invocation. + + public parms ;an000;share parms +parms label byte ;an000;parms control block + dw dg:parmsx ;an000;point to parms structure + db 00h ;an000;no additional delims. + +parmsx label byte ;an000;parameter types + db 1,1 ;an000;must have filespec + dw dg:fs_pos ;an000;filespec control block + db 1 ;an000;max. number of switches + dw dg:sw_b ;an000;\b switch control block + db 00h ;an000;no keywords + +;======================= filespec positional tables ====================== + +fs_pos label byte ;an000;filespec positional + dw 0200h ;an000;filespec/not optional + dw 0001h ;an000;cap + dw dg:filespec_res ;an000;filespec result table + dw dg:noval ;an000;value list/none + db 0 ;an000;no keyword/switch syns. + +filespec_res label byte ;an000;filespec result table +parse_fs_res db ? ;an000;must be filespec (05) +parse_fs_tag db ? ;an000;item tag +parse_fs_syn dw ? ;an000;synonym pointer +parse_fs_off dw ? ;an000;offset to filespec +parse_fs_seg dw ? ;an000;segment of filespec + +;======================= switch tables /b ================================ + +sw_b label byte ;an000;/b switch + dw 0000h ;an000;no match flags + dw 0000h ;an000;no cap + dw dg:switch_res ;an000;result buffer + dw dg:noval ;an000;value list/none + db 1 ;an000;1 switch +sw_b_switch db "/B",0 ;an000;/B means ignore CTL-Z + +switch_res label byte ;an000;switch result table +parse_sw_res db ? ;an000;must be string (03) +parse_sw_tag db ? ;an000;item tag +parse_sw_syn dw ? ;an000;synonym pointer +parse_sw_ptr dd ? ;an000;pointer to result + +noval label byte ;an000;value table + db 0 ;an000;no values + + +;======================= end input parameter control blocks ============== + +filespec db 128 dup (0) ;an000;holds filespec +parse_switch_b db ? ;an000;hold boolean result + ; of /b parse +parse_sw_b db "/B" ;an000;comparison switch + +DATA ENDS + +DG GROUP CODE,CONST,cstack,DATA + +code segment public byte ;an000;code segment + assume cs:dg,ds:dg,es:dg,ss:CStack ;an000; + + public parser_command ;an000;share this routine + + + +;======================= begin main routine ============================== +.xlist + +include parse.asm ;an000;parser + +.list + +parser_command proc near ;an000;parse routine + + push es ;an000;save registers + push ds ;an000; + push di ;an000; + push si ;an000; + + mov dg:parse_switch_b,false ;an000;init. to false + xor cx,cx ;an000;set cx to 0 + xor dx,dx ;an000;set dx to 0 + mov di,offset dg:parms ;an000;point to parms + mov si,parse_command ;an000;point to ds:81h + mov ds,dg:org_ds ;an000;get ds at entry + assume ds:nothing ;an000; + +parse_continue: ;an000;loop return point + + call sysparse ;an000;invoke parser + cmp ax,parse_ok ;an000;is it a good parse + jne parse_end ;an000;continue on good parse + push si + mov si,dx + cmp byte ptr es:[si],fs_flag ;an000;do we have a filespec +; $if e ;an000;yes we do + JNE $$IF1 + call build_fs ;an000;save filespec +; $else ;an000; + JMP SHORT $$EN1 +$$IF1: + cmp parse_switch_b,true ;an000;see if already set +; $if nz ;an000;if not + JZ $$IF3 + call val_sw ;an000;see which switch +; $else ;an000; + JMP SHORT $$EN3 +$$IF3: + mov ax,too_many ;an000;set error level + jmp parse_end ;an000;exit parser +; $endif ;an000; +$$EN3: +; $endif ;an000; +$$EN1: + + pop si + jmp parse_continue ;an000;continue parsing + +parse_end: ;an000;end parse routine + + pop si ;an000;restore registers + pop di ;an000; for return to caller + pop ds ;an000; + assume ds:dg ;an000; + pop es ;an000; + + ret ;an000;return to caller + +parser_command endp ;an000;end parser_command + + +;======================= subroutine area ================================= + + +;========================================================================= +; build_fs: This routine saves the filespec for use by the calling program. +;========================================================================= + +build_fs proc near ;an000;save filespec + + push ax ;an000;save affected regs. + push di ;an000; + push si ;an000; + push ds ;an000; + push es ;an000; + + mov di,offset dg:filespec ;an000;point to filespec buffer + lds si,dword ptr es:parse_fs_off ;an000;get offset + +build_cont: ;an000;continue routine + + lodsb ;an000;mov ds:si to al + cmp al,nul ;an000;is it end of filespec +; $if nz ;an000;if not + JZ $$IF7 + stosb ;an000;move byte to filespec + jmp build_cont ;an000;continue buffer fill +; $endif ;an000; +$$IF7: + stosb ;an000;save nul + + pop es ;an000;restore regs + pop ds ;an000; + pop si ;an000; + pop di ;an000; + pop ax ;an000; + + ret ;an000;return to caller + +build_fs endp ;an000;end proc + +;========================================================================= +; val_sw : determines which switch we have. +;========================================================================= + +val_sw proc near ;an000;switch determination + + cmp es:parse_sw_syn,offset es:sw_b_switch ;an000;/B switch? +; $if e ;an000;compare good + JNE $$IF9 + mov dg:parse_switch_b,true ;an000;signal /B found +; $else ;an000; + JMP SHORT $$EN9 +$$IF9: + mov dg:parse_switch_b,false ;an000;signal /B not found +; $endif ;an000; +$$EN9: + + ret ;an000;return to caller + +val_sw endp ;an000;end proc + + +code ends ;an000;end segment + end ;an000; + \ No newline at end of file diff --git a/v4.0/src/CMD/EDLIN/EDLSTDSW.INC b/v4.0/src/CMD/EDLIN/EDLSTDSW.INC new file mode 100644 index 0000000..436f09f --- /dev/null +++ b/v4.0/src/CMD/EDLIN/EDLSTDSW.INC @@ -0,0 +1,32 @@ +; SCCSID = @(#)stdsw.asm 1.1 85/04/10 +; Use the switches below to produce the standard Microsoft version or the IBM +; version of the operating system + + +;include EDLVERS.INC ;IBM/MSVER/JAPVER switches + + +WANG EQU FALSE +Rainbow EQU FALSE + + +; Set this switch to cause DOS to move itself to the end of memory +HIGHMEM EQU FALSE + + IF IBM +ESCCH EQU 0 ; character to begin escape seq. +CANCEL EQU 27 ;Cancel with ESCAPE +TOGLPRN EQU TRUE ;One key toggles printer echo +ZEROEXT EQU TRUE + ELSE + IF WANG ;Are we assembling for WANG? +ESCCH EQU 1FH ;Yes. Use 1FH for escape character + ELSE +ESCCH EQU 1BH + ENDIF +CANCEL EQU "X"-"@" ;Cancel with Ctrl-X +TOGLPRN EQU FALSE ;Separate keys for printer echo on + ;and off +ZEROEXT EQU TRUE + ENDIF + diff --git a/v4.0/src/CMD/EDLIN/MAKEFILE b/v4.0/src/CMD/EDLIN/MAKEFILE new file mode 100644 index 0000000..d01bbb1 --- /dev/null +++ b/v4.0/src/CMD/EDLIN/MAKEFILE @@ -0,0 +1,56 @@ +#************************** makefile for cmd\append *************************** + +msg =..\..\messages +dos =..\..\dos +inc =..\..\inc +hinc =..\..\h + +# +####################### dependencies begin here. ######################### +# + +all: edlin.com + +edlin.ctl: edlin.skl \ + $(msg)\$(COUNTRY).msg \ + makefile + + +edlin.obj: edlin.asm edlequ.asm edlstdsw.inc makefile \ + $(inc)\dossym.inc \ + $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\buffer.inc \ + $(inc)\sysvar.inc $(inc)\mult.inc $(inc)\dirent.inc \ + $(inc)\dpb.inc $(inc)\curdir.inc $(inc)\cpmfcb.inc \ + $(inc)\find.inc $(inc)\pdb.inc $(inc)\sf.inc $(inc)\arena.inc \ + $(inc)\intnat.inc $(inc)\error.inc $(inc)\syscall.inc + +edlcmd1.obj: edlcmd1.asm edlequ.asm edlstdsw.inc makefile \ + $(inc)\dossym.inc \ + $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\buffer.inc \ + $(inc)\sysvar.inc $(inc)\mult.inc $(inc)\dirent.inc \ + $(inc)\dpb.inc $(inc)\curdir.inc $(inc)\cpmfcb.inc \ + $(inc)\find.inc $(inc)\pdb.inc $(inc)\sf.inc $(inc)\arena.inc \ + $(inc)\intnat.inc $(inc)\error.inc $(inc)\syscall.inc + +edlcmd2.obj: edlcmd2.asm edlequ.asm edlstdsw.inc makefile \ + $(inc)\dossym.inc \ + $(inc)\dosmac.inc $(inc)\bpb.inc $(inc)\buffer.inc \ + $(inc)\sysvar.inc $(inc)\mult.inc $(inc)\dirent.inc \ + $(inc)\dpb.inc $(inc)\curdir.inc $(inc)\cpmfcb.inc \ + $(inc)\find.inc $(inc)\pdb.inc $(inc)\sf.inc $(inc)\arena.inc \ + $(inc)\intnat.inc $(inc)\error.inc $(inc)\syscall.inc + +edlmes.obj: edlmes.asm $(inc)\sysmsg.inc makefile \ + edlin.ctl \ + edlin.cla \ + edlin.clb \ + edlin.cl1 \ + edlin.cl2 \ + +edlparse.obj: edlparse.asm $(inc)\parse.asm makefile + +edlin.com: edlin.obj edlcmd1.obj edlcmd2.obj edlmes.obj edlparse.obj \ + edlin.lnk makefile + link @edlin.lnk + convert edlin.exe + del edlin.exe -- cgit v1.2.3