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

📄 llcscn.asm

📁 Microsoft MS-DOS6.0 完整源代码
💻 ASM
📖 第 1 页 / 共 3 页
字号:
	TITLE	LLCSCN - GW-BASIC Core Screen Interface
;***
; LLCSCN - GW-BASIC Core Screen Interface
;
;	Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
;	This file contains code for screen manipulations that is needed
;	for all programs.
;
;*****************************************************************************
	INCLUDE switch.inc	;switches
	INCLUDE rmacros.inc	

	USESEG	_DATA		
	USESEG	_BSS		
	USESEG	CN_TEXT 	
	USESEG	CONST		
	USESEG	GR_TEXT
	USESEG	RT_TEXT 	

	INCLUDE seg.inc 	
	INCLUDE oscalls.inc	
	INCLUDE idmac.inc	
	INCLUDE intmac.inc
	INCLUDE llgrp.inc
	INCLUDE ibmunv.inc

sBegin	_BSS

	externB b$Adapter	
	externB b$ScrHeight


	externB b$OrgEquip	
	externB b$BiosMode	
	externB b$ScreenMode
	externB b$Burst
	externB b$ScrWidth
	externB b$MaxPage
	externW b$OrgScrBst	
	externW b$OrgScrDim	
	externW b$OrgCsrTyp	
	externW b$OrgPages	
	externB b$KEY_SW	
	externW b$SetMode
	externW b$AlphaDim
	externW b$PalReset
	externW b$SetPages

;***
;b$ScreenRestored - Flag to indicate that the screen mode has been changed
;OEM-interface routine (variable)
;
;Purpose:
;	This flag is used to signal the interpreter that we have changed
;	the screen mode in B$RESETSCN.	The interpreter UI uses it during
;	RUN time initialization to decide if it needs to throw away its
;	saved image of the user output screen.
;
;	This variable is only needed in a version of the runtime that
;	supports the QB Interpreter.
;
;Allocation:
;	b$ScreenRestored is a BYTE value declared in the _BSS segment
;	by the OEM.
;
;Values:
;	0 - Screen Mode did not change
;	1 - Screen Mode changed
;
;
;Initially Set:
;	This variable is initialized to 0 with the rest of the _BSS segment.
;
;Modified By:
;	The variable should only be modified by the runtime during execution
;	of the routine B$RESETSCN.  It may be modified by the Interpreter
;	at any point.
;
;Used by:
;	b$ScreenRestored is used by the interpreter for screen management.
;****
globalB b$ScreenRestored,,1	;non-0 if screen changed in B$RESETSCN


sEnd	_BSS


sBegin	_DATA

	globalW b$CSRTYP,-1,1	; CURRENT cursor type (start and stop lines)
				; Low byte = -1 if actual cursor type is
				; unknown.

;***
;b$CurPages, b$ActPage - Display pages
;OEM-interface routine (variable)
;
;Purpose:
;	b$CurPages contains the current active and visual display
;	page.  The visual display page is also accessible by the
;	variable b$ActPage.  The high byte of b$CurPages is the
;	number of the current visual page and its low byte is the
;	number of the current active page.
;
;	This value is only used by OEM independent code during termination
;	when trying to display the message "Hit any key to return to system".
;	When this is done, we have to make sure that the message gets
;	displayed on the visual page.  To do this, we copy the high order
;	byte of b$CurPages (the visual page) to b$ActPage.  A call to
;	B$GETCSRDATA is then done to get the cursor position of the
;	(possibly new) active page. After displaying the message, the visual
;	page is restored by another change to b$ActPage.
;
;	One major effect of this use of b$ActPage is that the OEM-dependent
;	code has to be written such that it can handle an asynchronious
;	change to this variable.
;
;Allocation:
;	b$CurPages is a WORD value declared in the _DATA segment
;	by the OEM. b$ActPage is a BYTE value.	It is the low order
;	byte of b$CurPages.
;
;Values:
;	The values of the two halves of b$CurPages are dependent on
;	the current screen mode and the hardware installed in the
;	computer.
;
;Initially Set:
;	The OEM-Dependent code is responsible for initially setting
;	this variable. It must be initialized such that, at termination,
;	if the active display page is not the visual display page (as
;	indicated by b$CurPages (HI) != b$CurPages (LOW)), changing
;	the value of b$ActPage will be sufficient to indicate that the
;	pages must be changed.
;
;Modified By:
;	By OEM only, except during termination as noted above.
;
;Used By:
;	OEM and termination code.
;****

labelW	<PUBLIC,b$CharPage>	;b$CharColor and b$ActPage in one word
	globalB b$CharColor,7,1 ;encoded color attributes for character
labelW	<PUBLIC,b$CurPages>	;b$ActPage and b$VisPage in one word
	globalB b$ActPage,0,1	;active display page
	globalB b$VisPage,0,1	;visual display page

	externW b$CurrPSize	;Current page size in paras
	externW b$UsrCsrTyp	; user-defined cursor


globalW b$ScreenX,<OFFSET DGROUP:ScreenTb>,1 ; Indirect pointer to screen mode table
				; in DGROUP

labelW	ScreenTb		; mode-dependent SCREEN set-up
	DB	0		; Maximum screen mode (default=0)
	DW	B$Screen0

	externW b$CURSOR
	externW b$vKEYDSP	; vector for indirect call to B$KEYDSP
	externB b$UsrCsrStart	; user-defined cursor start line
	externB b$UsrCsrStop	; user-defined cursor stop line
	externW b$InsCsrTyp	; insert mode cursor (init to 1/2 block)
	externB b$InsCsrStop	; insert cursor stop line
	externW b$MapXYC	
	externD b$AddrC 	
	externB b$ForeMapped	
	externB b$WDOTOP	; top line of text window (1-relative)
	externB b$WDOBOT	; bottom line of text window (1-relative)
	externB b$CRTWIDTH	; rightmost column (1-relative)
	externB b$NullColor	;encoded color attributes for blank/_BSCROLL
	globalB b$UsrCsrOn,0,1	; user cursor status (1=on, 0=off)
	globalW b$pOgaCsr,B$NearRet ; pointer to Olivetti version of GRPCSR

sEnd	_DATA

OffCsrTyp EQU 2707H		; valid cursor start and stop lines, with
				; bit 5 set to indicate cursor off



sBegin	GR_TEXT
externNP B$Screen0
externNP B$FixTextPage				
sEnd	GR_TEXT

sBegin	CONST			

	staticB BLTLOT,0,4	;Half Box Character
	staticB ,255,12 	;Whole Box Character

sEnd	CONST			



sBegin	RT_TEXT 		
	externNP B$GRMODE	
	externNP B$VIEWINIT	
	externNP B$ChkMonitor	; set VGA mono/color monitor

sEnd	RT_TEXT 		


sBegin	CN_TEXT 		
	assumes CS,CN_TEXT	



;=============== Code from here to next marker moved from LLSCNIO.ASM

	externNP B$OutWord

	externNP B$SCINIT	; Delayed screen initializer
	externNP B$SCNSWI
	externNP B$ERR_FC
	externNP B$SCNCLR
	externNP B$NearRet	; a public NEAR RET
	externNP B$SetAdapter





;***
;B$SCNIO
;
;Purpose:
;
;Entry:
;
;Exit:
;
;Uses:
;
;Exceptions:
;
;****
cProc	B$SCNIO,<PUBLIC,NEAR>
cBegin
	SCNIO			;Screen I/O saving: BP,DI,SI
cEnd


;***
;B$SELAPG - select active page
;B$SELVPG - select visual page
;
;Purpose:
;	Set the current BIOS active page to be either the page number in
;	ActPage (for B$SELAPG) or VisPage (for B$SELVPG).
;
;Entry:
;	b$ActPage
;	b$VisPage
; WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
; WARNING!                                                       WARNING!
; WARNING!		 DS may not always = DGROUP		 WARNING!
; WARNING!                                                       WARNING!
; WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
;Exit:
;	[AL] = active page
;Uses:
;
;Preserves:
;	BX,CX,DX
;
;Exceptions:
;	none
;
;******************************************************************************

cProc	B$SELVPG,<PUBLIC,NEAR>
cBegin
	MOV	AL,SS:[b$VisPage]
	JMP	SHORT SELPAG
cEnd	<nogen> 		;End of B$SELVPG

cProc	B$SELAPG,<PUBLIC,NEAR>
cBegin
	MOV	AL,SS:[b$ActPage] ; [al] = active page #
SELPAG:


	PUSH	DX
	MOV	DX,SS:[b$CurrPSize] ;Get page size (set by B$SCRSTT) in paras
	SHL	DX,1		; Make it byte count
	SHL	DX,1		; * 4
	SHL	DX,1		; * 8
	SHL	DX,1		; * 16
	XOR	AH,AH
	PUSH	DS		; save current data segment
	PUSH	AX		; save new active page number
	MUL	DX		; [ax] = page No. * page size
	MOV	DS,DX		; [ES] = 0, since [DX] = 0 after multiply
	MOV	DS:CRT_START,AX ; store active page offset
	POP	AX		; restore page number
	MOV	DS:ACTIVE_PAGE,AL ; and store it in BIOS data area
	POP	DS		; restore data segment
	POP	DX
SELPAX:

cEnd				;End of B$SELAPG/B$SELVPG


;***
;B$GETCSRDATA -- Get current cursor position and type.
;OEM-interface routine
;
;Purpose:
;	Returns in DX the current screen cursor position and cursor type
;	for the current active page as reported by BIOS/VIO.  The cursor
;	type is returned with the low order byte containing the stop line
;	and the high order byte containing the line of cursor block in
;	which to start the cursor.
;
;	When in a graphics mode under OS/2, the cursor position returned
;	is the last cursor position (b$CURSOR), and the type returned in
;	CX is invalid.	Note that under DOS, the cursor type must always
;	be a legal even when bogus values are returned from DOS (i.e.
;	for a graphics screen).
;
;Entry:
;	None.
;
;Exit:
;	DX = Current screen cursor position.
;	CX = Current screen cursor start and stop lines.
;
;Uses:
;	Per Convention.
;
;Preserves:
;	AX, BX
;
;Exceptions:
;	None.
;**********************************************************************
cProc	B$GETCSRDATA,<PUBLIC,NEAR>,<AX,BX>
cBegin
	MOV	BH,b$ActPage	;return cursor for current active page
	SCNIOS	vReadCursorPos	; get cursor position and type from BIOS
	INC	DX		; make row 1-relative
	XCHG	DH,DL		; want row in DL, column in DH
	INC	DX		; make column 1-relative

	CMP	CH,CL		; is cursor type read valid? (CH <= CL)
	JBE	CURSOR_OK	; brif so
	MOV	CX,b$UsrCsrTyp	; return a known cursor
CURSOR_OK:
	MOV	BYTE PTR b$CSRTYP,-1 ; invalidate low-level current cursor
				; type so it will get reset.
cEnd


;***
;B$SCNLOC - Locate cursor on physical screen, saving new coordinates
;OEM-interface routine
;
;Purpose:
;	Moves the cursor on the screen and save the final location
;	in b$CURSOR.  The coordinates are 1,1-relative to the physical
;	screen.  The cursor is displayed only if it is currently visible.
;
;Entry:
;	DH=column, DL=line (1,1 is home)
;
;Exit:
;	Updates b$CURSOR.
;
;Uses:
;	Per Convention
;
;Preserves:
;	BX, CX, DX
;
;Exceptions:
;	None.
;****
;***
;B$OFFCSR, B$OVWCSR, B$INSCSR, B$USRCSR - Set Cursor Type and Location
;OEM-interface routine
;
;Purpose:
;	These routines display the appropriate cursor at a specified
;	location as given by the input parameters.  A request can also
;	be made to not display a cursor.  There are currently three
;	different types of cursors that are used, User Cursor, Insert
;	Cursor, and Overwrite Cursor.  The user cursor, which can be

⌨️ 快捷键说明

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