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

📄 editmgr2.asm

📁 dos 6.0 源代码 .对大家提高有一定的帮助。
💻 ASM
📖 第 1 页 / 共 5 页
字号:
cProc FAfterWord,<NEAR,PUBLIC>
cBegin
	mov	bx, [ldCur.ld_prgch]
	add	bx, [ipCur.ip_ob]
	dec	bx
	mov	al,[bx]
	cCall	IsWordChar,<ax>
	or	ax,ax
cEnd


;*******************************************************************************
;_LineUp
;
;Purpose:
;	Scroll screen up on line leaving cursor in place on screen
;Entry:
;	fMultiLine
;	ipCur
;	pdCur
;Exit:
;	ipCur
;	pdCur
;Uses:
;	none
;Exceptions:
;
;*******************************************************************************
cProc LineUp,<NEAR,PUBLIC>
cBegin
	test	[emState], ES_MULTILINE
	jnz	$I653
ifndef SILENT
	cCall	NearBeep
endif
	jmp	SHORT $I655
$I653:
	cCall	UpdateLine
	mov	ax,[pdCur.pd_olntop]
	mov	bx, [ipCur.ip_oln]
	or	bx,bx
	jz	$I655

	cmp	bx,ax			;if at top of screen scroll up
	jne	$I654

	cCall	ScrollUp
$I654:
	cmp	[cLinesCur],1		;if there is only one line in buffer
	je	$I655			;then don't move up.
	dec	ipCur.ip_oln		;else move ip up
$I655:
cEnd

;*******************************************************************************
;_LineDown
;
;Purpose:
;	Scroll file down on screen 1 line. Leave cursor in place.
;Entry:
;	fMultiLine
;	pwndEditCur
;	hBuffer
;	pdCur
;	ipCur
;	
;Exit:
;	ipCur
;Uses:
;	bx
;Exceptions:
;
;*******************************************************************************
cProc LineDown,<NEAR,PUBLIC>
cBegin
	test	[emState], ES_MULTILINE
	jz	$I660
	cCall	UpdateLine
	;!!! get structure
	mov	ax,[cLinesCur]			;pwndEditCur.cLines
	add	ax,pdCur.pd_olntop
	dec	ax
	cmp	ax,ipCur.ip_oln			;if at bottom scroll down
	jne	$I658
	cCall	ScrollDown
$I658:
	mov	ax, [clnCur]			;check not at end of file
	cmp	ax,ipCur.ip_oln
	jbe	$I660				;brif can go down
	cmp	[cLinesCur],1			;if there is only one line in
	je	$I661				;buffer, don't move down.
	inc	ipCur.ip_oln
	jmp	SHORT $I661
$I660:
ifndef SILENT
	cCall	NearBeep
endif
$I661:
cEnd

;*******************************************************************************
;_CharLeft
;
;Purpose:
;	Move cursor to the left 1 character
;Entry:
;	ipCur
;Exit:
;	ipCur
;	pdCur
;	shiftWidth
;Uses:
;	none
;Exceptions:
;
;*******************************************************************************
cProc CharLeft,<NEAR,PUBLIC>
cBegin
ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
	cmp	ipCur.ip_ob,0			;if already to left don't move
	jne	$I663
ifndef SILENT
	cCall	NearBeep
endif
	jmp	SHORT $I665
$I663:
ifdef	KANJI
	cCall	LeftKanji
else	; KANJI
	dec	ipCur.ip_ob
endif	; KANJI
	mov	ax,pdCur.pd_obleft		;check if past left margin
	cmp	ipCur.ip_ob,ax
	jge	$I665				;brif to right of left margin
	sub	ax,ax
	cCall	PageLeft,<shiftWidth,ax>
$I665:
cEnd

;*******************************************************************************
;_PageUp
;
;Purpose:
;	Move toward start of file 1 page (screen height)
;Entry:
;	fMultiLine
;	ipCur
;	pdCur
;	pwndEditCur
;Exit:
;	fRefreshScreen
;	ipCur
;Uses:
;	bx
;Exceptions:
;
;*******************************************************************************
cProc PageUp,<NEAR,PUBLIC>
cBegin
	test	[emState], ES_MULTILINE
	jnz	$I667
$L20059:
ifndef SILENT
	cCall	NearBeep
endif
	jmp	SHORT $I669
$I667:
	cCall	UpdateLine
	cmp	pdCur.pd_olntop,0		;can't page up if a top file
	je	$L20059
	mov	ax,[cLinesCur]			;pwndEditCur.cLines
	sub	pdCur.pd_olntop,ax		;move up 1 screen 
	jns	$I670				;brif did not wrap past 0
	mov	pdCur.pd_olntop,0		;not enough room so goto top
$I670:
	mov	ax,[cLinesCur]			;pwndEditCur.cLines
	sub	ipCur.ip_oln,ax 		;move ip up 1 sceen
	jns	$I671				;check did not underflow
	mov	ipCur.ip_oln,0			;not enough room
$I671:
	inc	[fRefreshScreen]
$I669:
cEnd

;*******************************************************************************
;_Scrolldown
;
;Purpose:
;	Scroll down 1 screen
;Entry:
;	fMultiLine
;	pdCur
;	ipCur
;Exit:
;	ipCur
;Uses:
;	si = oln
;Exceptions:
;
;*******************************************************************************
cProc ScrollDown,<NEAR,PUBLIC>,<SI>
cBegin
	test	[emState], ES_MULTILINE
	jz	$I675
	cCall	UpdateLine
	mov	si,[cLinesCur]			;pwndEditCur.cLines
	add	si,[pdCur.pd_olntop]		;move top down 1 screen
	mov	ax, [clnCur]			;check if past end of file
	cmp	ax,si				;si - oln
	jb	$I675
	mov	ax,[cLinesCur]			;pwndEditCur.cLInes
	dec	ax				;scroll 1 less then screen
	sub	cx,cx
	mov	dx,1

	push	[pwndEditCur]
	xor	cx,cx
	push	cx				; rxDest = 0
	push	cx				; ryDest = 0
	push	[cColumnsCur]			; drx = cColumnsCur
	mov	ax,[cLinesCur]
	dec	ax
	push	ax				; dry = cLinesCur - 1
	push	cx				; rxSrc = 0
	mov	ax,1
	push	ax				; rySrc = 1
	cCall	BltRrc

	inc	[pdCur.pd_olntop]		;adjust for new top of screen
	cCall	RefreshLine,<si>		;refresh scrolled over line

	mov	ax, [ipCur.ip_oln]
	cmp	ax, [pdCur.pd_olntop]
	jae	$I677
	inc	ipCur.ip_oln
	jmp	SHORT $I677
$I675:
ifndef SILENT
	cCall	NearBeep
endif
$I677:
cEnd

;*******************************************************************************
;ScrollUp
;
;Purpose:
;	Move up 1 line.  See ScrollDown
;Entry:
;	fMultiLine
;	pdCur
;	ipCur
;Exit:
;	ipCur
;Uses:
;	si = oln
;Exceptions:
;
;*******************************************************************************
cProc ScrollUp,<NEAR,PUBLIC>,<SI>
cBegin
	test	[emState], ES_MULTILINE
	jz	$I681
	cCall	UpdateLine
	mov	si,[pdCur.pd_olntop]		;scroll off top line
	dec	si
	js	$I681				;but don't scroll at top file

	cCall	GetLineScratch,<si>

	push	[pwndEditCur]			; pwnd
	xor	cx,cx				; cx = 0
	push	cx				; rxDest = 0
	mov	ax,1
	push	ax				; ryDest = 1
	push	[cColumnsCur]			; drx = cColumnsCur
	mov	ax,[cLinesCur]
	dec	ax
	push	ax				; dry = cLinesCur - 1
	push	cx				; rxSrc = 0
	push	cx				; rySrc = 0
	cCall	BltRrc

	mov	pdCur.pd_olntop,si		;new top of screen
	cCall	RefreshLine,<si>

	mov	ax, [pdCur.pd_olntop]
	add	ax, [cLinesCur]
	cmp	ax, [ipCur.ip_oln]
	ja	$I683
	dec	ipCur.ip_oln
	jmp	SHORT $I683
$I681:
ifndef SILENT
	cCall	NearBeep
endif
$I683:
cEnd

;*******************************************************************************
;_PageDown
;
;Purpose:
;	Move down file 1 page
;Entry:
;	fMultiLine
;	ipCur
;	pdCur
;	hBuffer
;Exit:
;	ipCur
;	fRefreshScreen
;Uses:
;	none
;Exceptions:
;
;*******************************************************************************
cProc PageDown,<NEAR,PUBLIC>
cBegin
	test	[emState], ES_MULTILINE
	jnz	$I685
$L20062:
ifndef SILENT
	cCall	NearBeep
endif
	jmp	SHORT $I687
$I685:
	cCall	UpdateLine
	mov	ax, [clnCur]			;check that page down won't
	mov	cx,[cLinesCur]			;pwndEditCur.cLines
	add	cx,WORD PTR pdCur.pd_olntop
	cmp	cx,ax
	jae	$L20062				;brif if paging off eof
	mov	ax,[cLinesCur]			;pwndEditCur.cLines
	add	pdCur.pd_olntop,ax		;adjust screen down 1 page
	add	ipCur.ip_oln,ax
	mov	ax, [clnCur]			;check if new ip is off eof
	cmp	ax,ipCur.ip_oln
	ja	$I688				;brif new ip still within file
	dec	ax				;else put ip at eof
	mov	ipCur.ip_oln,ax
$I688:
	inc	[fRefreshScreen]
$I687:
cEnd

;*******************************************************************************
;_PageLeft
;
;Purpose:
;	Page file to left.
;Entry:
;	ipCur
;	pdCur
;	pwndEditCur
;Exit:
;	ipCur
;	fRefreshScreen
;Uses:
;	shiftWidth
;	fMoveIp
;Exceptions:
;
;*******************************************************************************
cProc PageLeft,<NEAR,PUBLIC>
	parmW	$shiftWidth
	parmB	fMoveIp
cBegin
	cmp	pdCur.pd_obleft,0		;check if already to far left
	jne	$I692				;brif can still move to left
ifndef SILENT
	cCall	NearBeep			    ;no room to page left
endif
	jmp	SHORT $I693			;exit
$I692:
	mov	ax,pdCur.pd_obleft		;see if room to movu shiftwidth
	cmp	[$shiftWidth],ax
	jbe	$I694				;brif room move left shiftwidth
	mov	pdCur.pd_obleft,0		;else move the way left
	jmp	SHORT $I695
$I694:
	mov	ax,[$shiftWidth]			;adjust left margin
	sub	pdCur.pd_obleft,ax
$I695:
	cmp	[fMoveIp],0	
	je	$I698
	mov	ax,ipCur.ip_ob			;move ip with page left
	cmp	[$shiftWidth],ax
	jbe	$I697
	mov	ipCur.ip_ob,0
	jmp	SHORT $I698
$I697:
	mov	ax,[$shiftWidth]
	sub	ipCur.ip_ob,ax
$I698:
	mov	ax,[cColumnsCur]		;pwndEditCur.cColumns
	add	ax,pdCur.pd_obleft		;check if ip still on screen
	cmp	ax,ipCur.ip_ob
	ja	$I699				;brif so
	mov	ax,pdCur.pd_obleft		;if off screen move to margin
	mov	ipCur.ip_ob,ax
$I699:
	inc	[fRefreshScreen]
$I693:
cEnd

cProc PageRight,<NEAR,PUBLIC>
	parmW	$shiftWidth
	parmB	fMoveIp

	localW	obMax
cBegin
	mov	cx,pdCur.pd_obleft
	mov	dx,ipCur.ip_ob

	mov	ax,ldCur.ld_cbMax		;calc. max. offset can move
	mov	bx,pwndEditCur			;move to the right
	sub	ax,[cColumnsCur]		;pwndEditCur.cColumns
	jle	PR_1				;brif cbMax < cColumns
	mov	[obMax],ax	
	cmp	[obMax],cx	
	ja	$I704				;brif ok to page right

PR_1:
ifndef SILENT
	cCall	NearBeep
endif
	jmp	SHORT $I705			;return
$I704:
	mov	ax,[$shiftWidth]
	add	ax, cx				;ax = $shiftWidth+obleft
;	add	ax,pdCur.pd_obleft		;check if new margin+shiftwidth
	cmp	ax,[obMax]			;check if over limit
	jb	$I706				;brif not over limit
	mov	ax,[obMax]			;else put margin at max.
	mov	cx, ax				;cx = obleft
;	mov	pdCur.pd_obleft,ax
	jmp	SHORT $I707
$I706:
	mov	ax,[$shiftWidth]		;move margin to shift
	add	cx, ax				;cx = obleft+shiftwidth
;	add	pdCur.pd_obleft,ax
$I707:
	cmp	[fMoveIp],FALSE	
	je	$I708				;brif ip not to follow page
	mov	ax,[$shiftWidth]
	add	dx, ax				;dx = ipCur.ob+shiftWidth
;	add	ipCur.ip_ob,ax
$I708:
;	mov	ax,pdCur.pd_obleft
	cmp	dx, cx				;check if ip still on screen
;	cmp	ipCur.ip_ob,ax			;check if ip still on screen
	jge	$I709
	mov	dx, ax
