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

📄 uimisc.asm

📁 Dos6.0
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;
;	If int 24 error, returns appropriate error code
;
; Preserves:
;	ES
;
;***********************************************************************
cProc	fInt24Err,<PUBLIC,NEAR>
cBegin
	mov	ax,[b$fInt24Err]
	inc	ax
	je	fInt24Exit		;brif no Int 24 error has occurred
					; (return 0)
	and	ax,000Fh		;al = errcode + 1
	mov	dx,ER_OP		;9 ==> Out of Paper
	cmp	al,9+1			;remember, al=INT24 errcode + 1
	je	GotErrCode

	mov	dx,ER_PRM		;0 ==> Permission Denied
	dec	ax
	je	GotErrCode

	mov	dx,ER_DNA		;1 ==> Device Unavailable
	dec	ax
	je	GotErrCode

	mov	dx,ER_DNR		;2 ==> Disk not Ready
	dec	ax
	je	GotErrCode

	mov	dx,ER_IOE		;all others ==> Device I/O Error
GotErrCode:

	mov	ah,0dh			; disk reset, to trash any bogus
	int	21h			; DOS buffers.  Runtime normally
					; does this, but we are ignoring
					; errors, so it didn't (it can't).
	cCall	HookInt24		; reset int 24 flag
	xchg	ax,dx			; return ax = error code

fInt24Exit:
cEnd


RetryTable:			; table of errors that are retryable
	DW	ER_OP			; Out of Paper
	DW	ER_PRM			; Permission Denied
	DW	ER_DNA			; Device Unavailable
	DW	ER_DNR			; Disk not ready
	DW	ER_IOE			; Device I/O error
	DW	ER_DF			; Disk full

NUM_RETRYABLE	EQU ($ - RetryTable)/2	; size of table

;***********************************************************************
; RetryError
;
; Purpose:
;	Determine if an error is retry-able.
;	if it is, then prompt the user to retry or cancel.
;
; 	Added with revision [4].
;
; Entry:
;	errCode = error we got
;
; Exit:  ax =	0 ==> no error, or not retryable
;		IDRETRY ==> retry
;		IDCANCEL ==> don't retry
; Modifies:
;	Per convention
;
;***********************************************************************
cProc	RetryError,<PUBLIC,NEAR>,<DI>	
parmW	errCode
cBegin
	mov	ax,errCode		; ax = error we got
	push	cs			; ES = CS
	pop	es
	mov	di,UIOFFSET RetryTable	; table of retryable errors
	mov	cx,NUM_RETRYABLE	; # to look at
	repne	scasw			; search for error AX in table
	jne	RetryExit		; brif not found -- exit with ax = 0

GiveRetryBox:
	PUSHI	bx,MB_RETRYCANCEL	; pass dialog-box type
	push	ax			; pass std error code
	call	MsgBoxStd		; return AX = IDRETRY or IDCANCEL

	Skip2_PSW			; skip the XOR AX,AX
RetryExit:
	xor	ax,ax			; can't retry
cEnd

;***********************************************************************
; EnsureFullMenu
; Purpose:
;	Added with revision [2].
;	Called by file loader in txtload.asm when loading a .mak file.
;	Ensure that full menus are active because multiple module
;	programs are not allowed with EZ-Menus.  Ask the user whether
;	he would like to activate full menus or abort the load.
;
; Entry:
;	None
; Exit:
;	AX = 0 if load should be aborted, otherwise non-zero
;
;***********************************************************************

;***********************************************************************
; FindNMalloc
; Purpose:
;	Added with revision [6].
;	Called by UI when preparing for MakeExe.  If a QLB is loaded,
;	MakeExe has to make a decision based on the presence and size
;	of an NMALLOC block in the QLB.
;
; Entry:
;	None
; Exit:
;	AX = size of QLB's NMALLOC block (0 if none)
;
;***********************************************************************
cProc	FindNMalloc,<PUBLIC,FAR>
cBegin
	PUSHI	ax,<dataOFFSET sdNMALLOC>
	call	B$ULGetCommon	;ax = 0,bx <> 0 if found,dx = size if bx <> 0
	or	bx,bx		;NMALLOC found in QLB?
	jz	FindNMallocExit ;no, exit with ax=0
	xchg	ax,dx		;yes, exit with ax = size of NMALLOC block
FindNMallocExit:
cEnd

;	Ported from C with revision [7].
;***********************************************************************
;TMC NEAR PASCAL TmcDoDlgFar (lpDlg, cbDlg, hcab)
;
;Purpose:
;
;	Copy far Dlg data into near data to call TmcDoDlg.
;	Used to minimize DGROUP usage.
;
;Entry:
;	lpDlg		far pointer to the dialog structure.
;	cbDlg		byte count fo the structure.
;	hcab		handle of the cab structure.
;
;Exit:
;	returns TmcDoDlg's return value.
;
;Uses:
;	Per convention
;
;Exceptions:
;	None
;
;***********************************************************************
cProc	TmcDoDlgFar,<PUBLIC,NEAR>,<SI,DI>
parmD	lpDlg
parmW	cbDlg
parmW	hcab
	localW	oRsSave 		
