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

📄 editmgr2.asm

📁 dos 6.0 源代码 .对大家提高有一定的帮助。
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;*******************************************************************************
cProc BegPgm,<NEAR,PUBLIC>
cBegin
	cCall	UpdateLine
	mov	ipCur.ip_oln,0
	cCall	AutoIndent
	cCall	DisplayCurPos
cEnd

;*******************************************************************************
;_EndPgmInitContext()
;
;Purpose:
;	_EndPgm
;Entry:
;	ipCur
;Exit:
;	ipCur
;Uses:
;	none.
;Exceptions:
;
;*******************************************************************************
cProc EndPgm,<NEAR,PUBLIC>
cBegin
	cCall	UpdateLine
	mov	ax, [clnCur]
	mov	ipCur.ip_oln,ax
	mov	ipCur.ip_ob,0
	cCall	DisplayCurPos
cEnd

;*******************************************************************************
;_HomeLine
;
;Purpose:
;	Move Cursor to beginning of line
;Entry:
;	none.
;Exit:
;	ipCur
;Uses:
;	none.
;Exceptions:
;
;*******************************************************************************
cProc HomeLine,<NEAR,PUBLIC>
cBegin
	cCall	AutoIndent
	cCall	DisplayCurPos
cEnd

;*******************************************************************************
;_EndLine
;
;Purpose:
;	Move cursor to end of current line
;Entry:
;	ldCur
;	ipCur
;Exit:
;	ipCur
;Uses:
;	none.
;Exceptions:
;
;*******************************************************************************
cProc EndLine,<NEAR,PUBLIC>
cBegin
	xor	ax,ax
	mov	bx, [ipCur.ip_oln]
	cmp	bx, [clnCur]
	jae	EL_1
	cCall	GetCurLine
	mov	ax,ldCur.ld_cb
EL_1:
	mov	ipCur.ip_ob,ax
	cCall	DisplayCurPos
cEnd

;*******************************************************************************
;_CharRight
;
;Purpose:
;	Move cursor to the right 1 character. Non-destructive	
;Entry:
;	ldCur
;	ipCur
;	pdCur
;	pwndEditCur
;Exit:
;	ipCur
;Uses:
;	none.
;Exceptions:
;*******************************************************************************
cProc CharRight,<NEAR,PUBLIC>
cBegin
ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
	mov	ax,ldCur.ld_cbMax
	dec	ax
	cmp	ax,ipCur.ip_ob
	ja	$I604		;brif if ip is not a max. line width
ifndef SILENT
	cCall	NearBeep	;warn user
endif
	jmp	SHORT $I606

;Here if ok to move right
$I604:
ifdef	KANJI
	cCall	RightKanji
else	; KANJI
	inc	ipCur.ip_ob
endif	; KANJI
	mov	ax,[cColumnsCur]    ;pwndEditCur.cColumns
	add	ax,pdCur.pd_obleft
	cmp	ax,ipCur.ip_ob
	ja	$I606		;brif if ip to left of screen right edge
	sub	ax,ax		;moved offset screen so page right
	cCall	PageRight,<shiftWidth,ax>
$I606:
cEnd

;*******************************************************************************
;WordRight
;
;Purpose:
;	Move the cursor one word to the right. Moving to the next line if
;	no more word on the current line.
;Entry:
;  DX - if Zero position at start of word
;       if Non-Zero position at end of word
;Exit:
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc WordRight,<NEAR,PUBLIC>,<SI>
cBegin
	push	dx			; Save
	cCall	GetCurLine
	pop	ax			; Restore

	mov	si, User_EditOFFSET RightToWordStart
	or	ax,ax
	jz	WR_CheckEol

	mov	si, User_EditOFFSET RightPastWordEnd

WR_CheckEol:
	mov	ax, [ipCur.ip_ob]
	cmp	ax, [ldCur.ld_cb]
	jae	WR_NextLine

WR_Repeat:
	call	si
	jnz	WR_Exit

WR_NextLine:
	mov	ax, [ipCur.ip_oln]
	inc	ax
	cmp	ax, [clnCur]
	jae	WR_Beep

	mov	[ipCur.ip_oln], ax
	cCall	GetCurLine
	mov	[ipCur.ip_ob], 0
	cCall	FOnWord
	jnz	WR_Exit
	jmp	short WR_Repeat

WR_Beep:
ifndef SILENT
	cCall	NearBeep