$I709:
	mov	ax,ldCur.ld_cbMax		;could have gone past eol
	cmp	dx, ax
;	cmp	ipCur.ip_ob,ax
	jb	$I710				;brif ip still on line
	dec	ax				;if not then put at eol
	mov	dx, ax
$I710:
	inc	[fRefreshScreen]
$I705:
	mov	ipCur.ip_ob, dx
	mov	pdCur.pd_obleft, cx
cEnd

ifdef	KANJI

cProc LeftKanji,<NEAR,PUBLIC>
cBegin
	cCall	GetLineScratchPad,<[ipCur.ip_oln]>
	mov	ax,[ipCur.ip_ob]
	mov	bx,[ldEMScratch.LD_prgch]
	add	ax,bx
	cCall	PchPrevDbcs,<ax,bx>
	sub	ax,[ldEMScratch.LD_prgch]
	mov	[ipCur.ip_ob],ax
cEnd

cProc RightKanji,<NEAR,PUBLIC>
cBegin
	cCall	GetLineScratchPad,<[ipCur.ip_oln]>
	mov	bx,[ldEMScratch.LD_prgch]
	add	bx,[ipCur.ip_ob]
	cCall	PchNextDbcs,<bx>
	sub	ax,[ldEMScratch.LD_prgch]
	mov	[ipCur.ip_ob],ax
cEnd

cProc DbcsAdjCur,<NEAR,PUBLIC>
cBegin
	cCall	DbcsAdjCursor
	mov	[ipCur.ip_ob],ax
SkipAdjCur:
cEnd

cProc DbcsAdjCursor,<NEAR,PUBLIC>,<si,di>
cBegin
	cCall	GetLineScratchPad,<[ipCur.ip_oln]>
	mov	si,[ipCur.ip_ob]
	mov	bx,[ldEMScratch.LD_prgch]
	add	si,bx
	cCall	PchPrevDbcs,<si,bx>
	xchg	ax,di
	cCall	PchNextDbcs,<di>
	cmp	ax,si
	je	@F
	xchg	ax,di
@@:
	sub	ax,[ldEMScratch.LD_prgch]
cEnd

endif	; KANJI

;*******************************************************************************
;_DisplayCurPos
;
;Purpose:
;	Recalc. the file offset for the top of screen and left margin. This
;	is done when a seek to an arbitrary position within file is done
;	and a total calc. of position relative to currency is needed.
;Entry:
;	fRedraw 
;	pdCur
;	ipCur
;	pwndEditCur
;Exit:
;	ipCur
;	pdCur
;	fRefreshScreen
;Uses:
;	ax, bx, cx, dx, si, di
;	si = margin
;	di - ipCur.ob and olnBottom
;	obRight
;	shiftWidthSave
;Exceptions:
;	If run out of memory trying to allocate a buffer, runtime error
;		"Error during Initialization" or some such.
;*******************************************************************************
cProc DisplayCurPos,<NEAR,PUBLIC>,<SI,DI>

	localW	obRight
	localW	shiftWidthSave
cBegin

ifdef	KANJI
	cCall	DbcsAdjCur
endif	; KANJI
	test	[emState], ES_NOREDRAW
	jz	$JCC6737		;brif ok to redraw screen
	jmp	$EX711			;don't do recalc if no redraw
$JCC6737:
	mov	si,[cLinesCur]		;pwndEditCur.cLines
	shr	si,1			;calc. margin at 1/4 screen width
	shr	si,1			;margin - space left at edge
	;Compute file offset to move to top of screen
	mov	cx, pdCur.pd_olntop
	mov	dx, ipCur.ip_oln
;First check ipCur.oln < pdCur.olntop -  is ip above current top of screen
	cmp	dx, cx
	jae	$I718			;brif if ip below top of screen
	cmp	dx, si			;is ip within margin of beg. file
	jae	$I719			;brif if not
	xor	cx, cx	  		;if that close to bof, set at top
	jmp	SHORT $L20063
$I719:
	mov	ax, cx
	sub	ax,si			;check if ip between top of screen(tos)
	cmp	ax,dx			;and tos-margin (just above screen)
	jae	$I721			;brif if father above then that
	mov	cx,dx			;if that close make it tos
	jmp	SHORT $L20063
$I721:
	mov	cx, dx			;else tos to ip - margin
	sub	cx, si		       
$L20063:
	mov	pdCur.pd_olntop,cx	;adjust to new tos
$I720:
	inc	[fRefreshScreen]

;Here after check for ip above tos

⌨️ 快捷键说明

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