cBegin

	mov	ax,[grs.GRS_oRsCur]	; save the current grs.oRsCur
	mov	[oRsSave],ax		; as screen redraw changes it.

bpTitle	EQU	4	; offset of title pointer in dialog structure
				; do a bunch of crap before calling tmcDoDlg
	mov	ax,cbDlg		; CX = dialog image size
	inc	ax			; round up to nearest word
	and	ax,0FFFEh

	DbAssertRel	ax,be,17ch,UI,<TmcDoDlgFar: dialog has grown>	

	; NOTE: if you get this assertion, you must verify that there is still
	; NOTE: enough stack space left in the worst case for the biggest
	; NOTE: dialog, plus a help dialog box.  Currently, the biggest dialog
	; NOTE: is the greeting box, but we have our biggest stack usage when
	; NOTE: doing File/Load, due to COW directory list boxes.

	sub	sp,ax			; allocate space for dialog image
	mov	si,sp			; si = *dialog image
	push	ax			; save dialog image size

					; copy FAR dialog image to stack
	cCall	fmemcpy,<ss, si, seg_lpDlg, off_lpDlg, ax>

	mov	ax,iMsgStatusLine	; AX = current status line message #
	push	ax			; save old status line message

	mov	ax,MSG_StatusDialog	; display dialog box status line
	cCall	StatusLineMsg,<ax>	; draw the new status line

	xor	ax,ax			; AX = 0 ==> no char to restore
	mov	di,szDialogTitle	; DI = *new dialog box title
	mov	cx,di			; CX = *new dialog box title
	jcxz	SaveTitleChar		; brif null pointer -- no new title
	sub	cx,si			; CX = offset of title from dialog
					; 	image start
	mov	[si].bpTitle,cx		; use this new title

	mov	bx,cbDialogTitle	; BX = # chars to use of title
	or	bx,bx			; (NZ ==> menu name needs truncating) 
	jz	SaveTitleChar		; brif no trucation needed

	xchg	al,[di+bx]		; truncate string, AL = old character

SaveTitleChar:
	push	ax			; save old character, 0 if no need
					; to restore

	mov	ax,isaHilite		; isa to Get (and reset later)
	push	ax			; parm 1 for SetIsaColor @@@@
	push	ax			; space for coForeSave (parm #2) @@@@
	mov	bx,sp			; bx = *coForeSave
	push	ax			; space for coBackSave (parm #3) @@@@
	mov	cx,sp			; cx = *coBackSave

	push	ax			; parm 1 for SetIsaColor ****

	cCall	GetIsaColor,<ax,bx,cx>	; save old isaHilite values

	push	ax			; space for coFore (parm #2) ****
	mov	bx,sp			; bx = *coFore
	push	ax			; space for coBack (parm #3) ****
	mov	cx,sp			; cx = *coBack

	mov	ax,isaListBoxHilite	; assume normal highlighting

	cmp	fNoHighlight,0		; highlighting?
	jz	SetHighlight		; brif so -- set it
	mov	ax,isaDialogBox		; no highlighting
SetHighlight:
	cCall	GetIsaColor,<ax,bx,cx>	; get the highlight isa to use

					; SetIsaColor (isaHilite,coFore,coBack)
	cCall	SetIsaColor		; 3 parms pushed at "****" above

				; call COW to put up the dialog
	cCall	tmcDoDlg,<si,hcab>	; actually put up the dialog
	xchg	si,ax			; save return value in SI

				; put things back to normal

				; SetIsaColor (isaHilite,coForeSave,coBackSave)
	cCall	SetIsaColor		; 3 parms pushed at "@@@@" above

	pop	cx			; CL = old menu name character
	jcxz	NoRestore		; brif no need to restore
	
	mov	bx,cbDialogTitle	; BX = # chars of title used
	mov	[di+bx],cl		; restore menu name character
NoRestore:

	pop	ax			; AX = old status line message
	cCall	StatusLineMsg,<ax>	; restore original status line

	pop	ax			; AX = dialog image size
	add	sp,ax			; clean dialog image off stack

	cCall	UiRsActivate,<[oRsSave]>; Restore oRs
	xchg	ax,si			; AX = tmcDoDlg return value
	cmp	uierr,0			; got an error someplace?
	jz	NoUierr			; brif not -- return tmcDoDlg result
	mov	ax,tmcCancel		; got an error -- return tmcCancel
NoUierr:
cEnd

sEnd	UI

	end

⌨️ 快捷键说明

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