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

📄 uimisc.asm

📁 Dos6.0
💻 ASM
📖 第 1 页 / 共 2 页
字号:
	TITLE	uimisc.asm - miscellaneous user interface functions.
;*** 
;uimisc.asm
;
;	Copyright <C> 1985-1988, Microsoft Corporation
;
;Purpose:
;	Miscellanious Assember user interface functions
;
;
;*******************************************************************************

	.xlist
	include		version.inc
	UIMISC_ASM = ON	
	CONTEXT_NOFUNCS = ON

	include 	cw\version.inc
	include 	cw\windows.inc
	include 	cw\edityp.inc

	includeOnce	architec
	IncludeOnce	context
	includeOnce	qbimsgs
	includeOnce	ui
	includeOnce	uiint

	.list

assumes	DS,DATA
assumes	ES,DATA
assumes	SS,DATA

;-------------------------------------------------------------------------
;		DATA Segment Declarations
;-------------------------------------------------------------------------
sBegin	DATA

	globalW	fAbortKeyPressed,0

	externW fUiActive		; [17]
	externW iHelpId 		
	externW fOptionsChanged 	
	externW sdNMALLOC		

	globalB	fNoHighlight,0		; TRUE if no hilite should be done
	externW	szDialogTitle		
	externW	cbDialogTitle		
	externW	iMsgStatusLine		
	externB HelpFlags		
	externB fMessageBox		

sEnd	DATA

externFP B$ULGetCommon			
externFP _strcpy


sBegin UI
assumes CS,UI




;Added with [9]
;***
;MsgBoxStdRt - Special version of MsgBoxStd
;
;Purpose:
;	This routine is identical to MsgBoxStd, except that if
;	the error is a runtime error (0 < x < ER_UE), then
;	the helpId is treated specially so that help on this
;	error is different.  This allows us to have seperate
;	contexts for Interpreter generated runtime errors
;	(such as BadFileMode) and execution time runtime errors
;
;Entry:
;	Identical to MsgBoxStd
;
;Exit:
;	Identical to MSgBoxStd
;
;Uses:
;	Per C Convention
;
;****
cProc	MsgBoxStdRt,<PUBLIC,NEAR>
parmW	mbType
parmW	iMsg
cBegin
	mov	ax,iMsg
	mov	bx,ax
	jmp	short MsgBoxCommon	; jump into MsgBoxStd
cEnd	<nogen>



;Added with [9]
;***
;MsgBoxStd - Standard 1 line message box from Msg Number
;
;Purpose:
;	Displays a generic one line dialog box and waits for the user's
;	replay.  The text comes from QBIMSGS.TXT.
;
;	If the error code is less than or equal to ER_UE (i.e. it is
;	a runtime error), we will map the help id with HELP_INTERPBASE
;	so that we will assume the error was generated in the user
;	interface (for when we get help).  Use MsgBoxStdRt to allow
;	runtime help on a runtime error.
;
;Entry:
;	mbType = MB_OK, MB_YESNOCANCEL, or MB_RETRYCANCEL
;	iMsg   = standard message id from qbimsgs.h/inc
;
;Exit:
;	AX = IDOK, IDYES, IDNO, IDCANCEL, or IDRETRY  (id of button pushed)
;
;Uses:
;	Per C Convention
;****
cProc	MsgBoxStd,<PUBLIC,NEAR> 	;NOTE: branched into from MsgBoxStdRt
parmW	mbType
parmW	iMsg
cBegin
	mov	ax,iMsg 		; get the message number
	mov	bx,ax			; get a copy of the number
	cmp	bx,ER_UE		; is it a runtime error?
	ja	MsgBoxCommon		; no, use it as-is
	add	bx,HELP_INTERPBASE	; map it to a special help id
MsgBoxCommon:				; -Entry point for MsgBoxStdRt-
	mov	iHelpId,bx		; and save it
	push	ax			; parameter to ListStdMsg

	Call	ListStdMsg		; Convert Msg # to string

	push	si			; save si
	sub	sp,CB_bufStdMsg 	; Allocate space for bufStdMsg
	mov	si,sp			
	mov	ax,OFFSET DGROUP:bufStdMsg 
	cCall	_strcpy,<ax,si> 	; and copy it
	add	sp,4			
	xor	bx,bx
	cCall	UIMessageBox,<si,BX,BX,mbType> ; display the message box
	add	sp,CB_bufStdMsg 	; release space
	pop	si			; restore si


