⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e3.asm

📁 e3 是一个全屏的用户友好的文本编辑器
💻 ASM
📖 第 1 页 / 共 5 页
字号:
	mov al,byte [edi]	xchg al,byte [edi-1]	call KeyVICmdr2			;mov byte [edi],al / mov byte [changed],CHANGED;-------KeyRight:cmp byte [edi],NEWLINE	jnz KeyRNoMargin	call CheckEof	jae KeyRightEnd	call IsViMode	je KeyRightEnd			;no more line wrap around in vi mode	call GoDownKeyRNoMargin:inc ediKeyRightEnd:ret;-------KeyCLeft3:cmp edi,sot	jbe KeyCLEnd	dec ediKeyCtrlQW:cmp byte [edi-1],NEWLINE	jz KeyCLeft3	dec edi	cmp byte [edi],2fh	jbe KeyCtrlQW	cmp byte [edi-1],2fh	ja KeyCtrlQWKeyCLEnd:ret;-------KeyCRight3:call CheckEof	jae KeyCREnd	jmp short KQZ1KeyCtrlQZ:mov al,2fh	cmp byte [edi],NEWLINE	jz KeyCRight3KQZ1:	inc edi	call IsEmMode	jz ISEM2	cmp byte [edi],al		;ws stops at word begin	jbe KeyCtrlQZ	cmp byte [edi-1],al	jmp short ISEM22ISEM2:	cmp byte [edi-1],al		;em stops after end	jbe KeyCtrlQZ	cmp byte [edi],alISEM22:	ja KeyCtrlQZKeyCREnd:ret;-------KeyVIcmde3:call CheckEof		;end of word (vi only)	jae KeyCREnd	inc ediKeyVIcmde:cmp byte [edi],NEWLINE	jz KeyVIcmde3	inc edi	cmp byte [edi],2fh	jbe KeyVIcmde	cmp byte [edi+1],2fh	ja KeyVIcmde	ret;-------KeyEmaCtrlO:call Insert1Byte	jc KeyRightEnd	mov al,NEWLINE	mov byte [edi],al	ret;----------------------------------------------------------------------;; processing special keys from the WS's Ctrl-Q menu;KeyCtrlQE:call LookPgBegin		;goto top left on screen	call KursorFirstLine	jmp short KCtKV1;-------KeyCtrlQX:call LookPgEnd		;1st goto last line on screen	call KeyEnd			;2nd goto line end	call KursorLastLine	jmp short KCtKV1;-------KeyCtrlQV:cmp byte [bereitsges],0	;goto last ^QA,^QF pos	jz KeyCREnd	mov edi,[oldQFpos]KCtKV1:	jmp CQFNum;-------KeyVIbsearch:push byte -1	jmp short KVIfKeyVIfsearch:push byte 1KVIf:	mov byte[grossklein],0ffh	jmp short KeyECtS1;-------PicoCtrlTpico:mov [PicoSearch],edi	;store begin of search (because wrap around EOF)KeyEmaAltPer:push byte 1		;s&repl	pop dword[vorwarts]	mov byte[grossklein],0dfh;-------KeyCtrlQA:mov byte [bereitsges],2	call AskForReplace	jc SimpleRet9CQACtrlL:push edi	call FindText	jnc CQACL2	pop ediSimpleRet9:retCQACL2:	mov eax,[suchlaenge]	call DeleteByte	mov eax,[repllaenge]	call InsertByte	mov esi,replacetext	call MoveBlock	jmp short CQFFound;-------KeyPiCtrlJT:cmp byte [bereitsges],2	jz CQACtrlL	ret;-------KeyEmaCtrlR:push byte -1	jmp short KECS;-------KeyEmaCtrlS:push byte 1KECS:	mov byte[grossklein],0dfhKeyECtS1:pop dword[vorwarts]	mov [EmaMark],edi	call ShowBl0			;i.e. "mov byte [showblock],0";------- contKeyCtrlQF:call IsEmMode	jnz NO_EM04	cmp byte [EmaCtrlS],1	jz KeyCtrlLNO_EM04:push dword [suchtext]		;store begin of old find_text	mov byte [bereitsges],1	call AskForFind	pop ebx	pushf	test byte [mode], VI | PI	jz NO_VIPI01	popf	or eax,eax			;jmp if user entered a new find_text	jnz QFpico	or bl,bl			;jmp if no old find text available	jz CtrlQFEnd	mov byte [suchtext],bl		;restore last find_textQFpico:	mov [PicoSearch],edi		;store begin of search (because wrap around EOF)	jmp short CQFCtrlL;-------NO_VIPI01:popf	jc CtrlQFEndCQFCtrlL:push edi	call FindText	mov byte [EmaCtrlS],1	jc CtrlQFNotFoundCQFFound:mov [oldQFpos],edi	pop esi				;dummyCQFNum:	jmp CheckENum			;i.e. "mov byte [numeriere],1   ret"CtrlQFNotFound:pop ediCtrlQFEnd:ret;-------KeyCtrlL:mov eax,[bereitsges]		;2^QA   1^QF   0else	dec eax	jz CQFCtrlL	test byte[mode],WS | NE | PI	jz SimpleRet4	dec eax	jz near CQACtrlLSimpleRet4:ret;-------KeyVIcmd1:call ReadOneChar	cmp al,'G'	je KeyCtrlQR	retViSpecial:jecxz KeyCtrlQR	jmp short KCQIKeyNedCtrlA:mov [EmaMark],ebp	call ShowBl1			;i.e.  "mov byte [showblock],1"   but shorterKeyCtrlQR:mov edi,sot	jmp short CQFNum;-------KeyCtrlQP:mov ecx,[veryold]	cmp ecx,ebp	ja SimpleRet4	mov edi,ecxJmpCQFN3:jmp short CQFNum;-------KeyCtrlQB:xchg eax,edi	mov edi,[blockbegin]CtrlQB2:or edi,edi			;exit if no marker set	jnz CQFNum	xchg edi,eax	ret;-------KeyCtrlQK:xchg eax,edi	mov edi,[blockende]	jmp short CtrlQB2;-------KeyCtrlQI:mov esi,asklineno	call GetAsciiToInteger	jbe CtrlQFEnd			;CY or ZR setKCQI:	mov edi,sot	call LookPD2JmpCQFN:jmp short JmpCQFN3;-------KeyCtrlQDel:call KeyLeft		;delete all left of cursor	call CountToLineBegin	sub edi,eax	jmp short KCY;-------KeyVICmdD:mov byte [VInolinebased],1KeyCtrlQY:call CountToLineEnd%ifdef W32LF	or eax,eax	jz KCQY	cmp byte [edi+eax-1],0dh	jnz KCQY	dec eax				;keep RETURN 0dh char if existKCQY:%endif	call IsViMode	jnz CtrlTEnd1	call CtrlTEnd1	jmp KeyLeft;-------KeyCmddw:call CountToWordBeginVIstyle	jmp short NO_EM05;-------KeyCtrlY:call CountToLineBegin	sub edi,eax        		;edi at begin	call CountToLineEnd	cmp byte[mode],WS	jnz NO_WS01KCY:	call DeleteByteCheckMarker	jmp short KeyCtrlT1NO_WS01:test byte [mode], VI | PI	jz KeyCtrlT	lea ecx,[edi+eax]	cmp ecx,ebp	jz CtrlTEnd1			;do not delete pending LINEFEED (0Ah)	inc eax	jmp short CtrlTEnd1;-------KeyCtrlT:call CountToWordBegin	call IsEmMode	jnz NO_EM05KeyEmaCtrlK:call CountToLineEndNO_EM05:cmp byte [edi],NEWLINE	jnz CtrlTEnd1KeyCtrlT1:xor eax,eax	inc eax				;1 for LINEFEED (0ah)%ifdef W32LF	cmp byte[edi-1],RETURN	jnz KCT2	dec edi				;0dh is expected "left" of 0ah	inc eax				;1 for RETURN   (0dh)KCT2:%endifCtrlTEnd1:call CheckEof	jz SimpleRet3	cmp byte[mode],WS	jz near DeleteByteCheckMarker	mov esi,edi	call KeyEmaAltW2	jmp short DelBjmp;-------KeyEmaCtrlW:mov ecx,[showblock]	cmp byte[mode],PI	jne NOPI1KECW:	jecxz KeyCtrlY	mov ecx,[EmaMark]	jecxz KECW	jmp short NOPI2NOPI1:	jecxz SimpleRet3	mov ecx,[EmaMark]	jecxz SimpleRet3NOPI2:	call KeyEmaAltW	mov edi,[EmaKiSrc]	mov eax,[EmaKiSize]DelBjmp:jmp DeleteByte;----------------------------------------------------------------------;; processing special Keys from WS's Ctrl-K menu;KeyCtrlKY:call CheckBlock	jc SimpleRet3			;no block: no action	mov eax,[blockende]	mov edi,esi			;esi is blockbegin (side effect in CheckBlock)	sub eax,esi			;block length	call DeleteByte			;out ecx:=0	xchg eax,ecx	call InitSV2			;block no longer validJmpCQFN2:jmp JmpCQFN;-------KeyCtrlKH:xor byte [showblock],1 	;flip flopSimpleRet3:retKeyCtrlKK:mov [blockende],edi	jmp short ShowBl1;-------KeyCtrlKC:call CopyBlock	jc SimpleRet2CtrlKC2:mov [blockbegin],edi	add eax,edi	jmp InitSV3			;mov [blockende],eax - ret;-------KeyCtrlXX:mov ecx,[EmaMark]	jecxz SimpleRet3	call KeyEmaMark	mov edi,ecx	call KeyEmaCtrlLKeyCXX:	jmp short JmpCQFN2;-------KeyCtrlKV:call CopyBlock	jc SimpleRet2	push edi	cmp edi,[blockbegin]	pushf	mov edi,[blockbegin]	call DeleteByte	neg eax				;(for optimizing eax is negated there)	popf	pop edi	jb CtrlKC2	mov [blockende],edi	sub edi,eaxKeyCtrlKB:mov [blockbegin],ediShowBl1:mov byte [showblock],1SimpleRet2:retShowBl0:mov byte [showblock],0	ret;-------KeyVICmdm:call ReadOneChar	cmp al,'a'			;ma (marker a)	jne SimpleRet2	push edi	call KeyHome			;setting WS's "blockbegin" to BOL	mov [blockbegin],edi	pop edi	ret;-------KeyVICmdJmpM:call ReadOneChar	cmp al,'a'	jne SimpleRet2	mov ecx,[blockbegin]		;like WStar's Ctrl-QB  [also Sun Oct  7 17:01:37 2001]	jecxz SimpleRet2	mov edi,ecx	jmp short KeyCXX;-------KeyEmaMark:mov [EmaMark],edi	jmp short ShowBl1;-------KeyCtrlKR:call ReadBlock	jc CtrlKREnd	call KeyCtrlKB	add ecx,edi	mov [blockende],ecx	test byte [mode],EM | NE	jz NO_EM03	mov [EmaMark],ecx	call ShowBl0			;i.e. "mov byte [showblock],0"NO_EM03:cmp byte [mode],PI	jnz CtrlKREnd	mov edi,ecx			;in PI: cursor at end of read fileCtrlKREnd:jmp RestKursPos;-------KeyCtrlKW:call CheckBlock	jc CtrlKSEnd	   		;no action	call SaveBlock	jmp short CtrlKREnd;-------KeyEmaCtrlXF:cmp byte [changed],UNCHANGED	jz KECF	mov esi,asksave2	call DE1	call RestKursPos	call CheckUserAbort	jz CtrlKSEnd	and al,0dfh	cmp al,'N'			;N for request NOT SAVE changesKECF:	jz KCKD2	jmp short KeyCtrlKD;-------KeyEmaCtrlXW:call GetBlockName	jc CtrlKSEnd	mov esi,blockpathXW1:	cld	pusha	mov edi,filepathXW0:	lodsb	stosb				;copy to blockpath to filepath	or al,al	jne XW0	stosb	popaKeyCtrlKS0:call SetChg			;i.e. "mov byte [changed],CHANGED"  to save it really;-------KeyCtrlKS:call SaveFile	pushf				;(called by ^kd)	call RestKursPos	popf	jc CtrlKSEndUnchg:	mov byte [changed],UNCHANGEDCtrlKSEnd:ret;-------KeyCtrlKD:call KeyCtrlKS	jc KeyKXendKCKD2:	mov byte [endeedit],2	ret;-------KeyCtrlKQ:cmp byte [changed],UNCHANGED	jz KCKXend	mov esi,asksave	call DE1	call RestKursPos	call CheckUserAbort	jz CtrlKSEnd	and al,0dfh	cmp al,'N'			;N for request NOT SAVE changes	jz KCKXend	cmp al,'L'			;L for SAVE and LOAD a new file	jnz KeyCtrlKX	call KCKXendKeyCtrlKX:call KeyCtrlKS	jc CtrlKSEndKCKXend:inc byte [endeedit]KeyKXend:ret;----------------------------------------------------------------------;; some minimal limited vi specials in command mode;KeyVICmdW:lea esi,[ecx+2]	cmp byte [esi],SPACECHAR	ja XW1	ret;-------VINoLineCmd:mov eax,[ecx]	cmp ax,'w!'			;save	je KeyCtrlKS0	cmp ax,'w'			;save	je KeyCtrlKS	cmp ax,'x'                      ;save and exit	je KeyCtrlKX	cmp ax,'$'			;No line number, but EOF	jne KVI_KX0;-------KeyCtrlQC:mov edi,ebp	jmp CQFNum;-------KVI_KX0:cmp ax,'wq'KVI_KX:	je KeyCtrlKX	cmp ax,'w '			;save as ... and continue	je KeyVICmdW	cmp ax,'q'	je KeyCtrlKQ	cmp ax,'q!'	je KCKXend	cmp ax,'e '			;edit another ..	je near KeyVICmdE	cmp ax,'h'	je near KeyHelp%ifndef USE_PIPE	ret%else	jmp KeyVICmdtemp%endif;-------KeyVICmdZ:call ReadOneChar	cmp al,'Z'	je KVI_KX	ret;-------KeyVI1Char:call KeyHome	cmp byte [edi],SPACECHAR	ja KFC2KFC1:	cmp byte [edi],NEWLINE	jz KFC2	inc edi	cmp byte [edi],SPACECHAR	jbe KFC1	cmp byte [edi-1],SPACECHAR	ja KFC1KFC2:	ret;-------KeyVICmdS:call KeyHome	call KeyEmaCtrlK		;not quite ok in 'P'/'p' commands	mov byte [VInolinebased],1	jmp short KeyVICmdIKeyVICmdd:call ReadOneChar	cmp al,'w'			;word (greetings to ma_ko)	mov byte [VInolinebased],1	je near KeyCmddw	cmp al,'d'			;"delete"	mov byte [VInolinebased],0	je near KeyCtrlY	cmp al,"'"			;only line based mode supported	jne KFC2	call ReadOneChar	cmp al,'a'			;" d'a "    (only marker "a" supported)	jne KFC2	mov ecx,[blockbegin]		;don't go further if no mark set	jecxz KFC2	call VIsetMarker		;an helper for adjusting begin/end marker linecallKECW:call KeyEmaCtrlW	xor eax,eax	mov [blockbegin],eax		;after delete mark is no more set	jmp short JmpCQFn;-------KeyVICmdI:call KeyVI1Char	jmp short KeyVImode0;-------KeyVICmdp:mov ecx,[EmaKiSize]		;check this before call KeyEmaCtrlYjmpKFC2:jecxz KFC2	cmp byte [VInolinebased],1	jz KeyVICmdpnLB	call OvrRet			;uglyKeyVICmdP:mov ecx,[EmaKiSize]		;check this before call KeyEmaCtrlY	jecxz jmpKFC2	cmp byte [VInolinebased],1	jz KeyVICmdPnLB	call KeyHomeKeyVICP2:push edi	call KeyEmaCtrlY	pop ediJmpCQFn:jmp CQFNum;-------KeyVICmdR:mov byte [insstat],254	;i.e "not 1"	jmp short KeyVImode0KeyVICmdO:call KeyHome	call KeyRet	call KeyUp	jmp short KeyVImode0KeyVICmdo:call KeyEnd	call KeyRet	jmp short KeyVImode0KeyVICmdA:call KeyEnd	jmp short KeyVImode0KeyVIcmda:call KeyRightKeyVIcmdi:mov byte [insstat],1KeyVImode0:push byte 0	jmp short KVim1KeyVICmdC:call KeyEmaCtrlK	mov byte [VInolinebased],1	jmp short KeyVImode0;-------KeyVICmdpnLB:call KeyRight		;not_Line_Based modeKeyVICmdPnLB:call KeyVICP2	add edi,[EmaKiSize]		;Wed Apr 10 18:11:42 MEST 2002;------- contKeyLeft:cmp byte [edi-1],NEWLINE	jnz KeyLNoMargin	cmp edi,sot			;i.e. CheckBof	je KeyLeftEnd	call IsViMode	je KeyLeftEnd			;no more line wrap around in vi mode	call GoUpKeyLNoMargin:dec edi%ifdef W32LF	cmp byte [edi],RETURN		;do not stay at 0dh	jnz KeyLeftEnd	dec edi%endifKeyLeftEnd:ret;-------KeyEnd:	call CountToLineEnd	add edi,eax			;points to a LINEFEED (0ah) char	ret;-------KeyVImode1:push byte 1KVim1:	pop eax	mov byte [VICmdMode],al	ret;-------KeyVIex:call InputStringWithMessage0	pushf	call RestKursPos	popf	jc Kviex	mov esi,optbuffer	xor edx,edx	mov ecx,eax			;do not use xchg here	jecxz Kviex;-------	push esi			;save optbuffer	cldCheckDig:lodsb				;check for line number entered	cmp al,'0'	jnb CD1	inc edxCD1:	cmp al,':'	jb CD2	inc edxCD2:	loop CheckDig	pop ecx				;rest optbuffer;-------	or edx,edx	jnz near VINoLineCmd	call GetAsciiToInteger	jmp ViSpecial			;due short jumps there;-------IsViMode:cmp byte [mode],VI	retIsEmMode:cmp byte [mode],EMKviex:	ret;---------------------------------------------------------------------;; the general PAGE DISPLAY function: called after any pressed key;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -