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

📄 gwini.asm

📁 [随书类]Dos6.0源代码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;
;#########

labelB	<PUBLIC,b$PATHNAM>	; pathname buffer
globalB b$Buf1,,FILNAML	; 1st large (pathname-sized) scratch buffer
globalB b$Buf2,,FILNAML	; 2nd large (pathname-sized) scratch buffer
globalB b$Buf3,,16		; 3rd scratch buffer
				; these buffers MUST remain contiguous

sEnd	_BSS			


sBegin	RT_TEXT

assumes cs,RT_TEXT

	PAGE

	SUBTTL	Screen initialization

;***
; B$WHOME - Home the text cursor
; Moved here from iotty.asm with revision [60].  See note below!
;
; Input:
;	b$WDOTOP set
; Output:
;	[DL] == home row of cursor
;	[DH] == home column of cursor
; Modifies:
;	NONE
; Note:  
;  IMPORTANT: Must be kept in sync with the local WHOME routine in iotty.asm
;****

cProc	B$WHOME,<PUBLIC,NEAR>
cBegin
	MOV	DL,b$WDOTOP
	MOV	DH,1
cEnd


;***
; B$CRLF - Adust cursor row/column while doing a CR/LF. [61]
; Added with [60].
;
; Purpose:
;	This routine is called every time a CR/LF is to be output
;	to the screen.  It checks whether the screen will need to be
;	scrolled and if not, increments DL.  Flags are set indicating
;	whether or not the screen must be scrolled. DH is set to 1.
;
; Entry:
;	DL = current line
;
; Exit:
;	DH = 1
;	DL = new line
;	ZF ==> didn't change DL, since on last line
;	NZ ==> changed DL, since not on last line
;
; Modifies:
;	None
;****
cProc	B$CRLF,<PUBLIC,NEAR>	
cBegin
	MOV	DH,1		; reset cursor column to 1  
	CMP	DL,b$LINCNT 	; on status line?
	JNE	NOT_STATUS	; brif not -- don't adjust line
	MOV	DL,b$WDOBOT 	; move cursor to bottom
				; line of text window
NOT_STATUS:
	CMP	b$WDOBOT,DL	; Are we at bottom of window?
	JE	NO_INC		; brif so -- ZF ==> last line
	INC	DX		; increment row (NZ)
NO_INC:				; return with flags set
cEnd

;***
;B$SCNCLR - Home Text & Graphics Cursor, Refresh Function Key Display
;OEM-callback routine
;
;	Re-written with revision [54].
;
;Purpose:
;	This routine is used to initialize the screen editor, reset
;	the graphics viewport and window to the screen dimensions,
;	center the graphics cursor, home the text cursor and display
;	the function keys if needed.
;
;	This routine must be called at initialization and whenever
;	screen characters are no longer accessible to the user because
;	the screen dimensions have changed.  This routine should only
;	be called from B$SCRSTT, B$SWIDTH, B$RESETSCN, and during
;	initialization.
;
;Entry:
;	None.
;
;Exit:
;	None.
;
;Uses:
;	Per Convention
;
;Preserves:
;	BX, CX, DX
;
;Exceptions:
;	None.
;****

cProc	B$SCNCLR,<NEAR,PUBLIC>
cBegin

	CALL	B$WHOME			; DX=text cursor home
	MOV	b$CURSOR,DX		; update b$CURSOR
	CALL	[b$vKEYDSP] 		; Conditionally display softkeys
			 		; (displays user cursor at position
					; b$CURSOR when done)

cEnd	<nogen>				; fall into B$VIEWINIT


;		Added as part of revision [30]
;***
;B$VIEWINIT - Initialize viewport, center graphics cursor
;OEM-callback routine
;
;Purpose:
;	Initialize the graphics viewport and centers the graphics cursor.
;	Sets the logical coordinate system to be identical to the
;	physical coordinate system (disable WINDOW command).
;
;Entry:
;	None
;
;Exit:
;	None
;
;Uses:
;	Per Convention
;
;Preserves:
;	AX, BX, CX, DX
;
;Exceptions:
;	None.
;****

cProc	B$VIEWINIT,<NEAR,PUBLIC> 
cBegin				
	CALL	[b$VWINI_PTR]	;Initialize viewport, center graphics cursor
	MOV	B$WNDWSW,0	;Turn B$WNDWSW and B$WNDWSC off
Near_Ret:			;near ret for vectors
cEnd				

;***
;B$SCNSWI - Set screen width(logical/physical) and height
;OEM-callback routine
;
;Purpose:
;	B$SCNSWI will set the screen width (both logical and physical)
;	and screen height.  Since this routine is used to communicate
;	the screen dimensions to the Screen Editor, it must be called at
;	initialization and whenever the character dimensions of the
;	screen are modified.
;
;Input:
;	AL=width, CL=height
;
;Output:
;	None.
;
;Uses:
;	Per Convention
;
;Preserves:
;	AX, BX, CX, DX
;
;Exceptions:
;	None.
;****

cProc	B$SCNSWI,<PUBLIC,NEAR>		
cBegin					

	MOV	b$CRTWIDTH,AL	; Set physical width of screen
	MOV	b$SCRNWIDTH,AL	; Set SCRN: logical width
	MOV	B$LINCNT,CL	;Save physical height
	MOV	b$WDOTOP,1	;Init window top
	PUSH	CX
	DEC	CL		; Reserve status line
	MOV	b$WDOBOT,CL	;Set window bottom
	POP	CX
cEnd				; End of B$SCNSWI


;***
;B$UPCASE - Convert Character to Upper Case
;DBCS-callback
;
;Purpose:
;	Convert the character in AL to uppercase if possible.  If it is
;	not a character or it is already uppercase, it is not modified.
;	This is done by a comparison against the range 'a'-> 'z'.  It does
;	not use the Operating System call to case convert characters
;	outside of this range.
;
;	NOTE:  It is the caller's responsibility to make sure that it is
;	       not sending 1/2 of a KANJI character to this routine.
;
;	WARNING: Because this routine is called by B$GETCH
;
;			  DS != DGROUP
;
;		 If you go to change the code, keep this in mind!!!
;Entry:
;	AL = Character to convert
;
;Exit:
;	AL = UpperCase version of character
;
;Uses:
;	Per Convention
;
;Preserves:
;	AH, BX, CX, DX
;
;Exceptions:
;	None.
;****
cProc	B$UPCASE,<PUBLIC,NEAR>	
cBegin
	CMP	AL,'a'		;Is AL < 'a'
	JB	upret		;Skip it
	CMP	AL,'z'		;Is AL > 'z'
	JA	upret		;Skit it
upit:				
	AND	AL,255-' '	;Convert to Upper Case
upret:
cEnd


;*** 
;B$Mul32x16 -- 32 by 16 bit multiply
;
;Purpose:
;	Added with revision [68].
;
;Entry:
;	[DX|AX] = multiplicand
;	[CX]	= multiplier
;
;Exit:
;	[DX|AX] = [DX|AX] * [CX]
;	CF ==> overflow
;
;Uses:
;	BX
;
;Preserves
;	CX
;
;Exceptions:
;	None
;
;******************************************************************************
cProc	B$Mul32x16,<PUBLIC,NEAR>
cBegin
	xchg	bx,dx		; [BX|AX] = multiplicand
	mul	cx		; multiply low word by 1000 ([DX|AX] = result)
	push	ax		; save low word result
	push	dx		; save first overflow
	xchg	ax,bx		; AX = high word
	mul	cx		; [DX|AX] = result of high word multiply
	pop	dx		; DX = original high word
	jc	Overflow	; brif overflow (need to clean stack)
	add	ax,dx		; AX = high word of result (PSW.C if overflow)
	xchg	ax,dx		; DX = high word of result
OverFlow:
	pop	ax		; AX = low word of result
cEnd

	page


sEnd	RT_TEXT

	END

⌨️ 快捷键说明

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