cEnd

;Added with [13]
;***
;UIMessageBox - Interface to COW routine MessageBox
;
;Purpose:
;	Saves code by doing proceessing required before each MessageBox
;	routine.
;
;	NOBODY should be calling MessageBox() directly, except from within
;	this routine!
;
;	Closes the current help file, if any, before user input.  This
;	prevents them from doing something stupid, like switching floppy
;	disks, while we have the file open.
;
;Entry:
;	msg1	= first line of message
;	msg2	= second line of message (0 if none)
;	msg3	= third line of message (0 if none)
;	mbType	= MB_OK, MB_YESNOCANCEL, or MB_RETRYCANCEL
;
;Exit:
;	AX = IDOK, IDYES, IDNO, IDCANCEL, or IDRETRY  (id of button pushed)
;
;Uses:
;	Per C Convention
;****
cProc	UIMessageBox,<NEAR,PUBLIC>
parmW	msg1
parmW	msg2
parmW	msg3
parmW	mbType
	localW	wRet
cBegin
	push	[grs.GRS_oRsCur]	; [14] save the current grs.oRsCur

	mov	ax,[fUiActive]
	push	ax			; save value of fUiActive
	push	[b$fInt24Err]		; save old int 24 flag (0, -1)
					; (will be set to -1 by
					; EnterUserInterface)

; We should not call DoDrawDebugScr unless necessary.  If we do call it
; for example, when we pop up a message box in a dialog, EnableMenuBar
; will assert that pfnFilter is not DummyFilter, but the dialog filter
; procedure is active instead.  In general, it is just safer to skip
; the unnecessary call.
	or	ax,ax			; See if we are active
	jnz	@F			; If we are, Skip
	call	EnsShowDebugScr 	; make debug screen visible
	call	EnterUserInterface	; enable userInterface interrupt handlers
	call	DoDrawDebugScr		; actually draw debug screen, can't
					;  wait for next call in GetCmd() in the
					;  case where user just executed a TRON
					;  stmt, we don't call GetCmd at all
@@:

	cCall	CloseCurHelpFile	; close any open help files before
					; user input
	push	[iMsgStatusLine]	; push current status line as parm
					;	for StatusLineMsg
	mov	ax,MSG_StatusDialog	; display dialog box status line
	cCall	StatusLineMsg,<ax>	; draw the new status line
	mov	ax,mbType		; AX = type of msgbox
	test	HelpFlags,HLP_INHELP	; are we in the help system
	jz	NotInHelp		; no, don't make any changes
	or	ax,MB_NOHELP		; yes, don't have a <HELP> button
NotInHelp:
	inc	fMessageBox		; flag that we are in a message box
	cCall	MessageBox,<msg1, msg2, msg3, AX>	; display the msgbox
	mov	[wRet],ax		; [14] save return value
	dec	fMessageBox		; clear message box flag
	call	StatusLineMsg		; restore original status line
					;	parm pushed above

	pop	b$fInt24Err		; restore old int 24 flag (0, -1)
	pop	ax			; ax = old value of fUiActive

	or	ax,ax			
	jne	@F			; brif we were already in user interface
	call	ExitUserInterface	; restore runtime's interrupt handlers
	call	EnsShowOutputScr	; restore output screen
@@:
	cCall	UiRsActivate		; [14] Restore oRs (already on stack)
	mov	ax,[wRet]		; [14] restore return value
cEnd


;***********************************************************************
; HookInt24
; Purpose:
;	Save code by setting b$fInt24Err to UNDEFINED, causing the runtime
;	int 24 handler to ignore int 24 errors.  It also clears out
;	any int 24's that we may have previously ignored.
; Preserves:
;	ALL
;
;***********************************************************************
cProc	HookInt24,<PUBLIC,NEAR>
cBegin
	mov	[b$fInt24Err],UNDEFINED
cEnd

;***********************************************************************
; UnHookInt24
; Purpose:
;	Save code by setting b$fInt24Err to 0, causing int 24's to be
;	treated as runtime errors.
; Preserves:
;	ALL
;
;***********************************************************************
cProc	UnHookInt24,<PUBLIC,NEAR>
cBegin
	mov	[b$fInt24Err],0
cEnd

;***********************************************************************
; fInt24Err
; Purpose:
;	See if an Interrupt 24 error has occurred since the last
;	call to HookInt24() or fInt24Err().
;
;	If no error, returns 0

⌨️ 快捷键说明

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