endif
WR_Exit:
	cCall	DisplayCurPos
cEnd

;*******************************************************************************
;WordLeft
;
;Purpose:
;	Move left 1 word. See RightWord
;Entry:
;Exit:
;Exit:
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc WordLeft,<NEAR,PUBLIC>
cBegin
	cCall	GetCurLine
	mov	ax, [ldCur.ld_cb]
	cmp	ax, [ipCur.ip_ob]
	ja	WL_Repeat

	mov	[ipCur.ip_ob], ax

WL_Repeat:
	call	LeftToWordStart
	jnz	WL_Exit

	mov	ax, [ipCur.ip_oln]
	or	ax,ax
	jz	WL_NearBeep

	dec	ax
	mov	[ipCur.ip_oln], ax
	cCall	GetCurLine
	mov	ax, [ldCur.ld_cb]
	mov	[ipCur.ip_ob], ax
	jmp	short WL_Repeat

WL_NearBeep:
ifndef SILENT
	cCall	NearBeep
endif
WL_Exit:
	cCall	DisplayCurPos
cEnd

;*******************************************************************************
;_LeftToWordStart
;
;Purpose:
; Moves the cursor left on the current line until the begining of a word
; or the begining of the line is found
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor ---------vvvvvvvvvv
;                                  .....XXXXX.....XXXXX.....
;                                       ^
;      end position of cursor ----------/
;
;Entry:
;Exit:
; Return Z if no word found before begining of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc LeftToWordStart,<NEAR,PUBLIC>
cBegin
	cCall	LeftUntilWord
	jz	WSL_Exit		; Return Z - no word found
	cCall	LeftUntilNonWord
	or	sp,sp			; Set NZ flag
WSL_Exit:
cEnd

;*******************************************************************************
;_LeftPastWordEnd
;
;Purpose:
; Moves the cursor left on the current line until the end of a word
; or the begining of the line is found
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor -------------vvvvvvvvvvv
;                                  .....XXXXX.....XXXXX.......
;                                            ^
;      end position of cursor ---------------/
;
;Entry:
;Exit:
; Return Z - if no between word gap is found before start of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc LeftPastWordEnd,<NEAR,PUBLIC>
cBegin
	cCall	LeftUntilNonWord
	cCall	LeftUntilWord
cEnd

;*******************************************************************************
;_RightToWordStart
;
;Purpose:
; Moves the cursor right on the current line until the start of a word
; or the end of the line is found
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor --------vvvvvvvvvv
;                                  .....XXXXX.....XXXXX.....
;                                                 ^
;      end position of cursor --------------------/
;
;Entry:
;Exit:
; Return Z - if end of line before begining of word.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc RightToWordStart,<NEAR,PUBLIC>
cBegin
	cCall	RightWhileWord
	cCall	RightWhileNonWord
cEnd


;*******************************************************************************
;_RightPastWordEnd
;
;Purpose:
; Moves the cursor right on the current line until the end of a word
; or the end of the line is found
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor -------------vvvvvvvvvvv
;                                  .....XXXXX.....XXXXXX.....
;                                                       ^
;      end position of cursor --------------------------/
;
;Entry:
;Exit:
; Return Z if no word found before end of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc RightPastWordEnd,<NEAR,PUBLIC>
cBegin
	cCall	RightWhileNonWord
	jz	WER_Exit		; Return Z - No word found
	cCall	RightWhileWord
	or	sp,sp			; Return NZ - word found
WER_Exit:
cEnd

;*******************************************************************************
;LeftUntilWord
;
;Purpose:
; Moves the cursor left on the current line until the character to the
; left of the cursor is a word character or until the begining of the line
; is found.
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor ------=------vvvvvv
;                                  .....XXXXX.....XXXXXX.....
;                                            ^
;      end position of cursor ---------------/
;
;Entry:
;Exit:
; Return Z if cursor moved to begining of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc LeftUntilWord,<NEAR,PUBLIC>
cBegin
ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
LUW_Repeat:
	mov	ax, [ipCur.ip_ob]
	or	ax,ax				; Begining of line?
	jz	LUW_Exit			; Yes - Return Z

	cCall	FAfterWord			; Is char to left of cursor
						;    a word char?
	jnz	LUW_Exit			; Yes - Return NZ

ifdef	KANJI
	cCall	LeftKanji
else	; KANJI
	dec	[ipCur.ip_ob]			; Otherwise move cursor left
endif	; KANJI
	jmp	short LUW_Repeat

LUW_Exit:
cEnd

;*******************************************************************************
;LeftUntilNonWord
;
;Purpose:
; Moves the cursor left on the current line until the character to the
; left of the cursor is a non word character or until the begining of the line
; is found.
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor --------vvvvvv
;                                  .....XXXXX.....XXXXXX.....
;                                       ^
;      end position of cursor ----------/
;
;Entry:
;Exit:
; Return Z if cursor moved to begining of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc LeftUntilNonWord,<NEAR,PUBLIC>
cBegin
ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
LUNW_Repeat:
	mov	ax, [ipCur.ip_ob]
	or	ax,ax				; Begining of line?
	jz	LUNW_Exit			; Yes - Return Z

	cCall	FAfterWord			; Is char to left of cursor
						;    a word char?
	jz	LUNW_ExitNZ			; Yes - Return NZ

ifdef	KANJI
	cCall	LeftKanji
else	; KANJI
	dec	[ipCur.ip_ob]			; Otherwise move cursor left
endif	; KANJI
	jmp	short LUNW_Repeat

LUNW_ExitNZ:
	or	sp,sp				; Set NZ flag
LUNW_Exit:
cEnd

;*******************************************************************************
;RightWhileWord
;
;Purpose:
; Moves the cursor right on the current line until the character under
; the cursor is a non word character or until the end of the line is found.
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor --------vvvvvv
;                                  .....XXXXX.....XXXXXX.....
;                                            ^
;      end position of cursor ---------------/
;
;Entry:
;Exit:
; Return Z if cursor moved to end of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc RightWhileWord,<NEAR,PUBLIC>
cBegin
ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
RWW_Repeat:
	mov	ax, [ipCur.ip_ob]
	cmp	ax, [ldCur.ld_cb]		; End of line?
	jae	RWW_ExitZ			; Yes - Return Z

	cCall	FOnWord				; On a word char?
	jz	RWW_ExitNZ			; No - Return NZ

ifdef	KANJI
	cCall	RightKanji
else	; KANJI
	inc	[ipCur.ip_ob]
endif	; KANJI
	jmp	short RWW_Repeat

RWW_ExitNZ:
	or	sp,sp				; Return - NZ
	jmp	short RWW_Exit

RWW_ExitZ:
	xor	ax,ax				; Return - Z
RWW_Exit:
cEnd

;*******************************************************************************
;RightWhileNonWord
;
;Purpose:
; Moves the cursor right on the current line until the character under
; the cursor is a word character or until the end of the line is found.
;
; if x is a word character
; and . is a non word character
; search for:
;      start position of cursor -------------vvvvvv
;                                  .....XXXXX.....XXXXXX.....
;                                                 ^
;      end position of cursor --------------------/
;
;Entry:
;Exit:
; Return Z if cursor moved to end of line.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc RightWhileNonWord,<NEAR,PUBLIC>
cBegin
ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
RWNW_Repeat:
	mov	ax, [ipCur.ip_ob]
	cmp	ax, [ldCur.ld_cb]		; End of line?
	jae	RWNW_ExitZ			; Yes - Return Z

	cCall	FOnWord				; On a word char?
	jnz	RWNW_Exit			; Yes - Return NZ

ifdef	KANJI
	cCall	RightKanji
else	; KANJI
	inc	[ipCur.ip_ob]
endif	; KANJI
	jmp	short RWNW_Repeat

RWNW_ExitZ:
	xor	ax,ax				; Return - Z
RWNW_Exit:
cEnd

;*******************************************************************************
;FOnWord
;
;Purpose:
; Checks if the cursor is on a word character
;
;
;Entry:
;Exit:
; Return NZ if cursor is on a word.
;
;Uses:
;Exceptions:
;
;*******************************************************************************
cProc FOnWord,<NEAR,PUBLIC>
cBegin
	mov	bx, [ldCur.ld_prgch]
	add	bx, [ipCur.ip_ob]
	mov	al,[bx]
	cCall	IsWordChar,<ax>
	or	ax,ax
cEnd

;*******************************************************************************
;FAfterWord
;
;Purpose:
; Checks if the character to the left of the cursor is a word character.
;
;
;Entry:
;Exit:
; Return NZ if the character to the left of the cursor is a word character.
;
;Uses:
;Exceptions:
;
;*******************************************************************************

⌨️ 快捷键说明

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